[PATCH] arm64: dts: rockchip: enable NPU on ROCK 5B/+

From: Nicolas Frattaroli
Date: Tue Jun 03 2025 - 11:03:10 EST


The NPU on the ROCK5B uses the same regulator for both the sram-supply
and the npu's supply. Add this regulator, and enable all the NPU bits.
Also add the regulator as a domain-supply to the pd_npu power domain.

The 5B+'s regulator setup is identical to the 5B in this regard, so it
goes in the shared .dtsi.

Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>
---
.../boot/dts/rockchip/rk3588-rock-5b.dtsi | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dtsi
index 51e83f0ed809..5a20cc2555fb 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dtsi
@@ -332,6 +332,29 @@ regulator-state-mem {
};
};

+&i2c1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1m2_xfer>;
+ status = "okay";
+
+ vdd_npu_s0: regulator@42 {
+ compatible = "rockchip,rk8602";
+ reg = <0x42>;
+ fcs,suspend-voltage-selector = <1>;
+ regulator-name = "vdd_npu_s0";
+ regulator-boot-on;
+ regulator-enable-ramp-delay = <500>;
+ regulator-min-microvolt = <550000>;
+ regulator-max-microvolt = <950000>;
+ regulator-ramp-delay = <2300>;
+ vin-supply = <&vcc5v0_sys>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
+ };
+};
+
&i2c3 {
status = "okay";
};
@@ -521,6 +544,10 @@ &pd_gpu {
domain-supply = <&vdd_gpu_s0>;
};

+&pd_npu {
+ domain-supply = <&vdd_npu_s0>;
+};
+
&pinctrl {
hdmirx {
hdmirx_hpd: hdmirx-5v-detection {
@@ -585,6 +612,36 @@ &pwm1 {
status = "okay";
};

+&rknn_core_top {
+ npu-supply = <&vdd_npu_s0>;
+ sram-supply = <&vdd_npu_s0>;
+ status = "okay";
+};
+
+&rknn_core_1 {
+ npu-supply = <&vdd_npu_s0>;
+ sram-supply = <&vdd_npu_s0>;
+ status = "okay";
+};
+
+&rknn_core_2 {
+ npu-supply = <&vdd_npu_s0>;
+ sram-supply = <&vdd_npu_s0>;
+ status = "okay";
+};
+
+&rknn_mmu_top {
+ status = "okay";
+};
+
+&rknn_mmu_1 {
+ status = "okay";
+};
+
+&rknn_mmu_2 {
+ status = "okay";
+};
+
&saradc {
vref-supply = <&avcc_1v8_s0>;
status = "okay";
--
2.49.0






Return-Path: <linux-kernel+bounces-675544-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7B38141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:22:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3A3C47AB512
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:20:42 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D56FC286897;
Fri, 6 Jun 2025 09:21:39 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A9B942857F8;
Fri, 6 Jun 2025 09:21:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749201699; cv=none; b=n2JP8YQ94A+OMrk6qe8APVBvj77f9jETnBbI52fCvRDg0QOmvgZpyRC2tAqKdKuaA0auWWwSa0F629Q8RxaKmaJLzI2VP/C/QdtkkvY+RxWkOnoVaanTbJEwbSImaP9M4AQqpXkt1pgmlRsxVB2E0DyPThO0uBs3vuefQHFqOSw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749201699; c=relaxed/simple;
bh=JNII4LjXiJAVTUR4XLq+TZLkG3dqk5KWt6XmBuCspDQ=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=BZvDf21LAr/A+d8t0zrXSVEeLtDyCTG6VwL5KHzGDnQs+sSOhc7pDgybXAhozXFnNG5fB+ZwXnVeNxLr8nMAL6M7r3a8tOBBVG+/2gM1958IScQ1QAgMnShN4qoG74VNykwfeaM+unSWbe6aHAySHDY/8wB6UHHL+QpxXjlkfjg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C2C94153B;
Fri, 6 Jun 2025 02:21:16 -0700 (PDT)
Received: from bogus (e133711.arm.com [10.1.196.55])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A85D33F59E;
Fri, 6 Jun 2025 02:21:32 -0700 (PDT)
Date: Fri, 6 Jun 2025 10:21:29 +0100
From: Sudeep Holla <sudeep.holla@xxxxxxx>
To: Lukas Bulwahn <lbulwahn@xxxxxxxxxx>
Cc: Cristian Marussi <cristian.marussi@xxxxxxx>,
Sudeep Holla <sudeep.holla@xxxxxxx>,
Ulf Hansson <ulf.hansson@xxxxxxxxxx>, arm-scmi@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx,
Javier Martinez Canillas <javierm@xxxxxxxxxx>,
kernel-janitors@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Lukas Bulwahn <lukas.bulwahn@xxxxxxxxxx>
Subject: Re: [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter
Message-ID: <20250606-charming-aloof-adder-8acc6d@sudeepholla>
References: <20250606090802.597504-1-lukas.bulwahn@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606090802.597504-1-lukas.bulwahn@xxxxxxxxxx>
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 11:08:02AM +0200, Lukas Bulwahn wrote:
> From: Lukas Bulwahn <lukas.bulwahn@xxxxxxxxxx>
>
> There is no need to introduce the boolean power_on to select the constant
> value for state. Simply pass the value for state as argument. Just remove
> this code clutter.
>
> No functional change.
>

Nice cleanup. Thanks for doing this.

Reviewed-by: Sudeep Holla <sudeep.holla@xxxxxxx>

Ulf,

I assume you will pick this up when you start collecting patches for
next merge window.

--
Regards,
Sudeep


Return-Path: <linux-kernel+bounces-675545-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1E82841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:22:47 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5D8DB164945
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:22:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DC0427468;
Fri, 6 Jun 2025 09:22:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="F+JIz3Dd";
dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="F+JIz3Dd"
Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010036.outbound.protection.outlook.com [52.101.84.36])
(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 9900041C64
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:22:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.84.36
ARC-Seal:i=3; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749201757; cv=fail; b=GMrFULEHf2RoU11hGOnFAkUFpMODQQPBK/poUmqBXySbLGSjqyfhFVRvgNxCJvh0AdcYKA+zkE5QRJ3a3QK6T2G9XRfxvuojWGdSqdKGc8xfYiREVnXiyUyRWHVDrLy26w8r82MuwJ9lK1CimiUJvSFW3k0q+pbf2XTNwiZOk4Q=
ARC-Message-Signature:i=3; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749201757; c=relaxed/simple;
bh=VL7jvAhjkcxO4dn2CaaT6bbSTahXuefgqYXMPAjtUjk=;
h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To:
Content-Type:MIME-Version; b=tQ0AwFncw9AG9147GIDOZejY0fQ3YL8V7sCbNV+DZeLKOzul5bWeqAwKl10JajJVkVNX6L9dASyLOwQ2I/bA28uELbYSghaIU6E+Bk5h1UjjPl6KZ30HpBoWSQ1yhuItswmXPK5AGDbbNXv9p73FhN0/Veml0uZ/Dx58BFwjt7s=
ARC-Authentication-Results:i=3; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=F+JIz3Dd; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=F+JIz3Dd; arc=fail smtp.client-ip=52.101.84.36
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass;
b=w2r8u9RyTX3s7R9yqyX5dtjn+MlHUG+hp8B+6c/Pxe+tPOx0FvFYreylGoTvXAscpIW/jXvL6IEAWmZKwEX/Za+YumW5rQ7ereeSp1hcqoLXAneAbj102phmS9QOhI/u4ALIMWJ+ja929t8LslKUktemWTXBBQ0X5bqHzf6/LoUKfwwXKfzo+46Jz1HsdDgyql5thsJWp6vVuNHt33nfg0z3nT7i8aW154GaVcuCF4BnNEDrj8ST7ZbQo7bkrWQlLZTSUizS2KffDKHOh4zOV2/2LAxiQiOosIFX/0QMbjubnrGnysdxNeTx1Tr8CNo3jK9OHdnEahL3kR059WWDrQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=XzyOLrSj4sOD0rXwwl5QZNhZ18RmD7TcQiyUy4mxTeg=;
b=cryWp5wFfUxYGnxD97eu2VoDx6M3UsVfua2lEzKXqwpah96udrz2ADZtHPBUw4QjjQz4DTSyijLbO9x5VvkHNnxYC2ZM+oLdPv4vhmjU+NpbQ9amhYhvB9otGfZAAqjPniS0COFMZz3Tkt0qeXSU+hfb2eD60GjN4XIMYtoL7YP52uycVFwEOOe2z4CUaTXEvmExzLT4AgWL0OiKUsqW0Rf7vd9/Yj3rwbDddFijFDJUMY3naBZNjEhfkA9CmEXAylsXR/Z3gPsjZKqMfawjfmj/XArlfvZT2n7Vtwuxz7RNwFa4KqkkVwksNyDksx8Dsuf0vsbfzT+diUiAFngDyQ==
ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is
4.158.2.129) smtp.rcpttodomain=oracle.com smtp.mailfrom=arm.com; dmarc=pass
(p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass
(signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1
spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com]
dmarc=[1,1,header.from=arm.com])
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=XzyOLrSj4sOD0rXwwl5QZNhZ18RmD7TcQiyUy4mxTeg=;
b=F+JIz3DdbMeS3sQdJyR8ulNJUbqO9KTeKuypVEwlfgzXflFi1Z3aHEF3YZ2KlrN0X2lkJumLTzc+t2aHnT4y3Y7yaAqLIux2v2BfEAwSyYDLLJTLAGnSMMV9AGcKY/lzhGeJD/+tHfRCasqobez0+xP48opCRfmnoX/UezqG7nY=
Received: from PAYP264CA0016.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:11e::21)
by DB9PR08MB7745.eurprd08.prod.outlook.com (2603:10a6:10:394::7) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.20; Fri, 6 Jun
2025 09:22:29 +0000
Received: from AMS0EPF000001B1.eurprd05.prod.outlook.com
(2603:10a6:102:11e:cafe::5f) by PAYP264CA0016.outlook.office365.com
(2603:10a6:102:11e::21) with Microsoft SMTP Server (version=TLS1_3,
cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.28 via Frontend Transport; Fri,
6 Jun 2025 09:22:29 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129)
smtp.mailfrom=arm.com; dkim=pass (signature was verified)
header.d=arm.com;dmarc=pass action=none header.from=arm.com;
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates
4.158.2.129 as permitted sender) receiver=protection.outlook.com;
client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C
Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by
AMS0EPF000001B1.mail.protection.outlook.com (10.167.16.165) with Microsoft
SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.29
via Frontend Transport; Fri, 6 Jun 2025 09:22:28 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=R/AiT06ldf8wp+05s24AYjh9UYzTOmrCfC2rXqKnYwTpBggi1ODEwmbZG3gdiuKq7MIwAC6PWhvufZZ3WsyofnLxxX4LO7/OeSIVxmHfJ114C48VZfJRny5HQQWLiCGzX64fw/FwEO/D99uPQFJX7o+VZbLztphnaaM2UHHy+CpKYonS8n42g0uBqpCWBcRLt3LZs+ReVbSc/qj/z3PSOs5zk4cb0ORlVEXj6GJZ9+3tLDreFQvvAvl8cMQDCN8lzqWzztmEosqWV5Pj6ZP9N8VczUT8o82XeaD1MJLWCdx/IABJ9iOGMYm3J8KAVoWrBEeXI4OEUmvOCLQRgV3VDw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=XzyOLrSj4sOD0rXwwl5QZNhZ18RmD7TcQiyUy4mxTeg=;
b=dDrKVcouk/wQ6noYu6Z/aijutf/ygbhbQBtOk4LhcWhgnDWPjlG19KBFngtNi1ilcT7Mu5914YDMoZwFWOIcVF8c/ko9zbPHApDEQ4mW9dyf1jqwuZxHdBjLtJG198GgWoPZIEBuUEOs4LmLTrROIZRDOgiqeTt6lUCWwNC/BnhHlJbVzdYct9Esj/H1YMPeATc97+4quhSItrbOaqbt30cqfNScQbMHh+wUZsWTW4kAbtAR7QjwRlqJZNIWtu/kJv0+nBna5/zAvcgeA7zFCoDbv76AAVsL+GhCOfK8liKrHHZ+rBQqYv3ez0Cs35OQzVEs1SyVZZ2nC4JAQ7n1wg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass
header.d=arm.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=XzyOLrSj4sOD0rXwwl5QZNhZ18RmD7TcQiyUy4mxTeg=;
b=F+JIz3DdbMeS3sQdJyR8ulNJUbqO9KTeKuypVEwlfgzXflFi1Z3aHEF3YZ2KlrN0X2lkJumLTzc+t2aHnT4y3Y7yaAqLIux2v2BfEAwSyYDLLJTLAGnSMMV9AGcKY/lzhGeJD/+tHfRCasqobez0+xP48opCRfmnoX/UezqG7nY=
Authentication-Results-Original: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=arm.com;
Received: from AM9PR08MB7120.eurprd08.prod.outlook.com (2603:10a6:20b:3dc::22)
by DBBPR08MB6203.eurprd08.prod.outlook.com (2603:10a6:10:201::6) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 09:21:55 +0000
Received: from AM9PR08MB7120.eurprd08.prod.outlook.com
([fe80::2933:29aa:2693:d12e]) by AM9PR08MB7120.eurprd08.prod.outlook.com
([fe80::2933:29aa:2693:d12e%2]) with mapi id 15.20.8813.018; Fri, 6 Jun 2025
09:21:55 +0000
Message-ID: <ecfed817-105d-487f-80ba-52965f926c1e@xxxxxxx>
Date: Fri, 6 Jun 2025 14:51:48 +0530
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/3] mm: Allow pagewalk without locks
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: akpm@xxxxxxxxxxxxxxxxxxxx, david@xxxxxxxxxx, catalin.marinas@xxxxxxx,
will@xxxxxxxxxx, Liam.Howlett@xxxxxxxxxx, vbabka@xxxxxxx, rppt@xxxxxxxxxx,
surenb@xxxxxxxxxx, mhocko@xxxxxxxx, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, suzuki.poulose@xxxxxxx, steven.price@xxxxxxx,
gshan@xxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
Jann Horn <jannh@xxxxxxxxxx>, Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>,
Ryan Roberts <ryan.roberts@xxxxxxx>
References: <20250530090407.19237-1-dev.jain@xxxxxxx>
<20250530090407.19237-2-dev.jain@xxxxxxx>
<6a60c052-9935-489e-a38e-1b03a1a79155@lucifer.local>
Content-Language: en-US
From: Dev Jain <dev.jain@xxxxxxx>
In-Reply-To: <6a60c052-9935-489e-a38e-1b03a1a79155@lucifer.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: MA0PR01CA0037.INDPRD01.PROD.OUTLOOK.COM
(2603:1096:a01:81::7) To AM9PR08MB7120.eurprd08.prod.outlook.com
(2603:10a6:20b:3dc::22)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-TrafficTypeDiagnostic:
AM9PR08MB7120:EE_|DBBPR08MB6203:EE_|AMS0EPF000001B1:EE_|DB9PR08MB7745:EE_
X-MS-Office365-Filtering-Correlation-Id: 6809bed0-35ab-4008-4907-08dda4dba8a3
x-checkrecipientrouted: true
NoDisclaimer: true
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam-Untrusted:
BCL:0;ARA:13230040|1800799024|366016|7416014|376014;
X-Microsoft-Antispam-Message-Info-Original:
=?utf-8?B?T2pESTZkTTVZNHlFUnBGQVZ5aGVIWnJsQlJaTHJMWkNTOUVjNHdBRGJSVDlj?=
=?utf-8?B?alRPSWpseEVvVUF2d2d6K21sL1QyQ0ZQUGhuek0yczEzSHJjZHZ0aER3eGdJ?=
=?utf-8?B?OWpOWEYvMnJwRk5SbUIycWpZTFUvdkRyUmpJMTZUSjJIcHBGVVlzZmx3NjRG?=
=?utf-8?B?TjVZam5UeVhaSGExT3g1ZWNMem05cUkralBuZWVhUGxYYWRRS2QvZmpDWXNP?=
=?utf-8?B?NXZOR2FINkhwTnR4VkV2YlJHSG1tNE5CU2tOWTZKQVo0V2ZPVDFYVUNlNVIx?=
=?utf-8?B?UDJHdmFLVVp1MVFnTHZhOGErdkJVaHZUSWM4MG9rKzEwRmgrSklweURkaWNx?=
=?utf-8?B?OWJOdm1HS040RDdicG8wb2ZDcEg0RDBYS0U1OTkwM0ZwcU4vSU1ZOXloSTFX?=
=?utf-8?B?OTdqclF0cmZNSXZXNzVJT0l0U1NFREVOL1ZOZ1ZMc2NyU3JzWW40TEJ1bHBZ?=
=?utf-8?B?c3ZWVGtHMUVIRjh2UXdIRnZLaE05KytpVklyanZMNVRhdUhTaityVFRKWktx?=
=?utf-8?B?V0JEVVdIaFY1NXZzNmZIQW85MU9Yc2lKQTNFUVAyQ2RLVG5uWHFGZEU4UFA5?=
=?utf-8?B?MWtBQlJNdVhnRzVZY0N2V1BmUE1EbGpJRVhJcTF3Rm1aK3M0cmJ3dWVSZ3Iw?=
=?utf-8?B?bHB2NTQrNlZDdm5sQVY0UHlYT1dZMFlpZitTVzcwYkJNRWVOZVc1SWxJMnI2?=
=?utf-8?B?dFBFYlhGVkNqWjlUT2tveXFwTzNOMUo2cENKSFJ2ZHZYaUh1WEw3ZU04SWRr?=
=?utf-8?B?L3QyVEVNYWVYUzRBL0xsQXZmZDRubWkxYkNjdTlvMDFldHpqUzhCQjJJTXlv?=
=?utf-8?B?L0FvdXJVNDBJREVMdmRlTmxvTzdneE53RWYwNGFERkRGbXIzNTlrSFNXM3Fr?=
=?utf-8?B?aHMxZEk4V0V3eWlMZFZ6cXdyQ0Y1OUwvMzgrQkFxdFN1SnlORnoyd25LYUN2?=
=?utf-8?B?aVZ3YVI1V09TRk03ZmY1ZUxuNnFNTnFGZXh1QUZIdWl3OXFMUUN5cW50Tzkw?=
=?utf-8?B?bWpOSlM3cmJtWHJiOWE0VFFlSEs2SzdKTDJ0cW05eDdMc0RRcDI3cVpBQVBr?=
=?utf-8?B?eEdlSlNIbDRuY1dqTE1FL3ZIRVQwYTg1dk5GNnA3dkJleEE0b3lLTThWbDZl?=
=?utf-8?B?S2hIaUxTQzgxZ0N3WU81RU1FcWM4Ry81Sks3Z1RXTk9hekJONDkrM013eUI0?=
=?utf-8?B?dUwrVFkrS1dOMWJBdmtmTnVmRHIyVUZ2c25Fa2U0em45ZGJ3OFQ0VUpnK3hK?=
=?utf-8?B?ZUYzOHhvZURKd1ZtOCtjeUd1enhGSU1kV2p3WmJ3TzVxNlBHQnduWWJWb2NL?=
=?utf-8?B?endJRGl3dGNzR3g3NUJSTVE1cWI5TGtTMUhYa2tRbEU2YUlJSmljcno4NUFD?=
=?utf-8?B?bG5kdzJWTjl4QUJpUHFmdE9sZWRIRWNMNWxmbjB4amJDZEd4c1NzUmpSbkNY?=
=?utf-8?B?aHRSMjUvQWpMV3VJbTBDSXovbWUxeWdoODJjUnp2QUNqU0kxKzhaaHFkV0E2?=
=?utf-8?B?VmwvaWVoNHJkZURWV0pZVFdXNjVEK2hMQXNZVDNUM0IvR3AxR3llNTFPOGtD?=
=?utf-8?B?UEtGcmVxN3lLQ3pPdEczOEZ6K3hFT0VxU0RLMk1BMHdyVzFWUHFWbVpHeURJ?=
=?utf-8?B?eUVmYjZRcXFpRE8yY2RQK3l0MElWQXdRZFE1ejFyRGFldEVsZjJyZUF2N3Vs?=
=?utf-8?B?dzg3OWx1M21RalcvMzJhVUZFdW8xRkd3NUFnb0hNVjFreWU2NXhteS81TXBM?=
=?utf-8?B?R3VEOVQyelRVQzk3aTUyU28ybkx0ZUF0OGoxK2wxU0hYa1oyOEhVWENyU2ww?=
=?utf-8?B?eENSbjF5WGlZZmxNZmkwcVkzdVA4TEZHSmlxMkk2U2UzRHVJVlg2QjVCQzlj?=
=?utf-8?B?TGxidzZDVEh6cmpCYWJlZkk3TThEdjIweEZiVGxZNDVCMW5EakU4OFVneFdF?=
=?utf-8?Q?2qy9AS0pv9M=3D?=
X-Forefront-Antispam-Report-Untrusted:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR08MB7120.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(7416014)(376014);DIR:OUT;SFP:1101;
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6203
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
AMS0EPF000001B1.eurprd05.prod.outlook.com
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id-Prvs:
815308f6-a899-46bd-281f-08dda4db9470
X-Microsoft-Antispam:
BCL:0;ARA:13230040|35042699022|1800799024|14060799003|376014|7416014|82310400026|36860700013;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?YlFJcFU5Ym9oM0QvU3E5b1owbW1Pc0dlQlRIR2xTRlJMb2ZYSGdoSDNQUXpW?=
=?utf-8?B?R0VROTFzTnZPdGY3ZzVQY2d3V2F3VUIyYXc0VG8vQkZKRkhYajMrTWQ3L2dC?=
=?utf-8?B?ZDZSdjI3NHJoc2kyTytuSkpVWmRXQW4ySHplalFsMks4T2VoU3pHU0VwMUJu?=
=?utf-8?B?S0xNYUVuWlVtNnlWNnB1QWtOaTRub3pMTytxK0puc0lPYTBMZlJmYlRMaFc0?=
=?utf-8?B?b3NBSGNxZGxqT3BtL29OZ3dLK0lVdFFaRTBZWWFXcmFqOGNESTFpKy95QUNu?=
=?utf-8?B?WFZCd0k4RGtIdy9YRFVISU85K2xHNisvdUx6UTB3REhsRHgraXpoVGRQTGky?=
=?utf-8?B?OEU1WTg0QWQ5dHpNNk8xNFB5dmZxTmlQNnN0MXVQQ2szN1p5aUtpb2JFTVZ6?=
=?utf-8?B?QXdYVExGQ0FzY0t3VHR4ZGVieUs3eENjc0R5MHpadXdVYjhkMi9OS2k3S2ky?=
=?utf-8?B?UENrUjY5MEdUK0FqWmlZc0lJWkU1anRCSENDMGhzdFo4YkYwOVJ5clhidDQr?=
=?utf-8?B?ZWptemFHbXR2Q2pJZ0lHdVFRaFM2Z2g2K1N6VWI1Uy83MnA3VCsrK0RDSEVG?=
=?utf-8?B?UWdIemZHZmoyTW13TlBKenVuMGIyd2JHT0pSblp1MFFqempkenlYRHVqeGpV?=
=?utf-8?B?bkRKdEpCaVU0NTJsRVN5MVh3Wmc4Y2VHQ1VzUlN0V2t6c2tlR3psOUpxdjBT?=
=?utf-8?B?d3Rxd0JXOHEyODlpUlh0Slh1Q3hWUEZLMWd0TjdCcGlHTG9KUjVIK1ZvN0o1?=
=?utf-8?B?aWljbGJyZ1Jpa1BKWTlEN1R3SXNpdlRrUXY2Vi92SlFUUUk1VEhJdXlCQ2pK?=
=?utf-8?B?cEhPRGVMYnpvOFpYWkJYSnpKMldNUitGZ3M1eXF1RlJjRFFVZlBqRUF4OGdG?=
=?utf-8?B?WXFGNDRxWjgwOTdtRldBeGxUMDBtL0tzN0xMUWtVMUtYak50OFc1dGFJTG1y?=
=?utf-8?B?S0I1N3lmV1FwRE1ycmRzZGlPb1VkN3ZBN1BCTUFWTDAwS2ZISFNtY0tYSUhM?=
=?utf-8?B?RmZYTjVMQnh5TFJUN0pWNDFod3djUmFaMXRVQ3JOd0V6eGJaUGloL1FDY2lm?=
=?utf-8?B?U1IzTFVkRURJVStPUmVBV0tWU0wzNytHTjdyb2Z2ZEJJSzBpcVlTVlZLN0NQ?=
=?utf-8?B?Qkk5MHdnQjAyOFowdlF0c2ZsV054RXZ2by9ITVh4b3NLMlFDUjgzQ0poQWM2?=
=?utf-8?B?QmN2VEE5UjJUNjVPZ01IQlBTOTdFUDJLdGVNa3FyVE5FSDhYK2FYMkt4b2hp?=
=?utf-8?B?ZE5MN21aREkrWHFSWHVWK08zRkFOTWFRV3FCOXllR0p3YkVrQ2JaRzlvT3lq?=
=?utf-8?B?RDA2RU9NL0YzQkR6c05BTTgzNFl2Z3M0QkFzTGRRektPV2dnNlc2YStuYU1T?=
=?utf-8?B?Qm5zVTRaTUhxRElMdnNQVW5CN3djdzlYdUx3b2xOdUllYjdrbGlPcW8ybEIw?=
=?utf-8?B?TlVTUVRGVXk0MXR3Ny9hNnhzQ3FNY0ZGQjZ4RkkvaDF5NnpGb0tnWFdramwv?=
=?utf-8?B?Q1ZZbHNjTlNUekd1NE9ISVJPVnY1S05pcXBORXlMOVNvM0V6cE1BdkdiOEla?=
=?utf-8?B?MkdwU2NBLzNRZGhMZ3llWWpBS1ltZy83SmhSMnk5VlJDalpERG1MWFZTZUxY?=
=?utf-8?B?VlI0cWJHWjlNYzdMRUMxVER3V2Z0NGFZUExDaCtSSEtFcmFyaGlqTHhRRmNC?=
=?utf-8?B?RjlScUpTOGppSUIraDJNUmpoUjYxSEhoVWowVzF1K2Iwc1REeSt4bGVvNzZX?=
=?utf-8?B?aW1Kc05nWGxVNHRhRk55MEZUWlRRbFJnY01zQzlITGxhQ3pTS0NNVkE2czkr?=
=?utf-8?B?Rld1U2ZiZ3ZGc2JJR245azl4cThVRXk1S3ZlZS9NL1RaRjNYQkc4Q2hSSGNi?=
=?utf-8?B?VHBaOHlxREtVak94UjUzcGM5dWxvUFN2SThVV045b1dtMlFQQVA5bE5IR2NF?=
=?utf-8?B?MWdZTytkVS8veUR0bExkNllyMGUzUGk5MmZBWXhMZE5sL0RDOXhKUTBUaVNk?=
=?utf-8?B?dTFBOVNXT2FBdXlpOWtIcXYyZ3ZORjBXUzZuU1VnZjdsWHovdUxnbUxxeUU3?=
=?utf-8?B?UHJXQ0c4cW40MlVKb25jK01QZUZ4eWZ6YS9EUT09?=
X-Forefront-Antispam-Report:
CIP:4.158.2.129;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:outbound-uk1.az.dlp.m.darktrace.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(35042699022)(1800799024)(14060799003)(376014)(7416014)(82310400026)(36860700013);DIR:OUT;SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 09:22:28.9575
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 6809bed0-35ab-4008-4907-08dda4dba8a3
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[4.158.2.129];Helo=[outbound-uk1.az.dlp.m.darktrace.com]
X-MS-Exchange-CrossTenant-AuthSource:
AMS0EPF000001B1.eurprd05.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7745
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 30/05/25 4:27 pm, Lorenzo Stoakes wrote:
> +cc Jan for page table stuff.
>
> On Fri, May 30, 2025 at 02:34:05PM +0530, Dev Jain wrote:
>> It is noted at [1] that KFENCE can manipulate kernel pgtable entries during
>> softirqs. It does this by calling set_memory_valid() -> __change_memory_common().
>> This being a non-sleepable context, we cannot take the init_mm mmap lock.
>> Therefore, add PGWALK_NOLOCK to enable walk_page_range_novma() usage without
>> locks.
> Hm This is worrying.
>
> You're unconditionally making it possible for dangerous usage here - to
> walk page tables without a lock.
>
> We need to assert this is only being used in a context where this makes
> sense, e.g. a no VMA range under the right circumstances.
>
> At the very least we need asserts that we are in a circumstance where this
> is permitted.
>
> For VMAs, you must keep the VMA stable, which requires a VMA read lock at
> minimum.
>
> See
> https://origin.kernel.org/doc/html/latest/mm/process_addrs.html#page-tables
> for details where these requirements are documented.
>
> I also think we should update this documentation to cover off this non-VMA
> task context stuff. I can perhaps do this so as not to egregiously add
> workload to this series :)
>
> Also, again this commit message is not enough for such a major change to
> core mm stuff. I think you need to underline that - in non-task context -
> you are safe to manipulate _kernel_ mappings, having precluded KFENCE as a
> concern.

Sorry for late reply, after your comments I had to really go and understand
kernel pagetable walking properly by reading your process_addrs documentation
and reading the code, so that I could prepare an answer and improve my
understanding, thanks for your review!

How does the below comment above PGWALK_NOLOCK look?

"Walk without any lock. Use of this is only meant for the
case where there is no underlying VMA, and the user has
exclusive control over the range, guaranteeing no concurrent
access. For example, changing permissions of vmalloc objects."

and the patch description can be modified as
"
It is noted at [1] that KFENCE can manipulate kernel pgtable entries during
softirqs. It does this by calling set_memory_valid() -> __change_memory_common().
This being a non-sleepable context, we cannot take the init_mm mmap lock.
Therefore, add PGWALK_NOLOCK to enable walk_page_range_novma() usage without
locks.
Currently, apply_to_page_range is being used by __change_memory_common()
to change permissions over a range of vmalloc space, without any locking.
Patch 2 in this series shifts to the usage of walk_page_range_novma(), hence
this patch is needed. We do not need any locks because the vmalloc object
has exclusive access to the range, i.e two vmalloc objects do not share
the same physical address.
"


>
>> [1] https://lore.kernel.org/linux-arm-kernel/89d0ad18-4772-4d8f-ae8a-7c48d26a927e@xxxxxxx/
> Basically expand upon this information.
>
> Basically the commit message refers to your usage, but describes a patch
> that makes it possible to do unlocked page table walks.
>
> As I get into below, no pun intended, but this needs to be _locked down_
> heavily.
>
> - Only walk_page_range_novma() should allow it. All other functions should
> return -EINVAL if this is set.

Sure.

>
> - walk_page_range_novma() should assert we're in the appropriate context
> where this is feasible.

There should be two conditions: that the mm is init_mm, and the start address
belongs to the vmalloc (or module) space. I am a little nervous about the second. On searching
throughout the codebase, I could find only vmalloc and module addresses getting
modified through set_memory_* API, but I couldn't prove that all such usages
are being done on vmalloc/module addresses.

>
> - Comments should be updated accordingly.
>
> - We should assert (at least CONFIG_DEBUG_VM asserts) in every place that
> checks for a VMA that we are not in this lock mode, since this is
> disallowed.
>
>> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
>> ---
>> include/linux/pagewalk.h | 2 ++
>> mm/pagewalk.c | 12 ++++++++----
>> 2 files changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/linux/pagewalk.h b/include/linux/pagewalk.h
>> index 9700a29f8afb..9bc8853ed3de 100644
>> --- a/include/linux/pagewalk.h
>> +++ b/include/linux/pagewalk.h
>> @@ -14,6 +14,8 @@ enum page_walk_lock {
>> PGWALK_WRLOCK = 1,
>> /* vma is expected to be already write-locked during the walk */
>> PGWALK_WRLOCK_VERIFY = 2,
>> + /* no lock is needed */
>> + PGWALK_NOLOCK = 3,
> I'd prefer something very explicitly documenting that, at the very least, this
> can only be used for non-VMA cases.
>
> It's hard to think of a name here, but the comment should be explicit as to
> under what circumstances this is allowed.
>
>> };
>>
>> /**
>> diff --git a/mm/pagewalk.c b/mm/pagewalk.c
>> index e478777c86e1..9657cf4664b2 100644
>> --- a/mm/pagewalk.c
>> +++ b/mm/pagewalk.c
>> @@ -440,6 +440,8 @@ static inline void process_vma_walk_lock(struct vm_area_struct *vma,
>> case PGWALK_RDLOCK:
>> /* PGWALK_RDLOCK is handled by process_mm_walk_lock */
>> break;
>> + default:
>> + break;
> Please no 'default' here, we want to be explicit and cover all cases.

Sure.

>
> And surely, since you're explicitly only allowing this for non-VMA ranges, this
> should be a WARN_ON_ONCE() or something?

Sounds good, maybe a WARN_ON_ONCE(vma)?

>
>> }
>> #endif
>> }
>> @@ -640,10 +642,12 @@ int walk_page_range_novma(struct mm_struct *mm, unsigned long start,
>> * specified address range from being freed. The caller should take
>> * other actions to prevent this race.
>> */
> All functions other than this should explicitly disallow this locking mode
> with -EINVAL checks. I do not want to see this locking mode made available
> in a broken context.
>
> The full comment:
>
> /*
> * 1) For walking the user virtual address space:
> *
> * The mmap lock protects the page walker from changes to the page
> * tables during the walk. However a read lock is insufficient to
> * protect those areas which don't have a VMA as munmap() detaches
> * the VMAs before downgrading to a read lock and actually tearing
> * down PTEs/page tables. In which case, the mmap write lock should
> * be hold.
> *
> * 2) For walking the kernel virtual address space:
> *
> * The kernel intermediate page tables usually do not be freed, so
> * the mmap map read lock is sufficient. But there are some exceptions.
> * E.g. memory hot-remove. In which case, the mmap lock is insufficient
> * to prevent the intermediate kernel pages tables belonging to the
> * specified address range from being freed. The caller should take
> * other actions to prevent this race.
> */
>
> Are you walking kernel memory only? Point 1 above explicitly points out why
> userland novma memory requires a lock.
>
> For point 2 you need to indicate why you don't need to consider hotplugging,

Well, hotunplugging will first offline the physical memory, and since the
vmalloc object has the reference to the pages, there is no race.

> etc.
>
> But as Ryan points out elsewhere, you should be expanding this comment to
> explain your case...
>
> You should also assert you're in a context where this applies and error
> out/WARN if not.
>
>> - if (mm == &init_mm)
>> - mmap_assert_locked(walk.mm);
>> - else
>> - mmap_assert_write_locked(walk.mm);
>> + if (ops->walk_lock != PGWALK_NOLOCK) {
> I really don't like the idea that you're allowing no lock for userland mappings.
>
> This should at the very least be:
>
> if (mm == &init_mm) {
> if (ops->walk_lock != PGWALK_NOLOCK)
> mmap_assert_locked(walk.mm);
> } else {
> mmap_assert_write_locked(walk.mm);
> }

Sure.

>
>> + if (mm == &init_mm)
>> + mmap_assert_locked(walk.mm);
>> + else
>> + mmap_assert_write_locked(walk.mm);
>> + }
>>
>> return walk_pgd_range(start, end, &walk);
>> }
>> --
>> 2.30.2
>>
> We have to be _really_ careful with this stuff. It's very fiddly and
> brokenness can be a security issue.


Return-Path: <linux-kernel+bounces-675546-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DDB7641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:24:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4B2D47A24DF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:23:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A5832286413;
Fri, 6 Jun 2025 09:24:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Dpuu8/J7"
Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9CE627468;
Fri, 6 Jun 2025 09:24:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749201868; cv=none; b=mQWTtAznusWGH+iaDSW9It/lajTPE2Hc3pj4J5FLg5LzU8DIa27Ttkgg2cS23K1Ww0azhjuGTUiwq7kCnsFtRtIeGntvks1Yx/RI8iUscPw83JwWLgq1nse+fqio0PeJlTIEZwOHRUwAqiQNTwKVtb3L0WZ52w6T1NvhGcl8u7Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749201868; c=relaxed/simple;
bh=f+Wxw4EM39rKBgY0c49H2GDg+nabb6mWi/XNe/6zCY0=;
h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=l3O6w0Ekqtccr5rCLSWUvitnRxkeTrLmNERxX1Esp9nqLpqvWnvZaXzqWshMWgPMUWfDBdH4S3swFaiT7QIeHKZ46RiwvZKZwPvqU2woGllr6QvpcXp9vfDx0tkkd5eWo0IgjrbcvpyqkI4O4I17rWakMvQd5caFfn+7ewaRR3I=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Dpuu8/J7; arc=none smtp.client-ip=217.70.183.201
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com
Received: by mail.gandi.net (Postfix) with ESMTPSA id 73C1843423;
Fri, 6 Jun 2025 09:24:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1;
t=1749201858;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=f+Wxw4EM39rKBgY0c49H2GDg+nabb6mWi/XNe/6zCY0=;
b=Dpuu8/J7iTIRvepQ76q8ahXSHCKRbL8PLInN/k6elyJCxgmevhisDvZIEEx6PPg27bIO9Y
2Ij0dzH2w02Razsa42UjkCQ6rOr9amM6qkH0o9G06pM8r8vjT6rRiC7OdN8GZDhj9Vigp7
8v8oFY3TK41DuEEjC9F0FHGlHjaHJKdgjGtizlxUBKgqqtZMRHaLYNBnXVSWj+JXcWGcVB
L3S0Wky0nRqFoyFobwwfgAUIGslOu6KV9co2hLB0MGDUTQBshtj5FMb+q3SJvMbFCunZCk
gfuUJdH7Yh9EQGldDmJo98aZWpw0DLBeOR7JcGvE2buGZph8+AeKPsMS1iRN3Q==
Date: Fri, 6 Jun 2025 11:24:11 +0200
From: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
To: "Russell King (Oracle)" <linux@xxxxxxxxxxxxxxx>
Cc: Paolo Abeni <pabeni@xxxxxxxxxx>, davem@xxxxxxxxxxxxx, Andrew Lunn
<andrew@xxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Eric Dumazet
<edumazet@xxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, thomas.petazzoni@xxxxxxxxxxx, Simon Horman
<horms@xxxxxxxxxx>, Heiner Kallweit <hkallweit1@xxxxxxxxx>, Christophe
Leroy <christophe.leroy@xxxxxxxxxx>, Herve Codina
<herve.codina@xxxxxxxxxxx>, Romain Gantois <romain.gantois@xxxxxxxxxxx>,
Jijie Shao <shaojijie@xxxxxxxxxx>
Subject: Re: [PATCH net] net: phy: phy_caps: Don't skip better duplex macth
on non-exact match
Message-ID: <20250606112411.69b1a3f9@fedora>
In-Reply-To: <aEKnQ4haQtcJWzXX@xxxxxxxxxxxxxxxxxxxxx>
References: <20250603083541.248315-1-maxime.chevallier@xxxxxxxxxxx>
<ef3efb3c-3b5a-4176-a512-011e80c52a06@xxxxxxxxxx>
<20250606101923.04393789@fedora>
<aEKnQ4haQtcJWzXX@xxxxxxxxxxxxxxxxxxxxx>
Organization: Bootlin
X-Mailer: Claws Mail 4.3.1 (GTK 3.24.43; x86_64-redhat-linux-gnu)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdegkeelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfgjfhhoofggtgfgsehtjeertdertddvnecuhfhrohhmpeforgigihhmvgcuvehhvghvrghllhhivghruceomhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepgeevledtvdevueehhfevhfelhfekveeftdfgiedufeffieeltddtgfefuefhueeknecukfhppedvuddvrddutdehrdduhedtrddvhedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdduvddruddthedrudehtddrvdehvddphhgvlhhopehfvgguohhrrgdpmhgrihhlfhhrohhmpehmrgigihhmvgdrtghhvghvrghllhhivghrsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeduhedprhgtphhtthhopehlihhnuhigsegrrhhmlhhinhhugidrohhrghdruhhkpdhrtghpthhtohepphgrsggvnhhisehrvgguhhgrthdrtghomhdprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhnvghtpdhrtghpthhtoheprghnughrvgifsehluhhnnhdrtghhpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopegvughum
hgriigvthesghhoohhglhgvrdgtohhmpdhrtghpthhtohepnhgvthguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhg
X-GND-Sasl: maxime.chevallier@xxxxxxxxxxx
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi,

On Fri, 6 Jun 2025 09:30:59 +0100
"Russell King (Oracle)" <linux@xxxxxxxxxxxxxxx> wrote:

> On Fri, Jun 06, 2025 at 10:19:23AM +0200, Maxime Chevallier wrote:
> > In reality, the case you're mentioning would be a device that supports
> > 1000/Full, 100/Full and 100/Half, user asks for 1000/Half, and 100/Full
> > would be reported.

> If you're version doesn't come out with a matching speed, then I'm
> afraid it's still broken.

My analysis is wrong, but the new result is right. The patch we're
discussing is correct I think, we do report a matching speed (tested on
an espressobin with manual masking of the linkmodes)

I'll update the doc though.

Maxime



Return-Path: <linux-kernel+bounces-675547-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6BC1F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:25:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id ACD9B7A51B3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:24:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 90FDD2857F0;
Fri, 6 Jun 2025 09:25:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="j78M4blQ"
Received: from xry111.site (xry111.site [89.208.246.23])
(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 18F3E204F8C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:25:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.208.246.23
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749201919; cv=none; b=nbli7ZpfHqg7u6jYPMifDNHeT1I+XRJ8wJbsVI5Co3ujkOs2/3VmG0lb80PSdzn1JCsDJ32J6hxIwxw93rhquRH3QvA3dU0rZ38j93pARR5NuZ/YG3sQJHmMgQSHbTdyHDElkRh9ChB8pgX3sZ8G+BsdGF2UUjGVtsi7OQ4/58Q=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749201919; c=relaxed/simple;
bh=I6PsUegXvW4sKwtm2hBSON/3SVKA+xQsbUV7xdVlBvs=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=HSw06wJidOQQQddD5QDKBTSDRyXmfhK1+eO10RAIqfZ6yp60qqe1lugnPhrcNkgepPkrc8SuuhnDQrEYrW3zICSQxHpYoN99vZJgk2Ji4J2+TysIj9S0wNC6JtYVMebxIlglpJQRralSHgczhVNYOH/+svFZTiKQiJEkEhDQhPo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b=j78M4blQ; arc=none smtp.client-ip=89.208.246.23
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xry111.site;
s=default; t=1749201916;
bh=7KRt2HEAfw/QBgPweBInY7JAo1KxrGLTcf3nOhyjppw=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=j78M4blQyuDMZi/77ULjiVFRXBNYmihmFbvvGrUR/B76MB7mrcwxkWfW9kqmQO1BH
2MfZ5X/TiSQsmiG33p1FFcYDNKXaQKOv4TLD5dsG1s6tGrWl6pTwzOjZAjtUCseJ9w
QzGV0D0poPJXgwN3JDEI7zAo78IJLROfuUkRtv7w=
Received: from stargazer.. (unknown [113.200.174.7])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)
(Client did not present a certificate)
(Authenticated sender: xry111@xxxxxxxxxxx)
by xry111.site (Postfix) with ESMTPSA id BF41E65992;
Fri, 6 Jun 2025 05:25:14 -0400 (EDT)
From: Xi Ruoyao <xry111@xxxxxxxxxxx>
To: Alexandre Ghiti <alex@xxxxxxxx>,
=?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas.weissschuh@xxxxxxxxxxxxx>,
Nathan Chancellor <nathan@xxxxxxxxxx>
Cc: "Jason A . Donenfeld" <Jason@xxxxxxxxx>,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>,
Palmer Dabbelt <palmer@xxxxxxxxxxx>,
Guo Ren <guoren@xxxxxxxxxx>,
linux-riscv@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Xi Ruoyao <xry111@xxxxxxxxxxx>
Subject: [PATCH v2] RISC-V: vDSO: Correct inline assembly constraints in the getrandom syscall wrapper
Date: Fri, 6 Jun 2025 17:24:44 +0800
Message-ID: <20250606092443.73650-2-xry111@xxxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250605091112-7cd6b3bd-a466-486a-aebc-7bf0b2a8ac31@xxxxxxxxxxxxx>
References: <20250605091112-7cd6b3bd-a466-486a-aebc-7bf0b2a8ac31@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

As recently pointed out by Thomas, if a register is forced for two
different register variables, among them one is used as "+" (both input
and output) and another is only used as input, Clang would treat the
conflicting input parameters as undefined behaviour and optimize away
the argument assignment.

Per an example in the GCC documentation, for this purpose we can use "="
(only output) for the output, and "0" for the input for that we must
reuse the same register as the output. And GCC developers have
confirmed using a simple "r" (that we use for most vDSO implementations)
instead of "0" is also fine.

Link: https://lore.kernel.org/all/20250603-loongarch-vdso-syscall-v1-1-6d12d6dfbdd0@xxxxxxxxxxxxx/
Link: https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Local-Register-Variables.html
Link: https://gcc.gnu.org/pipermail/gcc-help/2025-June/144266.html
Cc: Thomas WeiÃ?schuh <thomas.weissschuh@xxxxxxxxxxxxx>
Cc: Nathan Chancellor <nathan@xxxxxxxxxx>
Signed-off-by: Xi Ruoyao <xry111@xxxxxxxxxxx>
---

v1 -> v2: Keep using "r" for buffer to follow the existing convention
(that the GCC developers have confirmed fine).

arch/riscv/include/asm/vdso/getrandom.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/include/asm/vdso/getrandom.h b/arch/riscv/include/asm/vdso/getrandom.h
index 8dc92441702a..c6d66895c1f5 100644
--- a/arch/riscv/include/asm/vdso/getrandom.h
+++ b/arch/riscv/include/asm/vdso/getrandom.h
@@ -18,7 +18,7 @@ static __always_inline ssize_t getrandom_syscall(void *_buffer, size_t _len, uns
register unsigned int flags asm("a2") = _flags;

asm volatile ("ecall\n"
- : "+r" (ret)
+ : "=r" (ret)
: "r" (nr), "r" (buffer), "r" (len), "r" (flags)
: "memory");


base-commit: dc5240f09bca7b5fc72ad8894d6b9321bce51139
--
2.49.0



Return-Path: <linux-kernel+bounces-675548-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B191E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:26:12 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id ECD62170921
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:26:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 09AB02857F0;
Fri, 6 Jun 2025 09:26:05 +0000 (UTC)
Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 282BD204F8C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:26:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.69
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749201964; cv=none; b=ap75S+fiHCiNDPoVx4hS+/XmR/CZFbfOZPAHCvQRRXLU5jwPY2dORcYv0uAKGIg3/U+C9BDh9apfWfO14LB55sne1jJea0x629rJLQROpVjy2zNG2zH1oPntFLiCVXkomVdkrvjdC0D/LEw24D6Utj6UIbIi4idTY+eKvnpUjlw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749201964; c=relaxed/simple;
bh=nfpHKU+Q8jnJYk2RkacQOUfQ8pePzqfvjsJuYOHX3aQ=;
h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To:
Content-Type; b=CWq6/8KtWRztMY4SSYblqFPxpLHY/4s/8wzs59ZGK0tEFPIBRCxb0nwXzsd66Nfpq6c9IVo5O4BpJcRnMJKPhwtJgcXcnTy9lJV/htDjgCwQwyWalxWpKXKb2ebHOd8niE/OzTF4shGw12ZFnJw79Wy+a9t3G5xV0Nwme+x+EA4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.69
Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com
Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-86d0daf3b2cso364910139f.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 02:26:02 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749201962; x=1749806762;
h=to:from:subject:message-id:in-reply-to:date:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=g6vH4LJ7CoOPe7hLVuOQPzYeCnRHZ+xCiGvJ/vje2Kg=;
b=uq5jbTYF6etFvlduFM2qz9mwEaZqc1X5B56A0tJoUaLRcTut6OHqYbRIsc2qJhHC3n
PVYKyrGPEp+PhZ8/iGbk5oAtQGv8E+k5JzE2hAE5xTvI/XmFoYKJsTu5hIo1vH+JKr+a
AcH9UTeB01OMAC/yEHoe10d3+jRq4Ziv9X6qV52q7a0KT5cO9UH1W3quUgVz4vqWGI5m
L+YoUmhzwqnCjOxmcBKhCIyMFRgQtjzoqL7K+KyzJZbz3ZRbivLjRrAbXOd5HvHALxnW
BVdHjrdWGpT3sX7wCTkLGwmEaNpCO6qhN+UB6a6RqaH7jDGiQghm99APDaXMPKWtCzKd
oPaw==
X-Forwarded-Encrypted: i=1; AJvYcCVYB740WuKN5qpDF04RtAPjOG01Gt8ZdVo1jpoc5oIhJzgx8WJcIRY1qq+S3dZdhuHBfaa6E5VJuhPdErw=@vger.kernel.org
X-Gm-Message-State: AOJu0YySV9aE9mCtbAj1+ZEacQdvx1vAwNZbZO0q1ubqCyn3D/gRMOfw
hfiAQqXhBI4XuxGD11BvBA1mLakAIxkH+ZLKCIj1UHyqwQzKDaM33U6ZpOr2TbzPlHuWeOWRAHc
mTzXzfje9wprGGnrMoWmZshinR14u94fJynwmtEHAA+s7X1wxEGfgN3SYc2w=
X-Google-Smtp-Source: AGHT+IEWe0yLlTA3Hzim5hPB+52bF6CgQ2wC7f11qDm5jloaEgKy+TdK7PwoQOrWacMITaPAMpnkZusOaBtQ6LOLSKHF8CmeQxI4
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Received: by 2002:a05:6e02:219e:b0:3dc:8667:3426 with SMTP id
e9e14a558f8ab-3ddce46e8d1mr25653565ab.17.1749201962142; Fri, 06 Jun 2025
02:26:02 -0700 (PDT)
Date: Fri, 06 Jun 2025 02:26:02 -0700
In-Reply-To: <fccdb703-d3b4-48db-b001-3630e20cdf3e@xxxxxxxxx>
X-Google-Appengine-App-Id: s~syzkaller
X-Google-Appengine-App-Id-Alias: syzkaller
Message-ID: <6842b42a.050a0220.389efd.0002.GAE@xxxxxxxxxx>
Subject: Re: [syzbot] [trace?] BUG: corrupted list in ring_buffer_subbuf_order_set
From: syzbot <syzbot+05d673e83ec640f0ced9@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: dmantipov@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
syzkaller-bugs@xxxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.0 required=5.0 tests=FROM_LOCAL_HEX,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+05d673e83ec640f0ced9@xxxxxxxxxxxxxxxxxxxxxxxxx
Tested-by: syzbot+05d673e83ec640f0ced9@xxxxxxxxxxxxxxxxxxxxxxxxx

Tested on:

commit: e271ed52 Merge tag 'pm-6.16-rc1-3' of git://git.kernel..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=16d93c0c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=6ede24871858ac52
dashboard link: https://syzkaller.appspot.com/bug?extid=05d673e83ec640f0ced9
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=17893c0c580000

Note: testing is done by a robot and is best-effort only.


Return-Path: <linux-kernel+bounces-675549-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DB47941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:27:24 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id A92B83AD04B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:27:02 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EA3E92857F0;
Fri, 6 Jun 2025 09:26:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b="fMz6mKKv"
Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FA6D2857EE
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:26:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202016; cv=none; b=lsAm7VvqXcd1dHWZY+FLUBRbVXlRdEFV0iy5kUE3FztZPPQ5kSmRE3QRu3DF9qWEgjGcV2Hhhte0UMgJkbR8xYDxgPumzZLY2rftCPZ5ktcCgST2lqRTIyl1tzQFWuLJ+6ksN8uv/7BGaPIQZb82pU+2B1lfunsETKFZE6EiIqc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202016; c=relaxed/simple;
bh=JiIl1P74SS4Y3zSRkT1zMbKSeoxi47tk7FK58JMqrdQ=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=llMVG4Q3VDW6P/rzu8g5f/Ok57PqBtefXq1pDyY61FDZXQphY9RnCRnmlYNmH40x08E48w46txlxxUK+Uoz/bX2eItO91ku46BXG1TvxrDf81pOj3MLWLlJaMfjdu9qdtnVevmHsl3p0u/PjC2OcYAX3BEOL9opF4GNfyD5MnWw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com; spf=pass smtp.mailfrom=daynix.com; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b=fMz6mKKv; arc=none smtp.client-ip=209.85.210.177
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=daynix.com
Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-73c17c770a7so2060975b3a.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 02:26:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1749202012; x=1749806812; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=dVFp0y3LwEl0dSfuP1w+3N/rjAu1odVqqvr/raUrT4M=;
b=fMz6mKKv2HEpF/DfWIdQhzOUAaVYsB3NfAWh/uAwatsxiJpOtihO3u+nSB7UE62hNv
ctj20I5R9i0LKT/5ynfdsDv65K2R0h7DuC0BUE3RCym0sZEqwGfFdjkFlDn/ym63dzaF
0l1E1srOzPIZsVP162x8uxckc9WT80XGiAGvCGRXf9LjL+NinvNJzTcNK+rYSbwxCwRi
TMplhiT+2oHfOXpWMMaGAPu6Mtb0rrs42ovCCT7cvsH0xMOY/S5KlKip0McDz4ja+ine
7dNAYMKOHIzH/oLpfQE1rJlFIBT35ALJ1CxlSz+Ey2rklO82E1UZfr8Ti2m5Q59Zs/Ls
X3Bw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749202012; x=1749806812;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=dVFp0y3LwEl0dSfuP1w+3N/rjAu1odVqqvr/raUrT4M=;
b=XsFi96Sl46xShM283qno3zwm75UDt7SwHEcPZtCoWDeHB0MwBYtZB3uSSAVuvQLN+s
jJJthggEaaPDCx3OE0VfdjtBsHVGdFzX8h/ED4qdCAO+QVhoF27Gk3TaKIfEgr/WX2tG
9ftLEB0p4N4rl8k3y5nAJ2gUtkxpik+TbZ0IBoz6wrUFmedzt0bqwzms3zK0KxLdF8O9
OX0C27HFC3tnT/rbqwpwA43jlVe8yyLDnWsjg6RK/RKmZI8GWdZDN8WXVB0f1YgJbUQX
eUJ64TaH8MHZihIAl5Vn2iGVDHiuGIh9Q++hSBmVuB0l1juYqDmN8wrk9k5neQOuHJJF
huOg==
X-Forwarded-Encrypted: i=1; AJvYcCVX/EXD8r+uNt6WO7zwyDG8N5IwLRIStjG7Q3UBWq6ffVHQVzr50Qqv4sJ3MBjaA3KE/VD24NTLBwEF/gM=@vger.kernel.org
X-Gm-Message-State: AOJu0Yyccp/DAvKXqfuJ/GhWCBZ0LzdMNpK2+AtgG1M8dW39kdm+7+nR
IGjUl6pFq7ranFuSuBYHaadNRiHP+y/JXPcToTpwyKcIq09uaTnxHnoliY7NfAq4iR8=
X-Gm-Gg: ASbGncuLN1tg/jffY7SJjOZrEw+z+nGuPibsQktRmF+Qg1BEjIQnM1dulZkTaVVsEwZ
iQEfw3009X9N3k2PHCgEY5SeRQJ6A3xZQ6TO+Dn69M/bUioEMCFrkSpGEYcOFqANya4Ywt9fjCq
xCMYRJZ3P5lhpr70OZJr8Xa3oA7zpXM6g2uue5hs+MR32mfOQzfRSVzCgfGIVaiPpN/WmUVO4YR
BAxhiUrFD9Mxbm+NZy5gIKoSjZwTTPG+gMA4patmv7dP6xcAF3MhRfFpTjJXlRPoSfKS+ddNjv3
gYKqAQdik2lnH485xb3yxS+Efbs25Aq9GZAl+ZHX4PR95rydfPIjp7xr5fSPHYjy
X-Google-Smtp-Source: AGHT+IHQGezEimrgJQ1aDQob3oB943JapFLl3dX3CiFX1QlzPfh8s7zRYxdK1iqOU7iR7O2guzKnGg==
X-Received: by 2002:a05:6a20:e605:b0:1f5:7eee:bb10 with SMTP id adf61e73a8af0-21ee258bddfmr3922262637.8.1749202012132;
Fri, 06 Jun 2025 02:26:52 -0700 (PDT)
Received: from [157.82.203.223] ([157.82.203.223])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482af3ab94sm897848b3a.31.2025.06.06.02.26.47
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 02:26:51 -0700 (PDT)
Message-ID: <48ae8ca2-d5e9-446c-b845-0df31f385ff6@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 18:26:46 +0900
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH net-next v12 04/10] tun: Add common virtio-net hash
feature code
To: Jason Wang <jasowang@xxxxxxxxxx>
Cc: Jonathan Corbet <corbet@xxxxxxx>,
Willem de Bruijn <willemdebruijn.kernel@xxxxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>, Xuan Zhuo
<xuanzhuo@xxxxxxxxxxxxxxxxx>, Shuah Khan <shuah@xxxxxxxxxx>,
linux-doc@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx,
virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, linux-kselftest@xxxxxxxxxxxxxxx,
Yuri Benditovich <yuri.benditovich@xxxxxxxxxx>,
Andrew Melnychenko <andrew@xxxxxxxxxx>,
Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx>, gur.stavi@xxxxxxxxxx,
Lei Yang <leiyang@xxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxx>
References: <20250530-rss-v12-0-95d8b348de91@xxxxxxxxxx>
<20250530-rss-v12-4-95d8b348de91@xxxxxxxxxx>
<CACGkMEupCBFH2eLv_93uy9K=+s_jQPM12mvyhU=zGbwSUnyVaA@xxxxxxxxxxxxxx>
<a3e21479-2967-4604-a684-9b9b9e115f37@xxxxxxxxxx>
<CACGkMEuBb6eB9w=HgYq7wy2vW-4PMGGQKk5dd=kCm3ednJ2WxQ@xxxxxxxxxxxxxx>
<56647ddd-c6ac-43cf-bcb2-626a162858a4@xxxxxxxxxx>
<CACGkMEs+3Pu9-E7RcmEzp6wZxZYwDS1G+1P3ti=Vzceq=C31YQ@xxxxxxxxxxxxxx>
Content-Language: en-US
From: Akihiko Odaki <akihiko.odaki@xxxxxxxxxx>
In-Reply-To: <CACGkMEs+3Pu9-E7RcmEzp6wZxZYwDS1G+1P3ti=Vzceq=C31YQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 2025/06/06 10:01, Jason Wang wrote:
> On Thu, Jun 5, 2025 at 4:18â?¯PM Akihiko Odaki <akihiko.odaki@xxxxxxxxxx> wrote:
>>
>> On 2025/06/05 11:46, Jason Wang wrote:
>>> On Wed, Jun 4, 2025 at 4:42â?¯PM Akihiko Odaki <akihiko.odaki@xxxxxxxxxx> wrote:
>>>>
>>>> On 2025/06/04 10:53, Jason Wang wrote:
>>>>> On Fri, May 30, 2025 at 12:50â?¯PM Akihiko Odaki <akihiko.odaki@xxxxxxxxxx> wrote:
>>>>>>
>>>>>> Add common code required for the features being added to TUN and TAP.
>>>>>> They will be enabled for each of them in following patches.
>>>>>>
>>>>>> Added Features
>>>>>> ==============
>>>>>>
>>>>>> Hash reporting
>>>>>> --------------
>>>>>>
>>>>>> Allow the guest to reuse the hash value to make receive steering
>>>>>> consistent between the host and guest, and to save hash computation.
>>>>>>
>>>>>> Receive Side Scaling (RSS)
>>>>>> --------------------------
>>>>>>
>>>>>> RSS is a receive steering algorithm that can be negotiated to use with
>>>>>> virtio_net. Conventionally the hash calculation was done by the VMM.
>>>>>> However, computing the hash after the queue was chosen defeats the
>>>>>> purpose of RSS.
>>>>>>
>>>>>> Another approach is to use eBPF steering program. This approach has
>>>>>> another downside: it cannot report the calculated hash due to the
>>>>>> restrictive nature of eBPF steering program.
>>>>>>
>>>>>> Introduce the code to perform RSS to the kernel in order to overcome
>>>>>> thse challenges. An alternative solution is to extend the eBPF steering
>>>>>> program so that it will be able to report to the userspace, but I didn't
>>>>>> opt for it because extending the current mechanism of eBPF steering
>>>>>> program as is because it relies on legacy context rewriting, and
>>>>>> introducing kfunc-based eBPF will result in non-UAPI dependency while
>>>>>> the other relevant virtualization APIs such as KVM and vhost_net are
>>>>>> UAPIs.
>>>>>>
>>>>>> Added ioctls
>>>>>> ============
>>>>>>
>>>>>> They are designed to make extensibility and VM migration compatible.
>>>>>> This change only adds the implementation and does not expose them to
>>>>>> the userspace.
>>>>>>
>>>>>> TUNGETVNETHASHTYPES
>>>>>> -------------------
>>>>>>
>>>>>> This ioctl tells supported hash types. It is useful to check if a VM can
>>>>>> be migrated to the current host.
>>>>>>
>>>>>> TUNSETVNETREPORTINGAUTOMQ, TUNSETVNETREPORTINGRSS, and TUNSETVNETRSS
>>>>>> --------------------------------------------------------------------
>>>>>>
>>>>>> These ioctls configures a steering algorithm and, if needed, hash
>>>>>> reporting.
>>>>>>
>>>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@xxxxxxxxxx>
>>>>>> Tested-by: Lei Yang <leiyang@xxxxxxxxxx>
>>>>>> ---
>>>>>> drivers/net/tap.c | 10 ++-
>>>>>> drivers/net/tun.c | 12 +++-
>>>>>> drivers/net/tun_vnet.h | 165 +++++++++++++++++++++++++++++++++++++++++---
>>>>>> include/uapi/linux/if_tun.h | 71 +++++++++++++++++++
>>>>>> 4 files changed, 244 insertions(+), 14 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/net/tap.c b/drivers/net/tap.c
>>>>>> index d4ece538f1b2..25c60ff2d3f2 100644
>>>>>> --- a/drivers/net/tap.c
>>>>>> +++ b/drivers/net/tap.c
>>>>>> @@ -179,6 +179,11 @@ static void tap_put_queue(struct tap_queue *q)
>>>>>> sock_put(&q->sk);
>>>>>> }
>>>>>>
>>>>>> +static const struct virtio_net_hash *tap_find_hash(const struct sk_buff *skb)
>>>>>> +{
>>>>>> + return NULL;
>>>>>> +}
>>>>>> +
>>>>>> /*
>>>>>> * Select a queue based on the rxq of the device on which this packet
>>>>>> * arrived. If the incoming device is not mq, calculate a flow hash
>>>>>> @@ -711,11 +716,12 @@ static ssize_t tap_put_user(struct tap_queue *q,
>>>>>> int total;
>>>>>>
>>>>>> if (q->flags & IFF_VNET_HDR) {
>>>>>> - struct virtio_net_hdr vnet_hdr;
>>>>>> + struct virtio_net_hdr_v1_hash vnet_hdr;
>>>>>>
>>>>>> vnet_hdr_len = READ_ONCE(q->vnet_hdr_sz);
>>>>>>
>>>>>> - ret = tun_vnet_hdr_from_skb(q->flags, NULL, skb, &vnet_hdr);
>>>>>> + ret = tun_vnet_hdr_from_skb(vnet_hdr_len, q->flags, NULL, skb,
>>>>>> + tap_find_hash, &vnet_hdr);
>>>>>> if (ret)
>>>>>> return ret;
>>>>>>
>>>>>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
>>>>>> index 9133ab9ed3f5..03d47799e9bd 100644
>>>>>> --- a/drivers/net/tun.c
>>>>>> +++ b/drivers/net/tun.c
>>>>>> @@ -451,6 +451,11 @@ static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash)
>>>>>> e->rps_rxhash = hash;
>>>>>> }
>>>>>>
>>>>>> +static const struct virtio_net_hash *tun_find_hash(const struct sk_buff *skb)
>>>>>> +{
>>>>>> + return NULL;
>>>>>> +}
>>>>>> +
>>>>>> /* We try to identify a flow through its rxhash. The reason that
>>>>>> * we do not check rxq no. is because some cards(e.g 82599), chooses
>>>>>> * the rxq based on the txq where the last packet of the flow comes. As
>>>>>> @@ -1993,7 +1998,7 @@ static ssize_t tun_put_user_xdp(struct tun_struct *tun,
>>>>>> ssize_t ret;
>>>>>>
>>>>>> if (tun->flags & IFF_VNET_HDR) {
>>>>>> - struct virtio_net_hdr gso = { 0 };
>>>>>> + struct virtio_net_hdr_v1_hash gso = { 0 };
>>>>>>
>>>>>> vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz);
>>>>>> ret = tun_vnet_hdr_put(vnet_hdr_sz, iter, &gso);
>>>>>> @@ -2046,9 +2051,10 @@ static ssize_t tun_put_user(struct tun_struct *tun,
>>>>>> }
>>>>>>
>>>>>> if (vnet_hdr_sz) {
>>>>>> - struct virtio_net_hdr gso;
>>>>>> + struct virtio_net_hdr_v1_hash gso;
>>>>>>
>>>>>> - ret = tun_vnet_hdr_from_skb(tun->flags, tun->dev, skb, &gso);
>>>>>> + ret = tun_vnet_hdr_from_skb(vnet_hdr_sz, tun->flags, tun->dev,
>>>>>> + skb, tun_find_hash, &gso);
>>>>>> if (ret)
>>>>>> return ret;
>>>>>>
>>>>>> diff --git a/drivers/net/tun_vnet.h b/drivers/net/tun_vnet.h
>>>>>> index 58b9ac7a5fc4..45d0533efc8d 100644
>>>>>> --- a/drivers/net/tun_vnet.h
>>>>>> +++ b/drivers/net/tun_vnet.h
>>>>>> @@ -6,6 +6,17 @@
>>>>>> #define TUN_VNET_LE 0x80000000
>>>>>> #define TUN_VNET_BE 0x40000000
>>>>>>
>>>>>> +typedef struct virtio_net_hash *(*tun_vnet_hash_add)(struct sk_buff *);
>>>>>> +typedef const struct virtio_net_hash *(*tun_vnet_hash_find)(const struct sk_buff *);
>>>>>> +
>>>>>> +struct tun_vnet_hash {
>>>>>> + bool report;
>>>>>> + bool rss;
>>>>>> + struct tun_vnet_rss common;
>>>>>> + u32 rss_key[VIRTIO_NET_RSS_MAX_KEY_SIZE];
>>>>>> + u16 rss_indirection_table[];
>>>>>> +};
>>>>>> +
>>>>>> static inline bool tun_vnet_legacy_is_little_endian(unsigned int flags)
>>>>>> {
>>>>>> bool be = IS_ENABLED(CONFIG_TUN_VNET_CROSS_LE) &&
>>>>>> @@ -107,6 +118,128 @@ static inline long tun_vnet_ioctl(int *vnet_hdr_sz, unsigned int *flags,
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> +static inline long tun_vnet_ioctl_gethashtypes(u32 __user *argp)
>>>>>> +{
>>>>>> + return put_user(VIRTIO_NET_SUPPORTED_HASH_TYPES, argp) ? -EFAULT : 0;
>>>>>> +}
>>>>>> +
>>>>>> +static inline long tun_vnet_ioctl_sethash(struct tun_vnet_hash __rcu **hashp,
>>>>>> + unsigned int cmd,
>>>>>> + void __user *argp)
>>>>>> +{
>>>>>> + struct tun_vnet_rss common;
>>>>>> + struct tun_vnet_hash *hash;
>>>>>> + size_t indirection_table_size;
>>>>>> + size_t key_size;
>>>>>> + size_t size;
>>>>>> +
>>>>>> + switch (cmd) {
>>>>>> + case TUNSETVNETREPORTINGAUTOMQ:
>>>>>> + if (get_user(common.hash_types, (u32 __user *)argp))
>>>>>> + return -EFAULT;
>>>>>> +
>>>>>> + if (common.hash_types) {
>>>>>> + hash = kzalloc(sizeof(*hash), GFP_KERNEL);
>>>>>> + if (!hash)
>>>>>> + return -ENOMEM;
>>>>>> +
>>>>>> + hash->report = true;
>>>>>> + hash->common.hash_types = common.hash_types;
>>>>>> + } else {
>>>>>> + hash = NULL;
>>>>>> + }
>>>>>> + break;
>>>>>> +
>>>>>> + case TUNSETVNETREPORTINGRSS:
>>>>>> + case TUNSETVNETRSS:
>>>>>
>>>>> So the above three shows unnecessary design redundancy as well as a
>>>>> burden for the future extension. Why not simply have
>>>>>
>>>>> 1) TUNSETVNET_RSS
>>>>> 2) TUNSETVNET_HASH_REPORT
>>>>> ?
>>>>>
>>>>> Which maps to
>>>>>
>>>>> #define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable
>>>>> receive steering)
>>>>> #define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for configurable
>>>>> hash calculation)
>>>>>
>>>>> It would be always easier to start with what spec had or at least we
>>>>> need to explain why we choose a different design here or in the
>>>>> changelog to ease our life.
>>>>
>>>> TUNSETVNETREPORTINGAUTOMQ maps to VIRTIO_NET_CTRL_MQ_HASH_CONFIG.
>>>
>>> It's not:
>>>
>>> VIRTIO_NET_CTRL_MQ_HASH_CONFIG uses:
>>>
>>> struct virtio_net_hash_config {
>>> le32 hash_types;
>>> le16 reserved[4];
>>> u8 hash_key_length;
>>> u8 hash_key_data[hash_key_length];
>>> };
>>>
>>> but TUNSETVNETREPORTINGAUTOMQ only accepts hash_types without others:
>>
>> The others are not present because the spec doesn't specify what to do
>> with them and the kernel doesn't use them either.
>
> Did you mean the hash_key_length and hash_key_data? Note that we have
> drivers other than the Linux ones as well.

And reserved. Drivers can set whatever to these fields. It is not
specified how these fields should be used.

>
>>
>>>
>>>>
>>>> TUNSETVNETREPORTINGRSS and TUNSETVNETRSS map to
>>>> VIRTIO_NET_CTRL_MQ_RSS_CONFIG.
>>>
>>> I think we've already had a discussion about this.
>>>
>>> Reusing virtio-net uAPI is much better instead of having a tun
>>> specific one considering tun may need to support more virtio commands
>>> in the future. Or maybe it's the time to introduce a transport for the
>>> virtio control virtqueue uAPI in tuntap to avoid inventing new uAPI
>>> endlessly.
>>>
>>> What's more I see:
>>>
>>> struct tun_vnet_rss {
>>> __u32 hash_types;
>>> __u16 indirection_table_mask;
>>> __u16 unclassified_queue;
>>> };
>>>
>>> struct tun_vnet_hash {
>>> bool report;
>>> bool rss;
>>> struct tun_vnet_rss common;
>>> u32 rss_key[VIRTIO_NET_RSS_MAX_KEY_SIZE];
>>> u16 rss_indirection_table[];
>>> };
>>>
>>> As I pointed out in the past, let's just decouple the rss from hash,
>>> everything would be much simpler, or you need to explain why you
>>> couple this somewhere.
>>>
>>> For example:
>>>
>>> 1) why is the tun_vnet_hash not part of the uAPI but tun_vnet_rss, or
>>> how could userspace know what kind of format it would use for
>>> TUNSETVNETREPORTINGRSS?
>>
>> That was the previous version.
>>
>>> 2) what's the advantages of embedding rss specific stuff into hash
>>> report structure
>>
>> Because the hash types field in struct tun_vnet_rss is used by hash
>> reporting too.
>>
>>> 3) what's the advantages of not using virtio-net uAPI
>>
>> 1. The use cases that don't involve VM will be simplified; programs for
>> such a use case will not need to convert endian or to fill fileds the
>> kernel doesn't care.
>
> Well, virtio_net_hdr is used by packet socket as well. Considering the
> complexity of designing a new uAPI, it's still better.

This patch series also reuses the datapath, following the prior examples.

>
> Or maybe you can clarify which field that kernel doesn't care about?
> In this case TUN/TAP is basically the device datapath, if some of the
> fields don't make sense, it's a bug of the spec.

reserved, hash_key_length, and hash_key_data.

>
>> 2. It aligns with existing UAPIs that operate in native endian and don't
>> use virtio-net data structures like TUNSETOFFLOAD and TUNSETVNETHDRSZ.
>
> For those two examples, it would be used by guests directly. This is
> different from RSS stuff.

They are mediated by the VMM, which is no different from RSS.

>
> With native endian, you need an endian conversation that converts le to native.

That's true, but QEMU does so anyway to validate the configuration, to
attach/detach queues, and to share the data structures with userspace
RSS implementations. I expect other VMMs will do so too.

>
>>
>>>
>>> More issues:
>>>
>>> 1) max_tx_vq is ignored, so do you expect the userspace to intercept
>>> this and switch to using TUNSETQUEUE? This seems like a burden as TUN
>>> can simply accept it and do the attaching/detaching by itself
>>> 2) the rx depends on the indirection table, so userspace need to
>>> intercept the indirection and change the rx queue numbers accordingly
>>> 3) RSS allows a async TX/RX queue, this is not supported by TUN now,
>>> no matter if we decide to let userspace to intercept max_tx_vq or not,
>>> we need to implement it first
>> > > Things would be much more simpler, if kernel can do 1) and 2).
>>
>> Attaching and detaching queues is not possible for the kernel because it
>> doesn't know what file descriptors that map to queues will be used by
>> the userspace.
>
> The kernel knows, tfile has a queue_index part.

queue_index is set with TUNSETQUEUE so we need the ioctl.

>
>>
>> The following patch does 2) for QEMU:
>> https://lore.kernel.org/qemu-devel/20250322-vq-v2-1-cee0aafe6404@xxxxxxxxxx/
>
> See below point, form the view of the kernel, it's still a queue pair
> not async TX/RX queue.
>
>>
>> For 3), the patch for QEMU takes the maximum of TX and RX queue numbers
>> to derive the number of queue pairs.
>>
>>>
>>>> We have two ioctls here because
>>>> VIRTIO_NET_CTRL_MQ_RSS_CONFIG behaves differently depending on whether
>>>> VIRTIO_NET_F_HASH_REPORT is negotiated or not;
>>>
>>> It wouldn't be a problem if you do 1:1 mapping between virtio commands
>>> and TUN uAPI, otherwise it should have a bug somewhere.
>>
>> Speaking of 1:1 mapping, it is possible to map VIRTIO_NET_F_HASH_REPORT
>> into another ioctl. It may help add another receive steering algorithm
>> in the future by not requiring two ioctls (TUNSETVNETREPORTING_X and
>> TUNSETVNET_X).
>
> Yes and as I pointed out, virtio_net_hash_config should not be
> specific to automq, it can work for other steering algorithm as well.

That's not what the virtio spec says, so it will not be 1:1 mapping
between virtio commands and TUN uAPI.

>
>>
>>>
>>>> it also enables hash
>>>> reporting if the feature is negotiated.
>>>
>>> Again, starting from virtio-net command is easier, a strong
>>> justification is needed to explain why we choose another for tun/tap.
>>>
>>>>
>>>>>
>>>>> One day we would have tun_select_queue_algorithm_x() we don't have to
>>>>> duplicate the ioctls once again here like TUNSETVNETREPORTINGXYZ
>>>>
>>>> 5.1.6.5.6.4 Hash calculation says:
>>>>> If VIRTIO_NET_F_HASH_REPORT was negotiated and the device uses
>>>>> automatic receive steering, the device MUST support a command to
>>>>> configure hash calculation parameters.
>>>>>
>>>>> The driver provides parameters for hash calculation as follows:
>>>>>
>>>>> class VIRTIO_NET_CTRL_MQ, command VIRTIO_NET_CTRL_MQ_HASH_CONFIG.
>>>>
>>>> VIRTIO_NET_CTRL_MQ_HASH_CONFIG is for automatic receive steering and not
>>>> for RSS (or other steering algorithms if the spec gets any in the future).
>>>
>>> I'm not sure but the spec needs some tweaking. For example, I don't
>>> expect there would be a dedicated hash config command for flow filters
>>> in the future. I think the reason why spec says like this is that
>>> virtio-net only supports automatic receive steering.
>>>
>>> Note that macvtap doesn't implement automatic receive steering.
>>
>> QEMU advertises VIRTIO_NET_F_CTRL_VQ for macvtap too, so it should have
>> implemented it. I think QEMU with macvtap still compliant to the spec.
>
> Compliant, but automatic traffic steering is the best effort as well.
>
> Nope, TUN/TAP implements a flow cache that can steer tx based on rx.
> Macvtap simply uses hash here.
>
>>
>> "5.1.6.5.6 Automatic receive steering in multiqueue mode" says:
>>
>> > After the driver transmitted a packet of a flow on transmitqX, the
>> > device SHOULD cause incoming packets for that flow to be steered to
>> > receiveqX.
>>
>> It is "SHOULD", so it is still compliant if the device doesn't properly
>> respect the flow.
>
> Yes, a quality of implementation, or it's impractical to support a
> correct steering for this device as limited resources and mailious
> users can do syn flood etc.
>
>>
>>>
>>>>
>>>>>
>>>>>> + if (copy_from_user(&common, argp, sizeof(common)))
>>>>>> + return -EFAULT;
>>>>>> + argp = (struct tun_vnet_rss __user *)argp + 1;
>>>>>> +
>>>>>> + indirection_table_size = ((size_t)common.indirection_table_mask + 1) * 2;
>>>>>> + key_size = virtio_net_hash_key_length(common.hash_types);
>>>>>> + size = struct_size(hash, rss_indirection_table,
>>>>>> + (size_t)common.indirection_table_mask + 1);
>>>>>> +
>>>>>> + hash = kmalloc(size, GFP_KERNEL);
>>>>>> + if (!hash)
>>>>>> + return -ENOMEM;
>>>>>> +
>>>>>> + if (copy_from_user(hash->rss_indirection_table,
>>>>>> + argp, indirection_table_size)) {
>>>>>> + kfree(hash);
>>>>>> + return -EFAULT;
>>>>>> + }
>>>>>> + argp = (u16 __user *)argp + common.indirection_table_mask + 1;
>>>>>> +
>>>>>> + if (copy_from_user(hash->rss_key, argp, key_size)) {
>>>>>> + kfree(hash);
>>>>>> + return -EFAULT;
>>>>>> + }
>>>>>> +
>>>>>> + virtio_net_toeplitz_convert_key(hash->rss_key, key_size);
>>>>>> + hash->report = cmd == TUNSETVNETREPORTINGRSS;
>>>>>
>>>>> At least, if this is the only difference why not simply code this into
>>>>> the ioctl itself other than having a very similar command?
>>>>
>>>> It is what the previous version did. Either is fine I guess; the only
>>>> practical difference would be the size of the configuration struct is
>>>> smaller with this approach.
>>>>
>>>>>
>>>>>> + hash->rss = true;
>>>>>> + hash->common = common;
>>>>>> + break;
>>>>>> +
>>>>>> + default:
>>>>>> + return -EINVAL;
>>>>>> + }
>>>>>> +
>>>>>> + kfree_rcu_mightsleep(rcu_replace_pointer_rtnl(*hashp, hash));
>>>>>> + return 0;
>>>>>> +}
>>>>>> +
>>>>>> +static inline void tun_vnet_hash_report(const struct tun_vnet_hash *hash,
>>>>>> + struct sk_buff *skb,
>>>>>> + const struct flow_keys_basic *keys,
>>>>>> + u32 value,
>>>>>> + tun_vnet_hash_add vnet_hash_add)
>>>>>> +{
>>>>>> + struct virtio_net_hash *report;
>>>>>> +
>>>>>> + if (!hash || !hash->report)
>>>>>> + return;
>>>>>> +
>>>>>> + report = vnet_hash_add(skb);
>>>>>> + if (!report)
>>>>>> + return;
>>>>>> +
>>>>>> + *report = (struct virtio_net_hash) {
>>>>>> + .report = virtio_net_hash_report(hash->common.hash_types, keys),
>>>>>> + .value = value
>>>>>> + };
>>>>>> +}
>>>>>> +
>>>>>> +static inline u16 tun_vnet_rss_select_queue(u32 numqueues,
>>>>>> + const struct tun_vnet_hash *hash,
>>>>>> + struct sk_buff *skb,
>>>>>> + tun_vnet_hash_add vnet_hash_add)
>>>>>> +{
>>>>>> + struct virtio_net_hash *report;
>>>>>> + struct virtio_net_hash ret;
>>>>>> + u16 index;
>>>>>> +
>>>>>> + if (!numqueues)
>>>>>> + return 0;
>>>>>> +
>>>>>> + virtio_net_hash_rss(skb, hash->common.hash_types, hash->rss_key, &ret);
>>>>>> +
>>>>>> + if (!ret.report)
>>>>>> + return hash->common.unclassified_queue % numqueues;
>>>>>> +
>>>>>> + if (hash->report) {
>>>>>> + report = vnet_hash_add(skb);
>>>>>> + if (report)
>>>>>> + *report = ret;
>>>>>> + }
>>>>>> +
>>>>>> + index = ret.value & hash->common.indirection_table_mask;
>>>>>> +
>>>>>> + return hash->rss_indirection_table[index] % numqueues;
>>>>>> +}
>>>>>> +
>>>>>> static inline int tun_vnet_hdr_get(int sz, unsigned int flags,
>>>>>> struct iov_iter *from,
>>>>>> struct virtio_net_hdr *hdr)
>>>>>> @@ -135,15 +268,17 @@ static inline int tun_vnet_hdr_get(int sz, unsigned int flags,
>>>>>> }
>>>>>>
>>>>>> static inline int tun_vnet_hdr_put(int sz, struct iov_iter *iter,
>>>>>> - const struct virtio_net_hdr *hdr)
>>>>>> + const struct virtio_net_hdr_v1_hash *hdr)
>>>>>> {
>>>>>> + int content_sz = MIN(sizeof(*hdr), sz);
>>>>>> +
>>>>>> if (unlikely(iov_iter_count(iter) < sz))
>>>>>> return -EINVAL;
>>>>>>
>>>>>> - if (unlikely(copy_to_iter(hdr, sizeof(*hdr), iter) != sizeof(*hdr)))
>>>>>> + if (unlikely(copy_to_iter(hdr, content_sz, iter) != content_sz))
>>>>>> return -EFAULT;
>>>>>>
>>>>>> - if (iov_iter_zero(sz - sizeof(*hdr), iter) != sz - sizeof(*hdr))
>>>>>> + if (iov_iter_zero(sz - content_sz, iter) != sz - content_sz)
>>>>>> return -EFAULT;
>>>>>>
>>>>>> return 0;
>>>>>> @@ -155,26 +290,38 @@ static inline int tun_vnet_hdr_to_skb(unsigned int flags, struct sk_buff *skb,
>>>>>> return virtio_net_hdr_to_skb(skb, hdr, tun_vnet_is_little_endian(flags));
>>>>>> }
>>>>>>
>>>>>> -static inline int tun_vnet_hdr_from_skb(unsigned int flags,
>>>>>> +static inline int tun_vnet_hdr_from_skb(int sz, unsigned int flags,
>>>>>> const struct net_device *dev,
>>>>>> const struct sk_buff *skb,
>>>>>> - struct virtio_net_hdr *hdr)
>>>>>> + tun_vnet_hash_find vnet_hash_find,
>>>>>> + struct virtio_net_hdr_v1_hash *hdr)
>>>>>> {
>>>>>> int vlan_hlen = skb_vlan_tag_present(skb) ? VLAN_HLEN : 0;
>>>>>> + const struct virtio_net_hash *report = sz < sizeof(struct virtio_net_hdr_v1_hash) ?
>>>>>> + NULL : vnet_hash_find(skb);
>>>>>> +
>>>>>> + *hdr = (struct virtio_net_hdr_v1_hash) {
>>>>>> + .hash_report = VIRTIO_NET_HASH_REPORT_NONE
>>>>>> + };
>>>>>> +
>>>>>> + if (report) {
>>>>>> + hdr->hash_value = cpu_to_le32(report->value);
>>>>>> + hdr->hash_report = cpu_to_le16(report->report);
>>>>>> + }
>>>>>>
>>>>>> - if (virtio_net_hdr_from_skb(skb, hdr,
>>>>>> + if (virtio_net_hdr_from_skb(skb, (struct virtio_net_hdr *)hdr,
>>>>>> tun_vnet_is_little_endian(flags), true,
>>>>>> vlan_hlen)) {
>>>>>> struct skb_shared_info *sinfo = skb_shinfo(skb);
>>>>>>
>>>>>> if (net_ratelimit()) {
>>>>>> netdev_err(dev, "unexpected GSO type: 0x%x, gso_size %d, hdr_len %d\n",
>>>>>> - sinfo->gso_type, tun_vnet16_to_cpu(flags, hdr->gso_size),
>>>>>> - tun_vnet16_to_cpu(flags, hdr->hdr_len));
>>>>>> + sinfo->gso_type, tun_vnet16_to_cpu(flags, hdr->hdr.gso_size),
>>>>>> + tun_vnet16_to_cpu(flags, hdr->hdr.hdr_len));
>>>>>> print_hex_dump(KERN_ERR, "tun: ",
>>>>>> DUMP_PREFIX_NONE,
>>>>>> 16, 1, skb->head,
>>>>>> - min(tun_vnet16_to_cpu(flags, hdr->hdr_len), 64), true);
>>>>>> + min(tun_vnet16_to_cpu(flags, hdr->hdr.hdr_len), 64), true);
>>>>>> }
>>>>>> WARN_ON_ONCE(1);
>>>>>> return -EINVAL;
>>>>>> diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
>>>>>> index 980de74724fc..fe4b984d3bbb 100644
>>>>>> --- a/include/uapi/linux/if_tun.h
>>>>>> +++ b/include/uapi/linux/if_tun.h
>>>>>> @@ -62,6 +62,62 @@
>>>>>> #define TUNSETCARRIER _IOW('T', 226, int)
>>>>>> #define TUNGETDEVNETNS _IO('T', 227)
>>>>>>
>>>>>> +/**
>>>>>> + * define TUNGETVNETHASHTYPES - ioctl to get supported virtio_net hashing types
>>>>>> + *
>>>>>> + * The argument is a pointer to __u32 which will store the supported virtio_net
>>>>>> + * hashing types.
>>>>>> + */
>>>>>> +#define TUNGETVNETHASHTYPES _IOR('T', 228, __u32)
>>>>>> +
>>>>>> +/**
>>>>>> + * define TUNSETVNETREPORTINGAUTOMQ - ioctl to enable automq with hash reporting
>>>>>> + *
>>>>>> + * Disable RSS and enable automatic receive steering with hash reporting.
>>>>>> + *
>>>>>> + * The argument is a pointer to __u32 that contains a bitmask of hash types
>>>>>> + * allowed to be reported.
>>>>>> + *
>>>>>> + * This ioctl results in %EBADFD if the underlying device is deleted. It affects
>>>>>> + * all queues attached to the same device.
>>>>>> + *
>>>>>> + * This ioctl currently has no effect on XDP packets and packets with
>>>>>> + * queue_mapping set by TC.
>>>>>> + */
>>>>>> +#define TUNSETVNETREPORTINGAUTOMQ _IOR('T', 229, __u32)
>>>>>> +
>>>>>> +/**
>>>>>> + * define TUNSETVNETREPORTINGRSS - ioctl to enable RSS with hash reporting
>>>>>> + *
>>>>>> + * Disable automatic receive steering and enable RSS with hash reporting.
>>>>>
>>>>> This is unnecessary, e.g one day will have select_queue_xyz(), we
>>>>> don't want to say "Disable automatic receive steering and xyz ..."
>>>>
>>>> It is still something better to be documented as its behavior is
>>>> somewhat complicated.
>>>
>>> This is a hint of uAPI design issue.
>>>
>>>>
>>>> Concretely, this ioctl disables automatic receive steering but doesn't
>>>> disable steering by eBPF, which is implied by TUN_STEERINGEBPF_FALLBACK.
>>>
>>> It would be simpler:
>>>
>>> 1) not having TUN_STEERINGEBPF_FALLBACK
>>> 2) the steering algorithm depends on the last uAPI call
>>
>> What will TUNSETSTEERINGEBPF with NULL mean in that case? It currently
>> switches the steering algorithm to automq.
>
> A stackwise semantic then?

Can you clarify the semantics with an example of a set of ioctls?
Perhaps it is an easy way to demonstrate an alternative design idea.

Regards,
Akihiko Odaki


Return-Path: <linux-kernel+bounces-675550-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5E03341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:27:47 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 33AA43AE391
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:27:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1411628643F;
Fri, 6 Jun 2025 09:27:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Fc0h1XGU"
Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DAE0204F8C;
Fri, 6 Jun 2025 09:27:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202047; cv=none; b=ezjyX/q4exLanXrvGbIqMUOnQJwxPMvG5LfvUzBscB6IPZtQNyxMd4We2ilJfdEsewBhlHgaUM375a54rBUdyoRf8ZnWFX6/BRVbNtfju7ysOx3x4cLp1Rq754c2UCZme7nfJFp16EtFezOfTqwckqDpjRzg/Fi/C/lkhpd0kdY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202047; c=relaxed/simple;
bh=qAQ8mJSWYlTfWRB8Ep92WYLN2lrT5PO+Q1r4q7E7lCQ=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=Qddf+PzG3iVfTJOcxWm0q3qQGOfqyEumVs9SZLHIL509odYWKbooVD5KwKw6WYTdWadC2bnwMeIOk5ZVufHDpkRuKTp/zT9FQz6nc02XXQNjR3kyrSiXj4VvqxKqP1rjp7hCuiLUbjAKaRtEI8bNH5OPv0tPiriu2LHkHyvVZUM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Fc0h1XGU; arc=none smtp.client-ip=209.85.208.175
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-32a7a12955eso9568281fa.3;
Fri, 06 Jun 2025 02:27:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749202043; x=1749806843; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=qAQ8mJSWYlTfWRB8Ep92WYLN2lrT5PO+Q1r4q7E7lCQ=;
b=Fc0h1XGUHHGJL6WSgZ4nf77xGDipBDeHi5BrcuyhpfTL5EuJuSO7Ct7DjA9EQRkzoa
2Bl2iK3q2UzSRn8FA6xxnn1qIC6AuO2wsLZyO0RTQ4mKmmpZ9UQP12y1IQOdWgK1TyN4
5/m4bCc0ELmcIj4aRUq1WgAy3gtkQ1kr79njiCGcyqfS04fV/1iCIUPBXcjh2pr8mK0D
HwXei4kDhv9+/g4KoEpXmg66UBx1fN/LNQmEpjaoYbj36dDeo6WX8xF8UimzfkvOV8jz
aq7hGn+BtTX8dyPTRo0/itQiwLQe+yPNYIWwnCEWzUxqY0CIkAu9NKszZOBPq7RwFNUq
2IrQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749202043; x=1749806843;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=qAQ8mJSWYlTfWRB8Ep92WYLN2lrT5PO+Q1r4q7E7lCQ=;
b=MPb4T6YkC/iBEBcM4dV86c168TaR5outM5E095cb9RY1vgZQz14hOo3WOsvt8FAbKq
6cBr50fBpzxWa6v1SqscbJloGgwDvVuKIXoGuavDVx8kINE5o+ILP0GBagIlhpPwGJqZ
e0AXM0C41W60svYEn6xpmYTCN8lXu/PWsg2e4P9iipvu9gOEx1lm4Lt715/jY2BMxp6q
ZGnUsrGqOJzdJLKks3CUhvWGyTXok0cjmtxNP3pErjhPPlv5j+CX4LpKENFvAa6yl2c4
/ODLrmQLwn6JPdJJYRQIFztmDn55sgv6n2AcT3+0bgoC5nT6KRwFiFfighOsCknJNimS
nwjA==
X-Forwarded-Encrypted: i=1; AJvYcCUisjMyAxVcu6GgT4tcTrowQknEaZ+ud93zfP3pYwwp9GZVIqimRoGy4Q+hvbwmbHGuaJBCJqg6n4i1jI7nL0c=@vger.kernel.org, AJvYcCV6bu5/eJ9Qjk1EPQPVja4bEdpqXyk9aRZ7Q7Bu26wmmywRwprxYw/wQV9dq6pSbvx0jfTMQOBk@xxxxxxxxxxxxxxx, AJvYcCVW26c6adDSMrsV8SsXrx4e8CwHaf9A5NqnKwTkUIOwwNLjAZG19yrWgiop6fedwsIXd4fjEb+aqrv8@xxxxxxxxxxxxxxx, AJvYcCWbHFEb+h0wFekz0i7SvW/evHbESJ0Ul+sXHOnbCucj5uMyUU6FajJqaqdOv9bHQUfVADnw23ooD4dShbUq@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YyG6sym7IJVUVgmAL6BLsiJNAdw2duNlvVESpK8Ps8hskKEmat6
9DcFk54bYFDBwgv16HOLUVCym2tP/xWM2HK/4xXrd7bFTyEs/LTbDwTsogZl3rt80U7dAKteDPL
SM85uidUm1ITf2FCr7iFBL9J4MaoBJQw=
X-Gm-Gg: ASbGncsm4XliZ1/RqQfZKf0FbSI6buZB38OIjONF4xyupaOUhI20v0enLsCJeqKDbFy
vtkal0VP5BN+8nksIS5eG+Zj+XPTQrO3NCwasM88e+4NJP53CEon62ZF84zt1LwgFOKxUyvrhi6
cH5+7CboIxnY7+Mh3c3qHdY/uKFUeLSB/7
X-Google-Smtp-Source: AGHT+IGUeijlpBN1uonipWsqdJg+nWSH/xMPJaX4H/+mQ0DOM4jhgZHNPYVM8V0AevFO7SK/JVaeJNVvlpd396frMbw=
X-Received: by 2002:a05:651c:220a:b0:32a:8591:668f with SMTP id
38308e7fff4ca-32adfdd88abmr6163341fa.31.1749202043172; Fri, 06 Jun 2025
02:27:23 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250127160709.80604-1-ubizjak@xxxxxxxxx> <20250127160709.80604-7-ubizjak@xxxxxxxxx>
<02c00acd-9518-4371-be2c-eb63e5d11d9c@xxxxxxxxxx> <b27d96fc-b234-4406-8d6e-885cd97a87f3@xxxxxxxxx>
<CAFULd4Ygz8p8rD1=c-S2MjJniP6vjVNMsWG_B=OjCVpthk0fBg@xxxxxxxxxxxxxx> <9767d411-81dc-491b-b6da-419240065ffe@xxxxxxxxxx>
In-Reply-To: <9767d411-81dc-491b-b6da-419240065ffe@xxxxxxxxxx>
From: Uros Bizjak <ubizjak@xxxxxxxxx>
Date: Fri, 6 Jun 2025 11:27:11 +0200
X-Gm-Features: AX0GCFsBhLxdX-uCBdNC6NAFJUOZLU2V-9ugVfL-X7mjzETyRN9kjHa3cvoik3c
Message-ID: <CAFULd4Zf4FOP-h0GVYo=frJ90tF07yvbuLbngnqUwyx9x+qz6w@xxxxxxxxxxxxxx>
Subject: Re: Large modules with 6.15 [was: [PATCH v4 6/6] percpu/x86: Enable
strict percpu checks via named AS qualifiers]
To: Jiri Slaby <jirislaby@xxxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxx>, x86@xxxxxxxxxx, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-bcachefs@xxxxxxxxxxxxxxx,
linux-arch@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx,
Nadav Amit <nadav.amit@xxxxxxxxx>, Dennis Zhou <dennis@xxxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>,
Christoph Lameter <cl@xxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>,
Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>,
"H. Peter Anvin" <hpa@xxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>,
Andy Lutomirski <luto@xxxxxxxxxx>, Brian Gerst <brgerst@xxxxxxxxx>,
Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Shung-Hsi Yu <shung-hsi.yu@xxxxxxxx>,
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 11:17=E2=80=AFAM Jiri Slaby <jirislaby@xxxxxxxxxx> w=
rote:
>
> On 05. 06. 25, 19:31, Uros Bizjak wrote:
> > On Thu, Jun 5, 2025 at 7:15=E2=80=AFPM Dave Hansen <dave.hansen@intel.c=
om> wrote:
> >>
> >> On 6/5/25 07:27, Jiri Slaby wrote:
> >>> Reverting this gives me back to normal sizes.
> >>>
> >>> Any ideas?
> >>
> >> I don't see any reason not to revert it. The benefits weren't exactly
> >> clear from the changelogs or cover letter. Enabling "various compiler
> >> checks" doesn't exactly scream that this is critical to end users in
> >> some way.
> >>
> >> The only question is if we revert just this last patch or the whole se=
ries.
> >>
> >> Uros, is there an alternative to reverting?
> >
> > This functionality can easily be disabled in include/linux/compiler.h
> > by not defining USE_TYPEOF_UNQUAL:
> >
> > #if CC_HAS_TYPEOF_UNQUAL && !defined(__CHECKER__)
> > # define USE_TYPEOF_UNQUAL 1
> > #endif
> >
> > (support for typeof_unqual keyword is required to handle __seg_gs
> > qualifiers), but ...
> >
> > ... the issue is reportedly fixed, please see [1], and ...
>
> Confirmed, I need a patched userspace (libbpf).
>
> > ... you will disable much sought of feature, just ask tglx (and please
> > read his rant at [2]):
>
> Given this is the second time I hit a bug with this, perhaps introduce
> an EXPERIMENTAL CONFIG option, so that random users can simply disable
> it if an issue occurs? Without the need of patching random userspace and
> changing random kernel headers?

In both cases, the patch *exposed* a bug in a related utility
software, it is not that the patch itself is buggy. IMO, waving off
the issue by disabling the feature you just risk the bug in the
related software to hit even harder in some not too distant future.

Uros.


Return-Path: <linux-kernel+bounces-675551-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 81F8641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:28:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id C4DEC16F29E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:28:35 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1ED23286424;
Fri, 6 Jun 2025 09:28:25 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 20C9027468;
Fri, 6 Jun 2025 09:28:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202104; cv=none; b=E5k16oC0W6wsxApSg3J830DG3QLRj81iOAMTII/6PO4qcWgLFFWO8rONLYJ7hDuJLzytFp/YM2nIxbJKYWpOON0Qts19G1Zo7yJaVzSv15G9xlpSx722b2XpFhuIrks5Jqm8JrbwexQ1q94412I38MwJSBCRWdvrrmmH1cGjrWw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202104; c=relaxed/simple;
bh=XHWGZ7c7xcEbWzJJedFfGFBEzPbGnbtlcjdCVfCQva0=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tYyze+nlvwYkAkXWyh6vAx7ZUc9dMbc06J3PvKcHtiT9dIR3ThrLmV3mTe5S1JUmR+avbp4ePw80/5Q6U11Sox4Mhz57rzEwrNQAr2j03o4JYSpp9EW21eexDJy4Fj6pt1XrKWex7vT3Sos7IPqFhMShgdwOE2C3hOd3mx4yMcg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 525361655;
Fri, 6 Jun 2025 02:28:04 -0700 (PDT)
Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B4AEE3F59E;
Fri, 6 Jun 2025 02:28:20 -0700 (PDT)
From: Ryan Roberts <ryan.roberts@xxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>,
Jann Horn <jannh@xxxxxxxxxx>,
Mel Gorman <mgorman@xxxxxxx>
Cc: Ryan Roberts <ryan.roberts@xxxxxxx>,
linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Subject: [PATCH v1] mm: Close theoretical race where stale TLB entries could linger
Date: Fri, 6 Jun 2025 10:28:07 +0100
Message-ID: <20250606092809.4194056-1-ryan.roberts@xxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Commit 3ea277194daa ("mm, mprotect: flush TLB if potentially racing with
a parallel reclaim leaving stale TLB entries") described a theoretical
race as such:

"""
Nadav Amit identified a theoritical race between page reclaim and
mprotect due to TLB flushes being batched outside of the PTL being held.

He described the race as follows:

CPU0 CPU1
---- ----
user accesses memory using RW PTE
[PTE now cached in TLB]
try_to_unmap_one()
==> ptep_get_and_clear()
==> set_tlb_ubc_flush_pending()
mprotect(addr, PROT_READ)
==> change_pte_range()
==> [ PTE non-present - no flush ]

user writes using cached RW PTE
...

try_to_unmap_flush()

The same type of race exists for reads when protecting for PROT_NONE and
also exists for operations that can leave an old TLB entry behind such
as munmap, mremap and madvise.
"""

The solution was to introduce flush_tlb_batched_pending() and call it
under the PTL from mprotect/madvise/munmap/mremap to complete any
pending tlb flushes.

However, while madvise_free_pte_range() and
madvise_cold_or_pageout_pte_range() were both retro-fitted to call
flush_tlb_batched_pending() immediately after initially acquiring the
PTL, they both temporarily release the PTL to split a large folio if
they stumble upon one. In this case, where re-acquiring the PTL
flush_tlb_batched_pending() must be called again, but it previously was
not. Let's fix that.

There are 2 Fixes: tags here: the first is the commit that fixed
madvise_free_pte_range(). The second is the commit that added
madvise_cold_or_pageout_pte_range(), which looks like it copy/pasted the
faulty pattern from madvise_free_pte_range().

This is a theoretical bug discovered during code review.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: 3ea277194daa ("mm, mprotect: flush TLB if potentially racing with a parallel reclaim leaving stale TLB entries")
Fixes: 9c276cc65a58 ("mm: introduce MADV_COLD")
Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
---

Applies on today's mm-unstable (3f676fe5c7a0). All mm selftests continue to
pass.

Thanks,
Ryan

mm/madvise.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/mm/madvise.c b/mm/madvise.c
index 5f7a66a1617e..1d44a35ae85c 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -508,6 +508,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
pte_offset_map_lock(mm, pmd, addr, &ptl);
if (!start_pte)
break;
+ flush_tlb_batched_pending(mm);
arch_enter_lazy_mmu_mode();
if (!err)
nr = 0;
@@ -741,6 +742,7 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
start_pte = pte;
if (!start_pte)
break;
+ flush_tlb_batched_pending(mm);
arch_enter_lazy_mmu_mode();
if (!err)
nr = 0;
--
2.43.0



Return-Path: <linux-kernel+bounces-675552-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 96C1C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:32:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id BF926171868
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:32:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CBDF2853F9;
Fri, 6 Jun 2025 09:32:27 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 11BCA27468;
Fri, 6 Jun 2025 09:32:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202346; cv=none; b=IYklOYotOyHDubiz8vvkTfqrkaPE1jpJVj3VmBWGyxVfVzSTRx4IROjgDDQxNwamKV4ltlijQ5tyHzfB4tJfQw8CO26ilt+2WrwsQDkOVjP6Wd2DpzOVTPtDtadIb+L/CrsbfI+oSlyK7J5RRmmKqSEv31PjsxaU5UF5anD2PU8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202346; c=relaxed/simple;
bh=g81aEbYwteZ3V3OWzvKzvIPAPWgs84217Y0lm1MM9SA=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=VZFEGuWT30NXGaXRxqLv/8BQiRw95BnSjQNEgwddOn5B+TFgNHVdCtkGrxv31jyMqkS0+G12Hv5AmAJ1Xq9/U9kHgRowdCgprft4pOYWrRfS+qys7/t1ptoBEL0J2fpEn/MdhTlACXu65AlKCzSUpo/HNNPwcMmCQmWqBOuvqxQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 830E3153B;
Fri, 6 Jun 2025 02:32:06 -0700 (PDT)
Received: from [10.57.49.177] (unknown [10.57.49.177])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4A98B3F59E;
Fri, 6 Jun 2025 02:32:22 -0700 (PDT)
Message-ID: <11ea6009-72d2-4306-a068-a828d4af429d@xxxxxxx>
Date: Fri, 6 Jun 2025 10:32:21 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 1/2] dt-bindings: arm: Add device Trace Network On Chip
definition
Content-Language: en-GB
To: Yuanfang Zhang <quic_yuanfang@xxxxxxxxxxx>,
Mike Leach <mike.leach@xxxxxxxxxx>, James Clark <james.clark@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: kernel@xxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
coresight@xxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
References: <20250606-trace-noc-v8-0-833f94712c57@xxxxxxxxxxx>
<20250606-trace-noc-v8-1-833f94712c57@xxxxxxxxxxx>
From: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
In-Reply-To: <20250606-trace-noc-v8-1-833f94712c57@xxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 10:18, Yuanfang Zhang wrote:
> Add a new coresight-tnoc.yaml file to describe the bindings required to
> define Trace Network On Chip (TNOC) in device trees. TNOC is an
> integration hierarchy which is a hardware component that integrates the
> functionalities of TPDA and funnels. It collects trace form subsystems
> and transfers to coresight sink.
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> Signed-off-by: Yuanfang Zhang <quic_yuanfang@xxxxxxxxxxx>
> ---
> .../bindings/arm/qcom,coresight-tnoc.yaml | 111 +++++++++++++++++++++
> 1 file changed, 111 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tnoc.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tnoc.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..d07c6f2d7b949f69f9d8dd8de8664382eb39fac1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tnoc.yaml
> @@ -0,0 +1,111 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/arm/qcom,coresight-tnoc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm Trace Network On Chip - TNOC
> +
> +maintainers:
> + - Yuanfang Zhang <quic_yuanfang@xxxxxxxxxxx>
> +
> +description: >
> + The Trace Network On Chip (TNOC) is an integration hierarchy hardware
> + component that integrates the functionalities of TPDA and funnels.
> +
> + It sits in the different subsystem of SOC and aggregates the trace and
> + transports it to Aggregation TNOC or to coresight trace sink eventually.
> + TNOC embeds bridges for all the interfaces APB, ATB, TPDA and NTS (Narrow
> + Time Stamp).
> +
> + TNOC can take inputs from different trace sources i.e. ATB, TPDM.

This looks like the generic description of TNOC. But please could you
also mention this binding is only for Aggregator TNOC ? Or make the
binding as such explicit ?

- qcom,coresight-aggregator-tnoc

Suzuki


> +
> +# Need a custom select here or 'arm,primecell' will match on lots of nodes
> +select:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - qcom,coresight-tnoc
> + required:
> + - compatible
> +
> +properties:
> + $nodename:
> + pattern: "^tn(@[0-9a-f]+)$"
> +
> + compatible:
> + items:
> + - const: qcom,coresight-tnoc
> + - const: arm,primecell
> +
> + reg:
> + maxItems: 1
> +
> + clock-names:
> + items:
> + - const: apb_pclk
> +
> + clocks:
> + items:
> + - description: APB register access clock
> +
> + in-ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> +
> + patternProperties:
> + '^port(@[0-9a-f]{1,2})?$':
> + description: Input connections from CoreSight Trace Bus
> + $ref: /schemas/graph.yaml#/properties/port
> +
> + out-ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> + additionalProperties: false
> +
> + properties:
> + port:
> + description:
> + Output connection to CoreSight Trace Bus
> + $ref: /schemas/graph.yaml#/properties/port
> +
> +required:
> + - compatible
> + - reg
> + - clocks
> + - clock-names
> + - in-ports
> + - out-ports
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + tn@109ab000 {
> + compatible = "qcom,coresight-tnoc", "arm,primecell";
> + reg = <0x109ab000 0x4200>;
> +
> + clocks = <&aoss_qmp>;
> + clock-names = "apb_pclk";
> +
> + in-ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + tn_ag_in_tpdm_gcc: endpoint {
> + remote-endpoint = <&tpdm_gcc_out_tn_ag>;
> + };
> + };
> + };
> +
> + out-ports {
> + port {
> + tn_ag_out_funnel_in1: endpoint {
> + remote-endpoint = <&funnel_in1_in_tn_ag>;
> + };
> + };
> + };
> + };
> +...
>



Return-Path: <linux-kernel+bounces-675553-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E91BA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:33:16 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id D4EF53AE5FD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:32:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A5A2228643E;
Fri, 6 Jun 2025 09:33:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aHjUGbiM"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA2F4191F7E;
Fri, 6 Jun 2025 09:33:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202383; cv=none; b=LfHZDB+fQPJwoA+b8NW67ziOGXUaLRd92/uHTIlhDcxHHzf2FugevwwC9MBWkihTmji3OfWjH1IJvvGB8LNpSW5VSfYolRzajMcHLHNF4so7OH6Dau/wmcRXe4FijHcdxYE7QH7Y0MV9TkBnxZeNGVsG+swMY9iz4OBJEW7dbD8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202383; c=relaxed/simple;
bh=a/cSRPXXvWMntEronSsbDihFTabNg3hkGiuEn4chUIA=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
MIME-Version:Content-Type; b=hDNEX4h/T4/K0Kd2eW1x3SUGBGrBOchYEjhs3Z+onwhEMhZhAnS78kMSvRMZpz5yKlnwxhO1FMNsY7RTBCDr8UsC6r2XueIhDuyH6hCTZ4Xg6PeF2KpKWLADSBt9mvCnfMKbVgtJCsRqdNwyPkfBGpaHJYQHKS7hNsjIntBxfxo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aHjUGbiM; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10A5FC4CEEB;
Fri, 6 Jun 2025 09:32:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749202382;
bh=a/cSRPXXvWMntEronSsbDihFTabNg3hkGiuEn4chUIA=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
b=aHjUGbiMRTgqmKBI5/NKSytER+wD+f8xtIQAG9im9jNLtdG0Euimvzu7mf27OGY9+
02d4tGq5I3JSdFyRFuprtiwxviESlUW+rjOju0gNhU9O+51pPm9ArY1Jb4zZ9+iaFL
4+tfVM5CGBw9LbksFk0KUh5/3IXXkhxjz3MX4gFhNP8vwp4S3zppGj+T6jvzfDfI3b
mC65zomebElguFf6DZbQwXmqg3dRm2SZQ7UVQMkAS0eZMMVEXIPjCElKMlyC9MjPDR
1CanswgBu1tw1VRmrDvt8/qS2s2JGvUgF4Q+c893ZONew80RB7FZKa7htzlP+zA8/a
BvOmCaJ/eEw3w==
X-Mailer: emacs 30.1 (via feedmail 11-beta-1 I)
From: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxx>
To: Jason Gunthorpe <jgg@xxxxxxxxxx>
Cc: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx,
sumit.semwal@xxxxxxxxxx, christian.koenig@xxxxxxx,
pbonzini@xxxxxxxxxx, seanjc@xxxxxxxxxx, alex.williamson@xxxxxxxxxx,
dan.j.williams@xxxxxxxxx, aik@xxxxxxx, linux-coco@xxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx,
linaro-mm-sig@xxxxxxxxxxxxxxxx, vivek.kasireddy@xxxxxxxxx,
yilun.xu@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, lukas@xxxxxxxxx,
yan.y.zhao@xxxxxxxxx, daniel.vetter@xxxxxxxx, leon@xxxxxxxxxx,
baolu.lu@xxxxxxxxxxxxxxx, zhenzhong.duan@xxxxxxxxx,
tao1.su@xxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx, zhiw@xxxxxxxxxx,
simona.vetter@xxxxxxxx, shameerali.kolothum.thodi@xxxxxxxxxx,
iommu@xxxxxxxxxxxxxxx, kevin.tian@xxxxxxxxx
Subject: Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for
TEE-IO support
In-Reply-To: <20250605163339.GE19710@xxxxxxxxxx>
References: <20250529053513.1592088-1-yilun.xu@xxxxxxxxxxxxxxx>
<20250529053513.1592088-20-yilun.xu@xxxxxxxxxxxxxxx>
<yq5ah60u8kev.fsf@xxxxxxxxxx> <20250605151029.GC19710@xxxxxxxxxx>
<yq5a7c1q88oy.fsf@xxxxxxxxxx> <20250605163339.GE19710@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 15:02:49 +0530
Message-ID: <yq5a1prx8bb2.fsf@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Jason Gunthorpe <jgg@xxxxxxxxxx> writes:

> On Thu, Jun 05, 2025 at 09:47:01PM +0530, Aneesh Kumar K.V wrote:
>> Jason Gunthorpe <jgg@xxxxxxxxxx> writes:
>>=20
>> > On Thu, Jun 05, 2025 at 05:33:52PM +0530, Aneesh Kumar K.V wrote:
>> >
>> >> > +
>> >> > + /* To ensure no host side MMIO access is possible */
>> >> > + ret =3D pci_request_regions_exclusive(pdev, "vfio-pci-tsm");
>> >> > + if (ret)
>> >> > + goto out_unlock;
>> >> > +
>> >> >
>> >>=20
>> >> I am hitting failures here with similar changes. Can you share the Qe=
mu
>> >> changes needed to make this pci_request_regions_exclusive successful.
>> >> Also after the TDI is unbound, we want the region ownership backto
>> >> "vfio-pci" so that things continue to work as non-secure device. I do=
n't
>> >> see we doing that. I could add a pci_bar_deactivate/pci_bar_activate =
in
>> >> userspace which will result in vfio_unmap()/vfio_map(). But that does=
n't
>> >> release the region ownership.
>> >
>> > Again, IMHO, we should not be doing this dynamically. VFIO should do
>> > pci_request_regions_exclusive() once at the very start and it should
>> > stay that way.
>> >
>> > There is no reason to change it dynamically.
>> >
>> > The only decision to make is if all vfio should switch to exclusive
>> > mode or if we need to make it optional for userspace.
>>=20
>> We only need the exclusive mode when the device is operating in secure
>> mode, correct? That suggests we=E2=80=99ll need to dynamically toggle th=
is
>> setting based on the device=E2=80=99s security state.
>
> No, if the decision is that VFIO should allow this to be controlled by
> userspace then userspace will tell iommufd to run in regions_exclusive
> mode prior to opening the vfio cdev and VFIO will still do it once at
> open time and never change it.
>

So this will be handled by setting
vdevice::flags =3D IOMMUFD_PCI_REGION_EXCLUSIVE in
iommufd_vdevice_alloc_ioctl()? And we set this flag when starting a
secure guest, regardless of whether the device is TEE-capable or not

and vfio_pci_core_mmap() will do

if (!vdev->barmap[index]) {

if (core_vdev->iommufd_device &&
iommufd_vdevice_region_exclusive(core_vdev->iommufd_device))
ret =3D pci_request_selected_regions_exclusive(pdev,
1 << index, "vfio-pci");
else
ret =3D pci_request_selected_regions(pdev,
1 << index, "vfio-pci");




>
> The only thing request_regions does is block other drivers outside
> vfio from using this memory space. There is no reason at all to change
> this dynamically. A CC VMM using VFIO will never use a driver outside
> VFIO to touch the VFIO controlled memory.
>
> Jason

-aneesh


Return-Path: <linux-kernel+bounces-675554-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8271D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:34:04 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8AAA13B0F8B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:33:42 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 07A6F28640C;
Fri, 6 Jun 2025 09:33:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="lvAG+tHk"
Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8992191F7E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:33:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202436; cv=none; b=B1NJ5RDUK/FR8MWfXkZUINuVC9bUjxK/c3YC4iwkpBWzubr7NTDz6x6OIQBzrCpMrzHBQUiCV+XX3fWNLoibWnsNh/8fijUJhzVsGiDTqD8zCDVBZkpo5ShDzAT+iFWO6vhgqy0HCQlNaDlVGvwyZ9GiAsoL9MZ9f3uk3wmsDL8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202436; c=relaxed/simple;
bh=NCD3FsHqX/tDsdqDrxlXUdzTVx+2sqRGtUtrxLK6jAc=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=LTp85mLTHkqC6B/JtzMvMtiZZIpDqHE6qgeZNRCimS3nLfVFQ74IKIsR/jRRdsp86h5/J8nQ3c7eHqB3Oqab27wQrpbEFXr0wwf3+OPuhWcFvGxYFMwjbbQ/dKTFLsZFz+kl6gRdQT874iq9M6we3zAQ3lsFxcaoJUD/wL9X5FY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu; spf=pass smtp.mailfrom=szeredi.hu; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b=lvAG+tHk; arc=none smtp.client-ip=209.85.160.176
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=szeredi.hu
Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-4a44b3526e6so23027611cf.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 02:33:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=szeredi.hu; s=google; t=1749202433; x=1749807233; darn=vger.kernel.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=kjjJoIKAqPL4Fi3nMaT3Fad+/StO4aRC+TRTWdCbeTc=;
b=lvAG+tHkEIFwrw/yQXFUo0RH+vfERl2p/X23Pzswzv4TaPWDxbepHDZIr3RmqV7aCq
eaYotMiBY26iIMwt2AJx45me/PQfzUI+tHBfPK4n3fEhAmGz0+VHSoA3l8qW+pik3ND1
xvYFl1SOljGyKrq/Hwp/2q+u8k3l9uDXzQvJ8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749202433; x=1749807233;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=kjjJoIKAqPL4Fi3nMaT3Fad+/StO4aRC+TRTWdCbeTc=;
b=f7iz6cquuscrFtn1bdNvqWpb3JYAgRNPPr3sGNrjtUCpmcJwXHwn9fyqXay2tIqjKC
qOYxVMa5RA9YbJY4l1ixUg+82HlurVh8WmGHlJ5V03dRG5bSHa1JHH48li3MJZ7IJpFB
7nhFe7mlpixnCHhGNctel40e6yAboLFDTe6YZtDGhGKBfCnJa2Dz1Pa/jAMJGOa+SUTm
SH9Pt0vUYcjvHUISMVoJUOURd5/BTZHCXjulc3U25DjuGH7i9WLqxf/NPcMBqrUytl2x
8vw+pnffy1gY1/KSPbV9PNjpOr2jbL1u3tlJMPO1TW1gAAKyjw9orWBsrlumqc1I71un
a3fQ==
X-Forwarded-Encrypted: i=1; AJvYcCUC2LCKAxecIWK3N7Wi2A5gEW5VISi19PEM5wStd3dHI1F1udE3CC7LWqXrDDw1hnezUoOGszZ8hl3SEzU=@vger.kernel.org
X-Gm-Message-State: AOJu0YzqHUkFEWqHM0LbIHa3oTf1zABGZ03kCaWwsvIqv1MU4e7wMNNX
V+kOzvG052iL6t+vNJLyPnte4NuuwRbh9Rn4tpiuWItLG8b77NdH5LAD1xxLUQl+b+ehRFCVJ7Q
xL8ACrcIpTtLrCDhg5NjKIbw86pDW0JjmyJ58QWRHjA==
X-Gm-Gg: ASbGnctFOLjHf1ohEcv8B3r4dLmq9amoc0zZdFKlo7lt/vnvlmwT7flgR+XOfseBUz6
smYmlUISA8Bj1K5fuPVMkY2Z/AVQtFCxk/5/MQgs+2BWRhW8+3N9uL2JTJmyHjKydSv8WUZDLHz
HvDxxDS9ROU3lptoRKElUFe/KUGYTP6gM=
X-Google-Smtp-Source: AGHT+IEpD8A+u93yY7dMI4QI7COmSAbaXPHLO6KjHqBSEgUYxk/Jw0ZYl1TrJ9sLHanEFIt9Z9r1xEAOroted7uPQME=
X-Received: by 2002:a05:622a:428c:b0:48e:1f6c:227b with SMTP id
d75a77b69052e-4a5b9a47e1amr44216851cf.26.1749202433527; Fri, 06 Jun 2025
02:33:53 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <CAJfpegvB3At5Mm54eDuNVspuNtkhoJwPH+HcOCWm7j-CSQ1jbw@xxxxxxxxxxxxxx>
<CAHk-=wgH174aR4HnpmV7yVYVjS7VmSRC31md5di7_Cr_v0Afqg@xxxxxxxxxxxxxx>
<CAOQ4uxjXvcj8Vf3y81KJCbn6W5CSm9fFofV8P5ihtcZ=zYSREA@xxxxxxxxxxxxxx> <CAJfpegutprdJ8LPsKGG-yNi9neC65Phhf67nLuL+5a4xGhpkZA@xxxxxxxxxxxxxx>
In-Reply-To: <CAJfpegutprdJ8LPsKGG-yNi9neC65Phhf67nLuL+5a4xGhpkZA@xxxxxxxxxxxxxx>
From: Miklos Szeredi <miklos@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 11:33:42 +0200
X-Gm-Features: AX0GCFvFo8VWZRAyQvoO_OwOv8y44RwyQfaZo7GsgVMP1nOljN6vif8ZNW5sSOg
Message-ID: <CAJfpegu1BAVsW5duT-HoMGiSXNvj2VsLNfTuzvF1-RLyVLDdTA@xxxxxxxxxxxxxx>
Subject: Re: [GIT PULL] overlayfs update for 6.16
To: Amir Goldstein <amir73il@xxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>,
overlayfs <linux-unionfs@xxxxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 6 Jun 2025 at 08:36, Miklos Szeredi <miklos@xxxxxxxxxx> wrote:

> I'll redo the PR with your patch.

Pushed to #overlayfs-next.

I'll drop this from the PR, since it's just a cleanup. It still won't
break anything (and that's what I meant by "trivial"), but it can wait
a cycle or at least a few rc's.

Thanks,
Miklos


Return-Path: <linux-kernel+bounces-675555-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 427C641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:34:16 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id C98A7173D31
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:34:16 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 660F827468;
Fri, 6 Jun 2025 09:34:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="AsVUO9lP";
dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="AsVUO9lP"
Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazon11013037.outbound.protection.outlook.com [40.107.159.37])
(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 8A8C0191F7E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:34:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.159.37
ARC-Seal:i=3; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202445; cv=fail; b=a2zpL15X6dUKnOIlMqDr6KsUBeKuBn0MzqsMpAuBzkhY+iBeeqFsAFzV1fA7K6IpQKorqDNoYgmFP2tZKo+P9E/45sne5lK0sgP7gIKkCDdfW9pnad3+17AihDLfGT89wron2Gqe8r0Eh6s043zfsCbHBL/Ky8GHgaH8J4NHn1c=
ARC-Message-Signature:i=3; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202445; c=relaxed/simple;
bh=O06LhCQIuK7c+cBnHkhPsCPx5QW19MkpuGP0Gw3q1lg=;
h=Message-ID:Date:Subject:From:To:Cc:References:In-Reply-To:
Content-Type:MIME-Version; b=ay6q4hIF2w11cGAD31tyoxVjlmb81M/fbly5lG/i3nuwGZPb8naker46coYBZHY3gQkK0WT912665ayyFX7O9lbxLkHsCQiNAIp6HuWUl93ytn+hPwfywxO3QORv9t72lVRnWLqqkgKjXenZqlD+7MGtObwBD94Stf+hSx+mb5Q=
ARC-Authentication-Results:i=3; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=AsVUO9lP; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=AsVUO9lP; arc=fail smtp.client-ip=40.107.159.37
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass;
b=d1SC8zechAMhFIfSX29TpixgkpC9qMCEJeM6SjBJsdZYVauCEpG5YWA3J4FzorqbjsVfM6A7hHmpQcwQFs8UOY2WVOQvqlUfb0xZtb/Rgxfg5jxUjJvdVxWs7ZexOgq1Nnu3JQmB9wV5kiNMeyNx5ye/LW97IutfARtLF+bEangcfIVGZcp2p274YvnoICqp3hyMphA+tBPoP/ZSgZQrym9PiDFVkLWWmxFsxmI0xjWPq0yA8rp61fCRlQT9mMRRVQLf0Ay6BVxSlE/TpaL4joP6GSdESCA0ILzmFiHylJa4k7gjUoOUqjOvUiIhZnAynKNOxQIz9jrNNK62WzdiRA==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=wOMA75XJH6voJUZcIb2cczi10iVLH2bEc3TJt7aeA28=;
b=cGZlI9Bp5+cYq18trHgcluZYyi1P9MFEQXzjeltXMLX9+PJCquDQRFBr9XdMiY/lHt3W/CuRSavBOfnpg1bTUxYvopN0iY1SFxXF2rpMa6ILLzhJ6mJE7XUE6YafK0wjxx8LUEWxRrG6NKhFb2BWmBSHMZiCmDrs8Pa/OKaE5E+mApYg71rewjWUMro1KUlJC0Wcp20kvQVGOOMSYtT2vj1SkMK+7baPbfyfhTfRST8xbhILiARo1GrXGF4KqDpWLg8H54fbvgxUjhZuTfSrgDB2CuQpeoCL6hH/hKjFRSZVy28wVaPOvfBucOQ7q3JGvVFX4YSioqKi/O9tnq+hCQ==
ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is
4.158.2.129) smtp.rcpttodomain=oracle.com smtp.mailfrom=arm.com; dmarc=pass
(p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass
(signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1
spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com]
dmarc=[1,1,header.from=arm.com])
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=wOMA75XJH6voJUZcIb2cczi10iVLH2bEc3TJt7aeA28=;
b=AsVUO9lPm+GNZ1i+lZ1IkhAdqHJyvLYuPIfZRsDnVmRCHFPDSxyHokZmGCsoh7tx515M8y6AETYY7Q9pLD4jIE1g0iOt5Z5My+v/PCo4ZbILtolQ+W9iEYlRD7aHk9l8BRIh0Fsdde7zOQCRoqEHHl3+3ynkUQhVwb4Pr7Qo+Vk=
Received: from AS4P192CA0009.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:5da::16)
by AM8PR08MB6402.eurprd08.prod.outlook.com (2603:10a6:20b:363::10) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 09:33:59 +0000
Received: from AMS0EPF000001B1.eurprd05.prod.outlook.com
(2603:10a6:20b:5da:cafe::7e) by AS4P192CA0009.outlook.office365.com
(2603:10a6:20b:5da::16) with Microsoft SMTP Server (version=TLS1_3,
cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.29 via Frontend Transport; Fri,
6 Jun 2025 09:33:59 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129)
smtp.mailfrom=arm.com; dkim=pass (signature was verified)
header.d=arm.com;dmarc=pass action=none header.from=arm.com;
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates
4.158.2.129 as permitted sender) receiver=protection.outlook.com;
client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C
Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by
AMS0EPF000001B1.mail.protection.outlook.com (10.167.16.165) with Microsoft
SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.29
via Frontend Transport; Fri, 6 Jun 2025 09:33:58 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=eFTjnsrpm1bXUt5eEAvUjOfBYhsAniA5F4Mb/uXgDX75FbVfM7d07X7J6qs5z/qOMi0VX9gu/YOcyLRtJs9M2RUw6ChgRjoG+TWX8TPhG2lYkT1MoD1clJlqV0vHtJswFX2AePDgQhLtj6qgHr3HZJj1zGWeZAQyRbdRuXiBfmAWbK4Z/MCgXJaEIDZ5C0J4KF2cCYP15J36HjSCQ5cUiprXqb87hUavKHNhyTvGixUiNL39OsPCeBPT/Y0P82tha/axIxUQxujwmMJ/lDTK+RT3MwZS5mqkSf8tJvEiEMmDnF+fkjTWhLAsuSo0sSVd+1o3eVSIrM4g2qAo6hDLFw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=wOMA75XJH6voJUZcIb2cczi10iVLH2bEc3TJt7aeA28=;
b=EFZk/bQ1hE52Rm1Gi+4+zUQRZBFx4DUuGfknO+ehoiU7hmqzsyTONQ1m8MNRu9oywCTc4DrbIHTb5U/Ifisz372vU4GHFWdtHxRtLbVGE3mBuYD+C0CZxCJ7SuEm1xFfAWy9RLPLJDZsgYJhbggKvN3HVNVe7Vo9o6ZsAtIMaM6hqPDdzFiDPlVaoAZpdoATmAVW4Jj7JHJMzqv1w/NwIqxqm7/2RLmd8Glx0rPIC3Z9q48LDTjDGmvUkb5PWSerC6DHaYTQA10mVoSN+mrjxFfYFqeiWKkGtbbPhqQk2ek7Q+QsvqUFgZul074IFSxWMJmWl52fL1bIhTyVAZ/Kuw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass
header.d=arm.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=wOMA75XJH6voJUZcIb2cczi10iVLH2bEc3TJt7aeA28=;
b=AsVUO9lPm+GNZ1i+lZ1IkhAdqHJyvLYuPIfZRsDnVmRCHFPDSxyHokZmGCsoh7tx515M8y6AETYY7Q9pLD4jIE1g0iOt5Z5My+v/PCo4ZbILtolQ+W9iEYlRD7aHk9l8BRIh0Fsdde7zOQCRoqEHHl3+3ynkUQhVwb4Pr7Qo+Vk=
Authentication-Results-Original: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=arm.com;
Received: from AM9PR08MB7120.eurprd08.prod.outlook.com (2603:10a6:20b:3dc::22)
by PAVPR08MB9722.eurprd08.prod.outlook.com (2603:10a6:102:31d::16) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 09:33:25 +0000
Received: from AM9PR08MB7120.eurprd08.prod.outlook.com
([fe80::2933:29aa:2693:d12e]) by AM9PR08MB7120.eurprd08.prod.outlook.com
([fe80::2933:29aa:2693:d12e%2]) with mapi id 15.20.8813.018; Fri, 6 Jun 2025
09:33:25 +0000
Message-ID: <099ada2f-ed5e-4797-a51e-ba3edc528620@xxxxxxx>
Date: Fri, 6 Jun 2025 15:03:18 +0530
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/3] mm: Allow pagewalk without locks
From: Dev Jain <dev.jain@xxxxxxx>
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: akpm@xxxxxxxxxxxxxxxxxxxx, david@xxxxxxxxxx, catalin.marinas@xxxxxxx,
will@xxxxxxxxxx, Liam.Howlett@xxxxxxxxxx, vbabka@xxxxxxx, rppt@xxxxxxxxxx,
surenb@xxxxxxxxxx, mhocko@xxxxxxxx, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, suzuki.poulose@xxxxxxx, steven.price@xxxxxxx,
gshan@xxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
Jann Horn <jannh@xxxxxxxxxx>, Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>,
Ryan Roberts <ryan.roberts@xxxxxxx>
References: <20250530090407.19237-1-dev.jain@xxxxxxx>
<20250530090407.19237-2-dev.jain@xxxxxxx>
<6a60c052-9935-489e-a38e-1b03a1a79155@lucifer.local>
<ecfed817-105d-487f-80ba-52965f926c1e@xxxxxxx>
Content-Language: en-US
In-Reply-To: <ecfed817-105d-487f-80ba-52965f926c1e@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: MA0PR01CA0001.INDPRD01.PROD.OUTLOOK.COM
(2603:1096:a01:80::14) To AM9PR08MB7120.eurprd08.prod.outlook.com
(2603:10a6:20b:3dc::22)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-TrafficTypeDiagnostic:
AM9PR08MB7120:EE_|PAVPR08MB9722:EE_|AMS0EPF000001B1:EE_|AM8PR08MB6402:EE_
X-MS-Office365-Filtering-Correlation-Id: b866f0ed-5773-4a4a-83a1-08dda4dd43ad
x-checkrecipientrouted: true
NoDisclaimer: true
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam-Untrusted:
BCL:0;ARA:13230040|366016|1800799024|376014|7416014;
X-Microsoft-Antispam-Message-Info-Original:
=?utf-8?B?MU4wN296Y25Pd3BYdGpGWU91VmhyMmdjQWhWcHRIR2lKemZiZ3BQRFpybHZM?=
=?utf-8?B?amF5YkFNM05LdmxxSGNtWWM2MlYxM09JTHBoTE43eENDMnNIQXVQSmtYT0Fp?=
=?utf-8?B?dDlqdWEwbENBQmtmNlBVSnNHWC95Q2hrQTRoVE1MWGV1OC95R0hwNFpaWWU4?=
=?utf-8?B?UW5kSS9QSlNLVmFDUnRVRXVkWlFyR0VCNURCdVZUaFdEMHhEYjAyY3FRTWMr?=
=?utf-8?B?ZTB0bHBnUmtWcmd4NGsxS3VkNy9EL1BERHYxVS9PL1dPK1I0VnF6Ym5Mb0Ji?=
=?utf-8?B?bk14MWJxaVVQV2dhb25BaUV4Z0NVM2dWT3dOdjBqS1ZpaS8yanNkR2xnVlB3?=
=?utf-8?B?WFd5N1ZpWUIyV1N3Yld1TG5lN3FlanVXeGI1SWo0SU9IczVLUkxGV1FEOHlS?=
=?utf-8?B?Vk02Q21tbTYxYmhTWFFZbTRSTkdjR0xlQkNtb2k4V1IzbFMvb3RqTi9xWWFK?=
=?utf-8?B?bmluTTROL2dMOWxrM3NXTzdxZ1dtMHRGVUR3Z1BPcnUrTWRuYlFad3Y5TEZ0?=
=?utf-8?B?ZGVDeml2bk5pNllQRnBEam5GV1dwUUZaWU5FbGZVRE1HOWxrcnNiYWdYOS91?=
=?utf-8?B?QUMrNzVydG9TT1FXZGpLYnp5VFZ2WGdWRzRmNXBUcUlvRTdLdFRldG9FS2dT?=
=?utf-8?B?aDVBempmT0t3L2tvdWc0d3pXeW4yTVBYNXhXOXpzenkwOXh0SGRBd1QrcWM2?=
=?utf-8?B?TkdLQ29IM3psd3RUeVEwUHprSzg3d2dFZjA3aStsTFZjaFdQTEVQbW5NeWFl?=
=?utf-8?B?VE1jR3c4UlM4SWhjT0Z4Sm5kYk5NSTY0NE5IdjRqcm9senc2aE4rRHNiR3lt?=
=?utf-8?B?MG50S28rNXVGaGdqcGVPVEtCOVBiWkZYb0MxR0Qwck1JbENmWmx1eUNnS3Fl?=
=?utf-8?B?OGs1V2tMQlBuWXhCOEVXQ0x0WVlMckpIQkpkb1l0RG1OV1hZeENiQ2dkZk1B?=
=?utf-8?B?WUpUM3ROKzJpckc5VXJla2k1Q3Y5SlFLVEdiNEZUQjJiY3p6UXRyYWpzT29v?=
=?utf-8?B?WWcwYW9ZVW0waHlWQStFM2pabERJVW1mV216TFMrU05XcEpHWVIxbVdLbUMy?=
=?utf-8?B?Vm5VVThGbmpuNFMyV1czVGRBYTFqVXdPVEs0bWhKbGE0MXdBenZtVnFTMVRp?=
=?utf-8?B?YmtPL2ovc2FCSm9aRHQydjV3RDhhV1JzaEhrcmZMSkJGc1F5Njdtb1YwazJw?=
=?utf-8?B?WWFCZGFtVm41SG54L3IxU3FRTkY2SVk3WDVkaXNpOVA5VWk4bWhjUjdzUU5k?=
=?utf-8?B?RHYyVEk3RFkzWjBBS3FoVERQSVliS3prTEdmS0kxeXR6N2VyTTl5Vnc1OXBH?=
=?utf-8?B?MCtHN0NZSVM5dWZPQkNsQXlFN0NRNXhNYld6cngzS0RUUlZMN1dkOVpHSi9P?=
=?utf-8?B?aTg0TlRJbHdXVnpmd0dYSlluNVBTM3F5aHhFM1EwRXlUclAweTdpQ0hKalp1?=
=?utf-8?B?R0had2ZnK2lUekFFOTZja00zSFFRWFhoVDBsQUZwRnFiRCtYOTFBWXN5UWNT?=
=?utf-8?B?NVpSb3ZVN3ZKOHZXSUcrS2o1YlFUdXNwZDBvMTJWZlRId3FrUHpPckpwMll0?=
=?utf-8?B?WEEvbkRkeHQvdGxSZVhYR000RkV3ZXMxa1FJTzhqa29iKzJUYVNmVzdMOWtF?=
=?utf-8?B?aXExd1ZYak1QdnZ2a3dIOTV2NDlSc1loOTN6ZFg1b01qZDRaK2Z2Rk80TStj?=
=?utf-8?B?cXBQQ3N6U1hqREtLbDdlVU4zODlucEtTd0RqeHVwOHJlWWRhTmkvaXFUMTAz?=
=?utf-8?B?bDVoalpnSkp3RjN4K0RHQU13NmxZeFltZFUxaGpBN1lsZ0VmTkNKUHNvbXEr?=
=?utf-8?B?b3QxSC8rUFhGS1hhcTNSeGZrTlNNc2FnblVsc0NIcVoxalhXZlAvcHVWbHNJ?=
=?utf-8?B?dXY5K0t5L3NWODFzRkl1RGNENXJFN01RUVdWVHQ0dThLb3Uyd3NITzBiVUFQ?=
=?utf-8?Q?Pi0eDpMJTRs=3D?=
X-Forefront-Antispam-Report-Untrusted:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR08MB7120.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(7416014);DIR:OUT;SFP:1101;
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9722
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
AMS0EPF000001B1.eurprd05.prod.outlook.com
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id-Prvs:
7f26a5a2-0e28-45e5-894b-08dda4dd2f71
X-Microsoft-Antispam:
BCL:0;ARA:13230040|36860700013|82310400026|35042699022|1800799024|14060799003|376014|7416014;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?eGkwYUNQU05lMEl4aFZqd0NLQjc1VDhxNzVwR21saFBVVUdNR3pHYWtoQ2Fn?=
=?utf-8?B?OHU3UmpEcXR1b1ptSm1WS3hWdkkwdWFIZC9TVlhRUUtnSlloUXpHcmc1SytO?=
=?utf-8?B?a1MvbzlYZ0RqMkQ0ZDFwOWxnbFNMMVBBemFXanZJWEpYOVV4SjZwZnFpVE5T?=
=?utf-8?B?QUp0OUhTZFpITUM5ZHFJY3E4dUZDTDBUcDl6ZjNjRy9YR1A5QUNjRmx3Nldt?=
=?utf-8?B?Vm1kdGVaWjU1dmNpUWNOSlZQNzdzaWFOK0VwaFkza2o4aGs3OThBc01odS96?=
=?utf-8?B?NFVSSm9wNU5hTDVjKzAzL0NpYnh2cW8vbFc5WmYwY1dpODBXdGM2UGpIQ0JE?=
=?utf-8?B?RmhCMnBxQkoxMGIvL2s0THpBUDBxeVp1ZnQ0R1N6Z25iZEhCQVJld0tuWGVC?=
=?utf-8?B?bmJ5bkQzS2QzbUxVZXJUQjkzenJ1cHBYaTY2a1ZzTHRhekViTEhNUE4wY1NV?=
=?utf-8?B?RUJCMDRQNUt6N2xiNEtmN3BHQmMzaWZ2bWdyQ3c4MUR6ZVFJWnBVcTR5OFBz?=
=?utf-8?B?MEUwMjRZTWx0S2taWXpMYzNHUUlCb0NlTUdBUFFxd2t1akZTUnI1c3ByQytX?=
=?utf-8?B?M2tnL3RhRGp3RlFpUWMxWGxDWk5vYVd4em5wNzNGemFNbmgzajJCSE54TDVI?=
=?utf-8?B?bC93S29sZkQwUjlSVm1xYTc4ZmRSUXhoV2l4VnpWTi9GYmxOeW4vOGxhRnBD?=
=?utf-8?B?Y2wvZU1rSG9pVUNxV0RuWWtRM0M0dDdPNnJzSGNTNmZ3U1g5K0VyQWgra2pr?=
=?utf-8?B?VFpnYjJsUkt0YkhCQ1lac3gwN2RlYmlQS3d1M3pReG8rbzZPY3EyVEZkcG50?=
=?utf-8?B?Rlo3RXFUWWFZWEVpZ3UxTkJaSENRQnpRVDF1UTU2RkkvL3BEWk9Gbnp2aS9K?=
=?utf-8?B?eFQrNmt1QkpPMXlaN1Z1MU5QTWFLbkNvZFNFYmZ4THR1TmpJQmxxc3ZPWmli?=
=?utf-8?B?VEM1dXRIdkVoSHdHRG9CUFI0VnZYcWFlSzVnbmpZT1h3ZHRINzVwT2pSMnc2?=
=?utf-8?B?a0tuYmJaK0dvMk5jOG5jL2g3dlpwT0NoRjlDQ21hMmJVKzhsK2FrOFA2WmJ3?=
=?utf-8?B?bnZpUUFINGJnQkFzNTZXd1IwWWZ2eDd2WEIyTklCVURPREcyOG02d01UZ2Ur?=
=?utf-8?B?bVFZS3RjM1pLWlNDT0JNcDNSdlRVNGp0N1R6WVcyQ2YvdkxNdldMeHplTTRC?=
=?utf-8?B?a3QyMThkczhyc3B1QkQ2ODF2UWRKSnZ2anU2MjJVdnkwV1BmU1krb3M4b2tR?=
=?utf-8?B?RjBRYVBnQmtYRUdNSzVGNGhrL1VoemUxWnd3WW1kWU5saEg2Z3hzeXRySzBQ?=
=?utf-8?B?c2tROHZ0RXpzWGt0VzVRRFNhMXFnSi94N1NNK0M4bjA4NmFJUXV5TGs0NFVw?=
=?utf-8?B?MkdpTmRRUlR0TEdHNE5DSHNvcHJXNk1WWG5iKzBmN3BrdHFPRWhsU1RxT2R4?=
=?utf-8?B?eUFzNkZ6eVRXTS96Qi9nbE54bzNjb2pIRkpNdG1CSXFZY0xvNEx6VDUyTExm?=
=?utf-8?B?TW9TV0U2YmlvQ2pFZURwRUZZRlpEWFlyT3VTRUpCVjNvMVBqOW03M29BazR3?=
=?utf-8?B?K3ZPaXg2WGdvU3NUZUVHMmZlL01veWcycTloRGZFL3NyWGp1RjBnbVEvUUNZ?=
=?utf-8?B?MyttbzdDYVI3VnQ5YlJzeFdsYm1XQkhqZXZ0VW9MNDJjWFpDWHl0ay9zUjcx?=
=?utf-8?B?eE1hZWpPNEZMZ2V4TWIwWjBZOThzM1BjL1lUSFBxM1R4S2NGNWtRSEpTUVIx?=
=?utf-8?B?MWFHODhocG5tTDllTUVyV1VyazJveW1wZ044YW9RcmVRYW1KMnZwR0dKL0Ns?=
=?utf-8?B?OFozZUFmN0lFODFrcXlVVEdXRVJHVUY0TW1abzNzWHdFTUprOHpNTDg3VUQ5?=
=?utf-8?B?SGF4Z245NVRlb2poR3VrbEIzc1hUYnRGZlh2b29lbGE1ZkhjYkllOVhFV2xE?=
=?utf-8?B?c1BSZ1djejV4WnpzaFdEVFpmTU1VNUlKVEt6RllkWWVJM29nUWVQNENhVzhs?=
=?utf-8?B?ZWhITFFnbmI4LzlvdTIwWlZ1T1BiK25tQ1FxcUN4SlA4TjAzQ2ZkcTBjT1U4?=
=?utf-8?B?U0ljaVlBQ09yVVY4Z1pRNGxiK3pqNDZKT2FSdz09?=
X-Forefront-Antispam-Report:
CIP:4.158.2.129;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:outbound-uk1.az.dlp.m.darktrace.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(35042699022)(1800799024)(14060799003)(376014)(7416014);DIR:OUT;SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 09:33:58.5736
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: b866f0ed-5773-4a4a-83a1-08dda4dd43ad
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[4.158.2.129];Helo=[outbound-uk1.az.dlp.m.darktrace.com]
X-MS-Exchange-CrossTenant-AuthSource:
AMS0EPF000001B1.eurprd05.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6402
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 06/06/25 2:51 pm, Dev Jain wrote:
>
> On 30/05/25 4:27 pm, Lorenzo Stoakes wrote:
>> +cc Jan for page table stuff.
>>
>> On Fri, May 30, 2025 at 02:34:05PM +0530, Dev Jain wrote:
>>> It is noted at [1] that KFENCE can manipulate kernel pgtable entries
>>> during
>>> softirqs. It does this by calling set_memory_valid() ->
>>> __change_memory_common().
>>> This being a non-sleepable context, we cannot take the init_mm mmap
>>> lock.
>>> Therefore, add PGWALK_NOLOCK to enable walk_page_range_novma() usage
>>> without
>>> locks.
>> Hm This is worrying.
>>
>> You're unconditionally making it possible for dangerous usage here - to
>> walk page tables without a lock.
>>
>> We need to assert this is only being used in a context where this makes
>> sense, e.g. a no VMA range under the right circumstances.
>>
>> At the very least we need asserts that we are in a circumstance where
>> this
>> is permitted.
>>
>> For VMAs, you must keep the VMA stable, which requires a VMA read
>> lock at
>> minimum.
>>
>> See
>> https://origin.kernel.org/doc/html/latest/mm/process_addrs.html#page-tables
>>
>> for details where these requirements are documented.
>>
>> I also think we should update this documentation to cover off this
>> non-VMA
>> task context stuff. I can perhaps do this so as not to egregiously add
>> workload to this series :)
>>
>> Also, again this commit message is not enough for such a major change to
>> core mm stuff. I think you need to underline that - in non-task
>> context -
>> you are safe to manipulate _kernel_ mappings, having precluded KFENCE
>> as a
>> concern.
>
> Sorry for late reply, after your comments I had to really go and
> understand
> kernel pagetable walking properly by reading your process_addrs
> documentation
> and reading the code, so that I could prepare an answer and improve my
> understanding, thanks for your review!
>
> How does the below comment above PGWALK_NOLOCK look?
>
> "Walk without any lock. Use of this is only meant for the
>  case where there is no underlying VMA, and the user has
>  exclusive control over the range, guaranteeing no concurrent
>  access. For example, changing permissions of vmalloc objects."
>
> and the patch description can be modified as
> "
> It is noted at [1] that KFENCE can manipulate kernel pgtable entries
> during
> softirqs. It does this by calling set_memory_valid() ->
> __change_memory_common().
> This being a non-sleepable context, we cannot take the init_mm mmap lock.
> Therefore, add PGWALK_NOLOCK to enable walk_page_range_novma() usage
> without
> locks.
> Currently, apply_to_page_range is being used by __change_memory_common()
> to change permissions over a range of vmalloc space, without any locking.
> Patch 2 in this series shifts to the usage of walk_page_range_novma(),
> hence
> this patch is needed. We do not need any locks because the vmalloc object
> has exclusive access to the range, i.e two vmalloc objects do not share
> the same physical address.
> "
>
>
>>
>>> [1]
>>> https://lore.kernel.org/linux-arm-kernel/89d0ad18-4772-4d8f-ae8a-7c48d26a927e@xxxxxxx/
>> Basically expand upon this information.
>>
>> Basically the commit message refers to your usage, but describes a patch
>> that makes it possible to do unlocked page table walks.
>>
>> As I get into below, no pun intended, but this needs to be _locked down_
>> heavily.
>>
>> - Only walk_page_range_novma() should allow it. All other functions
>> should
>>    return -EINVAL if this is set.
>
> Sure.
>
>>
>> - walk_page_range_novma() should assert we're in the appropriate context
>>    where this is feasible.
>
> There should be two conditions: that the mm is init_mm, and the start
> address
> belongs to the vmalloc (or module) space. I am a little nervous about
> the second. On searching
> throughout the codebase, I could find only vmalloc and module
> addresses getting
> modified through set_memory_* API, but I couldn't prove that all such
> usages
> are being done on vmalloc/module addresses.

Sorry, please ignore the bit about the second point, I confused it with
some other

issue in the past. Now set_direct_map_invalid_noflush() will also use
__change_memory_common ->

walk_page_range_novma, and previously too it was doing it locklessly. So
let us assert only for

mm == init_mm.


>
>>
>> - Comments should be updated accordingly.
>>
>> - We should assert (at least CONFIG_DEBUG_VM asserts) in every place
>> that
>>    checks for a VMA that we are not in this lock mode, since this is
>>    disallowed.
>>
>>> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
>>> ---
>>>   include/linux/pagewalk.h |  2 ++
>>>   mm/pagewalk.c            | 12 ++++++++----
>>>   2 files changed, 10 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/include/linux/pagewalk.h b/include/linux/pagewalk.h
>>> index 9700a29f8afb..9bc8853ed3de 100644
>>> --- a/include/linux/pagewalk.h
>>> +++ b/include/linux/pagewalk.h
>>> @@ -14,6 +14,8 @@ enum page_walk_lock {
>>>       PGWALK_WRLOCK = 1,
>>>       /* vma is expected to be already write-locked during the walk */
>>>       PGWALK_WRLOCK_VERIFY = 2,
>>> +    /* no lock is needed */
>>> +    PGWALK_NOLOCK = 3,
>> I'd prefer something very explicitly documenting that, at the very
>> least, this
>> can only be used for non-VMA cases.
>>
>> It's hard to think of a name here, but the comment should be explicit
>> as to
>> under what circumstances this is allowed.
>>
>>>   };
>>>
>>>   /**
>>> diff --git a/mm/pagewalk.c b/mm/pagewalk.c
>>> index e478777c86e1..9657cf4664b2 100644
>>> --- a/mm/pagewalk.c
>>> +++ b/mm/pagewalk.c
>>> @@ -440,6 +440,8 @@ static inline void process_vma_walk_lock(struct
>>> vm_area_struct *vma,
>>>       case PGWALK_RDLOCK:
>>>           /* PGWALK_RDLOCK is handled by process_mm_walk_lock */
>>>           break;
>>> +    default:
>>> +        break;
>> Please no 'default' here, we want to be explicit and cover all cases.
>
> Sure.
>
>>
>> And surely, since you're explicitly only allowing this for non-VMA
>> ranges, this
>> should be a WARN_ON_ONCE() or something?
>
> Sounds good, maybe a WARN_ON_ONCE(vma)?
>
>>
>>>       }
>>>   #endif
>>>   }
>>> @@ -640,10 +642,12 @@ int walk_page_range_novma(struct mm_struct
>>> *mm, unsigned long start,
>>>        * specified address range from being freed. The caller should
>>> take
>>>        * other actions to prevent this race.
>>>        */
>> All functions other than this should explicitly disallow this locking
>> mode
>> with -EINVAL checks. I do not want to see this locking mode made
>> available
>> in a broken context.
>>
>> The full comment:
>>
>>     /*
>>      * 1) For walking the user virtual address space:
>>      *
>>      * The mmap lock protects the page walker from changes to the page
>>      * tables during the walk.  However a read lock is insufficient to
>>      * protect those areas which don't have a VMA as munmap() detaches
>>      * the VMAs before downgrading to a read lock and actually tearing
>>      * down PTEs/page tables. In which case, the mmap write lock should
>>      * be hold.
>>      *
>>      * 2) For walking the kernel virtual address space:
>>      *
>>      * The kernel intermediate page tables usually do not be freed, so
>>      * the mmap map read lock is sufficient. But there are some
>> exceptions.
>>      * E.g. memory hot-remove. In which case, the mmap lock is
>> insufficient
>>      * to prevent the intermediate kernel pages tables belonging to the
>>      * specified address range from being freed. The caller should take
>>      * other actions to prevent this race.
>>      */
>>
>> Are you walking kernel memory only? Point 1 above explicitly points
>> out why
>> userland novma memory requires a lock.
>>
>> For point 2 you need to indicate why you don't need to consider
>> hotplugging,
>
> Well, hotunplugging will first offline the physical memory, and since the
> vmalloc object has the reference to the pages, there is no race.
>
>> etc.
>>
>> But as Ryan points out elsewhere, you should be expanding this
>> comment to
>> explain your case...
>>
>> You should also assert you're in a context where this applies and error
>> out/WARN if not.
>>
>>> -    if (mm == &init_mm)
>>> -        mmap_assert_locked(walk.mm);
>>> -    else
>>> -        mmap_assert_write_locked(walk.mm);
>>> +    if (ops->walk_lock != PGWALK_NOLOCK) {
>> I really don't like the idea that you're allowing no lock for
>> userland mappings.
>>
>> This should at the very least be:
>>
>> if (mm == &init_mm)  {
>>     if (ops->walk_lock != PGWALK_NOLOCK)
>>         mmap_assert_locked(walk.mm);
>> } else {
>>     mmap_assert_write_locked(walk.mm);
>> }
>
> Sure.
>
>>
>>> +        if (mm == &init_mm)
>>> +            mmap_assert_locked(walk.mm);
>>> +        else
>>> +            mmap_assert_write_locked(walk.mm);
>>> +    }
>>>
>>>       return walk_pgd_range(start, end, &walk);
>>>   }
>>> --
>>> 2.30.2
>>>
>> We have to be _really_ careful with this stuff. It's very fiddly and
>> brokenness can be a security issue.
>


Return-Path: <linux-kernel+bounces-675556-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7607F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:35:13 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id F1AD91894480
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:35:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 61AFA2857D5;
Fri, 6 Jun 2025 09:35:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="MRA303t/"
Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6C4827468
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:35:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202505; cv=none; b=oJx1idxjCmXhyOJqmNtKlncUeiUw2PV+gQHZr4C4UbhufYhC1VWifekFaYDj+4UwUwYDAxxTLnB3rkHXZT4yNj75jmCFX6xQ4nDeZm4MdLe4e9z2FPOQBkL9r4de2wISt4jJwqV+NiS2xbDUfyISlPfwY1rZp7lRre8saHpspk4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202505; c=relaxed/simple;
bh=WgAzWRE7She4otQlVJzaMK08pPPq7NcuL5CVfsMI03w=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=uMdXikOaMsoGgs7X5lMny/JA5PsCCXhKDv7FHc04pIWSaiqLEZDUj+tNrj1btq1HbGwngIJJWpEeCP8Zdf9Lk5Pa5h/FoiNgoZsxxQa37idanb3Ztvw+JsvkZ0GA7bHcOr5y4YFGjhaa7OSZyDo3pQiL+hPxjsRtBqJrWdyXnhk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=MRA303t/; arc=none smtp.client-ip=209.85.128.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com
Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-450cea01b9cso6049145e9.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 02:35:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=suse.com; s=google; t=1749202501; x=1749807301; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=16WVU7r379wE285Rct5yNMoMsint6/gzKjFKMpi3cK4=;
b=MRA303t/swoE9ZnEjcNKszLUaoKTtTpsMcjuwrh1eTyRuQM9/5DQxrqXzusY5nkSUo
aC4F6+mDxqpx/xwFQBnhTYE4+2j7Zluj6mityfUKNvpawAywN/J0vGluT10eRsoD63h1
igJ3oNbYznJK0IfYSfyZLzvzFok1+1/ku4Ri6J7SnyWpnsonEgB8vbTJuSs0yShF9k+t
QArUuG6Bu0rauzo6OdxTQ623z7wiLnF+ZnN7jdy2VoQ+czBeAyLndH2Y0wfZvhDc0AlL
rRKSJp2mvwjp5sgdfgoXzpEjgFSWSpfV0+bBOZA1Q8WXZnHDIG7Az/ThGjiM0bQiY1MY
t/zQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749202501; x=1749807301;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=16WVU7r379wE285Rct5yNMoMsint6/gzKjFKMpi3cK4=;
b=iy0psKl55thLziD39OtoZU8tdYTgyzqkN3tJTxEZwzV2vSsO1jWOGsbmiLE9XajjGi
VxeiqJLcPYXQGj1HLP9wi18eksQGojAH1+Fp/2LNqQR3tKQJi5aZ/Uz/t1j8KgDCreuu
HZuDu3KtPK/W3CYLjsuVY9suTfIQVatn+EkXObHvh1lFyzTZjUZcEpxNWWlebk42Wqoq
quMrFKnylUsRkNjqSkC+VVzxwUCg02ntT+ZopddFAkfjC+i/y6J6HYIFOBdlVL0jjWw/
BsZ/qlPGlZcrj8FHPOj1/iRPN8DBHcFhTsgGg3yWylpzA/Bfi9VRP28wPD9SfAM0s90f
earg==
X-Forwarded-Encrypted: i=1; AJvYcCX1gus9nVDRV5JR4L79jo7zJuO57vON4pQpgbNImn2DXAVzLRA6MgYTFAKpO6l4/sPt3nplvuImg9eDGdo=@vger.kernel.org
X-Gm-Message-State: AOJu0YxTJHArgqmu9GBjjP10s6WjKjEcOOlRJj8t8/UDXKM31OgPBzM/
vPSwbXtnI7tOIFF5GEcS3x1tpSnbhYU681SMQdGDD4IF/L5tLGiNC2AhpN5xvyYKndU=
X-Gm-Gg: ASbGncv6FMeyQU/XXfZ3v7I38Hd88Ej6kN8rRg8Ptesqm1A6qCoIG4tQbomP9d/jNj1
Dybzc9JsYzKM77rVMs6SKOkB70YO7+P8ji6O3bOK2Qz/w4JNqUyM+S2MurUjfb4XeCWIdlWAdE0
XS0MMDwm40QDlLQh5ZW1Y5eEB23ASv5kqhp5t2CMiy8QcfF4+m9cycYXCb9VNwVzDuqugc4VXq5
zSEB3TjpuqGNXPRv05dPueCQX0nvAItG7OZLBB2pWYYsPQugp70bSgNGjyE9u1R0jDse/RVAEVE
xH4R4NnvQWwxe7xaU7vNS1DViltNYpxvq6/CebEspKZTsGpG36sjrQ==
X-Google-Smtp-Source: AGHT+IEXrINuMkdEIP9xCA7rioc8ocp0d0MYKrrke+NTaRENXHWiMhnlDpotpkYsrzCiqFR7r81jXg==
X-Received: by 2002:a05:600c:4f0f:b0:43c:fa52:7d2d with SMTP id 5b1f17b1804b1-452014d74b6mr22334105e9.20.1749202500773;
Fri, 06 Jun 2025 02:35:00 -0700 (PDT)
Received: from blackdock.suse.cz ([193.86.92.181])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-452730b9beasm14825415e9.22.2025.06.06.02.34.59
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 02:35:00 -0700 (PDT)
Date: Fri, 6 Jun 2025 11:34:58 +0200
From: Michal =?utf-8?Q?Koutn=C3=BD?= <mkoutny@xxxxxxxx>
To: Jemmy Wong <jemmywong512@xxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>, Johannes Weiner <hannes@xxxxxxxxxxx>,
Martin KaFai Lau <martin.lau@xxxxxxxxx>, Alexei Starovoitov <ast@xxxxxxxxxx>,
Daniel Borkmann <daniel@xxxxxxxxxxxxx>, Andrii Nakryiko <andrii@xxxxxxxxxx>,
Eduard Zingerman <eddyz87@xxxxxxxxx>, Song Liu <song@xxxxxxxxxx>,
Yonghong Song <yonghong.song@xxxxxxxxx>, John Fastabend <john.fastabend@xxxxxxxxx>,
KP Singh <kpsingh@xxxxxxxxxx>, Stanislav Fomichev <sdf@xxxxxxxxxxx>,
Hao Luo <haoluo@xxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, cgroups@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v0] cgroup: Add lock guard support
Message-ID: <fo5le4uonsrv24z5gikojq7hxwaqaidgco25pypnppk5h2czap@egdwx6yte4lf>
References: <20250605211053.19200-1-jemmywong512@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="ua3zb34t3kfdq7gf"
Content-Disposition: inline
In-Reply-To: <20250605211053.19200-1-jemmywong512@xxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--ua3zb34t3kfdq7gf
Content-Type: text/plain; protected-headers=v1; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: [PATCH v0] cgroup: Add lock guard support
MIME-Version: 1.0

Hello.

On Fri, Jun 06, 2025 at 05:10:53AM +0800, Jemmy Wong <jemmywong512@xxxxxxxx=
m> wrote:
> This change replaces manual lock acquisition and release with lock guards
> to improve code robustness and reduce the risk of lock mismanagement.
> No functional changes to the cgroup logic are introduced.

I like this.
Could you possible split it to individual commits to ease the review
for: cgroup_mutex, css_set_lock, RCU and the rest?

=2E..
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -382,6 +382,10 @@ static inline void cgroup_put(struct cgroup *cgrp)
> =20
> extern struct mutex cgroup_mutex;
> =20
> +DEFINE_LOCK_GUARD_0(cgroup_mutex,
> + mutex_lock(&cgroup_mutex),
> + mutex_unlock(&cgroup_mutex))
> +
> static inline void cgroup_lock(void)
> {
> mutex_lock(&cgroup_mutex);
> @@ -656,6 +660,9 @@ struct cgroup *cgroup_get_from_id(u64 id);
> struct cgroup_subsys_state;
> struct cgroup;
> =20
> +extern struct mutex cgroup_mutex;

I assume this was because of the BPF code, which wouldn't be needed in
the end.

=2E..

Thanks,
Michal

--ua3zb34t3kfdq7gf
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHQEABYKAB0WIQTd6mfF2PbEZnpdoAkt3Wney77BSQUCaEK2NgAKCRAt3Wney77B
SVT1AQCRa4xOZhTwPK9tNZnPZhJdBQ0U0Y4hWIj1hPsIJzCwcgD3Xdkw3M+MD4HW
muBCdmP7vHKczXzk4Fal9QO7O72gAg==
=8HJL
-----END PGP SIGNATURE-----

--ua3zb34t3kfdq7gf--


Return-Path: <linux-kernel+bounces-675557-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 96E5241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:37:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5FCE53B1C0C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:37:08 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B0907286419;
Fri, 6 Jun 2025 09:37:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rebNEyMv"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF21527468;
Fri, 6 Jun 2025 09:37:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202641; cv=none; b=U+XHgXusNW3GqcvzC885ylMiMOg3R7gAK1gKVtIl96ifeREZBWFXqTYRFURzVJqSnj7xbWD/0ydmoexjEZy3rbr+UUobwuXN98jnat/gqCobLwq3Ii7LjR6nzta0/HQvbEfPWVkcbza9ENN+MPgqgG2WZoHcRjdiUIH0RB6aXeg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202641; c=relaxed/simple;
bh=a9Zg/DhoRqaLyi2gmTsRz1QWED8HUHhMKVYw0b0MLaI=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=mHsgwz1Ajv0f0weaBl/s6XRi2MeY+wf5ZiqKNPlsZrnJDA9ZEJo6XGZN+yLRRDWbZGFmQrmFKkc804vMBquacGrhUXNJp13Cud7GAbH6+VPgIMFA36DPDgOUY3XcbTOcWcATfihgRNdKzdtF2zx+8r2iZsHf8g+uWWjXO39FDwE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rebNEyMv; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49711C4CEEB;
Fri, 6 Jun 2025 09:37:20 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749202640;
bh=a9Zg/DhoRqaLyi2gmTsRz1QWED8HUHhMKVYw0b0MLaI=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=rebNEyMvMYlywgjkjaA5J0/uuXWIXSLc6zgj/dGdlsiZosql0U8UEzlkhGdOrCVNX
QCXkyKhmNvG2S2OOL06l1ptZqqFIXan8fEZRpHD0UUDEIo8GaWElcz1dbOSkCQvV9b
Z0JnD890NNQllDqryXTiJTi+U2FJbDWB1aTIG/oNWpi2I7S5YkS/qxJDnlVS/CbUx8
bVrW39gEB8/2iP+ubx8Z87KowkPOKTbscLbefMienA/R00FgW4FJK57I8QNsXlfKDc
dIfs1B1R+N+4fSeymzZK+RCQQLjqZNhRA/LGfCoNIT9cUlIbSO1esjVy75z3tw5l5t
HreKk1oTkY6WQ==
Received: from johan by xi.lan with local (Exim 4.97.1)
(envelope-from <johan@xxxxxxxxxx>)
id 1uNTVj-0000000039m-1X7v;
Fri, 06 Jun 2025 11:37:16 +0200
Date: Fri, 6 Jun 2025 11:37:15 +0200
From: Johan Hovold <johan@xxxxxxxxxx>
To: Miaoqing Pan <quic_miaoqing@xxxxxxxxxxx>
Cc: Johan Hovold <johan+linaro@xxxxxxxxxx>,
Jeff Johnson <jjohnson@xxxxxxxxxx>,
Remi Pommarel <repk@xxxxxxxxxxxx>,
Baochen Qiang <quic_bqiang@xxxxxxxxxxx>,
linux-wireless@xxxxxxxxxxxxxxx, ath12k@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v2 4/4] wifi: ath12k: fix dest ring-buffer corruption
when ring is full
Message-ID: <aEK2y8mMSQtbsKq2@xxxxxxxxxxxxxxxxxxxx>
References: <20250604144509.28374-1-johan+linaro@xxxxxxxxxx>
<20250604144509.28374-5-johan+linaro@xxxxxxxxxx>
<a8236639-2448-4552-ac21-db7e7370e23e@xxxxxxxxxxx>
<aEKylLhbfLusD3Kq@xxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aEKylLhbfLusD3Kq@xxxxxxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 11:19:16AM +0200, Johan Hovold wrote:
> On Fri, Jun 06, 2025 at 03:27:04PM +0800, Miaoqing Pan wrote:
> > On 6/4/2025 10:45 PM, Johan Hovold wrote:
> > > Add the missing memory barriers to make sure that destination ring
> > > descriptors are read before updating the tail pointer (and passing
> > > ownership to the device) to avoid memory corruption on weakly ordered
> > > architectures like aarch64 when the ring is full.
>
> > > @@ -2184,6 +2187,10 @@ void ath12k_hal_srng_access_end(struct ath12k_base *ab, struct hal_srng *srng)
> > > srng->u.src_ring.hp);
> > > } else {
> > > srng->u.dst_ring.last_hp = *srng->u.dst_ring.hp_addr;
> > > + /* Make sure descriptor is read before updating the
> > > + * tail pointer.
> > > + */
> > > + mb();
> >
> > Is rmb() sufficient, since MMIO write already includes wmb()?
>
> No, rmb() only orders reads against later reads.
>
> [ The wmb() itself orders reads against later writes on aarch64, but
> that's not generally guaranteed and hence should not be relied on in
> driver code. ]

Sorry, I meant to say: an rmb() would order reads against later writes
on aarch64 (but that's not generally guaranteed and hence should not be
relied on in driver code).

Johan


Return-Path: <linux-kernel+bounces-675558-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 948D141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:38:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 7C842189B197
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:38:50 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E89422857EE;
Fri, 6 Jun 2025 09:38:29 +0000 (UTC)
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 792B627468
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:38:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202709; cv=none; b=LluaJreec/sAHpUBE8brJtYKm5vViV3i2aLmah698uTnsu/zRw35vqAi7pNx+xMN4aj2QC9YAu5pxl8Uy7h56ooBN+tFqUO1A+oscAiiYqvVh2CHYG9ZSXCS7GkMMADbm5Q4a8/dn06EiWSEYgSQoUoTg8Hk72MThe/vyAnLWWo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202709; c=relaxed/simple;
bh=jZh8jvo3lyT78zBIAuub14qMFwnpBif3VNd4GueNpac=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
MIME-Version:Content-Type; b=E+/bqGmMXrMkKr94DxNz5j6lmDu9TwEtN9hfu/tYGoaqe2akT4P3WcuK4u539Ml0VPVpBe9wCc4Nmvd2y34qbNoRyI249ecA9QUVUFyzRQx3oUJ2NhqxqWoDmhTAYmojA//20f3nkz4PqGQ2qYqphqS/o4it1NG0i2Z9aW9yZd8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com
[209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-313-PRaEmDnkPzqmcmHodWQZtA-1; Fri, 06 Jun 2025 05:38:24 -0400
X-MC-Unique: PRaEmDnkPzqmcmHodWQZtA-1
X-Mimecast-MFC-AGG-ID: PRaEmDnkPzqmcmHodWQZtA_1749202703
Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3a4eb9c80deso912010f8f.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 02:38:24 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749202703; x=1749807503;
h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
:from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=26Ry3YWNg+Xx3lprVa5lk9OAapvgIQNkgZHWX4BPEr0=;
b=oct3kKUKRbvswxajZfF042lpt7XfwRnsPHTnO8zmYEl+KCQb33zW7Ct9FfbQCFYDFH
MYgVR2KyzYBDgb8pQrOryfZHB2FSyNyJsgMJbmkcvCAdpJVWtph/CbAgw123QugcRIhP
K326suBar9cw4Y0Eb5v2OH2IAzOeXAkYtyYKYuCRXI47+5G6JREkwU06wWbQz+SaNYGE
JXokT563AxHmefLkel4O5QbqyuB4jkz7I0wx1L7RVN6+hZZUp2G1H2zha5EF1djczdvR
agTdhMlUM51CwR2cB5V+bY0CSEG0me3Q1GyrmJJWbiw97YnnEJI4xSFBYGrRj/B1tTr4
vAwQ==
X-Forwarded-Encrypted: i=1; AJvYcCUhofjs+BPOkNU5jXEvvreJUYfGAHnSmmI4MAyi/fAWDgiAdQBGSVGFr9DoW8k3vRRuHez0MqRY4fT0E+s=@vger.kernel.org
X-Gm-Message-State: AOJu0YyHr/nH6vhUyezHrSM41AcVNvDAwtFe2n7nnq6XDTkuGx2+tWDX
7R2B9ilR4tfUKPugnCCNfaR3Ju9bDM1CAP3+aBRJmSuIDxAej/CYqQlx1a8uAli2jtY1Egv9qxr
p+j6K1XrQJK2lMMzfVFm/BxIm5JrGeZcTVUpdNAVcVP/S91RxMpsyjc6TSlhcqH7h1w==
X-Gm-Gg: ASbGncvpYB++aV5iSR2hjrXMIt++3bwknbC9G7rbVIJfE2LWx4eL4N04zsl/pvMBqzW
hL5SxIP2YaqlBiDUsCHvJiHQdSU/B0pDmmdMAwuyyAqWs7WPucIdNSsooJPo8kUZtEsiOrLMxnN
V922zxe3Lnk8ixNdoFqaVcyewp6ZGwAQMeABIPc1L43TzNTbIaJCQ06imyS0kFnPc3cEBh25WvV
kO6Z1AW3O/E4k6FW51J4vVhOA525KJ0xPLfWYPNQHplO3RNRlzM8q6vdRmqvyJw8gePTgu9r1zG
rO7GEaXJw5Ctg2+U3w7/YQYw9TFzS6+xazORDPfeUbBqY67iJ7AjKj6cGp4R6+7Ki8OtsVsXE8R
hSiGr
X-Received: by 2002:a05:6000:240b:b0:3a4:f8fa:9c94 with SMTP id ffacd0b85a97d-3a531caa070mr2442146f8f.13.1749202703117;
Fri, 06 Jun 2025 02:38:23 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IE2hgVVQ9Gk7GHogece0bM9/ZswNLeykZTGpNB8vcSGMUSbHrTwRCq1omPf2ID9eCFShi5YvA==
X-Received: by 2002:a05:6000:240b:b0:3a4:f8fa:9c94 with SMTP id ffacd0b85a97d-3a531caa070mr2442120f8f.13.1749202702694;
Fri, 06 Jun 2025 02:38:22 -0700 (PDT)
Received: from localhost (62-151-111-63.jazzfree.ya.com. [62.151.111.63])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4526e056122sm15416265e9.6.2025.06.06.02.38.21
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 02:38:22 -0700 (PDT)
From: Javier Martinez Canillas <javierm@xxxxxxxxxx>
To: Lukas Bulwahn <lbulwahn@xxxxxxxxxx>, Sudeep Holla
<sudeep.holla@xxxxxxx>, Cristian Marussi <cristian.marussi@xxxxxxx>, Ulf
Hansson <ulf.hansson@xxxxxxxxxx>, arm-scmi@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx
Cc: kernel-janitors@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Lukas
Bulwahn <lukas.bulwahn@xxxxxxxxxx>
Subject: Re: [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter
In-Reply-To: <20250606090802.597504-1-lukas.bulwahn@xxxxxxxxxx>
References: <20250606090802.597504-1-lukas.bulwahn@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 11:38:19 +0200
Message-ID: <8734cddxbo.fsf@xxxxxxxxxxxx-host-address-is-not-set>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Lukas Bulwahn <lbulwahn@xxxxxxxxxx> writes:

> From: Lukas Bulwahn <lukas.bulwahn@xxxxxxxxxx>
>
> There is no need to introduce the boolean power_on to select the constant
> value for state. Simply pass the value for state as argument. Just remove
> this code clutter.
>
> No functional change.
>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@xxxxxxxxxx>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>

--
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat



Return-Path: <linux-kernel+bounces-675559-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2AEE241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:39:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 95FD73B1C5E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:39:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B1F0C286438;
Fri, 6 Jun 2025 09:39:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="czIXUc/X"
Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F9231F4701
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:39:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202781; cv=none; b=cC8ZwM374b1v6VPG5O/Mlkm2DxGdGl/c7iJIdnLtEe7y5ShCmU+sKe8hm8xGwwj4oclzzXZWSwETg+Dby3bVwU6Zthdksr12XAmofOB1dKj5MhDm6L+7v31PZfB7ddfXQic3TVMRQAk/WczgMbCmVm5Ua8TVa6OmesXUocsvECY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202781; c=relaxed/simple;
bh=N9gt6zoeOojtVaBP1jlkmM2TL467uVikZEZwQ9GbU2k=;
h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Content-Type; b=RfSmBd39iMorRNVnc4shv78yKkUEgXXTwZzHuksSV8WfDqye9CbVSdcsRogXzSTKpYLtqxshH4c3hZ45dH4VgMC6Ycakz3HLg88yvQHJLq6Tx3+a4ZQrbi3dshbS96iPEDHpDBC/wSCWTseB1Lm+UJn9v/6X7HtOiXBt3g4kBwE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu; spf=pass smtp.mailfrom=szeredi.hu; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b=czIXUc/X; arc=none smtp.client-ip=209.85.160.169
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=szeredi.hu
Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-4a5840ec53dso22388791cf.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 02:39:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=szeredi.hu; s=google; t=1749202778; x=1749807578; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=tPFP4ZmRAhjJ4I3wEZwmt/w3eZJoSPjBDwx/NSazgHI=;
b=czIXUc/X6IcDpUOA3IeEWcwJMdXR87FSYsf5ixCCWiLNSx0kMQWKuXOOc+l8f17ERN
hQ41vSzEECLEU99+vsNVlAylbqd35o/yPNwcNy9N75OSqWTi69PL2nxbGPEcVp61PN+/
ChGwVsZBiKuG/G9s44uLpKp+eT2Re14ssbP9Q=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749202778; x=1749807578;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=tPFP4ZmRAhjJ4I3wEZwmt/w3eZJoSPjBDwx/NSazgHI=;
b=HaA1fo8HbH8PamZhxWOT4k8sZgfoXyq861VxrwOQfWtOm0pCYWNDavB4ab5kJqyKcC
ZitdmI9waKnrXEFO+W7Llfd/flanWwSCA5uHKtcJjWuZuhdqLaFJ9HHFZOaE8+dspac3
JxtQF72qf6WPYS6Cls7amgsYGD5VvtXdNFA3Q+pM04J/rYpVX6iIrp6ts9SY5sE3wUaX
iHigzG5mHO83i/xoLzy3r/RLnIUv6zxvYbBq1/d2OnBrlkJwA/4r+ZgvrC/inhPPpSBS
ZpORt4C6Q1EfGliEKRAEandd6yoYvJXHK+Xcl4PjXFemCJkEGNNd5hsVGBSWB5K53JYo
BNSw==
X-Forwarded-Encrypted: i=1; AJvYcCV0NmINkKLcEVRLTJCXLBjwrvcEMsiSxoOZPOxiG8JRJVqJhyiVRi5CrFxee748oFBD0Gl7KkK2tYbO2Xo=@vger.kernel.org
X-Gm-Message-State: AOJu0YymXmIfQo1/o7xvLF2NgpYnTrtpwgDU9ayvsMZ11Rarc0/w/Fm3
SZ69GDDoWQVnMy9bA5B273Czf8wu41gfqKF2WuXpRkifuT3xaGHpEGwZSm9Agw5os3mHNJKmxOo
GkXQgtJwql2Ahqp7HNDMQs+a1qklQ5uy0x6comRykLQ==
X-Gm-Gg: ASbGnctFFQb/KQNFAUs3ze4Ec+2OgNeTba2g3mC/byQm6jD2rTHdDuNGe9EvBev4Hy2
gZJaJbiaDqJ5zAd+NRw3gm9Os0cahM4jLcNleoqUR3uaBCuxq0j+mxWxAPKWsnSXZMl1pLH2HNi
GhhyhjPm0f/gIRJHpeoX45Lst+FS7ZA1dlE2ipswxuClU5TkUmMOmn
X-Google-Smtp-Source: AGHT+IHI9ky3s76fSv3Zu8lWTiZqJ/uarX5vedd0MSl6G+9c+iOb+o0VwnbkevaSB0b6iGykHy5yDFmDXJLp6vQ0kM0=
X-Received: by 2002:a05:622a:4010:b0:494:a495:c257 with SMTP id
d75a77b69052e-4a5b9e21cd9mr45032831cf.17.1749202778321; Fri, 06 Jun 2025
02:39:38 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
From: Miklos Szeredi <miklos@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 11:39:27 +0200
X-Gm-Features: AX0GCFtZRITQRM4IxzsfgyjT1CJY8JlGN07qklEcnKGJyagr2TeGe-HdyBll-OI
Message-ID: <CAJfpegssS_nOs1T+LTZBY9afFcmvpQH3gaSEph0NDx4neXNGRA@xxxxxxxxxxxxxx>
Subject: [GIT PULL v2] overlayfs update for 6.16
To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: overlayfs <linux-unionfs@xxxxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Amir Goldstein <amir73il@xxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs.git
tags/ovl-update-v2-6.16

- Fix a regression in getting the path of an open file (e.g. in
/proc/PID/maps) for a nested overlayfs setup (Andr=C3=A9 Almeida)

- Support data-only layers and verity in a user namespace
(unprivileged composefs use case)

- Fix a gcc warning (Kees)

- Cleanups

Thanks,
Miklos

v2: dropped constification cleanup

---
Andr=C3=A9 Almeida (1):
ovl: Fix nested backing file paths

Kees Cook (1):
ovl: Check for NULL d_inode() in ovl_dentry_upper()

Miklos Szeredi (3):
ovl: make redirect/metacopy rejection consistent
ovl: relax redirect/metacopy requirements for lower -> data redirect
ovl: don't require "metacopy=3Don" for "verity"

Thorsten Blum (4):
ovl: Use str_on_off() helper in ovl_show_options()
ovl: Replace offsetof() with struct_size() in ovl_cache_entry_new()
ovl: Replace offsetof() with struct_size() in ovl_stack_free()
ovl: Annotate struct ovl_entry with __counted_by()

---
Documentation/filesystems/overlayfs.rst | 7 +++
fs/overlayfs/file.c | 4 +-
fs/overlayfs/namei.c | 98 ++++++++++++++++++++---------=
----
fs/overlayfs/ovl_entry.h | 2 +-
fs/overlayfs/params.c | 40 ++------------
fs/overlayfs/readdir.c | 4 +-
fs/overlayfs/util.c | 9 ++-
7 files changed, 84 insertions(+), 80 deletions(-)


Return-Path: <linux-kernel+bounces-675560-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 67C2B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:40:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id E551E179904
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:40:04 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 18126286437;
Fri, 6 Jun 2025 09:39:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Lf2shYci"
Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123])
(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 34F491C861D;
Fri, 6 Jun 2025 09:39:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202789; cv=none; b=PV4GaTKWGMgstwESmCGr0/vIC+uiSZ+6kfCrh2yhkz/784ii8fj7C5K3+wH7N/86H3hNAjomIOKL26qvR/21roA6OMrQqBYOCC2pPRaihbYhgGJKv+UvDvoUboWnbXvD6s/CV/Tg4wgY/FYVe0MFmXPYOv8+9fIp2eTH3w+3Auk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202789; c=relaxed/simple;
bh=2OFIkwcFfGxbIptsJzGXFt9IKn/aP/aohtIajXB2Jno=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=Wt9BoWgY4PvBFBxkhS3kesmbB99+pDpcTKkqbc4JsvESWbJFi99yZhIjTuO55Hw8gHA26kSPuQO7pugKPFp8i89fQexUwvQdYTXjFlgbInPYINQoz1UMWYxGENLIS9bR9c9byEs6HLhmDKHcDq2kdXk3kltq3tbc5Pc3rXNNAVU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=Lf2shYci; arc=none smtp.client-ip=68.232.154.123
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp;
t=1749202787; x=1780738787;
h=from:to:cc:subject:date:message-id:in-reply-to:
references:mime-version:content-transfer-encoding;
bh=2OFIkwcFfGxbIptsJzGXFt9IKn/aP/aohtIajXB2Jno=;
b=Lf2shYciSVxArhhKE7mtyIaFOO6vDkFpU1f+HejPiVz1KasX/xaU6OiR
p3XZ8Yxu/drKzfyq/wkkl7k8tsc2sYALWNuP+zFGiZc4JyLL30qfB6kOe
DAs/G/3UPPYypS7uxvwO4PPAcv5lYNR71rJezqcijFwPPzm6uSXzaXMu4
TEapBqFvB/Er2CaJUV1AWtYjMExW5ImHyz8nmgmeT+G71DjWOSnM/abR7
HnQBWhQIDaKBrwqWrxsJHk0wyITQXYrv7bB++5kyfDX40Ut7508NmO5DX
zZWoqzcsoZlD/Wx0lV/CIR27sqx/n/+CXeYayeTmOBw7GTwxHnyjDopBM
Q==;
X-CSE-ConnectionGUID: RNxw4F1gS4uefnTd7vXzbA==
X-CSE-MsgGUID: y5Nj09tiRyOGdHR44TJ84A==
X-IronPort-AV: E=Sophos;i="6.16,214,1744095600";
d="scan'208";a="43064047"
X-Amp-Result: SKIPPED(no attachment in message)
Received: from unknown (HELO email.microchip.com) ([170.129.1.10])
by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Jun 2025 02:39:45 -0700
Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by
chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.1.2507.44; Fri, 6 Jun 2025 02:39:43 -0700
Received: from marius-VM.mshome.net (10.10.85.11) by chn-vm-ex04.mchp-main.com
(10.10.85.152) with Microsoft SMTP Server id 15.1.2507.44 via Frontend
Transport; Fri, 6 Jun 2025 02:39:40 -0700
From: <marius.cristea@xxxxxxxxxxxxx>
To: <jic23@xxxxxxxxxx>, <dlechner@xxxxxxxxxxxx>, <nuno.sa@xxxxxxxxxx>,
<andy@xxxxxxxxxx>
CC: <robh@xxxxxxxxxx>, <krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<broonie@xxxxxxxxxx>, <linux-iio@xxxxxxxxxxxxxxx>,
<devicetree@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<marius.cristea@xxxxxxxxxxxxx>
Subject: [PATCH v3 1/2] dt-bindings: iio: adc: adding support for PAC194X
Date: Fri, 6 Jun 2025 12:39:28 +0300
Message-ID: <20250606093929.100118-2-marius.cristea@xxxxxxxxxxxxx>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <20250606093929.100118-1-marius.cristea@xxxxxxxxxxxxx>
References: <20250606093929.100118-1-marius.cristea@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Marius Cristea <marius.cristea@xxxxxxxxxxxxx>

This is the device tree schema for iio driver for Microchip PAC194X
and PAC195X series of Power Monitors with Accumulator. The PAC194X
family supports 9V Full-Scale Range and the PAC195X supports 32V
Full-Scale Range.

There are two versions of the PAC194X/5X: the PAC194X/5X-1 devices
are for high-side current sensing and the PAC194X/5X-2 devices are
for low-side current sensing or floating VBUS applications.

The PAC194X/5X-1 is named shortly PAC194X/5X.

Signed-off-by: Marius Cristea <marius.cristea@xxxxxxxxxxxxx>
---
.../bindings/iio/adc/microchip,pac1944.yaml | 204 ++++++++++++++++++
1 file changed, 204 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml

diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml
new file mode 100644
index 000000000000..4a2cf6b64055
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml
@@ -0,0 +1,204 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/microchip,pac1944.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip PAC1944 and PAC1954 Power Monitors with Accumulator
+
+maintainers:
+ - Marius Cristea <marius.cristea@xxxxxxxxxxxxx>
+
+description: |
+ This device is part of the Microchip family of Power Monitors with
+ Accumulator. The datasheet for PAC1941-1, PAC1941-1, PAC1942-1, PAC1942-2,
+ PAC1943-1 and PAC1944-1 can be found here:
+ https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/PAC194X-Family-Data-Sheet-DS20006543.pdf
+ The datasheet for PAC1951-1, PAC1951-1, PAC1952-1, PAC1952-2, PAC1953-1 and
+ PAC1954-1 can be found here:
+ https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/PAC195X-Family-Data-Sheet-DS20006539.pdf
+
+properties:
+ compatible:
+ enum:
+ - microchip,pac1941
+ - microchip,pac19412
+ - microchip,pac1942
+ - microchip,pac19422
+ - microchip,pac1943
+ - microchip,pac1944
+ - microchip,pac1951
+ - microchip,pac19512
+ - microchip,pac1952
+ - microchip,pac19522
+ - microchip,pac1953
+ - microchip,pac1954
+
+ reg:
+ maxItems: 1
+
+ vdd-supply: true
+
+ "#address-cells":
+ const: 1
+
+ "#size-cells":
+ const: 0
+
+ interrupts:
+ maxItems: 2
+
+ interrupt-names:
+ description:
+ alert1 indicates a HIGH or LOW limit was exceeded.
+ alert2 indicates a THERM limit was exceeded.
+ items:
+ - const: alert1
+ - const: alert2
+
+patternProperties:
+ "^channel@[1-4]+$":
+ type: object
+ $ref: adc.yaml
+ description:
+ Represents the external channels which are connected to the ADC.
+
+ properties:
+ reg:
+ items:
+ minimum: 1
+ maximum: 4
+
+ shunt-resistor-micro-ohms:
+ description:
+ Value in micro Ohms of the shunt resistor connected between
+ the SENSE+ and SENSE- inputs, across which the current is measured.
+ Value is needed to compute the scaling of the measured current.
+
+ microchip,vbus-half-range:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description: |
+ In order to increase measurement resolution and keeping the same
+ number the of bits the device has a configurable VBUS full range scale
+ (FSR). The range should be set by hardware design and it should not be
+ changed during runtime. The bipolar capability for VBUS enables
+ accurate offset measurement and correction.
+ The VBUS could be configured into the following full scale range:
+ - VBUS has unipolar 0V to 32V FSR (default) for PAC195X or 0V to 9V
+ (default) for PAC194X.
+ - VBUS has bipolar -32V to 32V FSR for PAC195X or -9V to 9V for
+ PAC194X. The actual range is limited to about -200 mV due to the
+ impact of the ESD structures.
+ - VBUS has bipolar -16V to 16V FSR for PAC195X or -4.5V to 4.5V for
+ PAC194X. The actual range is limited to about -200 mV due to the
+ impact of the ESD structures.
+
+ microchip,vbus-bipolar:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ If provided, the channel is to be used in bipolar mode. The
+ actual range is limited to about -200 mV due to the impact of the ESD
+ structures.
+
+ microchip,vsense-half-range:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description: |
+ In order to decrease the power dissipation on the shunt resistor and
+ in the same time to increase measurement resolution by keeping the
+ same number the of bits the device has a configurable VSENSE full
+ range scale (FSR). The range should be set by hardware design and it
+ should not be changed during runtime.
+ The VSENSE could be configured into the following full scale range:
+ - VSENSE has unipolar 0V to 100 mV FSR (default)
+ - VSENSE has bipolar -100 mV to 100 mV FSR
+ - VSENSE has bipolar -50 mV to 50 mV FSR
+
+ microchip,vsense-bipolar:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ If provided, the channel is to be used in bipolar mode.
+
+ microchip,accumulation-mode:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ The Hardware Accumulator may be used to accumulate VPOWER, VSENSE or
+ VBUS values for any channel. By setting the accumulator for a channel
+ to accumulate the VPOWER values gives a measure of accumulated power
+ into a time period, which is equivalent to energy. Setting the
+ accumulator for a channel to accumulate VSENSE values gives a measure
+ of accumulated current, which is equivalent to charge. This allows the
+ accumulator to be used as a coulomb counter. For either VSENSE or
+ VBUS, many samples may be accumulated on chip and the result collected
+ by the host and divided by the accumulator counter count value to
+ yield an average value with a very long integration time to reduce
+ noise. This feature is also very useful for system calibration,
+ allowing many averages to be accumulated for fast averaging/noise
+ reduction.
+ This functionality needs to be setup once and must not be changed
+ during the runtime, just in case the user wants to measure the charge
+ or the energy consumed from board power up till the user has control
+ or during a reboot of the system.
+ The Hardware Accumulator could be configured to accumulate
+ VPOWER, VSENSE or VBUS
+ <0> - Accumulator accumulates VPOWER (default)
+ <1> - Accumulator accumulates VSENSE
+ <2> - Accumulator accumulates VBUS
+ maximum: 2
+ default: 0
+
+ required:
+ - reg
+ - shunt-resistor-micro-ohms
+
+ unevaluatedProperties: false
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+ - "#address-cells"
+ - "#size-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ power-monitor@10 {
+ compatible = "microchip,pac1954";
+ reg = <0x10>;
+ vdd-supply = <&vdd>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ channel@1 {
+ reg = <0x1>;
+ shunt-resistor-micro-ohms = <24900>;
+ label = "CPU";
+ microchip,vsense-half-range;
+ microchip,vsense-bipolar;
+ };
+
+ channel@3 {
+ reg = <0x3>;
+ shunt-resistor-micro-ohms = <75000>;
+ label = "MEM";
+ microchip,vbus-half-range;
+ microchip,vbus-bipolar;
+ microchip,vsense-half-range;
+ };
+
+ channel@4 {
+ reg = <0x4>;
+ shunt-resistor-micro-ohms = <100000>;
+ label = "NET";
+ microchip,vbus-bipolar;
+ };
+ };
+ };
+
+...
--
2.48.1



Return-Path: <linux-kernel+bounces-675561-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8953241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:40:20 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2FF327A57C5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:39:00 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4113228640C;
Fri, 6 Jun 2025 09:40:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="nsQtImAe"
Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233])
(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 E28722857EE;
Fri, 6 Jun 2025 09:40:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202812; cv=none; b=CbJL18asvX4AhlkCVlWp7hXBQClPAQ53+nILZlU/fjhoUYF34LQ8oDKvqiOPXoXa9fUz6emDstD97QNKgM297TVWEBfAOvLDKxhven4qcGt1S92NGFuYwrWi+75b06Jc3mrTYIylK3jPx0P3dzwflcvJ4hGYpFGY9bAXinOxpVg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202812; c=relaxed/simple;
bh=hx2tqVby4hICbY7arRGml2MUf2WN62USFOlRL4dU2TE=;
h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=pRCDbY51dpVS5+SdQlR84wJbCQAZj3LIPlvWNGvHgfNa/1J1qTwm4PtsK5Q5zP0lCjMlzKpv+j0r1ipMkHY4m5y+1zGgi6FbY2cbXxzIOQra6U/eXri0Yi2dL/KNNvLrsjNDf9UvZ25x2XsTeZu081r66UR2aqFs0pE8SsKwStU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=nsQtImAe; arc=none smtp.client-ip=68.232.153.233
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp;
t=1749202811; x=1780738811;
h=from:to:cc:subject:date:message-id:mime-version:
content-transfer-encoding;
bh=hx2tqVby4hICbY7arRGml2MUf2WN62USFOlRL4dU2TE=;
b=nsQtImAeqTwIpx3lWaHlXwbYAbK8tGj28kOOxj5o/Ieepzc85ZMWCuJi
vT/zro3a8wiaQNNJw5gs6kuG4wJPLUPX3EP1XAeIQM2a/YYdJ6pACs2n4
82Srj14hGqRSaUsudkDdY4ZSGCuckn9niZVbrF74+rOE9DBDTE9Vwz5Tu
wj+RC8ZaaTzQXxYcviKsUiqkd4+5WeCY5P4oKxFnHwGeHTlHLILOhu1bJ
oDyKpwXATtmLlc1kyn4ltwVep0l0L7YUtchQG1FdJCPAuL4mK11TjYUrX
OwCpWdYT6FnWuEb+2VluMjSCg6gsTKnA6kNnX/HdHrldV3XpmKThOJDO+
Q==;
X-CSE-ConnectionGUID: 01hBMkXoQcS7BeTmXZ+HsA==
X-CSE-MsgGUID: IY4AG+0kQ9OfYiy2P1hX0Q==
X-IronPort-AV: E=Sophos;i="6.16,214,1744095600";
d="scan'208";a="42499415"
X-Amp-Result: SKIPPED(no attachment in message)
Received: from unknown (HELO email.microchip.com) ([170.129.1.10])
by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Jun 2025 02:40:10 -0700
Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by
chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.1.2507.44; Fri, 6 Jun 2025 02:39:37 -0700
Received: from marius-VM.mshome.net (10.10.85.11) by chn-vm-ex04.mchp-main.com
(10.10.85.152) with Microsoft SMTP Server id 15.1.2507.44 via Frontend
Transport; Fri, 6 Jun 2025 02:39:35 -0700
From: <marius.cristea@xxxxxxxxxxxxx>
To: <jic23@xxxxxxxxxx>, <dlechner@xxxxxxxxxxxx>, <nuno.sa@xxxxxxxxxx>,
<andy@xxxxxxxxxx>
CC: <robh@xxxxxxxxxx>, <krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<broonie@xxxxxxxxxx>, <linux-iio@xxxxxxxxxxxxxxx>,
<devicetree@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<marius.cristea@xxxxxxxxxxxxx>
Subject: [PATCH v3 0/2] adding support for Microchip PAC194X Power Monitor
Date: Fri, 6 Jun 2025 12:39:27 +0300
Message-ID: <20250606093929.100118-1-marius.cristea@xxxxxxxxxxxxx>
X-Mailer: git-send-email 2.48.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Marius Cristea <marius.cristea@xxxxxxxxxxxxx>

Adding support for Microchip PAC194X and PAC195X series of Power Monitor
with Accumulator chip family. This driver covers the following part
numbers:
- PAC1941, PAC1941_2, PAC1942, PAC1942_2, PAC1943, PAC1944
- PAC1951, PAC1951_2, PAC1952, PAC1952_2, PAC1953, PAC1954

The PAC194X family supports 9V Full-Scale Range and the PAC195X supports
32V Full-Scale Range.

There are two versions of the PAC194X/5X: the PAC194X-1/5X-1 devices are
for high-side current sensing and the PAC194X/5X-2 devices are for low-side
current sensing or floating VBUS applications. The PAC194X/5X-1 is named
shortly PAC194X/5X.

Differences related to previous patch:
v3:
- fix review comments device tree binding:
rewrite commit message
change the way full scale for voltage and current is set. Add a
properties to describe if the input is bipolar or not.
fix the "dtschema/dtc warnings/errors"
- fix review comments driver:
simplify the driver to include just the basic functionality. More
features will be added later.
fix coding style issues
change to lower case the "to_pac1944_chip_info()" to be more like
other container_of
remove the PAC1944_DEV_ATTR() macro
drop the __func__ bit from error messages
remove unneeded casts
change the logic to reset the accumulator when is enabled
change from {} to { }
remove unreachable() from the code
rewrite the code to keep the error paths out of line
replace scoped_guard() with guard(), where was possible
use to_delayed_work() to get from work to delayed work
remove active_channels[] array
print info message in case FW disagrees with what is found on the bus

v2:
- fix review comments device tree binding:
remove underscore from names
add names to the interrupts and list them
add a better description for new properties
- fix review comments driver:
fix coding style issues
use bitmap for checking the active channels
keep the "pac1944_get_unaligned_be56" here because the change wasn't acceted
into the asm-generic.
document new added attributes
remove the "scan" part till we support buffered capture
remove "unlikely" marking
add masks up in some array of const structures to avoid some case statements
remove pac1944_mutex_destroy function
replace some functions with a macro (just for testing)
replace dev_err with dev_err_probe in functions used in pac1944_probe

v1:
- first version committed to review

Marius Cristea (2):
dt-bindings: iio: adc: adding support for PAC194X
iio: adc: adding support for PAC194X

.../ABI/testing/sysfs-bus-iio-adc-pac1944 | 17 +
.../bindings/iio/adc/microchip,pac1944.yaml | 204 ++
MAINTAINERS | 7 +
drivers/iio/adc/Kconfig | 12 +
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/pac1944.c | 2841 +++++++++++++++++
6 files changed, 3082 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-pac1944
create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml
create mode 100644 drivers/iio/adc/pac1944.c


base-commit: 0c86e33819785fe50616b6ee3fb35c1e4be406d5
--
2.48.1



Return-Path: <linux-kernel+bounces-675563-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CC3B941E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:40:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8B9353B1C44
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:40:29 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DFBD2868A9;
Fri, 6 Jun 2025 09:40:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CRQTQBEC"
Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D96DA28688D;
Fri, 6 Jun 2025 09:40:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202841; cv=none; b=fs+xtCP7jlDyUVZN/irGnC/l3yaEbP61sjYyv/q5wZTqHphbR5tUlAfH+M0ooTvaZfxrLYoAz5jE1AvRjM3wBe32byL53F991xT/cp530VRdcsuhQzZh7EztWGGwuxmhJ73rKtt5RPFdeoi51mpjFKlHy4PVxyBSaDqqDh6RsNU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202841; c=relaxed/simple;
bh=MsSVWdGVlzcxZp/J2ROe/PeWjaXznhz0HwdWWtqU+e8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=bejnDSNigBiaPPXzPyoznlpRdA3e33WgEGQKeDLqcPOuvCbfcki+nvP0rgYza1aOOKRfMyWpVvxMT1+DJREnBh20BFt/KRdVTS23SBzgIpq7jv8aiwPrq1Oq8bbAjaSZwd6vBWfHsrvwTxzu08B1ICXVqjyCttBlH8QmEACae8Y=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CRQTQBEC; arc=none smtp.client-ip=209.85.128.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-451d3f72391so24788115e9.3;
Fri, 06 Jun 2025 02:40:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749202838; x=1749807638; darn=vger.kernel.org;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date:from:to
:cc:subject:date:message-id:reply-to;
bh=q+n76qVXU3h+uhDCEUxB7URrPrTN6QFQxKPKPiN//Go=;
b=CRQTQBEC8ZFZQ/DgEqyr1N4/Vuk19KgIRlKMrVx5QtQ8sMLtmbXigRHKqc2TvA9H6N
XbHrepfy1lyL76pnamtgU6YJNXfOFZxBFY6Q7H1mjX+ttlUkNNeHmwFJEmDqQtM6KEg1
EJdPupjcDcKK6XyWp/rIHAfVZbMa0byydMIy9pwUvtEY5p7V9ybcLFhmy1r9h3P6DAlq
zRfaU9zOJNBfCMIFLW4BohyKOtRrf4kwRwtRdMAFN2BZRIMcKCedB7ETLJoQk71kFK1X
tkzOqX1YTMAZBJCtyxTgEX6Xi/vDc6azzfqtpeca4gcqgyPZ4+KNPUUVNboAiCym56CI
n7gA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749202838; x=1749807638;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=q+n76qVXU3h+uhDCEUxB7URrPrTN6QFQxKPKPiN//Go=;
b=a0gglGlXN/GLFvyCxqaSCmfrVq9kmThKCktBIVtehhmpowUBDuH0OjtddaRxlQRNou
Ro66pGG53YGpL3kWPjJd+GH+Bu17dE4YyJkUcRmMuTX6f+x1+9jC68oUcaV49pl8bKQ+
VRRxvFP+m2StBfyqaTVqi1txCXVqd47sRXfFyjLekkgBN93nHRie8CbserJ1e3yOcMj0
unUkkWk+FNA0SWfMlPAupC+900d5x2vf3BCmm73nB29cD/tNoTjMqcaKlIufOlCyMggM
qRSNK73bPRZgph3MlQf7VN0RJRvd6vS+gJ0rNv6Zqx/IGXgtp81btfa5okVAsetkeLsU
TLEw==
X-Forwarded-Encrypted: i=1; AJvYcCXC0fmcbtI5V0Fyhdi5hNy3efGysI7FRKZ2rM/ojus+dQ9NPZryHJbJotKTnjjYx1goiLfHE8SZ1rDEdJQR@xxxxxxxxxxxxxxx, AJvYcCXIgf26YUT2EoM1la2sZAkXBgHz7L56GwcUTVPbhMUR2EMtgr0YFgkToaawCHRqr/ysvYTAu/vrOvfP@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yxipl1j1RqT1qDjeH0aND2WV04AyP9ENZttEEGjZuwBuRs8+Pbn
whmsRhPGrBDGAGXxiuPCMVSZgm22g3HR27ddJKySOSdxcp1g9gDqKvRg
X-Gm-Gg: ASbGncvNMcHRNHHOI5D0VTFfPWf6zchXpcn7UdJWF41qkQzCnC/PyoP+uPwfCOa3pZy
bTsd2VEz7EXBd6JV+BhURttC6HW5VpQ1QlnwnwwvexG9UvzQSTgs4lThj2MV/Bp6nXJycVU6hRd
uOTBnqXt9ZIHjNej1Gv8Dmbu1hVdmhv9b6gBZQuCnrFg6FuZuXLqaKvI0f7ZAd0IMmqTUX15GRl
3rQtsZb4RrS8LtYk8xGQ0Z10xFPSX9i96IKQX5P2vsT8aRt3fhdsgTjC+9PKxSF3UOdPiPbp2Bs
kv2GqcIoqM4P3X+IXnDvC1Q5kqXAjLTbo/OHpscLwoBq8/Tk/Bu9S/wQT8Xv5rAw1MBFFF8/0rO
x
X-Google-Smtp-Source: AGHT+IGwBj0jxP6yyRAAm+wJVRyOfQEStxQUYPCyRL5B3SL086Ed1xUu2fktxVuU5/8a5FZfBehQTQ==
X-Received: by 2002:a05:600c:548d:b0:43d:3df:42d8 with SMTP id 5b1f17b1804b1-45201437aa8mr27346985e9.6.1749202837831;
Fri, 06 Jun 2025 02:40:37 -0700 (PDT)
Received: from HYB-DlYm71t3hSl.ad.analog.com ([2001:a61:1225:ec01:d1d7:779d:8019:7bb0])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-452730c73b8sm15003775e9.29.2025.06.06.02.40.37
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 02:40:37 -0700 (PDT)
Date: Fri, 6 Jun 2025 11:40:35 +0200
From: Jorge Marques <gastmaier@xxxxxxxxx>
To: Frank Li <Frank.li@xxxxxxx>
Cc: Jorge Marques <jorge.marques@xxxxxxxxxx>,
Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
linux-i3c@xxxxxxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 1/2] dt-bindings: i3c: Add adi-i3c-master
Message-ID: <binjodgavnupkl2plmnwjito4pu27uwwmhgwexlqq3diad3zj3@c2jotuzsq43o>
References: <20250604-adi-i3c-master-v1-0-0488e80dafcb@xxxxxxxxxx>
<20250604-adi-i3c-master-v1-1-0488e80dafcb@xxxxxxxxxx>
<aECSL3cn3m9pKJv6@lizhi-Precision-Tower-5810>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <aECSL3cn3m9pKJv6@lizhi-Precision-Tower-5810>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Frank,

On Wed, Jun 04, 2025 at 02:36:31PM -0400, Frank Li wrote:
> On Wed, Jun 04, 2025 at 05:48:57PM +0200, Jorge Marques wrote:
> > Add nodes for ADI I3C Controller IP core.
>
> Add binding doc for ...
>
> >
> > Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
> > ---
> > .../devicetree/bindings/i3c/adi,i3c-master.yaml | 63 ++++++++++++++++++++++
> > MAINTAINERS | 5 ++
> > 2 files changed, 68 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml b/Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..859dbfde15f123db59d7aa46c120c4a3ac05198e
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
> > @@ -0,0 +1,63 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/i3c/adi,i3c-master.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Analog Devices I3C Controller
> > +
> > +description: |
> > + The ADI I3C controller implements a subset of the I3C-basic specification to
> > + interface I3C and I2C peripherals [1].
> > +
> > + [1] https://analogdevicesinc.github.io/hdl/library/i3c_controller
> > +
> > +maintainers:
> > + - Jorge Marques <jorge.marques@xxxxxxxxxx>
> > +
> > +allOf:
> > + - $ref: i3c.yaml#
> > +
>
> New binding, generally, allOf between required and unevaluatedProperties
>

Ack.
> > +properties:
> > + compatible:
> > + const: adi,i3c-master
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + clocks:
> > + minItems: 1
> > + items:
> > + - description: The AXI interconnect clock.
> > + - description: The I3C controller clock.
> > +
> > + clock-names:
> > + items:
> > + - const: s_axi_aclk
> > + - const: i3c_clk
>
> Needn't _clk surfix,
>
> - const: axi
> - const: i3c
>
> Frank

Ack.

Best Regards,
Jorge
> > +
> > + interrupts:
> > + maxItems: 1
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - clocks
> > + - clock-names
> > + - interrupts
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > + - |
> > + i3c@44a00000 {
> > + compatible = "adi,i3c-master";
> > + reg = <0x44a00000 0x1000>;
> > + interrupts = <0 56 4>;
> > + clocks = <&clkc 15>, <&clkc 15>;
> > + clock-names = "s_axi_aclk", "i3c_clk";
> > + #address-cells = <3>;
> > + #size-cells = <0>;
> > +
> > + /* I3C and I2C devices */
> > + };
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 96b82704950184bd71623ff41fc4df31e4c7fe87..6f56e17dcecf902c6812827c1ec3e067c65e9894 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -11243,6 +11243,11 @@ S: Maintained
> > F: Documentation/devicetree/bindings/i3c/aspeed,ast2600-i3c.yaml
> > F: drivers/i3c/master/ast2600-i3c-master.c
> >
> > +I3C DRIVER FOR ANALOG DEVICES I3C CONTROLLER IP
> > +M: Jorge Marques <jorge.marques@xxxxxxxxxx>
> > +S: Maintained
> > +F: Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
> > +
> > I3C DRIVER FOR CADENCE I3C MASTER IP
> > M: PrzemysÅ?aw Gaj <pgaj@xxxxxxxxxxx>
> > S: Maintained
> >
> > --
> > 2.49.0
> >
>
> --
> linux-i3c mailing list
> linux-i3c@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-i3c


Return-Path: <linux-kernel+bounces-675562-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3F71141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:40:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9B4493B1C04
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:40:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4584128688E;
Fri, 6 Jun 2025 09:40:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="jZu8bqer"
Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233])
(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 0E169286424;
Fri, 6 Jun 2025 09:40:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749202835; cv=none; b=tyv4qQDk7eQvkMmtE3qzVgsrQv1XySdz/aAPwaawfXL+y6xkWC9daXjEPlYyxKHyjuIcBZZtwqUH4xyaJa/GthHAKoseqUwyWgz446ZB7/9ueZUDp0rGqOFvqBPrTYDJi963fGdFjiHCQjjdS2oOX4IDD6bWuOOHV8Au9wtNUTk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749202835; c=relaxed/simple;
bh=UvEzkzzdRSdLU09QVWj2cGb9t4oSZLXYFVa39D5Yx8k=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=cmuO5JF9CWFMIDdlsLtb504w5NiTjvMf58Mn6B91IOycy3811d0dgkcjJESJEZYxDnQyKuxakIM1YD/h5N1RvWqTbVDQM0fveV6d2WQx8GyXs5sfDn0ixD8fGe0ZUE241agw6w9cZ3FYKnCIlOcFYtys8cItxOoWX9dDordirHM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=jZu8bqer; arc=none smtp.client-ip=68.232.153.233
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp;
t=1749202831; x=1780738831;
h=from:to:cc:subject:date:message-id:in-reply-to:
references:mime-version:content-transfer-encoding;
bh=UvEzkzzdRSdLU09QVWj2cGb9t4oSZLXYFVa39D5Yx8k=;
b=jZu8bqerHBnge5ykhKgAFRtVNoWBuM4G39JCaKGR5fUbxCotPElphMEK
WkYdGY1KE7Y/C5mtPPMTra1Wu/CpUynDd4tEI4gu7Lu5rYJ5INNsw+Ki3
V/zbsWMnlLZVeoJ77TsHFVpL53l0DwFfzs2lz3USscd8gmkcQuA4oKbNJ
au5/uIpS6WRFD8gx6sIztA/NMHmgnfSmE78rhDIrf7To6w98EObgiICut
nZttcsD47WL2Mm4x2vW+MJAyrtZfGmPM0tAdUPQ8QDRZL8Y3NmpjBzkr9
KFneHLp1Gcax1ayKm35GyFNHIRtQsDSofNo3wbtL6bPaWmmNDQ0NH95zB
Q==;
X-CSE-ConnectionGUID: sMPIwhvsR82v7ZZg5p3Gug==
X-CSE-MsgGUID: RuXcIohoQTO3uryuSvFXtg==
X-IronPort-AV: E=Sophos;i="6.16,214,1744095600";
d="scan'208";a="47448216"
X-Amp-Result: SKIPPED(no attachment in message)
Received: from unknown (HELO email.microchip.com) ([170.129.1.10])
by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Jun 2025 02:40:29 -0700
Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by
chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.1.2507.44; Fri, 6 Jun 2025 02:39:49 -0700
Received: from marius-VM.mshome.net (10.10.85.11) by chn-vm-ex04.mchp-main.com
(10.10.85.152) with Microsoft SMTP Server id 15.1.2507.44 via Frontend
Transport; Fri, 6 Jun 2025 02:39:46 -0700
From: <marius.cristea@xxxxxxxxxxxxx>
To: <jic23@xxxxxxxxxx>, <dlechner@xxxxxxxxxxxx>, <nuno.sa@xxxxxxxxxx>,
<andy@xxxxxxxxxx>
CC: <robh@xxxxxxxxxx>, <krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<broonie@xxxxxxxxxx>, <linux-iio@xxxxxxxxxxxxxxx>,
<devicetree@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<marius.cristea@xxxxxxxxxxxxx>
Subject: [PATCH v3 2/2] iio: adc: adding support for PAC194X
Date: Fri, 6 Jun 2025 12:39:29 +0300
Message-ID: <20250606093929.100118-3-marius.cristea@xxxxxxxxxxxxx>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <20250606093929.100118-1-marius.cristea@xxxxxxxxxxxxx>
References: <20250606093929.100118-1-marius.cristea@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Marius Cristea <marius.cristea@xxxxxxxxxxxxx>

This is the iio driver for Microchip PAC194X and PAC195X series of
Power Monitors with Accumulator. The PAC194X family supports 9V
Full-Scale Range and the PAC195X supports 32V Full-Scale Range.

There are two versions of the PAC194X/5X: the PAC194X/5X-1 devices
are for high-side current sensing and the PAC194X/5X-2 devices are
for low-side current sensing or floating VBUS applications. The
PAC194X/5X-1 is named shortly PAC194X/5X.

Signed-off-by: Marius Cristea <marius.cristea@xxxxxxxxxxxxx>
---
.../ABI/testing/sysfs-bus-iio-adc-pac1944 | 17 +
MAINTAINERS | 7 +
drivers/iio/adc/Kconfig | 12 +
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/pac1944.c | 2841 +++++++++++++++++
5 files changed, 2878 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-pac1944
create mode 100644 drivers/iio/adc/pac1944.c

diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-pac1944 b/Documentation/ABI/testing/sysfs-bus-iio-adc-pac1944
new file mode 100644
index 000000000000..ae88eac354a4
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-pac1944
@@ -0,0 +1,17 @@
+What: /sys/bus/iio/devices/iio:deviceX/slow_alert1_cfg
+KernelVersion: 6.16
+Contact: linux-iio@xxxxxxxxxxxxxxx
+Description:
+ A read/write property used to route, inside the PAC device, a specific ALERT
+ signal to the SLOW/ALERT1 pin. The SLOW/ALERT1 pin must be configured for the
+ ALERT function in order to control the device hardware pin (this is the default
+ functionality of the device hardware pin).
+
+What: /sys/bus/iio/devices/iio:deviceX/gpio_alert2_cfg
+KernelVersion: 6.16
+Contact: linux-iio@xxxxxxxxxxxxxxx
+Description:
+ A read/write property used to route, inside the PAC device, a specific ALERT
+ signal to the GPIO/ALERT2 hardware pin. The GPIO/ALERT2 pin must be configured
+ for ALERT function in order to control the device hardware pin (this is the
+ default functionality of the device hardware pin).
diff --git a/MAINTAINERS b/MAINTAINERS
index 86a2045ba62e..240e84893ad9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15920,6 +15920,13 @@ S: Supported
F: Documentation/devicetree/bindings/iio/adc/microchip,pac1934.yaml
F: drivers/iio/adc/pac1934.c

+MICROCHIP PAC1944 ADC DRIVER
+M: Marius Cristea <marius.cristea@xxxxxxxxxxxxx>
+L: linux-iio@xxxxxxxxxxxxxxx
+S: Supported
+F: Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml
+F: drivers/iio/adc/pac1944.c
+
MICROCHIP PCI1XXXX GP DRIVER
M: Vaibhaav Ram T.L <vaibhaavram.tl@xxxxxxxxxxxxx>
M: Kumaravel Thiagarajan <kumaravel.thiagarajan@xxxxxxxxxxxxx>
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 186a453af56c..a608aa6cb9c7 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -1148,6 +1148,18 @@ config PAC1934
This driver can also be built as a module. If so, the module
will be called pac1934.

+config PAC1944
+ tristate "Microchip Technology PAC1944/PAC1954 driver"
+ depends on I2C
+ help
+ Say yes here to build support for Microchip Technology's PAC1941,
+ PAC1941-2, PAC1942, PAC1942-2, PAC1943, PAC1944, PAC1951,
+ PAC1951-2, PAC1952, PAC1952-2, PAC1953, PAC1954
+ Single/Multi-Channel Power Monitor with Accumulator.
+
+ This driver can also be built as a module. If so, the module
+ will be called pac1944.
+
config PALMAS_GPADC
tristate "TI Palmas General Purpose ADC"
depends on MFD_PALMAS
diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
index 09ae6edb2650..ee47d880babf 100644
--- a/drivers/iio/adc/Makefile
+++ b/drivers/iio/adc/Makefile
@@ -103,6 +103,7 @@ obj-$(CONFIG_NCT7201) += nct7201.o
obj-$(CONFIG_NPCM_ADC) += npcm_adc.o
obj-$(CONFIG_PAC1921) += pac1921.o
obj-$(CONFIG_PAC1934) += pac1934.o
+obj-$(CONFIG_PAC1944) += pac1944.o
obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o
obj-$(CONFIG_QCOM_PM8XXX_XOADC) += qcom-pm8xxx-xoadc.o
obj-$(CONFIG_QCOM_SPMI_ADC5) += qcom-spmi-adc5.o
diff --git a/drivers/iio/adc/pac1944.c b/drivers/iio/adc/pac1944.c
new file mode 100644
index 000000000000..ce09334b076a
--- /dev/null
+++ b/drivers/iio/adc/pac1944.c
@@ -0,0 +1,2841 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * IIO driver for PAC194X and PAC195X series chips
+ *
+ * Copyright (C) 2022-2025 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Marius Cristea marius.cristea@xxxxxxxxxxxxx
+ *
+ * Datasheet for PAC1941, PAC1942, PAC1943 and PAC1944 can be found here:
+ * https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/PAC194X-Family-Data-Sheet-DS20006543.pdf
+ * Datasheet for PAC1951, PAC1952, PAC1953 and PAC1954 can be found here:
+ * https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/PAC195X-Family-Data-Sheet-DS20006539.pdf
+ */
+
+#include <linux/acpi.h>
+#include <linux/bitfield.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/events.h>
+#include <linux/iio/sysfs.h>
+#include <linux/unaligned.h>
+
+/*
+ * Maximum (1092 * 60 * 1000), around 1092 minutes@1024 sps
+ * We will keep the refresh lower
+ */
+#define PAC1944_MAX_RFSH_LIMIT_MS 300000
+
+/* 50msec is the timeout for validity of the cached registers */
+#define PAC1944_MIN_POLLING_TIME_MS 50
+/*
+ * 1000usec is the minimum wait time for normal conversions when sample
+ * rate doesn't change
+ */
+#define PAC1944_MIN_UPDATE_WAIT_TIME_US 1000
+
+#define PAC1944_SHUNT_UOHMS_DEFAULT 100000
+
+/* 32000mV */
+#define PAC195X_VOLTAGE_MILLIVOLTS_MAX 32000
+/* 9000mV */
+#define PAC194X_VOLTAGE_MILLIVOLTS_MAX 9000
+
+/*
+ * Voltage bits resolution when set for unsigned values and
+ * HALF FSR signed values
+ */
+#define PAC1944_VOLTAGE_16B_RES 16
+/* Voltage bits resolution when set for signed values */
+#define PAC1944_VOLTAGE_15B_RES 15
+
+/* 100mV maximum voltage drop over the sense resistors */
+#define PAC1944_VSENSE_MILLIVOLTS_MAX 100
+
+/*
+ * Current bits resolution when set for unsigned values and
+ * HALF FSR signed values
+ */
+#define PAC1944_CURRENT_16B_RES 16
+
+/* Current bits resolution when set for signed values */
+#define PAC1944_CURRENT_15B_RES 15
+
+/* Power resolution is 30 bits when unsigned and HALF FSR signed values */
+#define PAC1944_POWER_30B_RES 30
+
+/* Power resolution is 29 bits when signed */
+#define PAC1944_POWER_29B_RES 29
+
+/* Accumulation register is 56 bits long for unipolar range */
+#define PAC1944_ENERGY_56B_RES 56
+
+/* Accumulation register is 56 bits long for bipolar range */
+#define PAC1944_ENERGY_55B_RES 55
+
+/* Maximum power-product value - 32 V * 0.1 V */
+#define PAC195X_PRODUCT_VOLTAGE_PV_FSR 3200000000000UL
+
+/* Maximum power-product value - 9 V * 0.1 V */
+#define PAC194X_PRODUCT_VOLTAGE_PV_FSR 900000000000UL
+
+#define PAC1944_MEAS_REG_SNAPSHOT_LEN 80
+#define PAC1944_CTRL_REG_SNAPSHOT_LEN 24
+
+#define PAC1944_DEFAULT_CHIP_SAMP_SPEED_HZ 1024
+
+/* Device register address map */
+#define PAC1944_REFRESH_REG_ADDR 0x00
+#define PAC1944_CTRL_REG_ADDR 0x01
+#define PAC1944_ACC_COUNT_REG_ADDR 0x02
+#define PAC1944_VACC_1_REG_ADDR 0x03
+#define PAC1944_VACC_2_REG_ADDR 0x04
+#define PAC1944_VACC_3_REG_ADDR 0x05
+#define PAC1944_VACC_4_REG_ADDR 0x06
+#define PAC1944_VBUS_1_ADDR 0x07
+#define PAC1944_VBUS_2_ADDR 0x08
+#define PAC1944_VBUS_3_ADDR 0x09
+#define PAC1944_VBUS_4_ADDR 0x0A
+#define PAC1944_VSENSE_1_ADDR 0x0B
+#define PAC1944_VSENSE_2_ADDR 0x0C
+#define PAC1944_VSENSE_3_ADDR 0x0D
+#define PAC1944_VSENSE_4_ADDR 0x0E
+#define PAC1944_VBUS_AVG_1_ADDR 0x0F
+#define PAC1944_VBUS_AVG_2_ADDR 0x10
+#define PAC1944_VBUS_AVG_3_ADDR 0x11
+#define PAC1944_VBUS_AVG_4_ADDR 0x12
+#define PAC1944_VSENSE_AVG_1_ADDR 0x13
+#define PAC1944_VSENSE_AVG_2_ADDR 0x14
+#define PAC1944_VSENSE_AVG_3_ADDR 0x15
+#define PAC1944_VSENSE_AVG_4_ADDR 0x16
+#define PAC1944_VPOWER_1_ADDR 0x17
+#define PAC1944_VPOWER_2_ADDR 0x18
+#define PAC1944_VPOWER_3_ADDR 0x19
+#define PAC1944_VPOWER_4_ADDR 0x1A
+
+/* Start of configurations registers */
+#define PAC1944_SMBUS_SETTINGS_REGS_ADDR 0x1C
+#define PAC1944_NEG_PWR_FSR_REG_ADDR 0x1D
+#define PAC1944_REFRESG_V_REG_ADDR 0x1E
+#define PAC1944_REFRESH_V_REG_ADDR 0x1F
+#define PAC1944_SLOW_REG_ADDR 0x20
+#define PAC1944_CTRL_ACT_REG_ADDR 0x21
+#define PAC1944_CTRL_LAT_REG_ADDR 0x23
+#define PAC1944_NEG_PWR_FSR_LAT_REG_ADDR 0x24
+#define PAC1944_ACCUM_CFG_REG_ADDR 0x25
+
+/*
+ * Registers related to alert functionality
+ */
+#define PAC1944_ALERT_STATUS_REG_ADDR 0x26
+#define PAC1944_SLOW_ALERT1_REG_ADDR 0x27
+#define PAC1944_GPIO_ALERT2_REG_ADDR 0x28
+#define PAC1944_ACC_FULLNESS_LIMITS_REG_ADDR 0x29
+#define PAC1944_OC_LIMIT_REG_ADDR 0x30
+#define PAC1944_UC_LIMIT_REG_ADDR 0x34
+#define PAC1944_OP_LIMIT_REG_ADDR 0x38
+#define PAC1944_OV_LIMIT_REG_ADDR 0x3C
+#define PAC1944_UV_LIMIT_REG_ADDR 0x40
+#define PAC1944_OC_LIMIT_NSAMPLES_REG_ADDR 0x44
+#define PAC1944_UC_LIMIT_NSAMPLES_REG_ADDR 0x45
+#define PAC1944_OP_LIMIT_NSAMPLES_REG_ADDR 0x46
+#define PAC1944_OV_LIMIT_NSAMPLES_REG_ADDR 0x47
+#define PAC1944_UV_LIMIT_NSAMPLES_REG_ADDR 0x48
+#define PAC1944_ALERT_ENABLE_REG_ADDR 0x49
+
+#define PAC1944_ALERT_ENABLE_REG_LEN 3
+#define PAC1944_ALERTS_REG_LEN 63
+
+#define PAC1944_PID_REG_ADDR 0xFD
+
+/* Alert Enable register */
+#define PAC1944_OC_MASK GENMASK(23, 20)
+#define PAC1944_CH01OC_MASK BIT(23)
+#define PAC1944_CH01OC_SET BIT(23)
+#define PAC1944_CH02OC_MASK BIT(22)
+#define PAC1944_CH02OC_SET BIT(22)
+#define PAC1944_CH03OC_MASK BIT(21)
+#define PAC1944_CH03OC_SET BIT(21)
+#define PAC1944_CH04OC_MASK BIT(20)
+#define PAC1944_CH04OC_SET BIT(20)
+
+#define PAC1944_UC_MASK GENMASK(19, 16)
+#define PAC1944_CH01UC_MASK BIT(19)
+#define PAC1944_CH01UC_SET BIT(19)
+#define PAC1944_CH02UC_MASK BIT(18)
+#define PAC1944_CH02UC_SET BIT(18)
+#define PAC1944_CH03UC_MASK BIT(17)
+#define PAC1944_CH03UC_SET BIT(17)
+#define PAC1944_CH04UC_MASK BIT(16)
+#define PAC1944_CH04UC_SET BIT(16)
+
+#define PAC1944_OV_MASK GENMASK(15, 12)
+#define PAC1944_CH01OV_MASK BIT(15)
+#define PAC1944_CH01OV_SET BIT(15)
+#define PAC1944_CH02OV_MASK BIT(14)
+#define PAC1944_CH02OV_SET BIT(14)
+#define PAC1944_CH03OV_MASK BIT(13)
+#define PAC1944_CH03OV_SET BIT(13)
+#define PAC1944_CH04OV_MASK BIT(12)
+#define PAC1944_CH04OV_SET BIT(12)
+
+#define PAC1944_UV_MASK GENMASK(11, 8)
+#define PAC1944_CH01UV_MASK BIT(11)
+#define PAC1944_CH01UV_SET BIT(11)
+#define PAC1944_CH02UV_MASK BIT(10)
+#define PAC1944_CH02UV_SET BIT(10)
+#define PAC1944_CH03UV_MASK BIT(9)
+#define PAC1944_CH03UV_SET BIT(9)
+#define PAC1944_CH04UV_MASK BIT(8)
+#define PAC1944_CH04UV_SET BIT(8)
+
+#define PAC1944_OP_MASK GENMASK(7, 4)
+#define PAC1944_CH01OP_MASK BIT(7)
+#define PAC1944_CH01OP_SET BIT(7)
+#define PAC1944_CH02OP_MASK BIT(6)
+#define PAC1944_CH02OP_SET BIT(6)
+#define PAC1944_CH03OP_MASK BIT(5)
+#define PAC1944_CH03OP_SET BIT(5)
+#define PAC1944_CH04OP_MASK BIT(4)
+#define PAC1944_CH04OP_SET BIT(4)
+
+#define PAC1944_ACC_OVF_MASK BIT(3)
+#define PAC1944_ACC_OVF_SET BIT(3)
+
+#define PAC1944_ACC_COUNT_MASK BIT(2)
+#define PAC1944_ACC_COUNT_SET BIT(2)
+
+#define PAC1944_ALERT_CC1_MASK BIT(1)
+#define PAC1944_ALERT_CC1_SET BIT(1)
+
+#define PAC1944_ACC_REG_LEN 4
+#define PAC1944_VACC_REG_LEN 7
+#define PAC1944_VBUS_SENSE_REG_LEN 2
+#define PAC1944_VPOWER_REG_LEN 4
+#define PAC1944_CTRL_ACT_REG_LEN 2
+#define PAC1944_CTRL_LAT_REG_LEN 2
+#define PAC1944_MAX_REGISTER_LEN 6
+
+#define PAC1944_COMMON_DEVATTR 1
+#define PAC1944_ACC_DEVATTR 3
+#define PAC1944_SHARED_DEVATTRS_COUNT 2
+
+#define PAC1944_MID 0x5D
+#define PAC194x54_PID 0x5B
+#define PAC194x53_PID 0x5A
+#define PAC194x52_PID 0x59
+#define PAC194x51_PID 0x58
+
+#define PAC1944_MAX_CH 4
+
+/* PAC194X family */
+#define PAC_PRODUCT_ID_1941 0x68
+#define PAC_PRODUCT_ID_1942 0x69
+#define PAC_PRODUCT_ID_1943 0x6A
+#define PAC_PRODUCT_ID_1944 0x6B
+#define PAC_PRODUCT_ID_1941_2 0x6C
+#define PAC_PRODUCT_ID_1942_2 0x6D
+/* PAC195x family */
+#define PAC_PRODUCT_ID_1951 0x78
+#define PAC_PRODUCT_ID_1952 0x79
+#define PAC_PRODUCT_ID_1953 0x7A
+#define PAC_PRODUCT_ID_1954 0x7B
+#define PAC_PRODUCT_ID_1951_2 0x7C
+#define PAC_PRODUCT_ID_1952_2 0x7D
+
+#define PAC1944_ALERT 0x00
+#define PAC1944_GPIO_INPUT 0x01
+#define PAC1944_GPIO_OUTPUT 0x02
+#define PAC1944_SLOW 0x03
+
+#define PAC1944_CTRL_SAMPLE_MASK GENMASK(15, 12)
+#define PAC1944_CTRL_GPIO_ALERT2_MASK GENMASK(11, 10)
+#define PAC1944_CTRL_SLOW_ALERT1_MASK GENMASK(9, 8)
+#define PAC1944_CTRL_CH_1_OFF_MASK BIT(7)
+#define PAC1944_CTRL_CH_2_OFF_MASK BIT(6)
+#define PAC1944_CTRL_CH_3_OFF_MASK BIT(5)
+#define PAC1944_CTRL_CH_4_OFF_MASK BIT(4)
+
+#define PAC1944_NEG_PWR_CFG_VS1_MASK GENMASK(15, 14)
+#define PAC1944_NEG_PWR_CFG_VS2_MASK GENMASK(13, 12)
+#define PAC1944_NEG_PWR_CFG_VS3_MASK GENMASK(11, 10)
+#define PAC1944_NEG_PWR_CFG_VS4_MASK GENMASK(9, 8)
+#define PAC1944_NEG_PWR_CFG_VB1_MASK GENMASK(7, 6)
+#define PAC1944_NEG_PWR_CFG_VB2_MASK GENMASK(5, 4)
+#define PAC1944_NEG_PWR_CFG_VB3_MASK GENMASK(3, 2)
+#define PAC1944_NEG_PWR_CFG_VB4_MASK GENMASK(1, 0)
+
+#define PAC1944_CFG_ACC4_SHIFT 0
+#define PAC1944_CFG_ACC3_SHIFT 2
+#define PAC1944_CFG_ACC2_SHIFT 4
+#define PAC1944_CFG_ACC1_SHIFT 6
+
+#define PAC1944_ACPI_GET_NAMES 1
+#define PAC1944_ACPI_GET_UOHMS_VALS 2
+#define PAC1944_ACPI_GET_BIPOLAR_SETTINGS 4
+#define PAC1944_ACPI_GET_SAMP 5
+
+#define ACCUM_REG(acc1_cfg, acc2_cfg, acc3_cfg, acc4_cfg) \
+ ((((acc1_cfg) & 0x03) << PAC1944_CFG_ACC1_SHIFT) | \
+ (((acc2_cfg) & 0x03) << PAC1944_CFG_ACC2_SHIFT) | \
+ (((acc3_cfg) & 0x03) << PAC1944_CFG_ACC3_SHIFT) | \
+ (((acc4_cfg) & 0x03) << PAC1944_CFG_ACC4_SHIFT))
+
+/*
+ * Accumulated power/energy formula (in mW-seconds):
+ * Energy = (Vacc/10^9)*[(10^9/2^30)*2^9]*3.2*10^3/Rsense
+ * Vacc - is the accumulated value per second
+ * Rsense - value of the shunt resistor in microOhms
+ *
+ * PAC195X_MAX_VPOWER_RSHIFTED_BY_29B = 3.2*((10^9)/(2^29))*10^9
+ * will be used to calculate the scale for accumulated power/energy
+ */
+#define PAC195X_MAX_VPOWER_RSHIFTED_BY_29B 5960464478UL
+
+/*
+ * PAC194X_MAX_VPOWER_RSHIFTED_BY_29B = 0.9*((10^9)/(2^29))*10^9
+ * will be used to calculate the scale for accumulated power/energy
+ */
+#define PAC194X_MAX_VPOWER_RSHIFTED_BY_29B 1676380634UL
+
+/* (100mV * 1000000) / (2^15) used to calculate the scale for current */
+#define PAC1944_MAX_VSENSE_RSHIFTED_BY_15B 3052
+
+/*
+ * [(100mV * 1000000) / (2^15)]*10^9 used to calculate the scale
+ * for accumulated current/Coulomb counter
+ */
+#define PAC1944_MAX_VSENSE_NANO 3051757812500UL
+
+#define to_pac1944_chip_info(d) container_of(d, struct pac1944_chip_info, work_chip_rfsh)
+
+/*
+ * these indexes are exactly describing the element order within a single
+ * PAC1944/54 phys channel IIO channel descriptor; see the static const struct
+ * iio_chan_spec pac1944_single_channel[] declaration
+ */
+enum pac1944_ch_idx {
+ PAC1944_CH_POWER,
+ PAC1944_CH_VOLTAGE,
+ PAC1944_CH_CURRENT,
+ PAC1944_CH_VOLTAGE_AVERAGE,
+ PAC1944_CH_CURRENT_AVERAGE,
+};
+
+/* IDs ordered based on Product ID */
+enum pac1944_ids {
+ PAC1941,
+ PAC1942,
+ PAC1943,
+ PAC1944,
+ PAC1941_2,
+ PAC1942_2,
+ PAC1951,
+ PAC1952,
+ PAC1953,
+ PAC1954,
+ PAC1951_2,
+ PAC1952_2,
+};
+
+enum pac1944_acc_mode {
+ PAC1944_ACCMODE_VPOWER,
+ PAC1944_ACCMODE_VSENSE,
+ PAC1944_ACCMODE_VBUS,
+};
+
+enum pac1944_ {
+ PAC1944_UNIPOLAR_FSR_CFG,
+ PAC1944_BIPOLAR_FSR_CFG,
+ PAC1944_BIPOLAR_HALF_FSR_CFG,
+};
+
+enum pac1944_samps {
+ PAC1944_SAMP_1024SPS_ADAPT,
+ PAC1944_SAMP_256SPS_ADAPT,
+ PAC1944_SAMP_64SPS_ADAPT,
+ PAC1944_SAMP_8SPS_ADAPT,
+
+ PAC1944_SAMP_1024SPS,
+ PAC1944_SAMP_256SPS,
+ PAC1944_SAMP_64SPS,
+ PAC1944_SAMP_8SPS,
+
+ PAC1944_SAMP_SINGLE_SHOT,
+ PAC1944_SAMP_SINGLE_SHOT_8X,
+ PAC1944_SAMP_FAST_MODE,
+ PAC1944_SAMP_BURST_MODE,
+
+ PAC1944_RESERVED1,
+ PAC1944_RESERVED2,
+ PAC1944_RESERVED3,
+ PAC1944_RESERVED4,
+};
+
+enum pac1944_number_of_active_channels {
+ PAC1944_1_CHANNEL_ACTIVE,
+ PAC1944_2_CHANNELS_ACTIVE,
+ PAC1944_3_CHANNELS_ACTIVE,
+ PAC1944_4_CHANNELS_ACTIVE,
+};
+
+/*
+ * The PAC195X has a feature called Adaptive Accumulator mode (APAPT). In this
+ * mode, sampling is programmed at one of the valid sample rates and samples are
+ * accumulated. If the SLOW pin is asserted and the device begins sampling at
+ * 8 SPS, these samples are shifted by 7 bits to the left and accumulated so as
+ * to simulate sampling at the maximum sampling rate, 1024 SPS, and the
+ * accumulator count is also incremented by 128 for each sample in Slow mode
+ * (when using the Adaptive Accumulator mode) to simulate samples being
+ * accumulated at the maximum sampling rate.
+ * This offers a big reduction in host overhead and bus traffic for systems that
+ * need to use the SLOW pin for lower power operation during certain times and
+ * want to have continuous accurate energy monitoring for both the maximum
+ * sampling rate and the SLOW sampling rate.
+ */
+static const unsigned int pac1944_samp_rate_map_tbl[] = {
+ [PAC1944_SAMP_1024SPS_ADAPT] = 1024,
+ [PAC1944_SAMP_256SPS_ADAPT] = 256,
+ [PAC1944_SAMP_64SPS_ADAPT] = 64,
+ [PAC1944_SAMP_8SPS_ADAPT] = 8,
+ [PAC1944_SAMP_1024SPS] = 1024,
+ [PAC1944_SAMP_256SPS] = 256,
+ [PAC1944_SAMP_64SPS] = 64,
+ [PAC1944_SAMP_8SPS] = 8,
+ [PAC1944_SAMP_SINGLE_SHOT] = 1,
+ [PAC1944_SAMP_SINGLE_SHOT_8X] = 8,
+ [PAC1944_SAMP_FAST_MODE] = 0xff,
+ [PAC1944_SAMP_BURST_MODE] = 0xff,
+ [PAC1944_RESERVED1] = 0xff,
+ [PAC1944_RESERVED2] = 0xff,
+ [PAC1944_RESERVED3] = 0xff,
+ [PAC1944_RESERVED4] = 0xff,
+};
+
+static const unsigned int shift_map_tbl[] = {
+ [PAC1944_SAMP_1024SPS_ADAPT] = 10,
+ [PAC1944_SAMP_256SPS_ADAPT] = 10,
+ [PAC1944_SAMP_64SPS_ADAPT] = 10,
+ [PAC1944_SAMP_8SPS_ADAPT] = 10,
+ [PAC1944_SAMP_1024SPS] = 10,
+ [PAC1944_SAMP_256SPS] = 8,
+ [PAC1944_SAMP_64SPS] = 6,
+ [PAC1944_SAMP_8SPS] = 3,
+ [PAC1944_SAMP_SINGLE_SHOT] = 10,
+ [PAC1944_SAMP_SINGLE_SHOT_8X] = 8,
+ [PAC1944_SAMP_FAST_MODE] = 0xff,
+ [PAC1944_SAMP_BURST_MODE] = 0xff,
+ [PAC1944_RESERVED1] = 0xff,
+ [PAC1944_RESERVED2] = 0xff,
+ [PAC1944_RESERVED3] = 0xff,
+ [PAC1944_RESERVED4] = 0xff,
+};
+
+static const unsigned int samp_rate_burst_mode_tbl[] = {
+ [PAC1944_1_CHANNEL_ACTIVE] = 5120,
+ [PAC1944_2_CHANNELS_ACTIVE] = 2560,
+ [PAC1944_3_CHANNELS_ACTIVE] = 1706,
+ [PAC1944_4_CHANNELS_ACTIVE] = 1280,
+};
+
+static const unsigned int samp_rate_fast_mode_tbl[] = {
+ [PAC1944_1_CHANNEL_ACTIVE] = 2560,
+ [PAC1944_2_CHANNELS_ACTIVE] = 1707,
+ [PAC1944_3_CHANNELS_ACTIVE] = 1280,
+ [PAC1944_4_CHANNELS_ACTIVE] = 1024,
+};
+
+/* Available Sample Modes */
+static const char * const pac1944_frequency_avail[] = {
+ "1024_ADAP",
+ "256_ADAP",
+ "64_ADAP",
+ "8_ADAP",
+ "1024",
+ "256",
+ "64",
+ "8",
+ "single_shot_1x",
+ "single_shot_8x",
+ "fast",
+ "burst",
+};
+
+static const unsigned int pac1944_overvoltage_mask_tbl[] = {
+ PAC1944_CH01OV_MASK,
+ PAC1944_CH02OV_MASK,
+ PAC1944_CH03OV_MASK,
+ PAC1944_CH04OV_MASK,
+};
+
+static const unsigned int pac1944_undervoltage_mask_tbl[] = {
+ PAC1944_CH01UV_MASK,
+ PAC1944_CH02UV_MASK,
+ PAC1944_CH03UV_MASK,
+ PAC1944_CH04UV_MASK,
+};
+
+static const unsigned int pac1944_overcurrent_mask_tbl[] = {
+ PAC1944_CH01OC_MASK,
+ PAC1944_CH02OC_MASK,
+ PAC1944_CH03OC_MASK,
+ PAC1944_CH04OC_MASK,
+};
+
+static const unsigned int pac1944_undercurrent_mask_tbl[] = {
+ PAC1944_CH01UC_MASK,
+ PAC1944_CH02OC_MASK,
+ PAC1944_CH03OC_MASK,
+ PAC1944_CH04OC_MASK,
+};
+
+static const unsigned int pac1944_overpower_mask_tbl[] = {
+ PAC1944_CH01OP_MASK,
+ PAC1944_CH02OP_MASK,
+ PAC1944_CH03OP_MASK,
+ PAC1944_CH04OP_MASK,
+};
+
+/**
+ * struct reg_data - data from the registers
+ * @vsense_mode:array of values, Full Scale Range (FSR) mode for V Sense
+ * @vbus_mode: array of values, Full Scale Range (FSR) mode for V Bus
+ * @accumulation_mode: array of values, accumulation mode for hardware accumulator
+ * @meas_regs: snapshot of raw measurements registers
+ * @ctrl_act_reg: snapshot of the ctrl_act register
+ * @ctrl_lat_reg: snapshot of the ctrl_lat register
+ * @acc_count: snapshot of the acc_count register
+ * @total_samples_nr: accumulated values for acc_count (total number of samples)
+ * @acc_val: accumulated values per second
+ * @vacc: accumulated vpower values
+ * @vpower: snapshot of vpower registers
+ * @vbus: snapshot of vbus registers
+ * @vbus_avg: averages of vbus registers
+ * @vsense: snapshot of vsense registers
+ * @vsense_avg: averages of vsense registers
+ * @jiffies_tstamp: chip's uptime
+ */
+struct reg_data {
+ u8 vbus_mode[PAC1944_MAX_CH];
+ u8 vsense_mode[PAC1944_MAX_CH];
+ u8 accumulation_mode[PAC1944_MAX_CH];
+ u8 meas_regs[PAC1944_MEAS_REG_SNAPSHOT_LEN];
+ u16 ctrl_act_reg;
+ u16 ctrl_lat_reg;
+ u32 acc_count;
+ u32 total_samples_nr[PAC1944_MAX_CH];
+ s64 acc_val[PAC1944_MAX_CH];
+ s64 vacc[PAC1944_MAX_CH];
+ s32 vpower[PAC1944_MAX_CH];
+ s32 vbus[PAC1944_MAX_CH];
+ s32 vbus_avg[PAC1944_MAX_CH];
+ s32 vsense[PAC1944_MAX_CH];
+ s32 vsense_avg[PAC1944_MAX_CH];
+ unsigned long jiffies_tstamp;
+};
+
+/**
+ * struct pac1944_chip_info - chip configuration
+ * @channels: array of values, true means that channel is active
+ * @iio_info: pointer to iio_info structure
+ * @client: a pointer to the i2c client associated with the device
+ * @lock: lock to prevent concurrent reads/writes
+ * @work_chip_rfsh: chip refresh workqueue implementation
+ * @active_channels_mask: active channels
+ * @phys_channels: number of physical channels for the device
+ * @chip_variant: stores the type of the device
+ * @chip_revision: store the silicon revision version of the device
+ * @shunts: array of values, shunt resistor values
+ * @chip_reg_data: pointer to structure, containing data from the device registers
+ * @sample_rate_value: sampling frequency
+ * @labels: array of string, name of each channel
+ * @is_pac195x_family: true if device is part of the PAC195x family
+ * @sampling_mode: sampling mode used by the device
+ * @num_enabled_channels: count of how many chip channels are currently enabled
+ * @slow_alert1: snapshot of slow/alert register
+ * @gpio_alert2: snapshot of gpio/alert register
+ * @acc_fullness: snapshot of accumulator fullness limit register
+ * @overcurrent: array of values, overcurrent limit
+ * @undercurrent: array of values, undercurrent limit
+ * @overpower: array of values, overpower limit
+ * @overvoltage: array of values, overvoltage limit
+ * @undervoltage: array of values, undervoltage limit
+ * @oc_limit_nsamples: number of consecutive samples exceeding the overcurrent limit
+ * @uc_limit_nsamples: number of consecutive samples exceeding the undercurrent limit
+ * @op_limit_nsamples: number of consecutive samples exceeding the overpower limit
+ * @ov_limit_nsamples: number of consecutive samples exceeding the overvoltage limit
+ * @uv_limit_nsamples: number of consecutive samples exceeding the undervoltage limit
+ * @alert_enable: snapshot of alert enable register
+ * @enable_acc: array of values, true means that accumulation channel is measured
+ */
+struct pac1944_chip_info {
+ const struct iio_chan_spec *channels;
+ struct iio_info iio_info;
+ struct i2c_client *client;
+ struct mutex lock; /* lock to prevent concurrent reads/writes */
+ struct delayed_work work_chip_rfsh;
+ unsigned long active_channels_mask;
+ u8 phys_channels;
+ u8 chip_variant;
+ u8 chip_revision;
+ u32 shunts[PAC1944_MAX_CH];
+ struct reg_data chip_reg_data;
+ s32 sample_rate_value;
+ char *labels[PAC1944_MAX_CH];
+ bool is_pac195x_family;
+ u8 sampling_mode;
+ u8 num_enabled_channels;
+ u32 slow_alert1;
+ u32 gpio_alert2;
+ u16 acc_fullness;
+ u16 overcurrent[PAC1944_MAX_CH];
+ u16 undercurrent[PAC1944_MAX_CH];
+ u32 overpower[PAC1944_MAX_CH];
+ u16 overvoltage[PAC1944_MAX_CH];
+ u16 undervoltage[PAC1944_MAX_CH];
+ u8 oc_limit_nsamples[PAC1944_MAX_CH];
+ u8 uc_limit_nsamples[PAC1944_MAX_CH];
+ u8 op_limit_nsamples[PAC1944_MAX_CH];
+ u8 ov_limit_nsamples[PAC1944_MAX_CH];
+ u8 uv_limit_nsamples[PAC1944_MAX_CH];
+ u32 alert_enable;
+ bool enable_acc[PAC1944_MAX_CH];
+};
+
+/**
+ * struct pac1944_features - features of a pac194x instance
+ * @phys_channels: number of physical channels supported by the chip
+ * @prod_id: hardware ID
+ * @name: chip's name
+ */
+struct pac1944_features {
+ u8 phys_channels;
+ u8 prod_id;
+ const char *name;
+};
+
+static const struct pac1944_features pac1944_chip_config[] = {
+ /* PAC194X Family */
+ [PAC1941] = {
+ .phys_channels = 1,
+ .prod_id = PAC_PRODUCT_ID_1941,
+ .name = "pac1941",
+ },
+ [PAC1942] = {
+ .phys_channels = 2,
+ .prod_id = PAC_PRODUCT_ID_1942,
+ .name = "pac1942",
+ },
+ [PAC1943] = {
+ .phys_channels = 3,
+ .prod_id = PAC_PRODUCT_ID_1943,
+ .name = "pac1943",
+ },
+ [PAC1944] = {
+ .phys_channels = 4,
+ .prod_id = PAC_PRODUCT_ID_1944,
+ .name = "pac1944",
+ },
+ [PAC1941_2] = {
+ .phys_channels = 1,
+ .prod_id = PAC_PRODUCT_ID_1941_2,
+ .name = "pac1941_2",
+ },
+ [PAC1942_2] = {
+ .phys_channels = 2,
+ .prod_id = PAC_PRODUCT_ID_1942_2,
+ .name = "pac1942_2",
+ },
+ /* PAC195X Family */
+ [PAC1951] = {
+ .phys_channels = 1,
+ .prod_id = PAC_PRODUCT_ID_1951,
+ .name = "pac1951",
+ },
+ [PAC1952] = {
+ .phys_channels = 2,
+ .prod_id = PAC_PRODUCT_ID_1952,
+ .name = "pac1952_1",
+ },
+ [PAC1953] = {
+ .phys_channels = 3,
+ .prod_id = PAC_PRODUCT_ID_1953,
+ .name = "pac1953",
+ },
+ [PAC1954] = {
+ .phys_channels = 4,
+ .prod_id = PAC_PRODUCT_ID_1954,
+ .name = "pac1954",
+ },
+ [PAC1951_2] = {
+ .phys_channels = 1,
+ .prod_id = PAC_PRODUCT_ID_1951_2,
+ .name = "pac1951_2",
+ },
+ [PAC1952_2] = {
+ .phys_channels = 2,
+ .prod_id = PAC_PRODUCT_ID_1952_2,
+ .name = "pac1952_2",
+ },
+};
+
+static inline u64 pac1944_get_unaligned_be56(const u8 *p)
+{
+ return (u64)p[0] << 48 | (u64)p[1] << 40 | (u64)p[2] << 32 |
+ (u64)p[3] << 24 | p[4] << 16 | p[5] << 8 | p[6];
+}
+
+/* Low-level I2c functions used to transfer more then 32 bytes at once */
+static int pac1944_i2c_read(struct i2c_client *client, u8 reg_addr,
+ void *databuf, u8 len)
+{
+ struct i2c_msg msgs[2] = {
+ { .addr = client->addr,
+ .len = 1,
+ .buf = (u8 *)&reg_addr,
+ .flags = 0
+ },
+ { .addr = client->addr,
+ .len = len,
+ .buf = databuf,
+ .flags = I2C_M_RD
+ }
+ };
+
+ return i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
+}
+
+static int pac1944_disable_alert_reg(struct device *dev, u32 mask, u8 *status)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct i2c_client *client = info->client;
+ int ret;
+ u32 val;
+ u8 buf[PAC1944_ALERT_ENABLE_REG_LEN];
+
+ ret = i2c_smbus_read_i2c_block_data(client,
+ PAC1944_ALERT_ENABLE_REG_ADDR,
+ PAC1944_ALERT_ENABLE_REG_LEN,
+ status);
+ if (ret < 0) {
+ dev_err(dev, "failing to disable allert reg\n");
+ return ret;
+ }
+
+ val = get_unaligned_be24(status);
+ val = val & (~mask);
+ put_unaligned_be24(val, &buf[0]);
+
+ /* disable appropriate bit from the Alert enable register */
+ return i2c_smbus_write_block_data(client, PAC1944_ALERT_ENABLE_REG_ADDR,
+ PAC1944_ALERT_ENABLE_REG_LEN,
+ (u8 *)&buf[0]);
+}
+
+static int pac1944_restore_alert_reg(struct iio_dev *indio_dev, u8 *status)
+{
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct i2c_client *client = info->client;
+ int ret;
+
+ /* restoring the Alert enable register */
+ ret = i2c_smbus_write_block_data(client, PAC1944_ALERT_ENABLE_REG_ADDR,
+ PAC1944_ALERT_ENABLE_REG_LEN, status);
+ if (ret) {
+ dev_err(&client->dev, "failing to write %s\n", __func__);
+ return ret;
+ }
+
+ /* Sending a REFRESH_V to the chip, so the new settings take place */
+ ret = i2c_smbus_write_byte(info->client, PAC1944_REFRESH_V_REG_ADDR);
+ if (ret)
+ dev_err(&client->dev, "cannot send REFRESH_V\n");
+
+ return ret;
+}
+
+static int pac1944_update_alert_16b(struct device *dev, u8 addr, u32 mask,
+ u16 value)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct i2c_client *client = info->client;
+ int ret;
+ __be16 tmp_be16;
+ u8 status[PAC1944_ALERT_ENABLE_REG_LEN];
+
+ ret = pac1944_disable_alert_reg(dev, mask, &status[0]);
+ if (ret) {
+ dev_err(dev, "failed to disable alert reg\n");
+ return ret;
+ }
+
+ tmp_be16 = cpu_to_be16(value);
+
+ ret = i2c_smbus_write_word_data(client, addr, tmp_be16);
+ if (ret) {
+ dev_err(dev, "failing to write at 0x%x\n", addr);
+ return ret;
+ }
+
+ return pac1944_restore_alert_reg(indio_dev, &status[0]);
+}
+
+static int pac1944_update_alert_24b(struct device *dev, u8 addr, u32 mask,
+ u32 value)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct i2c_client *client = info->client;
+ int ret;
+ u8 status[PAC1944_ALERT_ENABLE_REG_LEN], tmp[3];
+
+ ret = pac1944_disable_alert_reg(dev, mask, &status[0]);
+ if (ret) {
+ dev_err(dev, "failed to disable alert reg\n");
+ return ret;
+ }
+
+ put_unaligned_be24(value, &tmp[0]);
+
+ ret = i2c_smbus_write_block_data(client, addr, ARRAY_SIZE(tmp), (u8 *)&tmp[0]);
+ if (ret) {
+ dev_err(dev, "failing to write at 0x%x\n", addr);
+ return ret;
+ }
+
+ return pac1944_restore_alert_reg(indio_dev, &status[0]);
+}
+
+/* Custom IIO Device Attributes */
+static ssize_t pac1944_shunt_value_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+
+ return sysfs_emit(buf, "%u\n", info->shunts[this_attr->address]);
+}
+
+static ssize_t pac1944_shunt_value_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+ int sh_val;
+
+ if (kstrtouint(buf, 10, &sh_val)) {
+ dev_err(dev, "Shunt value is not valid\n");
+ return -EINVAL;
+ }
+
+ scoped_guard(mutex, &info->lock)
+ info->shunts[this_attr->address] = sh_val;
+
+ return count;
+}
+
+static ssize_t pac1944_slow_alert1_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct i2c_client *client = info->client;
+ int ret;
+ u32 val;
+ u8 tmp[3];
+
+ if (kstrtoint(buf, 10, &val))
+ return -EINVAL;
+
+ put_unaligned_be24(val, &tmp[0]);
+
+ scoped_guard(mutex, &info->lock) {
+ ret = i2c_smbus_write_block_data(client, PAC1944_SLOW_ALERT1_REG_ADDR,
+ ARRAY_SIZE(tmp), (u8 *)&tmp[0]);
+ if (ret) {
+ dev_err(dev, "failing to write %s\n", __func__);
+ return ret;
+ }
+
+ info->slow_alert1 = val;
+ }
+
+ return count;
+}
+
+#define PAC1944_SLOW_ALERT_SHOW(alert_name) \
+static ssize_t pac1944_##alert_name##_show(struct device *dev, \
+ struct device_attribute *attr, \
+ char *buf) \
+ { \
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev); \
+ struct pac1944_chip_info *info = iio_priv(indio_dev); \
+ \
+ return sysfs_emit(buf, "%u\n", info->alert_name); \
+ }
+
+PAC1944_SLOW_ALERT_SHOW(slow_alert1)
+PAC1944_SLOW_ALERT_SHOW(gpio_alert2)
+
+static ssize_t pac1944_gpio_alert2_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct i2c_client *client = info->client;
+ int ret;
+ u32 val;
+ u8 tmp[3];
+
+ if (kstrtoint(buf, 10, &val))
+ return -EINVAL;
+
+ put_unaligned_be24(val, &tmp[0]);
+
+ scoped_guard(mutex, &info->lock) {
+ ret = i2c_smbus_write_block_data(client, PAC1944_GPIO_ALERT2_REG_ADDR,
+ ARRAY_SIZE(tmp), (u8 *)&tmp[0]);
+ if (ret) {
+ dev_err(dev, "failing to write %s\n", __func__);
+ return ret;
+ }
+
+ info->gpio_alert2 = val;
+ }
+
+ return count;
+}
+
+static IIO_DEVICE_ATTR(in_current1_shunt_resistor, 0644,
+ pac1944_shunt_value_show, pac1944_shunt_value_store, 0);
+static IIO_DEVICE_ATTR(in_current2_shunt_resistor, 0644,
+ pac1944_shunt_value_show, pac1944_shunt_value_store, 1);
+static IIO_DEVICE_ATTR(in_current3_shunt_resistor, 0644,
+ pac1944_shunt_value_show, pac1944_shunt_value_store, 2);
+static IIO_DEVICE_ATTR(in_current4_shunt_resistor, 0644,
+ pac1944_shunt_value_show, pac1944_shunt_value_store, 3);
+
+static IIO_DEVICE_ATTR(slow_alert1_cfg, 0644, pac1944_slow_alert1_show,
+ pac1944_slow_alert1_store, 0);
+static IIO_DEVICE_ATTR(gpio_alert2_cfg, 0644, pac1944_gpio_alert2_show,
+ pac1944_gpio_alert2_store, 0);
+
+static struct attribute *pac1944_all_attrs[] = {
+ &iio_dev_attr_in_current1_shunt_resistor.dev_attr.attr,
+ &iio_dev_attr_in_current2_shunt_resistor.dev_attr.attr,
+ &iio_dev_attr_in_current3_shunt_resistor.dev_attr.attr,
+ &iio_dev_attr_in_current4_shunt_resistor.dev_attr.attr,
+ &iio_dev_attr_slow_alert1_cfg.dev_attr.attr,
+ &iio_dev_attr_gpio_alert2_cfg.dev_attr.attr,
+ NULL
+};
+
+static const struct iio_event_spec pac1944_events[] = {
+ {
+ .type = IIO_EV_TYPE_THRESH,
+ .dir = IIO_EV_DIR_RISING,
+ .mask_separate = BIT(IIO_EV_INFO_VALUE) |
+ BIT(IIO_EV_INFO_ENABLE),
+ },
+ {
+ .type = IIO_EV_TYPE_THRESH,
+ .dir = IIO_EV_DIR_FALLING,
+ .mask_separate = BIT(IIO_EV_INFO_VALUE) |
+ BIT(IIO_EV_INFO_ENABLE),
+ },
+};
+
+static const struct iio_event_spec pac1944_single_event[] = {
+ {
+ .type = IIO_EV_TYPE_THRESH,
+ .dir = IIO_EV_DIR_RISING,
+ .mask_separate = BIT(IIO_EV_INFO_VALUE) |
+ BIT(IIO_EV_INFO_ENABLE),
+ },
+};
+
+#define PAC1944_VBUS_CHANNEL(_index, _address, _ev_spec, _num_ev_spec) {\
+ .type = IIO_VOLTAGE, \
+ .address = (_address), \
+ .indexed = 1, \
+ .channel = (_index) + 1, \
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
+ BIT(IIO_CHAN_INFO_SCALE), \
+ .event_spec = (_ev_spec), \
+ .num_event_specs = (_num_ev_spec), \
+ .ext_info = pac1944_ext_info \
+}
+
+#define PAC1944_VBUS_AVG_CHANNEL(_index, _address) {\
+ .type = IIO_VOLTAGE, \
+ .address = (_address), \
+ .indexed = 1, \
+ .channel = (_index) + 1, \
+ .info_mask_separate = BIT(IIO_CHAN_INFO_AVERAGE_RAW) | \
+ BIT(IIO_CHAN_INFO_SCALE), \
+ .ext_info = pac1944_ext_info \
+}
+
+#define PAC1944_VSENSE_CHANNEL(_index, _address, _ev_spec, _num_ev_spec) {\
+ .type = IIO_CURRENT, \
+ .address = (_address), \
+ .indexed = 1, \
+ .channel = (_index) + 1, \
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
+ BIT(IIO_CHAN_INFO_SCALE), \
+ .event_spec = (_ev_spec), \
+ .num_event_specs = (_num_ev_spec), \
+ .ext_info = pac1944_ext_info \
+}
+
+#define PAC1944_VSENSE_AVG_CHANNEL(_index, _address) { \
+ .type = IIO_CURRENT, \
+ .address = (_address), \
+ .indexed = 1, \
+ .channel = (_index) + 1, \
+ .info_mask_separate = BIT(IIO_CHAN_INFO_AVERAGE_RAW) | \
+ BIT(IIO_CHAN_INFO_SCALE), \
+ .ext_info = pac1944_ext_info \
+}
+
+#define PAC1944_VPOWER_CHANNEL(_index, _address, _ev_spec, _num_ev_spec) {\
+ .type = IIO_POWER, \
+ .address = (_address), \
+ .indexed = 1, \
+ .channel = (_index) + 1, \
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
+ BIT(IIO_CHAN_INFO_SCALE), \
+ .event_spec = (_ev_spec), \
+ .num_event_specs = (_num_ev_spec), \
+ .ext_info = pac1944_ext_info \
+}
+
+static int pac1944_send_refresh(struct pac1944_chip_info *info, u8 refresh_cmd,
+ u32 wait_time)
+{
+ struct i2c_client *client = info->client;
+ int ret;
+
+ /* Writing a REFRESH or a REFRESH_V command */
+ ret = i2c_smbus_write_byte(client, refresh_cmd);
+ if (ret) {
+ dev_err(&client->dev, "%s - cannot send Refresh cmd (0x%02X) to PAC1944\n",
+ __func__, refresh_cmd);
+ return ret;
+ }
+
+ /* Register data retrieval timestamp */
+ info->chip_reg_data.jiffies_tstamp = jiffies;
+ /* Wait till the data is available */
+ usleep_range(wait_time, wait_time + 100);
+
+ return 0;
+}
+
+static int pac1944_reg_snapshot(struct pac1944_chip_info *info, bool do_refresh,
+ u8 refresh_cmd, u32 wait_time)
+{
+ struct i2c_client *client = info->client;
+ struct device *dev = &client->dev;
+ u8 shift, idx;
+ u8 *offset_reg_data_p;
+ int cnt, ret;
+ u32 count, inc_count;
+ u32 fs = 0;
+ s64 stored_value, tmp_s64;
+ s64 inc = 0;
+ __be16 tmp_be16;
+ u16 smpl_mode;
+ bool is_unipolar;
+
+ guard(mutex)(&info->lock);
+
+ if (do_refresh) {
+ ret = pac1944_send_refresh(info, refresh_cmd, wait_time);
+ if (ret < 0) {
+ dev_err(dev, "cannot send refresh towards PAC1944\n");
+ return ret;
+ }
+ }
+
+ /* Read the ctrl/status registers for this snapshot */
+ ret = i2c_smbus_read_i2c_block_data(client, PAC1944_CTRL_ACT_REG_ADDR,
+ sizeof(tmp_be16), (u8 *)&tmp_be16);
+ if (ret < 0) {
+ dev_err(dev, "cannot read PAC1944 regs from 0x%02X\n", PAC1944_CTRL_ACT_REG_ADDR);
+ return ret;
+ }
+
+ info->chip_reg_data.ctrl_act_reg = be16_to_cpu(tmp_be16);
+
+ ret = i2c_smbus_read_i2c_block_data(client, PAC1944_CTRL_LAT_REG_ADDR,
+ sizeof(tmp_be16), (u8 *)&tmp_be16);
+ if (ret < 0) {
+ dev_err(dev, "cannot read PAC1944 regs from 0x%02X\n", PAC1944_CTRL_LAT_REG_ADDR);
+ return ret;
+ }
+
+ info->chip_reg_data.ctrl_lat_reg = be16_to_cpu(tmp_be16);
+
+ /* Read the data registers */
+ ret = pac1944_i2c_read(client, PAC1944_ACC_COUNT_REG_ADDR,
+ (u8 *)info->chip_reg_data.meas_regs,
+ PAC1944_MEAS_REG_SNAPSHOT_LEN);
+ if (ret < 0) {
+ dev_err(dev, "cannot read PAC1944 regs from 0x%02X\n", PAC1944_ACC_COUNT_REG_ADDR);
+ return ret;
+ }
+
+ offset_reg_data_p = &info->chip_reg_data.meas_regs[0];
+
+ info->chip_reg_data.acc_count = get_unaligned_be32(offset_reg_data_p);
+
+ offset_reg_data_p += PAC1944_ACC_REG_LEN;
+
+ /*
+ * Check if the channel is active (within the data read from
+ * the chip), skip all fields if disabled
+ */
+ for_each_set_bit(cnt, &info->active_channels_mask, info->phys_channels) {
+ /* skip if the energy accumulation is disabled */
+ if (!info->enable_acc[cnt]) {
+ offset_reg_data_p += PAC1944_VACC_REG_LEN;
+ continue;
+ }
+
+ stored_value = info->chip_reg_data.acc_val[cnt];
+
+ info->chip_reg_data.vacc[cnt] = pac1944_get_unaligned_be56(offset_reg_data_p);
+
+ is_unipolar = true;
+ switch (info->chip_reg_data.accumulation_mode[cnt]) {
+ case PAC1944_ACCMODE_VPOWER:
+ if (info->chip_reg_data.vbus_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG ||
+ info->chip_reg_data.vsense_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG)
+ is_unipolar = false;
+ break;
+ case PAC1944_ACCMODE_VBUS:
+ if (info->chip_reg_data.vbus_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG)
+ is_unipolar = false;
+ break;
+ case PAC1944_ACCMODE_VSENSE:
+ if (info->chip_reg_data.vsense_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG)
+ is_unipolar = false;
+ break;
+ }
+
+ if (!is_unipolar)
+ info->chip_reg_data.vacc[cnt] =
+ sign_extend64(info->chip_reg_data.vacc[cnt], 55);
+
+ if (info->chip_reg_data.accumulation_mode[cnt] != PAC1944_ACCMODE_VBUS) {
+ /*
+ * Integrate the accumulated power or current over
+ * the elapsed interval.
+ */
+ smpl_mode = info->chip_reg_data.ctrl_lat_reg >> 12;
+
+ tmp_s64 = info->chip_reg_data.vacc[cnt];
+ if (smpl_mode < PAC1944_SAMP_FAST_MODE) {
+ /*
+ * Find how much shift is required by the sample rate
+ * The chip's sampling rate is 2^shift samples/sec
+ */
+ shift = shift_map_tbl[smpl_mode];
+ inc = tmp_s64 >> shift;
+ } else if (smpl_mode <= PAC1944_SAMP_BURST_MODE) {
+ idx = info->num_enabled_channels - 1;
+
+ if (smpl_mode == PAC1944_SAMP_FAST_MODE)
+ fs = samp_rate_fast_mode_tbl[idx];
+ else
+ /* smpl_mode == PAC1944_SAMP_BURST_MODE) */
+ fs = samp_rate_burst_mode_tbl[idx];
+
+ inc = div_u64(abs(tmp_s64), fs);
+ if (tmp_s64 < 0)
+ inc = -inc;
+ } else {
+ dev_err(dev, "Invalid sample rate index: %d!\n", smpl_mode);
+ return -EIO;
+ }
+ } else {
+ count = info->chip_reg_data.total_samples_nr[cnt];
+ inc_count = info->chip_reg_data.acc_count;
+
+ /* Check if total number of samples will overflow */
+ if (check_add_overflow(count, inc_count, &count)) {
+ dev_err(dev, "Number of samples on channel [%d] overflow!\n",
+ cnt + 1);
+ info->chip_reg_data.total_samples_nr[cnt] = 0;
+ info->chip_reg_data.acc_val[cnt] = 0;
+ }
+
+ info->chip_reg_data.total_samples_nr[cnt] += inc_count;
+
+ inc = info->chip_reg_data.vacc[cnt];
+ }
+
+ if (check_add_overflow(stored_value, inc, &stored_value)) {
+ if (is_negative(stored_value))
+ info->chip_reg_data.acc_val[cnt] = S64_MIN;
+ else
+ info->chip_reg_data.acc_val[cnt] = S64_MAX;
+
+ dev_err(dev, "Overflow detected on channel [%d]!\n", cnt + 1);
+ } else {
+ info->chip_reg_data.acc_val[cnt] += inc;
+ }
+
+ offset_reg_data_p += PAC1944_VACC_REG_LEN;
+ }
+
+ for_each_set_bit(cnt, &info->active_channels_mask, info->phys_channels) {
+ info->chip_reg_data.vbus[cnt] = get_unaligned_be16(offset_reg_data_p);
+
+ if (info->chip_reg_data.vbus_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG)
+ info->chip_reg_data.vbus[cnt] =
+ sign_extend32(info->chip_reg_data.vbus[cnt], 15);
+
+ offset_reg_data_p += PAC1944_VBUS_SENSE_REG_LEN;
+ }
+
+ for_each_set_bit(cnt, &info->active_channels_mask, info->phys_channels) {
+ info->chip_reg_data.vsense[cnt] = get_unaligned_be16(offset_reg_data_p);
+
+ if (info->chip_reg_data.vsense_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG)
+ info->chip_reg_data.vsense[cnt] =
+ sign_extend32(info->chip_reg_data.vsense[cnt], 15);
+
+ offset_reg_data_p += PAC1944_VBUS_SENSE_REG_LEN;
+ }
+
+ for_each_set_bit(cnt, &info->active_channels_mask, info->phys_channels) {
+ info->chip_reg_data.vbus_avg[cnt] = get_unaligned_be16(offset_reg_data_p);
+
+ if (info->chip_reg_data.vbus_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG)
+ info->chip_reg_data.vbus_avg[cnt] =
+ sign_extend32(info->chip_reg_data.vbus_avg[cnt], 15);
+
+ offset_reg_data_p += PAC1944_VBUS_SENSE_REG_LEN;
+ }
+
+ for_each_set_bit(cnt, &info->active_channels_mask, info->phys_channels) {
+ info->chip_reg_data.vsense_avg[cnt] = get_unaligned_be16(offset_reg_data_p);
+
+ if (info->chip_reg_data.vsense_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG)
+ info->chip_reg_data.vsense_avg[cnt] =
+ sign_extend32(info->chip_reg_data.vsense_avg[cnt], 15);
+
+ offset_reg_data_p += PAC1944_VBUS_SENSE_REG_LEN;
+ }
+
+ for_each_set_bit(cnt, &info->active_channels_mask, info->phys_channels) {
+ info->chip_reg_data.vpower[cnt] = get_unaligned_be32(offset_reg_data_p) >> 2;
+
+ if (info->chip_reg_data.vbus_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG ||
+ info->chip_reg_data.vsense_mode[cnt] != PAC1944_UNIPOLAR_FSR_CFG)
+ info->chip_reg_data.vpower[cnt] =
+ sign_extend32(info->chip_reg_data.vpower[cnt], 29);
+
+ offset_reg_data_p += PAC1944_VPOWER_REG_LEN;
+ }
+
+ return 0;
+}
+
+static int pac1944_retrieve_data(struct pac1944_chip_info *info, u32 wait_time)
+{
+ int ret = 0;
+
+ /*
+ * Check if the minimal elapsed time has passed and if so,
+ * re-read the chip, otherwise the cached info is just fine
+ */
+ if (time_after(jiffies, info->chip_reg_data.jiffies_tstamp +
+ msecs_to_jiffies(PAC1944_MIN_POLLING_TIME_MS))) {
+ /*
+ * We need to re-read the chip values
+ * call the pac1944_reg_snapshot
+ */
+ ret = pac1944_reg_snapshot(info, true, PAC1944_REFRESH_REG_ADDR,
+ wait_time);
+ /*
+ * Re-schedule the work for the read registers timeout
+ * (to prevent chip regs saturation)
+ */
+ cancel_delayed_work_sync(&info->work_chip_rfsh);
+ schedule_delayed_work(&info->work_chip_rfsh,
+ msecs_to_jiffies(PAC1944_MAX_RFSH_LIMIT_MS));
+ }
+
+ return ret;
+}
+
+static ssize_t pac1944_in_power_acc_raw_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+ int ret;
+ s64 curr_energy, int_part;
+ int rem;
+
+ ret = pac1944_retrieve_data(info, PAC1944_MIN_UPDATE_WAIT_TIME_US);
+ if (ret < 0)
+ return 0;
+
+ /*
+ * Expresses the 64 bit energy value as a
+ * 64 bit integer and a 32 bit nano value
+ */
+ curr_energy = info->chip_reg_data.acc_val[this_attr->address];
+ int_part = div_s64_rem(curr_energy, 1000000000, &rem);
+
+ if (rem < 0)
+ return sysfs_emit(buf, "-%lld.%09u\n", abs(int_part), -rem);
+ else
+ return sysfs_emit(buf, "%lld.%09u\n", int_part, abs(rem));
+}
+
+static ssize_t pac1944_in_power_acc_scale_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+ unsigned int shunt, rem;
+ u64 tmp, ref;
+
+ if (info->is_pac195x_family)
+ ref = PAC195X_MAX_VPOWER_RSHIFTED_BY_29B;
+ else
+ ref = PAC194X_MAX_VPOWER_RSHIFTED_BY_29B;
+
+ if ((info->chip_reg_data.vbus_mode[this_attr->address] == PAC1944_UNIPOLAR_FSR_CFG &&
+ info->chip_reg_data.vsense_mode[this_attr->address] == PAC1944_UNIPOLAR_FSR_CFG) ||
+ info->chip_reg_data.vbus_mode[this_attr->address] == PAC1944_BIPOLAR_HALF_FSR_CFG ||
+ info->chip_reg_data.vsense_mode[this_attr->address] == PAC1944_BIPOLAR_HALF_FSR_CFG)
+ ref = ref >> 1;
+
+ shunt = info->shunts[this_attr->address];
+
+ tmp = div_u64(ref * 1000000000LL, shunt);
+ rem = do_div(tmp, 1000000000LL);
+
+ return sysfs_emit(buf, "%lld.%09u\n", tmp, rem);
+}
+
+static ssize_t pac1944_in_enable_acc_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+
+ return sysfs_emit(buf, "%d\n", info->enable_acc[this_attr->address]);
+}
+
+static ssize_t pac1944_in_enable_acc_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+ int val;
+
+ if (kstrtouint(buf, 10, &val)) {
+ dev_err(dev, "Value is not valid\n");
+ return -EINVAL;
+ }
+
+ scoped_guard(mutex, &info->lock) {
+ info->enable_acc[this_attr->address] = val ? true : false;
+ if (val) {
+ info->chip_reg_data.acc_val[this_attr->address] = 0;
+ info->chip_reg_data.total_samples_nr[this_attr->address] = 0;
+ }
+ }
+
+ return count;
+}
+
+static ssize_t pac1944_in_current_acc_raw_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+ int ret;
+
+ ret = pac1944_retrieve_data(info, PAC1944_MIN_UPDATE_WAIT_TIME_US);
+ if (ret < 0)
+ return ret;
+
+ return sysfs_emit(buf, "%lld\n", info->chip_reg_data.acc_val[this_attr->address]);
+}
+
+static ssize_t pac1944_in_current_acc_scale_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+ int shunt, rem;
+ u64 tmp_u64, ref;
+
+ /*
+ * Currents - scale for mA - depends on the channel's shunt value
+ * (100mV * 1000000) / (2^16 * shunt(uOhm))
+ */
+ ref = PAC1944_MAX_VSENSE_NANO;
+
+ switch (info->chip_reg_data.vsense_mode[this_attr->address]) {
+ case PAC1944_UNIPOLAR_FSR_CFG:
+ case PAC1944_BIPOLAR_HALF_FSR_CFG:
+ shunt = info->shunts[this_attr->address];
+ break;
+ case PAC1944_BIPOLAR_FSR_CFG:
+ ref = ref << 1;
+ shunt = info->shunts[this_attr->address];
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ /*
+ * Increasing precision
+ * (100mV * 1000000 * 1000000000) / 2^16 )
+ */
+ tmp_u64 = div_u64(ref, shunt);
+ rem = do_div(tmp_u64, 1000000000LL);
+
+ return sysfs_emit(buf, "%lld.%09u\n", tmp_u64, rem);
+}
+
+static ssize_t pac1944_in_voltage_acc_raw_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+ int ret;
+ s64 acc_voltage;
+ u32 samples_count;
+ u64 tmp_u64;
+
+ ret = pac1944_retrieve_data(info, PAC1944_MIN_UPDATE_WAIT_TIME_US);
+ if (ret < 0)
+ return ret;
+
+ acc_voltage = info->chip_reg_data.acc_val[this_attr->address];
+ samples_count = info->chip_reg_data.total_samples_nr[this_attr->address];
+
+ tmp_u64 = div_u64(abs(acc_voltage), samples_count);
+
+ if (is_negative(acc_voltage))
+ return sysfs_emit(buf, "-%lld\n", tmp_u64);
+ else
+ return sysfs_emit(buf, "%lld\n", tmp_u64);
+}
+
+static ssize_t pac1944_in_voltage_acc_scale_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
+ int vals[2];
+ unsigned long long tmp;
+
+ if (info->is_pac195x_family)
+ vals[0] = PAC195X_VOLTAGE_MILLIVOLTS_MAX;
+ else
+ vals[0] = PAC194X_VOLTAGE_MILLIVOLTS_MAX;
+
+ if (info->chip_reg_data.vbus_mode[this_attr->address] != PAC1944_BIPOLAR_FSR_CFG)
+ /* PAC1944_UNIPOLAR_FSR_CFG or PAC1944_BIPOLAR_HALF_FSR_CFG */
+ vals[1] = PAC1944_VOLTAGE_16B_RES;
+ else
+ vals[1] = PAC1944_VOLTAGE_15B_RES;
+
+ tmp = (s64)vals[0] * 1000000000LL >> vals[1];
+ vals[1] = do_div(tmp, 1000000000LL);
+ vals[0] = tmp;
+
+ return sysfs_emit(buf, "%d.%09u\n", vals[0], vals[1]);
+}
+
+static IIO_DEVICE_ATTR(in_energy1_raw, 0444, pac1944_in_power_acc_raw_show, NULL, 0);
+static IIO_DEVICE_ATTR(in_energy2_raw, 0444, pac1944_in_power_acc_raw_show, NULL, 1);
+static IIO_DEVICE_ATTR(in_energy3_raw, 0444, pac1944_in_power_acc_raw_show, NULL, 2);
+static IIO_DEVICE_ATTR(in_energy4_raw, 0444, pac1944_in_power_acc_raw_show, NULL, 3);
+
+static IIO_DEVICE_ATTR(in_energy1_scale, 0444, pac1944_in_power_acc_scale_show, NULL, 0);
+static IIO_DEVICE_ATTR(in_energy2_scale, 0444, pac1944_in_power_acc_scale_show, NULL, 1);
+static IIO_DEVICE_ATTR(in_energy3_scale, 0444, pac1944_in_power_acc_scale_show, NULL, 2);
+static IIO_DEVICE_ATTR(in_energy4_scale, 0444, pac1944_in_power_acc_scale_show, NULL, 3);
+
+static IIO_DEVICE_ATTR(in_energy1_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 0);
+static IIO_DEVICE_ATTR(in_energy2_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 1);
+static IIO_DEVICE_ATTR(in_energy3_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 2);
+static IIO_DEVICE_ATTR(in_energy4_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 3);
+
+static IIO_DEVICE_ATTR(in_current_acc1_raw, 0444, pac1944_in_current_acc_raw_show, NULL, 0);
+static IIO_DEVICE_ATTR(in_current_acc2_raw, 0444, pac1944_in_current_acc_raw_show, NULL, 1);
+static IIO_DEVICE_ATTR(in_current_acc3_raw, 0444, pac1944_in_current_acc_raw_show, NULL, 2);
+static IIO_DEVICE_ATTR(in_current_acc4_raw, 0444, pac1944_in_current_acc_raw_show, NULL, 3);
+
+static IIO_DEVICE_ATTR(in_current_acc1_scale, 0444, pac1944_in_current_acc_scale_show, NULL, 0);
+static IIO_DEVICE_ATTR(in_current_acc2_scale, 0444, pac1944_in_current_acc_scale_show, NULL, 1);
+static IIO_DEVICE_ATTR(in_current_acc3_scale, 0444, pac1944_in_current_acc_scale_show, NULL, 2);
+static IIO_DEVICE_ATTR(in_current_acc4_scale, 0444, pac1944_in_current_acc_scale_show, NULL, 3);
+
+static IIO_DEVICE_ATTR(in_current_acc1_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 0);
+static IIO_DEVICE_ATTR(in_current_acc2_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 1);
+static IIO_DEVICE_ATTR(in_current_acc3_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 2);
+static IIO_DEVICE_ATTR(in_current_acc4_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 3);
+
+static IIO_DEVICE_ATTR(in_voltage_acc1_raw, 0444, pac1944_in_voltage_acc_raw_show, NULL, 0);
+static IIO_DEVICE_ATTR(in_voltage_acc2_raw, 0444, pac1944_in_voltage_acc_raw_show, NULL, 1);
+static IIO_DEVICE_ATTR(in_voltage_acc3_raw, 0444, pac1944_in_voltage_acc_raw_show, NULL, 2);
+static IIO_DEVICE_ATTR(in_voltage_acc4_raw, 0444, pac1944_in_voltage_acc_raw_show, NULL, 3);
+
+static IIO_DEVICE_ATTR(in_voltage_acc1_scale, 0444, pac1944_in_voltage_acc_scale_show, NULL, 0);
+static IIO_DEVICE_ATTR(in_voltage_acc2_scale, 0444, pac1944_in_voltage_acc_scale_show, NULL, 1);
+static IIO_DEVICE_ATTR(in_voltage_acc3_scale, 0444, pac1944_in_voltage_acc_scale_show, NULL, 2);
+static IIO_DEVICE_ATTR(in_voltage_acc4_scale, 0444, pac1944_in_voltage_acc_scale_show, NULL, 3);
+
+static IIO_DEVICE_ATTR(in_voltage_acc1_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 0);
+static IIO_DEVICE_ATTR(in_voltage_acc2_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 1);
+static IIO_DEVICE_ATTR(in_voltage_acc3_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 2);
+static IIO_DEVICE_ATTR(in_voltage_acc4_en, 0644, pac1944_in_enable_acc_show,
+ pac1944_in_enable_acc_store, 3);
+
+static struct attribute *pac1944_power_acc_attr[] = {
+ &iio_dev_attr_in_energy1_raw.dev_attr.attr,
+ &iio_dev_attr_in_energy2_raw.dev_attr.attr,
+ &iio_dev_attr_in_energy3_raw.dev_attr.attr,
+ &iio_dev_attr_in_energy4_raw.dev_attr.attr,
+ &iio_dev_attr_in_energy1_scale.dev_attr.attr,
+ &iio_dev_attr_in_energy2_scale.dev_attr.attr,
+ &iio_dev_attr_in_energy3_scale.dev_attr.attr,
+ &iio_dev_attr_in_energy4_scale.dev_attr.attr,
+ &iio_dev_attr_in_energy1_en.dev_attr.attr,
+ &iio_dev_attr_in_energy2_en.dev_attr.attr,
+ &iio_dev_attr_in_energy3_en.dev_attr.attr,
+ &iio_dev_attr_in_energy4_en.dev_attr.attr,
+ NULL
+};
+
+static struct attribute *pac1944_current_acc_attr[] = {
+ &iio_dev_attr_in_current_acc1_raw.dev_attr.attr,
+ &iio_dev_attr_in_current_acc2_raw.dev_attr.attr,
+ &iio_dev_attr_in_current_acc3_raw.dev_attr.attr,
+ &iio_dev_attr_in_current_acc4_raw.dev_attr.attr,
+ &iio_dev_attr_in_current_acc1_scale.dev_attr.attr,
+ &iio_dev_attr_in_current_acc2_scale.dev_attr.attr,
+ &iio_dev_attr_in_current_acc3_scale.dev_attr.attr,
+ &iio_dev_attr_in_current_acc4_scale.dev_attr.attr,
+ &iio_dev_attr_in_current_acc1_en.dev_attr.attr,
+ &iio_dev_attr_in_current_acc2_en.dev_attr.attr,
+ &iio_dev_attr_in_current_acc3_en.dev_attr.attr,
+ &iio_dev_attr_in_current_acc4_en.dev_attr.attr,
+ NULL
+};
+
+static struct attribute *pac1944_voltage_acc_attr[] = {
+ &iio_dev_attr_in_voltage_acc1_raw.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc2_raw.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc3_raw.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc4_raw.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc1_scale.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc2_scale.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc3_scale.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc4_scale.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc1_en.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc2_en.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc3_en.dev_attr.attr,
+ &iio_dev_attr_in_voltage_acc4_en.dev_attr.attr,
+ NULL
+};
+
+static int pac1944_prep_custom_attributes(struct pac1944_chip_info *info,
+ struct iio_dev *indio_dev)
+{
+ int ch, i, j;
+ int active_channels_count = 0;
+ struct attribute **pac1944_custom_attrs, **tmp_attr;
+ struct attribute_group *pac1944_group;
+ int custom_attr_cnt;
+ struct i2c_client *client = info->client;
+
+ active_channels_count = info->num_enabled_channels;
+
+ pac1944_group = devm_kzalloc(&client->dev, sizeof(*pac1944_group), GFP_KERNEL);
+ if (!pac1944_group)
+ return -ENOMEM;
+
+ /*
+ * Attributes for channel X:
+ * - in_shunt_value_X
+ * - one of pair attributes:
+ * - in_power_accX_raw and in_power_accX_scale
+ * - in_current_accX_raw and in_current_accX_scale
+ * - in_voltage_accX_raw and in_voltage_accX_scale
+ * Shared attributes:
+ * - slow_alert1_cfg
+ * - gpio_alert2_cfg
+ * NULL
+ */
+ custom_attr_cnt = PAC1944_COMMON_DEVATTR * active_channels_count;
+ custom_attr_cnt += PAC1944_ACC_DEVATTR * active_channels_count;
+ custom_attr_cnt += PAC1944_SHARED_DEVATTRS_COUNT;
+
+ pac1944_custom_attrs = devm_kzalloc(&client->dev, custom_attr_cnt *
+ sizeof(*pac1944_group) + 1, GFP_KERNEL);
+ if (!pac1944_custom_attrs)
+ return -ENOMEM;
+
+ j = 0;
+
+ for_each_set_bit(ch, &info->active_channels_mask, info->phys_channels) {
+ for (i = 0; i < PAC1944_COMMON_DEVATTR; i++)
+ pac1944_custom_attrs[j++] =
+ pac1944_all_attrs[PAC1944_COMMON_DEVATTR * ch + i];
+
+ switch (info->chip_reg_data.accumulation_mode[ch]) {
+ case PAC1944_ACCMODE_VPOWER:
+ tmp_attr = pac1944_power_acc_attr;
+ break;
+ case PAC1944_ACCMODE_VSENSE:
+ tmp_attr = pac1944_current_acc_attr;
+ break;
+ case PAC1944_ACCMODE_VBUS:
+ tmp_attr = pac1944_voltage_acc_attr;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ pac1944_custom_attrs[j++] = tmp_attr[ch];
+ pac1944_custom_attrs[j++] = pac1944_power_acc_attr[PAC1944_MAX_CH + ch];
+ pac1944_custom_attrs[j++] = pac1944_power_acc_attr[2 * PAC1944_MAX_CH + ch];
+ }
+
+ for (i = 0; i < PAC1944_SHARED_DEVATTRS_COUNT; i++)
+ pac1944_custom_attrs[j++] =
+ pac1944_all_attrs[PAC1944_COMMON_DEVATTR * PAC1944_MAX_CH + i];
+
+ pac1944_group->attrs = pac1944_custom_attrs;
+ info->iio_info.attrs = pac1944_group;
+
+ return 0;
+}
+
+static int pac1944_frequency_set(struct iio_dev *indio_dev,
+ const struct iio_chan_spec *chan,
+ unsigned int mode)
+{
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct i2c_client *client = info->client;
+ int ret;
+ u16 tmp_u16;
+ __be16 tmp_be16;
+
+ ret = i2c_smbus_read_i2c_block_data(client, PAC1944_CTRL_ACT_REG_ADDR,
+ sizeof(tmp_u16), (u8 *)&tmp_be16);
+ if (ret < 0) {
+ dev_err(&client->dev, "cannot read PAC1944 regs from 0x%02X\n",
+ PAC1944_CTRL_ACT_REG_ADDR);
+ return ret;
+ }
+
+ tmp_u16 = be16_to_cpu(tmp_be16);
+ tmp_u16 &= ~PAC1944_CTRL_SAMPLE_MASK;
+ tmp_u16 |= FIELD_PREP(PAC1944_CTRL_SAMPLE_MASK, mode);
+ tmp_be16 = cpu_to_be16(tmp_u16);
+
+ scoped_guard(mutex, &info->lock) {
+ ret = i2c_smbus_write_word_data(client, PAC1944_CTRL_REG_ADDR, tmp_be16);
+ if (ret < 0) {
+ dev_err(&client->dev, "Failed to configure sampling mode\n");
+ return ret;
+ }
+
+ info->sampling_mode = mode;
+ info->chip_reg_data.ctrl_act_reg = tmp_u16;
+ }
+
+ return pac1944_retrieve_data(info, PAC1944_MIN_UPDATE_WAIT_TIME_US);
+}
+
+static int pac1944_frequency_get(struct iio_dev *indio_dev,
+ const struct iio_chan_spec *chan)
+{
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+
+ return info->sampling_mode;
+}
+
+static const struct iio_enum sampling_mode_enum = {
+ .items = pac1944_frequency_avail,
+ .num_items = ARRAY_SIZE(pac1944_frequency_avail),
+ .set = pac1944_frequency_set,
+ .get = pac1944_frequency_get,
+};
+
+static const struct iio_chan_spec_ext_info pac1944_ext_info[] = {
+ IIO_ENUM("sampling_frequency", IIO_SHARED_BY_ALL, &sampling_mode_enum),
+ {
+ .name = "sampling_frequency_available",
+ .shared = IIO_SHARED_BY_ALL,
+ .read = iio_enum_available_read,
+ .private = (uintptr_t)&sampling_mode_enum,
+ },
+ { }
+};
+
+static int pac1944_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan,
+ int *val, int *val2, long mask)
+{
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ int ret, idx;
+ u64 tmp;
+
+ ret = pac1944_retrieve_data(info, PAC1944_MIN_UPDATE_WAIT_TIME_US);
+ if (ret < 0)
+ return ret;
+
+ /* into the datasheet channels are noted from 1 to 4 */
+ idx = chan->channel - 1;
+
+ /*
+ * For AVG the index should be between 5 to 8. To calculate
+ * PAC1944_CH_VOLTAGE_AVERAGE and PAC1944_CH_CURRENT_AVERAGE real index,
+ * we need to remove the added offset (PAC1944_MAX_CH).
+ */
+ if (idx >= PAC1944_MAX_CH)
+ idx = idx - PAC1944_MAX_CH;
+
+ switch (mask) {
+ case IIO_CHAN_INFO_RAW:
+ switch (chan->type) {
+ case IIO_VOLTAGE:
+ *val = info->chip_reg_data.vbus[idx];
+ return IIO_VAL_INT;
+ case IIO_CURRENT:
+ *val = info->chip_reg_data.vsense[idx];
+ return IIO_VAL_INT;
+ case IIO_POWER:
+ *val = info->chip_reg_data.vpower[idx];
+ return IIO_VAL_INT;
+ default:
+ return -EINVAL;
+ }
+ case IIO_CHAN_INFO_AVERAGE_RAW:
+ switch (chan->type) {
+ case IIO_VOLTAGE:
+ *val = info->chip_reg_data.vbus_avg[idx];
+ return IIO_VAL_INT;
+ case IIO_CURRENT:
+ *val = info->chip_reg_data.vsense_avg[idx];
+ return IIO_VAL_INT;
+ default:
+ return -EINVAL;
+ }
+ case IIO_CHAN_INFO_SCALE:
+ switch (chan->address) {
+ case PAC1944_VBUS_1_ADDR:
+ case PAC1944_VBUS_2_ADDR:
+ case PAC1944_VBUS_3_ADDR:
+ case PAC1944_VBUS_4_ADDR:
+ case PAC1944_VBUS_AVG_1_ADDR:
+ case PAC1944_VBUS_AVG_2_ADDR:
+ case PAC1944_VBUS_AVG_3_ADDR:
+ case PAC1944_VBUS_AVG_4_ADDR:
+ if (info->is_pac195x_family)
+ *val = PAC195X_VOLTAGE_MILLIVOLTS_MAX;
+ else
+ *val = PAC194X_VOLTAGE_MILLIVOLTS_MAX;
+
+ switch (info->chip_reg_data.vbus_mode[idx]) {
+ case PAC1944_UNIPOLAR_FSR_CFG:
+ case PAC1944_BIPOLAR_HALF_FSR_CFG:
+ *val2 = PAC1944_VOLTAGE_16B_RES;
+ break;
+ case PAC1944_BIPOLAR_FSR_CFG:
+ *val2 = PAC1944_VOLTAGE_15B_RES;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return IIO_VAL_FRACTIONAL_LOG2;
+ /*
+ * Currents - scale for mA - depends on the
+ * channel's shunt value
+ * (100mV * 1000000) / (2^16 * shunt(microOhm))
+ */
+ case PAC1944_VSENSE_1_ADDR:
+ case PAC1944_VSENSE_2_ADDR:
+ case PAC1944_VSENSE_3_ADDR:
+ case PAC1944_VSENSE_4_ADDR:
+ case PAC1944_VSENSE_AVG_1_ADDR:
+ case PAC1944_VSENSE_AVG_2_ADDR:
+ case PAC1944_VSENSE_AVG_3_ADDR:
+ case PAC1944_VSENSE_AVG_4_ADDR:
+ *val = PAC1944_MAX_VSENSE_RSHIFTED_BY_15B;
+ switch (info->chip_reg_data.vsense_mode[idx]) {
+ case PAC1944_UNIPOLAR_FSR_CFG:
+ case PAC1944_BIPOLAR_HALF_FSR_CFG:
+ *val = *val >> 1;
+ *val2 = info->shunts[idx];
+ break;
+ case PAC1944_BIPOLAR_FSR_CFG:
+ *val2 = info->shunts[idx];
+ break;
+ default:
+ return -EINVAL;
+ }
+ return IIO_VAL_FRACTIONAL;
+ /*
+ * Power - mW - it will use the combined scale
+ * for current and voltage
+ * current(mA) * voltage(mV) = power (uW)
+ */
+ case PAC1944_VPOWER_1_ADDR:
+ case PAC1944_VPOWER_2_ADDR:
+ case PAC1944_VPOWER_3_ADDR:
+ case PAC1944_VPOWER_4_ADDR:
+ if (info->is_pac195x_family)
+ tmp = PAC195X_PRODUCT_VOLTAGE_PV_FSR;
+ else
+ tmp = PAC194X_PRODUCT_VOLTAGE_PV_FSR;
+
+ do_div(tmp, info->shunts[idx]);
+ *val = (int)tmp;
+ if ((info->chip_reg_data.vbus_mode[idx] == PAC1944_UNIPOLAR_FSR_CFG &&
+ info->chip_reg_data.vsense_mode[idx] == PAC1944_UNIPOLAR_FSR_CFG) ||
+ info->chip_reg_data.vbus_mode[idx] == PAC1944_BIPOLAR_HALF_FSR_CFG ||
+ info->chip_reg_data.vsense_mode[idx] == PAC1944_BIPOLAR_HALF_FSR_CFG)
+ *val2 = PAC1944_POWER_30B_RES;
+ else
+ *val2 = PAC1944_POWER_29B_RES;
+
+ return IIO_VAL_FRACTIONAL_LOG2;
+ }
+ }
+
+ return -EINVAL;
+}
+
+static int pac1944_read_label(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan, char *label)
+{
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ int idx;
+
+ /* into the datasheet channels are noted from 1 to 4 */
+ idx = chan->channel - 1;
+
+ /*
+ * For AVG the index should be between 5 to 8.
+ * To calculate PAC1944_CH_VOLTAGE_AVERAGE and
+ * PAC1944_CH_CURRENT_AVERAGE real index, we need
+ * to remove the added offset (PAC1944_MAX_CH).
+ */
+ if (idx >= PAC1944_MAX_CH)
+ idx = idx - PAC1944_MAX_CH;
+
+ switch (chan->address) {
+ case PAC1944_VBUS_1_ADDR:
+ case PAC1944_VBUS_2_ADDR:
+ case PAC1944_VBUS_3_ADDR:
+ case PAC1944_VBUS_4_ADDR:
+ if (info->labels[idx])
+ return sysfs_emit(label, "%s_VBUS_%d\n", info->labels[idx], idx + 1);
+ else
+ return sysfs_emit(label, "VBUS_%d\n", idx + 1);
+ case PAC1944_VBUS_AVG_1_ADDR:
+ case PAC1944_VBUS_AVG_2_ADDR:
+ case PAC1944_VBUS_AVG_3_ADDR:
+ case PAC1944_VBUS_AVG_4_ADDR:
+ if (info->labels[idx])
+ return sysfs_emit(label, "%s_VBUS_AVG_%d\n", info->labels[idx], idx + 1);
+ else
+ return sysfs_emit(label, "VBUS_AVG_%d\n", idx + 1);
+ case PAC1944_VSENSE_1_ADDR:
+ case PAC1944_VSENSE_2_ADDR:
+ case PAC1944_VSENSE_3_ADDR:
+ case PAC1944_VSENSE_4_ADDR:
+ if (info->labels[idx])
+ return sysfs_emit(label, "%s_IBUS_%d\n", info->labels[idx], idx + 1);
+ else
+ return sysfs_emit(label, "IBUS_%d\n", idx + 1);
+ case PAC1944_VSENSE_AVG_1_ADDR:
+ case PAC1944_VSENSE_AVG_2_ADDR:
+ case PAC1944_VSENSE_AVG_3_ADDR:
+ case PAC1944_VSENSE_AVG_4_ADDR:
+ if (info->labels[idx])
+ return sysfs_emit(label, "%s_IBUS_AVG_%d\n", info->labels[idx], idx + 1);
+ else
+ return sysfs_emit(label, "IBUS_AVG_%d\n", idx + 1);
+ case PAC1944_VPOWER_1_ADDR:
+ case PAC1944_VPOWER_2_ADDR:
+ case PAC1944_VPOWER_3_ADDR:
+ case PAC1944_VPOWER_4_ADDR:
+ if (info->labels[idx])
+ return sysfs_emit(label, "%s_POWER_%d\n", info->labels[idx], idx + 1);
+ else
+ return sysfs_emit(label, "POWER_%d\n", idx + 1);
+ }
+
+ return 0;
+}
+
+static int pac1944_read_thresh(struct iio_dev *indio_dev,
+ const struct iio_chan_spec *chan, enum iio_event_type type,
+ enum iio_event_direction dir, enum iio_event_info info,
+ int *val, int *val2)
+{
+ struct pac1944_chip_info *chip_info = iio_priv(indio_dev);
+ int idx;
+
+ /* into the datasheet channels are noted from 1 to 4 */
+ idx = chan->channel - 1;
+
+ guard(mutex)(&chip_info->lock);
+
+ switch (chan->type) {
+ case IIO_VOLTAGE:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ *val = chip_info->overvoltage[idx];
+ return IIO_VAL_INT;
+ case IIO_EV_DIR_FALLING:
+ *val = chip_info->undervoltage[idx];
+ return IIO_VAL_INT;
+ default:
+ return -EINVAL;
+ }
+ case IIO_CURRENT:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ *val = chip_info->overcurrent[idx];
+ return IIO_VAL_INT;
+ case IIO_EV_DIR_FALLING:
+ *val = chip_info->undercurrent[idx];
+ return IIO_VAL_INT;
+ default:
+ return -EINVAL;
+ }
+ case IIO_POWER:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ *val = chip_info->overpower[idx];
+ return IIO_VAL_INT;
+ default:
+ return -EINVAL;
+ }
+ default:
+ return -EINVAL;
+ }
+}
+
+static int pac1944_write_thresh(struct iio_dev *indio_dev,
+ const struct iio_chan_spec *chan, enum iio_event_type type,
+ enum iio_event_direction dir, enum iio_event_info info,
+ int val, int val2)
+{
+ struct pac1944_chip_info *chip_info = iio_priv(indio_dev);
+ int idx, ret;
+
+ /* into the datasheet channels are noted from 1 to 4 */
+ idx = chan->channel - 1;
+
+ guard(mutex)(&chip_info->lock);
+
+ switch (chan->type) {
+ case IIO_VOLTAGE:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ ret = pac1944_update_alert_16b(&indio_dev->dev,
+ PAC1944_OV_LIMIT_REG_ADDR + idx,
+ pac1944_overvoltage_mask_tbl[idx], val);
+ if (ret)
+ return ret;
+
+ chip_info->overvoltage[idx] = val;
+ return 0;
+ case IIO_EV_DIR_FALLING:
+ ret = pac1944_update_alert_16b(&indio_dev->dev,
+ PAC1944_UV_LIMIT_REG_ADDR + idx,
+ pac1944_undervoltage_mask_tbl[idx], val);
+ if (ret)
+ return ret;
+
+ chip_info->undervoltage[idx] = val;
+ return 0;
+ default:
+ return -EINVAL;
+ }
+ case IIO_CURRENT:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ ret = pac1944_update_alert_16b(&indio_dev->dev,
+ PAC1944_OC_LIMIT_REG_ADDR + idx,
+ pac1944_overcurrent_mask_tbl[idx], val);
+ if (ret)
+ return ret;
+
+ chip_info->overcurrent[idx] = val;
+ return ret;
+ case IIO_EV_DIR_FALLING:
+ ret = pac1944_update_alert_16b(&indio_dev->dev,
+ PAC1944_UC_LIMIT_REG_ADDR + idx,
+ pac1944_undercurrent_mask_tbl[idx], val);
+ if (ret)
+ return ret;
+
+ chip_info->undercurrent[idx] = val;
+ return 0;
+ default:
+ return -EINVAL;
+ }
+ case IIO_POWER:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ ret = pac1944_update_alert_24b(&indio_dev->dev,
+ PAC1944_OP_LIMIT_REG_ADDR + idx,
+ pac1944_overpower_mask_tbl[idx],
+ val);
+ if (ret)
+ return ret;
+
+ chip_info->overpower[idx] = val;
+ return 0;
+ default:
+ return -EINVAL;
+ }
+ default:
+ return -EINVAL;
+ }
+}
+
+static int pac1944_read_event_config(struct iio_dev *indio_dev,
+ const struct iio_chan_spec *chan,
+ enum iio_event_type type,
+ enum iio_event_direction dir)
+{
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ int idx;
+ u32 tmp;
+
+ /* into the datasheet channels are noted from 1 to 4 */
+ idx = chan->channel - 1;
+
+ scoped_guard(mutex, &info->lock) {
+ switch (chan->type) {
+ case IIO_VOLTAGE:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ tmp = FIELD_GET(PAC1944_OV_MASK, info->alert_enable);
+ break;
+ case IIO_EV_DIR_FALLING:
+ tmp = FIELD_GET(PAC1944_UV_MASK, info->alert_enable);
+ break;
+ default:
+ return -EINVAL;
+ }
+ return -EINVAL;
+ case IIO_CURRENT:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ tmp = FIELD_GET(PAC1944_OC_MASK, info->alert_enable);
+ break;
+ case IIO_EV_DIR_FALLING:
+ tmp = FIELD_GET(PAC1944_UC_MASK, info->alert_enable);
+ break;
+ default:
+ return -EINVAL;
+ }
+ return -EINVAL;
+ case IIO_POWER:
+ if (dir == IIO_EV_DIR_RISING)
+ tmp = FIELD_GET(PAC1944_OP_MASK, info->alert_enable);
+ else
+ return -EINVAL;
+ break;
+ default:
+ return -EINVAL;
+ }
+ }
+
+ tmp = tmp >> (3 - idx);
+
+ return tmp & 0x01;
+}
+
+static int pac1944_write_event_config(struct iio_dev *indio_dev,
+ const struct iio_chan_spec *chan,
+ enum iio_event_type type,
+ enum iio_event_direction dir,
+ bool state)
+{
+ struct pac1944_chip_info *info = iio_priv(indio_dev);
+ struct i2c_client *client = info->client;
+ int idx, val, mask, ret;
+ bool update = false;
+ u8 tmp[PAC1944_ALERT_ENABLE_REG_LEN];
+
+ /* into the datasheet channels are noted from 1 to 4 */
+ idx = chan->channel - 1;
+
+ switch (chan->type) {
+ case IIO_VOLTAGE:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ mask = pac1944_overvoltage_mask_tbl[idx];
+ break;
+ case IIO_EV_DIR_FALLING:
+ mask = pac1944_undervoltage_mask_tbl[idx];
+ break;
+ default:
+ return -EINVAL;
+ }
+ break;
+ case IIO_CURRENT:
+ switch (dir) {
+ case IIO_EV_DIR_RISING:
+ mask = pac1944_overcurrent_mask_tbl[idx];
+ break;
+ case IIO_EV_DIR_FALLING:
+ mask = pac1944_undercurrent_mask_tbl[idx];
+ break;
+ default:
+ return -EINVAL;
+ }
+ break;
+ case IIO_POWER:
+ if (dir != IIO_EV_DIR_RISING)
+ return -EINVAL;
+
+ mask = pac1944_overpower_mask_tbl[idx];
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ guard(mutex)(&info->lock);
+
+ val = info->alert_enable & mask;
+ if (state && !val) {
+ /* enable the event in hardware */
+ info->alert_enable |= mask;
+ update = true;
+ } else if (!state && val) {
+ /* disable the event in hardware */
+ info->alert_enable &= ~mask;
+ update = true;
+ }
+
+ /* do not update if not needed */
+ if (update) {
+ put_unaligned_be24(info->alert_enable, &tmp[0]);
+
+ /* update the Alert enable register */
+ ret = pac1944_restore_alert_reg(indio_dev, &tmp[0]);
+ if (ret) {
+ dev_err(&client->dev, "failing to restore alert reg\n");
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static void pac1944_work_periodic_rfsh(struct work_struct *work)
+{
+ struct pac1944_chip_info *info = to_pac1944_chip_info(to_delayed_work(work));
+ struct i2c_client *client = info->client;
+
+ dev_dbg(&client->dev, "Periodic refresh\n");
+
+ pac1944_reg_snapshot(info, true, PAC1944_REFRESH_REG_ADDR,
+ PAC1944_MIN_UPDATE_WAIT_TIME_US);
+
+ schedule_delayed_work(&info->work_chip_rfsh,
+ msecs_to_jiffies(PAC1944_MAX_RFSH_LIMIT_MS));
+}
+
+/*
+ * Universal Unique Identifier (UUID),
+ * 721F1534-5D27-4B60-9DF4-41A3C4B7DA3A,
+ * is reserved to Microchip for the PAC194x and PAC195x.
+ */
+#define PAC1944_DSM_UUID "721F1534-5D27-4B60-9DF4-41A3C4B7DA3A"
+
+/*
+ * documentation related to the ACPI device definition
+ * https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/UserGuides/PAC194X_5X-UEFI-BIOS-Integration-and-Microsoft-Windows-10-and-Windows-11-Energy-Meter-Interface-Device-Driver-Users-Guide-DS50003155.pdf
+ */
+static int pac1944_acpi_parse_channel_config(struct i2c_client *client,
+ struct pac1944_chip_info *info)
+{
+ acpi_handle handle;
+ union acpi_object *rez;
+ struct device *dev = &client->dev;
+ unsigned short bi_dir_mask;
+ int i;
+ guid_t guid;
+ const struct acpi_device_id *id;
+
+ handle = ACPI_HANDLE(dev);
+
+ id = acpi_match_device(dev->driver->acpi_match_table, dev);
+ if (!id)
+ return -ENODEV;
+
+ guid_parse(PAC1944_DSM_UUID, &guid);
+
+ rez = acpi_evaluate_dsm(handle, &guid, 0, PAC1944_ACPI_GET_NAMES, NULL);
+ if (!rez)
+ return -EINVAL;
+
+ for (i = 0; i < rez->package.count; i++) {
+ info->labels[i] = devm_kmemdup(dev, rez->package.elements[i].string.pointer,
+ (size_t)rez->package.elements[i].string.length + 1,
+ GFP_KERNEL);
+ info->labels[i][rez->package.elements[i].string.length] = '\0';
+ }
+
+ ACPI_FREE(rez);
+
+ rez = acpi_evaluate_dsm(handle, &guid, 1, PAC1944_ACPI_GET_UOHMS_VALS, NULL);
+ if (!rez)
+ return -EINVAL;
+
+ for (i = 0; i < rez->package.count; i++) {
+ info->shunts[i] = rez->package.elements[i].integer.value;
+ if (info->shunts[i])
+ set_bit(i, &info->active_channels_mask);
+ }
+
+ ACPI_FREE(rez);
+
+ rez = acpi_evaluate_dsm(handle, &guid, 1, PAC1944_ACPI_GET_BIPOLAR_SETTINGS, NULL);
+ if (!rez)
+ return -EINVAL;
+
+ for_each_set_bit(i, &info->active_channels_mask, info->phys_channels) {
+ bi_dir_mask = rez->package.elements[i].integer.value;
+
+ if (bi_dir_mask == PAC1944_UNIPOLAR_FSR_CFG ||
+ bi_dir_mask == PAC1944_BIPOLAR_FSR_CFG ||
+ bi_dir_mask == PAC1944_BIPOLAR_HALF_FSR_CFG) {
+ dev_dbg(dev, "VBUS{%d} mode set to: %d\n", i, bi_dir_mask);
+ info->chip_reg_data.vbus_mode[i] = bi_dir_mask;
+ } else {
+ return dev_err_probe(dev, -EINVAL, "invalid vbus-mode value on %i\n", i);
+ }
+
+ bi_dir_mask = rez->package.elements[i + PAC1944_MAX_CH].integer.value;
+
+ if (bi_dir_mask == PAC1944_UNIPOLAR_FSR_CFG ||
+ bi_dir_mask == PAC1944_BIPOLAR_FSR_CFG ||
+ bi_dir_mask == PAC1944_BIPOLAR_HALF_FSR_CFG) {
+ dev_dbg(dev, "VSENSE{%d} mode set to: %d\n", i, bi_dir_mask);
+ info->chip_reg_data.vsense_mode[i] = bi_dir_mask;
+ } else {
+ return dev_err_probe(dev, -EINVAL, "invalid vsense-mode value on %i\n", i);
+ }
+ }
+
+ ACPI_FREE(rez);
+
+ rez = acpi_evaluate_dsm(handle, &guid, 1, PAC1944_ACPI_GET_SAMP, NULL);
+ if (!rez)
+ return -EINVAL;
+
+ info->sample_rate_value = rez->package.elements[0].integer.value;
+
+ ACPI_FREE(rez);
+
+ return 0;
+}
+
+static int pac1944_of_parse_channel_config(struct i2c_client *client,
+ struct pac1944_chip_info *info)
+{
+ unsigned int current_channel;
+ struct device *dev = &client->dev;
+ int idx, ret, temp;
+ bool is_bipolar, is_half_fsr;
+
+ current_channel = 1;
+
+ device_for_each_child_node_scoped(dev, child) {
+ ret = fwnode_property_read_u32(child, "reg", &idx);
+ if (ret)
+ return dev_err_probe(dev, ret, "reading invalid channel index\n");
+
+ /* adjust idx to match channel index (1 to 4) from the datasheet */
+ idx--;
+
+ if (current_channel >= (info->phys_channels + 1) ||
+ idx >= info->phys_channels || idx < 0)
+ return dev_err_probe(dev, -EINVAL, "invalid channel index %d value\n",
+ idx + 1);
+
+ /* enable channel */
+ set_bit(idx, &info->active_channels_mask);
+
+ ret = fwnode_property_read_u32(child, "shunt-resistor-micro-ohms",
+ &info->shunts[idx]);
+ if (ret)
+ return dev_err_probe(dev, ret, "%s: invalid shunt-resistor value: %d\n",
+ fwnode_get_name(child), info->shunts[idx]);
+
+ if (fwnode_property_present(child, "label"))
+ fwnode_property_read_string(child, "label",
+ (const char **)&info->labels[idx]);
+
+ is_bipolar = false;
+ if (fwnode_property_present(child, "microchip,vbus-bipolar"))
+ is_bipolar = true;
+
+ is_half_fsr = false;
+ if (fwnode_property_present(child, "microchip,vbus-half-range"))
+ is_half_fsr = true;
+
+ /* default value is unipolar and Full Scale Range */
+ info->chip_reg_data.vbus_mode[idx] = PAC1944_UNIPOLAR_FSR_CFG;
+ if (is_half_fsr)
+ info->chip_reg_data.vbus_mode[idx] = PAC1944_BIPOLAR_HALF_FSR_CFG;
+ else if (is_bipolar)
+ info->chip_reg_data.vbus_mode[idx] = PAC1944_BIPOLAR_FSR_CFG;
+
+ is_bipolar = false;
+ if (fwnode_property_present(child, "microchip,vsense-bipolar"))
+ is_bipolar = true;
+
+ is_half_fsr = false;
+ if (fwnode_property_present(child, "microchip,vsense-half-range"))
+ is_half_fsr = true;
+
+ /* default value is unipolar and Full Scale Range */
+ info->chip_reg_data.vsense_mode[idx] = PAC1944_UNIPOLAR_FSR_CFG;
+ if (is_half_fsr)
+ info->chip_reg_data.vsense_mode[idx] = PAC1944_BIPOLAR_HALF_FSR_CFG;
+ else if (is_bipolar)
+ info->chip_reg_data.vsense_mode[idx] = PAC1944_BIPOLAR_FSR_CFG;
+
+ ret = fwnode_property_read_u32(child, "microchip,accumulation-mode", &temp);
+ if (ret)
+ return dev_err_probe(dev, ret, "invalid accumulation-mode value on %s\n",
+ fwnode_get_name(child));
+ if (temp == PAC1944_ACCMODE_VPOWER ||
+ temp == PAC1944_ACCMODE_VSENSE ||
+ temp == PAC1944_ACCMODE_VBUS) {
+ dev_dbg(dev, "Accumulation{%d} mode set to: %d\n", idx, temp);
+ info->chip_reg_data.accumulation_mode[idx] = temp;
+ } else {
+ return dev_err_probe(dev, -EINVAL,
+ "invalid mode for accumulator value on %s\n",
+ fwnode_get_name(child));
+ }
+ current_channel++;
+ }
+
+ return 0;
+}
+
+static void pac1944_cancel_delayed_work(void *dwork)
+{
+ cancel_delayed_work_sync(dwork);
+}
+
+static int pac1944_chip_identify(struct pac1944_chip_info *info)
+{
+ int ret = 0;
+ struct i2c_client *client = info->client;
+ u8 chip_rev_info[3];
+
+ ret = i2c_smbus_read_i2c_block_data(client, PAC1944_PID_REG_ADDR,
+ sizeof(chip_rev_info),
+ chip_rev_info);
+ if (ret < 0)
+ return dev_err_probe(&client->dev, ret, "cannot read revision\n");
+
+ dev_info(&client->dev, "Chip revision: 0x%02X\n", chip_rev_info[2]);
+ info->chip_revision = chip_rev_info[2];
+ info->chip_variant = chip_rev_info[0];
+
+ switch (chip_rev_info[0]) {
+ case PAC_PRODUCT_ID_1941:
+ case PAC_PRODUCT_ID_1942:
+ case PAC_PRODUCT_ID_1943:
+ case PAC_PRODUCT_ID_1944:
+ case PAC_PRODUCT_ID_1941_2:
+ case PAC_PRODUCT_ID_1942_2:
+ info->is_pac195x_family = false;
+ return chip_rev_info[0] - PAC_PRODUCT_ID_1941;
+ case PAC_PRODUCT_ID_1951:
+ case PAC_PRODUCT_ID_1952:
+ case PAC_PRODUCT_ID_1953:
+ case PAC_PRODUCT_ID_1954:
+ case PAC_PRODUCT_ID_1951_2:
+ case PAC_PRODUCT_ID_1952_2:
+ info->is_pac195x_family = true;
+ return (chip_rev_info[0] - PAC_PRODUCT_ID_1951) +
+ (PAC_PRODUCT_ID_1942_2 - PAC_PRODUCT_ID_1941) + 1;
+ default:
+ dev_err(&client->dev,
+ "product ID (0x%02X, 0x%02X, 0x%02X) for this part doesn't match\n",
+ chip_rev_info[0], chip_rev_info[1], chip_rev_info[2]);
+ return -EINVAL;
+ }
+}
+
+static int pac1944_chip_configure(struct pac1944_chip_info *info)
+{
+ int cnt, ret;
+ struct i2c_client *client = info->client;
+ u8 regs[PAC1944_ALERTS_REG_LEN];
+ u8 *offset_p;
+ u32 wait_time;
+ u8 tmp_u8;
+ __be16 tmp_be16;
+ u16 cfg;
+
+ /*
+ * Counting how many channels are enabled and store
+ * this information within the driver data
+ */
+ info->num_enabled_channels = hweight_long(info->active_channels_mask);
+
+ /* get sampling rate from PAC */
+ ret = i2c_smbus_read_i2c_block_data(client, PAC1944_CTRL_REG_ADDR,
+ sizeof(tmp_be16), (u8 *)&tmp_be16);
+ if (ret < 0)
+ return dev_err_probe(&client->dev, ret, "cannot read CTRL reg\n");
+
+ info->sampling_mode = FIELD_GET(PAC1944_CTRL_SAMPLE_MASK, be16_to_cpu(tmp_be16));
+
+ /*
+ * The current/voltage can be measured unidirectional, bidirectional or half FSR
+ * no SLOW triggered REFRESH, clear POR
+ */
+ cfg = FIELD_PREP(PAC1944_NEG_PWR_CFG_VS1_MASK, info->chip_reg_data.vsense_mode[0]) |
+ FIELD_PREP(PAC1944_NEG_PWR_CFG_VS2_MASK, info->chip_reg_data.vsense_mode[1]) |
+ FIELD_PREP(PAC1944_NEG_PWR_CFG_VS3_MASK, info->chip_reg_data.vsense_mode[2]) |
+ FIELD_PREP(PAC1944_NEG_PWR_CFG_VS4_MASK, info->chip_reg_data.vsense_mode[3]) |
+ FIELD_PREP(PAC1944_NEG_PWR_CFG_VB1_MASK, info->chip_reg_data.vbus_mode[0]) |
+ FIELD_PREP(PAC1944_NEG_PWR_CFG_VB2_MASK, info->chip_reg_data.vbus_mode[1]) |
+ FIELD_PREP(PAC1944_NEG_PWR_CFG_VB3_MASK, info->chip_reg_data.vbus_mode[2]) |
+ FIELD_PREP(PAC1944_NEG_PWR_CFG_VB4_MASK, info->chip_reg_data.vbus_mode[3]);
+
+ ret = i2c_smbus_write_word_data(client, PAC1944_NEG_PWR_FSR_REG_ADDR, cpu_to_be16(cfg));
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "cannot write NEG_PWR_FSR reg\n");
+
+ ret = i2c_smbus_write_word_data(client, PAC1944_SLOW_REG_ADDR, 0);
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "cannot write SLOW reg\n");
+
+ /* Write the CHANNEL_N_OFF from CTRL REGISTER */
+ cfg = FIELD_PREP(PAC1944_CTRL_SAMPLE_MASK, info->sampling_mode) |
+ FIELD_PREP(PAC1944_CTRL_GPIO_ALERT2_MASK, 0) |
+ FIELD_PREP(PAC1944_CTRL_SLOW_ALERT1_MASK, 0) |
+ FIELD_PREP(PAC1944_CTRL_CH_1_OFF_MASK, !test_bit(0, &info->active_channels_mask)) |
+ FIELD_PREP(PAC1944_CTRL_CH_2_OFF_MASK, !test_bit(1, &info->active_channels_mask)) |
+ FIELD_PREP(PAC1944_CTRL_CH_3_OFF_MASK, !test_bit(2, &info->active_channels_mask)) |
+ FIELD_PREP(PAC1944_CTRL_CH_4_OFF_MASK, !test_bit(3, &info->active_channels_mask));
+
+ ret = i2c_smbus_write_word_data(client, PAC1944_CTRL_REG_ADDR, cpu_to_be16(cfg));
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "cannot write CTRL reg\n");
+
+ tmp_u8 = ACCUM_REG(info->chip_reg_data.accumulation_mode[0],
+ info->chip_reg_data.accumulation_mode[1],
+ info->chip_reg_data.accumulation_mode[2],
+ info->chip_reg_data.accumulation_mode[3]);
+
+ ret = i2c_smbus_write_byte_data(client, PAC1944_ACCUM_CFG_REG_ADDR, tmp_u8);
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "cannot write ACCUM_CFG reg\n");
+
+ /* reading all alerts, status and limits related registers */
+ ret = pac1944_i2c_read(client, PAC1944_ALERT_STATUS_REG_ADDR, regs, sizeof(regs));
+ if (ret < 0)
+ return dev_err_probe(&client->dev, ret, "cannot read ALERT_STATUS reg\n");
+
+ offset_p = &regs[0];
+
+ /* skip alert_status register*/
+ offset_p += 3;
+
+ info->slow_alert1 = get_unaligned_be24(offset_p);
+ offset_p += 3;
+
+ info->gpio_alert2 = get_unaligned_be24(offset_p);
+ offset_p += 3;
+
+ info->acc_fullness = get_unaligned_be16(offset_p);
+ offset_p += 2;
+
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++) {
+ info->overcurrent[cnt] = get_unaligned_be16(offset_p);
+ offset_p += 2;
+ }
+
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++) {
+ info->undercurrent[cnt] = get_unaligned_be16(offset_p);
+ offset_p += 2;
+ }
+
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++) {
+ info->overpower[cnt] = get_unaligned_be24(offset_p);
+ offset_p += 3;
+ }
+
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++) {
+ info->overvoltage[cnt] = get_unaligned_be16(offset_p);
+ offset_p += 2;
+ }
+
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++) {
+ info->undervoltage[cnt] = get_unaligned_be16(offset_p);
+ offset_p += 2;
+ }
+
+ offset_p += 1;
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++)
+ info->oc_limit_nsamples[cnt] = (*offset_p >> (2 * cnt)) & 0x03;
+
+ offset_p += 1;
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++)
+ info->uc_limit_nsamples[cnt] = (*offset_p >> (2 * cnt)) & 0x03;
+
+ offset_p += 1;
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++)
+ info->op_limit_nsamples[cnt] = (*offset_p >> (2 * cnt)) & 0x03;
+
+ offset_p += 1;
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++)
+ info->ov_limit_nsamples[cnt] = (*offset_p >> (2 * cnt)) & 0x03;
+
+ offset_p += 1;
+ for (cnt = 0; cnt < PAC1944_MAX_CH; cnt++)
+ info->uv_limit_nsamples[cnt] = (*offset_p >> (2 * cnt)) & 0x03;
+
+ offset_p += 1;
+ info->alert_enable = get_unaligned_be24(offset_p);
+
+ /*
+ * Sending a REFRESH to the chip, so the new settings take place
+ * as well as resetting the accumulators
+ */
+ ret = i2c_smbus_write_byte(client, PAC1944_REFRESH_REG_ADDR);
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "cannot write REFRESH reg\n");
+
+ /*
+ * Get the current (in the chip) sampling speed and compute the
+ * required timeout based on its value the timeout is 1/sampling_speed
+ * wait the maximum amount of time to be on the safe side - the
+ * maximum wait time is for 8sps
+ */
+ wait_time = (1024 / pac1944_samp_rate_map_tbl[info->sampling_mode]) * 1000;
+ usleep_range(wait_time, wait_time + 100);
+
+ INIT_DELAYED_WORK(&info->work_chip_rfsh, pac1944_work_periodic_rfsh);
+ /* Setup the latest moment for reading the regs before saturation */
+ schedule_delayed_work(&info->work_chip_rfsh,
+ msecs_to_jiffies(PAC1944_MAX_RFSH_LIMIT_MS));
+
+ return devm_add_action_or_reset(&client->dev, pac1944_cancel_delayed_work,
+ &info->work_chip_rfsh);
+}
+
+static const struct iio_chan_spec pac1944_single_channel[] = {
+ PAC1944_VPOWER_CHANNEL(0, PAC1944_VPOWER_1_ADDR, pac1944_single_event,
+ ARRAY_SIZE(pac1944_single_event)),
+ PAC1944_VBUS_CHANNEL(0, PAC1944_VBUS_1_ADDR, pac1944_events,
+ ARRAY_SIZE(pac1944_events)),
+ PAC1944_VSENSE_CHANNEL(0, PAC1944_VSENSE_1_ADDR, pac1944_events,
+ ARRAY_SIZE(pac1944_events)),
+ PAC1944_VBUS_AVG_CHANNEL(0, PAC1944_VBUS_AVG_1_ADDR),
+ PAC1944_VSENSE_AVG_CHANNEL(0, PAC1944_VSENSE_AVG_1_ADDR),
+};
+
+static int pac1944_prep_iio_channels(struct pac1944_chip_info *info,
+ struct iio_dev *indio_dev)
+{
+ struct device *dev = &info->client->dev;
+ struct iio_chan_spec *ch_sp;
+ int channel_size, attribute_count, cnt;
+
+ /* Finding out dynamically how many IIO channels we need */
+ attribute_count = 0;
+ channel_size = 0;
+
+ for_each_set_bit(cnt, &info->active_channels_mask, info->phys_channels) {
+ /* add the size of the properties of one chip physical channel */
+ channel_size += sizeof(pac1944_single_channel);
+ /* count how many enabled channels we have */
+ attribute_count += ARRAY_SIZE(pac1944_single_channel);
+ dev_dbg(dev, ":%s: Channel %d active\n", __func__, cnt + 1);
+ }
+
+ ch_sp = devm_kzalloc(dev, channel_size, GFP_KERNEL);
+ if (!ch_sp)
+ return -ENOMEM;
+
+ /*
+ * Send the updated dynamic channel structure information towards IIO
+ * prepare the required field for IIO class registration
+ */
+ indio_dev->num_channels = attribute_count;
+ indio_dev->channels = ch_sp;
+
+ /* Populate the dynamic channels and make all the adjustments */
+ for_each_set_bit(cnt, &info->active_channels_mask, info->phys_channels) {
+ memcpy(ch_sp, pac1944_single_channel, sizeof(pac1944_single_channel));
+ /*
+ * Into the datasheet channels are noted from 1 to 4 so we will adjust
+ * the channel to match channel index (1 to 4) from the datasheet
+ */
+ ch_sp[PAC1944_CH_POWER].channel = cnt + 1;
+ ch_sp[PAC1944_CH_POWER].address = cnt + PAC1944_VPOWER_1_ADDR;
+ ch_sp[PAC1944_CH_VOLTAGE].channel = cnt + 1;
+ ch_sp[PAC1944_CH_VOLTAGE].address = cnt + PAC1944_VBUS_1_ADDR;
+ ch_sp[PAC1944_CH_CURRENT].channel = cnt + 1;
+ ch_sp[PAC1944_CH_CURRENT].address = cnt + PAC1944_VSENSE_1_ADDR;
+ /*
+ * In order to be able to use labels for PAC1944_CH_VOLTAGE and
+ * PAC1944_CH_VOLTAGE_AVERAGE, respectively PAC1944_CH_CURRENT
+ * and PAC1944_CH_CURRENT_AVERAGE we need to use different channel numbers.
+ * We will add +5 (+1 to maximum PAC channels).
+ */
+ ch_sp[PAC1944_CH_VOLTAGE_AVERAGE].channel = cnt + PAC1944_MAX_CH + 1;
+ ch_sp[PAC1944_CH_VOLTAGE_AVERAGE].address = cnt + PAC1944_VBUS_AVG_1_ADDR;
+ ch_sp[PAC1944_CH_CURRENT_AVERAGE].channel = cnt + PAC1944_MAX_CH + 1;
+ ch_sp[PAC1944_CH_CURRENT_AVERAGE].address = cnt + PAC1944_VSENSE_AVG_1_ADDR;
+
+ /* advance the pointer */
+ ch_sp += ARRAY_SIZE(pac1944_single_channel);
+ }
+
+ return 0;
+}
+
+static const struct iio_info pac1944_info = {
+ .read_raw = pac1944_read_raw,
+ .read_label = pac1944_read_label,
+ .read_event_value = pac1944_read_thresh,
+ .write_event_value = pac1944_write_thresh,
+ .read_event_config = pac1944_read_event_config,
+ .write_event_config = pac1944_write_event_config,
+};
+
+static int pac1944_probe(struct i2c_client *client)
+{
+ struct pac1944_chip_info *info;
+ struct iio_dev *indio_dev;
+ const struct pac1944_features *chip;
+ int cnt, ret;
+ struct device *dev = &client->dev;
+
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*info));
+ if (!indio_dev)
+ return -ENOMEM;
+
+ info = iio_priv(indio_dev);
+ info->client = client;
+
+ ret = pac1944_chip_identify(info);
+ if (ret < 0) {
+ dev_dbg(dev, "Failed to identify the device based on HW ID\n");
+ /*
+ * If failed to identify the hardware based on internal registers,
+ * try using fallback compatible in device tree to deal with
+ * some newer part number.
+ */
+ chip = i2c_get_match_data(client);
+ if (!chip)
+ return -EINVAL;
+
+ info->chip_variant = chip->prod_id;
+ info->phys_channels = chip->phys_channels;
+ indio_dev->name = chip->name;
+ } else {
+ info->phys_channels = pac1944_chip_config[ret].phys_channels;
+ indio_dev->name = pac1944_chip_config[ret].name;
+ }
+
+ for (cnt = 0; cnt < info->phys_channels; cnt++) {
+ /* always start with accumulation channels enabled */
+ info->enable_acc[cnt] = true;
+ }
+
+ if (ACPI_HANDLE(dev))
+ ret = pac1944_acpi_parse_channel_config(client, info);
+ else
+ ret = pac1944_of_parse_channel_config(client, info);
+
+ if (ret)
+ return dev_err_probe(dev, ret, "parameter parsing returned an error\n");
+
+ ret = devm_mutex_init(dev, &info->lock);
+ if (ret < 0)
+ return ret;
+
+ ret = pac1944_chip_configure(info);
+ if (ret < 0)
+ return ret;
+
+ ret = pac1944_prep_iio_channels(info, indio_dev);
+ if (ret < 0)
+ return ret;
+
+ info->iio_info = pac1944_info;
+ indio_dev->info = &info->iio_info;
+ indio_dev->modes = INDIO_DIRECT_MODE;
+
+ ret = pac1944_prep_custom_attributes(info, indio_dev);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Can't configure custom attributes for device\n");
+
+ ret = pac1944_reg_snapshot(info, true, false,
+ PAC1944_MIN_UPDATE_WAIT_TIME_US);
+ if (ret < 0)
+ return ret;
+
+ ret = devm_iio_device_register(dev, indio_dev);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Can't register IIO device\n");
+
+ return 0;
+}
+
+static const struct i2c_device_id pac1944_id[] = {
+ { .name = "pac1941", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1941] },
+ { .name = "pac19412", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1941_2] },
+ { .name = "pac1942", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1942] },
+ { .name = "pac19422", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1942_2] },
+ { .name = "pac1943", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1943] },
+ { .name = "pac1944", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1944] },
+ { .name = "pac1951", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1951] },
+ { .name = "pac19512", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1951_2] },
+ { .name = "pac1952", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1952] },
+ { .name = "pac19522", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1952_2] },
+ { .name = "pac1953", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1953] },
+ { .name = "pac1954", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1954] },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, pac1944_id);
+
+static const struct of_device_id pac1944_of_match[] = {
+ {
+ .compatible = "microchip,pac1941",
+ .data = (void *)&pac1944_chip_config[PAC1941]
+ },
+ {
+ .compatible = "microchip,pac19412",
+ .data = (void *)&pac1944_chip_config[PAC1941_2]
+ },
+ {
+ .compatible = "microchip,pac1942",
+ .data = (void *)&pac1944_chip_config[PAC1942]
+ },
+ {
+ .compatible = "microchip,pac19422",
+ .data = (void *)&pac1944_chip_config[PAC1942_2]
+ },
+ {
+ .compatible = "microchip,pac1943",
+ .data = (void *)&pac1944_chip_config[PAC1943]
+ },
+ {
+ .compatible = "microchip,pac1944",
+ .data = (void *)&pac1944_chip_config[PAC1944]
+ },
+ {
+ .compatible = "microchip,pac1951",
+ .data = (void *)&pac1944_chip_config[PAC1951]
+ },
+ {
+ .compatible = "microchip,pac19512",
+ .data = (void *)&pac1944_chip_config[PAC1951_2]
+ },
+ {
+ .compatible = "microchip,pac1952",
+ .data = (void *)&pac1944_chip_config[PAC1952]
+ },
+ {
+ .compatible = "microchip,pac19522",
+ .data = (void *)&pac1944_chip_config[PAC1952_2]
+ },
+ {
+ .compatible = "microchip,pac1953",
+ .data = (void *)&pac1944_chip_config[PAC1953]
+ },
+ {
+ .compatible = "microchip,pac1954",
+ .data = (void *)&pac1944_chip_config[PAC1954]
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(of, pac1944_of_match);
+
+static const struct acpi_device_id pac1944_acpi_match[] = {
+ { "MCHP1940", .driver_data = (kernel_ulong_t)&pac1944_chip_config[PAC1944] },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, pac1944_acpi_match);
+
+static struct i2c_driver pac1944_driver = {
+ .driver = {
+ .name = "pac1944",
+ .of_match_table = pac1944_of_match,
+ .acpi_match_table = pac1944_acpi_match
+ },
+ .probe = pac1944_probe,
+ .id_table = pac1944_id,
+};
+module_i2c_driver(pac1944_driver);
+
+MODULE_AUTHOR("Marius Cristea <marius.cristea@xxxxxxxxxxxxx>");
+MODULE_DESCRIPTION("Microchip PAC194X and PAC195X Power Monitor");
+MODULE_LICENSE("GPL");
--
2.48.1



Return-Path: <linux-kernel+bounces-675564-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F003A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:43:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2A004173DDC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:43:53 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6985928688D;
Fri, 6 Jun 2025 09:43:46 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7329B2857EE;
Fri, 6 Jun 2025 09:43:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203026; cv=none; b=htnlUd0I2/zlqDVSpSQYhwQ1SP9fr4+Q0GlO6lqON/ZSrEvRZidGh+JtBqAMyRzG5EqbnKjd5bhba1pSGU7yvmPWTrxNavAh9YpTpatb0oZVaQpZEnJGOX8E1UCZbBqB6F87EmEnUQ5hl/I3/6wdNlOKfYzmJngu6e5VZEhVay0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203026; c=relaxed/simple;
bh=CGa6Fxkxq4yuPjwo3CTYeG71tpsCcLUb40D4q4WTZ+k=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=uQIhaA6vnYdHygBLOTD5V/6HOBDal6JolxmXe4Irvp9IY3n0J+dQNw2AaYzcZpVjUAfeMh8xSPV6oqsy8TgUzJe462Dil+5eILrMqw1i/iw0uEPmLBz+yoDRLTdOw9lVmN3NiNqwNBTR3kPLYp626TA/N3YVTizvHnBoO7EImEc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AF043153B;
Fri, 6 Jun 2025 02:43:25 -0700 (PDT)
Received: from pluto (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1D5C93F59E;
Fri, 6 Jun 2025 02:43:42 -0700 (PDT)
Date: Fri, 6 Jun 2025 10:43:30 +0100
From: Cristian Marussi <cristian.marussi@xxxxxxx>
To: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Cc: Sudeep Holla <sudeep.holla@xxxxxxx>,
Cristian Marussi <cristian.marussi@xxxxxxx>,
Michael Turquette <mturquette@xxxxxxxxxxxx>,
Stephen Boyd <sboyd@xxxxxxxxxx>, Peng Fan <peng.fan@xxxxxxx>,
arm-scmi@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-clk@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] clk: scmi: Fix children encountered before parents case
Message-ID: <aEK4QmtXO_GL5K_0@pluto>
References: <20250604-clk-scmi-children-parent-fix-v1-1-be206954d866@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250604-clk-scmi-children-parent-fix-v1-1-be206954d866@xxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, Jun 04, 2025 at 01:00:30PM +0200, Sascha Hauer wrote:
> When it comes to clocks with parents the SCMI clk driver assumes that
> parents are always initialized before their children which might not
> always be the case.
>

Hi,

> During initialization of the parent_data array we have:
>
> sclk->parent_data[i].hw = hws[sclk->info->parents[i]];
>
> hws[sclk->info->parents[i]] will not yet be initialized when children
> are encountered before their possible parents. Solve this by allocating
> all struct scmi_clk as an array first and populating all hws[] upfront.
>

Yes indeed, good catch.
Thanks for this.

Just one minor nitpick down below.

> Fixes: 65a8a3dd3b95f ("clk: scmi: Add support for clock {set,get}_parent")
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
> drivers/clk/clk-scmi.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
> index 15510c2ff21c0335f5cb30677343bd4ef59c0738..f258ad7dda73e3c50c3ce567a8e22b3d2ec9836b 100644
> --- a/drivers/clk/clk-scmi.c
> +++ b/drivers/clk/clk-scmi.c
> @@ -404,6 +404,7 @@ static int scmi_clocks_probe(struct scmi_device *sdev)
> const struct scmi_handle *handle = sdev->handle;
> struct scmi_protocol_handle *ph;
> const struct clk_ops *scmi_clk_ops_db[SCMI_MAX_CLK_OPS] = {};
> + struct scmi_clk *sclks;
>
> if (!handle)
> return -ENODEV;
> @@ -430,18 +431,24 @@ static int scmi_clocks_probe(struct scmi_device *sdev)
> transport_is_atomic = handle->is_transport_atomic(handle,
> &atomic_threshold_us);
>
> + sclks = devm_kcalloc(dev, count, sizeof(*sclks), GFP_KERNEL);
> + if (!sclks)
> + return -ENOMEM;
> +
> for (idx = 0; idx < count; idx++) {
> - struct scmi_clk *sclk;
> - const struct clk_ops *scmi_ops;
> + struct scmi_clk *sclk = &sclks[idx];

...do we really need this intermediate local variable in this initializarion loop ?
...doesnt feel like giving more readability (even though the compiler will probably
kill it anyway...)

> - sclk = devm_kzalloc(dev, sizeof(*sclk), GFP_KERNEL);
> - if (!sclk)
> - return -ENOMEM;
> + hws[idx] = &sclk->hw;

....cant we just

for (idx = 0; idx < count; idx++)
hws[idx] = &sclks[idx].hw;


Other than this, LGTM.
Reviewed-by: Cristian Marussi <cristian.marussi@xxxxxxx>

Thanks,
Cristian


Return-Path: <linux-kernel+bounces-675565-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D6E0841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:44:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id D43363AF269
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:44:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4326A286898;
Fri, 6 Jun 2025 09:44:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Sl5v8Ary"
Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193])
(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 381D0207A3A;
Fri, 6 Jun 2025 09:44:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203085; cv=none; b=OPUbe08bDn9evVN/dmeKFmBwK+WjrPSpca0zVzW1lKtbhe2BCQ1ze6MxaYQ7GuDTS5v7m4MtKjxw+N15oULFRfhcCbpwbHeGtM4WVewopODN+gw9xKf/Tuufm8XHK47dfUmVNmR9YkODQPTClqrYrfRMEpDr0EYUGnFZoaD6vFM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203085; c=relaxed/simple;
bh=9qfH4e4DKeBNWo1tN5k/hRYd/YM+kbmrEZZ6Hb/KOZs=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=V1/qU3PHGEYXGSxASr7gWjET1ewqMCuq1SXaeV3acI6B5bOKKbazv3WnGB32AvU4Rk73SKsCcObM3uytNXcRttYkxsFvnnmP0kkjrZ4Llc5MD1+EfwXAlqLzaheMJgJDp2XbIujRKkt2Jv0cVWaLEpICzSrOvtPO2+9FjkdPf1s=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Sl5v8Ary; arc=none smtp.client-ip=217.70.183.193
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com
Received: by mail.gandi.net (Postfix) with ESMTPSA id 03E9542E77;
Fri, 6 Jun 2025 09:44:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1;
t=1749203081;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding;
bh=eTDZAF5gNbxnNxj+lsJqqE9vfgSs2erOnFdEb7FBGt0=;
b=Sl5v8AryVjAS3ndFPZhBmcx9hFXUMFuUCZ34zswapUR19vQWw3kr8zlh28JFfquff+41aw
OqYBYRq7X+WjlTW/mT8YlsWcrPDu96IEpKTBfef0F+3XJMLpqiOdDjTkWRFKtOpr+MCZaT
qPamB/Oik2zueznSG0VIz9HIfJr16PuUDvoY/dBY6bAXfn1GGTASm2+73unuCYAqEqNveb
nUjHbCy3+bla4Dm9H0cdBYCPC37gB6WvwFEBUJ63FBdMdjQ7ntAdqfTQH47gG1ixy2uSu0
2nK3Klxd9rMka1CHvRJf5SyrC7AXENylNnsiqB+EeaHWM24GhLOesCU+cFZq0A==
From: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
To: davem@xxxxxxxxxxxxx,
Andrew Lunn <andrew@xxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Paolo Abeni <pabeni@xxxxxxxxxx>
Cc: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>,
netdev@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
thomas.petazzoni@xxxxxxxxxxx,
Simon Horman <horms@xxxxxxxxxx>,
Heiner Kallweit <hkallweit1@xxxxxxxxx>,
Russell King <linux@xxxxxxxxxxxxxxx>,
Christophe Leroy <christophe.leroy@xxxxxxxxxx>,
Herve Codina <herve.codina@xxxxxxxxxxx>,
Romain Gantois <romain.gantois@xxxxxxxxxxx>,
Jijie Shao <shaojijie@xxxxxxxxxx>,
Larysa Zaremba <larysa.zaremba@xxxxxxxxx>
Subject: [PATCH net v2] net: phy: phy_caps: Don't skip better duplex macth on non-exact match
Date: Fri, 6 Jun 2025 11:43:20 +0200
Message-ID: <20250606094321.483602-1-maxime.chevallier@xxxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdegleduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhmvgcuvehhvghvrghllhhivghruceomhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepjefhleeihefgffeiffdtffeivdehfeetheekudekgfetffetveffueeujeeitdevnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepvdduvddruddthedrudehtddrvdehvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvuddvrddutdehrdduhedtrddvhedvpdhhvghlohepfhgvughorhgrrddrpdhmrghilhhfrhhomhepmhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepudejpdhrtghpthhtohepuggrvhgvmhesuggrvhgvmhhlohhfthdrnhgvthdprhgtphhtthhopegrnhgurhgvfieslhhunhhnrdgthhdprhgtphhtthhopehkuhgsrgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepvgguuhhmrgiivghtsehgohhoghhlvgdrtghomhdprhgtphhtthhopehprggsvghnihesrhgvughhrghtr
dgtohhmpdhrtghpthhtohepmhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomhdprhgtphhtthhopehnvghtuggvvhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh
X-GND-Sasl: maxime.chevallier@xxxxxxxxxxx
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

When performing a non-exact phy_caps lookup, we are looking for a
supported mode that matches as closely as possible the passed speed/duplex.

Blamed patch broke that logic by returning a match too early in case
the caller asks for half-duplex, as a full-duplex linkmode may match
first, and returned as a non-exact match without even trying to mach on
half-duplex modes.

Reported-by: Jijie Shao <shaojijie@xxxxxxxxxx>
Closes: https://lore.kernel.org/netdev/20250603102500.4ec743cf@fedora/T/#m22ed60ca635c67dc7d9cbb47e8995b2beb5c1576
Tested-by: Jijie Shao <shaojijie@xxxxxxxxxx>
Reviewed-by: Larysa Zaremba <larysa.zaremba@xxxxxxxxx>
Fixes: fc81e257d19f ("net: phy: phy_caps: Allow looking-up link caps based on speed and duplex")
Signed-off-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
---
drivers/net/phy/phy_caps.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/phy_caps.c b/drivers/net/phy/phy_caps.c
index 703321689726..38417e288611 100644
--- a/drivers/net/phy/phy_caps.c
+++ b/drivers/net/phy/phy_caps.c
@@ -188,6 +188,9 @@ phy_caps_lookup_by_linkmode_rev(const unsigned long *linkmodes, bool fdx_only)
* When @exact is not set, we return either an exact match, or matching capabilities
* at lower speed, or the lowest matching speed, or NULL.
*
+ * Non-exact matches will try to return an exact speed and duplex match, but may
+ * return matching capabilities with same speed but a different duplex.
+ *
* Returns: a matched link_capabilities according to the above process, NULL
* otherwise.
*/
@@ -195,7 +198,7 @@ const struct link_capabilities *
phy_caps_lookup(int speed, unsigned int duplex, const unsigned long *supported,
bool exact)
{
- const struct link_capabilities *lcap, *last = NULL;
+ const struct link_capabilities *lcap, *match = NULL, *last = NULL;

for_each_link_caps_desc_speed(lcap) {
if (linkmode_intersects(lcap->linkmodes, supported)) {
@@ -204,16 +207,19 @@ phy_caps_lookup(int speed, unsigned int duplex, const unsigned long *supported,
if (lcap->speed == speed && lcap->duplex == duplex) {
return lcap;
} else if (!exact) {
- if (lcap->speed <= speed)
- return lcap;
+ if (!match && lcap->speed <= speed)
+ match = lcap;
+
+ if (lcap->speed < speed)
+ break;
}
}
}

- if (!exact)
- return last;
+ if (!match && !exact)
+ match = last;

- return NULL;
+ return match;
}
EXPORT_SYMBOL_GPL(phy_caps_lookup);

--
2.49.0



Return-Path: <linux-kernel+bounces-675566-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0554141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:48:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id AFF15189C023
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:47:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C76E8286430;
Fri, 6 Jun 2025 09:47:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ildp5oto"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15CF3191F7E;
Fri, 6 Jun 2025 09:47:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203248; cv=none; b=FKWgyxlFgNCTX/+BT11ptcpqbeP4+krp+rwm+DZIRNPlGRX3kdjMtbPtBKQw7sZYTPC2K62NEUKh0EUtJNMn7z3YYJOUKblYZMoGj4i7vjUjL1uXZ0IwMch2xxsFn84JZAEPVSZyuuxgue9jF/GYaR8QxE4JbWhB7PQHLkiU/jA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203248; c=relaxed/simple;
bh=vvY+zy9RAHY5Xv9bdqTJBXFQVoDzhPJHF1eJQ9KYoDA=;
h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:
Content-Disposition; b=tTv8/yxTKBLsMYGcyPWVh9M8g84/dVHCXOYEa3HPyIvolx9quQrQS3AHvSgfxbsz48W63EI5zOcFEjbLYgor1rwXhPEJ+dP1VQyAB/Cb+l9kupO+CgrV5Pug6IfaOhBoukldKGoSs3Kjv8QD9BJq4EEwXea8fcc0bx44m/azf6A=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ildp5oto; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 206BBC4CEEB;
Fri, 6 Jun 2025 09:47:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749203247;
bh=vvY+zy9RAHY5Xv9bdqTJBXFQVoDzhPJHF1eJQ9KYoDA=;
h=Date:From:To:Cc:Subject:From;
b=Ildp5otoztJksh2Bp1iOkOSirhm5+tezfn0hw/Rw+xybsiVkpMtUl54gFeybakK2A
8RZOGYWAhYSCikgMAbxy2p/8yRm1+AUtktxfoeTjI3vS4jUxcK4lfhX+07ujCkyAFA
nRkbbY6N6WbvUMItJV1PhxzLzLAqKbzMPyuJptfBYQXxJSU3TfMiKjhDurw+OakI3N
ychK01gtpN9frEV4+RqJFC2YNvU2DQmhSxPj5KHTBCbsokkcNALcy8bH1OHvGKgkXI
6mjlXu+mxSSospxpDKx2MeWOfPtTGTXGKcJ/4R6TdZHTO1heZkj5Ra3cJSO52BtlrJ
26JDjpOv836EA==
Date: Fri, 6 Jun 2025 11:47:24 +0200
From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= <ukleinek@xxxxxxxxxx>
To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: David Lechner <dlechner@xxxxxxxxxxxx>,
Trevor Gamblin <tgamblin@xxxxxxxxxxxx>, Nuno =?utf-8?B?U8Oh?= <nuno.sa@xxxxxxxxxx>,
linux-pwm@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: [GIT PULL] pwm: axi-pwmgen: Fix handling of external clock
Message-ID: <jzbvo3ranrbpiaox6pzs73jmq5njkkmq7iqnme5z7krcugjdk2@6hy7myyjdji5>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="ixgvzd3utbel5w3b"
Content-Disposition: inline
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--ixgvzd3utbel5w3b
Content-Type: text/plain; protected-headers=v1; charset=us-ascii
Content-Disposition: inline
Subject: [GIT PULL] pwm: axi-pwmgen: Fix handling of external clock
MIME-Version: 1.0

Hello Linus,

the following changes since commit c0c980f237e822fd9cc6c0ab5b60ce8efe76464e:

dt-bindings: timer: renesas,tpu: remove binding documentation (2025-05-19 18:46:45 +0200)

(which corresponds to my tag pwm/for-6.16-rc1 that you already pulled
last week) are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git tags/pwm/for-6.16-rc1-fixes

for you to fetch changes up to a8841dc3dfbf127a19c3612204bd336ee559b9a1:

pwm: axi-pwmgen: fix missing separate external clock (2025-06-02 18:23:33 +0200)

----------------------------------------------------------------
pwm: axi-pwmgen: Fix handling of external clock

The pwm-axi-pwmgen device is backed by an FPGA and can be synthesized in
different ways. Relevant here is that it can use one or two external
clock signals. The changes included here fix clock handling for the two
clocks case.

----------------------------------------------------------------

The two commits have been in next since last Tuesday without issues.
Please pull these two changes for 6.16-rc1.

Thanks
Uwe

David Lechner (2):
dt-bindings: pwm: adi,axi-pwmgen: Fix clocks
pwm: axi-pwmgen: fix missing separate external clock

.../devicetree/bindings/pwm/adi,axi-pwmgen.yaml | 13 ++++++++++--
drivers/pwm/pwm-axi-pwmgen.c | 23 +++++++++++++++++++---
2 files changed, 31 insertions(+), 5 deletions(-)

--ixgvzd3utbel5w3b
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmhCuSkACgkQj4D7WH0S
/k6vOQf+NCDzm/4JC9KgW9GvFklJ811OhzwGYtDBvTPpOjwI8vU1/d0c+0gffUDx
BkbuEGS3fTZSURW2uXhP8OiazkVbBCZIJbJVScssNTbskQVDWNSgOojnqQz7uzjK
oCO8W2uUURBSCdafJ+mRpsRgN0I7YB4Pili0o5QWtjrZ+YU1VYfKZVGlTbl58Dci
z9QtzZX5uxBNq5FxtSpiPQIWKMGl5HiGaGo4JTI9wwb+tQiFdi843AkpTwhLiAgD
YjJ91a7wzMgWvOuEmP/8cGyIlJCbN99RLEu0lh2p6UbFxpPS6SWpRj5vJ4HQ69K1
9AS5znuYDWPT6wbvJ4VtF+Q/IhRkgw==
=TiO0
-----END PGP SIGNATURE-----

--ixgvzd3utbel5w3b--


Return-Path: <linux-kernel+bounces-675567-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6918A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:49:21 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C48F418964CF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:49:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ECEB9286887;
Fri, 6 Jun 2025 09:49:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@xxxxxxxxxxxxx header.b="AXrT3X/g"
Received: from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com [136.143.188.12])
(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 684B3191F7E;
Fri, 6 Jun 2025 09:49:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.12
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203353; cv=pass; b=cGyE+YzEfxMsU8WqUmhh3GcjlhmDjs7wxUpSHUyGc0KCA514mGbth/RaKN0mVXQ+zU6Bu9FsNUNYfM5PP/rqwuhlOMDxkb5MhIXvvh61RjB69UZTOSVSEEUhqD5KmMf4RlZtvy+mUY+dYdIrxRUfsARv/PLHJ/P2P4jNbsvbNoE=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203353; c=relaxed/simple;
bh=ufQdgJJ8ELiGvRLyctLyDxDULThwCFQ5M0s2dHp5WcU=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=evxLqmH9vtNp39RF1DNMtcyryPccZW12xxtHqtrfbhMTCKfcZLqyyRQdZPHqlWiJ38p/n67Od8WhdWdhx2S7iFcrny5eLT3lU1u4Yq4999+Md3RTlU7PbQAanX3uSuBAKQ4dGYLz+Mwki3O1NEZgvIkJ4HkhAY+IFcmO9YZtp2w=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@xxxxxxxxxxxxx header.b=AXrT3X/g; arc=pass smtp.client-ip=136.143.188.12
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com
ARC-Seal: i=1; a=rsa-sha256; t=1749203325; cv=none;
d=zohomail.com; s=zohoarc;
b=BDRQhUXbZUXBzSw5etuAVJudYAJv3trPbVEKVW6rlGrgnN2e08Az+GzLRKwRLQdkcFR7fOyxG9ejgamyeLed2xLloQDaL7Tj4xkzuxHsT1U4x4jtQoA050uUt3/9O/uIALARzVrZGsXqwm6Snm/kIao1kEYs0Qvi3mfNjtDFCSQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc;
t=1749203325; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;
bh=pOMikGDm0MmBx1ffFfqI8HnHprOULeEnm50fJ4rduiM=;
b=OuYOkQ9JUvFU83oyRWnXcQMzx7c4joJcXfgHpBqS5d05ixiVEmg0hDqHLMfvCSdHv63o8X7iWYPBOVVzhk1JR20vnJlxODrToAaQWK1QowIlGwo+dp10ALfOvcP/mwK41OYAJiNtA2gXQDfdfaN2U98I06l4YnCZ5jTFDi5epzk=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass header.i=collabora.com;
spf=pass smtp.mailfrom=nicolas.frattaroli@xxxxxxxxxxxxx;
dmarc=pass header.from=<nicolas.frattaroli@xxxxxxxxxxxxx>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1749203325;
s=zohomail; d=collabora.com; i=nicolas.frattaroli@xxxxxxxxxxxxx;
h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To;
bh=pOMikGDm0MmBx1ffFfqI8HnHprOULeEnm50fJ4rduiM=;
b=AXrT3X/gdWM3d/al73oHTm1DN8lTjiDmui1fUMKEtuAgJ8VTAhcjSRq1wH5kJy1D
i6TL+OWL3LgzNr/iD08U06uj/1K7RrfU3lipLp0BRWmhtFqYTQ7OmYX+ir8o+VVQ+8B
RMNAI2YuCzcS8ffKZTdwWX4K7unjDiVoAPnTqY0M=
Received: by mx.zohomail.com with SMTPS id 17492033238565.683996663710104;
Fri, 6 Jun 2025 02:48:43 -0700 (PDT)
From: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>
To: lgirdwood@xxxxxxxxx, broonie@xxxxxxxxxx, perex@xxxxxxxx, tiwai@xxxxxxxx,
heiko@xxxxxxxxx, linux-rockchip@xxxxxxxxxxxxxxxxxxx,
linux-sound@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Pei Xiao <xiaopei01@xxxxxxxxxx>
Cc: Pei Xiao <xiaopei01@xxxxxxxxxx>
Subject:
Re: [PATCH v2 1/2] ASOC: rockchip: fix capture stream handling in
rockchip_sai_xfer_stop
Date: Fri, 06 Jun 2025 11:48:38 +0200
Message-ID: <9468228.NyiUUSuA9g@workhorse>
In-Reply-To:
<c374aae92c177aaf42c0f1371eccdbc7e9615786.1749201126.git.xiaopei01@xxxxxxxxxx>
References:
<cover.1749201126.git.xiaopei01@xxxxxxxxxx>
<c374aae92c177aaf42c0f1371eccdbc7e9615786.1749201126.git.xiaopei01@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Friday, 6 June 2025 11:18:21 Central European Summer Time Pei Xiao wrote:
> Correcting the capture stream handling which was incorrectly setting
> playback=true for capture streams.
>
> The original code mistakenly set playback=true for capture streams,
> causing incorrect behavior.
>
> Fixes: cc78d1eaabad ("ASoC: rockchip: add Serial Audio Interface (SAI) driver")
> Signed-off-by: Pei Xiao <xiaopei01@xxxxxxxxxx>
> ---
> sound/soc/rockchip/rockchip_sai.c | 16 +++-------------
> 1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/sound/soc/rockchip/rockchip_sai.c b/sound/soc/rockchip/rockchip_sai.c
> index 602f1ddfad00..916af63f1c2c 100644
> --- a/sound/soc/rockchip/rockchip_sai.c
> +++ b/sound/soc/rockchip/rockchip_sai.c
> @@ -378,19 +378,9 @@ static void rockchip_sai_xfer_start(struct rk_sai_dev *sai, int stream)
> static void rockchip_sai_xfer_stop(struct rk_sai_dev *sai, int stream)
> {
> unsigned int msk = 0, val = 0, clr = 0;
> - bool playback;
> - bool capture;
> -
> - if (stream < 0) {
> - playback = true;
> - capture = true;
> - } else if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
> - playback = true;
> - capture = false;
> - } else {
> - playback = true;
> - capture = false;
> - }
> + bool capture = stream == SNDRV_PCM_STREAM_CAPTURE || stream < 0;
> + bool playback = stream == SNDRV_PCM_STREAM_PLAYBACK || stream < 0;
> + /* could be <= 0 but we don't want to depend on enum values */
>
> if (playback) {
> msk |= SAI_XFER_TXS_MASK;
>

Tested-by: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>
Acked-by: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>

Thank you!




Return-Path: <linux-kernel+bounces-675568-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0894641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:50:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id BCA20189B2B5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:50:20 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 98727286430;
Fri, 6 Jun 2025 09:50:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="YB8tBlOd";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="yWnMby0j"
Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32])
(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 B40CE13B2A4
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:49:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203399; cv=fail; b=gw6gCZEJUpD9h+lE9skRl2wvljTTXcfwQbLYyIbT2IHb7oL8/MR8w3g1zOlraO6mND5Lxg4vulW3VVldKyPSDiFgoLizdTUhW0ENTOywB3JVk3s25gPv6wJCYZA2mukymYAocg5wbDc65IjfLUsoQolFID342jdvXPirNotkH9I=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203399; c=relaxed/simple;
bh=apnPGc9hD+zPRQMqfu6ZjzLY7n7iepmwXr4gR9q9W6c=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=hYdHHVcrS64JlSUJo+EeKR3AYlM7S936gHfjs3ZO8+L0K8vhdUV6vjwNa6CpACA21FcnVbijnnOzexwnkvlkN9Pvo8N5Jyt4p0lJICKz9BeLMc2A1v0kQBY2umeDR4LNGoBoKVv0QfTy2Z2rgFmBmY6I5bckBtE0N5DVsu4/dQQ=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=YB8tBlOd; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=yWnMby0j; arc=fail smtp.client-ip=205.220.165.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246617.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NI3r028785;
Fri, 6 Jun 2025 09:49:31 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=aiTHPi41M5uyqgqdpA
uI1PwyGUv1RzJoq80AEPCErDc=; b=YB8tBlOdhhe2G2mGIdpswyE9nwYjaJHXNG
jTsFpsJg0dhbTamlnc5NY2yyXv5cmN6yEEyQZo0yHZ5+473LDerDsZFtBgp0w7oH
2tvTfio3KjvGADv1sFYfvHxanmN9zq+ybNO13ETRWG5+beyqgomv1e4u7dPRHTN4
OaZqSepcdFJJjVYMEyz5aOi+MpjmJDvtodxDrACk5vSkBF1j7F2rENiL4Y8deZKn
/rm2iG+8rWUlq4xnqP+D8EuSUgZXovTHyWLfBihNc7I5fXI/0XLRWjb6euHL25Gp
WvxMhPY6RilQcWMokN0jwN5oAzdakwR2vbxzbOY5Lbb0fFaWCRnQ==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8kfsmy-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 09:49:30 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5569QZkU039442;
Fri, 6 Jun 2025 09:49:30 GMT
Received: from dm1pr04cu001.outbound.protection.outlook.com (mail-centralusazon11010014.outbound.protection.outlook.com [52.101.61.14])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7d4wx9-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 09:49:30 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=RY2rW74YtOEbmMWPiY/RjX03n5z5Wmg3iiYSqcm1rsCMtDlfALCgwxpUL3K+K4ap/E4+ApokaM66KhRNgmO1v95r698Vn4o7naDw1ZJdh2iholJWHtlFy++gLls0zYscmQshGjqP5UF9D6911SFM/+TNgv7kfyQa9sZ5l4d7h14OYPlisMoehH4CQI009kxFdO8zJ/7pK2DgDb+SpBs6bK+2NVKesT3yifXlYJqBoE5F5isjPd7YiIaLMo633bhZC4cbvgm7ecdfE4ej5grI8Qgb7QQA4cIQUEnhzKcBW4Vo4ALbtbnKBn8dYZpP+59wzpAhowFhzPtEuWYiLVDr5Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=aiTHPi41M5uyqgqdpAuI1PwyGUv1RzJoq80AEPCErDc=;
b=sqTVLF1MDbTLmA6mf3EBoHYvOE77cvlcdNQ1qTqd789+pxtzqdrLWtuk1+b5UTghWNx/v6aQ5L/MjgC5c3cNYA89lQv0Pxt9oJOY/mgomuNwjtVakocSQktRdoepYQBCiNQvHaG2OHn7WRltE2F6RJDieP4UMKf6UDG+igUajpG7d6AwS+P+V2EU7SuZqZTUEFlwMQFYN7Jwq//FNEMZ2Kj6p+Te812PYKQMLqN/eL7VygqMAwXem/jhqz2Dl4cxYg4eh3pIsmvbq40sLkwrG7s5/2yTwmHCOQltvUjQUUJtQ0UcqhIilGtJdft+pJLpZ6SDu97YIf2b3WoyB1lG3Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=aiTHPi41M5uyqgqdpAuI1PwyGUv1RzJoq80AEPCErDc=;
b=yWnMby0jXgvff1HQiYszMjA2IBiklHziigCv+GCSoyP36Rcjm4DvNQt1tcCf3jvsCw44uaWe90CYmNdMKhmIDE0kKLYMfzkgDDHtJziBv3U1R4yB4nS62l0/jFyE/NjAeCwa1QgvHW2ZYFljM87LRGZqMVY+Oo1nHAdrUE8XrPg=
Received: from BL4PR10MB8229.namprd10.prod.outlook.com (2603:10b6:208:4e6::14)
by PH0PR10MB7063.namprd10.prod.outlook.com (2603:10b6:510:289::13) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.36; Fri, 6 Jun
2025 09:49:26 +0000
Received: from BL4PR10MB8229.namprd10.prod.outlook.com
([fe80::552b:16d2:af:c582]) by BL4PR10MB8229.namprd10.prod.outlook.com
([fe80::552b:16d2:af:c582%4]) with mapi id 15.20.8813.018; Fri, 6 Jun 2025
09:49:26 +0000
Date: Fri, 6 Jun 2025 10:49:22 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Dev Jain <dev.jain@xxxxxxx>
Cc: akpm@xxxxxxxxxxxxxxxxxxxx, david@xxxxxxxxxx, catalin.marinas@xxxxxxx,
will@xxxxxxxxxx, Liam.Howlett@xxxxxxxxxx, vbabka@xxxxxxx,
rppt@xxxxxxxxxx, surenb@xxxxxxxxxx, mhocko@xxxxxxxx,
linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
suzuki.poulose@xxxxxxx, steven.price@xxxxxxx, gshan@xxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/3] arm64: pageattr: Use walk_page_range_novma() to
change memory permissions
Message-ID: <f528506e-b04d-4c80-93c3-93ba4ca385bd@lucifer.local>
References: <20250530090407.19237-1-dev.jain@xxxxxxx>
<20250530090407.19237-3-dev.jain@xxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250530090407.19237-3-dev.jain@xxxxxxx>
X-ClientProxiedBy: LO2P123CA0107.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:139::22) To BL4PR10MB8229.namprd10.prod.outlook.com
(2603:10b6:208:4e6::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: BL4PR10MB8229:EE_|PH0PR10MB7063:EE_
X-MS-Office365-Filtering-Correlation-Id: 2c766257-da34-40c3-8b9c-08dda4df6bdc
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|1800799024|366016|376014|7416014|7053199007;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?XDGIbOz6P+54ZLmz2k5CeyfSDDMBkMawrnysJ7lciSeO23mKJIDph8Lu7afH?=
=?us-ascii?Q?7CSkZUVNwROikNG5+tm5+TvW2jDwcipAbsqBT7LsZiMCU6SxP+/cK2xKvL0F?=
=?us-ascii?Q?bMRuB9qY3IO8F5LsLWGFjz37jqrBQDCw3CeE3LrsHIU0+Pwj0D/scW40fZSl?=
=?us-ascii?Q?sPDVhIgfue/dPbAu0e6Uvp/nbqkBoFMrfpc+t4DmptK85YCeLzSbimtxyv+M?=
=?us-ascii?Q?DU94qzEG91moAczI+9gMkBPxnh131DrFZJg2/lla+13987tXkQj9au+yZ3Wl?=
=?us-ascii?Q?BAyBKYwwHRv13d+kW21Dhl/0u8DDEDvTuDAUlj0yFFrYKMnUTVCjceecuRqY?=
=?us-ascii?Q?Xt+d51ILrbWlLBsf3NXIRXBg++KADhVP2+kWjiAn/mAP/Vm5GnMJut4+X58T?=
=?us-ascii?Q?fLIsjcVoFUCgol9ZXWik3WyG3I3UBkMXojuIQ1nfucyu3I/MPhYCyemcqpZn?=
=?us-ascii?Q?RRt8J3AVRD4479iYdDS99xm0HYH0WeVYHZLQQ0qT0O6OvuG7M6xhBq6VPU8h?=
=?us-ascii?Q?qiZwcZEmdkP5NKuiXNZM+WvssHh4vH38DUwoKeDyJQt3U+5P6JgiQt0q1qlc?=
=?us-ascii?Q?nOOQ4vnq756xkcf+jc4vRAcap5Xnrfp4amTio4xytpur3t3gELQwiLKCvqeL?=
=?us-ascii?Q?Pd2NooYg1JkQJ73AA5k0CpV5A/kZUDLmzYHHv28leyajtuWfDytXURIUovyt?=
=?us-ascii?Q?/JtwSMPPd3b/5x3cYe1slofaOmRI3QA/BGiQNabCa8nNkWZXjEgv/vhoxQkO?=
=?us-ascii?Q?ULVBXuNJP/Eu1lLWUVam4E9zP3rkgJqXKnm6Oa+9e4hdGKRQcMdb59DZyMXN?=
=?us-ascii?Q?GOTnkG/oAb9AJkW42i0WafELjD64z/7WHauGd/rsrU0cJdMIVNKJSx5U9PBi?=
=?us-ascii?Q?qPFsuYK8YgYitzvhnzju0g7CzFVYVYz05roYbkmUu9Uz4ReSDe9mQqg0JuB0?=
=?us-ascii?Q?x5OH/Jc6l8U443TxSc1x0T2ptBy5YSlU4TavnSczlWXPOrMRIx68TzqetNEU?=
=?us-ascii?Q?u6xslNmk0MVuWN5Z8xGh1NPJiTggxMwO/K6PePaiVOCWa/jQp014eI90ssEL?=
=?us-ascii?Q?/zAHKr+V4fOtJArsUrgdRXuObnyFXWMiFMPC5zt+OdcD4ACD5+uWB5tfTquy?=
=?us-ascii?Q?/yZw4TlCIxsHfS5ayr6qcpZLrcLha+RzcBy5dzoi3RIPc2yCzFD6VMp+rKwi?=
=?us-ascii?Q?Qm/4v7wUYN4uNQ+sIsii+CUaJow6bc7wE/FHpf8sVAndhGeVALCcRivMUYwS?=
=?us-ascii?Q?AaqFRqaJ6QQQT8gclWJv7Q9wt5t9lVYOsN+BCy2tIicm49y4xr02PV14U1Lx?=
=?us-ascii?Q?cgf5lkknhFjNeDS+ZTo+nBnZpPgxlF5iRHShLl5X+mRxqLs7dV7aX4LIsvHJ?=
=?us-ascii?Q?rBxfIUKplwxj07jCo6oA3jaN+OxRPKVE6Pvv2AvKeIFvsuIeybiEhl8TBtfE?=
=?us-ascii?Q?+EW2pmkbst0=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL4PR10MB8229.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014)(7053199007);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?xfwGq8OnBopw6hLORpcar9NgU8Gs4FaEn8wANgkwdmmXQexDwIqF4uP41Af9?=
=?us-ascii?Q?3BUUaOI9PNw3w3a+hHZAvwQO6fZGQLYygCy8ei+s4yPWAQC+tNnlNlIhZ1oO?=
=?us-ascii?Q?tABcZhcysPu76QMZlutIpKEfyJGFg4kUvaXmblKXWMW9LX26v3ZAH7CtxSsQ?=
=?us-ascii?Q?erlpxtXpSWkRdiERZlCK8mdxFj5AZ6vEtGYoEpjK01kPYj+i4HKUZR9egVux?=
=?us-ascii?Q?S4lPbwmj0wfwkiaIhxhUrtqq09gq+XmB1JJNKf3WHolWXa/1UGS7CsPnU4pe?=
=?us-ascii?Q?hiTN4WUvTdfky2jld9gTJZZh+ng0nG2K4SQ4TNGNhthGI9W5mlzVFjbntRJ2?=
=?us-ascii?Q?uORyqCU+vnfluQfnRWBSo8ps7Rxqv4Wa5/ebD+qCzQa8GNbdwE8MY36TDg5K?=
=?us-ascii?Q?UKl0Jx914RFm5SO7ucGOrPFVfJgT0wHF3fCIfxCpS5iBtBQWEnlGfMowtHIO?=
=?us-ascii?Q?GQFULDwln2yCJKbedm12TVV7pfDMMXhZXZqSRO/EgLoYZG5c81FQIS7kFnmA?=
=?us-ascii?Q?IPOsgnKPWLDSICdJhGi0l8JQ73HnYipj6NWySPo17NxcB60xIb8lz21e2X9c?=
=?us-ascii?Q?wduHXHU3XWE8swlaeQb3gkrCPJudtx06hQQdcGPk2AdgAiGZySowHq4mPjU3?=
=?us-ascii?Q?7SbvdZMr8uGlw7kJ39r1K/Kq9IGAgCDCA+LxFfoAdWwrJIq0PZweWYmcTfSz?=
=?us-ascii?Q?oWJvEsq3HhCKq7Qg0NfXKPKeFbVYOUPq1bSmLg3+1egxi+qBof8eLH9DSlf7?=
=?us-ascii?Q?k5AycG/5Mv4vaCz9Hanpx+YGrQwqOb8wJQFD+iUzARg5EKurfmIsouZ3pxKj?=
=?us-ascii?Q?JFxEMSztFey8IFU9zkyoZbaeXWM3+WOLL8HjbqWQkV7c3Kr6dU0+4XxZRaIa?=
=?us-ascii?Q?FWuh0ywUqKLIix0YoDCZpYDkLT6BbVCqhbTfJzuvpKFaACUc8CuIAEMhCOSG?=
=?us-ascii?Q?etiqfX7sY22gHPJ9ay1EHUrnKrX3fFqgtn75v/OhJWugRZDmQCQM5v6QSJM4?=
=?us-ascii?Q?530M5lLn4ijb95g2szU4qtH5gv821Amx4dl3BqRMUOZ/W1gqKNZQC7WrSkhT?=
=?us-ascii?Q?85iGh5h8E4YjUX5WwK6T31zaR/sKRWYGHnTihIZ56JIA43hcIdwz2qZELP/e?=
=?us-ascii?Q?YjCd8f4KjvWu0tjQkO9Pau0tjd3CBMjX21B1S/+W6cCzPl6p6OOpYGqtO4vm?=
=?us-ascii?Q?kHwyzqOS3c4hIrEIzOxsJdageglTzTIFs90R7XnvJu/BJXKw+HhlGAf7VgHV?=
=?us-ascii?Q?FwwwTVYarbX6F0mINPPMTEmp8t/uXf+Z/5Le+Uwxsqu+81/szQf6jw93Xh/x?=
=?us-ascii?Q?9ZmUYjUxu2ezEyai7r6ybJvEVtXJiv8ioyJuUO/CpsYWvP7gG6zj1Ueg/U1X?=
=?us-ascii?Q?97eFumfWEGIna/URO06PU+Wb9ax8I7uf1w5yGo+uRDmCV6V6IwVcxNtaWVlT?=
=?us-ascii?Q?ahJcORUbgYwQJfGCBGqgaJw0UVXGP+UiArNOh9TaQC0wT170fSGky/5x73t0?=
=?us-ascii?Q?Uo76C8dNaJ5jJjfsV6642Y8wiKcxMqC3RsXoDO4K+o3mjnMGyi/+ix54pK5E?=
=?us-ascii?Q?tM6K0wFmgM9aGm4J4UoDlIeCTZAI6FH1pxh/bA9q1xfSBZ/+B5ox1DWiVUhV?=
=?us-ascii?Q?xw=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
pt7SVIZVIeueYwtF4OL6K1fIGWhtBpUvgjM5eq3X7yR26WnvpWF0axHvwwanHEwscSTCsKk+VGRcPq0RjnAkznLeEf73nElXRmQPZzQXYi3PyomenS4oFVn8MwpnBkrXgyBDPsh/umNspHit7C6Lz8zIIqo3mz6H8xv4yU3UmJUhYgnP2KmjS7fJKmzhK0zPUPdzzHVTtEd/XeBEcHagj07B7lYOEwstKDrJ8WJcItaia96gPj2HWvgG5y+xcyWhPZgpByd8XSKgPeOwNmqDeSQDPfsRBCFCE5dlzE/fsJKdeTGB9uoZp6yF0YL8UDbgBQu374/8zEHEFaz7n8SC5OyI/AWyxNPDH+3nnwGBrlL/A0dXirf7Sn3OOajI57qIlu2W84QoFAlR6J1fsogD5yp6yQuGbTgwQ1iqpGjF4g/X2blFllESugVvmWJtJvmBoNLksMZMBjIUM/lwTl3+3S/3c4C7jiaF2R4nt13Vt5JanFvajUkfYszAi2jZ27mCDogJ+3udksipGK9K9P/N3IcWDE4egJ8t3uBa+DGYgKiBA9BPFhvJg2QulGDlWhV80cPOVbB4o6btwS924X5kXLPBUKgMuN12HlraHrWoMSE=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 2c766257-da34-40c3-8b9c-08dda4df6bdc
X-MS-Exchange-CrossTenant-AuthSource: BL4PR10MB8229.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 09:49:26.3950
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: TPcigJs4Ig50ZzpDbS6Ge3D8iGrxIX1ooU3VBqUs+sm5bO7iygHikv8lq82qd60VZ9Ldb8304Vrd6JagQQR/stXiiRSdUyurPD7HC8crczk=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB7063
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060089
X-Proofpoint-GUID: CO2cNq-VpipxIERsRv_lJPy-pvykW0cQ
X-Proofpoint-ORIG-GUID: CO2cNq-VpipxIERsRv_lJPy-pvykW0cQ
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA4OSBTYWx0ZWRfX5JctetuRuKjg wZ8NCIpSR8LPa1C/59OrqymY6MWEa2rT5pH+8HeIiLUpCaA5V9q/IxTYprYTPO1P8fwor71WiHv ob4CfOyPxDLBjre0bYPJF/eIppuLzIJIRTY5zcJmK+Yi1NgcsYbmjiuY7Le+SkRT8ZeJw5/GYPO
MDMCT09Mtsj8pOwsLYI5JZymUoNyvvSE6GUGn2ZDH8xgQ8kaGEsquWRZ4B+f6Fxshp+iISG/gFB o2feCOwt2YdS9aZiFbTwtpolHf3wtqSBAUwspRHJLPxXEAmjdc06bU7jMEsG2WyadD4kowqJ7f6 X0NOEknVGfeo97ZFidOuiC6JrwrjVvdugcPIk4qS7g8H/5ldl7LjM97OKCBS32ZBBCcvpZV+Kq/
dmRx5hf05h/pcvIHB9mUfma7L/Mkq+Jm0cRDLrADzML4mjfvA7AaMWuB6D7uKkVUk5cV4Ez0
X-Authority-Analysis: v=2.4 cv=FM4bx/os c=1 sm=1 tr=0 ts=6842b9aa cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=7CQSdrXTAAAA:8 a=kIOOWBL0crzjPrg8fIkA:9 a=CjuIK1q_8ugA:10 a=a-qgeE7W1pNrGK8U0ZQC:22
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, May 30, 2025 at 02:34:06PM +0530, Dev Jain wrote:
> Move away from apply_to_page_range(), which does not honour leaf mappings,
> to walk_page_range_novma(). The callbacks emit a warning and return EINVAL
> if a partial range is detected.

Hm a follow up question here - why not just improve apply_to_page_range() to
honour leaf mappings?

What does honouring leaf mappings actually mean? You mean handling huge pages?

Would it be all that difficult to implement?

It seems like you're pushing a bunch of the 'applying' logic over from there to
a walker that isn't maybe best suited to it and having to introduce an iffy new
form of locking...

Can we go vice-versa? :)

Also obviously walk_page_range_novma() doesn't exist any more :P
walk_kernel_page_table_range() is the preferred solution.

>
> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
> ---
> arch/arm64/mm/pageattr.c | 69 +++++++++++++++++++++++++++++++++++++---
> 1 file changed, 64 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
> index 39fd1f7ff02a..a5c829c64969 100644
> --- a/arch/arm64/mm/pageattr.c
> +++ b/arch/arm64/mm/pageattr.c
> @@ -8,6 +8,7 @@
> #include <linux/mem_encrypt.h>
> #include <linux/sched.h>
> #include <linux/vmalloc.h>
> +#include <linux/pagewalk.h>
>
> #include <asm/cacheflush.h>
> #include <asm/pgtable-prot.h>
> @@ -20,6 +21,67 @@ struct page_change_data {
> pgprot_t clear_mask;
> };
>
> +static pteval_t set_pageattr_masks(unsigned long val, struct mm_walk *walk)
> +{
> + struct page_change_data *masks = walk->private;
> + unsigned long new_val = val;
> +
> + new_val &= ~(pgprot_val(masks->clear_mask));
> + new_val |= (pgprot_val(masks->set_mask));
> +
> + return new_val;
> +}
> +
> +static int pageattr_pud_entry(pud_t *pud, unsigned long addr,
> + unsigned long next, struct mm_walk *walk)
> +{
> + pud_t val = pudp_get(pud);
> +
> + if (pud_leaf(val)) {
> + if (WARN_ON_ONCE((next - addr) != PUD_SIZE))
> + return -EINVAL;
> + val = __pud(set_pageattr_masks(pud_val(val), walk));
> + set_pud(pud, val);
> + walk->action = ACTION_CONTINUE;
> + }
> +
> + return 0;
> +}
> +
> +static int pageattr_pmd_entry(pmd_t *pmd, unsigned long addr,
> + unsigned long next, struct mm_walk *walk)
> +{
> + pmd_t val = pmdp_get(pmd);
> +
> + if (pmd_leaf(val)) {
> + if (WARN_ON_ONCE((next - addr) != PMD_SIZE))
> + return -EINVAL;
> + val = __pmd(set_pageattr_masks(pmd_val(val), walk));
> + set_pmd(pmd, val);
> + walk->action = ACTION_CONTINUE;
> + }
> +
> + return 0;
> +}
> +
> +static int pageattr_pte_entry(pte_t *pte, unsigned long addr,
> + unsigned long next, struct mm_walk *walk)
> +{
> + pte_t val = ptep_get(pte);
> +
> + val = __pte(set_pageattr_masks(pte_val(val), walk));
> + set_pte(pte, val);
> +
> + return 0;
> +}
> +
> +static const struct mm_walk_ops pageattr_ops = {
> + .pud_entry = pageattr_pud_entry,
> + .pmd_entry = pageattr_pmd_entry,
> + .pte_entry = pageattr_pte_entry,
> + .walk_lock = PGWALK_NOLOCK,
> +};
> +
> bool rodata_full __ro_after_init = IS_ENABLED(CONFIG_RODATA_FULL_DEFAULT_ENABLED);
>
> bool can_set_direct_map(void)
> @@ -49,9 +111,6 @@ static int change_page_range(pte_t *ptep, unsigned long addr, void *data)
> return 0;
> }
>
> -/*
> - * This function assumes that the range is mapped with PAGE_SIZE pages.
> - */
> static int __change_memory_common(unsigned long start, unsigned long size,
> pgprot_t set_mask, pgprot_t clear_mask)
> {
> @@ -61,8 +120,8 @@ static int __change_memory_common(unsigned long start, unsigned long size,
> data.set_mask = set_mask;
> data.clear_mask = clear_mask;
>
> - ret = apply_to_page_range(&init_mm, start, size, change_page_range,
> - &data);
> + ret = walk_page_range_novma(&init_mm, start, start + size,
> + &pageattr_ops, NULL, &data);
>
> /*
> * If the memory is being made valid without changing any other bits
> --
> 2.30.2
>


Return-Path: <linux-kernel+bounces-675569-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1BE2641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:50:32 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id EF08C3A65E7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:50:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A78EE286884;
Fri, 6 Jun 2025 09:50:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qfI9cano";
dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GIm3ZBAV"
Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55])
(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 4BF1D286423
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:50:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203426; cv=none; b=WdAl21UuQI+6ZAxHgHCnjbi+MJu2deVIZ1n7tsOHRBKESGc0+y6eoXx2OIVTH1DLDeSJmBjOeJ6mV8JjcvcZmiEM7JvuoBH6kWEihY/QqYo8iLHSpNv4XMwqk6R8u81RPxV1T4N5yygIGf4ovKFIvW/mUeaFmfIEWxHC+2sOFzo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203426; c=relaxed/simple;
bh=kzUqLZeJ2yjPfSSP5h5qzP0//IHkx/iH5DMtIukoG6M=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=OC8AwpR93Qv3G8DB7OPvihY19l+WML7Ukd7u+jPqk/mqeD1utEfTb/zufxmnN95NwgE5o20JgIEwk4cCf7Ygdlq3Vracr7CR2+iLssjQVj0c993oqazNxGu6V+a1sDV2v1TAHfSR3qP++IgjEzjAQ61bjOISR73Bq+xsCvnrVwY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qfI9cano; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=GIm3ZBAV; arc=none smtp.client-ip=193.142.43.55
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de
Date: Fri, 6 Jun 2025 11:50:21 +0200
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de;
s=2020; t=1749203421;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=GLSdIgeVQP7vdahEotSJRsbMUWrTn+A4o1VzdMavb+Q=;
b=qfI9canoTrdbiweyImkK8+XQqUokGbKt6yF73hV5xAPELJjJCwXWYMaClVYXCpgoRJQLdn
uxngu1G/tD3VZ8m8GD4GT5FwACvglpJj7uHIsXi19E3UyFja1IlyTcK1IfIY02Epv2B2TU
FCy4xQMKM+Dfez69y+W3b7XyaPZz4CneNK0Ysr+Lqml13Tccp6+XBCgnhPsAP4lXRhsUAG
8bozl8DE6wKKHeYwNxNdpJNbDhJR2Kp11QD9I2BKtZrE1jpwNpqCWnNDYHZPjRvaw8higO
rv0EFtRUEPi3/5aWI1qRlw519K8/5HazlwQeDbUhEsnDhtxRtv+GU24rmR8ukw==
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
s=2020e; t=1749203421;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=GLSdIgeVQP7vdahEotSJRsbMUWrTn+A4o1VzdMavb+Q=;
b=GIm3ZBAV/7x2LRtcycM/uSg7k41ZFVb9zA79HjVHngC7UurtpeqbV+h+P/KogITcjgi8lX
D2Wb+zEjr8Bv8uCQ==
From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= <thomas.weissschuh@xxxxxxxxxxxxx>
To: Xi Ruoyao <xry111@xxxxxxxxxxx>
Cc: Alexandre Ghiti <alex@xxxxxxxx>, Nathan Chancellor <nathan@xxxxxxxxxx>,
"Jason A . Donenfeld" <Jason@xxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>,
Palmer Dabbelt <palmer@xxxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, linux-riscv@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v2] RISC-V: vDSO: Correct inline assembly constraints in
the getrandom syscall wrapper
Message-ID: <20250606112858-abbbff06-c6cb-4c23-b58b-c69b0719e1a7@xxxxxxxxxxxxx>
References: <20250605091112-7cd6b3bd-a466-486a-aebc-7bf0b2a8ac31@xxxxxxxxxxxxx>
<20250606092443.73650-2-xry111@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250606092443.73650-2-xry111@xxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 05:24:44PM +0800, Xi Ruoyao wrote:
> As recently pointed out by Thomas, if a register is forced for two
> different register variables, among them one is used as "+" (both input
> and output) and another is only used as input, Clang would treat the
> conflicting input parameters as undefined behaviour and optimize away
> the argument assignment.
>
> Per an example in the GCC documentation, for this purpose we can use "="
> (only output) for the output, and "0" for the input for that we must
> reuse the same register as the output. And GCC developers have
> confirmed using a simple "r" (that we use for most vDSO implementations)
> instead of "0" is also fine.

The wording is a bit confusing. Maybe this is better:

Instead use "=r" (only output) for the output parameter and "r" (only input)
for the input parameter.
While the example from the GCC documentation uses "0" for the input parameter,
this is not necessary as confirmed by the GCC developers and "r"
matches what the other architectures' vDSO implementations are using.

> Link: https://lore.kernel.org/all/20250603-loongarch-vdso-syscall-v1-1-6d12d6dfbdd0@xxxxxxxxxxxxx/
> Link: https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Local-Register-Variables.html
> Link: https://gcc.gnu.org/pipermail/gcc-help/2025-June/144266.html
> Cc: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>

In any case, thanks and

Reviewed-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>

> Cc: Nathan Chancellor <nathan@xxxxxxxxxx>
> Signed-off-by: Xi Ruoyao <xry111@xxxxxxxxxxx>
> ---
>
> v1 -> v2: Keep using "r" for buffer to follow the existing convention
> (that the GCC developers have confirmed fine).
>
> arch/riscv/include/asm/vdso/getrandom.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/include/asm/vdso/getrandom.h b/arch/riscv/include/asm/vdso/getrandom.h
> index 8dc92441702a..c6d66895c1f5 100644
> --- a/arch/riscv/include/asm/vdso/getrandom.h
> +++ b/arch/riscv/include/asm/vdso/getrandom.h
> @@ -18,7 +18,7 @@ static __always_inline ssize_t getrandom_syscall(void *_buffer, size_t _len, uns
> register unsigned int flags asm("a2") = _flags;
>
> asm volatile ("ecall\n"
> - : "+r" (ret)
> + : "=r" (ret)
> : "r" (nr), "r" (buffer), "r" (len), "r" (flags)
> : "memory");
>
>
> base-commit: dc5240f09bca7b5fc72ad8894d6b9321bce51139
> --
> 2.49.0
>


Return-Path: <linux-kernel+bounces-675570-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B5ED641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:50:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D3A817981D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:50:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 83309286884;
Fri, 6 Jun 2025 09:50:38 +0000 (UTC)
Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3967013B2A4;
Fri, 6 Jun 2025 09:50:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.236.30
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203438; cv=none; b=AX1IAp1XcAXTxNu+5gWH9SRVPHzZjqRUkgyWWRCch5DrDtZZ8jMiye5RCsxTi4bLE9CcwBNJ2T/LjCtZxar6G4lEsf5KXz8fxAYcPAIqheivaapA25l8QzV0PfXFeQcib3alMXb5R4hbbOukzibqF+gf7Czoodv3h6vVGu4ASkI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203438; c=relaxed/simple;
bh=feAQpUfREqIyqaR5jr5Sy0Qgv6IKtyAVXYK+ZWaBKfw=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Z5OBAJJyDVdxjvTM8wbn0YwSaDdlhImF8fyQt8aTN7R0L0WwCPT3cpYB9DAgjxGI3gJ3L3kdYN+CUNVzLh8vlZo824eZU80vXZAXODxrRsxfqfPw2Bldw/pSD3FSQpEW82YNXA2VTUkGu6yXByGUi++A7C+2zSr0HIZ0M0a42AU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.236.30
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu
Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233])
by localhost (Postfix) with ESMTP id 4bDGcJ510Jz9ssb;
Fri, 6 Jun 2025 11:44:16 +0200 (CEST)
X-Virus-Scanned: amavisd-new at c-s.fr
Received: from pegase1.c-s.fr ([192.168.12.234])
by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id tjurJkmP4Gxb; Fri, 6 Jun 2025 11:44:16 +0200 (CEST)
Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192])
by pegase1.c-s.fr (Postfix) with ESMTP id 4bDGcJ4C5Wz9srg;
Fri, 6 Jun 2025 11:44:16 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
by messagerie.si.c-s.fr (Postfix) with ESMTP id 8B59F8B76C;
Fri, 6 Jun 2025 11:44:16 +0200 (CEST)
X-Virus-Scanned: amavisd-new at c-s.fr
Received: from messagerie.si.c-s.fr ([127.0.0.1])
by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023)
with ESMTP id skAA1reDtuH6; Fri, 6 Jun 2025 11:44:16 +0200 (CEST)
Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.235.99])
by messagerie.si.c-s.fr (Postfix) with ESMTP id 18FEE8B763;
Fri, 6 Jun 2025 11:44:16 +0200 (CEST)
From: Christophe Leroy <christophe.leroy@xxxxxxxxxx>
To: Jaroslav Kysela <perex@xxxxxxxx>,
Takashi Iwai <tiwai@xxxxxxxx>,
Mark Brown <broonie@xxxxxxxxxx>
Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
linuxppc-dev@xxxxxxxxxxxxxxxx,
linux-sound@xxxxxxxxxxxxxxx,
Herve Codina <herve.codina@xxxxxxxxxxx>
Subject: [PATCH] ALSA: pcm: Rewrite recalculate_boundary() to avoid costly loop
Date: Fri, 6 Jun 2025 11:44:02 +0200
Message-ID: <4836e2cde653eebaf2709ebe30eec736bb8c67fd.1749202237.git.christophe.leroy@xxxxxxxxxx>
X-Mailer: git-send-email 2.47.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749203043; l=3083; i=christophe.leroy@xxxxxxxxxx; s=20211009; h=from:subject:message-id; bh=feAQpUfREqIyqaR5jr5Sy0Qgv6IKtyAVXYK+ZWaBKfw=; b=qB3NAsGq3M8Q0jjRupzKaooojapfHgaxiAqyhkjD/arhMy8Gf84sxuM4dscgA+wlp0eVzGbAl Uzowl9ub5IDDUTT9oWgWbKqtrPkutIIJlPhqgllmPt+YfjtjqxxIzdI
X-Developer-Key: i=christophe.leroy@xxxxxxxxxx; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0=
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

At the time being recalculate_boundary() is implemented with a
loop which shows up as costly in a perf profile, as depicted by
the annotate below:

0.00 : c057e934: 3d 40 7f ff lis r10,32767
0.03 : c057e938: 61 4a ff ff ori r10,r10,65535
0.21 : c057e93c: 7d 49 50 50 subf r10,r9,r10
5.39 : c057e940: 7d 3c 4b 78 mr r28,r9
2.11 : c057e944: 55 29 08 3c slwi r9,r9,1
3.04 : c057e948: 7c 09 50 40 cmplw r9,r10
2.47 : c057e94c: 40 81 ff f4 ble c057e940 <snd_pcm_ioctl+0xee0>

Total: 13.2% on that simple loop.

But what the loop does is to multiply the boundary by 2 until it is
over the wanted border. This can be avoided by using fls() to get the
boundary value order and shift it by the appropriate number of bits at
once.

This change provides the following profile:

0.04 : c057f6e8: 3d 20 7f ff lis r9,32767
0.02 : c057f6ec: 61 29 ff ff ori r9,r9,65535
0.34 : c057f6f0: 7d 5a 48 50 subf r10,r26,r9
0.23 : c057f6f4: 7c 1a 50 40 cmplw r26,r10
0.02 : c057f6f8: 41 81 00 20 bgt c057f718 <snd_pcm_ioctl+0xf08>
0.26 : c057f6fc: 7f 47 00 34 cntlzw r7,r26
0.09 : c057f700: 7d 48 00 34 cntlzw r8,r10
0.22 : c057f704: 7d 08 38 50 subf r8,r8,r7
0.04 : c057f708: 7f 5a 40 30 slw r26,r26,r8
0.35 : c057f70c: 7c 0a d0 40 cmplw r10,r26
0.13 : c057f710: 40 80 05 f8 bge c057fd08 <snd_pcm_ioctl+0x14f8>
0.00 : c057f714: 57 5a f8 7e srwi r26,r26,1

Total: 1.7% with that loopless alternative.

Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx>
---
sound/core/pcm_native.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 6c2b6a62d9d2..2b77190a247d 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -24,6 +24,7 @@
#include <sound/minors.h>
#include <linux/uio.h>
#include <linux/delay.h>
+#include <linux/bitops.h>

#include "pcm_local.h"

@@ -3119,13 +3120,23 @@ struct snd_pcm_sync_ptr32 {
static snd_pcm_uframes_t recalculate_boundary(struct snd_pcm_runtime *runtime)
{
snd_pcm_uframes_t boundary;
+ snd_pcm_uframes_t border;
+ int order;

if (! runtime->buffer_size)
return 0;
- boundary = runtime->buffer_size;
- while (boundary * 2 <= 0x7fffffffUL - runtime->buffer_size)
- boundary *= 2;
- return boundary;
+
+ border = 0x7fffffffUL - runtime->buffer_size;
+ if (runtime->buffer_size > border)
+ return runtime->buffer_size;
+
+ order = __fls(border) - __fls(runtime->buffer_size);
+ boundary = runtime->buffer_size << order;
+
+ if (boundary <= border)
+ return boundary;
+ else
+ return boundary / 2;
}

static int snd_pcm_ioctl_sync_ptr_compat(struct snd_pcm_substream *substream,
--
2.47.0



Return-Path: <linux-kernel+bounces-675571-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3ECEA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:51:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8BBFB179725
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:51:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D0554286893;
Fri, 6 Jun 2025 09:51:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="nReW8NZX"
Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C5EA13B2A4;
Fri, 6 Jun 2025 09:51:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203481; cv=none; b=tnEDBOlv9BfIe+FilXsEEojwYYBqr0XqQmr2NCQpUiPHhqLPZyze/G0poO3+axlE9alI+oibcxAloo4MK8OItZLX0hX/xEdHo0iqjRCk6QUxGp6cgz4MpfWJxHCV/3x6Felb6+MflR3DS/wmf3dQgQys15S6BqnU0gUM6eradgo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203481; c=relaxed/simple;
bh=Liqzz+y3Xpct0YUxn1hcdqAN16lyEo7U507Jr8n4RDA=;
h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=OJmU3fhiHj9XXF4Shy4aIoev+Lny+1dHr6Kd0pBN/oaMOREwQSmjMCom/WBJgRpR7cqtiN42U1si+SLvPFBU9hw3Bmp4iLoZRdYBSB6+J115IFxjOdH1VoQxTTMwMOrByOaGJ2sNSGDJvs0Uw6mWmr8K7np25CTC8HHloVyfRMQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=nReW8NZX; arc=none smtp.client-ip=117.135.210.2
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=gV
Q67dkOWrUUbsyOUp1tkuG+EhYQ5alDpGFSmm71tg0=; b=nReW8NZX2u/A3csB07
Ts+bguMylNdkNqrnf2D7GisAbTZQPVObt7IMiGHnmC3FjnIYaPNxMCeqYdoEIzXV
g0/PK6f8LG4kREf6iUK8GT/fdCm3UepINupCu7ENZFeBc3rCmnhZI1fVV2YlPaeQ
fDMQ39Hj0tOJv0Rx48mth5tS4=
Received: from localhost.localdomain (unknown [])
by gzga-smtp-mtada-g0-3 (Coremail) with SMTP id _____wDnS1LduUJoDSSKGQ--.2037S2;
Fri, 06 Jun 2025 17:50:23 +0800 (CST)
From: Slark Xiao <slark_xiao@xxxxxxx>
To: manivannan.sadhasivam@xxxxxxxxxx,
johan+linaro@xxxxxxxxxx,
mhi@xxxxxxxxxxxxxxx
Cc: linux-arm-msm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Slark Xiao <slark_xiao@xxxxxxx>
Subject: [PATCH] bus: mhi: host: pci_generic: Change T99W515 to T99W640
Date: Fri, 6 Jun 2025 17:50:19 +0800
Message-Id: <20250606095019.383992-1-slark_xiao@xxxxxxx>
X-Mailer: git-send-email 2.25.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-CM-TRANSID:_____wDnS1LduUJoDSSKGQ--.2037S2
X-Coremail-Antispam: 1Uf129KBjvJXoW7AFy7GFWfArW8Zr18Wr1UAwb_yoW8WF48pF
4fur1UtaykXr45Ka1kAryDuas8GrsxCryxK3WxG34Igr1qyrWYgFZ7Gr1a9w1Yqa93tF1S
vFWUuFyUX3WDKF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRhNVhUUUUU=
X-CM-SenderInfo: xvod2y5b0lt0i6rwjhhfrp/1tbibgZkZGhCsRPxxQAAsU
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

T99W515 is a LGA device but not a M.2 modem device.
So correct this name in case a name mismatch issue.

Fixes: bf30a75e6e00("bus: mhi: host: Add support for Foxconn SDX72 modems")
Signed-off-by: Slark Xiao<slark_xiao@xxxxxxx>
---
drivers/bus/mhi/host/pci_generic.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index a4a62429c784..9c2d10327ce5 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -593,8 +593,8 @@ static const struct mhi_pci_dev_info mhi_foxconn_dw5932e_info = {
.sideband_wake = false,
};

-static const struct mhi_pci_dev_info mhi_foxconn_t99w515_info = {
- .name = "foxconn-t99w515",
+static const struct mhi_pci_dev_info mhi_foxconn_t99w640_info = {
+ .name = "foxconn-t99w640",
.edl = "qcom/sdx72m/foxconn/edl.mbn",
.edl_trigger = true,
.config = &modem_foxconn_sdx72_config,
@@ -920,9 +920,9 @@ static const struct pci_device_id mhi_pci_id_table[] = {
/* DW5932e (sdx62), Non-eSIM */
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0f9),
.driver_data = (kernel_ulong_t) &mhi_foxconn_dw5932e_info },
- /* T99W515 (sdx72) */
+ /* T99W640 (sdx72) */
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe118),
- .driver_data = (kernel_ulong_t) &mhi_foxconn_t99w515_info },
+ .driver_data = (kernel_ulong_t) &mhi_foxconn_t99w640_info },
/* DW5934e(sdx72), With eSIM */
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe11d),
.driver_data = (kernel_ulong_t) &mhi_foxconn_dw5934e_info },
--
2.25.1



Return-Path: <linux-kernel+bounces-675572-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9781241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:51:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id D556E178DB8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:51:53 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DFB3428689C;
Fri, 6 Jun 2025 09:51:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@xxxxxxxxxxxxx header.b="b4dEefdS"
Received: from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com [136.143.188.12])
(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 B1D4F286881;
Fri, 6 Jun 2025 09:51:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.12
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203504; cv=pass; b=ujphRqbidhx91P2Dal6tj6vr88taYy7HSHqXJRXyiYQStlbpkgtVbgfKW/LbOfA+gmbPsqBKJUbVWBzD6L/ZmbpEe3SlchIddtmYZFwNQAClQV6nRWI6CKETguhLhvb96Ulnwx7HhuOKqkdvVbwFOKdYc6AuK95G4sVmlUwX7Q8=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203504; c=relaxed/simple;
bh=kTrpTqTzCsXY5bYJidp9/0da5RBF2G/y1wGZ1MRfJbY=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=WxpUgM29buVA+xfvyOb0Hkud6bNbyEizOv4SC6HNgRkYvkEjcvWvgzueINUbEmN2UD77NLuQ7UWgCMd9sFqrb4VXXdxokv9abl+0LLpVphiiDR6pB2RhB/mNh+lvY19iYGK9/jq0dnQjSszns2QPHK4effQT5dQgzSWqkDFnWgQ=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@xxxxxxxxxxxxx header.b=b4dEefdS; arc=pass smtp.client-ip=136.143.188.12
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com
ARC-Seal: i=1; a=rsa-sha256; t=1749203482; cv=none;
d=zohomail.com; s=zohoarc;
b=OYTEc6yXPsIcRrHcRogHNuuYr2RSQbvW8h0bM+VDGsFW7I+pApg6ySm9RGKZc7RHwHUpCSQYHImtfJOimVIphDyxV0wOcV9FR5eQTKsAT/IB+AMXPUUjCoRZ7sQPIIgcnmgn41FI/ABk4zVLVetmv8eWb6ySp/cpoIjDzhO7Sik=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc;
t=1749203482; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;
bh=tfnGcQSUHbLimk8z8aZ3QSd/T6JAuGeb919MpsyxEvo=;
b=QjTRmi6jQa2aQnzKRdkghqnj8WvmY3P25PwvVQs/Hzrl0rpgcWRJKqSmaDevvNS+1Avk3MR59AJlMTWZOG0edVwZtx1Hd8SSuI/5z97jdTZwEu/nA8ckAPSt1k4xFua5FNmdZUA+Y1Ww3+8/vRy/hFejNWUnEipPe9lAhlZmKPo=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass header.i=collabora.com;
spf=pass smtp.mailfrom=nicolas.frattaroli@xxxxxxxxxxxxx;
dmarc=pass header.from=<nicolas.frattaroli@xxxxxxxxxxxxx>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1749203482;
s=zohomail; d=collabora.com; i=nicolas.frattaroli@xxxxxxxxxxxxx;
h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To;
bh=tfnGcQSUHbLimk8z8aZ3QSd/T6JAuGeb919MpsyxEvo=;
b=b4dEefdSzxzo0UixhUC9rGQqPy00a2fiwxiLzerpmJqIc1MixsZgnSaIWYd/8uOQ
om56GC0tC26vEt3ywPCxM/ZjNDIE2GvM+3Ahs5j0S/WZGIkaakUTE85sq2bHar2R78a
IYLrcqqZl0kUlJ5QnAl8q5f0LNbdLgqO8KGULl2g=
Received: by mx.zohomail.com with SMTPS id 1749203480891403.2196795067804;
Fri, 6 Jun 2025 02:51:20 -0700 (PDT)
From: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>
To: lgirdwood@xxxxxxxxx, broonie@xxxxxxxxxx, perex@xxxxxxxx, tiwai@xxxxxxxx,
heiko@xxxxxxxxx, linux-rockchip@xxxxxxxxxxxxxxxxxxx,
linux-sound@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Pei Xiao <xiaopei01@xxxxxxxxxx>
Cc: Pei Xiao <xiaopei01@xxxxxxxxxx>
Subject:
Re: [PATCH v2 2/2] ASOC: rockchip: Use helper function devm_clk_get_enabled()
Date: Fri, 06 Jun 2025 11:51:17 +0200
Message-ID: <2818018.CQOukoFCf9@workhorse>
In-Reply-To:
<84bc40641d05596f1edf4f01d1e6aea16bdbeeb5.1749201126.git.xiaopei01@xxxxxxxxxx>
References:
<cover.1749201126.git.xiaopei01@xxxxxxxxxx>
<84bc40641d05596f1edf4f01d1e6aea16bdbeeb5.1749201126.git.xiaopei01@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Friday, 6 June 2025 11:18:22 Central European Summer Time Pei Xiao wrote:
> Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared
> and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be
> replaced by devm_clk_get_enabled() when driver enables the clocks for the
> whole lifetime of the device. Moreover, it is no longer necessary to
> unprepare and disable the clocks explicitly.
>
> Signed-off-by: Pei Xiao <xiaopei01@xxxxxxxxxx>
> ---
> sound/soc/rockchip/rockchip_sai.c | 35 +++++++++----------------------
> 1 file changed, 10 insertions(+), 25 deletions(-)
>
> diff --git a/sound/soc/rockchip/rockchip_sai.c b/sound/soc/rockchip/rockchip_sai.c
> index 916af63f1c2c..0b9f54102d69 100644
> --- a/sound/soc/rockchip/rockchip_sai.c
> +++ b/sound/soc/rockchip/rockchip_sai.c
> @@ -1427,43 +1427,32 @@ static int rockchip_sai_probe(struct platform_device *pdev)
> if (irq > 0) {
> ret = devm_request_irq(&pdev->dev, irq, rockchip_sai_isr,
> IRQF_SHARED, node->name, sai);
> - if (ret) {
> + if (ret)
> return dev_err_probe(&pdev->dev, ret,
> "Failed to request irq %d\n", irq);
> - }
> } else {
> dev_dbg(&pdev->dev, "Asked for an IRQ but got %d\n", irq);
> }
>
> sai->mclk = devm_clk_get(&pdev->dev, "mclk");
> - if (IS_ERR(sai->mclk)) {
> + if (IS_ERR(sai->mclk))
> return dev_err_probe(&pdev->dev, PTR_ERR(sai->mclk),
> "Failed to get mclk\n");
> - }
>
> - sai->hclk = devm_clk_get(&pdev->dev, "hclk");
> - if (IS_ERR(sai->hclk)) {
> + sai->hclk = devm_clk_get_enabled(&pdev->dev, "hclk");
> + if (IS_ERR(sai->hclk))
> return dev_err_probe(&pdev->dev, PTR_ERR(sai->hclk),
> "Failed to get hclk\n");
> - }
> -
> - ret = clk_prepare_enable(sai->hclk);
> - if (ret)
> - return dev_err_probe(&pdev->dev, ret, "Failed to enable hclk\n");
>
> regmap_read(sai->regmap, SAI_VERSION, &sai->version);
>
> ret = rockchip_sai_init_dai(sai, res, &dai);
> - if (ret) {
> - dev_err(&pdev->dev, "Failed to initialize DAI: %d\n", ret);
> - goto err_disable_hclk;
> - }
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "Failed to initialize DAI\n");
>
> ret = rockchip_sai_parse_paths(sai, node);
> - if (ret) {
> - dev_err(&pdev->dev, "Failed to parse paths: %d\n", ret);
> - goto err_disable_hclk;
> - }
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "Failed to parse paths\n");
>
> /*
> * From here on, all register accesses need to be wrapped in
> @@ -1474,10 +1463,8 @@ static int rockchip_sai_probe(struct platform_device *pdev)
> devm_pm_runtime_enable(&pdev->dev);
> pm_runtime_get_noresume(&pdev->dev);
> ret = rockchip_sai_runtime_resume(&pdev->dev);
> - if (ret) {
> - dev_err(&pdev->dev, "Failed to resume device: %pe\n", ERR_PTR(ret));
> - goto err_disable_hclk;
> - }
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "Failed to resume device\n");
>
> ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
> if (ret) {
> @@ -1504,8 +1491,6 @@ static int rockchip_sai_probe(struct platform_device *pdev)
> /* If we're !CONFIG_PM, we get -ENOSYS and disable manually */
> if (pm_runtime_put(&pdev->dev))
> rockchip_sai_runtime_suspend(&pdev->dev);
> -err_disable_hclk:
> - clk_disable_unprepare(sai->hclk);
>
> return ret;
> }
>

Acked-by: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>
Tested-by: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>

Thank you!





Return-Path: <linux-kernel+bounces-675573-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C5C3641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:53:26 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D602173267
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:53:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DD6422868B3;
Fri, 6 Jun 2025 09:53:13 +0000 (UTC)
Received: from mta22.hihonor.com (mta22.honor.com [81.70.192.198])
(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 54A9213B2A4;
Fri, 6 Jun 2025 09:53:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.70.192.198
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203593; cv=none; b=GiiQxs6GX+fUxw0ZjoD/d3e8GsHfBQcXbH3MMzuhY/Pj6wKIPHYpfC7+18atsUXKZ5pcGYu7fJ1nWS8n3c46sjT02ZEmyqU445R0hOeBRrvNP1OuqEnme+VaKnHcLXgSueZ7PAhJJTuwDnPSIQmh0GGqMeE3hdsYJm/Vc9dDujY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203593; c=relaxed/simple;
bh=LEb3nFdnzhPAz1p+K99qR/il1eWd8KUET+Ja2aEpKxQ=;
h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
Content-Type:MIME-Version; b=GpPooWa4b9Q1oMKQ0wdoEK4GaksoPcUpekbiAlEScANEwXTbWo82TrE5gbdY6Yg7+w6/SkkjeWpWMT7lgFa5jQhpzacbIGuqUXFHz5R0QGVrD4TSXlRS1OEaI9PMCq+pSqDZoRqB4DWZSXIthwovuG8Ph+ZVAwrKrQgTR33TAnY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=honor.com; spf=pass smtp.mailfrom=honor.com; arc=none smtp.client-ip=81.70.192.198
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=honor.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=honor.com
Received: from w013.hihonor.com (unknown [10.68.26.19])
by mta22.hihonor.com (SkyGuard) with ESMTPS id 4bDGm20Yh8zYm12N;
Fri, 6 Jun 2025 17:50:58 +0800 (CST)
Received: from a015.hihonor.com (10.68.27.88) by w013.hihonor.com
(10.68.26.19) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 6 Jun
2025 17:52:55 +0800
Received: from a010.hihonor.com (10.68.16.52) by a015.hihonor.com
(10.68.27.88) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 6 Jun
2025 17:52:54 +0800
Received: from a010.hihonor.com ([fe80::7127:3946:32c7:6e]) by
a010.hihonor.com ([fe80::7127:3946:32c7:6e%14]) with mapi id 15.02.1544.011;
Fri, 6 Jun 2025 17:52:54 +0800
From: wangtao <tao.wangtao@xxxxxxxxx>
To: Christoph Hellwig <hch@xxxxxxxxxxxxx>, =?iso-8859-1?Q?Christian_K=F6nig?=
<christian.koenig@xxxxxxx>
CC: "sumit.semwal@xxxxxxxxxx" <sumit.semwal@xxxxxxxxxx>, "kraxel@xxxxxxxxxx"
<kraxel@xxxxxxxxxx>, "vivek.kasireddy@xxxxxxxxx" <vivek.kasireddy@xxxxxxxxx>,
"viro@xxxxxxxxxxxxxxxxxx" <viro@xxxxxxxxxxxxxxxxxx>, "brauner@xxxxxxxxxx"
<brauner@xxxxxxxxxx>, "hughd@xxxxxxxxxx" <hughd@xxxxxxxxxx>,
"akpm@xxxxxxxxxxxxxxxxxxxx" <akpm@xxxxxxxxxxxxxxxxxxxx>, "amir73il@xxxxxxxxx"
<amir73il@xxxxxxxxx>, "benjamin.gaignard@xxxxxxxxxxxxx"
<benjamin.gaignard@xxxxxxxxxxxxx>, "Brian.Starkey@xxxxxxx"
<Brian.Starkey@xxxxxxx>, "jstultz@xxxxxxxxxx" <jstultz@xxxxxxxxxx>,
"tjmercier@xxxxxxxxxx" <tjmercier@xxxxxxxxxx>, "jack@xxxxxxx" <jack@xxxxxxx>,
"baolin.wang@xxxxxxxxxxxxxxxxx" <baolin.wang@xxxxxxxxxxxxxxxxx>,
"linux-media@xxxxxxxxxxxxxxx" <linux-media@xxxxxxxxxxxxxxx>,
"dri-devel@xxxxxxxxxxxxxxxxxxxxx" <dri-devel@xxxxxxxxxxxxxxxxxxxxx>,
"linaro-mm-sig@xxxxxxxxxxxxxxxx" <linaro-mm-sig@xxxxxxxxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,
"linux-fsdevel@xxxxxxxxxxxxxxx" <linux-fsdevel@xxxxxxxxxxxxxxx>,
"linux-mm@xxxxxxxxx" <linux-mm@xxxxxxxxx>, "wangbintian(BintianWang)"
<bintian.wang@xxxxxxxxx>, yipengxiang <yipengxiang@xxxxxxxxx>, liulu 00013167
<liulu.liu@xxxxxxxxx>, hanfeng 00012985 <feng.han@xxxxxxxxx>
Subject: RE: [PATCH v4 0/4] Implement dmabuf direct I/O via copy_file_range
Thread-Topic: [PATCH v4 0/4] Implement dmabuf direct I/O via copy_file_range
Thread-Index: AQHb1G1ol+FT389RFkuW+lwB3adoKrPw4BKAgAADywCAAAF8AIAE6kCg
Date: Fri, 6 Jun 2025 09:52:54 +0000
Message-ID: <5d36abace6bf492aadd847f0fabc38be@xxxxxxxxx>
References: <20250603095245.17478-1-tao.wangtao@xxxxxxxxx>
<aD7x_b0hVyvZDUsl@xxxxxxxxxxxxx>
<09c8fb7c-a337-4813-9f44-3a538c4ee8b1@xxxxxxx>
<aD72alIxu718uri4@xxxxxxxxxxxxx>
In-Reply-To: <aD72alIxu718uri4@xxxxxxxxxxxxx>
Accept-Language: zh-CN, en-US
Content-Language: zh-CN
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



> -----Original Message-----
> From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Sent: Tuesday, June 3, 2025 9:20 PM
> To: Christian K=F6nig <christian.koenig@xxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>; wangtao
> <tao.wangtao@xxxxxxxxx>; sumit.semwal@xxxxxxxxxx; kraxel@xxxxxxxxxx;
> vivek.kasireddy@xxxxxxxxx; viro@xxxxxxxxxxxxxxxxxx; brauner@xxxxxxxxxx;
> hughd@xxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; amir73il@xxxxxxxxx;
> benjamin.gaignard@xxxxxxxxxxxxx; Brian.Starkey@xxxxxxx;
> jstultz@xxxxxxxxxx; tjmercier@xxxxxxxxxx; jack@xxxxxxx;
> baolin.wang@xxxxxxxxxxxxxxxxx; linux-media@xxxxxxxxxxxxxxx; dri-
> devel@xxxxxxxxxxxxxxxxxxxxx; linaro-mm-sig@xxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; linux-fsdevel@xxxxxxxxxxxxxxx; linux-
> mm@xxxxxxxxx; wangbintian(BintianWang) <bintian.wang@xxxxxxxxx>;
> yipengxiang <yipengxiang@xxxxxxxxx>; liulu 00013167
> <liulu.liu@xxxxxxxxx>; hanfeng 00012985 <feng.han@xxxxxxxxx>
> Subject: Re: [PATCH v4 0/4] Implement dmabuf direct I/O via
> copy_file_range
>=20
> On Tue, Jun 03, 2025 at 03:14:20PM +0200, Christian K=F6nig wrote:
> > On 6/3/25 15:00, Christoph Hellwig wrote:
> > > This is a really weird interface. No one has yet to explain why
> > > dmabuf is so special that we can't support direct I/O to it when we
> > > can support it to otherwise exotic mappings like PCI P2P ones.
> >
> > With udmabuf you can do direct I/O, it's just inefficient to walk the
> > page tables for it when you already have an array of all the folios.
>=20
> Does it matter compared to the I/O in this case?
>=20
> Either way there has been talk (in case of networking implementations) th=
at
> use a dmabuf as a first class container for lower level I/O.
> I'd much rather do that than adding odd side interfaces. I.e. have a ver=
sion
> of splice that doesn't bother with the pipe, but instead just uses in-ker=
nel
> direct I/O on one side and dmabuf-provided folios on the other.
If the VFS layer recognizes dmabuf type and acquires its sg_table
and folios, zero-copy could also be achieved. I initially thought
dmabuf acts as a driver and shouldn't be handled by VFS, so I made
dmabuf implement copy_file_range callbacks to support direct I/O
zero-copy. I'm open to both approaches. What's the preference of
VFS experts?

Regards,
Wangtao.



Return-Path: <linux-kernel+bounces-675574-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B24BC41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:58:33 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id D855E1892A97
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:58:46 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id F3D422868AF;
Fri, 6 Jun 2025 09:58:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="AdKi0Snm"
Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11021076.outbound.protection.outlook.com [52.101.70.76])
(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 D40AB286413;
Fri, 6 Jun 2025 09:58:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.76
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203899; cv=fail; b=tbdwuOXGZmzEcndDs6suOT0qEPNoqFnU78VQhVTFQirEwdXULFCLc5GBqezM7QbtidOFEVO5wY5m4rj2IkSx1n84Y0LxE7OjKtYMFzIK6RHISR2KEzOWsQb27HWKfsuiNT04tbzZtkfH6I61FLzFAyVdYnUCjPhZA3eQ2+vjT2I=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203899; c=relaxed/simple;
bh=qDb2MGKSvSYXXLxiDkPGpRwC65+yg9scm4Y37SfROk4=;
h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=gsEuZ/fHVU26ejonRg7YdR4EF13HNyKLym7nuT5YJ2VMkDmR2xN/hU1gHmj1izdeHGCkSCq8Dm7eK62vPzx9BZYG1tch7Up1t36ElHb/Da1lzl196OHcweurM3zkMnidIKlKDriGv9s9/f/PvWSZ5vvkTkz7QcCe4LGGaFC/Zos=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com; spf=pass smtp.mailfrom=virtuozzo.com; dkim=pass (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b=AdKi0Snm; arc=fail smtp.client-ip=52.101.70.76
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=virtuozzo.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=ltoTw8GgFmcacOcZos7HWbz9/CodP8HNDsRtCqYS0zJgF2fgh49iHJpKyQve+xTSZUFeYqnX0JtQfvQNDEg7/oFxKTHM3T0lwPAeiJjdjH6rwwOgCDhvmff6sOnDzE1GzHum9nEXCCsyGca3epS6G1se26DUevvvRrcLZI1H5/cN7Plhbi6W+bU7gilmV8QoZEznDovZxxUpX03eDWakBrOz6T6Tkoj/xtzOP3MGK54OykDWs+ZkNttvKiBfvgrzMKBkFhy59wRIlaW7DvCl22h1BDnILD02R0/Ni55msGFh6XUGhajJwwEua/HSNpQ8Pb+u1BwqDh25DTItRd6nDg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=Rle1vBZQPEBuU/UoIH8UpN6TYaXrieKpMFiH+Ow3nhU=;
b=MmFoywnjevbn6CarYhbifkFPY0TTUodS8NRxDS4l/KYDXEvQ3wWqdZ2y0xjIAjqI4LD3V9uKdmCJSzLVcrDfQ8VtqR/Pde5XFsU71X1DoYJdZgJLBlLglB61tx99Q0890cm2/TzrQvxuAIen9m8qHUqKSla/iX5tGle3ZeBZaYiKZzv9C5Jvz4F9QgT1s0UJfosAlP+fOMLcq8qillcjQ8gs/yB7g2uG1l4NFE+k1zrZUCRm0UwRWQtn+XtW2VN0EsZYQdHnyjQE9+Cgj3jDq4HATc7/FxQgUBMP8nV9rumarQnnrC2QC2w9tRuLda5jVfykcXxdptCZVfEOEoCeug==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=virtuozzo.com; dmarc=pass action=none
header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com;
s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=Rle1vBZQPEBuU/UoIH8UpN6TYaXrieKpMFiH+Ow3nhU=;
b=AdKi0SnmUs/VSBtJRZhOu/pGbOfWGGtf3La5V/9KL0akzvSaIXogcFtIGLJTKtcfUqt3rhW7ogegkzOSVCZTsE51T071EP539McVl36qzszVS3iHosyjpWT3Jmlko8JZkaRauheffDiB7pAv3gP902PRl1JS0SWsRcZpqCcdWVpRkugEtCtLHt+wNocInpl1BkBZ5bGvlvxLM7SS2jwJ61hrislHit6d/hmbMsCHMX/Eq0BQFp7PXhMipujFU1V8+fq7+eNMmdl9Seiyt8TcILAJlOKhK9+aZZlZ1M5syFT5chtcLPRWFr+bcV1lzgG3ynxGsE9+Xk8x/tYPsAr+KQ==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=virtuozzo.com;
Received: from DU0PR08MB9003.eurprd08.prod.outlook.com (2603:10a6:10:471::13)
by DB8PR08MB5369.eurprd08.prod.outlook.com (2603:10a6:10:11c::17) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.20; Fri, 6 Jun
2025 09:58:12 +0000
Received: from DU0PR08MB9003.eurprd08.prod.outlook.com
([fe80::7261:fca8:8c2e:29ce]) by DU0PR08MB9003.eurprd08.prod.outlook.com
([fe80::7261:fca8:8c2e:29ce%5]) with mapi id 15.20.8792.034; Fri, 6 Jun 2025
09:58:12 +0000
From: Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx>
To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>,
Ingo Molnar <mingo@xxxxxxxxxx>,
Will Deacon <will@xxxxxxxxxx>,
Boqun Feng <boqun.feng@xxxxxxxxx>,
Waiman Long <longman@xxxxxxxxxx>,
Kees Cook <kees@xxxxxxxxxx>,
Joel Granados <joel.granados@xxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Konstantin Khorenko <khorenko@xxxxxxxxxxxxx>,
Denis Lunev <den@xxxxxxxxxxxxx>,
Aleksandr Mikhalitsyn <aleksandr.mikhalitsyn@xxxxxxxxxxxxx>,
Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
linux-fsdevel@xxxxxxxxxxxxxxx,
kernel@xxxxxxxxxx
Subject: [PATCH] locking: detect spin_lock_irq() call with disabled interrupts
Date: Fri, 6 Jun 2025 17:57:23 +0800
Message-ID: <20250606095741.46775-1-ptikhomirov@xxxxxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: KU0P306CA0008.MYSP306.PROD.OUTLOOK.COM
(2603:1096:d10:17::13) To DU0PR08MB9003.eurprd08.prod.outlook.com
(2603:10a6:10:471::13)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DU0PR08MB9003:EE_|DB8PR08MB5369:EE_
X-MS-Office365-Filtering-Correlation-Id: 73b698bf-c988-4fc6-b3c1-08dda4e0a5b3
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|10070799003|376014|7416014|52116014|1800799024|366016;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?N21KQR0y5I53ZvU0IhccFGLaGJXqK7sdwSAvkBZjZU9xTQFLOkqBqvc4Af9T?=
=?us-ascii?Q?aIvJN2bwhXUqg3k3NvwV8jgJNyvpNmAkjWGYRdoKER0A7ahE7Qp6ns3QY+PJ?=
=?us-ascii?Q?zbqDHFSy+1LlGa6SY788fR4PyS+e1ZG2h3D88NQnJ5zpRGxFZ2qT/xN+S6Ex?=
=?us-ascii?Q?ak/n/mCJobZi1/XGGjQNkxaSag+SaB/CGuGf3En7drwZT5yVIDOmJxZGrhDQ?=
=?us-ascii?Q?IcgQ1Y8pLmZUAt0rvlZNUsCIRHFdsJ88QMt2Xek0jHFy6Zr30yen+LhPR9du?=
=?us-ascii?Q?Lorul5H+TDs3aVcgkqhSU06xtOBOebcFk+9/F/3Yw85uOHy8206Ay1Khkgyi?=
=?us-ascii?Q?fWIeSFu+q+BMXbNDNP5kb73xT2U5o1ZsVoldLZm7MHzq2sprPnRYnJS7QxHP?=
=?us-ascii?Q?jlK8uZOSzA+qFlGULORF2PqHfsNp7CRFVaQyKGUDkAHzvmBqC2vsRoRMaWzV?=
=?us-ascii?Q?jE6LPlRmOyO7rJZiRrBMY1oLEAiRKM9/Hbvw89u+vCBWq/ASYFLf4YiCeH0y?=
=?us-ascii?Q?E8nZizYQVjdH1lebP9ANkTW25Ggb2fF6ULw7SQ3/qZep1peL9LMOI+1baqn3?=
=?us-ascii?Q?trNlDdePJoXYkmeFkBRYfGoWi+Y59O2oQB4qiGUOcxPNnqyzRWDck+d9rnWK?=
=?us-ascii?Q?eT0eswioZbqdZvtxT4WJS1quc9+raJr6QrwoOBKUzQoRmEKzjHdU/wQwmDwI?=
=?us-ascii?Q?0NwyTyAk89VpLfDrLsPLxMwQz8VohZ0grAbgj/TMeAr6jDgP0V+aIppQPV/e?=
=?us-ascii?Q?t7SzdHRCHxVeaCV+oHQAqaXuoVr1f2utuwAR8rBZQ1TeMCrrzv0YhgV476SP?=
=?us-ascii?Q?3GqjkrMOr0cwr4XFO6bIbqGwib7bkbNEafeGc9Exbc9GmgBBhCA51DuQTJIj?=
=?us-ascii?Q?CYXTzZWzMjfjFgpkGBcBN073Q55k0BL1ExnJc3V8Zd9efEQkXvoj/u+ziBL/?=
=?us-ascii?Q?/xHuF9bVkZCoG3k8XjLnIN5wXHdPX6IC9r2eTCSzW20wsHmfyUtTricvnA2P?=
=?us-ascii?Q?PpZB2bLxXo/BFSFTNhwVTCSE+UxUASNIslKR+T0ib+Q/4JJ/i+JQu/t8YW6t?=
=?us-ascii?Q?fjanZwBbSjIsRFdqUvJQeoZe9fZQxrCkpUes4mfCjmAlIe8fIPyUMmEq2Iom?=
=?us-ascii?Q?qePQ1F01p3DQkV7dve9/nzzUI4EUoT83nzAzAkt4RgEHykwyh8IQfqXdhSN7?=
=?us-ascii?Q?MYVBW37L5AXu0WOXspj4o4pb42b3tvJO9azrLKy+wjuuUXlN/OIhoj//XNBt?=
=?us-ascii?Q?fAPXO+7ls1ZdvjZRxvgluaSOYS5arxfre6c2wsS/zmRR9o1Vg4pbiIU6v5ZI?=
=?us-ascii?Q?I9A6VMRPXOUTOo5hI0v6i+fbUFccsV+x/LksPF253Hbd87iFiJts+pQ7DSAJ?=
=?us-ascii?Q?XFbp/2U4DHJAJn2g0/lGvqI4G+xUsDXe14rSLXj7IGWmzmRUu1+VuA3Ay5eu?=
=?us-ascii?Q?UneRLJfcAPE=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR08MB9003.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(10070799003)(376014)(7416014)(52116014)(1800799024)(366016);DIR:OUT;SFP:1102;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?89gTbvyS9ULCWwPoWcfd4NmkrkBQSoCbhybraKfuHRKHoQBScdWd/mqDLHGs?=
=?us-ascii?Q?Xh5DsPTf6HpNurFgpApnv8phBzNl4I0gdIOR2wmFQYXKFKAIyAExm4lcmHxW?=
=?us-ascii?Q?F4bKctlB5ZYRSQAkzcm3bghRA4/MT5JfTmQn4UhBrkaGVpraomXJSALgvvVn?=
=?us-ascii?Q?spadU80DcBkn27ajadNwiK10vPhcVBg1auo/Hm4GQhBuPwatFuipYvlARrVL?=
=?us-ascii?Q?a2zTNKonMRHLf99MdCRTwvHSB10UgD6JdbMC8MWUG/9O0jVeX17fiBtRpUPI?=
=?us-ascii?Q?PjNiIMKLFUruw7ZE0+m+iQP7y8EM9GphsdgDN4PIrGWItRInNnGjuBaWqOmy?=
=?us-ascii?Q?hBYpZow39iGDaaw1O/FGLNizXXMiLJpgu0ImuOZXxruepk27rnkY94wxsZmy?=
=?us-ascii?Q?Akhgy7iBMuR1COR2gP3GoNksxKdknZ6zqF085pYUvz3gV+OATM9vPjjyJIJY?=
=?us-ascii?Q?wmhenNS5pAUNhoHEhL13d8uWTiwr3NcaXsuDH/sGmwTmR6j598W+iFNJCQad?=
=?us-ascii?Q?Q/dY6MukrAHUslfX4QJGLsC17GmZFa/y8rZ1+kVzPy1vsHuqFvYSeuHDr3KL?=
=?us-ascii?Q?aJiOA2gPtaBmDC3YRRVKciMk0BmjaQJ2x61oNUYOWMYao6HTlwCI4HwspxHr?=
=?us-ascii?Q?NYJGvWhEji/KoBDoi+6bZPjz8qR37Ubfp8DqL2haH48X8MzSxnRZOGLWjMmP?=
=?us-ascii?Q?qdAXGacdpYLJeWs1ioWWfg+WBnYKSpmk8N+phBwQkB0/UfwoxH2eMGexHYOy?=
=?us-ascii?Q?9asE6cnV/XeNRnzWzyYjOq06mH7iOnhrBrqKT4MqZBTfKNd2W1/o0blJ9ZDJ?=
=?us-ascii?Q?bbAyHOObeyBlF4WGaH8DYHGIdV34nuTDp2mea8ir1WLGDqbNDoOyHDvMAGi+?=
=?us-ascii?Q?9LahxvhUINm/fg1oFJd/FFhCpyOLqHevQJUiLQoN2LzcCnH9mWtJAfXCHS+R?=
=?us-ascii?Q?jjXFJ4LEKOgqVIbha/91vgbhnnego3pDBcy2cKPiNqKOmGBZLjH/NfvemrPd?=
=?us-ascii?Q?sQUo2SreEQ5Pd3vMebXqr8kvQgbwW+eYPBBgaY4fjalvHN9P7OGTMXZCxqBX?=
=?us-ascii?Q?sYlaOVaLTEV2z5/xiQourOaUVH6iVIETQejhUgIPT9/choephWkWSRumk6TW?=
=?us-ascii?Q?U6t5gLJ/nCiw6ZYR6qHLjSahprYKiYE3lvcSNsoyoxU1zHalI0qmzMgMKCzF?=
=?us-ascii?Q?9+LFM7xMgU3cxw5YCX/JBECiX7/72mzL/LkXZRj1GSdkGAK4TSyU3ZYwZ8sD?=
=?us-ascii?Q?vrFmdwtfGEYm+Istf8PVKwq7Jo/viIpSJkE7VKZG0NLpsoLUx1dUTKdBsngQ?=
=?us-ascii?Q?ePLgm7ZEdXjcxayb8U7YATaspHB/eOYhsIXkCtZu/5QoGQCF5r8l5/rCd8jc?=
=?us-ascii?Q?lXhctTuJGd66f0vHGvQp7/JeuA1zzpUHQmUWnsb3VQZE7Nr+evYwLH2na5wZ?=
=?us-ascii?Q?+LSTk1Y+gNZIAiw/zv9abClAl6MREA2hyXk77775hprX9kJJNzfVDuBDb9S6?=
=?us-ascii?Q?nzoRhKW4fYQxzQiuN9lbs7i+gFQlIh9L7nrEwVb+OMkFpa0Mobw1M4lPGkCf?=
=?us-ascii?Q?kowiVvOA3vrNdIDO9rXaua3W2/EI8gMACvIxn4jZsWBBmTPIyht9A17W7nly?=
=?us-ascii?Q?7ae7KKMJ6JidMrPbl+tJ2OklfPbJ250+L4Wh1jNniHfEcE7Fbc01s9MniBvE?=
=?us-ascii?Q?3zU78g=3D=3D?=
X-OriginatorOrg: virtuozzo.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 73b698bf-c988-4fc6-b3c1-08dda4e0a5b3
X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9003.eurprd08.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 09:58:11.9929
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: hMrmOIuuwZCduQ/oR47hB9HGJT0aLX61mCEWwjeishCAtppG8IJS0zLRas3HeJ9384gHvi0/vqNdK/sA+mD3kLJHWMuVMxSi9zi/c7hVxxQ=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5369
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This is intended to easily detect irq spinlock self-deadlocks like:

spin_lock_irq(A);
spin_lock_irq(B);
spin_unlock_irq(B);
IRQ {
spin_lock(A); <- deadlocks
spin_unlock(A);
}
spin_unlock_irq(A);

Recently we saw this kind of deadlock on our partner's node:

PID: 408 TASK: ffff8eee0870ca00 CPU: 36 COMMAND: "kworker/36:1H"
#0 [fffffe3861831e60] crash_nmi_callback at ffffffff97269e31
#1 [fffffe3861831e68] nmi_handle at ffffffff972300bb
#2 [fffffe3861831eb0] default_do_nmi at ffffffff97e9e000
#3 [fffffe3861831ed0] exc_nmi at ffffffff97e9e211
#4 [fffffe3861831ef0] end_repeat_nmi at ffffffff98001639
[exception RIP: native_queued_spin_lock_slowpath+638]
RIP: ffffffff97eb31ae RSP: ffffb1c8cd2a4d40 RFLAGS: 00000046
RAX: 0000000000000000 RBX: ffff8f2dffb34780 RCX: 0000000000940000
RDX: 000000000000002a RSI: 0000000000ac0000 RDI: ffff8eaed4eb81c0
RBP: ffff8eaed4eb81c0 R8: 0000000000000000 R9: ffff8f2dffaf3438
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000024 R14: 0000000000000000 R15: ffffd1c8bfb24b80
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
--- <NMI exception stack> ---
#5 [ffffb1c8cd2a4d40] native_queued_spin_lock_slowpath at ffffffff97eb31ae
#6 [ffffb1c8cd2a4d60] _raw_spin_lock_irqsave at ffffffff97eb2730
#7 [ffffb1c8cd2a4d70] __wake_up at ffffffff9737c02d
#8 [ffffb1c8cd2a4da0] sbitmap_queue_wake_up at ffffffff9786c74d
#9 [ffffb1c8cd2a4dc8] sbitmap_queue_clear at ffffffff9786cc97
--- <IRQ stack> ---
[exception RIP: _raw_spin_unlock_irq+20]
RIP: ffffffff97eb2e84 RSP: ffffb1c8cd90fd18 RFLAGS: 00000283
RAX: 0000000000000001 RBX: ffff8eafb68efb40 RCX: 0000000000000001
RDX: 0000000000000008 RSI: 0000000000000061 RDI: ffff8eafb06c3c70
RBP: ffff8eee7af43000 R8: ffff8eaed4eb81c8 R9: ffff8eaed4eb81c8
R10: 0000000000000008 R11: 0000000000000008 R12: 0000000000000000
R13: ffff8eafb06c3bd0 R14: ffff8eafb06c3bc0 R15: ffff8eaed4eb81c0
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018

Luckily it was already fixed in mainstream by:
commit b313a8c83551 ("block: Fix lockdep warning in blk_mq_mark_tag_wait")

Currently if we are unlucky we may miss such a deadlock on our testing
system as it is racy and it depends on the specific interrupt handler
appearing at the right place and at the right time. So this patch tries
to detect the problem despite the absence of the interrupt.

If we see spin_lock_irq under interrupts already disabled we can assume
that it has paired spin_unlock_irq which would reenable interrupts where
they should not be reenabled. So we report a warning for it.

Same thing on spin_unlock_irq even if we were lucky and there was no
deadlock let's report if interrupts were enabled.

Let's make this functionality catch one problem and then be disabled, to
prevent from spamming kernel log with warnings. Also let's add sysctl
kernel.debug_spin_lock_irq_with_disabled_interrupts to reenable it if
needed. Also let's add a by default enabled configuration option
DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT, in case we will
need this on boot.

Yes Lockdep can detect that, if it sees both the interrupt stack and the
regular stack where we can get into interrupt with spinlock held. But
with this approach we can detect the problem even without ever getting
into interrupt stack. And also this functionality seems to be more
lightweight then Lockdep as it does not need to maintain lock dependency
graph.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx>

--
Tested with https://github.com/Snorch/spinlock-irq-test-module.
---
include/linux/spinlock.h | 21 +++++++++++++++++++++
kernel/locking/spinlock.c | 6 ++++++
kernel/sysctl.c | 9 +++++++++
lib/Kconfig.debug | 12 ++++++++++++
4 files changed, 48 insertions(+)

diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index d3561c4a080e..b8ebccaa5062 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -371,8 +371,21 @@ do { \
raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock); \
} while (0)

+#ifdef CONFIG_DEBUG_SPINLOCK
+DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT,
+ debug_spin_lock_irq_with_disabled_interrupts);
+#endif
+
static __always_inline void spin_lock_irq(spinlock_t *lock)
{
+#ifdef CONFIG_DEBUG_SPINLOCK
+ if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
+ if (raw_irqs_disabled()) {
+ static_branch_disable(&debug_spin_lock_irq_with_disabled_interrupts);
+ WARN(1, "spin_lock_irq() called with irqs disabled!\n");
+ }
+ }
+#endif
raw_spin_lock_irq(&lock->rlock);
}

@@ -398,6 +411,14 @@ static __always_inline void spin_unlock_bh(spinlock_t *lock)

static __always_inline void spin_unlock_irq(spinlock_t *lock)
{
+#ifdef CONFIG_DEBUG_SPINLOCK
+ if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
+ if (!raw_irqs_disabled()) {
+ static_branch_disable(&debug_spin_lock_irq_with_disabled_interrupts);
+ WARN(1, "spin_unlock_irq() called with irqs enabled!\n");
+ }
+ }
+#endif
raw_spin_unlock_irq(&lock->rlock);
}

diff --git a/kernel/locking/spinlock.c b/kernel/locking/spinlock.c
index 7685defd7c52..6ec4a788f53c 100644
--- a/kernel/locking/spinlock.c
+++ b/kernel/locking/spinlock.c
@@ -22,6 +22,12 @@
#include <linux/debug_locks.h>
#include <linux/export.h>

+#ifdef CONFIG_DEBUG_SPINLOCK
+DEFINE_STATIC_KEY_MAYBE(CONFIG_DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT,
+ debug_spin_lock_irq_with_disabled_interrupts);
+EXPORT_SYMBOL(debug_spin_lock_irq_with_disabled_interrupts);
+#endif
+
#ifdef CONFIG_MMIOWB
#ifndef arch_mmiowb_state
DEFINE_PER_CPU(struct mmiowb_state, __mmiowb_state);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 9b4f0cff76ea..1e3cca2e3c8f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -50,6 +50,7 @@
#include <linux/sched/sysctl.h>
#include <linux/mount.h>
#include <linux/pid.h>
+#include <linux/spinlock.h>

#include "../lib/kstrtox.h"

@@ -1758,6 +1759,14 @@ static const struct ctl_table kern_table[] = {
.extra2 = SYSCTL_INT_MAX,
},
#endif
+#ifdef CONFIG_DEBUG_SPINLOCK
+ {
+ .procname = "debug_spin_lock_irq_with_disabled_interrupts",
+ .data = &debug_spin_lock_irq_with_disabled_interrupts,
+ .mode = 0644,
+ .proc_handler = proc_do_static_key,
+ },
+#endif
};

int __init sysctl_init_bases(void)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index ebe33181b6e6..c4834f4c9d51 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1465,6 +1465,18 @@ config DEBUG_SPINLOCK
best used in conjunction with the NMI watchdog so that spinlock
deadlocks are also debuggable.

+config DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT
+ bool "Detect spin_(un)lock_irq() call with disabled(enabled) interrupts"
+ depends on DEBUG_SPINLOCK
+ help
+ Say Y here to detect spin_lock_irq() and spin_unlock_irq() calls
+ with disabled (enabled) interrupts. This helps detecting bugs
+ where the code is not using the right locking primitives. E.g.
+ using spin_lock_irq() twice in a row (on different locks). And thus
+ code can reenable interrupts where they should be disabled and lead
+ to deadlock.
+ Say N if you are unsure.
+
config DEBUG_MUTEXES
bool "Mutex debugging: basic checks"
depends on DEBUG_KERNEL && !PREEMPT_RT
--
2.49.0



Return-Path: <linux-kernel+bounces-675575-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 32E9D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:59:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C373A1885C8D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:59:04 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 661CB2868AF;
Fri, 6 Jun 2025 09:58:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XDKFGZnH"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14])
(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 A7261286413;
Fri, 6 Jun 2025 09:58:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203919; cv=none; b=frIPdbAAvPFDszYfDLZH0hZxT9yRmhimctxvSw6YulHFEOY9y1iNs6+w3999Gub/HwwLrugDhqhnUQEW/CseGx3codT/Jg8hJ7nCXIuCgc9qq3UJhmekd6jYaUIv7dIWgI41Q0UGDHffrs88LyKclm3aBO8AF6aRAwkhNjWofPs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203919; c=relaxed/simple;
bh=U95hSfjSxKU8Mrr+Q+iu2SL32xjHNdq6Oy0UV7wpoEI=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=UxirZDsRZef3bWtBaAIC848hpoHpMNDCvKiECTnid4v0X0Irt1tgSxKOi3B1z44ZKjpVibgqTCiJcAbYvyy23s21/Sy8DWl6mSmfLVSlYyf3J6BSwBwWdX2GOTKOUb+B1/qCpvcKALtqPHQmxw/Y0Hv+cFOeKaL6RANjUFyOpqU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XDKFGZnH; arc=none smtp.client-ip=198.175.65.14
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749203918; x=1780739918;
h=date:from:to:cc:subject:message-id:references:
mime-version:in-reply-to;
bh=U95hSfjSxKU8Mrr+Q+iu2SL32xjHNdq6Oy0UV7wpoEI=;
b=XDKFGZnHWekomi6BvUkD3Gj89I6j3Ht7JdMG6dLoFMNiVfYDPZmeFpZE
WwHCr4XO0TW2vwx9cAQbJXKwzCcHaDScc9g6FPV8K4c7Zm+osO+wQdlpH
Yt3vaK6biLOVFn5ifB5oWGcJc5kkmukFcOFkraP0yzGcZQIBtBmvW6daP
2+P6Od8sax7pz+CRPbmJhylZLvPUKFz4VZMfQvs9z0LBgpskXdhK7KVBt
Y8VliAwmINahEmNdJ/FAzegrquVPFEeYoEuiOt3aQ9p+UdikWrMIWlRj+
ihY31/cgtOhj3b5mRB5+qyW1zwaYix/1j59yfQPNiVKtshO31CAj8jILY
g==;
X-CSE-ConnectionGUID: LACeQ9bOSOWgIwWLUKZA9Q==
X-CSE-MsgGUID: YFdnrZ54ToSi/V8D/tdWyA==
X-IronPort-AV: E=McAfee;i="6800,10657,11455"; a="55158102"
X-IronPort-AV: E=Sophos;i="6.16,214,1744095600";
d="scan'208";a="55158102"
Received: from orviesa008.jf.intel.com ([10.64.159.148])
by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 02:58:37 -0700
X-CSE-ConnectionGUID: ybNLIoauTK6E6oM5rpJACA==
X-CSE-MsgGUID: rB5H5TO0RbSYvHrgesocLw==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,214,1744095600";
d="scan'208";a="146756643"
Received: from lkp-server01.sh.intel.com (HELO e8142ee1dce2) ([10.239.97.150])
by orviesa008.jf.intel.com with ESMTP; 06 Jun 2025 02:58:34 -0700
Received: from kbuild by e8142ee1dce2 with local (Exim 4.96)
(envelope-from <lkp@xxxxxxxxx>)
id 1uNTqJ-0004u5-11;
Fri, 06 Jun 2025 09:58:31 +0000
Date: Fri, 6 Jun 2025 17:58:21 +0800
From: kernel test robot <lkp@xxxxxxxxx>
To: Dionna Glaze <dionnaglaze@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: llvm@xxxxxxxxxxxxxxx, oe-kbuild-all@xxxxxxxxxxxxxxx,
linux-coco@xxxxxxxxxxxxxxx, Dionna Glaze <dionnaglaze@xxxxxxxxxx>,
Thomas Lendacky <Thomas.Lendacky@xxxxxxx>,
Paolo Bonzini <pbonzini@xxxxxxxxxx>, Joerg Roedel <jroedel@xxxxxxx>,
Peter Gonda <pgonda@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>,
Sean Christopherson <seanjc@xxxxxxxxxx>
Subject: Re: [PATCH v6 1/2] kvm: sev: Add SEV-SNP guest request throttling
Message-ID: <202506061922.q7OljdiN-lkp@xxxxxxxxx>
References: <20250605150236.3775954-2-dionnaglaze@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250605150236.3775954-2-dionnaglaze@xxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Dionna,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mst-vhost/linux-next]
[also build test WARNING on linus/master v6.15 next-20250606]
[cannot apply to kvm/queue kvm/next kvm/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Dionna-Glaze/kvm-sev-Add-SEV-SNP-guest-request-throttling/20250605-230536
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link: https://lore.kernel.org/r/20250605150236.3775954-2-dionnaglaze%40google.com
patch subject: [PATCH v6 1/2] kvm: sev: Add SEV-SNP guest request throttling
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250606/202506061922.q7OljdiN-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
rustc: rustc 1.78.0 (9b00956e5 2024-04-29)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/202506061922.q7OljdiN-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506061922.q7OljdiN-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/svm/sev.c:376:6: warning: variable 'throttle_interval' set but not used [-Wunused-but-set-variable]
376 | u64 throttle_interval;
| ^
1 warning generated.


vim +/throttle_interval +376 arch/x86/kvm/svm/sev.c

334
335 /*
336 * This sets up bounce buffers/firmware pages to handle SNP Guest Request
337 * messages (e.g. attestation requests). See "SNP Guest Request" in the GHCB
338 * 2.0 specification for more details.
339 *
340 * Technically, when an SNP Guest Request is issued, the guest will provide its
341 * own request/response pages, which could in theory be passed along directly
342 * to firmware rather than using bounce pages. However, these pages would need
343 * special care:
344 *
345 * - Both pages are from shared guest memory, so they need to be protected
346 * from migration/etc. occurring while firmware reads/writes to them. At a
347 * minimum, this requires elevating the ref counts and potentially needing
348 * an explicit pinning of the memory. This places additional restrictions
349 * on what type of memory backends userspace can use for shared guest
350 * memory since there is some reliance on using refcounted pages.
351 *
352 * - The response page needs to be switched to Firmware-owned[1] state
353 * before the firmware can write to it, which can lead to potential
354 * host RMP #PFs if the guest is misbehaved and hands the host a
355 * guest page that KVM might write to for other reasons (e.g. virtio
356 * buffers/etc.).
357 *
358 * Both of these issues can be avoided completely by using separately-allocated
359 * bounce pages for both the request/response pages and passing those to
360 * firmware instead. So that's what is being set up here.
361 *
362 * Guest requests rely on message sequence numbers to ensure requests are
363 * issued to firmware in the order the guest issues them, so concurrent guest
364 * requests generally shouldn't happen. But a misbehaved guest could issue
365 * concurrent guest requests in theory, so a mutex is used to serialize
366 * access to the bounce buffers.
367 *
368 * [1] See the "Page States" section of the SEV-SNP Firmware ABI for more
369 * details on Firmware-owned pages, along with "RMP and VMPL Access Checks"
370 * in the APM for details on the related RMP restrictions.
371 */
372 static int snp_guest_req_init(struct kvm *kvm)
373 {
374 struct kvm_sev_info *sev = to_kvm_sev_info(kvm);
375 struct page *req_page;
> 376 u64 throttle_interval;
377
378 req_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
379 if (!req_page)
380 return -ENOMEM;
381
382 sev->guest_resp_buf = snp_alloc_firmware_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
383 if (!sev->guest_resp_buf) {
384 __free_page(req_page);
385 return -EIO;
386 }
387
388 sev->guest_req_buf = page_address(req_page);
389 mutex_init(&sev->guest_req_mutex);
390
391 throttle_interval = ((u64)sev_snp_request_ratelimit_khz * HZ) / HZ_PER_KHZ;
392 ratelimit_state_init(&sev->snp_guest_msg_rs, sev_snp_request_ratelimit_khz, 1);
393
394 return 0;
395 }
396

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Return-Path: <linux-kernel+bounces-675576-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B416F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 05:59:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1FCA67A9383
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:58:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EDEA628643F;
Fri, 6 Jun 2025 09:59:36 +0000 (UTC)
Received: from mta20.hihonor.com (mta20.honor.com [81.70.206.69])
(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 0C5942857EF;
Fri, 6 Jun 2025 09:59:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.70.206.69
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749203975; cv=none; b=okE9DE3jRTjLQ48XzuaH/Fz1jYoVMIYsDEtemKhi+AyV3LCh+C8yoFiPSDg66htI8oqSotUEay0L4FckCZ6KqjTVHA4qV/CYCqm5W0H1xARW2J/lWVwaTJ2jR5DSXfZB6jDwg5Vx2paSixGmeufDrXMXc66OQffdwj/nI66nzSE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749203975; c=relaxed/simple;
bh=sTYLlWK7D9rHYnaH7Ko2SXSb+sPWa/ys/gbyd7C5Zz8=;
h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
Content-Type:MIME-Version; b=OC1ND8gPzFiF0EJ5oyMhH4ib4fgdi5ds3FvDMxehKmnOSz0O9brt8yV5zceQbsxNZ5EZdJkK5DCDt79FF+9ESvZsMasCYMbCSYFi4H5c3MK4aij9lmo4DRaJOgwqVMXax0QqYjnh9mzEO6RhUuGkfgXFapmx6N7xoASA2n1xC5o=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=honor.com; spf=pass smtp.mailfrom=honor.com; arc=none smtp.client-ip=81.70.206.69
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=honor.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=honor.com
Received: from w001.hihonor.com (unknown [10.68.25.235])
by mta20.hihonor.com (SkyGuard) with ESMTPS id 4bDGtg6WhnzYm3Kr;
Fri, 6 Jun 2025 17:56:43 +0800 (CST)
Received: from a014.hihonor.com (10.68.16.227) by w001.hihonor.com
(10.68.25.235) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 6 Jun
2025 17:59:02 +0800
Received: from a010.hihonor.com (10.68.16.52) by a014.hihonor.com
(10.68.16.227) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 6 Jun
2025 17:59:02 +0800
Received: from a010.hihonor.com ([fe80::7127:3946:32c7:6e]) by
a010.hihonor.com ([fe80::7127:3946:32c7:6e%14]) with mapi id 15.02.1544.011;
Fri, 6 Jun 2025 17:59:02 +0800
From: wangtao <tao.wangtao@xxxxxxxxx>
To: Christoph Hellwig <hch@xxxxxxxxxxxxx>, =?iso-8859-1?Q?Christian_K=F6nig?=
<christian.koenig@xxxxxxx>
CC: "sumit.semwal@xxxxxxxxxx" <sumit.semwal@xxxxxxxxxx>, "kraxel@xxxxxxxxxx"
<kraxel@xxxxxxxxxx>, "vivek.kasireddy@xxxxxxxxx" <vivek.kasireddy@xxxxxxxxx>,
"viro@xxxxxxxxxxxxxxxxxx" <viro@xxxxxxxxxxxxxxxxxx>, "brauner@xxxxxxxxxx"
<brauner@xxxxxxxxxx>, "hughd@xxxxxxxxxx" <hughd@xxxxxxxxxx>,
"akpm@xxxxxxxxxxxxxxxxxxxx" <akpm@xxxxxxxxxxxxxxxxxxxx>, "amir73il@xxxxxxxxx"
<amir73il@xxxxxxxxx>, "benjamin.gaignard@xxxxxxxxxxxxx"
<benjamin.gaignard@xxxxxxxxxxxxx>, "Brian.Starkey@xxxxxxx"
<Brian.Starkey@xxxxxxx>, "jstultz@xxxxxxxxxx" <jstultz@xxxxxxxxxx>,
"tjmercier@xxxxxxxxxx" <tjmercier@xxxxxxxxxx>, "jack@xxxxxxx" <jack@xxxxxxx>,
"baolin.wang@xxxxxxxxxxxxxxxxx" <baolin.wang@xxxxxxxxxxxxxxxxx>,
"linux-media@xxxxxxxxxxxxxxx" <linux-media@xxxxxxxxxxxxxxx>,
"dri-devel@xxxxxxxxxxxxxxxxxxxxx" <dri-devel@xxxxxxxxxxxxxxxxxxxxx>,
"linaro-mm-sig@xxxxxxxxxxxxxxxx" <linaro-mm-sig@xxxxxxxxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,
"linux-fsdevel@xxxxxxxxxxxxxxx" <linux-fsdevel@xxxxxxxxxxxxxxx>,
"linux-mm@xxxxxxxxx" <linux-mm@xxxxxxxxx>, "wangbintian(BintianWang)"
<bintian.wang@xxxxxxxxx>, yipengxiang <yipengxiang@xxxxxxxxx>, liulu 00013167
<liulu.liu@xxxxxxxxx>, hanfeng 00012985 <feng.han@xxxxxxxxx>
Subject: RE: [PATCH v4 0/4] Implement dmabuf direct I/O via copy_file_range
Thread-Topic: [PATCH v4 0/4] Implement dmabuf direct I/O via copy_file_range
Thread-Index: AQHb1G1ol+FT389RFkuW+lwB3adoKrPw4BKAgAADywCAAAF8AIAAEGgAgAAC0oCAABhEAIAAAd6AgATEk2A=
Date: Fri, 6 Jun 2025 09:59:02 +0000
Message-ID: <d5d3567d956440c39cb8d2851950f412@xxxxxxxxx>
References: <20250603095245.17478-1-tao.wangtao@xxxxxxxxx>
<aD7x_b0hVyvZDUsl@xxxxxxxxxxxxx>
<09c8fb7c-a337-4813-9f44-3a538c4ee8b1@xxxxxxx>
<aD72alIxu718uri4@xxxxxxxxxxxxx>
<924ac01f-b86b-4a03-b563-878fa7736712@xxxxxxx>
<aD8Gi9ShWDEYqWjB@xxxxxxxxxxxxx>
<d1937343-5fc3-4450-b31a-d45b6f5cfc16@xxxxxxx>
<aD8cd137bWPALs4u@xxxxxxxxxxxxx>
In-Reply-To: <aD8cd137bWPALs4u@xxxxxxxxxxxxx>
Accept-Language: zh-CN, en-US
Content-Language: zh-CN
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



> -----Original Message-----
> From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Sent: Wednesday, June 4, 2025 12:02 AM
> To: Christian K=F6nig <christian.koenig@xxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>; wangtao
> <tao.wangtao@xxxxxxxxx>; sumit.semwal@xxxxxxxxxx; kraxel@xxxxxxxxxx;
> vivek.kasireddy@xxxxxxxxx; viro@xxxxxxxxxxxxxxxxxx; brauner@xxxxxxxxxx;
> hughd@xxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; amir73il@xxxxxxxxx;
> benjamin.gaignard@xxxxxxxxxxxxx; Brian.Starkey@xxxxxxx;
> jstultz@xxxxxxxxxx; tjmercier@xxxxxxxxxx; jack@xxxxxxx;
> baolin.wang@xxxxxxxxxxxxxxxxx; linux-media@xxxxxxxxxxxxxxx; dri-
> devel@xxxxxxxxxxxxxxxxxxxxx; linaro-mm-sig@xxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; linux-fsdevel@xxxxxxxxxxxxxxx; linux-
> mm@xxxxxxxxx; wangbintian(BintianWang) <bintian.wang@xxxxxxxxx>;
> yipengxiang <yipengxiang@xxxxxxxxx>; liulu 00013167
> <liulu.liu@xxxxxxxxx>; hanfeng 00012985 <feng.han@xxxxxxxxx>
> Subject: Re: [PATCH v4 0/4] Implement dmabuf direct I/O via
> copy_file_range
>=20
> On Tue, Jun 03, 2025 at 05:55:18PM +0200, Christian K=F6nig wrote:
> > On 6/3/25 16:28, Christoph Hellwig wrote:
> > > On Tue, Jun 03, 2025 at 04:18:22PM +0200, Christian K=F6nig wrote:
> > >>> Does it matter compared to the I/O in this case?
> > >>
> > >> It unfortunately does, see the numbers on patch 3 and 4.
> > >
> > > That's kinda weird. Why does the page table lookup tage so much
> > > time compared to normal I/O?
> >
> > I have absolutely no idea. It's rather surprising for me as well.
> >
> > The user seems to have a rather slow CPU paired with fast I/O, but it s=
till
> looks rather fishy to me.
> >
> > Additional to that allocating memory through memfd_create() is *much*
> slower on that box than through dma-buf-heaps (which basically just uses
> GFP and an array).
>=20
> Can someone try to reproduce these results on a normal system before
> we're building infrastructure based on these numbers?

Here's my test program. If anyone's interested,
please help test it?

Regards,
Wangtao.

[PATCH] Add dmabuf direct I/O zero-copy test program

Compare latency and throughput of file read/write for
memfd, udmabuf+memfd, udmabuf, and dmabuf buffers.
memfd supports buffer I/O and direct I/O via read/write,
sendfile, and splice user APIs.
udmabuf/dmabuf only support buffer I/O via read/write,
lacking direct I/O, sendfile, and splice support.
Previous patch added dmabuf's copy_file_range callback,
enabling buffer/direct I/O file copies for udmabuf/dmabuf.
u+memfd represents using memfd-created udmabuf with memfd's
user APIs for file copying.

usage: dmabuf-dio [file_path] [size_MB]

Signed-off-by: wangtao <tao.wangtao@xxxxxxxxx>
---
tools/testing/selftests/dmabuf-heaps/Makefile | 1 +
.../selftests/dmabuf-heaps/dmabuf-dio.c | 617 ++++++++++++++++++
2 files changed, 618 insertions(+)
create mode 100644 tools/testing/selftests/dmabuf-heaps/dmabuf-dio.c

diff --git a/tools/testing/selftests/dmabuf-heaps/Makefile b/tools/testing/=
selftests/dmabuf-heaps/Makefile
index 9e7e158d5fa3..beb6b3e55e17 100644
--- a/tools/testing/selftests/dmabuf-heaps/Makefile
+++ b/tools/testing/selftests/dmabuf-heaps/Makefile
@@ -2,5 +2,6 @@
CFLAGS +=3D -static -O3 -Wl,-no-as-needed -Wall $(KHDR_INCLUDES)
=20
TEST_GEN_PROGS =3D dmabuf-heap
+TEST_GEN_PROGS +=3D dmabuf-dio
=20
include ../lib.mk
diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-dio.c b/tools/test=
ing/selftests/dmabuf-heaps/dmabuf-dio.c
new file mode 100644
index 000000000000..eae902a27f29
--- /dev/null
+++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-dio.c
@@ -0,0 +1,617 @@
+#include <linux/dma-heap.h>
+#include <linux/dma-buf.h>
+#include <linux/udmabuf.h>
+#include <sys/mman.h>
+#include <sys/sendfile.h>
+#include <sys/ioctl.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+#include <time.h>
+#include <errno.h>
+
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(exp) ({ \
+ __typeof__(exp) _rc; \
+ do { \
+ _rc =3D (exp); \
+ } while (_rc =3D=3D -1 && errno =3D=3D EINTR); \
+ _rc; })
+#endif
+
+#if 1
+int memfd_create(const char *name, unsigned flags)
+{
+ return syscall(__NR_memfd_create, name, flags);
+}
+
+ssize_t copy_file_range(int fd_in, off_t *off_in, int fd_out, off_t *off_o=
ut,
+ size_t len, unsigned flags)
+{
+ return syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out, l=
en, flags);
+}
+#endif
+
+int alloc_memfd(size_t size)
+{
+ int memfd =3D memfd_create("ubuf", MFD_ALLOW_SEALING);
+ if (memfd < 0)
+ return -1;
+
+ int ret =3D fcntl(memfd, F_ADD_SEALS, F_SEAL_SHRINK);
+ if (ret < 0)
+ return -1;
+ ret =3D TEMP_FAILURE_RETRY(ftruncate(memfd, size));
+ if (ret < 0)
+ return -1;
+ return memfd;
+}
+
+int alloc_udmabuf(size_t size, int memfd)
+{
+ static int udev_fd =3D -1;
+ if (udev_fd < 0) {
+ udev_fd =3D open("/dev/udmabuf", O_RDONLY);
+ if (udev_fd < 0)
+ return -1;
+ }
+
+ struct udmabuf_create uc =3D {0};
+ uc.memfd =3D memfd;
+ uc.offset =3D 0;
+ uc.size =3D size;
+ int buf_fd =3D TEMP_FAILURE_RETRY(ioctl(udev_fd, UDMABUF_CREATE, &uc))=
;
+ if (buf_fd < 0)
+ return -1;
+
+ return buf_fd;
+}
+
+int alloc_dmabuf(size_t size)
+{
+ static int heap_fd =3D -1;
+
+ struct dma_heap_allocation_data heap_data =3D { 0 };
+ heap_data.len =3D size; // length of data to be allocated in bytes
+ heap_data.fd_flags =3D O_RDWR | O_CLOEXEC; // permissions for the mem=
ory to be allocated
+
+ if (heap_fd < 0) {
+ heap_fd =3D open("/dev/dma_heap/system", O_RDONLY);
+ if (heap_fd < 0)
+ return -1;
+ }
+
+ int ret =3D TEMP_FAILURE_RETRY(ioctl(heap_fd, DMA_HEAP_IOCTL_ALLOC, &h=
eap_data));
+ if (ret < 0) {
+ return -1;
+ }
+ if (heap_data.fd < 0)
+ return -1;
+
+ return heap_data.fd;
+}
+
+static inline long times_us_duration(struct timespec *ts_start, struct tim=
espec *ts_end)
+{
+ long long start =3D ts_start->tv_sec * 1000000 + ts_start->tv_nsec / 1=
000;
+ long long end =3D ts_end->tv_sec * 1000000 + ts_end->tv_nsec / 1000;
+ return end - start;
+}
+
+static inline long time_us2ms(long us)
+{
+ return (us + 1000 - 1) / 1000;
+}
+
+void drop_pagecaches(int file_fd, loff_t offset, size_t len)
+{
+ if (file_fd >=3D 0 && len > 0) {
+ posix_fadvise(file_fd, offset, len, POSIX_FADV_DONTNEED);
+ return;
+ }
+
+ int fd =3D open("/proc/sys/vm/drop_caches", O_WRONLY | O_CLOEXEC);
+ if (fd < 0) {
+ printf("open drop_caches failed %d\n", errno);
+ return;
+ }
+ write(fd, "3", 1);
+ close(fd);
+}
+
+const size_t SIZ_MB =3D 1024 * 1024;
+const size_t DMABUF_SIZE_MAX =3D SIZ_MB * 32;
+
+static inline unsigned char test_data_value(unsigned int val)
+{
+ return val % 253;
+}
+
+void test_fill_data(unsigned char* ptr, unsigned int val, size_t sz, bool =
fast)
+{
+ if (sz > 0 && fast) {
+ ptr[0] =3D test_data_value(val);
+ ptr[sz / 2] =3D test_data_value(val + sz / 2);
+ ptr[sz - 1] =3D test_data_value(val + sz - 1);
+ return;
+ }
+ for (size_t i =3D 0; i < sz; i++) {
+ ptr[i] =3D test_data_value(val + i);
+ }
+}
+
+bool test_check_data(unsigned char* ptr, unsigned int val, size_t sz, bool=
fast)
+{
+ if (sz > 0 && fast) {
+ if (ptr[0] !=3D test_data_value(val))
+ return false;
+ if (ptr[sz / 2] !=3D test_data_value(val + sz / 2))
+ return false;
+ if (ptr[sz - 1] !=3D test_data_value(val + sz - 1))
+ return false;
+ return true;
+ }
+ for (size_t i =3D 0; i < sz; i++) {
+ if (ptr[i] !=3D test_data_value(val + i))
+ return false;
+ }
+ return true;
+}
+
+enum mem_buf_type {
+ BUF_MEMFD,
+ BUF_UDMA_MEMFD,
+ BUF_UDMABUF,
+ BUF_DMABUF,
+ BUF_TYPE_MAX,
+};
+
+enum copy_io_type {
+ IO_MAP_READ_WRITE,
+ IO_SENDFILE,
+ IO_SPLICE,
+ IO_COPY_FILE_RANGE,
+ IO_TYPE_MAX,
+};
+
+static const char *mem_buf_type_descs[BUF_TYPE_MAX] =3D {
+ "memfd", "u+memfd", "udmabuf", "dmabuf",
+};
+
+static const char *io_type_descs[IO_TYPE_MAX] =3D {
+ "R/W", "sendfile", "splice", "c_f_r",
+};
+
+struct mem_buf_st {
+ enum mem_buf_type buf_type_;
+ int io_fd_;
+ int mem_fd_;
+ int buf_fd_;
+ size_t buf_len_;
+ unsigned char *buf_ptr_;
+};
+
+struct mem_buf_tc {
+ enum mem_buf_type buf_type_;
+ enum copy_io_type io_type_;
+ int file_fd_;
+ bool direct_io_;
+ size_t io_len_;
+ long times_create_;
+ long times_data_;
+ long times_io_;
+ long times_close_;
+};
+
+void membuf_deinit(struct mem_buf_st *membuf)
+{
+ if (membuf->buf_ptr_ !=3D NULL && membuf->buf_ptr_ !=3D MAP_FAILED)
+ munmap(membuf->buf_ptr_, membuf->buf_len_);
+ membuf->buf_ptr_ =3D NULL;
+ if (membuf->mem_fd_ > 0)
+ close(membuf->mem_fd_);
+ if (membuf->buf_fd_ > 0)
+ close(membuf->buf_fd_);
+ membuf->mem_fd_ =3D -1;
+ membuf->buf_fd_ =3D -1;
+}
+
+bool membuf_init(struct mem_buf_st *membuf, size_t len, enum mem_buf_type =
buf_type)
+{
+ int map_fd =3D -1;
+
+ membuf->mem_fd_ =3D -1;
+ membuf->buf_fd_ =3D -1;
+ membuf->buf_len_ =3D len;
+ membuf->buf_ptr_ =3D NULL;
+ if (buf_type <=3D BUF_UDMABUF) {
+ membuf->mem_fd_ =3D alloc_memfd(len);
+ if (membuf->mem_fd_ < 0) {
+ printf("alloc memfd %zd failed %d\n", len, errno);
+ return false;
+ }
+ map_fd =3D membuf->mem_fd_;
+ if (buf_type > BUF_MEMFD) {
+ membuf->buf_fd_ =3D alloc_udmabuf(len, membuf->mem_fd_);
+ if (membuf->buf_fd_ < 0) {
+ printf("alloc udmabuf %zd failed %d\n", len, errno);
+ return false;
+ }
+ if (buf_type =3D=3D BUF_UDMABUF)
+ map_fd =3D membuf->buf_fd_;
+ }
+ } else {
+ membuf->buf_fd_ =3D alloc_dmabuf(len);
+ if (membuf->buf_fd_ < 0) {
+ printf("alloc dmabuf %zd failed %d\n", len, errno);
+ return false;
+ }
+ map_fd =3D membuf->buf_fd_;
+ }
+ membuf->io_fd_ =3D map_fd;
+ membuf->buf_ptr_ =3D (unsigned char *)mmap(NULL, len,
+ PROT_READ | PROT_WRITE, MAP_SHARED, map_fd, 0);
+ if (membuf->buf_ptr_ =3D=3D MAP_FAILED) {
+ printf("fd %d map %zd failed %d\n", map_fd, len, errno);
+ membuf->buf_ptr_ =3D NULL;
+ return false;
+ }
+ return true;
+}
+
+ssize_t membuf_read_write(const struct mem_buf_st *membuf, int file_fd,
+ loff_t off, bool is_read)
+{
+ if (!membuf->buf_ptr_)
+ return -1;
+ lseek(file_fd, off, SEEK_SET);
+ if (is_read)
+ return read(file_fd, membuf->buf_ptr_, membuf->buf_len_);
+ else
+ return write(file_fd, membuf->buf_ptr_, membuf->buf_len_);
+}
+
+ssize_t membuf_sendfile(const struct mem_buf_st *membuf, int file_fd,
+ loff_t off, bool is_read)
+{
+ int mem_fd =3D membuf->io_fd_;
+ size_t buf_len =3D membuf->buf_len_;
+
+ if (mem_fd < 0)
+ return -__LINE__;
+
+ lseek(mem_fd, 0, SEEK_SET);
+ lseek(file_fd, off, SEEK_SET);
+ if (is_read)
+ return sendfile(mem_fd, file_fd, NULL, buf_len);
+ else
+ return sendfile(file_fd, mem_fd, NULL, buf_len);
+}
+
+ssize_t membuf_splice(const struct mem_buf_st *membuf, int file_fd,
+ loff_t off, bool is_read)
+{
+ size_t len =3D 0, out_len =3D 0, buf_len =3D membuf->buf_len_;
+ int mem_fd =3D membuf->io_fd_;
+ int fd_in =3D file_fd, fd_out =3D mem_fd;
+ ssize_t ret =3D 0;
+ static int s_pipe_fds[2] =3D { -1, -1};
+
+ if (mem_fd < 0)
+ return -__LINE__;
+
+ lseek(mem_fd, 0, SEEK_SET);
+ lseek(file_fd, off, SEEK_SET);
+ if (s_pipe_fds[0] < 0) {
+ const int pipe_size =3D SIZ_MB * 32;
+ int pipe_fds[2];
+ ret =3D pipe(pipe_fds);
+ if (ret < 0)
+ return -__LINE__;
+ ret =3D fcntl(pipe_fds[1], F_SETPIPE_SZ, pipe_size);
+ if (ret < 0)
+ return -__LINE__;
+ ret =3D fcntl(pipe_fds[0], F_GETPIPE_SZ, pipe_size);
+ if (ret !=3D pipe_size)
+ return -__LINE__;
+ s_pipe_fds[0] =3D pipe_fds[0];
+ s_pipe_fds[1] =3D pipe_fds[1];
+ }
+
+ if (!is_read) {
+ fd_in =3D mem_fd;
+ fd_out =3D file_fd;
+ }
+
+ while (buf_len > len) {
+ ret =3D splice(fd_in, NULL, s_pipe_fds[1], NULL, buf_len - len, SP=
LICE_F_NONBLOCK);
+ if (ret <=3D 0)
+ break;
+ len +=3D ret;
+ do {
+ ret =3D splice(s_pipe_fds[0], NULL, fd_out, NULL, len - out_le=
n, 0);
+ if (ret <=3D 0)
+ break;
+ out_len +=3D ret;
+ } while (out_len < len);
+ }
+ return out_len > 0 ? out_len : ret;
+}
+
+ssize_t membuf_cfr(const struct mem_buf_st *membuf, int file_fd, loff_t of=
f,
+ bool is_read)
+{
+ loff_t mem_pos =3D 0;
+ loff_t file_pos =3D off;
+ size_t out_len =3D 0, buf_len =3D membuf->buf_len_;
+ int mem_fd =3D membuf->io_fd_;
+ int fd_in =3D file_fd, fd_out =3D mem_fd;
+ loff_t pos_in =3D file_pos, pos_out =3D mem_pos;
+ ssize_t ret =3D 0;
+
+ if (mem_fd < 0)
+ return -__LINE__;
+
+ lseek(mem_fd, mem_pos, SEEK_SET);
+ lseek(file_fd, file_pos, SEEK_SET);
+
+ if (!is_read) {
+ fd_in =3D mem_fd;
+ fd_out =3D file_fd;
+ pos_in =3D mem_pos;
+ pos_out =3D file_pos;
+ }
+
+ while (buf_len > out_len) {
+ ret =3D copy_file_range(fd_in, &pos_in, fd_out, &pos_out, buf_len =
- out_len, 0);
+ if (ret <=3D 0)
+ break;
+ out_len +=3D ret;
+ }
+ return out_len > 0 ? out_len : ret;
+}
+
+ssize_t membuf_io(const struct mem_buf_st *membuf, int file_fd, loff_t off=
,
+ bool is_read, enum copy_io_type io_type)
+{
+ ssize_t ret =3D 0;
+ if (io_type =3D=3D IO_MAP_READ_WRITE) {
+ ret =3D membuf_read_write(membuf, file_fd, off, is_read);
+ } else if (io_type =3D=3D IO_SENDFILE) {
+ ret =3D membuf_sendfile(membuf, file_fd, off, is_read);
+ } else if (io_type =3D=3D IO_SPLICE) {
+ ret =3D membuf_splice(membuf, file_fd, off, is_read);
+ } else if (io_type =3D=3D IO_COPY_FILE_RANGE) {
+ ret =3D membuf_cfr(membuf, file_fd, off, is_read);
+ } else
+ return -1;
+ if (ret < 0)
+ printf("membuf_io io failed %d\n", errno);
+ return ret;
+}
+
+const char *membuf_tc_desc(const struct mem_buf_tc *tc)
+{
+ static char buf[32];
+ snprintf(buf, sizeof(buf), "%s %s %s", mem_buf_type_descs[tc->buf_type=
_],
+ tc->direct_io_ ? "direct" : "buffer", io_type_descs[tc->io_type_])=
;
+ return buf;
+}
+
+bool test_membuf(struct mem_buf_tc *tc, loff_t pos, size_t file_len,
+ size_t buf_siz, bool is_read, bool clean_pagecache=
s)
+{
+ loff_t off =3D pos, file_end =3D pos + file_len;
+ int file_fd =3D tc->file_fd_;
+ int i =3D 0, buf_num;
+ struct mem_buf_st *membufs;
+ struct timespec ts_start, ts_end;
+ ssize_t ret;
+
+ if (buf_siz > file_len)
+ buf_siz =3D file_len;
+ buf_num =3D (file_len + buf_siz - 1) / buf_siz;
+ membufs =3D (struct mem_buf_st *)malloc(sizeof(*membufs) * buf_num);
+ if (!membufs)
+ return false;
+
+ memset(membufs, 0, sizeof(*membufs) * buf_num);
+ drop_pagecaches(-1, 0, 0);
+ for (i =3D 0; i < buf_num && off < file_end; i++, off +=3D buf_siz) {
+ if (buf_siz > file_end - off)
+ buf_siz =3D file_end - off;
+
+ if (clean_pagecaches)
+ drop_pagecaches(file_fd, off, buf_siz);
+
+ clock_gettime(CLOCK_MONOTONIC, &ts_start);
+ if (!membuf_init(&membufs[i], buf_siz, tc->buf_type_)) {
+ printf("alloc %s %d failed\n", membuf_tc_desc(tc), i);
+ break;
+ }
+ clock_gettime(CLOCK_MONOTONIC, &ts_end);
+ tc->times_create_ +=3D times_us_duration(&ts_start, &ts_end);
+
+ clock_gettime(CLOCK_MONOTONIC, &ts_start);
+ if (!membufs[i].buf_ptr_) {
+ printf("map %s %d failed\n", membuf_tc_desc(tc), i);
+ break;
+ }
+ if (!is_read)
+ test_fill_data(membufs[i].buf_ptr_, off + 1, buf_siz, true);
+ clock_gettime(CLOCK_MONOTONIC, &ts_end);
+ tc->times_data_ +=3D times_us_duration(&ts_start, &ts_end);
+
+ clock_gettime(CLOCK_MONOTONIC, &ts_start);
+ ret =3D membuf_io(&membufs[i], file_fd, off, is_read, tc->io_type_=
);
+ if (ret < 0 || ret !=3D buf_siz) {
+ printf("membuf_io %s %d rw %zd ret %zd failed %d\n",
+ membuf_tc_desc(tc), i, buf_siz, ret, errno);
+ break;
+ }
+ clock_gettime(CLOCK_MONOTONIC, &ts_end);
+ tc->times_io_ +=3D times_us_duration(&ts_start, &ts_end);
+
+ clock_gettime(CLOCK_MONOTONIC, &ts_start);
+ if (!test_check_data(membufs[i].buf_ptr_, off + 1, buf_siz, true))=
{
+ printf("check data %s %d failed\n", membuf_tc_desc(tc), i);
+ break;
+ }
+ clock_gettime(CLOCK_MONOTONIC, &ts_end);
+ tc->times_data_ +=3D times_us_duration(&ts_start, &ts_end);
+
+ if (clean_pagecaches)
+ drop_pagecaches(file_fd, off, buf_siz);
+ }
+
+ clock_gettime(CLOCK_MONOTONIC, &ts_start);
+ for (i =3D 0; i < buf_num; i++) {
+ membuf_deinit(&membufs[i]);
+ }
+ clock_gettime(CLOCK_MONOTONIC, &ts_end);
+ tc->times_close_ +=3D times_us_duration(&ts_start, &ts_end);
+ drop_pagecaches(-1, 0, 0);
+ tc->io_len_ =3D off - pos;
+ return off - pos >=3D file_end;
+}
+
+bool prepare_init_file(int file_fd, loff_t off, size_t file_len)
+{
+ struct mem_buf_st membuf =3D {};
+ ssize_t ret;
+
+ ftruncate(file_fd, off + file_len);
+
+ if (!membuf_init(&membuf, file_len, BUF_MEMFD))
+ return false;
+
+ test_fill_data(membuf.buf_ptr_, off + 1, file_len, false);
+ ret =3D membuf_io(&membuf, file_fd, off, false, IO_MAP_READ_WRITE);
+ membuf_deinit(&membuf);
+
+ return ret >=3D file_len;
+}
+
+bool prepare_file(const char *filepath, loff_t off, size_t file_len)
+{
+ ssize_t file_end;
+ bool suc =3D true;
+ int flags =3D O_RDWR | O_CLOEXEC | O_LARGEFILE | O_CREAT;
+ int file_fd =3D open(filepath, flags, 0660);
+ if (file_fd < 0) {
+ printf("open %s failed %d\n", filepath, errno);
+ return false;
+ }
+
+ file_end =3D (size_t)lseek(file_fd, 0, SEEK_END);
+ if (file_end < off + file_len)
+ suc =3D prepare_init_file(file_fd, off, file_len);
+
+ close(file_fd);
+ return suc;
+}
+
+void test_membuf_cases(struct mem_buf_tc *test_cases, int test_count,
+ loff_t off, size_t file_len, size_t buf_siz,
+ bool is_read, bool clean_pagecaches)
+{
+ char title[64];
+ long file_MB =3D (file_len + SIZ_MB - 1) / SIZ_MB;
+ long buf_MB =3D (buf_siz + SIZ_MB - 1) / SIZ_MB;
+ long base_io_time, io_times;
+ long base_io_speed, io_speed;
+ struct mem_buf_tc *tc;
+ int n;
+
+ for (n =3D 0; n < test_count; n++) {
+ test_membuf(&test_cases[n], off, file_len, buf_siz, is_read, clean=
_pagecaches);
+ }
+
+ snprintf(title, sizeof(title), "%ldx%ldMB %s %4ldMB",
+ (file_MB + buf_MB - 1) / buf_MB, buf_MB,
+ is_read ? "Read" : "Write", file_MB);
+
+ base_io_time =3D test_cases[0].times_io_ ?: 1;
+ base_io_speed =3D test_cases[0].io_len_ / base_io_time ? : 1000;
+
+ printf("| %-23s|%8s|%8s|%8s|%8s| I/O%%\n", title,
+ "Creat-ms", "Close-ms", "I/O-ms", "I/O-MB/s");
+ printf("|---------------------------|--------|--------|--------|------=
--|-----\n");
+ for (n =3D 0; n < test_count; n++) {
+ tc =3D &test_cases[n];
+ io_times =3D tc->times_io_;
+ io_speed =3D io_times > 0 ? tc->io_len_ / io_times : 0;
+
+ printf("|%2d) %23s| %6ld | %6ld | %6ld | %6ld |%4ld%%\n", n + 1,
+ membuf_tc_desc(tc), time_us2ms(tc->times_create_),
+ time_us2ms(tc->times_close_), time_us2ms(io_times),
+ io_speed, io_speed * 100 / base_io_speed);
+ }
+ return;
+}
+
+void test_all_membufs(const char *filepath, loff_t off, size_t file_len, s=
ize_t buf_siz,
+ bool is_read, bool clean_pagecaches)
+{
+ int buffer_fd;
+ int direct_fd;
+
+ buffer_fd =3D open(filepath, O_RDWR | O_CLOEXEC | O_LARGEFILE);
+ direct_fd =3D open(filepath, O_RDWR | O_CLOEXEC | O_LARGEFILE | O_DIRE=
CT);
+ if (buffer_fd < 0 || direct_fd < 0) {
+ printf("buffer_fd %d direct_fd %d\n", buffer_fd, direct_fd);
+ return;
+ }
+
+ struct mem_buf_tc test_cases[] =3D {
+ {BUF_MEMFD, IO_MAP_READ_WRITE, buffer_fd, false},
+ {BUF_MEMFD, IO_MAP_READ_WRITE, direct_fd, true},
+ {BUF_UDMA_MEMFD, IO_MAP_READ_WRITE, buffer_fd, false},
+ {BUF_UDMA_MEMFD, IO_MAP_READ_WRITE, direct_fd, true},
+ {BUF_UDMA_MEMFD, IO_SENDFILE, buffer_fd, false},
+ {BUF_UDMA_MEMFD, IO_SENDFILE, direct_fd, true},
+ {BUF_UDMA_MEMFD, IO_SPLICE, buffer_fd, false},
+ {BUF_UDMA_MEMFD, IO_SPLICE, direct_fd, true},
+ {BUF_UDMABUF, IO_MAP_READ_WRITE, buffer_fd, false},
+ {BUF_DMABUF, IO_MAP_READ_WRITE, buffer_fd, false},
+ {BUF_UDMABUF, IO_COPY_FILE_RANGE, buffer_fd, false},
+ {BUF_UDMABUF, IO_COPY_FILE_RANGE, direct_fd, true},
+ {BUF_DMABUF, IO_COPY_FILE_RANGE, buffer_fd, false},
+ {BUF_DMABUF, IO_COPY_FILE_RANGE, direct_fd, true},
+ };
+
+ test_membuf_cases(test_cases, sizeof(test_cases) / sizeof(test_cases[0=
]),
+ off, file_len, buf_siz, is_read, clean_pagecaches);
+ close(buffer_fd);
+ close(direct_fd);
+}
+
+void usage(void)
+{
+ printf("usage: dmabuf-dio [file_path] [size_MB]\n");
+ return;
+}
+
+int main(int argc, char *argv[])
+{
+ const char *file_path =3D "/data/membuf.tmp";
+ size_t file_len =3D SIZ_MB * 1024;
+
+ if (argc > 1)
+ file_path =3D argv[1];
+ if (argc > 2)
+ file_len =3D atoi(argv[2]) * SIZ_MB;
+ if (file_len < 0)
+ file_len =3D SIZ_MB * 1024;
+ if (!prepare_file(file_path, 0, file_len)) {
+ usage();
+ return -1;
+ }
+
+ test_all_membufs(file_path, 0, file_len, SIZ_MB * 32, true, true); =
=20
+ return 0;
+}
--



Return-Path: <linux-kernel+bounces-675577-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BAA3741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:00:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 024CE188E5E3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:00:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EFD6D286D58;
Fri, 6 Jun 2025 10:00:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="o/iDplID"
Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 574C027F752
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:00:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204024; cv=none; b=VbOxoCV2lmzsyLLWDMXaJCBpBqFqfetb6j41lxlWgdUFqtT7Z/XzBxMvNECOU5BjRc05z828ImIevGrGu7a4ch7b/Kz9/JedCZHTToUcO6Fg6sZodTB8Umuy5U/uV5d4h7uujVVwsocrOYQymG+lWo6QwPuVC9xdKnPdgRFgcdY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204024; c=relaxed/simple;
bh=3a+WQLGp4elFYZvrRecz8JZgfyQKKlirEzi3m1GN03Y=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=taiQwoH5fvbUhJb0teC2TCHyc4mlVkK9zpxBQq8S2CF89Kn9o1ZRtpkR6zN8cPWwXDO9W996R4UPYssEXFJsxf8Onv3jwIzlVQ8ReWXdpR+4mMOZn9aTLg2KI8VxRTRFg7hobjTamG3GQDcBBwjmKPMjVT/5OJGEbb9wFdJRC78=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=o/iDplID; arc=none smtp.client-ip=209.85.221.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3a4fea34e07so1110853f8f.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:00:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749204020; x=1749808820; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=0Wm5Ysxp6GbjttnpPxWFZX/i14ZJHHqOtrosH3lsbGA=;
b=o/iDplIDx5jpp9nUY2jflHw+xk5xcd4ILsUh9OwOBhQIfOtjZsVTBUBYuJNnaNfcg2
06Asjz7Ndy39AphhmVt1np1DmZWrr2jXcgHeE7WTJgYuTl1bqdZAGqp4frdiG+DAP9YF
aKhckTHYjKjt6h+kX2xeHNIP6grjHdSj+APQMCikU7wOWHAoEWE7bWVHcD7KR+fm9Ox8
bSxsTXZrETAtNQGEE6gq+6YX4cmxNKMRwtG+NNsMMD9NVtclnswI+tnv2UnboQaZIplJ
iE3ag+NBvbrzR5vOOp0pVUJ0+ES6BigyPtNAM8dU3SrNhM28KzjyViIdT1IGYOipxVe+
5Eig==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749204020; x=1749808820;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=0Wm5Ysxp6GbjttnpPxWFZX/i14ZJHHqOtrosH3lsbGA=;
b=cSco9PQJFXxXrM6QqYR1A2DQZTVYrzhVKrDXwcK2zOMsmRVAC0k+ZvmK+oI8t1a+Me
a0FRSllqb/X+3/FeaAR5uy7M5bVpOvaRQXR+trPMPG4qP9qtF2PNiVNXVrHICABl55QP
QNuO5+ko7YpW46FZJM2LJpR7nWUxbaGGHSm26waEOYNeb59O2dexJR2I9YON6kqjdpbd
5Sekdruqzd8MM6ZsvLy1ahEPjmIP6l0YphTIQYBg+nithkR+GzYq78s18kS+X0YKW/Cb
O/5V1mEePqx/gZaix67rddvqqBpUkA12s+MXyKbByrDzhw0w3CfrXM0ZtThSJTYPhSbJ
0R0A==
X-Forwarded-Encrypted: i=1; AJvYcCVcQUWag2ElIgyT2RfIPxQLPdeeJfcFlhwBh9WIN1r7FbaAy+xKs3SJr54MFKzDWQfHbloZyn7yTaALQ9k=@vger.kernel.org
X-Gm-Message-State: AOJu0YysC8Hb/N7TtkvMZTG55sJVCTiDOq2UWotoJL5e1GkofDTd9WlX
lP4VDJBB67+R2UgKbBDWIWLWvkUqtvBTeuRHPRsxK0mm8OAffc6j3Nn6JVXpssoeE7c=
X-Gm-Gg: ASbGncukiCmhNvcTUWlQI9vkkNO0fHu+WVX+7vr2mrWfPzjIa3vlMTB1TQPNrH/RAPT
aIlGKG4ROTfnPmO5Ylzk9i9djroJHTWxoEDvkL5cIneNx3Y59hvkWuZMJPKEDLuwTm1yo2EAv3M
YdvDqPDzq95LkALg1OvotdvQ6nb7btv3EbH1srKZWSi4gXemWJhKEJz60QCJoDhgymTklZNTXQd
i0hM7BF892etvfiJDFF+X+STJQKe8MJTuIwol0Z9fjTdR96ktwADkIeOoRgcceu35cWdEJZyUWy
AwKHsW5Dq2TqFX4MHr0h0T9q26uH8bAacp4LBgl+14xHhg3HkAyzhP3RwFgyNOVzRUzoSg==
X-Google-Smtp-Source: AGHT+IHtw37a7aLpgY1NgIlSmAhbyHbRMRvllHSnmnalrMLkUdNldLsfg2cqEgFo08aK/ax73zNvkw==
X-Received: by 2002:a05:6000:25c5:b0:3a4:df80:7284 with SMTP id ffacd0b85a97d-3a53188a553mr2530102f8f.1.1749204020520;
Fri, 06 Jun 2025 03:00:20 -0700 (PDT)
Received: from [192.168.1.221] ([5.30.189.74])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324621a4sm1347436f8f.88.2025.06.06.03.00.15
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 03:00:18 -0700 (PDT)
Message-ID: <ca3ce8df-aa4f-4422-8455-29db2440d8d5@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:00:14 +0300
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] dmaengine: mediatek: Fix a flag reuse error in
mtk_cqdma_tx_status()
To: Qiu-ji Chen <chenqiuji666@xxxxxxxxx>
Cc: sean.wang@xxxxxxxxxxxx, vkoul@xxxxxxxxxx, matthias.bgg@xxxxxxxxx,
angelogioacchino.delregno@xxxxxxxxxxxxx, dmaengine@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-mediatek@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, baijiaju1990@xxxxxxxxx,
stable@xxxxxxxxxxxxxxx, kernel test robot <lkp@xxxxxxxxx>
References: <20250606071709.4738-1-chenqiuji666@xxxxxxxxx>
<ff77f70e-344d-4b8a-a27f-c8287d49339c@xxxxxxxxxx>
<CANgpojXWk1zvu32bMuGgkVGVNvPw+0NWmSUC62Sbc3WcUXAd3A@xxxxxxxxxxxxxx>
Content-Language: en-US
From: Eugen Hristev <eugen.hristev@xxxxxxxxxx>
In-Reply-To: <CANgpojXWk1zvu32bMuGgkVGVNvPw+0NWmSUC62Sbc3WcUXAd3A@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/6/25 12:14, Qiu-ji Chen wrote:
>> On 6/6/25 10:17, Qiu-ji Chen wrote:
>>> Fixed a flag reuse bug in the mtk_cqdma_tx_status() function.
>> If the first spin_lock_irqsave already saved the irq flags and disabled
>> them, would it be meaningful to actually use a simple spin_lock for the
>> second lock ? Or rather spin_lock_nested since there is a second nested
>> lock taken ?
>>
>> Eugen
>>
>
> Hello Eugen,
>
> Thanks for helpful suggestion. The modification has been submitted in
> patch v2 as discussed.
>
> Best regards,
> Qiu-ji Chen

You are welcome, but in fact I suggested two alternatives. Any reason
you picked this one instead of the other ?


Return-Path: <linux-kernel+bounces-675578-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 72CFA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:01:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 32484188F55D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:01:44 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A6C6B286D55;
Fri, 6 Jun 2025 10:01:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=fibocomcorp.onmicrosoft.com header.i=@fibocomcorp.onmicrosoft.com header.b="Xe4WDA/N"
Received: from TYPPR03CU001.outbound.protection.outlook.com (mail-japaneastazon11022081.outbound.protection.outlook.com [52.101.126.81])
(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 90BC01E47AD;
Fri, 6 Jun 2025 10:01:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.126.81
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204077; cv=fail; b=XM5OqRASJ0gDmXhOxcYlHJlWD9tRbxnMGlM7Txri43QpS4uReaotojsjiKx69rJo/iaGwIhUKU50VG/Ko7Ugu1DtBV8L9/8fizFP0go9O0zuc//p4P2oTrOZkp/MBB29VRX7hg2eok3g+7AgoovSkgG9wIMvk0bTBCwLyrrieQg=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204077; c=relaxed/simple;
bh=lJhdvA2wGEZBekHI5Abk6bnseD6lkzX1ynCr+A66mQg=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
Content-Type:MIME-Version; b=To8ZNydqZug5KyfLk8z88SjNfhOHIfU8NyN/L6AH0xfBcNc6IlfssKfJw+jmtxelGHm3fUnspSKkcP/a45xVkgy6byRiO8c+fZVTSdsfChw+MMogDAZ7Nnnj22rgfOIyoS+7/j6A33xLH7gsgBsSKjZEaSw3fdv5jw70QEMgr7A=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fibocom.com; spf=pass smtp.mailfrom=fibocom.com; dkim=pass (1024-bit key) header.d=fibocomcorp.onmicrosoft.com header.i=@fibocomcorp.onmicrosoft.com header.b=Xe4WDA/N; arc=fail smtp.client-ip=52.101.126.81
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fibocom.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fibocom.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=H0sFuv36HdPZ3dkM6dALJon1j6OPcpzOES/3iWV3i7P35FGMeW2ypD4S7A8RCFqBIfbWdTGQdPI8WpFRUPULMQQ51g6093K6JKDm80jV9BJMTKKc7KR2gAVn91HafOZmqDX7oMYoZyBxodXga7tddny3HYpq8+Gcb6F/mEXx29M6H0VcYemPHcJoGPMOO4sgA4IBLr9RS+WxB8ilo3U5Aob3/mWtL/sUmSnrvOrhwXCNvEIiAm7ub1iud8ttMbeHH1TJpL8cE0VQpcqPno9AaQlfHJf/618BVJI79aaMu/Ou4dVVGQZ2G9UJWVsjLqEcVR3uBSkBnnxIpZd6HKpbCA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=w5VkthyIBrvsULez1SzppZ3IHx9AbISlhDI5aoLPBs4=;
b=WDAoBqEOE6bWFXF/gNJjJ419e9O6TYe9318dLHdVSAeSmXpNHassZKI3s5COAizlEWAz89Zx7A3fTuHLFNEOpC3QWc9C1mINsUIZ13vmaj3ltVmGv2teSPFMsHyH4RBzqYHVEqXQG7oNwVUh8e0tnbW6VX1ElXCqhYVSlXEBy5K1u1YIT7O0smgWQktvoARGRU4moy/Xm/q14tODne11C4XfAlXLvF1tEMILYKRrJob1zBkBOOjPyzXsqBZNhncBwn5zxpVtYG0nJFeZdd0aJns5NdDGY0LLQx6ok6+O9RbM7vypb0mj3Gh/gs1221C6bVoDnivBS5bPSSI9iI8eHQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=fibocom.com; dmarc=pass action=none header.from=fibocom.com;
dkim=pass header.d=fibocom.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=fibocomcorp.onmicrosoft.com; s=selector1-fibocomcorp-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=w5VkthyIBrvsULez1SzppZ3IHx9AbISlhDI5aoLPBs4=;
b=Xe4WDA/NSe9NuWJnPn2U8Qvk0vUyruwboVlHWyktNphP3vSjHfbWKszv7Bvq7eqqcJuL7D2ZyvWZRoSm+XFmUYzZtKHzBOAkhXzkqA3xlxxwdR4mHPVxjPfym3HIbT6gr3YIxoRYnQHIoR2t3QGrmhYm2l8qP7ixMDuKJ8hSRes=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=fibocom.com;
Received: from TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6)
by TYSPR02MB7321.apcprd02.prod.outlook.com (2603:1096:400:46a::10) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.34; Fri, 6 Jun
2025 10:01:08 +0000
Received: from TY0PR02MB5766.apcprd02.prod.outlook.com
([fe80::f53d:47b:3b04:9a8b]) by TY0PR02MB5766.apcprd02.prod.outlook.com
([fe80::f53d:47b:3b04:9a8b%4]) with mapi id 15.20.8769.037; Fri, 6 Jun 2025
10:01:07 +0000
From: Jinjian Song <jinjian.song@xxxxxxxxxxx>
To: kuba@xxxxxxxxxx,
Jinjian Song <jinjian.song@xxxxxxxxxxx>
Cc: andrew+netdev@xxxxxxx,
angelogioacchino.delregno@xxxxxxxxxxxxx,
chandrashekar.devegowda@xxxxxxxxx,
chiranjeevi.rapolu@xxxxxxxxxxxxxxx,
corbet@xxxxxxx,
danielwinkler@xxxxxxxxxx,
davem@xxxxxxxxxxxxx,
edumazet@xxxxxxxxxx,
haijun.liu@xxxxxxxxxxxx,
helgaas@xxxxxxxxxx,
horms@xxxxxxxxxx,
johannes@xxxxxxxxxxxxxxxx,
korneld@xxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-doc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
linux-mediatek@xxxxxxxxxxxxxxxxxxx,
loic.poulain@xxxxxxxxxx,
m.chetan.kumar@xxxxxxxxxxxxxxx,
matthias.bgg@xxxxxxxxx,
netdev@xxxxxxxxxxxxxxx,
pabeni@xxxxxxxxxx,
rafael.wang@xxxxxxxxxxx,
ricardo.martinez@xxxxxxxxxxxxxxx,
ryazanov.s.a@xxxxxxxxx
Subject: Re: [net-next v1] net: wwan: t7xx: Parameterize data plane RX BAT and FAG count
Date: Fri, 6 Jun 2025 18:00:50 +0800
Message-Id: <20250605071240.7133d1a5@xxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250605071240.7133d1a5@xxxxxxxxxx>
References: <20250514104728.10869-1-jinjian.song@xxxxxxxxxxx> <20250515180858.2568d930@xxxxxxxxxx> <20250516084320.66998caf@xxxxxxxxxx> <20250520122141.025616c9@xxxxxxxxxx>
Precedence: bulk
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: SI1PR02CA0007.apcprd02.prod.outlook.com
(2603:1096:4:1f7::6) To TY0PR02MB5766.apcprd02.prod.outlook.com
(2603:1096:400:1b5::6)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: TY0PR02MB5766:EE_|TYSPR02MB7321:EE_
X-MS-Office365-Filtering-Correlation-Id: 48427f90-6ee8-4e4a-da48-08dda4e10e53
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|366016|1800799024|4022899009|7416014|376014|52116014|38350700014|7053199007;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?DdzY82Qv0DOH8x1TQefXIHGuEjGoabnP4OaZmjZZn6KjT6j4HDnNLnb/MuHj?=
=?us-ascii?Q?y6gRdhzsYUQd1tFvafc2DabT0cLX12e0TSuRf8TQszINDY6c5zh6FvxE/FwQ?=
=?us-ascii?Q?mB8s+xAHGGiqsXlvfDrK92TbDk23r39ESVWfYBzswHc4o3frZpXxr/rbB9oX?=
=?us-ascii?Q?7FkVlwnTwezO16n6pHJUA7/kZIxZ0oGQCruJcryLmvg+qMB3Lhg70pFZczcv?=
=?us-ascii?Q?0lhbO3oph8XFdZI58j8DtItGbTRTT61hKrp1xClwiDUFY0g537zE05cX8wSz?=
=?us-ascii?Q?1QlUTtKflfsibW7ofYiijkwmr81y1CNr5wG3KfI1/WbD2BHg+BWayR5WB3AQ?=
=?us-ascii?Q?ixEo56JvaloMI+OM9NbutAQHUDgkVtltsO3/CDc1mdp7Y1xAGAOUBqT703VU?=
=?us-ascii?Q?m5bi47Z7NhPKuUvVMsbG+6rJ3L2/RzuHWsN/b9VtYYCB49mHvVUEeDEs9EsM?=
=?us-ascii?Q?ku5BXjxNm5fS/o0XQ/ZZZ8dOdYDZJYnNUYNCR5XNudnjKXF3HAMkCSZJV6Jq?=
=?us-ascii?Q?1utTu+5qEuf9DibUOMHB3cxvC5ej6CT6XuPANptchYzNue22YeB640DT53CK?=
=?us-ascii?Q?7+OEka+qNJbOp8FJQvvvmsZglhRYJoiCCigK8ReIsybUNemL2PJp5y8ZtV1n?=
=?us-ascii?Q?6AAUbUXorug/OKfjAtXQrBUES7inJ4Uxb81FBiJnioK7acGSESIgVmsIzsTn?=
=?us-ascii?Q?gVuZJSSueC81ryE+CHB6FxeEmqGDI0Y2HYaimwwMDDsoLAQX7uvCj7bTHapf?=
=?us-ascii?Q?9MEdzxknE7nQ6I+i3895f0nKkm8lXTOEoO4bT8setR4WDNxsiMTXz90OMWcF?=
=?us-ascii?Q?m10vgF/o5+Jhi18tVRqXrr9sV2wV7Fv24sMs+M45kEPP6bUKUSQcWbWo31nC?=
=?us-ascii?Q?hUSaOM2Xy71jma10ojP7OP+oLQbOQnUi4lFtwI3DC8X+q+NAwFidh/H+M1nd?=
=?us-ascii?Q?/hIPEJacoR3+xXEHKy3/Th7yZCa/5FExz6+YQKAvdOscfVovSultXZmdi0eL?=
=?us-ascii?Q?3ZRCNSVIbG/Wp0PqES7nsEgaJHV9TNdo25juJWH2Kuukwr2U7VjiWFxDLT5o?=
=?us-ascii?Q?oq0JjsBjS/TRGXYQlUzvxj8qxVsq6KvepcVJ0nyHBVo+d65yAOrWTRtaRXs+?=
=?us-ascii?Q?LKNCKe3vUmpMk/G5pW99GqeGmIEwuU47WCLEsNxV8UyfVNWadBdpBa2R6k/g?=
=?us-ascii?Q?l05ywbm4uZH5eV4/ZyZx248n1K/wyTzb/7PXFdoYydjmRG7JRjqqMbn3DjJ/?=
=?us-ascii?Q?DMCARbIUoOQ7SLEeIwodkZisgxcKDgIjzmmwKw1Tf+nNIMN81SjRDnXw9AMf?=
=?us-ascii?Q?5+pOOKBWdMIrSF/YFe8nZfDV+raH59ZNqAYbvMBqZky/r9kWr01h7f6yk+7a?=
=?us-ascii?Q?BO86OCgrjAfsHUmgTAdJIrktPmzGMb3dFI0gaS0kgA8ceFPdceLy0Bot72Xb?=
=?us-ascii?Q?2bN0UN2O9i7uGuNDT0T7NGzYhCY36xzENS2gwfM907LI59oWA5WQug=3D=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TY0PR02MB5766.apcprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(4022899009)(7416014)(376014)(52116014)(38350700014)(7053199007);DIR:OUT;SFP:1102;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?PGXmFVjQB6JpiPLQXgARI36F8ivVaFwYVOZRPKBJSBxN3WbMS3R4h8l/USQF?=
=?us-ascii?Q?mkW+DMsQ42BawgBowHA6SlUevs138XbDRkGFdvUmimMVH1TIQ5Si04C110pB?=
=?us-ascii?Q?vmMPnKjXpcvG2eFAoQwoYngmZOS+dZYaeFf2hX4rkgF2VQkkghONHOaIRIM2?=
=?us-ascii?Q?jbNOSYh0y06DfL8l/dRhaq13/DBVftKCGZqoq0pexbeO6DKe+FMo8lBFgE6e?=
=?us-ascii?Q?zIR3XY6rM5CpQWCq/QZR57HypeR4k/2aB5BqeQnLhlnQTBc4ha8yLcH5ZRPI?=
=?us-ascii?Q?YOxj4soG91Vurg3HO/Td58UISpH35wN5BlAUFATSo5IJYHpf+r0Di5eBKx7R?=
=?us-ascii?Q?YlggG2gECgc8IOHL6GV3O5IQWFjfd0/38QhhtWsa37VNgYsULL3dqP7zAgO7?=
=?us-ascii?Q?a7tijrZgztGhHq+veCIZUoeSuYuw8s7O9/f1e7Q/BhRDM2uPeaFzHl5tA9WU?=
=?us-ascii?Q?So1d9/HJES+rB4j/023vUnhJe4AWs3viXBH8lfAn0DjFQn8cJODs/Ddmc2aR?=
=?us-ascii?Q?GZSuPRNWoCjJcKr7W7pdZEbBuAN76vjH31Di/f4ciCqMT3edM9sZom1dOM/I?=
=?us-ascii?Q?KMfw5IoLoYnFs9eiwdJNddv37KRZ2TEVxqIcfz86275bgkvxSRQx7SNsQnED?=
=?us-ascii?Q?DDmHeIgLkWPLuJB4qX7Rh8e9iN8c/wjgXRqI+9xGw+S2PfXiw6O2+66K7eia?=
=?us-ascii?Q?CBgpS5rMH0ICANKKXBPqKMdM1iyKRwIpVrElk/cNbG5QOvC9oRdkFCIaofvd?=
=?us-ascii?Q?XVgIs9B3msPMNbhGqV1MtObBLm68RAEXYk3pYSldzzV4sTl1kwqjxpFhqPMt?=
=?us-ascii?Q?FpfoWA2pmqy3DH8798IZ17C/u+J2rogYmDObBHDayyobvRLsNDzMMs+/LLGS?=
=?us-ascii?Q?HcIEhj3F9Zf9LdKrH64r3NucM2kaXOanddi8Jwrw9EV25ldOwGHgdoe4TxYj?=
=?us-ascii?Q?JuQYxAspsk3EoHkcSvfiAdWvKtjq/bbx7sbDHAvEqrsliEiae+c5Owe50Ojb?=
=?us-ascii?Q?fYtm8CyGuytVPh1RddkJM6k20vh6ejx1/EVv5TCc8HnpYmG24fIRhbM076TS?=
=?us-ascii?Q?H9ADe3Ooope4TgDxxhtuy0lQAvm91WoFpiP1YJFqlzgD5DmeE8k/y+CXc9D3?=
=?us-ascii?Q?+qR63tjYl9A3aLHSYpn/xKtQlFxcZhT8rkBVbcr5jzR0Dm7R9CC0VYAF/y3w?=
=?us-ascii?Q?6ZoSj+t3uRVZeKpbw5HMH2yT7HFSlx1JabUU/n5t90MnNzhmlZTKXxMz6mmZ?=
=?us-ascii?Q?StjdpDsrfpfFlkXLiTG1FcoxppD9v5sxTq/gL/3kNWXOoiY6moYedn0hAxtu?=
=?us-ascii?Q?y0MStqek3AJtNFMDhY+RQNN2mMbw1W0qoOrXY/xkrVBh7psBe2hqrR/6pQG/?=
=?us-ascii?Q?W+xFpC0wMJeL67EU1yaYsztdYL7uxNvFSL2Pxnp8yteb0bw2JG1J1vsmw0BO?=
=?us-ascii?Q?BQH0bmJr0Sc05BB3iNRNjbUXPg8CL6F+QJPqMyqPSL0ln45Gq+81XmQstTKJ?=
=?us-ascii?Q?IcFdivMxCnKJbvPD3vkFNMuC31m4LnXNOw0ElIX1BNSP1KvH6wzvS8FLtgFO?=
=?us-ascii?Q?yVzPb0CAimEapzp10gYOgj+PEnH/pz49FE5trc48dABw6BsgwfRN9McilhrJ?=
=?us-ascii?Q?0w=3D=3D?=
X-OriginatorOrg: fibocom.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 48427f90-6ee8-4e4a-da48-08dda4e10e53
X-MS-Exchange-CrossTenant-AuthSource: TY0PR02MB5766.apcprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:01:07.7221
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 889bfe61-8c21-436b-bc07-3908050c8236
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: Dfl5Rtpq1KKiZxCWbz0E/oDuOPHyQcOJabcue24b1Pg3M8+rdKxGVxa4cbBMlznaqbQf3tNLoT3GNFq+c2gwEwaKpZqMduCx5mNoljTiFmQ=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR02MB7321
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Jakub Kicinski <kuba@xxxxxxxxxx>

>On Wed, 4 Jun 2025 17:17:22 +0800 Jinjian Song wrote:
>> The parameters are used by data plane to request RX DMA buffers for the entrire lifetime of
>> the driver, so it's best to determine them at the driver load time. Adjusting them after the
>> driver has been probed could introduce complex issues (e.g., the DMA buffers may already be
>> in use for communication when the parameters are changed. While devlink appears to support
>> parameter configuration via driver reload and runtime adjustment, both of these occur after
>> the driver has been probed, which doesn't seem very friendly to the overall logic.
>
>no.
>

Hi Jakub,

Could we configue this parameter of mtk_t7xx through Kconfig?

Thanks.

Jinjian,
Best Regards.


Return-Path: <linux-kernel+bounces-675579-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A34B541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:01:45 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id A3477176CB0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:01:46 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C751928466E;
Fri, 6 Jun 2025 10:01:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="DFdebgTd";
dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="StBhc21b"
Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25])
(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 B4DE7286D64;
Fri, 6 Jun 2025 10:01:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=67.231.149.25
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204081; cv=fail; b=VChyuqPSHyX6tBUmLIBzqRsMV5wzxLpHYbcVUnhRi7OPk04npD7KGShoOmQLXgJnB4wNgJG2inYRY5DU7jVjms65JtH1g7ZGiCxjcb3v4zk+TlvRceLLQXRZSGRxktdxDa2nrjeDwqzlu7Sql19SHUJaRHOK821+W0KC4By+qY8=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204081; c=relaxed/simple;
bh=1NteGSJQitgqB4djOlXTyPdbDLbjOVA9Xz8s4LegtMg=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=euzyT7aLUZJLnpmZElAY0CXFqm3G0y8nTiBUT0cIY783ehpb0rKRaigPmQRqJGFXxShgScG6Nwx1+FCc74/KFwbGeCS/M7nsFOeO7T78uSWcLwzkcXPqZ2J3jcu8MlDhcT9EiC+vQeTyjCeUqq6eYsH7hzWv3FPMsPkd5f1Kvwg=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=DFdebgTd; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=StBhc21b; arc=fail smtp.client-ip=67.231.149.25
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com
Received: from pps.filterd (m0077473.ppops.net [127.0.0.1])
by mx0a-001ae601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5569wnvB002510;
Fri, 6 Jun 2025 05:00:47 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=
PODMain02222019; bh=rRMH/XdjagKhLnUSqHrK6gYeBYvIQlDISAEzHH0CbTU=; b=
DFdebgTdojgg9+Fc7cYaqACWtuMXNpaahPqMGOZE/XSHCerogqaHNEVlS5fv0qcy
Lz2YMgrEe6oMu5s1CkjbijC+IYiYl2rKfEsRTyILzM5C8h+vBbrrgBdx1veYuBUU
k9GxkMDvCm2YuVfyFNB37Rad7DZ3f2AmCORlgzvKvMlzslMuSMQMy7Thdrr4bTGB
ZZHp1zb0pSCRvk4XZEQREdJTMkJgLtuMV1T0Ndwn/W4+rtCnqarKJh2XcwO+Xt89
C8TNS0Pka750EndbkglSO7qWKJAMt/Sh/CuVPGeERe0OARzZIXWczTmlGx+YAY3t
uQxYcNewFeYu3vKgfL1n4w==
Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02hn2207.outbound.protection.outlook.com [52.100.158.207])
by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 471g8yyjvw-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 05:00:47 -0500 (CDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=PYFVIp+xMn2bs5vyNzbdA6kml+xkqETt2g2IaqDi3HmWBXW+kTMl+I/m8mZ6yChffF6wT1aIuE/KlHb49rXhyIPCTGUX3xYUVVk9V6adt8vToX9Iv0ND2dngmmUk57aCkmu7tlzuaHbI9Pj6XCzQo8XXq8kSgdoUnZuCeEwFfm7fH+dYnSU4CsWvUnNuBT50W9zjJVWlkD61BsN5xU5hHS0n8VLJAuGFH4+KBlPGeTRBzXUWlMR7wkivdO1jYxxOYXcln77PaWfM7eJei7SCwOT1xeW2mhgHovx/3jx72t21osotBSBlLAGw2NNi1QYuf0U4yHJlG30Jk2ynUw17PQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=rRMH/XdjagKhLnUSqHrK6gYeBYvIQlDISAEzHH0CbTU=;
b=gR/ruFaziz7yj1qgAvP7C/IQ7KS1ndrividR2Fg3mDSox8Ols9+dSIEmrmjhMKY4ni6l2aiKaaYug7jViFcs4A2/8t2QHVMjKJTV9QTpx/oK3h0EqjgLHSW5JAv9sOoUvLkzja/Dpnk8ciANoYpKSfrSx1vmVeM0Zc37uaxQhRN9JyE1M3S5R9ElMLHUrGhntAPqzyi4l15YUWD/Q8IxknW8W+leeZT5B4rpyVEeAjHgRK9vi1XK3igI5RjwyoXIlr9Dm6zVvdKOJ5pZ2FkeCpf6jo1ZLCNr50adnSqROiXBZ8VaRwo8yrWVnqlc9VqwBh0PLW2u3Xgsv/RJWcE+Aw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is
84.19.233.75) smtp.rcpttodomain=cirrus.com
smtp.mailfrom=opensource.cirrus.com; dmarc=fail (p=reject sp=reject pct=100)
action=oreject header.from=opensource.cirrus.com; dkim=none (message not
signed); arc=none (0)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=cirrus4.onmicrosoft.com; s=selector2-cirrus4-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=rRMH/XdjagKhLnUSqHrK6gYeBYvIQlDISAEzHH0CbTU=;
b=StBhc21bPYCYIf6fnvdzSPU5gkUkJI2saO/2XCN/sq4a538oLM/Tvc57tFqkqfnmEc9VwtVKv04o47krH8UY+4mRG8JTwmlQMvCHQb5mSmeEUZU+8lJZbHCeeCSQ672CDu+kER99zEUQMWV403YccW3qjW4gKq8mRppuwsmF8kk=
Received: from SJ0PR05CA0016.namprd05.prod.outlook.com (2603:10b6:a03:33b::21)
by SA6PR19MB8674.namprd19.prod.outlook.com (2603:10b6:806:41a::15) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8769.39; Fri, 6 Jun
2025 10:00:44 +0000
Received: from SJ1PEPF000026CA.namprd04.prod.outlook.com
(2603:10b6:a03:33b:cafe::a0) by SJ0PR05CA0016.outlook.office365.com
(2603:10b6:a03:33b::21) with Microsoft SMTP Server (version=TLS1_3,
cipher=TLS_AES_256_GCM_SHA384) id 15.20.8835.9 via Frontend Transport; Fri, 6
Jun 2025 10:00:44 +0000
X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 84.19.233.75)
smtp.mailfrom=opensource.cirrus.com; dkim=none (message not signed)
header.d=none;dmarc=fail action=oreject header.from=opensource.cirrus.com;
Received-SPF: Fail (protection.outlook.com: domain of opensource.cirrus.com
does not designate 84.19.233.75 as permitted sender)
receiver=protection.outlook.com; client-ip=84.19.233.75;
helo=edirelay1.ad.cirrus.com;
Received: from edirelay1.ad.cirrus.com (84.19.233.75) by
SJ1PEPF000026CA.mail.protection.outlook.com (10.167.244.107) with Microsoft
SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.29
via Frontend Transport; Fri, 6 Jun 2025 10:00:43 +0000
Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93])
by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id 088EC406541;
Fri, 6 Jun 2025 10:00:42 +0000 (UTC)
Received: from [198.90.208.24] (ediswws06.ad.cirrus.com [198.90.208.24])
by ediswmail9.ad.cirrus.com (Postfix) with ESMTPSA id D869082024A;
Fri, 6 Jun 2025 10:00:41 +0000 (UTC)
Message-ID: <f18e207f-94fb-4197-a96a-45231129956c@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 11:00:41 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] ASoC: cs48l32: Fix a signedness bug in
cs48l32_hw_params()
To: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>,
David Rhodes <david.rhodes@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Jaroslav Kysela <perex@xxxxxxxx>, Takashi Iwai <tiwai@xxxxxxxx>,
Stuart Henderson <stuarth@xxxxxxxxxxxxxxxxxxxxx>,
Piotr Stankiewicz <piotrs@xxxxxxxxxxxxxxxxxxxxx>,
Qi Zhou <qi.zhou@xxxxxxxxxx>, linux-sound@xxxxxxxxxxxxxxx,
patches@xxxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Cc: dan.carpenter@xxxxxxxxxx, kernel-janitors@xxxxxxxxxxxxxxx,
error27@xxxxxxxxx
References: <20250603214813.197346-1-harshit.m.mogalapalli@xxxxxxxxxx>
Content-Language: en-GB
From: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>
In-Reply-To: <20250603214813.197346-1-harshit.m.mogalapalli@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: SJ1PEPF000026CA:EE_|SA6PR19MB8674:EE_
X-MS-Office365-Filtering-Correlation-Id: dc45a475-45f2-4013-5a5f-08dda4e1006a
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|82310400026|61400799027|34020700016|36860700013|376014|7416014|921020|12100799063;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?VTRidzFUOXRFZlYxNEJWODYrRndsY1NwTnc4NDJBbmx3S25vb1pYNHRma29I?=
=?utf-8?B?bjdrMncvSE5YRmMraE5rZlhaYXNCSzJPbzZZWWN1MlE4VForZitBRUpqOWc1?=
=?utf-8?B?SDJWQjVNd05aWEdRR0hLYndsMWJtaXF1RG5leVFzSXNpa2VrVVMzWFFjUjNa?=
=?utf-8?B?STJlZjZNalJQc0prR3dXeFlyZ3RYVEc4UVF0K3JPa1E4dnoyc3dMYThzYjUr?=
=?utf-8?B?SlN2V09ScVRjM1YxQWlpL2JTcTBOZ0UzbWR0ZncxWHAzUGxGaVdOZUE1SlRU?=
=?utf-8?B?QktOQjZ5Vmw5d2dHcTMrUEFvMU9qRzgvazl4SHZuWStrY25wOWIwVUtUNmpD?=
=?utf-8?B?ZzZNbG82ZmpTV0lFMGsrY1gxbU9XaUh5Z2tEL0VHblgweE53ckpvWjlPZDUy?=
=?utf-8?B?YXlqTm0xcHYyRUtFU0d6NW1ya3NRcUQ0QnVqSmdrYmJkU1hibndXY1N1anpX?=
=?utf-8?B?QjVmSmtZaStOek9YWDg3R0tJUzBXVU15NTdwbU92U0hsZmVDUzZpcFY1WFpQ?=
=?utf-8?B?M0VjMWdkcStsS0lncWt6SXV6Vmg1aW5pZFVBV3BJMUFjZWRIMS9XbmFVNmFP?=
=?utf-8?B?UWNtdjBUc3NxVXd0S3ZLelkzTjV2VTVUUk9DQzZHZVlsZVBsaUtabmoxL0NF?=
=?utf-8?B?ak1PQ0tjWnROTGpzNGxrWExlbksyRndZSkMvR0lVS3Vpc1RhM3hpYTdRdmZu?=
=?utf-8?B?TDN1OUVBRytLbFJBWHFINU1qbXhBRFFFN2N4eU5OSkxzWU9OMjRlK295U0Z5?=
=?utf-8?B?djFmbmtPWUU1OXNkdHYyWDduaWoyMnZuaDgwb0hyb2Qvc0Y1ZUxRQUV0eGJ1?=
=?utf-8?B?eDNIc1pyUzFDRnl5UnV3aVBuM2FqMDZnU2hIbU9GQXNGMlRrRTZ3d2VjZDZ5?=
=?utf-8?B?RjBvU1NkOStjYmV6OXJVSEtWRVdQdktUeHl3aXRrT2F5aTA1RXQ2bWVJK2VB?=
=?utf-8?B?UDNWODR1RTZGREh4Y1NlYU9rQnU1aU51TjQxbEZqUGVBZnlrQnVtd0IyTVVo?=
=?utf-8?B?NTZUZnB1eTlISis0c0RSQ2F2czRLZ1RJanJFMU45L1VmbERpVTdycU5rTmtu?=
=?utf-8?B?VDFKNFF5c2hEU2ZLUm5WNDNjYTRoNm9UR21zNkxZKzIvdm1yd3pCYStzZVA5?=
=?utf-8?B?MGs4eFZNajdyYjhnYVBUdWZpSmNVMmEzejgxTE1NQkVsWHZMYjVPVksyY05V?=
=?utf-8?B?TmZVcFliMCtXdEpKc1R4TlJhc2tjVU9OSDR3V0F3b1UrSVd2bnRhNnREY3Yx?=
=?utf-8?B?a2xkWDByQlZJWHhNbG9UMkg5Y1NYYlkrQ0ZlNVV3THp5VEQwdDBVeTkydVgy?=
=?utf-8?B?Z3JFbEgrZDFYdEVoNGZQVEM3bUN4UHc0NEIvSEcyQ0dWSG1rdXVaRFpVMlBp?=
=?utf-8?B?UVdhaDBkZ0VvYnFYSWVtRXRtODJ1eGdYYjBKRXIxRlhSc1BGZGVFZy9KM2V3?=
=?utf-8?B?K0RjdFMvbzF2OXIvQm02VnUyNjdxZFJnNzJQZk1QWFhycC9qcEJaWkUxMzY5?=
=?utf-8?B?dng3UTFadng5WlZyZGo3YXFlc21pU2JBcC9UaGVNQkxrRzY1NEVVN3FENUUw?=
=?utf-8?B?cmdKQklHZDhuamVwTkVlM1VXZCtLTnc4SE9CcEVCK2QzaTMwYU1kbjNsN3Nx?=
=?utf-8?B?WFpGQ1ZQb1g3OTZYV281YWVKVDhPSGllMjdPR0NoOUxxUkNaQWVIVlAreC9Q?=
=?utf-8?B?SG5xZFBiOVlkeGVDRkdJeUc1M3prdzhRSVM5WWNjZWk3WlJ2T29yZDFEZG5j?=
=?utf-8?B?cDZRTEVVWndNb2hLRmVDY1dsNDN1bUFvTUdFbHpvb1M0eWQyaXBHYWY2VDN3?=
=?utf-8?B?OU16eGRpcExMcFovdzk2ajlLRW96VjhFdzduc1Jhakx3Mmp0MFE4N0tGQ0ZO?=
=?utf-8?B?WDhrNE9QU241L21teklLRnI4YzFPYTM2MGJHQkNicGlHc25lNldIOTdoeFM2?=
=?utf-8?B?aXlEeXFVUUZvZS8yZ1F0ZXpucFFLUkxmZUt4SWJxdzAyVWVQcXdzVjQ5NlVL?=
=?utf-8?B?NUhBSzQyOFVzNkVZVWQrTnpPM1lMTTVyVjRMS3JYWCtzL21oc2t1THo0OW9w?=
=?utf-8?B?Z1VwMXVOa1I3MUltSG1QOEpZU2VxeUdERXF4QT09?=
X-Forefront-Antispam-Report:
CIP:84.19.233.75;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edirelay1.ad.cirrus.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(61400799027)(34020700016)(36860700013)(376014)(7416014)(921020)(12100799063);DIR:OUT;SFP:1501;
X-OriginatorOrg: opensource.cirrus.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:00:43.4699
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: dc45a475-45f2-4013-5a5f-08dda4e1006a
X-MS-Exchange-CrossTenant-Id: bec09025-e5bc-40d1-a355-8e955c307de8
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bec09025-e5bc-40d1-a355-8e955c307de8;Ip=[84.19.233.75];Helo=[edirelay1.ad.cirrus.com]
X-MS-Exchange-CrossTenant-AuthSource:
SJ1PEPF000026CA.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA6PR19MB8674
X-Proofpoint-ORIG-GUID: 8gYycyuYXyRXphmcCzAEbjPlQveh8at2
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5MSBTYWx0ZWRfX5EeuG3Nndu46 3MslTpEKEcwyNi2ljZXOliCY/kZcn2Q/0tqoN6z6/zkb2KKolJ6ctr5P+3nbjV5oQZMoIu6a//A scpE/+khFH+62hQvBT3Y7PN9BhhJVX/2H+FJVSGwSPhCSNDiv1gh5M8qirxf1OM9oOewO9mhjdF
oq4OX8LgXeFcqq6muYP6VeUcLyJKOD0Lcz6gq136iGrTk1iEviTscs7zP6X64tm7xHPyvKrLbv8 Nf+Fq3Bunv3gWes1MeMKEzwW+opT0QukOsEsJ6hAO3eHsWQLiHyljc5aSfLQUphcuMHdUm0Sa7q cKUk44+DbhLgEaqUw1bU9NVbJgzSrYkHa+eHm8m+MSoRfj6nXNZChN6s3ezCbWBj5iDn43KDlEP
yb791c22JNLpHQYDTnrh0H6NzbMr1qmc8sFXEH0iIKLAeYpzkGnScAwXcxhxH7+4bmfYjqhv
X-Proofpoint-GUID: 8gYycyuYXyRXphmcCzAEbjPlQveh8at2
X-Authority-Analysis: v=2.4 cv=Pb7/hjhd c=1 sm=1 tr=0 ts=6842bc4f cx=c_pps a=GN986tOdW9pC5+Of7Oaumw==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=IkcTkHD0fZMA:10
a=6IFa9wvqVegA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=yPCof4ZbAAAA:8 a=w1d2syhTAAAA:8 a=_DwRC79A61G041Pbyk8A:9 a=QEXdDO2ut3YA:10 a=jZz-an6Pvt0H8_Yc_ROU:22
X-Proofpoint-Spam-Reason: safe
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 03/06/2025 10:48 pm, Harshit Mogalapalli wrote:
> There is a type promotion that can happen when freq(u32) variable is
> comapared with sclk_target(integer), when sclk_target is a negative
> value it promotes to a large postive integer which might not be a
> problem in this particular case as the condition evaluates to false
> when that happens, but bail out early when sclk_target has negative
> error codes.
>
> cs48l32_sclk_rates[i].freq >= sclk_target
>
> Fix this by adding a negative error check when
> snd_soc_tdm_params_to_bclk() fails
>
> Fixes: e2bcbf99d045 ("ASoC: cs48l32: Add driver for Cirrus Logic CS48L32 audio DSP")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>

Reviewed-by: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>


Return-Path: <linux-kernel+bounces-675580-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0EA0541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:03:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6BEB07A1BAE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:02:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BE762286880;
Fri, 6 Jun 2025 10:03:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="IpIAdLhI";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="f4mIjhXg"
Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32])
(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 69FCD27F75A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:03:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204222; cv=fail; b=JG71FkvGEi/Cb2fF8d3I9lgnKzjLi2XgYVS/hP4pEs2xTraegzq0YLMMFIYnZmC3VSLMs17759fMhY0fvcOBIkzycSaJZVvsEsdom0oB6BUGXMFw38WbjWYHuemJwQ77PWUtQberkL8tX+076UI9idbAO2FgGD7qepfv648yI/w=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204222; c=relaxed/simple;
bh=n+xupnBD7cQ5TZCGvnZ7Lxa3A2siHm2xxAp7oMSUOHc=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=Owc5wVkqeVBHEduqMv02X8MwvFmllQBRgmAR1xw37aDS/lOhQ37QBqMeyJzBQpyQpRr1BeZZduAyqn6+gaacw8nQWgnB6Ruotfgojewn4O5MNXhasRFWstTLxhilSfyMCsajL7kzr7Mh8XUfGC2RT7zNv0l7T91zPqAP9uLyoS0=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=IpIAdLhI; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=f4mIjhXg; arc=fail smtp.client-ip=205.220.165.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246629.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NG2O011382;
Fri, 6 Jun 2025 10:03:19 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=Jj+2RbZthBBqCc/VyY
6kJCF9irffaBJjy0DOCj9k1+g=; b=IpIAdLhIb8+ohlJlKZiZlkWUcURndbQeZ4
Rf8UtsffrHDpWATdrcHdY/JoAoTnQ8JD4eLluaFmDk/9KmaBwlKnXfd59pgv9qDh
zqfKEMopHyqHMPLkRz6nNRzVua1uFHll1CXMUqCggZ44Ik6dv4PeF+j97aYmjqd0
dUnX7QMe2EQ1Wb/jnX93YpIG5ai7eCvOjgy9iYUMvc2iMNBuI/ssNMyP/U2oo6al
kBX5xSrQroz80rm72S0EvsudsDoe9X6y0wfRKU9biff57J+NK/dmedQdSO91Jwne
zUd84YLfeks09MEFP30TSDP+P9q367het1rzW/V7zjDGuKtk5R7w==
Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gwhfk27-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:03:19 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5568ZAVi030643;
Fri, 6 Jun 2025 10:03:17 GMT
Received: from ch4pr04cu002.outbound.protection.outlook.com (mail-northcentralusazon11013015.outbound.protection.outlook.com [40.107.201.15])
by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7d44t7-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:03:17 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=jgUHM5kTrok3j1fvFy+pXIgzrZC6gi+HUrwTpxiS0kpSYP2pq9RadkyGEo3RWytSjI0WS7wDSztdWhpYsf6JChJGZ16POCMlx9cfHXpj21LpGYnfD0u99y62QyB1xaEzn6aRZDfllF98evWiwdbAaPZuv2rq50NrPdX56fe8WmBy1CuIByk41FEZ03EDL0R6i2aFoct+F3dw0x+L8wQ91wUKHNC2QJ67BCQqrlPM3OZMZWzRmkOjPRh39qvud89vnmwzk3n2IJogs+x0HBOgh6Z01Ebyey9lTRB/Tn0Sw4327n18HuVb/euGcx/2yCTauYNkdqiKwPZQsIZgUm1uYg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=Jj+2RbZthBBqCc/VyY6kJCF9irffaBJjy0DOCj9k1+g=;
b=TAOHVk+9LuZVdhN7KDdmeo1x7FzH1oR/ew9qA5Wpfd/CdXU7Y+PQY8Ggs41kwNM8ktBlRXolL4vWyXB36sBqPF5cRouA+WHQsj+p/4GigUMaYaDsz/6XtlkLfRTO7DCQn87X336f/3UkfQ6EJ11AZ3VvjG9uKSpfGJqVI0RnpvBNI8KV3wQEA8DbQGzim9B38M79YWfyNRaxKl8esW/0K5qlOsGkHIux4swXrhfFdrPV5wnM/L/HIOAwd5u0XnZ9RBSgNRDkaV8JxiDMk/CEe4S4jgDTgBIsCl5MKVVs5H6D6CIAgXpn3Y1q46szbgJ0RmdK3pbVM9i6MPO4vcTTMQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=Jj+2RbZthBBqCc/VyY6kJCF9irffaBJjy0DOCj9k1+g=;
b=f4mIjhXgxerCO58+W6870WlMVN95oRYSpkQeG4YUAvqmapXc9ARAvB31bx+gNz65zqzO3kDtCvl3xXKVnKoSkKX9uu21DuIVwNEccU12pQ/jMlO/Nlsr50Ouf2rBk0T9BfXCaZ3KjCdDe4B2kbmHDfO7oNTySLmRhANl1vzbo5E=
Received: from BL4PR10MB8229.namprd10.prod.outlook.com (2603:10b6:208:4e6::14)
by SN4PR10MB5624.namprd10.prod.outlook.com (2603:10b6:806:20b::7) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.20; Fri, 6 Jun
2025 10:03:01 +0000
Received: from BL4PR10MB8229.namprd10.prod.outlook.com
([fe80::552b:16d2:af:c582]) by BL4PR10MB8229.namprd10.prod.outlook.com
([fe80::552b:16d2:af:c582%4]) with mapi id 15.20.8813.018; Fri, 6 Jun 2025
10:03:01 +0000
Date: Fri, 6 Jun 2025 11:02:58 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Dev Jain <dev.jain@xxxxxxx>
Cc: akpm@xxxxxxxxxxxxxxxxxxxx, david@xxxxxxxxxx, catalin.marinas@xxxxxxx,
will@xxxxxxxxxx, Liam.Howlett@xxxxxxxxxx, vbabka@xxxxxxx,
rppt@xxxxxxxxxx, surenb@xxxxxxxxxx, mhocko@xxxxxxxx,
linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
suzuki.poulose@xxxxxxx, steven.price@xxxxxxx, gshan@xxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, Jann Horn <jannh@xxxxxxxxxx>,
Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>,
Ryan Roberts <ryan.roberts@xxxxxxx>
Subject: Re: [PATCH 1/3] mm: Allow pagewalk without locks
Message-ID: <0b2cf458-4e5f-4ab3-bdd5-82cec8f0aec7@lucifer.local>
References: <20250530090407.19237-1-dev.jain@xxxxxxx>
<20250530090407.19237-2-dev.jain@xxxxxxx>
<6a60c052-9935-489e-a38e-1b03a1a79155@lucifer.local>
<ecfed817-105d-487f-80ba-52965f926c1e@xxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <ecfed817-105d-487f-80ba-52965f926c1e@xxxxxxx>
X-ClientProxiedBy: LO4P123CA0365.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:18e::10) To BL4PR10MB8229.namprd10.prod.outlook.com
(2603:10b6:208:4e6::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: BL4PR10MB8229:EE_|SN4PR10MB5624:EE_
X-MS-Office365-Filtering-Correlation-Id: 1cf9fac8-a2a2-4734-024f-08dda4e15223
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|376014|1800799024;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?GtELHw4GxEOVKCK7dGZzAB7yh+LlZnldItvnZN1qoyjj1gphIFubc9uEs7Gz?=
=?us-ascii?Q?iIZzImftAWh9na0P9paBNkOBZfTuheSMjAIm7aepDfH2JofVDOP1yqATRCjx?=
=?us-ascii?Q?Z/B0iRfRSSQJIL+e3fflBFY/kAOeT/T8sB6+P6JrI3+tE69Q8NpjCRARlFnb?=
=?us-ascii?Q?XHOMoHdLQAamvsPALbxMhsOla++ARfQ45yxJOqus5CulKwAGsi7ICjuxmySg?=
=?us-ascii?Q?/8LZDzXU1dQnk75koWYeSFHZXiLDyJY5keYiAN+kgRYZ3WhDsb0njX7tpZlH?=
=?us-ascii?Q?oFGS4ytzxs1iliIueKvIirtiBzY1vOGBsL75FUv2/aufIjlamQ3lEDwXD11L?=
=?us-ascii?Q?P/8FqF8JXrn8+ycg4Mn0NaqnUgHqCF+HpH6X/uuS7Iajb9tY1ZLpZK2A8F7n?=
=?us-ascii?Q?BecOtVoHwJIpdBhwoowLU9O8jeb634muuww/zp5oSZd9ImLTS/vuzoEL7mm3?=
=?us-ascii?Q?y+jIk513mksbK7oKmNF6/T9NhaS1PxKKtDYIuM9DAQxw1J11XcEUfyoCjvfj?=
=?us-ascii?Q?S7QFMa0kpH2cVRsgeIdmTfdkN0l0jJ4k6zVrmyRYKMc5DrLshhUw+CSTgRdr?=
=?us-ascii?Q?BmOwafCY883dyAx/YvYTwJvccXCu1ne7bvfP+Zbwibvixl5R180Iot/wr7OF?=
=?us-ascii?Q?LSCNiKatxlqGaCZ2rpnKITeHn2URU7WJFjy7t4+C8aeBvnhL6oUx8G2LG+kj?=
=?us-ascii?Q?4np766VDzHKP8Psqn298KD5rviOyjk6ZtauUYUqPhQVMofZUNSOKEl9JYBlX?=
=?us-ascii?Q?raaL5x8x3PP0hJSxJFKBHmvNsTECNRw+6nyeD6pomHKHySUCZxONXbsY2eig?=
=?us-ascii?Q?HLgIHXAzRUmnjpJYOKPAd9GmQX5hX2QmPasFMIZHHDUGCjlJZPa2Ee6gb+uo?=
=?us-ascii?Q?2TPKPiTN1usq8iAZfxUgdzn6Y5TVVFqi9UiEWzswDzElJiCQ9a6rpV0Lk6v1?=
=?us-ascii?Q?LYbhCVK6zovao9WSu7xMqmQ7l5YHXFnRwHLJ+lhtcUXZzBiBOYIAEiHRKI9I?=
=?us-ascii?Q?OZbFV64YEDTN5J7TxcOD8hBxAfr3SQQsFZ4F5xIlaiNmaASxW8AYOUo8f95H?=
=?us-ascii?Q?gj6uJ79+HITmlLDrB5WF4brXS3OKuRwo4/uJulIfJsC4SihAUaq2ZRh/qMFP?=
=?us-ascii?Q?0o4R5U51wTXGVBWqNQWMWlkE4rViNhhk+pZR45FPsenKHwjSXv3V6KTGHH1r?=
=?us-ascii?Q?si6n7EHkYT6e9nFbGmNDqpU8Td+eGHO57c7HdNGqoXn3xiS+IaJkQc4DDgXJ?=
=?us-ascii?Q?vAHssF/fIMf73hEZ9r5PDeB/YLPeki94Jk4ye7LodGsVxUiG7M3XRciKSbEO?=
=?us-ascii?Q?6VBZRV+3O/vUKOJ0d8gd/jM+GOrIj7ypBHNgWVeuKZ/11PBi9rT9PT7143Ks?=
=?us-ascii?Q?GRHeNIyLbF6CGpCfeKlJ5kpEZ/8nHacy+3aIKR0VP6wk04PD68eTCGBCKv+6?=
=?us-ascii?Q?UMAqGBHHHRRbXyPNJw41x6ife3kN0IhA?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL4PR10MB8229.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(366016)(376014)(1800799024);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?dLnNM6/mOe9H/E7qbN9UVFqoTRh/adWiME/c7kvnC1T+5D1U+o+1c6RMMafB?=
=?us-ascii?Q?Rzme5xEs8TGDo5Eoi3t0cUqz2L1UPxp0Iwdy/oEmjz07wTRz8RtktKm/7McN?=
=?us-ascii?Q?B9tGoM1XiNLfpWnxqXKaN18CGrZjetrv6xkW9ZxZCywDpwic43U7bKIqTBUn?=
=?us-ascii?Q?pIy37xe1l5Hqxq+sdwGbnZh9PnpNlWErt6dMJlL6ECp8Sb7bqPBRUCN8M5v7?=
=?us-ascii?Q?BQCzBM92MH0+xyPDmGr6RezBjSSeKfhiKAFzdJH1wVaSpRfNM3o2Ta54HpP2?=
=?us-ascii?Q?G1omi70F5wVjK7g2tC0fNS3DVF79n9GGOZ+R41YfrJKZmu9N3rOvB8AFQDzX?=
=?us-ascii?Q?2LB4ge9fHKUlTeb/Y0dHWAUz0YQUqntn2c2IRRxSQ9szF3WoTY0fqqnjXppT?=
=?us-ascii?Q?lSbd21W0/kE8PrF8YDDXlkp3bnu6BGca7T08RgFSBbhOXaUM0f6xwCJ7KgKL?=
=?us-ascii?Q?t9FeIR6teLnpYcSqIGRvsui2mIAnaBqFn3/zjOkhKe7AO2gUY2HaoGfGcaIK?=
=?us-ascii?Q?am2VFbjvK+8gx43cTSA9m1AgVeEAwuOsmFLDlLBsAaXL4uJnYOsgDWyuo+fn?=
=?us-ascii?Q?kD5QLjws2t6Ef3viUJcue9J6jhSRzVNpfKSgH3plbwtGlToE7isRcHPDwAvh?=
=?us-ascii?Q?V8VF1dH68BayZakU7UdQL3ltd8+M6u1iKgaAvBxxh/i1RrMSe8tUInUZhBZq?=
=?us-ascii?Q?qKY8Di1pI1LL1ZEDWEf8nVyvoXp6b911e62lYYbl+83WKeDGt4a6uSnr1ep0?=
=?us-ascii?Q?coMb8LXvQBKgR55m/VETmMUaGsSyjO3mRLljVAgTRgitLcQ/vErPsYIZv8Td?=
=?us-ascii?Q?hgkBxppE0htLVAOxGheUDH0JH8pa6arZIX/4bJ/8EkA1w/MfVUTBQD8u2lao?=
=?us-ascii?Q?/eAYANFfHJs16ZgeesOcOoQyB3gyjDVd7nO7/ZhXYDaPYjjv/p+5DTj8rtUY?=
=?us-ascii?Q?uH4umR99/heGWvXZnQ/D7nI/3/grL//ZcGZtv80xPwKHGhu33GHjIob3RxhE?=
=?us-ascii?Q?P6/n7BR7MOHOUf56KYkeUxv7nKUQuUkucoF6BHf4zj16xBA/zx3LzMdPkRXq?=
=?us-ascii?Q?PD8lOtmf1SeQ/xtv6rzbYuiIg7Zo0uAmZiyYARLO0VrO4JKgC6mPTWmZjKcH?=
=?us-ascii?Q?e9wWHNPMLgAHv/p0I1ernL5VOBH7JrT0jYOcQnSCBSDM3klqtm9OyCWdXcHe?=
=?us-ascii?Q?XK+T0mEtFbcErsLco2y+Icvi5EwBbpGHsV527b9gzkj2RRQImNNQTmrTwU3u?=
=?us-ascii?Q?DjrN7ma31Hw9cdnLThW86Xh3pADu7EtRszxPd2Vl0uszkoXZRAwtJumFpKOe?=
=?us-ascii?Q?njVne87o9vhiZM7Lm2NsDSR/1xl4ZNX/KX9dEB3k9qezgFenJdZysH6ASD91?=
=?us-ascii?Q?8QXz0gGwOycVhd4eogxtuyWNUZ+LyuGdQzfG/CScfTuXEiqA4r99iVYi44cJ?=
=?us-ascii?Q?ZBZCBzJsMVIHqSsWtIklRrRWnYVRcAI4lXWa3+haxxw1Id81buzMpndjpS02?=
=?us-ascii?Q?tmbbJzp7GFT9ng9W6y32LVcfaOgc7/zmHQ95eZJ/aEfbwiFSOCNvpt8zrKqL?=
=?us-ascii?Q?FF5xMUziuZDoUerc3h0SwjNlqsX4RfotJqqeKAxdYAtpMfwKSyLneAAzfKMc?=
=?us-ascii?Q?eQ=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
7SUrae/+fdqEGXipPrIC2rPRV2BxZXalsxWK3l0BEGojr++QVPLUS7Mr/LVFDXpLV+Epuj/G1jeRYlwcPuz4eY4ryLxqaG+xdMJ2sm42r9sCDHYABwd70JJvcsVus4w+L6Q12vm4C0q7/PNVCDAtBMEUdeefyec7jJKB6V1rfvarTDw4wIsMe353kCRwqwk/uy4eWwVW80/WTgWK3kxyx0iAZ0AZjfsXobE59PIlFAvR/npypkpdenRXMM5yQw09192EH344sv9d5cGOj1ETRjwmji8L/67iNS6kolANr0n46xl2nUhs+Lrf7CTs/pXnIbRJdm85Z2DQmDnPhhfAoIzaIBejaLvR6ddEt+v9VVsQ7Et7/y4VVDqjqfwyC1V5cCk6WEgnTpbrLoH6EqjjBwhioukX+qafMOFDYIlkMLiZKSwPl9Xy+QLcBu6jNEXYtZHznzPz9MD7dWTju6DuRRvTA8IzykxpUQ8Eb1zjQxI8jcyP6Soc8y1gW4mQj0nkW5+lMJBiKPS/tl2pmRdSjYIiGlCg1Qi+UGflMdhpyr1yTQ5tpKgMlz4RJwbslOha3qkY79QT5mOBRo+Wm0C4YivD0pZMkG0wlUMUGxsRF+g=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 1cf9fac8-a2a2-4734-024f-08dda4e15223
X-MS-Exchange-CrossTenant-AuthSource: BL4PR10MB8229.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:03:01.2923
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 2furwG2GVLBDqoHaFzeRyoPLT0+z+1TkHF63Rc0TTPF35D832SlpRLlzcGA4TczGx1t/WdA0FrKOnpFjVd4WMjqbhzLfSuz7kllqkflqiVw=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR10MB5624
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0
suspectscore=0 phishscore=0 adultscore=0 spamscore=0 mlxlogscore=999
mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1
engine=8.12.0-2505160000 definitions=main-2506060092
X-Authority-Analysis: v=2.4 cv=Wu0rMcfv c=1 sm=1 tr=0 ts=6842bce7 b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=VwQbUJbxAAAA:8 a=7CQSdrXTAAAA:8 a=7qp52ovlw9--blVHXKAA:9 a=CjuIK1q_8ugA:10 a=PG6Q-FFm6skA:10 a=a-qgeE7W1pNrGK8U0ZQC:22 cc=ntf awl=host:14714
X-Proofpoint-GUID: dawVMZ30N4P_P_YcfFhkNlPLb3u7wkE1
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5MiBTYWx0ZWRfX1ZHUjNHwOScl B5ZFrbmIvzQ3k8Xma2md0/jzijIFdhif0QrOlC0TaSBqe3Bmz4xhPLSnLpA7MBmt0ouK4IC/9A9 l0JB/Hcb4wCxFcwwTj9U+JxCO/9h3JABPtr/7b0Li94J1gOH3piE+Ck+WgN1yrhE/o8uw52pK3g
doGf//0qs5m1fWVWEYsNDUvv2VIQh3VhDYptg9wy8q6QXIH5h54QwfI5XXmTOXTMDv7ghml8AKg x2IHDGSgrVt7BXWyduQ6QvFJegrw5cSNt6f7Zi6o7x9Eh6Ps+7BOak9/o3OKOKQcRCs3q7OMDez 5JWQz/IqJ6I+ro3TUzjjiToxY3zBVPhbMpWyFGKrwJqgLH2nhcssi0ARbN/N7co+rF8KSgzmK8+
dE1p72iv/rW82omJIn0L/3EOJkyU0gC5HDRUTu+BVZvu4i20EtSQVB7IeqiHmiwAmkgXCfXr
X-Proofpoint-ORIG-GUID: dawVMZ30N4P_P_YcfFhkNlPLb3u7wkE1
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

(One thing to note here is that I have refactored this walk_page_range_novma()
function so the kernel equivalent is now walk_kernel_page_table_range().)

Overall, I'm questioning doing this in the walker code at all.

The use of mmap locks for kernel mappings is essentially a convention among
callers, it's not something that is actually required for kernel page table
mappings.

And now we're introducing a new mode where we say 'ok that convention is
out the window, we won't assert anything'.

Not sure I want to add yet another way you can use the kernel walker code here,
not at least until I can unravel the mess of why we're even using these locks at
all.

Strikes me that init_mm.mmap_lock is just being used as a convenient mutual
exclusion for all other callers.

So as per my (new :P) comment to 2/3, maybe we should just fix apply_to_range()
no?

David - any thoughts here?

On Fri, Jun 06, 2025 at 02:51:48PM +0530, Dev Jain wrote:
>
> On 30/05/25 4:27 pm, Lorenzo Stoakes wrote:
> > +cc Jan for page table stuff.
> >
> > On Fri, May 30, 2025 at 02:34:05PM +0530, Dev Jain wrote:
> > > It is noted at [1] that KFENCE can manipulate kernel pgtable entries during
> > > softirqs. It does this by calling set_memory_valid() -> __change_memory_common().
> > > This being a non-sleepable context, we cannot take the init_mm mmap lock.
> > > Therefore, add PGWALK_NOLOCK to enable walk_page_range_novma() usage without
> > > locks.
> > Hm This is worrying.
> >
> > You're unconditionally making it possible for dangerous usage here - to
> > walk page tables without a lock.
> >
> > We need to assert this is only being used in a context where this makes
> > sense, e.g. a no VMA range under the right circumstances.
> >
> > At the very least we need asserts that we are in a circumstance where this
> > is permitted.
> >
> > For VMAs, you must keep the VMA stable, which requires a VMA read lock at
> > minimum.
> >
> > See
> > https://origin.kernel.org/doc/html/latest/mm/process_addrs.html#page-tables
> > for details where these requirements are documented.
> >
> > I also think we should update this documentation to cover off this non-VMA
> > task context stuff. I can perhaps do this so as not to egregiously add
> > workload to this series :)
> >
> > Also, again this commit message is not enough for such a major change to
> > core mm stuff. I think you need to underline that - in non-task context -
> > you are safe to manipulate _kernel_ mappings, having precluded KFENCE as a
> > concern.
>
> Sorry for late reply, after your comments I had to really go and understand
> kernel pagetable walking properly by reading your process_addrs documentation
> and reading the code, so that I could prepare an answer and improve my
> understanding, thanks for your review!

Of course, that's fine, it's all super confusing, and continues to be so... :)

>
> How does the below comment above PGWALK_NOLOCK look?
>
> "Walk without any lock. Use of this is only meant for the
> case where there is no underlying VMA, and the user has
> exclusive control over the range, guaranteeing no concurrent
> access. For example, changing permissions of vmalloc objects."
>

OK so now I think I understand better... this seems to wholly be about unwinding
the convention in this walker code that an mmap lock be taken on init_mm because
you have a context where that doesn't work.

Yeah, even more inclined to say no to this now.

Or if we absolutely cannot do this in apply_to_range(), then we should
explicitly have a function for this, like:

/*
* Does not assert any locks have been taken. You must absolutely be certain
* that appropriate locks are held.
*/
int walk_kernel_page_table_range_unlocked(unsigned long start, unsigned long end,
const struct mm_walk_ops *ops, pgd_t *pgd, void *private);

An alternative would be to have a new parameter that specifies locking to
walk_kerenl_page_table_range(), but I'd rather not have to churn up all the
callers yet again :)

> and the patch description can be modified as
> "
> It is noted at [1] that KFENCE can manipulate kernel pgtable entries during
> softirqs. It does this by calling set_memory_valid() -> __change_memory_common().
> This being a non-sleepable context, we cannot take the init_mm mmap lock.
> Therefore, add PGWALK_NOLOCK to enable walk_page_range_novma() usage without
> locks.
> Currently, apply_to_page_range is being used by __change_memory_common()
> to change permissions over a range of vmalloc space, without any locking.
> Patch 2 in this series shifts to the usage of walk_page_range_novma(), hence
> this patch is needed. We do not need any locks because the vmalloc object
> has exclusive access to the range, i.e two vmalloc objects do not share
> the same physical address.
> "

Thanks for expanding, but this sort of dives into the KFENCE thing without
explaining why or the context or what it relates to. It's like diving into the
ocean to look for an oyster but never mentioning the oyster and only talking
about your wet suit :P

>
>
> >
> > > [1] https://lore.kernel.org/linux-arm-kernel/89d0ad18-4772-4d8f-ae8a-7c48d26a927e@xxxxxxx/
> > Basically expand upon this information.
> >
> > Basically the commit message refers to your usage, but describes a patch
> > that makes it possible to do unlocked page table walks.
> >
> > As I get into below, no pun intended, but this needs to be _locked down_
> > heavily.
> >
> > - Only walk_page_range_novma() should allow it. All other functions should
> > return -EINVAL if this is set.
>
> Sure.
>
> >
> > - walk_page_range_novma() should assert we're in the appropriate context
> > where this is feasible.
>
> There should be two conditions: that the mm is init_mm, and the start address
> belongs to the vmalloc (or module) space. I am a little nervous about the second. On searching
> throughout the codebase, I could find only vmalloc and module addresses getting
> modified through set_memory_* API, but I couldn't prove that all such usages
> are being done on vmalloc/module addresses.

Hmm, yeah that's concerning.

>
> >
> > - Comments should be updated accordingly.
> >
> > - We should assert (at least CONFIG_DEBUG_VM asserts) in every place that
> > checks for a VMA that we are not in this lock mode, since this is
> > disallowed.
> >
> > > Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
> > > ---
> > > include/linux/pagewalk.h | 2 ++
> > > mm/pagewalk.c | 12 ++++++++----
> > > 2 files changed, 10 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/include/linux/pagewalk.h b/include/linux/pagewalk.h
> > > index 9700a29f8afb..9bc8853ed3de 100644
> > > --- a/include/linux/pagewalk.h
> > > +++ b/include/linux/pagewalk.h
> > > @@ -14,6 +14,8 @@ enum page_walk_lock {
> > > PGWALK_WRLOCK = 1,
> > > /* vma is expected to be already write-locked during the walk */
> > > PGWALK_WRLOCK_VERIFY = 2,
> > > + /* no lock is needed */
> > > + PGWALK_NOLOCK = 3,
> > I'd prefer something very explicitly documenting that, at the very least, this
> > can only be used for non-VMA cases.
> >
> > It's hard to think of a name here, but the comment should be explicit as to
> > under what circumstances this is allowed.
> >
> > > };
> > >
> > > /**
> > > diff --git a/mm/pagewalk.c b/mm/pagewalk.c
> > > index e478777c86e1..9657cf4664b2 100644
> > > --- a/mm/pagewalk.c
> > > +++ b/mm/pagewalk.c
> > > @@ -440,6 +440,8 @@ static inline void process_vma_walk_lock(struct vm_area_struct *vma,
> > > case PGWALK_RDLOCK:
> > > /* PGWALK_RDLOCK is handled by process_mm_walk_lock */
> > > break;
> > > + default:
> > > + break;
> > Please no 'default' here, we want to be explicit and cover all cases.
>
> Sure.
>
> >
> > And surely, since you're explicitly only allowing this for non-VMA ranges, this
> > should be a WARN_ON_ONCE() or something?
>
> Sounds good, maybe a WARN_ON_ONCE(vma)?
>
> >
> > > }
> > > #endif
> > > }
> > > @@ -640,10 +642,12 @@ int walk_page_range_novma(struct mm_struct *mm, unsigned long start,
> > > * specified address range from being freed. The caller should take
> > > * other actions to prevent this race.
> > > */
> > All functions other than this should explicitly disallow this locking mode
> > with -EINVAL checks. I do not want to see this locking mode made available
> > in a broken context.
> >
> > The full comment:
> >
> > /*
> > * 1) For walking the user virtual address space:
> > *
> > * The mmap lock protects the page walker from changes to the page
> > * tables during the walk. However a read lock is insufficient to
> > * protect those areas which don't have a VMA as munmap() detaches
> > * the VMAs before downgrading to a read lock and actually tearing
> > * down PTEs/page tables. In which case, the mmap write lock should
> > * be hold.
> > *
> > * 2) For walking the kernel virtual address space:
> > *
> > * The kernel intermediate page tables usually do not be freed, so
> > * the mmap map read lock is sufficient. But there are some exceptions.
> > * E.g. memory hot-remove. In which case, the mmap lock is insufficient
> > * to prevent the intermediate kernel pages tables belonging to the
> > * specified address range from being freed. The caller should take
> > * other actions to prevent this race.
> > */
> >
> > Are you walking kernel memory only? Point 1 above explicitly points out why
> > userland novma memory requires a lock.
> >
> > For point 2 you need to indicate why you don't need to consider hotplugging,
>
> Well, hotunplugging will first offline the physical memory, and since the
> vmalloc object has the reference to the pages, there is no race.

Right, but fundamentally you are holding vmalloc locks no? So this is what
protects things? Or more broadly, vmalloc wholly controls its ranges.

>
> > etc.
> >
> > But as Ryan points out elsewhere, you should be expanding this comment to
> > explain your case...
> >
> > You should also assert you're in a context where this applies and error
> > out/WARN if not.
> >
> > > - if (mm == &init_mm)
> > > - mmap_assert_locked(walk.mm);
> > > - else
> > > - mmap_assert_write_locked(walk.mm);
> > > + if (ops->walk_lock != PGWALK_NOLOCK) {
> > I really don't like the idea that you're allowing no lock for userland mappings.
> >
> > This should at the very least be:
> >
> > if (mm == &init_mm) {
> > if (ops->walk_lock != PGWALK_NOLOCK)
> > mmap_assert_locked(walk.mm);
> > } else {
> > mmap_assert_write_locked(walk.mm);
> > }
>
> Sure.
>
> >
> > > + if (mm == &init_mm)
> > > + mmap_assert_locked(walk.mm);
> > > + else
> > > + mmap_assert_write_locked(walk.mm);
> > > + }
> > >
> > > return walk_pgd_range(start, end, &walk);
> > > }
> > > --
> > > 2.30.2
> > >
> > We have to be _really_ careful with this stuff. It's very fiddly and
> > brokenness can be a security issue.


Return-Path: <linux-kernel+bounces-675581-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 16CE841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:05:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2AAEC1624E4
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:05:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 70E472868B2;
Fri, 6 Jun 2025 10:05:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sdd1t3xB"
Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4947181724;
Fri, 6 Jun 2025 10:05:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204308; cv=none; b=SXycvI0XPNXhTzuXcPX2D6FysWitS/OQKsjmKWg+iHJU3kS5RjE85b2OIuiUvFRwAl9Kdx8s0p3VZHuVDX1ibHRGaj7fs4oA+uLgAaEpm+ZZlJKWWEckw3zppy47enrdRDcKRhotM/nDc4Ee5+o21fDG5jUFN2TbMVEh/keAJ84=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204308; c=relaxed/simple;
bh=zg31OCNDujZUAqHixJFKbfF9+ZIcCZFGjjRq/8K4wso=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=FT//uUgb9LErB8HA3N3d4CRlDtP0dkZKoTMThsGSJFeQAO552gP2aBeTwHZqCYVHh6Ff7RW1DDuAe/UlKTVdEBw+b1YGRMk3dSB2UBxBk+3EX6Xn12Ye+D2yg931IahNeCM0/d5SDvWcUesqkR63rrg5iLgRkJLCrlZQKzlwm8s=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Sdd1t3xB; arc=none smtp.client-ip=209.85.218.43
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-ad89f9bb725so358217366b.2;
Fri, 06 Jun 2025 03:05:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749204303; x=1749809103; darn=vger.kernel.org;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date:from:to
:cc:subject:date:message-id:reply-to;
bh=QhpYN2L+e8ZOlXdHKAWYCgXLcomAnicmHPGk6SGwhY0=;
b=Sdd1t3xBoKvjwdP6LZ5yJOEGEKXRjScbv/VVDdvrIsVxRiQMdIDowcfiz4t3z3RXzG
8Ntn/XT/hQ8onu4E2Vp9pbG0u0L+Ftc/rCdlHU0SRbvzIU555meUiqgweSJzkN1R4eyj
8dTV2Mzv3bBa/1b9E5PHU/+HZTXb7ib1+HayVaa0ekSVrOq75B83y2MMijBFckclyK/b
QajLDZsjnbswFEc2fyGdsXCgxtPlVUlWO8oCq/gZny60Qia0Tocw2DmDVaNYj5xeIm6w
biadyxPXaUdru6ChHsXmjM6dva0oyA4B9iGI6QT3g0dijXd8kOIQKl2K3X0ppBB6VKgG
lPzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749204303; x=1749809103;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=QhpYN2L+e8ZOlXdHKAWYCgXLcomAnicmHPGk6SGwhY0=;
b=AWgN4XChxXiNHfcFGZdx//T+W1gDrkIDdXsn4JXFd4HD+LeydKBZ88XWpdGRCyhUs7
9HUo/0xGJQLJYhdP4vws0vys7dEOHRHAnD9nrjulPeHFJmluUatjmljj9z1jLdelbLg0
0tgtFvCukUcJyP9AFRfNmIZY+Q/ffKf3gsR15U/lB/fIhw7NOW40L81rnC/mdxnnYX5N
wCaRac9woKCIrpuoYVRb54EXDN4D+h25hjbgRcjRx+BjM2uJMOjfHnJDmBMXfJwXVXIH
mG+yfMeJ6fVtftGCE9JFd9lWuAKHA6ZmmvlL9bC4R4AankQMHySIfNC+zXVz3ikDET3x
5r9w==
X-Forwarded-Encrypted: i=1; AJvYcCUe7w0rmerzceGs4fPkzUsI+1PRFMHZYCP3c2nb1HBDBFr/O7foMSIqz52SlxLgfznRrw30KG6kfZjUjSXV@xxxxxxxxxxxxxxx, AJvYcCWNOR+xTC3I7W6MezJzaykee/l3df8K9lUmfGfXqCP7Ix49aTgjawGRQQG+HtqU+I0TGYUg9FABRd8l@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzKzAA68VEFuKb+UcJULt3ao087U/psIJ+7qLELhpEmmpG8gq+E
DXYQ0C7oyu7PIZVbgyf72dXEP3TpDKBN/V0UT3Fj2NTgliW/YInsKzI2D077azljMs9NDw==
X-Gm-Gg: ASbGncskcXGnIF7DgOWOKNBsOIOb9xMFhuYPlyzebgDvF3tLHRikFXDTOfLcgTdEreX
z6gDX1yQo14vmp42DRaiyPYbwoV8HQlKLHNjkaqoJn4nACvepu0cxH2RKhLUMB9aEDo3JYx6PLA
25vnVU485aEdbxQGoga5Dbc2ikY/4GU/NRnaIP5Yr496ygiwWmSjUNqK0p1VDY1vPppcD6eA88O
btjR9vj4nMEoNQK2uJSRuMO1/2u1A1EH7mf3D7EK6FbctvxDOWdBlR9M8cmc4UErTO+SNZjJPv2
5Q7sM7Wvpb9BuAHGNHmzv2oY1jAw/8FoF5zj90yYTcv+nwL+oUUXMNUPbHWp7s41L/3zjf6+IlR
C
X-Google-Smtp-Source: AGHT+IHJ3g9KDsHyFfInaEEVSx+H7Y6yZwCxQ9nsa5Q8ta2kMV05CkLuufoL+/0uzndXu1HOJQdIGg==
X-Received: by 2002:a17:906:c154:b0:ad2:2146:3b89 with SMTP id a640c23a62f3a-ade1a9c8247mr209498466b.47.1749204303107;
Fri, 06 Jun 2025 03:05:03 -0700 (PDT)
Received: from HYB-DlYm71t3hSl.ad.analog.com ([2001:a61:1225:ec01:d1d7:779d:8019:7bb0])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1d754180sm93099166b.9.2025.06.06.03.05.02
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:05:02 -0700 (PDT)
Date: Fri, 6 Jun 2025 12:05:00 +0200
From: Jorge Marques <gastmaier@xxxxxxxxx>
To: Frank Li <Frank.li@xxxxxxx>
Cc: Jorge Marques <jorge.marques@xxxxxxxxxx>,
Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
linux-i3c@xxxxxxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/2] i3c: master: Add driver for Analog Devices I3C
Controller IP
Message-ID: <lmh3y23qcffyyy4oxbyinsfagcawovxgpqiskyhjmwurqx4pri@tg4ipxn4abgo>
References: <20250604-adi-i3c-master-v1-0-0488e80dafcb@xxxxxxxxxx>
<20250604-adi-i3c-master-v1-2-0488e80dafcb@xxxxxxxxxx>
<aECaFQzkPYdfjagK@lizhi-Precision-Tower-5810>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <aECaFQzkPYdfjagK@lizhi-Precision-Tower-5810>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Frank,

Thank you for the review.

I think the only thing up for discussion on this thread is the tx_fifo
packing (see below).

On Wed, Jun 04, 2025 at 03:10:13PM -0400, Frank Li wrote:
> On Wed, Jun 04, 2025 at 05:48:58PM +0200, Jorge Marques wrote:
> > Add support for Analog Devices I3C Controller IP, an AXI-interfaced IP
> > core that supports I3C and I2C devices, multiple speed-grades and
> > I3C IBIs.
> >
> > Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
> > ---
> > MAINTAINERS | 1 +
> > drivers/i3c/master/Kconfig | 11 +
> > drivers/i3c/master/Makefile | 1 +
> > drivers/i3c/master/adi-i3c-master.c | 1063 +++++++++++++++++++++++++++++++++++
> > 4 files changed, 1076 insertions(+)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 6f56e17dcecf902c6812827c1ec3e067c65e9894..9eb5b6c327590725d1641fd4b73e48fc1d1a3954 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -11247,6 +11247,7 @@ I3C DRIVER FOR ANALOG DEVICES I3C CONTROLLER IP
> > M: Jorge Marques <jorge.marques@xxxxxxxxxx>
> > S: Maintained
> > F: Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
> > +F: drivers/i3c/master/adi-i3c-master.c
> >
> > I3C DRIVER FOR CADENCE I3C MASTER IP
> > M: PrzemysÅ?aw Gaj <pgaj@xxxxxxxxxxx>
> > diff --git a/drivers/i3c/master/Kconfig b/drivers/i3c/master/Kconfig
> > index 7b30db3253af9d5c6aee6544c060e491bfbeb643..328b7145cdefa20e708ebfa3383e849ce51c5a71 100644
> > --- a/drivers/i3c/master/Kconfig
> > +++ b/drivers/i3c/master/Kconfig
> > @@ -1,4 +1,15 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > +config ADI_I3C_MASTER
> > + tristate "Analog Devices I3C master driver"
> > + depends on HAS_IOMEM
> > + help
> > + Support for Analog Devices I3C Controller IP, an AXI-interfaced IP
> > + core that supports I3C and I2C devices, multiple speed-grades and
> > + I3C IBIs.
> > +
> > + This driver can also be built as a module. If so, the module
> > + will be called adi-i3c-master.
> > +
> > config CDNS_I3C_MASTER
> > tristate "Cadence I3C master driver"
> > depends on HAS_IOMEM
> > diff --git a/drivers/i3c/master/Makefile b/drivers/i3c/master/Makefile
> > index 3e97960160bc85e5eaf2966ec0c3fae458c2711e..6cc4f4b73e7bdc206b68c750390f9c3cc2ccb199 100644
> > --- a/drivers/i3c/master/Makefile
> > +++ b/drivers/i3c/master/Makefile
> > @@ -1,4 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > +obj-$(CONFIG_ADI_I3C_MASTER) += adi-i3c-master.o
> > obj-$(CONFIG_CDNS_I3C_MASTER) += i3c-master-cdns.o
> > obj-$(CONFIG_DW_I3C_MASTER) += dw-i3c-master.o
> > obj-$(CONFIG_AST2600_I3C_MASTER) += ast2600-i3c-master.o
> > diff --git a/drivers/i3c/master/adi-i3c-master.c b/drivers/i3c/master/adi-i3c-master.c
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..6f44b0b6fc2020bb0131e8e2943806c0a9d9ce7b
> > --- /dev/null
> > +++ b/drivers/i3c/master/adi-i3c-master.c
> > @@ -0,0 +1,1063 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * I3C Controller driver
> > + * Copyright 2024 Analog Devices Inc.
>
> 2025?
>
Ups.
> > + * Author: Jorge Marques <jorge.marques@xxxxxxxxxx>
> > + */
> > +
> > +#include <linux/bitops.h>
> > +#include <linux/clk.h>
> > +#include <linux/err.h>
> > +#include <linux/errno.h>
> > +#include <linux/i3c/master.h>
> > +#include <linux/interrupt.h>
> > +#include <linux/io.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/platform_device.h>
> > +
> > +#define VERSION_MAJOR(x) (((x) >> 16) & 0xff)
> > +#define VERSION_MINOR(x) (((x) >> 8) & 0xff)
> > +#define VERSION_PATCH(x) ((x) & 0xff)
>
> Can you use GEN_MASK and FIELD_GET macro for it?
>
Of course, for V2 I will do for all.
And also reformat the regmap to format:

#define REG_SOME_REG
#define REG_SOME_REG_FIELD_NAME

Which makes way easier to read/debug.
> > +
> > +#define MAX_DEVS 16
> > +
> > +#define REG_VERSION 0x000
> > +#define REG_ENABLE 0x040
> > +#define REG_IRQ_MASK 0x080
> > +#define REG_IRQ_PENDING 0x084
> > +#define REG_CMD_FIFO 0x0d4
> > +#define REG_CMDR_FIFO 0x0d8
> > +#define REG_SDO_FIFO 0x0dc
> > +#define REG_SDI_FIFO 0x0e0
> > +#define REG_IBI_FIFO 0x0e4
> > +#define REG_FIFO_STATUS 0x0e8
> > +#define REG_OPS 0x100
> > +#define REG_IBI_CONFIG 0x140
> > +#define REG_DEV_CHAR 0x180
> > +
> > +#define CMD0_FIFO_IS_CCC BIT(22)
> > +#define CMD0_FIFO_BCAST BIT(21)
> > +#define CMD0_FIFO_SR BIT(20)
> > +#define CMD0_FIFO_LEN(l) ((l) << 8)
> > +#define CMD0_FIFO_LEN_MAX 4095
> > +#define CMD0_FIFO_DEV_ADDR(a) ((a) << 1)
> > +#define CMD0_FIFO_RNW BIT(0)
> > +
> > +#define CMD1_FIFO_CCC(id) ((id) & GENMASK(7, 0))
> > +
> > +#define CMDR_NO_ERROR 0
> > +#define CMDR_CE0_ERROR 1
> > +#define CMDR_CE2_ERROR 4
> > +#define CMDR_NACK_RESP 6
> > +#define CMDR_UDA_ERROR 8
> > +#define CMDR_ERROR(x) (((x) & GENMASK(23, 20)) >> 20)
> > +#define CMDR_XFER_BYTES(x) (((x) & GENMASK(19, 8)) >> 8)
>
> use GET_FIELD
>
Ack.
> > +
> > +#define FIFO_STATUS_CMDR_EMPTY BIT(0)
> > +#define FIFO_STATUS_IBI_EMPTY BIT(1)
> > +#define IRQ_PENDING_CMDR_PENDING BIT(5)
> > +#define IRQ_PENDING_IBI_PENDING BIT(6)
> > +#define IRQ_PENDING_DAA_PENDING BIT(7)
> > +
> > +#define DEV_CHAR_IS_I2C BIT(0)
> > +#define DEV_CHAR_IS_ATTACHED BIT(1)
> > +#define DEV_CHAR_BCR_IBI(x) (((x) & GENMASK(2, 1)) << 1)
> > +#define DEV_CHAR_WEN BIT(8)
> > +#define DEV_CHAR_ADDR(x) (((x) & GENMASK(6, 0)) << 9)
>
> The same here.
>
Ack.
> > +
> > +#define REG_OPS_SET_SG(x) ((x) << 5)
> > +#define REG_OPS_PP_SG_MASK GENMASK(6, 5)
> > +
> > +#define REG_IBI_CONFIG_LISTEN BIT(1)
> > +#define REG_IBI_CONFIG_ENABLE BIT(0)
> > +
> > +enum speed_grade {PP_SG_UNSET, PP_SG_1MHZ, PP_SG_3MHZ, PP_SG_6MHZ, PP_SG_12MHZ};
> > +struct adi_i3c_cmd {
> > + u32 cmd0;
> > + u32 cmd1;
> > + u32 tx_len;
> > + const void *tx_buf;
> > + u32 rx_len;
> > + void *rx_buf;
> > + u32 error;
> > +};
> > +
> > +struct adi_i3c_xfer {
> > + struct list_head node;
> > + struct completion comp;
> > + int ret;
> > + unsigned int ncmds;
> > + unsigned int ncmds_comp;
> > + struct adi_i3c_cmd cmds[];
> > +};
> > +
> > +struct adi_i3c_master {
> > + struct i3c_master_controller base;
> > + u32 free_rr_slots;
> > + unsigned int maxdevs;
> > + struct {
> > + unsigned int num_slots;
> > + struct i3c_dev_desc **slots;
> > + spinlock_t lock; /* Protect IBI slot access */
> > + } ibi;
> > + struct {
> > + struct list_head list;
> > + struct adi_i3c_xfer *cur;
> > + spinlock_t lock; /* Protect transfer */
> > + } xferqueue;
> > + void __iomem *regs;
> > + struct clk *clk;
> > + unsigned long i3c_scl_lim;
> > + struct {
> > + u8 addrs[MAX_DEVS];
> > + u8 index;
> > + } daa;
> > +};
> > +
> > +static inline struct adi_i3c_master *to_adi_i3c_master(struct i3c_master_controller *master)
> > +{
> > + return container_of(master, struct adi_i3c_master, base);
> > +}
> > +
> > +static void adi_i3c_master_wr_to_tx_fifo(struct adi_i3c_master *master,
> > + const u8 *bytes, int nbytes)
> > +{
> > + writesl(master->regs + REG_SDO_FIFO, bytes, nbytes / 4);
> > + if (nbytes & 3) {
> > + u32 tmp = 0;
> > +
> > + memcpy(&tmp, bytes + (nbytes & ~3), nbytes & 3);
>
> ALIGN_DOWN(bytes, 4)?
>
> Do you need conside big/little endian to trim down data?
>

This is due the byte array passed may not be a multiple of 32bits.
If it were, it could be simply

writesl(master->regs + REG_SDO_FIFO, bytes, DIV_ROUND_UP(m, 4));

Also,

writesb(master->regs + REG_SDO_FIFO, bytes, m);

Is not suitable.
cnds and dw i3c tx fifo write do the same.
The data is packed as follows ("D" is discarded):

+----------------------------------------------------+
| Payload transfer, length = 5 |
+--------------------+-------+-------+-------+-------+
| SDO FIFO Stack | Byte3 | Byte2 | Byte1 | Byte0 |
+====================+=======+=======+=======+=======+
| #0 | 0x78 | 0x56 | 0x34 | 0x12 |
+--------------------+-------+-------+-------+-------+
| #1 | D | D | D | 0xFE |
+--------------------+-------+-------+-------+-------+

> > + writesl(master->regs + REG_SDO_FIFO, &tmp, 1);
>
> writel() is enough
>
Ok
> > + }
> > +}
> > +
> > +static void adi_i3c_master_rd_from_rx_fifo(struct adi_i3c_master *master,
> > + u8 *bytes, int nbytes)
> > +{
> > + readsl(master->regs + REG_SDI_FIFO, bytes, nbytes / 4);
> > + if (nbytes & 3) {
> > + u32 tmp;
> > +
> > + readsl(master->regs + REG_SDI_FIFO, &tmp, 1);
>
> readl()
>
Ok
> > + memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3);
> > + }
> > +}
> > +
> > +static bool adi_i3c_master_supports_ccc_cmd(struct i3c_master_controller *m,
> > + const struct i3c_ccc_cmd *cmd)
> > +{
> > + if (cmd->ndests > 1)
> > + return false;
> > +
> > + switch (cmd->id) {
> > + case I3C_CCC_ENEC(true):
> > + case I3C_CCC_ENEC(false):
> > + case I3C_CCC_DISEC(true):
> > + case I3C_CCC_DISEC(false):
> > + case I3C_CCC_RSTDAA(true):
> > + case I3C_CCC_RSTDAA(false):
> > + case I3C_CCC_ENTDAA:
> > + case I3C_CCC_SETDASA:
> > + case I3C_CCC_SETNEWDA:
> > + case I3C_CCC_GETMWL:
> > + case I3C_CCC_GETMRL:
> > + case I3C_CCC_GETPID:
> > + case I3C_CCC_GETBCR:
> > + case I3C_CCC_GETDCR:
> > + case I3C_CCC_GETSTATUS:
> > + case I3C_CCC_GETHDRCAP:
> > + return true;
> > + default:
> > + break;
> > + }
> > +
> > + return false;
> > +}
> > +
> > +static int adi_i3c_master_disable(struct adi_i3c_master *master)
> > +{
> > + writel(~REG_IBI_CONFIG_LISTEN | ~REG_IBI_CONFIG_ENABLE,
> > + master->regs + REG_IBI_CONFIG);
> > +
> > + return 0;
> > +}
> > +
> > +static struct adi_i3c_xfer *adi_i3c_master_alloc_xfer(struct adi_i3c_master *master,
> > + unsigned int ncmds)
> > +{
> > + struct adi_i3c_xfer *xfer;
> > +
> > + xfer = kzalloc(struct_size(xfer, cmds, ncmds), GFP_KERNEL);
> > + if (!xfer)
> > + return NULL;
> > +
> > + INIT_LIST_HEAD(&xfer->node);
> > + xfer->ncmds = ncmds;
> > + xfer->ret = -ETIMEDOUT;
> > +
> > + return xfer;
> > +}
> > +
> > +static void adi_i3c_master_start_xfer_locked(struct adi_i3c_master *master)
> > +{
> > + struct adi_i3c_xfer *xfer = master->xferqueue.cur;
> > + unsigned int i;
> > +
> > + if (!xfer)
> > + return;
> > +
> > + for (i = 0; i < xfer->ncmds; i++) {
> > + struct adi_i3c_cmd *cmd = &xfer->cmds[i];
> > +
> > + adi_i3c_master_wr_to_tx_fifo(master, cmd->tx_buf, cmd->tx_len);
>
> what's happen if data length bigger than fifo size?
>
Right, I will add the safeguards.
The behaviour is to set the minimum between tx_len and tx_fifo_room.
And if there is not enough room, data is lost.
Same for cmd_fifo.

> > + }
> > +
> > + for (i = 0; i < xfer->ncmds; i++) {
> > + struct adi_i3c_cmd *cmd = &xfer->cmds[i];
> > +
> > + writel(cmd->cmd0, master->regs + REG_CMD_FIFO);
> > + if (cmd->cmd0 & CMD0_FIFO_IS_CCC)
> > + writel(cmd->cmd1, master->regs + REG_CMD_FIFO);
> > + }
> > +}
> > +
> > +static void adi_i3c_master_end_xfer_locked(struct adi_i3c_master *master,
> > + u32 pending)
> > +{
> > + struct adi_i3c_xfer *xfer = master->xferqueue.cur;
> > + int i, ret = 0;
> > + u32 status0;
> > +
> > + if (!xfer)
> > + return;
> > +
> > + for (status0 = readl(master->regs + REG_FIFO_STATUS);
> > + !(status0 & FIFO_STATUS_CMDR_EMPTY);
> > + status0 = readl(master->regs + REG_FIFO_STATUS)) {
> > + struct adi_i3c_cmd *cmd;
> > + u32 cmdr, rx_len;
> > +
> > + cmdr = readl(master->regs + REG_CMDR_FIFO);
> > +
> > + cmd = &xfer->cmds[xfer->ncmds_comp++];
> > + rx_len = min_t(u32, CMDR_XFER_BYTES(cmdr), cmd->rx_len);
> > + adi_i3c_master_rd_from_rx_fifo(master, cmd->rx_buf, rx_len);
> > + cmd->error = CMDR_ERROR(cmdr);
>
> what happen if cmds[0] is write, cmds[1] is read.
>
What is important here is to check the direction, I will add checks as
follows were applicable:

if (cmd->cmd0 & REG_CMD_FIFO_0_RNW)

Instead of relying that tx/rx_len are set to 0.
> > + }
> > +
> > + for (i = 0; i < xfer->ncmds; i++) {
> > + switch (xfer->cmds[i].error) {
> > + case CMDR_NO_ERROR:
> > + break;
> > +
> > + case CMDR_CE0_ERROR:
> > + case CMDR_CE2_ERROR:
> > + case CMDR_NACK_RESP:
> > + case CMDR_UDA_ERROR:
> > + ret = -EIO;
> > + break;
> > +
> > + default:
> > + ret = -EINVAL;
> > + break;
> > + }
> > + }
> > +
> > + xfer->ret = ret;
> > +
> > + if (xfer->ncmds_comp != xfer->ncmds)
> > + return;
> > +
> > + complete(&xfer->comp);
> > +
> > + xfer = list_first_entry_or_null(&master->xferqueue.list,
> > + struct adi_i3c_xfer, node);
> > + if (xfer)
> > + list_del_init(&xfer->node);
> > +
> > + master->xferqueue.cur = xfer;
> > + adi_i3c_master_start_xfer_locked(master);
> > +}
> > +
> > +static void adi_i3c_master_queue_xfer(struct adi_i3c_master *master,
> > + struct adi_i3c_xfer *xfer)
> > +{
> > + unsigned long flags;
> > +
> > + init_completion(&xfer->comp);
> > + spin_lock_irqsave(&master->xferqueue.lock, flags);
>
> suggest use guard(spinlock_irqsave)
>
Sure!
> > + if (master->xferqueue.cur) {
> > + list_add_tail(&xfer->node, &master->xferqueue.list);
> > + } else {
> > + master->xferqueue.cur = xfer;
> > + adi_i3c_master_start_xfer_locked(master);
> > + }
> > + spin_unlock_irqrestore(&master->xferqueue.lock, flags);
> > +}
> > +
> > +static void adi_i3c_master_unqueue_xfer(struct adi_i3c_master *master,
> > + struct adi_i3c_xfer *xfer)
> > +{
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&master->xferqueue.lock, flags);
> > + if (master->xferqueue.cur == xfer)
> > + master->xferqueue.cur = NULL;
> > + else
> > + list_del_init(&xfer->node);
> > +
> > + writel(0x01, master->regs + REG_ENABLE);
> > + writel(0x00, master->regs + REG_ENABLE);
> > + writel(IRQ_PENDING_CMDR_PENDING, master->regs + REG_IRQ_MASK);
> > +
> > + spin_unlock_irqrestore(&master->xferqueue.lock, flags);
> > +}
> > +
> > +static enum i3c_error_code adi_i3c_cmd_get_err(struct adi_i3c_cmd *cmd)
> > +{
> > + switch (cmd->error) {
> > + case CMDR_CE0_ERROR:
> > + return I3C_ERROR_M0;
> > +
> > + case CMDR_CE2_ERROR:
> > + case CMDR_NACK_RESP:
> > + return I3C_ERROR_M2;
> > +
> > + default:
> > + break;
> > + }
> > +
> > + return I3C_ERROR_UNKNOWN;
> > +}
> > +
> > +static int adi_i3c_master_send_ccc_cmd(struct i3c_master_controller *m,
> > + struct i3c_ccc_cmd *cmd)
> > +{
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_xfer *xfer;
> > + struct adi_i3c_cmd *ccmd;
> > +
> > + xfer = adi_i3c_master_alloc_xfer(master, 1);
> > + if (!xfer)
> > + return -ENOMEM;
> > +
> > + ccmd = xfer->cmds;
> > + ccmd->cmd1 = CMD1_FIFO_CCC(cmd->id);
> > + ccmd->cmd0 = CMD0_FIFO_IS_CCC |
> > + CMD0_FIFO_LEN(cmd->dests[0].payload.len);
> > +
> > + if (cmd->id & I3C_CCC_DIRECT)
> > + ccmd->cmd0 |= CMD0_FIFO_DEV_ADDR(cmd->dests[0].addr);
> > +
> > + if (cmd->rnw) {
> > + ccmd->cmd0 |= CMD0_FIFO_RNW;
> > + ccmd->rx_buf = cmd->dests[0].payload.data;
> > + ccmd->rx_len = cmd->dests[0].payload.len;
> > + } else {
> > + ccmd->tx_buf = cmd->dests[0].payload.data;
> > + ccmd->tx_len = cmd->dests[0].payload.len;
> > + }
> > +
> > + adi_i3c_master_queue_xfer(master, xfer);
> > + if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000)))
> > + adi_i3c_master_unqueue_xfer(master, xfer);
> > +
> > + cmd->err = adi_i3c_cmd_get_err(&xfer->cmds[0]);
> > + kfree(xfer);
> > +
> > + return 0;
> > +}
> > +
> > +static int adi_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
> > + struct i3c_priv_xfer *xfers,
> > + int nxfers)
> > +{
> > + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_xfer *xfer;
> > + int i, ret;
> > +
> > + for (i = 0; i < nxfers; i++) {
> > + if (xfers[i].len > CMD0_FIFO_LEN_MAX)
> > + return -EOPNOTSUPP;
> > + }
> > +
> > + if (!nxfers)
> > + return 0;
> > +
> > + xfer = adi_i3c_master_alloc_xfer(master, nxfers);
> > + if (!xfer)
> > + return -ENOMEM;
> > +
> > + for (i = 0; i < nxfers; i++) {
> > + struct adi_i3c_cmd *ccmd = &xfer->cmds[i];
> > +
> > + ccmd->cmd0 = CMD0_FIFO_DEV_ADDR(dev->info.dyn_addr);
> > +
> > + if (xfers[i].rnw) {
> > + ccmd->cmd0 |= CMD0_FIFO_RNW;
> > + ccmd->rx_buf = xfers[i].data.in;
> > + ccmd->rx_len = xfers[i].len;
> > + } else {
> > + ccmd->tx_buf = xfers[i].data.out;
> > + ccmd->tx_len = xfers[i].len;
> > + }
> > +
> > + ccmd->cmd0 |= CMD0_FIFO_LEN(xfers[i].len);
> > +
> > + if (i < nxfers - 1)
> > + ccmd->cmd0 |= CMD0_FIFO_SR;
> > +
> > + if (!i)
> > + ccmd->cmd0 |= CMD0_FIFO_BCAST;
> > + }
> > +
> > + adi_i3c_master_queue_xfer(master, xfer);
> > + if (!wait_for_completion_timeout(&xfer->comp,
> > + msecs_to_jiffies(1000)))
> > + adi_i3c_master_unqueue_xfer(master, xfer);
> > +
> > + ret = xfer->ret;
> > +
> > + for (i = 0; i < nxfers; i++)
> > + xfers[i].err = adi_i3c_cmd_get_err(&xfer->cmds[i]);
> > +
> > + kfree(xfer);
> > +
> > + return ret;
> > +}
> > +
> > +struct adi_i3c_i2c_dev_data {
> > + u16 id;
> > + s16 ibi;
> > + struct i3c_generic_ibi_pool *ibi_pool;
> > +};
> > +
> > +static int adi_i3c_master_get_rr_slot(struct adi_i3c_master *master,
> > + u8 dyn_addr)
> > +{
> > + if (!master->free_rr_slots)
> > + return -ENOSPC;
> > +
> > + return ffs(master->free_rr_slots) - 1;
> > +}
> > +
> > +static int adi_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, u8 dyn_addr)
> > +{
> > + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + u8 addr;
> > +
> > + addr = dev->info.dyn_addr ? dev->info.dyn_addr : dev->info.static_addr;
> > +
> > + writel(DEV_CHAR_ADDR(dyn_addr), master->regs + REG_DEV_CHAR);
> > + writel((readl(master->regs + REG_DEV_CHAR) &
> > + ~DEV_CHAR_IS_ATTACHED) | DEV_CHAR_WEN,
> > + master->regs + REG_DEV_CHAR);
> > +
> > + writel(DEV_CHAR_ADDR(addr), master->regs + REG_DEV_CHAR);
> > + writel(readl(master->regs + REG_DEV_CHAR) |
> > + DEV_CHAR_IS_ATTACHED | DEV_CHAR_WEN,
> > + master->regs + REG_DEV_CHAR);
> > +
> > + return 0;
> > +}
> > +
> > +static int adi_i3c_master_attach_i3c_dev(struct i3c_dev_desc *dev)
> > +{
> > + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_i2c_dev_data *data;
> > + int slot;
> > + u8 addr;
> > +
> > + data = kzalloc(sizeof(*data), GFP_KERNEL);
> > + if (!data)
> > + return -ENOMEM;
> > +
> > + slot = adi_i3c_master_get_rr_slot(master, dev->info.dyn_addr);
> > + if (slot < 0) {
> > + kfree(data);
> > + return slot;
> > + }
> > +
> > + data->ibi = -1;
> > + data->id = slot;
> > + i3c_dev_set_master_data(dev, data);
> > + master->free_rr_slots &= ~BIT(slot);
> > +
> > + addr = dev->info.dyn_addr ? dev->info.dyn_addr : dev->info.static_addr;
> > +
> > + writel(DEV_CHAR_ADDR(addr), master->regs + REG_DEV_CHAR);
> > + writel(readl(master->regs + REG_DEV_CHAR) |
> > + DEV_CHAR_IS_ATTACHED | DEV_CHAR_WEN,
> > + master->regs + REG_DEV_CHAR);
> > +
> > + return 0;
> > +}
> > +
> > +static void adi_i3c_master_sync_dev_char(struct i3c_master_controller *m)
> > +{
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct i3c_dev_desc *i3cdev;
> > + u8 addr;
> > +
> > + i3c_bus_for_each_i3cdev(&m->bus, i3cdev) {
> > + addr = i3cdev->info.dyn_addr ?
> > + i3cdev->info.dyn_addr : i3cdev->info.static_addr;
> > + writel(DEV_CHAR_ADDR(addr), master->regs + REG_DEV_CHAR);
> > + writel(readl(master->regs + REG_DEV_CHAR) |
> > + DEV_CHAR_BCR_IBI(i3cdev->info.bcr) | DEV_CHAR_WEN,
> > + master->regs + REG_DEV_CHAR);
> > + }
> > +}
> > +
> > +static void adi_i3c_master_detach_i3c_dev(struct i3c_dev_desc *dev)
> > +{
> > + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev);
> > + u8 addr;
> > +
> > + addr = dev->info.dyn_addr ? dev->info.dyn_addr : dev->info.static_addr;
> > +
> > + writel(DEV_CHAR_ADDR(addr), master->regs + REG_DEV_CHAR);
> > + writel((readl(master->regs + REG_DEV_CHAR) &
> > + ~DEV_CHAR_IS_ATTACHED) | DEV_CHAR_WEN,
> > + master->regs + REG_DEV_CHAR);
> > +
> > + i3c_dev_set_master_data(dev, NULL);
> > + master->free_rr_slots |= BIT(data->id);
> > + kfree(data);
> > +}
> > +
> > +static int adi_i3c_master_attach_i2c_dev(struct i2c_dev_desc *dev)
> > +{
> > + struct i3c_master_controller *m = i2c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_i2c_dev_data *data;
> > + int slot;
> > +
> > + slot = adi_i3c_master_get_rr_slot(master, 0);
> > + if (slot < 0)
> > + return slot;
> > +
> > + data = kzalloc(sizeof(*data), GFP_KERNEL);
> > + if (!data)
> > + return -ENOMEM;
> > +
> > + data->id = slot;
> > + master->free_rr_slots &= ~BIT(slot);
> > + i2c_dev_set_master_data(dev, data);
> > +
> > + writel(DEV_CHAR_ADDR(dev->addr) |
> > + DEV_CHAR_IS_I2C | DEV_CHAR_IS_ATTACHED | DEV_CHAR_WEN,
> > + master->regs + REG_DEV_CHAR);
> > +
> > + return 0;
> > +}
> > +
> > +static void adi_i3c_master_detach_i2c_dev(struct i2c_dev_desc *dev)
> > +{
> > + struct i3c_master_controller *m = i2c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_i2c_dev_data *data = i2c_dev_get_master_data(dev);
> > +
> > + writel(DEV_CHAR_ADDR(dev->addr) |
> > + DEV_CHAR_IS_I2C | DEV_CHAR_WEN,
> > + master->regs + REG_DEV_CHAR);
> > +
> > + i2c_dev_set_master_data(dev, NULL);
> > + master->free_rr_slots |= BIT(data->id);
> > + kfree(data);
> > +}
> > +
> > +static void adi_i3c_master_bus_cleanup(struct i3c_master_controller *m)
> > +{
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > +
> > + adi_i3c_master_disable(master);
> > +}
> > +
> > +static void adi_i3c_master_upd_i3c_scl_lim(struct adi_i3c_master *master)
> > +{
> > + struct i3c_master_controller *m = &master->base;
> > + struct i3c_bus *bus = i3c_master_get_bus(m);
> > + u8 i3c_scl_lim = 0;
> > + struct i3c_dev_desc *dev;
> > + u8 pp_sg;
> > +
> > + i3c_bus_for_each_i3cdev(bus, dev) {
> > + u8 max_fscl;
> > +
> > + max_fscl = max(I3C_CCC_MAX_SDR_FSCL(dev->info.max_read_ds),
> > + I3C_CCC_MAX_SDR_FSCL(dev->info.max_write_ds));
> > +
> > + switch (max_fscl) {
> > + case I3C_SDR1_FSCL_8MHZ:
> > + max_fscl = PP_SG_6MHZ;
> > + break;
> > + case I3C_SDR2_FSCL_6MHZ:
> > + max_fscl = PP_SG_3MHZ;
> > + break;
> > + case I3C_SDR3_FSCL_4MHZ:
> > + max_fscl = PP_SG_3MHZ;
> > + break;
> > + case I3C_SDR4_FSCL_2MHZ:
> > + max_fscl = PP_SG_1MHZ;
> > + break;
> > + case I3C_SDR0_FSCL_MAX:
> > + default:
> > + max_fscl = PP_SG_12MHZ;
> > + break;
> > + }
> > +
> > + if (max_fscl &&
> > + (i3c_scl_lim > max_fscl || !i3c_scl_lim))
> > + i3c_scl_lim = max_fscl;
> > + }
> > +
> > + if (!i3c_scl_lim)
> > + return;
> > +
> > + master->i3c_scl_lim = i3c_scl_lim - 1;
> > +
> > + pp_sg = readl(master->regs + REG_OPS) &
> > + ~REG_OPS_PP_SG_MASK;
> > +
> > + pp_sg |= REG_OPS_SET_SG(master->i3c_scl_lim);
> > +
> > + writel(pp_sg, master->regs + REG_OPS);
> > +}
> > +
> > +static void adi_i3c_master_get_features(struct adi_i3c_master *master,
> > + unsigned int slot,
> > + struct i3c_device_info *info)
> > +{
> > + memset(info, 0, sizeof(*info));
> > +
> > + info->dyn_addr = 0x31;
> > + info->dcr = 0x00;
> > + info->bcr = 0x40;
> > + info->pid = 0;
> > +}
> > +
> > +static int adi_i3c_master_do_daa(struct i3c_master_controller *m)
> > +{
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + int ret;
> > + u32 irq_mask;
> > +
> > + master->daa.index = 0x8;
> > + for (u8 i = 0; i < MAX_DEVS; i++) {
>
> Not sure why need pre-alloc MAX_DEVS address here?
>
Here we just collect 15 free addresses to send during the DAA, the
allocation only occurs at the "Add I3C devices discovered". This driver
does not match an dynamic address with a provisioned id, so the payload
obtained during the DAA is discarded.
> > + ret = i3c_master_get_free_addr(m, master->daa.index);
> > + if (ret < 0)
> > + return -ENOSPC;
> > +
> > + master->daa.index = ret;
> > + master->daa.addrs[i] = master->daa.index;
> > + }
> > + /* Will be reused as index for daa.addrs */
> > + master->daa.index = 0;
> > +
> > + irq_mask = readl(master->regs + REG_IRQ_MASK);
> > + writel(irq_mask | IRQ_PENDING_DAA_PENDING,
> > + master->regs + REG_IRQ_MASK);
> > +
> > + ret = i3c_master_entdaa_locked(&master->base);
> > +
> > + writel(irq_mask, master->regs + REG_IRQ_MASK);
> > +
> > + /* DAA always finishes with CE2_ERROR or NACK_RESP */
> > + if (ret && ret != I3C_ERROR_M2)
> > + return ret;
> > +
> > + /* Add I3C devices discovered */
> > + for (u8 i = 0; i < master->daa.index; i++)
> > + i3c_master_add_i3c_dev_locked(m, master->daa.addrs[i]);
> > + /* Sync retrieved devs info with the IP */
> > + adi_i3c_master_sync_dev_char(m);
> > +
> > + i3c_master_defslvs_locked(&master->base);
> > +
> > + adi_i3c_master_upd_i3c_scl_lim(master);
> > +
> > + return 0;
> > +}
> > +
> > +static int adi_i3c_master_bus_init(struct i3c_master_controller *m)
> > +{
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct i3c_device_info info = { };
> > + int ret;
> > +
> > + ret = i3c_master_get_free_addr(m, 0);
> > + if (ret < 0)
> > + return ret;
> > +
> > + adi_i3c_master_get_features(master, 0, &info);
> > + ret = i3c_master_set_info(&master->base, &info);
> > + if (ret)
> > + return ret;
> > +
> > + writel(REG_IBI_CONFIG_LISTEN | ~REG_IBI_CONFIG_ENABLE,
> > + master->regs + REG_IBI_CONFIG);
> > +
> > + return 0;
> > +}
> > +
> > +static void adi_i3c_master_handle_ibi(struct adi_i3c_master *master,
> > + u32 ibi)
> > +{
> > + struct adi_i3c_i2c_dev_data *data;
> > + struct i3c_ibi_slot *slot;
> > + struct i3c_dev_desc *dev;
> > + u8 da, id;
> > + u8 *mdb;
> > +
> > + da = (ibi >> 17) & GENMASK(6, 0);
> > + for (id = 0; id < master->ibi.num_slots; id++) {
> > + if (master->ibi.slots[id] &&
> > + master->ibi.slots[id]->info.dyn_addr == da)
> > + break;
> > + }
> > +
> > + if (id == master->ibi.num_slots)
> > + return;
> > +
> > + dev = master->ibi.slots[id];
> > + spin_lock(&master->ibi.lock);
>
> use guard(spin_lock);
>
Ack.
> > +
> > + data = i3c_dev_get_master_data(dev);
> > + slot = i3c_generic_ibi_get_free_slot(data->ibi_pool);
> > + if (!slot)
> > + goto out_unlock;
> > +
> > + mdb = slot->data;
> > + mdb[0] = (ibi >> 8) & GENMASK(7, 0);
> > +
> > + slot->len = 1;
> > + i3c_master_queue_ibi(dev, slot);
> > +
> > +out_unlock:
> > + spin_unlock(&master->ibi.lock);
> > +}
> > +
> > +static void adi_i3c_master_demux_ibis(struct adi_i3c_master *master)
> > +{
> > + u32 status0;
> > +
> > + for (status0 = readl(master->regs + REG_FIFO_STATUS);
> > + !(status0 & FIFO_STATUS_IBI_EMPTY);
> > + status0 = readl(master->regs + REG_FIFO_STATUS)) {
> > + u32 ibi = readl(master->regs + REG_IBI_FIFO);
> > +
> > + adi_i3c_master_handle_ibi(master, ibi);
> > + }
> > +}
> > +
> > +static void adi_i3c_master_handle_da_req(struct adi_i3c_master *master)
> > +{
> > + u8 payload0[8];
> > + u32 addr;
> > +
> > + /* Clear device characteristics */
> > + adi_i3c_master_rd_from_rx_fifo(master, payload0, 6);
> > + addr = master->daa.addrs[master->daa.index++];
> > + addr = (addr << 1) | !parity8(addr);
> > +
> > + writel(addr, master->regs + REG_SDO_FIFO);
> > +}
> > +
> > +static irqreturn_t adi_i3c_master_irq(int irq, void *data)
> > +{
> > + struct adi_i3c_master *master = data;
> > + u32 pending;
> > +
> > + pending = readl_relaxed(master->regs + REG_IRQ_PENDING);
> > + if (pending & IRQ_PENDING_CMDR_PENDING) {
> > + spin_lock(&master->xferqueue.lock);
> > + adi_i3c_master_end_xfer_locked(master, pending);
> > + spin_unlock(&master->xferqueue.lock);
> > + }
> > + if (pending & IRQ_PENDING_IBI_PENDING)
> > + adi_i3c_master_demux_ibis(master);
> > + if (pending & IRQ_PENDING_DAA_PENDING)
> > + adi_i3c_master_handle_da_req(master);
> > + writel_relaxed(pending, master->regs + REG_IRQ_PENDING);
>
> this need move just after readl_relaxed().
>
Yes. I had to make a small RTL change to to allow this, since previously
the irq was sticky until resolved, which is uncommon. Now it is latched
on the rising edge and only re-sets on the next event rising edge,
allowing it to be cleared then resolved.
> > +
> > + return IRQ_HANDLED;
> > +}
> > +
> > +static int adi_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
> > + struct i2c_msg *xfers,
> > + int nxfers)
> > +{
> > + struct i3c_master_controller *m = i2c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_xfer *xfer;
> > + int i, ret;
> > +
> > + for (i = 0; i < nxfers; i++) {
> > + if (xfers[i].len > CMD0_FIFO_LEN_MAX)
> > + return -EOPNOTSUPP;
> > + if (xfers[i].flags & I2C_M_TEN)
> > + return -EOPNOTSUPP;
> > + }
> > +
> > + if (!nxfers)
> > + return 0;
> > +
> > + xfer = adi_i3c_master_alloc_xfer(master, nxfers);
> > + if (!xfer)
> > + return -ENOMEM;
> > +
> > + for (i = 0; i < nxfers; i++) {
> > + struct adi_i3c_cmd *ccmd = &xfer->cmds[i];
> > +
> > + ccmd->cmd0 = CMD0_FIFO_DEV_ADDR(xfers[i].addr);
> > +
> > + if (xfers[i].flags & I2C_M_RD) {
> > + ccmd->cmd0 |= CMD0_FIFO_RNW;
> > + ccmd->rx_buf = xfers[i].buf;
> > + ccmd->rx_len = xfers[i].len;
> > + } else {
> > + ccmd->tx_buf = xfers[i].buf;
> > + ccmd->tx_len = xfers[i].len;
> > + }
> > +
> > + ccmd->cmd0 |= CMD0_FIFO_LEN(xfers[i].len);
> > + }
> > +
> > + adi_i3c_master_queue_xfer(master, xfer);
> > + if (!wait_for_completion_timeout(&xfer->comp,
> > + msecs_to_jiffies(1000)))
> > + adi_i3c_master_unqueue_xfer(master, xfer);
> > +
> > + ret = xfer->ret;
> > + kfree(xfer);
> > + return ret;
> > +}
> > +
> > +static int adi_i3c_master_disable_ibi(struct i3c_dev_desc *dev)
> > +{
> > + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct i3c_dev_desc *i3cdev;
> > + bool enabled = 0;
>
> enabled = false if you use bool type.
>
I will set as u32 as suggested below.
> > + int ret;
> > +
> > + ret = i3c_master_disec_locked(m, dev->info.dyn_addr,
> > + I3C_CCC_EVENT_SIR);
> > +
> > + i3c_bus_for_each_i3cdev(&m->bus, i3cdev) {
> > + if (dev != i3cdev && i3cdev->ibi)
> > + enabled |= i3cdev->ibi->enabled;
>
> if you use | here, suggest use u32 enabled
>
Ack.
> > + }
> > + if (!enabled) {
> > + writel(REG_IBI_CONFIG_LISTEN | ~REG_IBI_CONFIG_ENABLE,
> > + master->regs + REG_IBI_CONFIG);
> > + writel(readl(master->regs + REG_IRQ_MASK) | ~IRQ_PENDING_IBI_PENDING,
> > + master->regs + REG_IRQ_MASK);
> > + }
> > +
> > + return ret;
> > +}
> > +
> > +static int adi_i3c_master_enable_ibi(struct i3c_dev_desc *dev)
> > +{
> > + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > +
> > + writel(REG_IBI_CONFIG_LISTEN | REG_IBI_CONFIG_ENABLE,
> > + master->regs + REG_IBI_CONFIG);
> > +
> > + writel(readl(master->regs + REG_IRQ_MASK) | IRQ_PENDING_IBI_PENDING,
> > + master->regs + REG_IRQ_MASK);
> > +
> > + return i3c_master_enec_locked(m, dev->info.dyn_addr,
> > + I3C_CCC_EVENT_SIR);
> > +}
> > +
> > +static int adi_i3c_master_request_ibi(struct i3c_dev_desc *dev,
> > + const struct i3c_ibi_setup *req)
> > +{
> > + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_i2c_dev_data *data;
> > + unsigned long flags;
> > + unsigned int i;
> > +
> > + data = i3c_dev_get_master_data(dev);
> > + data->ibi_pool = i3c_generic_ibi_alloc_pool(dev, req);
> > + if (IS_ERR(data->ibi_pool))
> > + return PTR_ERR(data->ibi_pool);
> > +
> > + spin_lock_irqsave(&master->ibi.lock, flags);
> > + for (i = 0; i < master->ibi.num_slots; i++) {
> > + if (!master->ibi.slots[i]) {
> > + data->ibi = i;
> > + master->ibi.slots[i] = dev;
> > + break;
> > + }
> > + }
> > + spin_unlock_irqrestore(&master->ibi.lock, flags);
> > +
> > + if (i < master->ibi.num_slots)
> > + return 0;
> > +
> > + i3c_generic_ibi_free_pool(data->ibi_pool);
> > + data->ibi_pool = NULL;
> > +
> > + return -ENOSPC;
> > +}
> > +
> > +static void adi_i3c_master_free_ibi(struct i3c_dev_desc *dev)
> > +{
> > + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> > + struct adi_i3c_master *master = to_adi_i3c_master(m);
> > + struct adi_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev);
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&master->ibi.lock, flags);
> > + master->ibi.slots[data->ibi] = NULL;
> > + data->ibi = -1;
> > + spin_unlock_irqrestore(&master->ibi.lock, flags);
> > +
> > + i3c_generic_ibi_free_pool(data->ibi_pool);
> > +}
> > +
> > +static void adi_i3c_master_recycle_ibi_slot(struct i3c_dev_desc *dev,
> > + struct i3c_ibi_slot *slot)
> > +{
> > + struct adi_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev);
> > +
> > + i3c_generic_ibi_recycle_slot(data->ibi_pool, slot);
> > +}
> > +
> > +static const struct i3c_master_controller_ops adi_i3c_master_ops = {
> > + .bus_init = adi_i3c_master_bus_init,
> > + .bus_cleanup = adi_i3c_master_bus_cleanup,
> > + .attach_i3c_dev = adi_i3c_master_attach_i3c_dev,
> > + .reattach_i3c_dev = adi_i3c_master_reattach_i3c_dev,
> > + .detach_i3c_dev = adi_i3c_master_detach_i3c_dev,
> > + .attach_i2c_dev = adi_i3c_master_attach_i2c_dev,
> > + .detach_i2c_dev = adi_i3c_master_detach_i2c_dev,
> > + .do_daa = adi_i3c_master_do_daa,
> > + .supports_ccc_cmd = adi_i3c_master_supports_ccc_cmd,
> > + .send_ccc_cmd = adi_i3c_master_send_ccc_cmd,
> > + .priv_xfers = adi_i3c_master_priv_xfers,
> > + .i2c_xfers = adi_i3c_master_i2c_xfers,
> > + .request_ibi = adi_i3c_master_request_ibi,
> > + .enable_ibi = adi_i3c_master_enable_ibi,
> > + .disable_ibi = adi_i3c_master_disable_ibi,
> > + .free_ibi = adi_i3c_master_free_ibi,
> > + .recycle_ibi_slot = adi_i3c_master_recycle_ibi_slot,
> > +};
> > +
> > +static const struct of_device_id adi_i3c_master_of_match[] = {
> > + { .compatible = "adi,i3c-master" },
> > + {}
> > +};
> > +
> > +static int adi_i3c_master_probe(struct platform_device *pdev)
> > +{
> > + struct adi_i3c_master *master;
> > + unsigned int version;
> > + int ret, irq;
> > +
> > + master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL);
> > + if (!master)
> > + return -ENOMEM;
> > +
> > + master->regs = devm_platform_ioremap_resource(pdev, 0);
> > + if (IS_ERR(master->regs))
> > + return PTR_ERR(master->regs);
> > +
> > + master->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
> > + if (IS_ERR(master->clk))
> > + return PTR_ERR(master->clk);
> > +
> > + irq = platform_get_irq(pdev, 0);
> > + if (irq < 0)
> > + return irq;
> > +
> > + ret = clk_prepare_enable(master->clk);
>
> use devm_clk_get_enabled() instead of devm_clk_get() to simple err handle.
>
Ack.
> > + if (ret)
> > + goto err_clk_disable;
> > +
> > + version = readl(master->regs + REG_VERSION);
> > + if (VERSION_MAJOR(version) != 0) {
> > + dev_err(&pdev->dev, "Unsupported IP version %u.%u.%c\n",
> > + VERSION_MAJOR(version),
> > + VERSION_MINOR(version),
> > + VERSION_PATCH(version));
> > + ret = -EINVAL;
> > + goto err_clk_disable;
> > + }
> > +
> > + writel(0x00, master->regs + REG_ENABLE);
> > + writel(0x00, master->regs + REG_IRQ_MASK);
> > +
> > + ret = devm_request_irq(&pdev->dev, irq, adi_i3c_master_irq, 0,
> > + dev_name(&pdev->dev), master);
> > + if (ret)
> > + goto err_clk_disable;
>
> needn't goto if you use devm_clk_get_enabled()
>
> Frank
Ack.

Best regards,
Jorge
> > +
> > + platform_set_drvdata(pdev, master);
> > +
> > + master->maxdevs = MAX_DEVS;
> > + master->free_rr_slots = GENMASK(master->maxdevs, 1);
> > +
> > + writel(IRQ_PENDING_CMDR_PENDING, master->regs + REG_IRQ_MASK);
> > +
> > + spin_lock_init(&master->ibi.lock);
> > + master->ibi.num_slots = 15;
> > + master->ibi.slots = devm_kcalloc(&pdev->dev, master->ibi.num_slots,
> > + sizeof(*master->ibi.slots),
> > + GFP_KERNEL);
> > + if (!master->ibi.slots) {
> > + ret = -ENOMEM;
> > + goto err_clk_disable;
> > + }
> > +
> > + ret = i3c_master_register(&master->base, &pdev->dev,
> > + &adi_i3c_master_ops, false);
> > + if (ret)
> > + goto err_clk_disable;
> > +
> > + return 0;
> > +
> > +err_clk_disable:
> > + clk_disable_unprepare(master->clk);
> > +
> > + return ret;
> > +}
> > +
> > +static void adi_i3c_master_remove(struct platform_device *pdev)
> > +{
> > + struct adi_i3c_master *master = platform_get_drvdata(pdev);
> > +
> > + i3c_master_unregister(&master->base);
> > +
> > + writel(0xff, master->regs + REG_IRQ_PENDING);
> > + writel(0x00, master->regs + REG_IRQ_MASK);
> > + writel(0x01, master->regs + REG_ENABLE);
> > +
> > + clk_disable_unprepare(master->clk);
> > +}
> > +
> > +static struct platform_driver adi_i3c_master = {
> > + .probe = adi_i3c_master_probe,
> > + .remove = adi_i3c_master_remove,
> > + .driver = {
> > + .name = "adi-i3c-master",
> > + .of_match_table = adi_i3c_master_of_match,
> > + },
> > +};
> > +module_platform_driver(adi_i3c_master);
> > +
> > +MODULE_AUTHOR("Jorge Marques <jorge.marques@xxxxxxxxxx>");
> > +MODULE_DESCRIPTION("Analog Devices I3C master driver");
> > +MODULE_LICENSE("GPL");
> >
> > --
> > 2.49.0
> >
>
> --
> linux-i3c mailing list
> linux-i3c@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-i3c


Return-Path: <linux-kernel+bounces-675582-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 54C2341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:09:03 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id F39D53AE30D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:08:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id F1CD5286887;
Fri, 6 Jun 2025 10:08:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="efUhyBqQ"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 D620281724
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:08:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204535; cv=none; b=nv4PYp1GgKCtvWfTtY2os5QWe9fX9VrB89cwn8zxe3MIV1OBLmyQMQJ0/kIUzT2LGBMjZXWiBAowRt3UNF6X4g6n3x3XwCSeOsIR5kxD/1iQN9qN5+y728U90X87NhvpeVQthUK+ar3TBjbEueQnb/iapX9D0oaOs72/1vOS6js=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204535; c=relaxed/simple;
bh=HpVL8Yd+Dmblvp5wZsu8Vt28y80Yk8bxFEyE6m2HD8Q=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=MuRvih51X43/lRdeDK9MxBQZpZWyMIYnTSrBuwwCbBr+KOnpjjk+G23ve9F8gDjwDyi3zCkyk+H9XZpD+sUERIaJRe+xSff3PwRh7fhPWXNqn/eid+YHssHaOPZQ0LTzYV9ZCJyX93CbtbUsJ6FeTXX47vkpfgmD8y59629SehQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=efUhyBqQ; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749204532;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=LqWL6kmiGthUPf56Vxhpep2m/EM/PHy4Ey78DgkqyIU=;
b=efUhyBqQgF3Cfiy2uMeHgju/9eG+De9kKO0RTbx1NisQi+ZvWNquCKsXl23f/+Y+yoiIR+
maYtwknB5kYoccRZeIKA7b09qkRGop+ZFboHDcZcNZ7u9B+eVss56XDx4VvCn9NdVtp6hP
p6AkKWK4ngffhSraDsH5X69bgX5K4Ws=
Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com
[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-650-lCjM-MCxOPyUEcQ13hYvPQ-1; Fri, 06 Jun 2025 06:08:51 -0400
X-MC-Unique: lCjM-MCxOPyUEcQ13hYvPQ-1
X-Mimecast-MFC-AGG-ID: lCjM-MCxOPyUEcQ13hYvPQ_1749204530
Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-450cb8f8b1bso5386905e9.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:08:50 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749204530; x=1749809330;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=LqWL6kmiGthUPf56Vxhpep2m/EM/PHy4Ey78DgkqyIU=;
b=Kqwvc/jEwVdyVwwbQjGoxOF320sBSTF3xi6Y0oRUZoXMGmaoMGMEnI8nVx9QXVnl6e
D4yfgTBx/G7z/ZeAlo4vMwqI0SK6iYX4w6IrbutiIiVv9OFtZN8lI0GuepwnFdDRYj86
Af4AQQGvNhce6fGXmSkK6TPhIa0DcmfW/0OCMHKBfnTXCoeVBPLhoS7zZjTNH+JOh8jj
GcdsNZg3iNhSlK4eLMId6djaoEz0vaU8v8X4lWMX2oLhq+ldJ0226X2qT0cb8m7JrT3v
rl1klcbBx5UG6A3kiWkZIRT6KfLCy+DSd1hDSbboXMKZCvxNDPyelGKlmIn66yUfiDNH
OoXQ==
X-Forwarded-Encrypted: i=1; AJvYcCV7DYuDRfru0uGZMtn2lSl3mOiz9WOpaUpPMpACj0d5kuUNssDGfKjRdVQIqOwpLpy8KwP6aKTcH8pO6cI=@vger.kernel.org
X-Gm-Message-State: AOJu0YzkKA6I6qOCvpF1MVLlmbu93gtLFbgQ7owL7SNXJvQYphnhb8aO
xuhbYBlQifhtf2GMSLnh5OPTgb+spHuVfrSc9ak1zMvU71XOdeOIDvLqxq54Flf3iTxgSWWIsXX
uLA69IUcyh5oRXmxmuBjqYE2hiLPzm7gWAawbCxQ0nbcKAanC3ThbkzRdE0Q8W8WPnA==
X-Gm-Gg: ASbGncuS02LcjbA2yPuAYdidm/jGO1ZZg4FvF9lWIMAoqE8Mm3rB2VvntY4KJygfrSh
kxeVsJkafNCL2Iw2zfaRojTwK71nqUqYA7fcsfwl6lAK6kRKi48HNdS+nIdrsLHYpL9s+xYpRLL
YC/LJYs+6Qsjs77E2Wp+PHs2+2o6zPxQpqp9Dp8c6D0LvhTAHbA6olkmtPL+e64RgoQjy8bWP5b
ScFnJ5CW5CXq0dwFpcMBz4cTb0AhEdtpBKV5ePeilwLUPxEHyWEe59uWPnPqh/D3E9MJK9H2GRr
NGx+8LJAxaqzqpGa872MU5LxTHsDVQtoFefy1Sf2YFDYOtPAWwM944MrJXs8Qkq3u/5C2LNLVb3
qkI/VCir9MnJ+4zjDub7C3KO4UkEONs+EGRPeAyw2/w==
X-Received: by 2002:a05:600c:8b11:b0:43d:77c5:9c1a with SMTP id 5b1f17b1804b1-4520137401bmr29283125e9.4.1749204529755;
Fri, 06 Jun 2025 03:08:49 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHPp5BZyf10iS7zveknOd4qj8+XlDxUekpiGQZEgOcw1eiN9sle9w8iR0ThEwJZwS/k9kEuiQ==
X-Received: by 2002:a05:600c:8b11:b0:43d:77c5:9c1a with SMTP id 5b1f17b1804b1-4520137401bmr29282795e9.4.1749204529310;
Fri, 06 Jun 2025 03:08:49 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-452730b9b3esm15826005e9.25.2025.06.06.03.08.47
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 03:08:48 -0700 (PDT)
Message-ID: <63145e68-76f7-44a1-b3fb-1213eaa959d0@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:08:47 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/1] mm/ksm: add ksm_pages_sharing for each process to
calculate profit more accurately
To: Longlong Xia <xialonglong@xxxxxxxxxx>, akpm@xxxxxxxxxxxxxxxxxxxx,
xu.xin16@xxxxxxxxxx
Cc: chengming.zhou@xxxxxxxxx, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Stefan Roesch <shr@xxxxxxxxxxxx>
References: <20250606070314.3028593-1-xialonglong@xxxxxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250606070314.3028593-1-xialonglong@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 09:03, Longlong Xia wrote:

CCing Stefan.

> The general_profit_show() function only considers ksm_pages_sharing,
> while ksm_process_profit() includes both ksm_pages_sharing and
> ksm_pages_shared for each process. This leads to a mismatch between
> the total profits from ksm_process_profit() and general_profit_show().
>
> Based on my tests, the sum of ksm_process_profit() for all processes
> can be up to 20% higher than general_profit_show(), depending on
> the size of page_shared. For individual processes, the ratio of
> ksm_pages_sharing to ksm_merging_pages is usually not equal to 1.
>
> To resolve this, we suggest introducing ksm_pages_sharing for each
> process to accurately calculate its pages_sharing, ensuring
> ksm_process_profit() reflects shared memory benefits more accurately.
>
> Add a new proc file named as ksm_pages_sharing both under /proc/<pid>/

It's an entry in the file, not a new file.

> and /proc/self/ksm_stat/ to indicate the saved pages of this process.
> (not including ksm_zero_pages)

Curious, why is updating ksm_process_profit() insufficient and we also
have to expose ksm_pages_sharing?

>
> Suggested-by: Xu Xin <xu.xin16@xxxxxxxxxx>
> Signed-off-by: Longlong Xia <xialonglong@xxxxxxxxxx>
> ---
> Documentation/admin-guide/mm/ksm.rst | 5 +++--
> Documentation/filesystems/proc.rst | 8 ++++++++
> fs/proc/base.c | 18 ++++++++++++++++++
> include/linux/mm_types.h | 5 +++++
> mm/ksm.c | 12 ++++++++----
> 5 files changed, 42 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst
> index ad8e7a41f3b5..0b33ef98930f 100644
> --- a/Documentation/admin-guide/mm/ksm.rst
> +++ b/Documentation/admin-guide/mm/ksm.rst
> @@ -256,9 +256,10 @@ several times, which are unprofitable memory consumed.
> process_profit =~ ksm_saved_pages * sizeof(page) -
> ksm_rmap_items * sizeof(rmap_item).
>
> - where ksm_saved_pages equals to the sum of ``ksm_merging_pages`` and
> + where ksm_saved_pages equals to the sum of ``ksm_pages_sharing`` and
> ``ksm_zero_pages``, both of which are shown under the directory
> - ``/proc/<pid>/ksm_stat``, and ksm_rmap_items is also shown in
> + ``/proc/<pid>/ksm_stat``, ksm_merging_pages and ksm_rmap_items are
> + also shown in
> ``/proc/<pid>/ksm_stat``. The process profit is also shown in
> ``/proc/<pid>/ksm_stat`` as ksm_process_profit.
>
> diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst
> index 2a17865dfe39..e14ea8389500 100644
> --- a/Documentation/filesystems/proc.rst
> +++ b/Documentation/filesystems/proc.rst
> @@ -2290,6 +2290,7 @@ Example
> / # cat /proc/self/ksm_stat
> ksm_rmap_items 0
> ksm_zero_pages 0
> + ksm_pages_sharing 0
> ksm_merging_pages 0
> ksm_process_profit 0
> ksm_merge_any: no
> @@ -2312,6 +2313,13 @@ ksm_zero_pages
> When /sys/kernel/mm/ksm/use_zero_pages is enabled, it represent how many
> empty pages are merged with kernel zero pages by KSM.
>
> +ksm_pages_sharing
> +^^^^^^^^^^^^^^^^^
> +
> +It represents how many pages saved of this process.
> +(not including ksm_zero_pages). It is the same with what
> +/proc/<pid>/ksm_pages_sharing shows.
> +> ksm_merging_pages
> ^^^^^^^^^^^^^^^^^
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index c667702dc69b..327bf82acf54 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -3262,6 +3262,21 @@ static int proc_pid_ksm_merging_pages(struct seq_file *m, struct pid_namespace *
>
> return 0;
> }
> +
> +static int proc_pid_ksm_pages_sharing(struct seq_file *m, struct pid_namespace *ns,
> + struct pid *pid, struct task_struct *task)
> +{
> + struct mm_struct *mm;
> +
> + mm = get_task_mm(task);
> + if (mm) {
> + seq_printf(m, "%lu\n", mm->ksm_pages_sharing);
> + mmput(mm);
> + }
> +
> + return 0;
> +}
> +
> static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns,
> struct pid *pid, struct task_struct *task)
> {
> @@ -3272,6 +3287,7 @@ static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns,
> if (mm) {
> seq_printf(m, "ksm_rmap_items %lu\n", mm->ksm_rmap_items);
> seq_printf(m, "ksm_zero_pages %ld\n", mm_ksm_zero_pages(mm));
> + seq_printf(m, "ksm_pages_sharing %lu\n", mm->ksm_pages_sharing);
> seq_printf(m, "ksm_merging_pages %lu\n", mm->ksm_merging_pages);
> seq_printf(m, "ksm_process_profit %ld\n", ksm_process_profit(mm));
> seq_printf(m, "ksm_merge_any: %s\n",
> @@ -3421,6 +3437,7 @@ static const struct pid_entry tgid_base_stuff[] = {
> ONE("seccomp_cache", S_IRUSR, proc_pid_seccomp_cache),
> #endif
> #ifdef CONFIG_KSM
> + ONE("ksm_pages_sharing", S_IRUSR, proc_pid_ksm_pages_sharing),
> ONE("ksm_merging_pages", S_IRUSR, proc_pid_ksm_merging_pages),
> ONE("ksm_stat", S_IRUSR, proc_pid_ksm_stat),
> #endif
> @@ -3758,6 +3775,7 @@ static const struct pid_entry tid_base_stuff[] = {
> ONE("seccomp_cache", S_IRUSR, proc_pid_seccomp_cache),
> #endif
> #ifdef CONFIG_KSM
> + ONE("ksm_pages_sharing", S_IRUSR, proc_pid_ksm_pages_sharing),
> ONE("ksm_merging_pages", S_IRUSR, proc_pid_ksm_merging_pages),
> ONE("ksm_stat", S_IRUSR, proc_pid_ksm_stat),
> #endif
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index d6b91e8a66d6..d260cb09c10a 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -1176,6 +1176,11 @@ struct mm_struct {
> * merging (not including ksm_zero_pages).
> */
> unsigned long ksm_merging_pages;
> + /*
> + * Represents how many pages saved of this process.
> + * (not including ksm_zero_pages).
> + */
> + unsigned long ksm_pages_sharing;
> /*
> * Represent how many pages are checked for ksm merging
> * including merged and not merged.
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 8583fb91ef13..c2d85ea07b1c 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -824,6 +824,7 @@ static void remove_node_from_stable_tree(struct ksm_stable_node *stable_node)
> hlist_for_each_entry(rmap_item, &stable_node->hlist, hlist) {
> if (rmap_item->hlist.next) {
> ksm_pages_sharing--;
> + rmap_item->mm->ksm_pages_sharing--;
> trace_ksm_remove_rmap_item(stable_node->kpfn, rmap_item, rmap_item->mm);
> } else {
> ksm_pages_shared--;
> @@ -976,8 +977,10 @@ static void remove_rmap_item_from_tree(struct ksm_rmap_item *rmap_item)
> folio_unlock(folio);
> folio_put(folio);
>
> - if (!hlist_empty(&stable_node->hlist))
> + if (!hlist_empty(&stable_node->hlist)) {
> ksm_pages_sharing--;
> + rmap_item->mm->ksm_pages_sharing--;
> + }


Hm, I am wondering if that works. Stable nodes are not per MM, so can't
we create an accounting imbalance for one MM somehow?

(did not look into all the details, just something that came to mind)

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675583-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9153841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:10:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id BDDE216CCC7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:10:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A4C1286D6F;
Fri, 6 Jun 2025 10:09:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="AKGLe6jE"
Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131])
(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 646AB28466E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:09:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204595; cv=none; b=uSoYDK2POL0ZKJxUkSVX282MVJ26uhY+JItpibYKywGqbuicNhL7CA/zvVx73GEpZkaJ8Ku/NACBFnUi+HqfnRubxArOOy+chGnpqHlIkaeO+gtmabcbu9ce36VjD8NmU0FNK46pQL6uSN15nQ3W3bjMHiFlk3L5wQJP3E9tn+0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204595; c=relaxed/simple;
bh=LpL31W6AKDCpdo/fRCicU1F0HGSNhPmft1JV8Pa5bLU=;
h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TM2PBxY62CSPm5xrezACcmvnLLLXti6bWHoU4p/Ee0qsMUNZgrza5LXlfTjmDcgrf2ysqoQ1fKE/xSAzOlNtBxxwoUDDP0/cYBr1GkOhRjxl7moCqF3Hdwz2ENWK8J6LINODorhnDmQT2dmyILyAeILYLr8rVdSPrMzdKh0uNB0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=AKGLe6jE; arc=none smtp.client-ip=205.220.180.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com
Received: from pps.filterd (m0279870.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565ox32032298
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:09:51 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=
cc:content-transfer-encoding:date:from:message-id:mime-version
:subject:to; s=qcppdkim1; bh=1Rull5WUa5O/co7lCOuxKulj8U2Z6zdeHoH
V9/g0S9I=; b=AKGLe6jEmO+oDiPNCgLtN/CuAN6XN+v1tEqUqlW4/pGOCi7POa6
ILJ8a4+a36YxnCcp3T7ymkdEfvHdsphU5CNX4pNezkyYD7/aZJQal+2DhWPh8JMO
Mr/AxO9Sfq0qferAyJW4M6cBNPWvk6a0q2V0oBE/C+qiOHWlESmW1qaZmbuzxNlp
VIBYRRlyaLoymBzBgMtkKegF0MlUM8+7ourNSudo9QcHUyupWm7AFK+18iz8DxgB
vTs4w1CjPnx5VrA9OGDFtRmt/7JYJPTtNFS6o4/MrVSdqcS/HJunrMaOfrg6Q+fb
VtOn4Nev4Ub2PBSdqHFHGDlVd1ve3gLjBpQ==
Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471sfv35jj-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 10:09:51 +0000 (GMT)
Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7ceb5b5140eso337108085a.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:09:50 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749204590; x=1749809390;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=1Rull5WUa5O/co7lCOuxKulj8U2Z6zdeHoHV9/g0S9I=;
b=qYvmHUW38IzG481IDxIxd6ADLBVkbOAVGd31Fe/OD2jdqBnP1ziF93FbXGWbKAEpTC
gPa+oCPXac86udofWSbr3YxZ9n984BDdedp0xohP0HQv3ER5rNyo0FwCbAfBkwnV4kq8
xzlXrU/TQ3kWeS9giMlDoLUUn6zXUlhuq1OB7n1BKbd/Wop4aoFitnmgo1NcwcA4VWgR
ZMUzjNwQk4QGEqm2WhBfyyb1zTyExxmEAbAsN4piJp3JqqnrDOhOugsb8LsBGrOWN6mp
b8A3TG4AemeVW3TbgOoUA1In4/oXthqOCZIvnMNmVoNRkRxtt/2P8yqT294bML6KZhHa
Z5tw==
X-Forwarded-Encrypted: i=1; AJvYcCU6Ko05ibcOv2B+K5euTtU0bWpu6twQu2ZnhL2/YogUgRQI1fKar1GPLc4lZ+MpOlLurDun97bLFIQzHrE=@vger.kernel.org
X-Gm-Message-State: AOJu0YzM/+1UqZ9uIWHUbfOkmsG4OdQjrWyskAQ0F3X08rBOr64ANeft
4UOqx0mH5PUkKC7LhCwsHjHnnxI/xWMhs6mNaWCxFDEd4RIG6FNz90xz4cbwoLF4zdmoa8NV38/
OYrjt0mQDnaEOh0LRs2jISXbYxv3SEKKsPztl0DQcdfkEkV9MMGQIUlGlr4SWx4ssQsk=
X-Gm-Gg: ASbGncuYp41QNIrSK8wchF9CPn/+RpB6sj01rnZ67N84TdaMIi8eAigR91UE2kJAoTb
HAon+EwZG5oseYoo980HmmeQR5olIawDLMBUOyMbmRupa2aTkRLe1J2OrB2WMMT6OWx6HKrL/8Q
JNSeEcdG29wywvpSf/pHOgSJvd2rOIH9CB88t4VJ16R903S64McI+NfMjoaxYYMaehjPXNeQQUc
UklwxwK8ZrtTvi1czD2WuWPVEsReGQJPGhqhHXSuMzO4s/HQQgtrwfZlSP8HuHezRZE6FxZnz9d
B2LfAyYeeP+GoJZU+hY0BHNLW6rHARcg8yraFCppP4YvBA30BKXu3+m/uweSWtBdzA==
X-Received: by 2002:a05:620a:1b99:b0:7c5:4adb:782a with SMTP id af79cd13be357-7d229851bb9mr483085685a.9.1749204590316;
Fri, 06 Jun 2025 03:09:50 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IENkAzJPgUxlRrOfxnaDBFgN+TY7Ep3pNndFgZuX9TRNL3Vyzjg5cluQwW3LY0RCEI363Xj0w==
X-Received: by 2002:a05:620a:1b99:b0:7c5:4adb:782a with SMTP id af79cd13be357-7d229851bb9mr483076885a.9.1749204589288;
Fri, 06 Jun 2025 03:09:49 -0700 (PDT)
Received: from trex.. (142.red-79-144-193.dynamicip.rima-tde.net. [79.144.193.142])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a532464581sm1415418f8f.95.2025.06.06.03.09.48
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:09:48 -0700 (PDT)
From: Jorge Ramirez-Ortiz <jorge.ramirez@xxxxxxxxxxxxxxxx>
To: jorge.ramirez@xxxxxxxxxxxxxxxx, stanimir.k.varbanov@xxxxxxxxx,
quic_vgarodia@xxxxxxxxxxx, bryan.odonoghue@xxxxxxxxxx,
mchehab@xxxxxxxxxx
Cc: linux-media@xxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] media: venus: protect against spurious interrupts during probe
Date: Fri, 6 Jun 2025 12:09:44 +0200
Message-Id: <20250606100944.4104715-1-jorge.ramirez@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Authority-Analysis: v=2.4 cv=CY8I5Krl c=1 sm=1 tr=0 ts=6842be6f cx=c_pps
a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=jucdD076RO8dzeEYkB3eYw==:17
a=6IFa9wvqVegA:10 a=EUspDBNiAAAA:8 a=4rlHZoThpNXEEVWAyUMA:9
a=PEH46H7Ffwr30OY-TuGO:22
X-Proofpoint-ORIG-GUID: nBTk1AwF4mK5yzeo8-BEybU9qkQGyKtQ
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5MyBTYWx0ZWRfX8Fr4FIwbcYJx
I3E2TBwGXCAG/1aBvfJaM+hhGdPWHmKEvMr4bXXZaXaIgR7X3E9/WXKZ2MlFkyb7eKmuaoEoYnK
OEpPC5iCb5fwIqYWKH4epozry1KWc2QlYXvWc7vmc9R8tzdPxBj2IZW7XV7IcGm85MAc73RnQNU
jrNqaKrQxbnl0Naeg2AXgpnZOWAOp92YzCkQIpHGRmMq+89vKTo4z1h/nkCqYXBWlvNUu6EaRxs
MoTrmzlhMgIH4OHppx1WyAlJr4sCYEwm0UuYAtI5toV1R5NQoCNOgJc8NxR2Al69v2fv+QTVHl6
U/RCq2xYFjOqfWY/LyU/sE5Kd4ba4ZuQzSpFdIReiVe3YwhhJeRGLOgW1WzyfECXOgjmEluRB+f
mXf8e0lP86uMfRzlVTLcbwz9HBNj3/wPqq4sel8B7xKrnRxWt41z6dlybz/dpPnqx1fw3DwD
X-Proofpoint-GUID: nBTk1AwF4mK5yzeo8-BEybU9qkQGyKtQ
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
priorityscore=1501 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0
malwarescore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0
phishscore=0 mlxlogscore=986 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060093
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Jorge Ramirez-Ortiz <jorge@xxxxxxxxxxxx>

Make sure the interrupt handler is initialized before the interrupt is
registered.

If the IRQ is registered before hfi_create(), it's possible that an
interrupt fires before the handler setup is complete, leading to a NULL
dereference.

This error condition has been observed during sytem boot on Rb3Gen2.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/venus/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 77d48578ecd2..04641a7dcc98 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
init_waitqueue_head(&core->sys_err_done);

- ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "venus", core);
+ ret = hfi_create(core, &venus_core_ops);
if (ret)
goto err_core_put;

- ret = hfi_create(core, &venus_core_ops);
+ ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
+ IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ "venus", core);
if (ret)
goto err_core_put;

--
2.34.1



Return-Path: <linux-kernel+bounces-675584-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1FDDB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:11:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6C0EF16D11A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:11:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A3584286D78;
Fri, 6 Jun 2025 10:10:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bIKBcX83"
Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9034E81724;
Fri, 6 Jun 2025 10:10:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204651; cv=none; b=X/vmDbTVG4n++oWA9aJ0F5U18u2LPdhyVm+PJARuVp4J7ENO5c1AEtVeYQqd/dqaltedejArB4gutLg+11kA+60rYjBYneJHdoZvVHI//EhAxFnnZ434/JKApASJpBT078opJTcFwN/2vOT+aLRaeP8s5Eg1AMOOvXIVc0ROqtE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204651; c=relaxed/simple;
bh=w3jvPKDcZ5KnZ8bgfQHEt/tnSSP/RaDEPYHKY4JFfQk=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=K3cA1FMXLGvYCKSAOhuLwHkgvgdUS5WBib7/6962QGwLN9n05/zP54ppeNlVsp+1HaC3XkzqXpoDuhhNJx1j6gTu8+1aeqegHzLWTbAa9VZEjNn+x13ElXAWOkbl34IL8NerCbLwmMknq8JQxHMP9t3HUzeOQZz2K/2mCoqPyVU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bIKBcX83; arc=none smtp.client-ip=209.85.214.177
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-234c26f8a25so3035745ad.1;
Fri, 06 Jun 2025 03:10:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749204650; x=1749809450; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=fEVsPcmujVG4TPPGthouiu2CSCG3XCwm4flJ5gXb89s=;
b=bIKBcX83PfeyoiJ/l4HcDSJKMC5T4UcVCLLqaSM1ocYlPRD4oPfyyF5d/ff3/Qo5fs
3KZFZroJVdbsvJH7zgDtZYcfpEy5NV50DjWEhFCa118DHCV70Guvmnn3wXx6t95ldwdd
AoDqczoR2QqQPIYNcKA7pA+KQXTsgSlkEqltQF8XQa9yo22TCBgUSifwsJVwNbbnivZV
cUUhWQLMHm4dlm7geSRxEq9StcAH0VqlbhBcBls+mMh5bSlCZrJrfNN1RI0hZqn0WK3p
0YCp6Mim6eV1vEMvZXxVkVHAYqTFGtPtMIcanZxQ4c7c3vqLXTreIbiJ6sc+5thS24cu
UJ7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749204650; x=1749809450;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=fEVsPcmujVG4TPPGthouiu2CSCG3XCwm4flJ5gXb89s=;
b=H9kQdAxJkwUuFRNHcaG3yrwvqIQ1m1tLvya8K3ojmpHmi1+lxIQP6V2hJIEMSucMnI
qA+DKzsSU8q7ZDKAC6nO1pUL4m8w+h4nAC51mvJpyei4v1MiqcXTyNRGUQjI+HQboFBH
s1eZ7x6RK7wxMkL7LWXVedng0LscOSo3vnWUOjBEY+S2vpPxpap+1IeWVUCu0L6P7B82
MmukQYeoECL/SRZgLNl9lRCBmQR2dX1baDlc/yQQWUiGUEnJ/j/y3Cq62LGI1b9KzLdb
uafxk3aNvr6aoW82VYJSSZRHGE0prfHid4LHopeXUg0iGS/b3rIBOuqGaU/7zF/36xah
k8ag==
X-Forwarded-Encrypted: i=1; AJvYcCU7jqOdoBK9KwrZkq0o0sttJhOOfQtqg2Qz6oekkiFqKy4C0BqxizZc02Fq/6AbQh60lXXej1/40PA=@vger.kernel.org, AJvYcCW+uU5orndG6orzfsSi2oItRzBhRzezCMAILrjsD22j0wYzB1PXNpL0SkNfreZEc2++F1ShY2lfyw4=@vger.kernel.org, AJvYcCW//BNwocnmehOV855x2XMoY3aLcH2mNFVVPlS1fMT4tBjWtoofVqHOgTaFAds6ERPyTXlfQv+OKmdcsoFA@xxxxxxxxxxxxxxx, AJvYcCW0IhZR520dcPA449FAAEJ7L/DqvJgZbZO8CCyeKE8K8oOqDxPLT/hrtLQb3LSp6Fc2qmnyrL+f6b24BOQpLh8=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzs4vHL6EJ4AX0WQdjTP3JauBpog0f518bPKAM1c+a3iLC/bUpF
XRqLTZclrB9V/VakDhTTz0nJe/MzIrXzaE6fgZF6VOWUzMtqlOCxCos1hp50aqO6uXiTpzsVmYi
q0wgnl14zXYkVIoZWfGFPLh43jLRL1rs=
X-Gm-Gg: ASbGnctu9ycIYa3de5U/8kfH0pshJ9BaxxyERVQOrq+1Ywq1lwSh7ni992vpsl8fVbd
6M7jvsS/uPvliRm1CfomtwFFCO1OYt62opVCCn/vpiUB0nlRPr5kUbyFM4l1EdxNXqWvZlA7mpO
+bVqhod2Qo4lvo2Y9XGT/GaNOMzNbNwc2v+S51n0AhIbE=
X-Google-Smtp-Source: AGHT+IHJK6lS0GjeOTRlGjUGlIzSEOQJan0nGM6pFx6roUYemWWUxEZ7RboJGS+1ELFs1nF2rCoKHpO5YCC2dkuhHuo=
X-Received: by 2002:a17:90b:3d04:b0:312:ec:411a with SMTP id
98e67ed59e1d1-3134e3fa0e4mr1136329a91.3.1749204649600; Fri, 06 Jun 2025
03:10:49 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <HVTDJypFNQFfSQJmmYDSPU4o-irFnjmDN22RW3S0z5Kwe_hVk9kquZWElv-C2k6d5kOIiewhj_Xo2kAoTHbHgg==@protonmail.internalid>
<cover.1747634382.git.viresh.kumar@xxxxxxxxxx> <87qzzy3ric.fsf@xxxxxxxxxx>
In-Reply-To: <87qzzy3ric.fsf@xxxxxxxxxx>
From: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
Date: Fri, 6 Jun 2025 12:10:37 +0200
X-Gm-Features: AX0GCFulh-NApLJ_BZprdr-LgDGIG0IRhXBoIDMZxa1As4OIxQVem2hDI7xiYt0
Message-ID: <CANiq72=EE1Gqhjhyz46njFa5Wb6gbax3Abg83PyhQNX=X7pF1Q@xxxxxxxxxxxxxx>
Subject: Re: [PATCH V12 00/15] Rust abstractions for clk, cpumask, cpufreq, OPP
To: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
Cc: Viresh Kumar <viresh.kumar@xxxxxxxxxx>, "Rafael J. Wysocki" <rafael@xxxxxxxxxx>,
Danilo Krummrich <dakr@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Benno Lossin <benno.lossin@xxxxxxxxx>,
=?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@xxxxxxxxxxxxxx>,
Boqun Feng <boqun.feng@xxxxxxxxx>, Danilo Krummrich <dakr@xxxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
Michael Turquette <mturquette@xxxxxxxxxxxx>, Miguel Ojeda <ojeda@xxxxxxxxxx>, Nishanth Menon <nm@xxxxxx>,
Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>,
Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Viresh Kumar <vireshk@xxxxxxxxxx>, Yury Norov <yury.norov@xxxxxxxxx>, linux-pm@xxxxxxxxxxxxxxx,
Vincent Guittot <vincent.guittot@xxxxxxxxxx>, rust-for-linux@xxxxxxxxxxxxxxx,
Manos Pitsidianakis <manos.pitsidianakis@xxxxxxxxxx>, =?UTF-8?B?QWxleCBCZW5uw6ll?= <alex.bennee@xxxxxxxxxx>,
Joakim Bech <joakim.bech@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>, Burak Emir <bqe@xxxxxxxxxx>,
Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>,
linux-clk@xxxxxxxxxxxxxxx, Andrew Ballance <andrewjballance@xxxxxxxxx>,
Anisse Astier <anisse@xxxxxxxxx>, Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,WEIRD_PORT autolearn=ham autolearn_force=no
version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 5, 2025 at 9:42=E2=80=AFPM Andreas Hindborg <a.hindborg@kernel.=
org> wrote:
>
> I was testing an unrelated patch and found this kunit failure in
> mainline today:
>
> [19:45:34] # rust_doctest_kernel_cpumask_rs_0.location: rust/kernel/cpuma=
sk.rs:180
> [19:45:34] # rust_doctest_kernel_cpumask_rs_0: ASSERTION FAILED at rust/k=
ernel/cpumask.rs:190
>
> This is for arm64 defconfig. The test seems to passes on x86_64.

Yeah, I reported this back in v11:

https://lore.kernel.org/rust-for-linux/CANiq72k3ozKkLMinTLQwvkyg9K=3DBe=
Rxs1oYZSKhJHY-veEyZdg@xxxxxxxxxxxxxx/

No harm done, but let's please try to avoid merging new stuff into
mainline with open issues.

Thanks!

Cheers,
Miguel


Return-Path: <linux-kernel+bounces-675585-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B04F641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:11:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 01D3516D60C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:11:20 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 756EE2874FB;
Fri, 6 Jun 2025 10:11:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kOYV3ygE"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1348286883;
Fri, 6 Jun 2025 10:11:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204662; cv=none; b=TdN1wmiMIe2hztKBhZ/O2WTTK5BNShUNL4IOufTgR3PF/7oY33EemnuUZoM70OfS8ObH6tL4I/LG+aVrOChGRHpmyyiuxDhCExbiu4CgR8uJFXV1rgLyCSciWSb6SqWYomKNLRJJ2bzNmCaoB1h0N1vq81PpjSqOVWJoE/oARaQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204662; c=relaxed/simple;
bh=QpA/JuCnAP/vFa+RSbOkJBcKz4J+tC4XXGlQAhLxjiY=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=q4UfznYGbivLKvkQheM+E4iC4I+Xp+tqYbBjlC0cJTFOyuTmk13PfFAOY/eHwtE3XsCjiZyZRI05m9FQfpYHGXQ6uUfhmfa+OsMdVRgyG2S+zmk9ZGPJ8UURPJTrq+SVVpUcBIL9GN/qzuG687sdzk9xOgUW6xA6hR5omb0/rDI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kOYV3ygE; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79D32C4CEEB;
Fri, 6 Jun 2025 10:10:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749204662;
bh=QpA/JuCnAP/vFa+RSbOkJBcKz4J+tC4XXGlQAhLxjiY=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=kOYV3ygE1WUo2ThdlO7485Uw/rj45w0Z+n/6w5WbgFyUCXIjsyKtxqHf2YHZO0Hv8
WbPKtRgW3k55PDtqmLWOUmorRkt/FVHsXcRPlM5ZyYNCebTbP+Q4uCa7zdoWaOn2O1
WbPE3oVUkM6WgXPuJMOlqd5WvzgdONu1RXVFeFzL0nqWRUOi3mG4dHgnrBzE/83Mqn
FyKKPmY4pvB6Z7tMVxcKOpNcAeK0soEHiZtQYZhuh00iKPvG3IhxtaXWR/Hhmik34O
gCbYNzdXNCtYHoXL9fEAWqLDFlVb1+xzr5QSZaqBb4CM/pdq0K28lxwY0NR1kAf91W
W7kAAiZVNcUhQ==
Date: Fri, 6 Jun 2025 12:10:54 +0200
From: Christian Brauner <brauner@xxxxxxxxxx>
To: Jeff Layton <jlayton@xxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>, Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>,
Chuck Lever <chuck.lever@xxxxxxxxxx>, Alexander Aring <alex.aring@xxxxxxxxx>,
Trond Myklebust <trondmy@xxxxxxxxxx>, Anna Schumaker <anna@xxxxxxxxxx>,
Steve French <sfrench@xxxxxxxxx>, Paulo Alcantara <pc@xxxxxxxxxxxxx>,
Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>, Shyam Prasad N <sprasad@xxxxxxxxxxxxx>,
Tom Talpey <tom@xxxxxxxxxx>, Bharath SM <bharathsm@xxxxxxxxxxxxx>,
NeilBrown <neil@xxxxxxxxxx>, Olga Kornievskaia <okorniev@xxxxxxxxxx>,
Dai Ngo <Dai.Ngo@xxxxxxxxxx>, Jonathan Corbet <corbet@xxxxxxx>,
Amir Goldstein <amir73il@xxxxxxxxx>, Miklos Szeredi <miklos@xxxxxxxxxx>,
linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-nfs@xxxxxxxxxxxxxxx,
linux-cifs@xxxxxxxxxxxxxxx, samba-technical@xxxxxxxxxxxxxxx, linux-doc@xxxxxxxxxxxxxxx
Subject: Re: [PATCH RFC v2 04/28] vfs: allow mkdir to wait for delegation
break on parent
Message-ID: <20250606-zuzahlen-vervielfachen-8831c5ca8f69@brauner>
References: <20250602-dir-deleg-v2-0-a7919700de86@xxxxxxxxxx>
<20250602-dir-deleg-v2-4-a7919700de86@xxxxxxxxxx>
<wqp4ruxfzv47xwz2fca5trvpwg7rxufvd3nlfiu5kfsasqzsih@lutnvxe4ri62>
<eeefb45bc67182971ae7d3c455a4ecfdec53d640.camel@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <eeefb45bc67182971ae7d3c455a4ecfdec53d640.camel@xxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 07:25:38AM -0400, Jeff Layton wrote:
> On Thu, 2025-06-05 at 13:19 +0200, Jan Kara wrote:
> > On Mon 02-06-25 10:01:47, Jeff Layton wrote:
> > > In order to add directory delegation support, we need to break
> > > delegations on the parent whenever there is going to be a change in the
> > > directory.
> > >
> > > Rename the existing vfs_mkdir to __vfs_mkdir, make it static and add a
> > > new delegated_inode parameter. Add a new exported vfs_mkdir wrapper
> > > around it that passes a NULL pointer for delegated_inode.
> > >
> > > Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> >
> > FWIW I went through the changes adding breaking of delegations to VFS
> > directory functions and they look ok to me. Just I dislike the addition of
> > __vfs_mkdir() (and similar) helpers because over longer term the helpers
> > tend to pile up and the maze of functions (already hard to follow in VFS)
> > gets unwieldy. Either I'd try to give it a proper name or (if exposing the
> > functionality to the external world is fine - which seems it is) you could
> > just add the argument to vfs_mkdir() and change all the callers? I've
> > checked and for each of the modified functions there's less than 10 callers
> > so the churn shouldn't be that big. What do others think?

If it's just a few callers we should just add the argument.


Return-Path: <linux-kernel+bounces-675586-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0F77241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:12:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id EE9A53B0513
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:11:57 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 53227286D73;
Fri, 6 Jun 2025 10:12:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y6b9EnwN"
Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 582832356B9;
Fri, 6 Jun 2025 10:12:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204730; cv=none; b=WlKgn63kPtXbp8CgiMmU9Rk6CeAC6iWwUMmwZY7FZWVycmlfqWJDhctcMmmsgY9kyW5uokvziqJyTgVobku4EQZbL0vZiyioQeZQM0GbOEbYHMi9Se4y0BuNWL/LmDGnD9u3KpfnyJ0u/JZmhVsgfL6spSGDuERUAAiBy/Ys9dc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204730; c=relaxed/simple;
bh=na3Pb0D7zXPPHmt6QnpL0+q1JshApJET/mF8iH1Bbkg=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=RCgw4aJYKhOdnOAz1e+KruuhJh3hNjQyDab4M9iWVF4MNKMelQIsS5142F3nECl3DShF3yHJZkNbGLdQQAE60JkwWeQiRf9as2XDbb7ZzHjxsTFCL7hJthu9NYhE2+w8JRjUIgctcCUwbwjNoG9sMbt8jvMw9t/AM0V9yEYJE0Y=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y6b9EnwN; arc=none smtp.client-ip=209.85.214.175
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-234ae2bf851so2677325ad.1;
Fri, 06 Jun 2025 03:12:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749204728; x=1749809528; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=28Bl/PeHLavR9/zeEbDpLv4eVLtWJGzEYSYvLscWvio=;
b=Y6b9EnwNHwwcqpRUz1DDiP6NBlDeIBgNR1VueVoq52JR8ahzAjtlLBHddCs03RLcna
ywl8Y+jysr0u6fK1AAnmOD3e1woWnWid6SRNZ4CSfnNLyucZGHlUtd6GScyzWJwWcTIP
ZBjSd4MK+EF/K+pVhJwcFNQxEJKT8SlZVgVWJEkJbuO0+O+MSLT9bhLC+dVZI8Z7S/fj
roR7/ZMKgYf9p73eAR/bBfwyUfiDvH3Vyiib+UbDdhGsiPza8Jii6KsW/dxxLDtUisbW
7dAnuNF1d8XqRklQU3n+H7HHq+6wC/fmnRnSNIlewtKQT4NBMquLL1RTMVdokes82iNm
TnZg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749204728; x=1749809528;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=28Bl/PeHLavR9/zeEbDpLv4eVLtWJGzEYSYvLscWvio=;
b=rWPvGzcBtBehIXefR4hHUftr6a/8caLSJY3XNeh2eyQLbMh1L5FoTr5CyGHoPeaQTP
ZyXei24rRqn6+nvyUepmBZyWPiXlVG5DH84onfvkgCLKr/72nP8f9Wg6H8h2Wmv01IdJ
rMoI5qNkpR3e/3Qkkz3ewv73ZSLaCMf1Tqvg8J7bGirLQhwBpcxtNwFj60KMO1IMO58P
SCnz0Md0PX9g3WtwtACO/8wdGBoSPLlUfzMdhXJU5kJmmNti2s1F10P/xbnrO4hnsZUr
ijU6qMq2TCiK3oHZ4WvkC5BfoWI/+QhOwU2f3GnSuEDVpUDIszxjcZyFPChVnm2SAoVk
i2xQ==
X-Forwarded-Encrypted: i=1; AJvYcCV794qW1K8j4SEa/K+GFmhQHRxd8fi7OWQRRJtlQ/LDs3CcIhbYgJUX0pkwUCvNwgSENy/dUIVp7qXgd8YKyTE=@vger.kernel.org, AJvYcCVB77cpz9P8wcmxlucNrAPu6WeSipHcncrF7uT+Z8LMtiJWYqiiq41lhW2OGaozxUOYn/BMBb3KgJY=@vger.kernel.org, AJvYcCVBB6sZ68bgFEOVLPtp/DqhmES8Xlz+7RKL3+T2tNiv49tHaLYrv/BY1FUHqlBJ/ZHxZ+o8Gu08WNMsUpY=@vger.kernel.org
X-Gm-Message-State: AOJu0YyYYeFmUxT2BTN7ETzlaN5wWREaH5ujuCVfaBgeDUKKjG3MXJmm
uPem2THLLCb5ppjcafox+WQ4WvNMv6UpaR0JIzsS+lEWMTiiS61ngd+H1Dv++icAhDV63XuZgHs
GEgE3Khr91nT9F1Z7wKe2cU6BdYS59LY=
X-Gm-Gg: ASbGnctFVk3XGSZmKY+ilO9SC65FwnJVLOHpZWOpDYJjL/ScY6ziKLd9gDv3DwNDKjQ
pEDfW//XX6YuEP0IJqMd0VM45QOqkxObVHtYERJ/sZLIvepDZ+dAzx2rxPu4Ns/PuDVa2mjgv5F
Ex+eEIqGsyQIJnjECtBuITYXOuyBQiCAO1hTTf5vJO/OY=
X-Google-Smtp-Source: AGHT+IGDyYS4phFiiRoWWoNoUg7v6sFeimAODFhUFphROTs9ZwAMTwMLYmFrMagrQi7dUStuyt9v5HYVGNf4skLUAYk=
X-Received: by 2002:a17:902:f683:b0:234:d7b2:2abe with SMTP id
d9443c01a7336-236040bb86bmr8720125ad.7.1749204728458; Fri, 06 Jun 2025
03:12:08 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <8b5fc7889a7aacbd9f1f7412c99f02c736bde190.1749183428.git.viresh.kumar@xxxxxxxxxx>
In-Reply-To: <8b5fc7889a7aacbd9f1f7412c99f02c736bde190.1749183428.git.viresh.kumar@xxxxxxxxxx>
From: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
Date: Fri, 6 Jun 2025 12:11:56 +0200
X-Gm-Features: AX0GCFvHZQ2r_W4WbjaPUXUdMkm3Lfj-HkvnbZrQYwwtbAB-RIXtkAjEDDUZN3M
Message-ID: <CANiq72nxs4BTFQQcJLgrbgHDzQLbhAA3=qsycdKu=oxc2V=yqw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] rust: cpumask: Validate CPU number in set() and clear()
To: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>, Yury Norov <yury.norov@xxxxxxxxx>,
Miguel Ojeda <ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <lossin@xxxxxxxxxx>, Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Danilo Krummrich <dakr@xxxxxxxxxx>, Vincent Guittot <vincent.guittot@xxxxxxxxxx>, linux-pm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, rust-for-linux@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 6:17=E2=80=AFAM Viresh Kumar <viresh.kumar@xxxxxxxxx=
g> wrote:
>
> Reported-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/87qzzy3ric.fsf@xxxxxxxxxx/

The URL is wrong, please point to the original report:

https://lore.kernel.org/rust-for-linux/CANiq72k3ozKkLMinTLQwvkyg9K=3DBe=
Rxs1oYZSKhJHY-veEyZdg@xxxxxxxxxxxxxx/

I would also suggest adding Inspired-by or Debugged-by or Suggested-by
or similar for Boqun, since he figured out the root issue.

Thanks!

Cheers,
Miguel


Return-Path: <linux-kernel+bounces-675587-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7D4F841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:13:38 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5B97F3B0483
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:13:16 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 93730286D5D;
Fri, 6 Jun 2025 10:13:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="bhe8fXQJ"
Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE51D2356B9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:13:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204812; cv=none; b=ZP5w9hPBqXbJJuFVh1xxnbcXKgvtdXtGCTyq33Cwyh6rXp/Z2MjqyS6PbRxnfc6Xxr7f7XqNDZHTmUA+1MZwA1tebz7asj0E7AXjqkVfEXBkgtupqzJeFNIrrIWLmwm5j3ZeLV6fDavcbRnAXsInLir/0BIykwWCIl3gOA5wXR0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204812; c=relaxed/simple;
bh=JC8m9niU2PxwVJWwsT3eajtakjILhZoQfTeDwU0V/48=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=nMkAPrMCtQS68fOodF7KH1ctJceyUbX0C9Dg2MgDEuhksr9sf8OARPsjZRx2PKEfVdecx+cchuWRfN+SVl2Sx7o5oDgRRYGCQ2gmlF8uY92AdC/2ohklcg1eI37VWnRAgE+NUMM4JcbVmOdIwddanrNeOzS9E57B75FqtUW5WGs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=bhe8fXQJ; arc=none smtp.client-ip=209.85.128.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com
Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-450cfb790f7so14993845e9.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:13:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=suse.com; s=google; t=1749204809; x=1749809609; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=11YEULiYbhQkJyMi2H73Pet8m14FwC3rDorDnj1SKc0=;
b=bhe8fXQJKFVqcFy+MSOkuAF3IN1ml+nFvGcGmkZWvP6Y+Sa56w0cZ2MfWagqm/ZV4p
F6WGYSWjiib3lexoVgEzf1btDEbK41nVO7hC6Y+GcHYv2GQQ4OsJ288jLfizU1VEvz8B
f8YJOAWoHSVdKqXIAicDoAQm3oR/0y2h+uERcS8qI2EDTpmXbGxkYTf4ZCJiBv59xYH4
UVb4rIp3Lssr6jSu7DJonTvFBe+i8drmRvw3paTQDXERUedapBq6ydttjN/QTWa1gd70
ieILAEQ58DMygsnLqn40iaC+qga3zPxS6iztKoNiVGIo9+qOisD9fio9RFMfKbGGsucf
9qPg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749204809; x=1749809609;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=11YEULiYbhQkJyMi2H73Pet8m14FwC3rDorDnj1SKc0=;
b=gRVuLuBPuZWpqxbR6p4/ASJ96BtdSZnZ9Qpi+CDOwEIyt9TZkhz4aWF+4UFw7r9smt
8bxiEQrqPBzvZk9/ghb52EHupqIiABvZGY+Nei+NyteZmCCNnNdQbN/EgMzmQbRDF9Cd
y0KnjUE0nFq/MS6yHhOwWlWrIB/ld4L79XOYVbZC7lRC/O4oLbempYKGKbIgpA6Yizl/
OgkrEy11VOKu0gmJYgYkmMVhvMMUyTs0qPDSRnxeGAR5uplShJTZKT3h9QWQHXX2K9nC
MXVGwEin8puK/ZkevQ76o0NN3zcNGEAwJhs+UBUn8MEgpT98ksZR5bXdg+1IoolWgUA7
zVXA==
X-Gm-Message-State: AOJu0Yw/tFR6Q+exQZb8TbETp4BjS/ReIg3twH+yYKiY+Iz+oRjaZJ7Q
ZVhhstBIRAOkkAC8SOLdmXC6ocwy+uWeEa/ckEzirFgY/te16NNOvKZCFiTAnX4TfBY=
X-Gm-Gg: ASbGncsWUIFQ0apeWzP7fqyFQWg1XQ5Vij1nBQQ4qLlKHaD/gFZZAI4HQn/WQu9WsVH
Cr8zgL1s+wQsB3XssMz3WibNGKLzwSm2gFkp/bme6uYvuSXOOKc/MlxXg67CZa0y4z63Ww1Fv+R
5w7FlvB5oR+9WXGauTh3ftu5VJQvSfYAhA8mJim6n+mxGB1o3CEU/zu4puyLHpN9iSf3uWlj4h3
a15ZoKDMkKNj+CExIGQJQnig/fAP4tH0GyVQioqmz6NH0HwN7EH3jvm9Ut2R0QVo9l2QyRfOg1f
QaAoxyCgsnz4LHTqqk3xHFrOvDgWmtWuRT72fwdYBWqf6ODww7J9upPnqW4+sPjS
X-Google-Smtp-Source: AGHT+IEOfH6h5CAaLuHUWbcfsNRataWKB14PhH2cGLe8aT2Om+5WRzi+evA70JPYI1gRq/tX4f+jNw==
X-Received: by 2002:a05:600c:3aca:b0:450:cf01:7310 with SMTP id 5b1f17b1804b1-452013914bcmr32349065e9.12.1749204808923;
Fri, 06 Jun 2025 03:13:28 -0700 (PDT)
Received: from localhost (109-81-91-107.rct.o2.cz. [109.81.91.107])
by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-451f8f13375sm35020835e9.1.2025.06.06.03.13.28
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:13:28 -0700 (PDT)
Date: Fri, 6 Jun 2025 12:13:27 +0200
From: Michal Hocko <mhocko@xxxxxxxx>
To: David Hildenbrand <david@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Jason Gunthorpe <jgg@xxxxxxxx>, John Hubbard <jhubbard@xxxxxxxxxx>,
Peter Xu <peterx@xxxxxxxxxx>
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
Message-ID: <aEK_R93gihEn-xW6@tiehlicka>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri 06-06-25 11:01:18, David Hildenbrand wrote:
> On 06.06.25 10:31, Michal Hocko wrote:
[...]
> > Turning them into VM_WARN_ON
> > should be reasonably safe as they are not enabled in production
> > environment anyway so we cannot really rely on those. Having them in
> > WARN form would be still useful for debugging and those that really need
> > a crash dump while debugging can achieve the same result.
>
> One question is if we should be VM_WARN_ON vs. VM_WARN_ON_ONCE ...

*WARN_ONCE ha a very limited use from code paths which are generally
shared by many callers. You just see one and then nothing. Some time ago
we have discussed an option to have _ONCE per call trace but I haven't
see any follow up.

Anyway starting without _ONCE seems like safer option because we are not
losing potentially useful debugging information. Afterall this is
debugging only thing. But no strong position on my side.

> VM_BUG_ON is essentially a "once" thing so far, but then, we don't continue
> ... so probably most should be _ONCE.
>
> >
> > So while I agree that many of them could be dropped or made more clear
> > those could be dealt with after a mass move. An advantage of this would
> > be that we can drop VM_BUG_ON* and stop new instances from being added.
>
> As a first step we could probably just #define them to go to the
> VM_WARN_ON_* variants and see what happens.

You meand VM_BUG_ON expand to VM_WARN_ON by default?

--
Michal Hocko
SUSE Labs


Return-Path: <linux-kernel+bounces-675588-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EB30941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:15:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 27BBB16F92C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:15:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 03AF2286D6B;
Fri, 6 Jun 2025 10:15:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AvARLcEM"
Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 944A720C00B;
Fri, 6 Jun 2025 10:15:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749204924; cv=none; b=kZBzcXWyXws6xHLEyLv2x7H09tcfRTNkt3CGdT8Pn/dC5BxTD2J4a3ysLurNr7UFwIVqsWnwY91iSTpjFAFuYHKVzYQmKQXwd6LdeqHKjqodoosK4EIcpI85WLVwUHgkN2G2vVMi+0ZgzahhF6z2/QdFX2bAxHhWu+V9LHTbdZc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749204924; c=relaxed/simple;
bh=L24GANeu0g8hEgu3+7YInBdMLbObkVzHCL14OVqBh90=;
h=Date:From:To:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=qHeOrS93MRLvuaYrMSezl5aVGsCNt5iEUpxMEdJ3y/Cu+S2v7GZVuF07PlNx+gGmSaeMyZGdCviTtI8H330rhdaKmdLWqD2ER1E0jJJNMhzK1r34eliPW3bG9eQwyNNkbUVyKMBMePHZQKWG0OrVImhFojvU+qVf2QA/n+BiYzQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AvARLcEM; arc=none smtp.client-ip=209.85.128.45
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-450ce671a08so12386425e9.3;
Fri, 06 Jun 2025 03:15:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749204921; x=1749809721; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=NDtFnCkMReqqiUbpjeifRmII/hPtdUlD+iwNu+Nb/uo=;
b=AvARLcEMWZo6k3n9ynSiw2BiIXw25ahg86tFvq3lI1KKaOmkE3ercQ14nCWE6V4F1w
feD6W/oQrDxb9ptSNC7+0P1P20EJVtLob6f5/5Fj/rE3CPTPSAcjI7mAdtnfaiShsfxl
xPIxHrqIsYeNd2sFch5xOw2TqElSKCh/FadRiUnxv4p43XwAOMtv1eGsVG2VplggVrfW
TxYioBLoHxmC466tWO7ln+CzR7xQo4S/Wjvo4MW+W5XJXEnSW8zr4Fn1KZCZj9kqmNyz
qqYlMyHt7Wnzy8Ysnm3onZ7V8JqHoWNPpw4z9LBzxU1A4K59xraAEKaCY2DgF5WzK0xo
5OYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749204921; x=1749809721;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=NDtFnCkMReqqiUbpjeifRmII/hPtdUlD+iwNu+Nb/uo=;
b=T+Kx39v8w0PuLjojjekRIXV4jIIHG0QtY7T75fCjNxbtdmQqy9E8m/UPQ7jaIJ8ktz
nMlXtoQXQ5VAulX9nH52yvJdyqKzis7rNNVRWzKRWaO2KgkB4sFMRwRPtaxTC9Jx7PTk
9BJVc7H2v/8sD4LAKC/butirJ5aPba/rnCNVs+NANMrqwRn/MiV0ebnEwZrJqzztYkbe
A+7GckujkmeSoEePqHyH2f4/jRtzZ4G2Cjqsl55LjdiZf+H/EaEDZUUR+QYMmdyPW/0m
mwaZXq140vsQ5wwLxvHE3jGcPI8yXv2Amxm6L97YzV99/myUk6uQuQneN9SuxsIVOHEn
iMQg==
X-Forwarded-Encrypted: i=1; AJvYcCUn5kHy9Oir+XYMjbwxcx93pZLHzET2rPG0qK7QtorfUSChLrV8gyYKS68vlmmOKPC58XVbTX61Cv10@xxxxxxxxxxxxxxx, AJvYcCXOgeF1wSImSSl0Nx8OaOQHTxacFKBJxYxVSF43JpJSnX6t+jDvNVu0J0Y3FQ9+HMpGSfif/FglFcloM2by@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzK91RiOXky6clgol0N0P37O02WnGajkkPKW1advn+utqEZNkjC
lnSnL4F42RBGkbLOxnNUXrjME5en/p68SGDGZzlJqt3cpJhlpr42ZSDY+zuZlq3qZMhstQ==
X-Gm-Gg: ASbGncvFl4S04hPrn5/K2Btn7vaYL6o1vIEi0N6YVgl9EERyv9xmM+myT8b30YgGFCL
FUF8SXccUMTirB9lAG/9URyE5eKvyjKdPYdpaRZHFLw3T80QrV2FecDvnKydMlXOj3oFV207NX8
eGBDGASZTtuUnc4UoU/n59zc+gtm5LTWLWOx5BW5evZY6/GKm6p/+2jb0COWmwJ3FNFLNmv0oKi
v84dP74K7HxY4SBWFaC2yujeaVMZ2+CKONByKwGm1L12Oq1H4bQgjCpiGslxSX7lXAH+7r/fMeA
iZAvupzUIcLjzQl1jJuk00X3RiT7VuaEQ8mYzJ26rzLx7HO+rT/nO8kRgmy4D8aYrwR+UaGlhn8
Q
X-Google-Smtp-Source: AGHT+IHkoGqyZU4A8UbDxOXpDq17ie8vVLoKYLh6DutXiqc0wb92kNu+EH/C1X6j+1vj63Y0RhyNSw==
X-Received: by 2002:a05:600c:1c85:b0:445:1984:247d with SMTP id 5b1f17b1804b1-4520136ee1amr26616255e9.7.1749204920556;
Fri, 06 Jun 2025 03:15:20 -0700 (PDT)
Received: from HYB-DlYm71t3hSl.ad.analog.com ([2001:a61:1225:ec01:d1d7:779d:8019:7bb0])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213726c44sm19113435e9.28.2025.06.06.03.15.19
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:15:20 -0700 (PDT)
Date: Fri, 6 Jun 2025 12:15:18 +0200
From: Jorge Marques <gastmaier@xxxxxxxxx>
To: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>,
Frank Li <Frank.li@xxxxxxx>, Jorge Marques <jorge.marques@xxxxxxxxxx>,
Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
linux-i3c@xxxxxxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/2] i3c: master: Add driver for Analog Devices I3C
Controller IP
Message-ID: <kffxck2gorwcdcokh6sf2p6vsnuketjimpbls3nqp6oapo5zdn@3yoxssd4ncxl>
References: <20250604-adi-i3c-master-v1-0-0488e80dafcb@xxxxxxxxxx>
<20250604-adi-i3c-master-v1-2-0488e80dafcb@xxxxxxxxxx>
<aECaFQzkPYdfjagK@lizhi-Precision-Tower-5810>
<aEDCATbPA9173lGI@shikoro>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aEDCATbPA9173lGI@shikoro>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Wolfram,

On Thu, Jun 05, 2025 at 12:00:33AM +0200, Wolfram Sang wrote:
> Hi everyone,
>
> On Wed, Jun 04, 2025 at 03:10:13PM -0400, Frank Li wrote:
> > On Wed, Jun 04, 2025 at 05:48:58PM +0200, Jorge Marques wrote:
> > > Add support for Analog Devices I3C Controller IP, an AXI-interfaced IP
> > > core that supports I3C and I2C devices, multiple speed-grades and
> > > I3C IBIs.
> > >
> > > Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
>
> Hmm, I didn't get the original patches. They are probably still in the
> moderated queue?
>

Yep the patch was held in the queue but are delivered now.

> > > +#define REG_VERSION 0x000
> > > +#define REG_ENABLE 0x040
> > > +#define REG_IRQ_MASK 0x080
> > > +#define REG_IRQ_PENDING 0x084
> > > +#define REG_CMD_FIFO 0x0d4
> > > +#define REG_CMDR_FIFO 0x0d8
> > > +#define REG_SDO_FIFO 0x0dc
> > > +#define REG_SDI_FIFO 0x0e0
> > > +#define REG_IBI_FIFO 0x0e4
> > > +#define REG_FIFO_STATUS 0x0e8
> > > +#define REG_OPS 0x100
> > > +#define REG_IBI_CONFIG 0x140
> > > +#define REG_DEV_CHAR 0x180
>
> This register set has some 'cdns'-vibe to it. Maybe an earlier version?
> Not sure merging this into the cdns-driver is a good idea, the register
> set looks quite different to me. Note that I don't know cdns hardware, I
> just grew a habit of comparing register sets of new drivers to avoid
> duplicated drivers.
>

This controller targets FPGAs, in particular low-cost ones. I am not
familar with cdns hw either. Overall the driver is strongly shaped by
the i3c ops, the spi-axi-spi-engine.c (also a FPGA IP) and the other
linux i3c controller drivers.

> Happy hacking,
>
> Wolfram

Best regards,
Jorge


> --
> linux-i3c mailing list
> linux-i3c@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-i3c



Return-Path: <linux-kernel+bounces-675589-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 218D541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:17:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8C3F03B0C21
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:17:08 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 837AD286880;
Fri, 6 Jun 2025 10:17:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="O+TPOkmN";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Pk90iFkN"
Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32])
(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 E2FBC3234
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:17:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205043; cv=fail; b=cYJWMPdCnUcvp2rqragdQDb4Yzcav5dpgkOAnQ7egPe9IBK64UN/S1XLMdF/UpO/FuQrebqZzrdnMw8ukBm0yIgllQG6DT9iUH8H4XeymOEgBTlB9sIcQtBBEMN5/u5PnI/XtXAXkKofiD3eobK68KqlLduNmx6vNdJc6oMji1U=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205043; c=relaxed/simple;
bh=O2yGksW06fxF5Nq/PjJfW8h+csvvZYC0OLMbX5YlGyQ=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=XY6Hu0nItPvdXafbvgfaasnPdmcadqtpBnZTBJhOZx+jKIoSn5QIuGLSvChKyNb+NsM+cgXFkqFGraL8pwxZFEReoyMpliqHem/WPqQRuOAndHYCjvqMMVRyUkrWBbcpn2JvWGK6isUGcOgpEfZ6aFMFymXhwjLgPVHn8CswScQ=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=O+TPOkmN; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Pk90iFkN; arc=fail smtp.client-ip=205.220.165.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246629.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NGMl011378;
Fri, 6 Jun 2025 10:17:05 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=
corp-2025-04-25; bh=KKiUmUnwvxm1j35JRyPBnHQhP9bxW3PafOTZ5RdnsAU=; b=
O+TPOkmN9TdNhWAiJK0bYYAf2oxk1iiCm+axuLaYOPjncTFIVYb5EOTQNmT60p3p
4ZjvgBpDRiW9HwkhWrD8205b8OzfftwAbn+Cv8TuhKnfM7piYIC957rSZMBzP7WD
zdqBIE2sLsfw3YVxrr7UmR2Q7/OU8kN1k3Foocc31AGu5HvlNF6h796UGeSBpkHC
3dxo2znvgpdqA0tTph8/36WULkyhiydSrVfyOTWOlJLS+xWo7JeBtjMk7A4dyjTR
J1W8TTbEGK/wFyC45NJvCIAjOBwgYmuioWPgDPxUD5X8TGGmEKvHXdXvtvoWpIH2
5UTc/lwk52agC2NctSXRrA==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gwhfkhe-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:17:04 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5568JnXT038507;
Fri, 6 Jun 2025 10:17:04 GMT
Received: from sj2pr03cu002.outbound.protection.outlook.com (mail-westusazon11013064.outbound.protection.outlook.com [52.101.44.64])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7d5q8v-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:17:03 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=VUVUNQxzne7oTOt6CwO3Uap8oQd6MBsegDSlwsdYaGjUSb/vR9wUuw3h10e/kdES6FrZ/ho0rRYr++jJ3dyAMrVUHKAXtRpwpkhihti33aki83DL+SXbJqs9TJ39ROWmqwNxenecchJAKVAQkz0TNPLBfUOp2EdLN+ItC4tsLe9alYhCK8A8l6bva/byPo78Cu+xJdk4Ey06ywu3ivTjv9kbiSbfk+9k5FvsqQZvMluQ9Yv0mKtehAsLq7TztwnXAK3TPoqMeYVQ3Vxi0NR+f9O5Hju/LJKpYhsFnfDcbhs2ufZusY/aMZzD8xho0Zarq8GnQ2wHkq+WkYTKcvV38A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=KKiUmUnwvxm1j35JRyPBnHQhP9bxW3PafOTZ5RdnsAU=;
b=S8dX7Kz2hU1sFgaKWIT06lUgTzTQLMqn1crDzb9ap3/N0weiA6cHKf4Db8Z6+2V9b/rBdrlA72BjkFLL0EOGXvQldRNpY+G1t2ovHlOL4CCuOuQpkzyXcj72qeZfGBYJLf0E8XgEvzZRLf1BLYPCjYD0gmsQ06peHJHDxUvAmraMtVTiKOp04VvUe/o6qGrdNQLvGXqgRJo7pAbCS3CB6uV70sjtaOmgdzUnUAZKzp5mAUJpuw30676HSS1Ep4rPi1lfmoR3NG2aPZi5XY18HJwBlYWj4swA8RD1DwAa80ogQavwkXeJRKzsAUgIh3h2vD+v1q7g56wsXezmqwHB2w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=KKiUmUnwvxm1j35JRyPBnHQhP9bxW3PafOTZ5RdnsAU=;
b=Pk90iFkN7dCjKeiv6mNeGeYJ8ITx+oSGqf9JPry6euF/NhnODRc9KmUpz2dO1Hcg/qPRiE3pVgaF/abemhhs2+3sibfBi0Er/PnjYAHBtzaiMOcwNtmVzXpmZ0ErmM63N+0vhQd1j8JBN0U5VwWRx5uPd47BUpjCazulOnE5Qrs=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by SA1PR10MB6494.namprd10.prod.outlook.com (2603:10b6:806:2b4::21) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.40; Fri, 6 Jun
2025 10:17:01 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
10:17:01 +0000
Date: Fri, 6 Jun 2025 11:16:58 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Barry Song <21cnbao@xxxxxxxxx>
Cc: Suren Baghdasaryan <surenb@xxxxxxxxxx>, akpm@xxxxxxxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Barry Song <v-songbaohua@xxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>,
Jann Horn <jannh@xxxxxxxxxx>, Lokesh Gidra <lokeshgidra@xxxxxxxxxx>,
Tangquan Zheng <zhengtangquan@xxxxxxxx>
Subject: Re: [PATCH RFC v2] mm: use per_vma lock for MADV_DONTNEED
Message-ID: <66be7662-0c55-4ff9-af32-7c75e4f76bd5@lucifer.local>
References: <20250530104439.64841-1-21cnbao@xxxxxxxxx>
<0b96ce61-a52c-4036-b5b6-5c50783db51f@lucifer.local>
<CAJuCfpEaG8WuGboxgc6xB6s5==Lx8QT=UwzgNXJNxDH0-KMqzg@xxxxxxxxxxxxxx>
<CAGsJ_4xAhtSxpLTf_foXbtnVWwTcjNuQfCnTYuVwpExbLKjakw@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAGsJ_4xAhtSxpLTf_foXbtnVWwTcjNuQfCnTYuVwpExbLKjakw@xxxxxxxxxxxxxx>
X-ClientProxiedBy: LO4P123CA0527.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:2c5::11) To BL4PR10MB8229.namprd10.prod.outlook.com
(2603:10b6:208:4e6::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|SA1PR10MB6494:EE_
X-MS-Office365-Filtering-Correlation-Id: 2501ee7f-d634-4db5-949d-08dda4e346d6
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?UUZoa2dqdXFCeHlNRksrdzhUOGFFdXkwbXVveVJvZWQxejJRNXBubnBuVkV3?=
=?utf-8?B?dlN0NHMvZFVubGg5ZytFTmtGLzFkSGNaaXVSK2FTSnlZWm9adlFhRnVjMkhL?=
=?utf-8?B?Z2Q4TjZIVEZjMVFYRG1hVDJSRUVhTUFPbnZSY1ZIelNFbU1NOFlaZ2FGUE40?=
=?utf-8?B?UE5XOGRxUFYrcGF5b2hQY2Z2cXJtNVlZYmZudDltdEY1SGkyZ3AvQmRUUTgw?=
=?utf-8?B?NWZ4V3lNSDREWFQ4b251cElISThNdWtsbENZUUFXVXhpSzNpMXpoSjJHYTBt?=
=?utf-8?B?bkwwNkMzOG1sR2tKR3RtMDNXVGd3Y3hkK1prVk95UHVzNEtoeVd2UnRZbFhn?=
=?utf-8?B?MjdXSEpBMFlkNGgyUFlSNkYvY0dwaFpLZHBjemo5ak4xV2FDZlNVZjlwNk5z?=
=?utf-8?B?SHBnOHVQMnlwVStrWE4vSlJET0lBUjVXT256TUZ4NkV4a09zL3hzNjJzV1gr?=
=?utf-8?B?eTFVRHZWYS9FSnhJbEJVUjFQV1hGaE1vS2diU0x5UnovUWdPak1CY3V4T2Z4?=
=?utf-8?B?dzExWlNqUjRUSlhxZCtJYXVpbDEyZjBqTHo1ZGFyQzFsTTVkNTNnYnA3S0o0?=
=?utf-8?B?b2hwNTZYRko4bEZ5N09BRDhGdDRYeVFSZUQwazZ0MmNob1FXbXBTY0RiQjgy?=
=?utf-8?B?L25TVnljUmZ0bVpDNFZtSzdXTFRYVzFYWWVJZHJIWmdwN3hXZktVMWJnVlh0?=
=?utf-8?B?VXROOWVKUDU2OFZpMk0wVFVyV0VvdFg0cXR2QlVYbmJubk9zVVl3T1V3VHJw?=
=?utf-8?B?dFRkYzdiWm55YmV2VExOL3N3Wjd2bWdoVWlWMGJsbnZ5Q1JhUCtySVltMjFM?=
=?utf-8?B?clEvMlppM0V5czFXcFUzV0ZxS1p2eGFlR25oKzlVajkvdmJtQnFEUTR5NGhk?=
=?utf-8?B?N2ViNExNR0VSMWJPYVBNeGFzZTNGWDltV0xnQlBkRW1qMTVFbDN2VmdjMTNV?=
=?utf-8?B?dmZ1allzQlUxaGFkaGlTWWR6bUw3d3Evd1RnWEFaK1VoSWRZK1huS1VGcGVl?=
=?utf-8?B?T1JZbkxsdDRwWWZmdHFwZXVXN0NQZ2t2V2NUZlE5TDN0ckxUcUprR1JmYllN?=
=?utf-8?B?QUh5YmpQbU1tSFpPL3AyVStsR01RN3A4UTBwcDJrK1JNSnQycVp3VE9hdVNs?=
=?utf-8?B?R0RuSTdtYVR4ZWtXOExsWWw4VVl1Ty9jMXJ0aWZEZk1jZzVCNS9uOGQ4N2RD?=
=?utf-8?B?UEJqaFNHQ2pjN3QyeTVhWVlmZXhHeGdCUTBmS0J5WTBrTUp2NnFBYm5GYnJu?=
=?utf-8?B?L09kRXZRWHVYcmZyRW1YL2RqaDZmRC9NNFZ0NU5sUkRQb3liL2ZacXFiUzFE?=
=?utf-8?B?RjlmNC9RdzZKamRpOWNnNlUwNGxuZ3NwZ2JHaEt5bE91aTExMldMS2lzaXVw?=
=?utf-8?B?YWdNVmQzZDNaQnJGdmw0ak1FbjdYS0JSRWxPdThWMXRWWmtjd2pScWVpY1Er?=
=?utf-8?B?TWU5SzlHQ1VuTE95aXFnN1JUc1lIdTZFVUUzUnVkMHpueStxUFdwOVdmNHZ3?=
=?utf-8?B?YnlNYXZESWVySi9sS3FsNVBYdE1JV2psZjBGb0Z5UlpicnRLRjcvQlFBcnJV?=
=?utf-8?B?QmhQL25ZL08xUnRoUzdjN01oMDFtaWcvamsvemkwblp5NDdkVzF4NGFma1Q1?=
=?utf-8?B?VEFjMDFjcmVPOG5nYitQaDlDT0U0bWMyTy96MVF5ZFAvQnpJZ21zZ3FiTjBK?=
=?utf-8?B?RkZWNmxaNHBTVkMrZ1Y4eDA4NkJRN2U4dElsY1BQMHRVNmE4MG5BczlHWUJa?=
=?utf-8?B?cXAvZlhPUkZiK21iYmlJWmZiaXVMaXh3c2U2S25qano2d3ZtT2U1TzEzZEVn?=
=?utf-8?B?N3B0bjFLWG9GTjlMYk5LWTdtSVZGbHlyLzc4Q1R2M3B5NFdTM2V4b0hocktN?=
=?utf-8?B?emY5TE54enVGZ3MwalkrWWpoeEhRYjBNL3FIakduYXZYYzgwOXUrMUZucEZw?=
=?utf-8?Q?y+Csk6Xqx8A=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?TmFtc0t6MURlY3VwV25kY1VmbmRuN1dLWUJiVC9RcWZSRkFQVUN6aWJuTVlN?=
=?utf-8?B?USs1OTNQblB6cnBldUJHcVlTWTJLZVhmSExyRC9aQWluckFlLzg4Mnpoa2VE?=
=?utf-8?B?azEwWGJjbVJFMHpBb3lJZ3BReGptOW9LYmlrSW02VFB4bWoxVkJQcndHSWRK?=
=?utf-8?B?SEhxdWpSakkxOWQwTmRLdmxyMUZCeVNoRWtRWUZVY2dTRzBRcm9sSHpWSXA3?=
=?utf-8?B?ek4xL2hZSVo5b0VqT0hKdnJTK3BFYVczcUZNM0RncDFleHZ3YTZ3U0l2dHJJ?=
=?utf-8?B?L2VRSkgyYldHdW5HMm5Wa2FBMldUMWpxU3RSUy9yUjlMMVpxZ2pEcGJ6WlV1?=
=?utf-8?B?akVQS3hEbDYzOWhqRUxoUWFGa0JUWUxuYVAwbXhHWUtRTXYrUXlMT0U4TkVh?=
=?utf-8?B?Qlh2bUxVeG1tL3dSWEpnaWZNak9kZDQrc2NkbTNIRHkwTkNpY0FrVW1SdmN1?=
=?utf-8?B?bFlpTWtMZ05LTTVtS0ltZjUrbExhUUEvY01Xc1VCZStOemtXYWtMa2NrMnRE?=
=?utf-8?B?bGNZczZodzFFTEVDL2p4R2ZLaFNrYWlVdVFYdE5qYmREblpqUTlpcFVWaGtu?=
=?utf-8?B?VFdKektWeGRHcnVJanBWcXl5WEdWTTdvOWkxSjM3R21PMUNKUFpjOVE0U1hP?=
=?utf-8?B?bjB5TDlwdFpTTzJPOWVIcFVxSEtWTzNZZ21GTDdQb290OTh6Y3VmZklZWVln?=
=?utf-8?B?c3dVMGdKdkRscjBhS0l5eEtabjBkemVEczR0dGpHYVRuMXB0T1lFRUhlVHNU?=
=?utf-8?B?MFd0ek4rSmEyZkFXMFA0aEUzQzVnQ09DVElubmpWUExMMnhIVDBuWWhWZEhY?=
=?utf-8?B?Vi8zd0RuTnpRY0JpbTlhK01FUTF5OVFiNFk0ZUY1UCtPWGdxYzAyT0FJdFky?=
=?utf-8?B?L2h4MklPZWQ1a0tSMGY4TFRnQ0NvbC9aS1FjN3hSNjJ3R0hiaTlHQ0JaNWp2?=
=?utf-8?B?bnFROVh0THcrcG9xbjJwMEFQV1U2YVRxajNwR0tYZHRvK3ZIbGRsUzdwRnI3?=
=?utf-8?B?V29YUkJYWWlmTmN3ZjNMN1JzRWJ6ZCtSUkhjanBqTE1qY0NZZStweTNkY0Y0?=
=?utf-8?B?d1hUeENBdkV4a3c3Qy8rR0hETkMyTCtLVVl5RWs2NCsxeDI0RG9DN3l6YVpr?=
=?utf-8?B?ekZRdlNHYVBoSm1MMk8rR00vTWxLSGJQRXhPZG9MN3piRkdqMFUrK1QxR1U2?=
=?utf-8?B?cjBVK2p2RHA2NWRoV0o5LzdkRkhEc0NtZzJZaTY3a21pa1V3Q3JBRFNieVdD?=
=?utf-8?B?aGFaSVliQmE4ajN3aGlrQmIxcU5xb2lxTTU2T053UDhBdG12cVErMUM3TnEx?=
=?utf-8?B?OXBuN0lqeDlIU25XbDMzMG4yTTVZdDZJS1FhR0ZRM09sV3VOTUZUdlRwQ3A5?=
=?utf-8?B?TGdKaUZRSmRqU01xYVByckpqSzMydEtyMUs4a2VybHFPQjRSenBHRVg0MGZr?=
=?utf-8?B?b2dib3FQVzA3WE9hdWVyOHh6dHJBUUwzRDY0SVdHUFlNUE5kK0pDM205MVUv?=
=?utf-8?B?RG9HejE5OVFVOUo1VHRrNVdBMFQ2MGltRHk1eUpvZ0YzTG9LRjVadWlOOG1z?=
=?utf-8?B?WFJFWTkySUxiUUkrOVZyaTNLZld2c2diYndqQzFHc3VYUld4VGlpd09NdS9j?=
=?utf-8?B?dEZ1YU1vd0ZoRHc0QmlKY3o5WEFqUHBnSE5iL28yRVVjQkxyZVZQQ0x1VjJF?=
=?utf-8?B?am1GaW1raTJDRHVLZDhnRncyZW5QVzFwNm5pMmg2VTN2bS9PKzZuc3dMYm9n?=
=?utf-8?B?NTBPKys1bHRhN0JpbmM4RURxTDVuMElhVy85NlpGendncXhYMnd4U1ZYZUJi?=
=?utf-8?B?aUlhMUFyNzhISmNhTXJoSWptMXNZTm5aT0ErdXFpaGVhUHNCK0s5N1JRRWFh?=
=?utf-8?B?NVA5RE9NcVRBOUtnRmEydHRjT1llZjV2eTkxcjFIanZxUzNtZGM0MVR4U0JP?=
=?utf-8?B?OCtLZkFnRElaSGJUTnNsL1IxN3lwTk1meU1KK0FWRW5ZSXhwbnVaTTlQbWU3?=
=?utf-8?B?cHlyMzJya2dpSlVQamIzMTVXaGtrdlVpcDZDejIzY2MyYzEyWnFBUTk2QkZD?=
=?utf-8?B?Q1Q0UVJQcitXV2hSdWU3OG5WZVREaUtsbFZWOGtGWGQyZ2NmWVRaZlZxWHVz?=
=?utf-8?B?L3pnMXpBYkU3Z05Oc3BBVERDalNxeVo4dmw4RHZDeWhpWGo2ek5rbkFVV2t0?=
=?utf-8?B?OEE9PQ==?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
wK2QZV0HQaZBDQqJl6+BNIOqJ+nOlzSCe0AZ+bX4WtGC9h0I7BvdMU4NdCeDeCPwB8/aqqQUOOo02Cmkx+gGL6TjVQL9jQAJUvcqFFxITGGEVeBfNoM+6Ak1uhz9HB0XpXDgkCgvMcDkl2EHkTXP98Vg8MAWAeXuowbvt485l9cj9TDkrLgIkRbUzYXXzKECj57OUAH7d+EqHLe0k0Q0FwgtWo4y8roU5KDVJASJUaXlbOc+8PbfZn2/ECfjmNkzXmKd69hkxgW+zSYil4EhTwdxdw506uLFrpkAGsGbWZqB4sf8RLQX6l/pwCdbcjJeCKkFXfq9Isno1HdjGVXLsXY4v5fNtaPFaovyRsJzuHGCV+KOR42ZyTTmahYbN/RHAMw97pK0QlJpbipQz0Cei954MslnF853o4VPw0QS3UJYU2HNyjHHCEIOHoEC6xJme6KNvp1f2eDwL+lQry/HNvNQpZwobftCr974JIYP5SsJB50Io+spzg5SNlk9NP9AQ9rL5atXD5HNhRCdwnPXYY+dWqBnbR4wl/AznAz9dh9irs41IILFYVnl7jLTORcrTi1IsupIb7c/E87o+lDDesGDd71QGg6AQ8EJ1O6+ZUo=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 2501ee7f-d634-4db5-949d-08dda4e346d6
X-MS-Exchange-CrossTenant-AuthSource: BL4PR10MB8229.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:17:01.5539
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 2aAZWsCcVK3YcsQdBSn+pTYomsaHJ7OcyZNZi6xqLl2v1hRatLEaFVReAYkoW2X3+98+wucmauTqA83VFon6rQTuTVLOB4pdrFFV2jpdLM4=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6494
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060093
X-Authority-Analysis: v=2.4 cv=Wu0rMcfv c=1 sm=1 tr=0 ts=6842c020 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=1XWaLZrsAAAA:8 a=yPCof4ZbAAAA:8 a=25MXHmvSDuRyV_qfCIkA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
X-Proofpoint-GUID: 0iRSxKa2ftDzaUCyiNWhCMAChW3H0KHv
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5MyBTYWx0ZWRfX1EqVB9jK4dz4 YBOJoR0lYQYxZ5bbCIw9vKntej6zoA+JEpC7ONF0Dl8iIiub581hqBw6CMxPw26S0wZdWDfPR8w x6FXUux8/IdFFzeLkWAoG4XXthsoIHthchqzAd4BiTAZWqkWbbEsoI5KQgi/EPeNSQoIu8m+TBF
sHeGypG+sQN6hDRCe++Bwci2NjcHLquc73OESvMZblcHGlMPi5HPk94exyQ6NRVKCmEp2sXRYk/ fCoNHzLsTvp1dFPuc9mI5m+akiLz7GjBfcrOfDX7G6wXkIdAFX7SHYNo9g0fJA75KjzHjc1zqQA mFzzueu4AGQj0Q3KPpqBH0xfIy0ksKX38w50pyn6x+g7xggWHUzFYTatlLFzGvkAZakHlCthnkY
KgVhuTlM5ChED5sPq/0XwPFJhMMOeLtaXlyeibGOw73QsvRbo0roPlBkiyym2LGEcEtBpt33
X-Proofpoint-ORIG-GUID: 0iRSxKa2ftDzaUCyiNWhCMAChW3H0KHv
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 07:18:25PM +1200, Barry Song wrote:
> On Wed, Jun 4, 2025 at 8:17â?¯AM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
> >
> > On Tue, Jun 3, 2025 at 11:43â?¯AM Lorenzo Stoakes
> > <lorenzo.stoakes@xxxxxxxxxx> wrote:
> > >
> > > Hi Barry,
> > >
> > > As promised, I enclose a patch to give a sense of how I think we might
> > > thread state through this operation.
> > >
> > > There's a todo on the untagged stuff so you can figure that out. This is
> > > based on the v1 so it might not encompass everything you addressed in the
> > > v2.
> > >
> > > Passing in madv_behavior to madvise_walk_vmas() twice kinda sucks, I
> > > _despise_ the void *arg function ptr stuff there added just for the anon
> > > vma name stuff (ughhh) so might be the only sensible way of threading
> > > state.
> > >
> > > I don't need any attribution, so please use this patch as you see
> > > fit/adapt/delete/do whatever with it, just an easier way for me to show the
> > > idea!
> > >
> > > I did some very basic testing and it seems to work, but nothing deeper.
> > >
> > > Cheers, Lorenzo
>
> Really appreciate your work on this, Lorenzo.

No problem! Hopefully having it in code form makes things clearer on how I
felt we could thread state through here.

The truth is the madvise code, despite SJ's great efforts to improve it
(and indeed he has!), is still a bit of a mess so it's fiddly. More work to
do there I think!

Obviously you are replying to Suren below but I will be so bold as to
quickly give my thoughts here :P

>
> > >
> > > ----8<----
> > > From ff4ba0115cb31a0630b6f8c02c68f11b3fb71f7a Mon Sep 17 00:00:00 2001
> > > From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> > > Date: Tue, 3 Jun 2025 18:22:55 +0100
> > > Subject: [PATCH] mm/madvise: support VMA read locks for MADV_DONTNEED[_LOCKED]
> > >
> > > Refactor the madvise() code to retain state about the locking mode utilised
> > > for traversing VMAs.
> > >
> > > Then use this mechanism to permit VMA locking to be done later in the
> > > madvise() logic and also to allow altering of the locking mode to permit
> > > falling back to an mmap read lock if required.
> > >
> > > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> > > ---
> > > mm/madvise.c | 174 +++++++++++++++++++++++++++++++++++++--------------
> > > 1 file changed, 127 insertions(+), 47 deletions(-)
> > >
> > > diff --git a/mm/madvise.c b/mm/madvise.c
> > > index 5f7a66a1617e..a3a6d73d0bd5 100644
> > > --- a/mm/madvise.c
> > > +++ b/mm/madvise.c
> > > @@ -48,38 +48,19 @@ struct madvise_walk_private {
> > > bool pageout;
> > > };
> > >
> > > +enum madvise_lock_mode {
> > > + MADVISE_NO_LOCK,
> > > + MADVISE_MMAP_READ_LOCK,
> > > + MADVISE_MMAP_WRITE_LOCK,
> > > + MADVISE_VMA_READ_LOCK,
> > > +};
> > > +
> > > struct madvise_behavior {
> > > int behavior;
> > > struct mmu_gather *tlb;
> > > + enum madvise_lock_mode lock_mode;
> > > };
> > >
> > > -/*
> > > - * Any behaviour which results in changes to the vma->vm_flags needs to
> > > - * take mmap_lock for writing. Others, which simply traverse vmas, need
> > > - * to only take it for reading.
> > > - */
> > > -static int madvise_need_mmap_write(int behavior)
> > > -{
> > > - switch (behavior) {
> > > - case MADV_REMOVE:
> > > - case MADV_WILLNEED:
> > > - case MADV_DONTNEED:
> > > - case MADV_DONTNEED_LOCKED:
> > > - case MADV_COLD:
> > > - case MADV_PAGEOUT:
> > > - case MADV_FREE:
> > > - case MADV_POPULATE_READ:
> > > - case MADV_POPULATE_WRITE:
> > > - case MADV_COLLAPSE:
> > > - case MADV_GUARD_INSTALL:
> > > - case MADV_GUARD_REMOVE:
> > > - return 0;
> > > - default:
> > > - /* be safe, default to 1. list exceptions explicitly */
> > > - return 1;
> > > - }
> > > -}
> > > -
> > > #ifdef CONFIG_ANON_VMA_NAME
> > > struct anon_vma_name *anon_vma_name_alloc(const char *name)
> > > {
> > > @@ -1486,6 +1467,43 @@ static bool process_madvise_remote_valid(int behavior)
> > > }
> > > }
> > >
> > > +/*
> > > + * Try to acquire a VMA read lock if possible.
> > > + *
> > > + * We only support this lock over a single VMA, which the input range must
> > > + * span.either partially or fully.
> > > + *
> > > + * This function always returns with an appropriate lock held. If a VMA read
> > > + * lock could be acquired, we return the locked VMA.
> > > + *
> > > + * If a VMA read lock could not be acquired, we return NULL and expect caller to
> >
> > Worth mentioning that the function itself will fall back to taking
> > mmap_read_lock in such a case.
> >
> > > + * fallback to mmap lock behaviour.
> > > + */
> > > +static struct vm_area_struct *try_vma_read_lock(struct mm_struct *mm,
> > > + struct madvise_behavior *madv_behavior,
> > > + unsigned long start, unsigned long end)
> > > +{
> > > + struct vm_area_struct *vma;
> > > +
> > > + if (!madv_behavior || madv_behavior->lock_mode != MADVISE_VMA_READ_LOCK)
> >
> > nit: I think it would be better to do this check before calling
> > try_vma_read_lock(). IMHO it does not make sense to call
> > try_vma_read_lock() when lock_mode != MADVISE_VMA_READ_LOCK. It also
> > makes reading this function easier. The first time I looked at it and
> > saw "return NULL" in one place that takes mmap_read_lock() and another
> > place which returns the same NULL but does not take mmap_lock really
> > confused me.
> >
> > > + return NULL;
> > > +
> > > + vma = lock_vma_under_rcu(mm, start);
> > > + if (!vma)
> > > + goto take_mmap_read_lock;
> > > + /* We must span only a single VMA, uffd unsupported. */
> > > + if (end > vma->vm_end || userfaultfd_armed(vma)) {
> >
> > vma->vm_end is not inclusive, so the above condition I think should be
> > (end >= vma->vm_end || ...)
>
> I don't quite understand why `end > vma->vm_end` would be a problem.
> For a VMA with `vm_start = X` and `vm_end = X + 0x1000`, wouldn't the
> range `(X, X + 0x1000)`â??where `end == vm_end`â??still be a valid
> candidate for using a per-VMA lock?
>
> We're checking which cases are not eligible for per-VMA locking,
> not which ones are.

Yeah agreed.

>
> >
> > > + vma_end_read(vma);
> > > + goto take_mmap_read_lock;
> > > + }
> > > + return vma;
> > > +
> > > +take_mmap_read_lock:
> > > + mmap_read_lock(mm);
> > > + madv_behavior->lock_mode = MADVISE_MMAP_READ_LOCK;
> > > + return NULL;
> > > +}
> > > +
> > > /*
> > > * Walk the vmas in range [start,end), and call the visit function on each one.
> > > * The visit function will get start and end parameters that cover the overlap
> > > @@ -1496,7 +1514,8 @@ static bool process_madvise_remote_valid(int behavior)
> > > */
> > > static
> > > int madvise_walk_vmas(struct mm_struct *mm, unsigned long start,
> > > - unsigned long end, void *arg,
> > > + unsigned long end, struct madvise_behavior *madv_behavior,
> > > + void *arg,
> > > int (*visit)(struct vm_area_struct *vma,
> > > struct vm_area_struct **prev, unsigned long start,
> > > unsigned long end, void *arg))
> > > @@ -1505,6 +1524,15 @@ int madvise_walk_vmas(struct mm_struct *mm, unsigned long start,
> > > struct vm_area_struct *prev;
> > > unsigned long tmp;
> > > int unmapped_error = 0;
> > > + int error;
> > > +
> > > + /* If VMA read lock supported, we apply advice to a single VMA only. */
> > > + vma = try_vma_read_lock(mm, madv_behavior, start, end);
> > > + if (vma) {
> > > + error = visit(vma, &prev, start, end, arg);
> > > + vma_end_read(vma);
> > > + return error;
> > > + }
> > >
> > > /*
> > > * If the interval [start,end) covers some unmapped address
> > > @@ -1516,8 +1544,6 @@ int madvise_walk_vmas(struct mm_struct *mm, unsigned long start,
> > > prev = vma;
> > >
> > > for (;;) {
> > > - int error;
> > > -
> > > /* Still start < end. */
> > > if (!vma)
> > > return -ENOMEM;
> > > @@ -1598,34 +1624,86 @@ int madvise_set_anon_name(struct mm_struct *mm, unsigned long start,
> > > if (end == start)
> > > return 0;
> > >
> > > - return madvise_walk_vmas(mm, start, end, anon_name,
> > > + return madvise_walk_vmas(mm, start, end, anon_name, NULL,
>
> I think this should be:
>
> + return madvise_walk_vmas(mm, start, end, NULL, anon_name,

Whoops! :) you're right!

I kind of hate having to pass the state like this but I guess for now we'll
live with it and can refactor this whole thing later perhaps.

>
> > > madvise_vma_anon_name);
> > > }
> > > #endif /* CONFIG_ANON_VMA_NAME */
> > >
> > > -static int madvise_lock(struct mm_struct *mm, int behavior)
> > > +
> > > +/*
> > > + * Any behaviour which results in changes to the vma->vm_flags needs to
> > > + * take mmap_lock for writing. Others, which simply traverse vmas, need
> > > + * to only take it for reading.
> > > + */
> > > +static enum madvise_lock_mode get_lock_mode(struct madvise_behavior *madv_behavior)
> > > {
> > > + int behavior = madv_behavior->behavior;
> > > +
> > > if (is_memory_failure(behavior))
> > > - return 0;
> > > + return MADVISE_NO_LOCK;
> > >
> > > - if (madvise_need_mmap_write(behavior)) {
> > > + switch (behavior) {
> > > + case MADV_REMOVE:
> > > + case MADV_WILLNEED:
> > > + case MADV_COLD:
> > > + case MADV_PAGEOUT:
> > > + case MADV_FREE:
> > > + case MADV_POPULATE_READ:
> > > + case MADV_POPULATE_WRITE:
> > > + case MADV_COLLAPSE:
> > > + case MADV_GUARD_INSTALL:
> > > + case MADV_GUARD_REMOVE:
> > > + return MADVISE_MMAP_READ_LOCK;
> > > + case MADV_DONTNEED:
> > > + case MADV_DONTNEED_LOCKED:
> > > + return MADVISE_VMA_READ_LOCK;
> > > + default:
> > > + return MADVISE_MMAP_WRITE_LOCK;
> > > + }
> > > +}
> > > +
> > > +static int madvise_lock(struct mm_struct *mm,
> > > + struct madvise_behavior *madv_behavior)
> > > +{
> > > + enum madvise_lock_mode lock_mode = get_lock_mode(madv_behavior);
> > > +
> > > + switch (lock_mode) {
> > > + case MADVISE_NO_LOCK:
> > > + break;
> > > + case MADVISE_MMAP_WRITE_LOCK:
> > > if (mmap_write_lock_killable(mm))
> > > return -EINTR;
> > > - } else {
> > > + break;
> > > + case MADVISE_MMAP_READ_LOCK:
> > > mmap_read_lock(mm);
> > > + break;
> > > + case MADVISE_VMA_READ_LOCK:
> > > + /* We will acquire the lock per-VMA in madvise_walk_vmas(). */
> > > + break;
> > > }
> > > +
> > > + madv_behavior->lock_mode = lock_mode;
> > > return 0;
> > > }
> > >
> > > -static void madvise_unlock(struct mm_struct *mm, int behavior)
> > > +static void madvise_unlock(struct mm_struct *mm,
> > > + struct madvise_behavior *madv_behavior)
> > > {
> > > - if (is_memory_failure(behavior))
> > > + switch (madv_behavior->lock_mode) {
> > > + case MADVISE_NO_LOCK:
> > > return;
> > > -
> > > - if (madvise_need_mmap_write(behavior))
> > > + case MADVISE_MMAP_WRITE_LOCK:
> > > mmap_write_unlock(mm);
> > > - else
> > > + break;
> > > + case MADVISE_MMAP_READ_LOCK:
> > > mmap_read_unlock(mm);
> > > + break;
> > > + case MADVISE_VMA_READ_LOCK:
> > > + /* We will drop the lock per-VMA in madvise_walk_vmas(). */
> > > + break;
> > > + }
> > > +
> > > + madv_behavior->lock_mode = MADVISE_NO_LOCK;
> > > }
> > >
> > > static bool madvise_batch_tlb_flush(int behavior)
> > > @@ -1721,6 +1799,8 @@ static int madvise_do_behavior(struct mm_struct *mm,
> > >
> > > if (is_memory_failure(behavior))
> > > return madvise_inject_error(behavior, start, start + len_in);
> > > +
> > > + // TODO: handle untagged stuff here...
> > > start = untagged_addr(start); //untagged_addr_remote(mm, start);
> > > end = start + PAGE_ALIGN(len_in);
> > >
> > > @@ -1729,7 +1809,7 @@ static int madvise_do_behavior(struct mm_struct *mm,
> > > error = madvise_populate(mm, start, end, behavior);
> > > else
> > > error = madvise_walk_vmas(mm, start, end, madv_behavior,
> > > - madvise_vma_behavior);
> > > + madv_behavior, madvise_vma_behavior);
> > > blk_finish_plug(&plug);
> > > return error;
> > > }
> > > @@ -1817,13 +1897,13 @@ int do_madvise(struct mm_struct *mm, unsigned long start, size_t len_in, int beh
> > >
> > > if (madvise_should_skip(start, len_in, behavior, &error))
> > > return error;
> > > - error = madvise_lock(mm, behavior);
> > > + error = madvise_lock(mm, &madv_behavior);
> > > if (error)
> > > return error;
> > > madvise_init_tlb(&madv_behavior, mm);
> > > error = madvise_do_behavior(mm, start, len_in, &madv_behavior);
> > > madvise_finish_tlb(&madv_behavior);
> > > - madvise_unlock(mm, behavior);
> > > + madvise_unlock(mm, &madv_behavior);
> > >
> > > return error;
> > > }
> > > @@ -1847,7 +1927,7 @@ static ssize_t vector_madvise(struct mm_struct *mm, struct iov_iter *iter,
> > >
> > > total_len = iov_iter_count(iter);
> > >
> > > - ret = madvise_lock(mm, behavior);
> > > + ret = madvise_lock(mm, &madv_behavior);
> > > if (ret)
> > > return ret;
> > > madvise_init_tlb(&madv_behavior, mm);
> > > @@ -1880,8 +1960,8 @@ static ssize_t vector_madvise(struct mm_struct *mm, struct iov_iter *iter,
> > >
> > > /* Drop and reacquire lock to unwind race. */
> > > madvise_finish_tlb(&madv_behavior);
> > > - madvise_unlock(mm, behavior);
> > > - ret = madvise_lock(mm, behavior);
> > > + madvise_unlock(mm, &madv_behavior);
> > > + ret = madvise_lock(mm, &madv_behavior);
> > > if (ret)
> > > goto out;
> > > madvise_init_tlb(&madv_behavior, mm);
> > > @@ -1892,7 +1972,7 @@ static ssize_t vector_madvise(struct mm_struct *mm, struct iov_iter *iter,
> > > iov_iter_advance(iter, iter_iov_len(iter));
> > > }
> > > madvise_finish_tlb(&madv_behavior);
> > > - madvise_unlock(mm, behavior);
> > > + madvise_unlock(mm, &madv_behavior);
> > >
> > > out:
> > > ret = (total_len - iov_iter_count(iter)) ? : ret;
> > > --
> > > 2.49.0
>
> Thanks
> Barry


Return-Path: <linux-kernel+bounces-675590-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 70BE341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:18:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C331E189A5C7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:18:21 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 928BB2874E0;
Fri, 6 Jun 2025 10:17:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="W/8NzpW0"
Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131])
(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 4241027D77D
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:17:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205077; cv=none; b=aGw69wKsNmlq5AxlfRhxx/FajLDH/53KgDT/gPsnuX8KZbh/aOgoA6Z76vCGvaRhYNoqOEQt1Ht9qvfTe3tDxLIDcU/elYAoagy+Ix9+XUqFjCIn1YfUCdFhs+czd6L/kCe7cXNVGlo3iX+/BgynlI/3qppT/4eM2GooTYgitiU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205077; c=relaxed/simple;
bh=SVMCfylbwM5vuiB3Wx+PhHek76Iz+RwCcFIRJVgYp/s=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=HdXeSQs80JGqZ4/4QXM/U8eoqg+2SE9Glhyj0IxoGr68ji0ARI5WP2UwWvdUTugaYS/oFKIzZ7HxaS0A3ivzTSFJcwqHH6yNPcQr8xA0wc4qzKpNXbb+kBZ/FjIOAh7+TywzXvjMAylxaNmLKdCe3pdA2T9Ik653V1Oe/jts+S8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=W/8NzpW0; arc=none smtp.client-ip=205.220.180.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com
Received: from pps.filterd (m0279870.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5561CCwp013895
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:17:55 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=
cc:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=qcppdkim1; bh=MUm770nsjTk7RKaqGJXS/UXM
bcC3CLIfXaIBHht8qoo=; b=W/8NzpW0F9AfIenOSQKcaHAtJd6pwGHnLQ78YdyZ
VRa0/MQkCsHkOd05mCswdst64V2qpJjZbOf0Hqh3w1gjcq4siRG8fCEIn3blroMS
AkU6oTlRt+c8EZI67XOllofobWQ7GAizeV2l0rhhTYLVFLBgoR9AeS+wYaGtjIZs
GKv7HFBC3/J0UBIqyRIUkIwcTf9VnkN80hEc31kIUThXYYeJaXqWN7oUSgKMSGQG
V0VvQfcTJUMkssvLnMV5MO337dGkbpNd8wFQom6S+aZeqHf/JYdAaNeTDY8zq3mM
rofkJBm+IznBjcgn34id9RcF4n79GuZ8Thl6QmmicpyZaA==
Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471sfv3659-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 10:17:54 +0000 (GMT)
Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-235f6b829cfso12431985ad.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:17:54 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205073; x=1749809873;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=MUm770nsjTk7RKaqGJXS/UXMbcC3CLIfXaIBHht8qoo=;
b=pJybFLIHgEUPOZGROdSLsvviCO7YmyA33ionnOfT7PFs423qJZcrMUzjJ2OztEZ6Wv
nOgP/F0J4tA1uFmdMkiTwbN0fxGqKV+dGdHHZMepBJhUGqdQdYP8H/W/SMh8sROC87J7
mbw3fn72s0q/LC8kT0lGhQjB9uIwPTn1UVxz2zaUPJKTrkQDU+6uobSPdM53kuxcNV+E
vZjUrtqFOnHM0TpjxZtCFimHOK4EBc0MapPTo2xYJfOkXTtLWT56euAOwwG+xw4uCxbp
bYlbtOVCstnRzpyewW4WbAMafRsxCCTqgjvo5E5lC47Od4n9t9s+IWTl3Z6RKD919e19
gw5g==
X-Forwarded-Encrypted: i=1; AJvYcCXSHk707NLkdOcmiAkgphDIrVAiixKZ3tuR6RS1l6CEwltx8HkIjLcCfsehUTQ/0uzmG+yqb4WFczZqtr0=@vger.kernel.org
X-Gm-Message-State: AOJu0Yw5CWrF+4q1XQWjP18V3kjk7jFDa4Ilb0HQwxbC70esOohHtjaV
m3qVoMeeGkRC3MbAKKgIMOm2ev6HPujgAKvED2j6NzaqY1VVRmWZ1qCNFOwfmeaU9ByvIwLahLq
zLwA44NxqLU/4XQ5dMItOs9YMO0qmcb9hiIChSS7HJ+GKjJp63YW6Os847Wvb/R/tevY=
X-Gm-Gg: ASbGncsfBBfDDUUKXXM/b0bGSJ0YVshQ9y6+B+n4MV0eMwkZDB7Hru8zBl0wnjzImDO
+XneVWDvi0iSdm6cGNLstbybpCtuN/im4jT/lh2B7ngGZAsNO1dnpVkM4v3yU61M5pYwZ5fMkU/
N77/pg5szT8doyF+5xqXUL9tBNHmLap7AzOqZlI54BQqmrIbPRUnVTx4J6cliNotwknFKiXtWI4
e7tv36rUfr+myZ+bRARNPYUdTQ77cC2o6atkzqzmS90pAumF2QvgnSXLn74UDzJv3xyzAvlmra/
PnnMNm6AmosJ8zDSEiHB0AFMsIl7rtttensaFQFwIV2DAf+DImgpqVspXAc=
X-Received: by 2002:a17:902:e5cf:b0:234:d7b2:2ab4 with SMTP id d9443c01a7336-23601d038c2mr38586405ad.17.1749205073605;
Fri, 06 Jun 2025 03:17:53 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHWEq5utuN+xciTxdEM9oY6Q/JAcry9JQaMjmy2DyusLiUkQ5pFcrFEA1HGQcbYN9+4KF154A==
X-Received: by 2002:a17:902:e5cf:b0:234:d7b2:2ab4 with SMTP id d9443c01a7336-23601d038c2mr38586135ad.17.1749205073233;
Fri, 06 Jun 2025 03:17:53 -0700 (PDT)
Received: from hu-qianyu-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-23603077e9dsm9466565ad.1.2025.06.06.03.17.51
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:17:52 -0700 (PDT)
Date: Fri, 6 Jun 2025 03:17:50 -0700
From: Qiang Yu <qiang.yu@xxxxxxxxxxxxxxxx>
To: Johan Hovold <johan@xxxxxxxxxx>
Cc: Wenbin Yao <quic_wenbyao@xxxxxxxxxxx>, catalin.marinas@xxxxxxx,
will@xxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
andersson@xxxxxxxxxx, konradybcio@xxxxxxxxxx, robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
vkoul@xxxxxxxxxx, kishon@xxxxxxxxxx, sfr@xxxxxxxxxxxxxxxx,
linux-phy@xxxxxxxxxxxxxxxxxxx, krishna.chundru@xxxxxxxxxxxxxxxx,
quic_vbadigan@xxxxxxxxxxx, quic_mrana@xxxxxxxxxxx,
quic_cang@xxxxxxxxxxx, Johan Hovold <johan+linaro@xxxxxxxxxx>,
Abel Vesa <abel.vesa@xxxxxxxxxx>
Subject: Re: [PATCH v4 5/5] phy: qcom: qmp-pcie: add x1e80100 qref supplies
Message-ID: <aELATuLue/Vs8lHz@xxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20250604080237.494014-1-quic_wenbyao@xxxxxxxxxxx>
<20250604080237.494014-6-quic_wenbyao@xxxxxxxxxxx>
<aEBh2xHu3QDtUrxe@xxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aEBh2xHu3QDtUrxe@xxxxxxxxxxxxxxxxxxxx>
X-Authority-Analysis: v=2.4 cv=CY8I5Krl c=1 sm=1 tr=0 ts=6842c052 cx=c_pps
a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17
a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=VwQbUJbxAAAA:8 a=zitRP-D0AAAA:8
a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=COk6AnOGAAAA:8 a=Kn45tV52aVggcf7Ks3EA:9
a=CjuIK1q_8ugA:10 a=uG9DUKGECoFWVXl0Dc02:22 a=xwnAI6pc5liRhupp6brZ:22
a=cvBusfyB2V15izCimMoJ:22 a=TjNXssC_j7lpFel5tvFf:22
X-Proofpoint-ORIG-GUID: g9QqLKCZ4K2c2zJZ23oIVFqpMT-qs_TT
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5MyBTYWx0ZWRfX5ccbmkXolF7j
j/DrpaliSTJJbNxuaO5Y7ZgcnkwJLcfg1VJ9I0PJmXaGHwmCsx3zJqtF0hlK38vu12ws3jzevzQ
pM+tcSeDQRuZTAHjbdI7qSoSyYfeubOy3OakQtxXmNnyk0EWBnpEd2ZqkyZvChRTCa96aKDDH4M
8rjDtI8/FDSPeiCEkpq0m3Pdo0MKxXjxsStecJE/ZUTILHnBTUuBmcWBU7sCbqbBhUf+IeL8UOT
57x/MOlDcd9zlM1YEA1RKSgEdbaMZoYE0DJt3VpIhKrrJHZ9VBOVBPIafAG+pjlA3fYSIQb+xV5
JdtZvYWMYcbyGvFOuTeN3Mcv+UmN8kPYEfmRtotx/Sfms5rWJzzfEg/H4c+ErMTMv8dQSeh9gv3
1A5fVcQfDQit2u9s4sQfy+lF6ur6QXrwA2aDP6brknK7U5b6sUJrmpVJYZHHMkKczmZXsCWI
X-Proofpoint-GUID: g9QqLKCZ4K2c2zJZ23oIVFqpMT-qs_TT
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
priorityscore=1501 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0
malwarescore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0
phishscore=0 mlxlogscore=999 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060093
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, Jun 04, 2025 at 05:10:19PM +0200, Johan Hovold wrote:
> On Wed, Jun 04, 2025 at 04:02:37PM +0800, Wenbin Yao wrote:
> > From: Qiang Yu <qiang.yu@xxxxxxxxxxxxxxxx>
> >
> > All PCIe PHYs on the X1E80100 SOC require the vdda-qref, which feeds QREF
> > clocks provided by the TCSR device.
>
> As I just mentioned in the thread where this is still being discussed:
>
> https://lore.kernel.org/all/aEBfV2M-ZqDF7aRz@xxxxxxxxxxxxxxxxxxxx
>
> you need to provide a lot more detail on why you think modelling these
> supplies as PHY supplies (which they are not) is the right thing to do.
>

TCSR_PCIE_xx_CLKREF_EN is not always in TCSR, they're custom
bits to enable pieces of the distribution network. We always classify them
as "TCSR" even though they're not always in that module.

So even if we put the QREF supplies in tscr device tree node, it still
doesn't describe the hardware correctly as the hardware itself does't have
a unified structure.

Since the TCSR_PCIE_xx_CLKREF_EN is only required by PCIe, why can't we
model these supplies consumed by TCSR_PCIE_xx_CLKREF_EN as PHY supplies,
treating PCIe PHY and TCSR_PCIE_xx_CLKREF_EN as a whole.

> Also please answer the question I've asked three times now on how the
> QREF supplies map to PHY supplies on X1E as no one will be able to use
> this binding unless this is documented somewhere (and similar for other
> SoCs).
>

PCIe3,
VDD_A_QREFS_0P875_0,
VDD_A_QREFS_0P875_B,
VDD_A_QREFS_1P2_B,

PCIe4,
VDD_A_QREFS_0P875_B,
VDD_A_QREFS_1P2_B

PCIe5,
VDD_A_QREFS_0P875_2,
VDD_A_QREFS_0P875_B,
VDD_A_QREFS_1P2_B,

PCIe6
VDD_A_QREFS_0P875_A,
VDD_A_QREFS_1P2_A

> The fact that you so far have not been able to provide an answer
> seems to suggest that these supplies need to be managed by the TCSR
> clock driver which can handle the mapping.
>
> > Hence, restore the vdda-qref request for the 6th and the 3th PCIe instance
> > by reverting commit 031b46b4729b ("phy: qcom: qmp-pcie: drop bogus x1e80100
> > qref supplies") and commit eb7a22f830f6("phy: qcom: qmp-pcie: drop bogus
> > x1e80100 qref supply"). For the 4th PCIe instance (Gen3 x2), add a new
> > driver data entry, namely x1e80100_qmp_gen3x2_pciephy_cfg, which is a copy
> > of sm8550_qmp_gen3x2_pciephy_cfg but uses sm8550_qmp_phy_vreg_l instead.
> >
> > Fixes: eb7a22f830f6 ("phy: qcom: qmp-pcie: drop bogus x1e80100 qref supplies")
> > Fixes: 031b46b4729b ("phy: qcom: qmp-pcie: drop bogus x1e80100 qref supplies")
> > Fixes: 606060ce8fd0 ("phy: qcom-qmp-pcie: Add support for X1E80100 g3x2 and g4x2 PCIE")
> > Cc: Johan Hovold <johan+linaro@xxxxxxxxxx>
> > Cc: Abel Vesa <abel.vesa@xxxxxxxxxx>
> > Signed-off-by: Qiang Yu <qiang.yu@xxxxxxxxxxxxxxxx>
> > Signed-off-by: Wenbin Yao <quic_wenbyao@xxxxxxxxxxx>
>
> NAK, for now, and please don't post any new revisions of this patch
> until this has been resolved.

OK, I will remove this patch from the series if other patches require
updates and submit it separately when it is required.

- Qiang Yu

>
> Johan


Return-Path: <linux-kernel+bounces-675591-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D1E9B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:19:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id C8E723B0B8B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:19:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 27996286D5D;
Fri, 6 Jun 2025 10:19:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NAcC5HuI";
dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="oU5sfJAx"
Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55])
(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 914BA3234;
Fri, 6 Jun 2025 10:19:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205180; cv=none; b=GuYsTFokhTmsq8HuDsDZ52+Nep0Patpd87uQDoJhHEPEAMblGj2KfvArvAb5w/YqL9euJNk0sgmHHJyYYaG78T1Oj7zeVS61wKeQbiWwgF3nsDYTj7Xceu1KkjPYBzP+ZK7DYWfil1dLjk1+mN3HfXB0BQu3BaBq47tLOifAQls=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205180; c=relaxed/simple;
bh=U9oRcqk8pQONKNF0tSAsSNHiaoMlLKsDK3FIcKhEGQk=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
MIME-Version:Content-Type; b=pXiuQqEkfHvJWzN9bwtv/C9pRb1O+7ih7Jk9AEkGlHZONn1b7hgcwhA6a2Grd4FxjsqizfA8u1Up0c5scBB5/EzVGd/Vaas5k6ZNIBM4K0M5ExGuyRDfFdXDG0kD6P21SE9GhI5fVn8t8Vi9p56Beuq0at6EXlGN84yjZuDELyk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=NAcC5HuI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=oU5sfJAx; arc=none smtp.client-ip=193.142.43.55
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de
From: John Ogness <john.ogness@xxxxxxxxxxxxx>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de;
s=2020; t=1749205176;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=2Wj8ecJw8sQMELv22VyqXO77n+w+BEzjGz6ZQfwvvzw=;
b=NAcC5HuIuZMqVi0R070oigm72+7GL9UEurnIlPXXJZ3LfgUaFtk0M2Za0cGz/tUqCN+vr/
b5YdrvdC2jhJwxrsQD45HLC6oAWzXVejuT3MuPcYfyZ3zmDUJNvN++edpV0XbMn7cPVMrg
mF0NqAMkjNudN/f0dMo8nOS2CDMbILTm2jD0jTeO/m2N/9RYDMqta++hz3YEYHEC+JcZF4
P8g+YCmJqQ+hUdUH30LbU9toOmsYkpjwDooAi6MPzvXt9u0ncTB/f5bv2lf8kFYr9EJ3yo
Qi2ZlQzJ9K6Yc/K1RIemL0Bh5eTXnXB8OMMgviFVyMA7Vzg8NBQQHLx5HYVmXA==
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
s=2020e; t=1749205176;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=2Wj8ecJw8sQMELv22VyqXO77n+w+BEzjGz6ZQfwvvzw=;
b=oU5sfJAxPYPEf4Mjq9ihtQjWLaP3Dg/H2+yCANCmxnuvywVX0+sZLQKU+aAWpT5RSmH39E
6+95i4B+bR+O5eAA==
To: Petr Mladek <pmladek@xxxxxxxx>, "Toshiyuki Sato (Fujitsu)"
<fj6611ie@xxxxxxxxxxx>
Cc: 'Michael Kelley' <mhklinux@xxxxxxxxxxx>, 'Ryo Takakura'
<ryotkkr98@xxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Greg
Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Jiri Slaby
<jirislaby@xxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx"
<linux-kernel@xxxxxxxxxxxxxxx>, "linux-serial@xxxxxxxxxxxxxxx"
<linux-serial@xxxxxxxxxxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx"
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: Problem with nbcon console and amba-pl011 serial port
In-Reply-To: <aEGeARVcCwqcoHb8@xxxxxxxxxxxxxxx>
References: <SN6PR02MB4157A4C5E8CB219A75263A17D46DA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<OS7PR01MB13775FE1A20762D1EA4A38D0ED76DA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<84y0u95e0j.fsf@xxxxxxxxxxxxxxxxxxxxx>
<84plfl5bf1.fsf@xxxxxxxxxxxxxxxxxxxxx>
<TY4PR01MB13777674C22721FCD8ACF4FCCD76CA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<aEApOPTqbVOR35F_@xxxxxxxxxxxxxxx> <84o6v3ohdh.fsf@xxxxxxxxxxxxxxxxxxxxx>
<aEBNLMYVUOGzusuR@xxxxxxxxxxxxxxx>
<TY4PR01MB13777CC92C858572B9C19394FD76FA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<aEGeARVcCwqcoHb8@xxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 12:25:35 +0206
Message-ID: <84frgdcgug.fsf@xxxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Status: No, score=-2.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INVALID_DATE_TZ_ABSURD,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 2025-06-05, Petr Mladek <pmladek@xxxxxxxx> wrote:
> The question is if it is worth it. Is the clean up really important?

I must admit that I am not happy about encouraging the proposed solution
so far (i.e. expecting driver authors to create special unsafe code in
the panic situation). It leads down the "hope and pray" path that nbcon
was designed to fix.

What if during non-panic-CPU shutdown, we allow reacquires to succeed
only for _direct_ acquires? The below diff shows how this could be
implemented. Since it only supports direct acquires, it does not violate
any state rules. And also, since it only involves the reacquire, there
is no ugly battling for console printing between the panic and non-panic
CPUs.

Thoughts?

John Ogness

diff --git a/include/linux/printk.h b/include/linux/printk.h
index 5b462029d03c1..d58ebdc8170b3 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -208,6 +208,7 @@ extern bool nbcon_device_try_acquire(struct console *con);
extern void nbcon_device_release(struct console *con);
void nbcon_atomic_flush_unsafe(void);
bool pr_flush(int timeout_ms, bool reset_on_progress);
+void nbcon_panic_allow_reacquire_set(bool value);
#else
static inline __printf(1, 0)
int vprintk(const char *s, va_list args)
@@ -321,6 +322,10 @@ static inline bool pr_flush(int timeout_ms, bool reset_on_progress)
return true;
}

+static inline void nbcon_panic_allow_reacquire_set(bool value)
+{
+}
+
#endif

bool this_cpu_in_panic(void);
diff --git a/kernel/panic.c b/kernel/panic.c
index b0b9a8bf4560d..8f572630c9f7e 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -292,6 +292,12 @@ static void panic_other_cpus_shutdown(bool crash_kexec)
panic_triggering_all_cpu_backtrace = false;
}

+ /*
+ * Temporarily allow non-panic CPUs to finish any nbcon cleanup
+ * in case they were interrupted due to the panic.
+ */
+ nbcon_panic_allow_reacquire_set(true);
+
/*
* Note that smp_send_stop() is the usual SMP shutdown function,
* which unfortunately may not be hardened to work in a panic
@@ -304,6 +310,8 @@ static void panic_other_cpus_shutdown(bool crash_kexec)
smp_send_stop();
else
crash_smp_send_stop();
+
+ nbcon_panic_allow_reacquire_set(false);
}

/**
diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index d60596777d278..d960cb8a05558 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -235,7 +235,8 @@ static void nbcon_seq_try_update(struct nbcon_context *ctxt, u64 new_seq)
* the handover acquire method.
*/
static int nbcon_context_try_acquire_direct(struct nbcon_context *ctxt,
- struct nbcon_state *cur)
+ struct nbcon_state *cur,
+ bool ignore_other_cpu_in_panic)
{
unsigned int cpu = smp_processor_id();
struct console *con = ctxt->console;
@@ -249,7 +250,7 @@ static int nbcon_context_try_acquire_direct(struct nbcon_context *ctxt,
* nbcon_waiter_matches(). In particular, the assumption that
* lower priorities are ignored during panic.
*/
- if (other_cpu_in_panic())
+ if (other_cpu_in_panic() && !ignore_other_cpu_in_panic)
return -EPERM;

if (ctxt->prio <= cur->prio || ctxt->prio <= cur->req_prio)
@@ -568,7 +569,7 @@ static struct printk_buffers panic_nbcon_pbufs;
* in an unsafe state. Otherwise, on success the caller may assume
* the console is not in an unsafe state.
*/
-static bool nbcon_context_try_acquire(struct nbcon_context *ctxt)
+static bool nbcon_context_try_acquire(struct nbcon_context *ctxt, bool ignore_other_cpu_in_panic)
{
unsigned int cpu = smp_processor_id();
struct console *con = ctxt->console;
@@ -577,7 +578,7 @@ static bool nbcon_context_try_acquire(struct nbcon_context *ctxt)

nbcon_state_read(con, &cur);
try_again:
- err = nbcon_context_try_acquire_direct(ctxt, &cur);
+ err = nbcon_context_try_acquire_direct(ctxt, &cur, ignore_other_cpu_in_panic);
if (err != -EBUSY)
goto out;

@@ -892,6 +893,12 @@ bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt)
}
EXPORT_SYMBOL_GPL(nbcon_exit_unsafe);

+static bool nbcon_panic_allow_reacquire;
+void nbcon_panic_allow_reacquire_set(bool value)
+{
+ nbcon_panic_allow_reacquire = value;
+}
+
/**
* nbcon_reacquire_nobuf - Reacquire a console after losing ownership
* while printing
@@ -913,7 +920,7 @@ void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt)
{
struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt);

- while (!nbcon_context_try_acquire(ctxt))
+ while (!nbcon_context_try_acquire(ctxt, READ_ONCE(nbcon_panic_allow_reacquire)))
cpu_relax();

nbcon_write_context_set_buf(wctxt, NULL, 0);
@@ -1101,7 +1108,7 @@ static bool nbcon_emit_one(struct nbcon_write_context *wctxt, bool use_atomic)
cant_migrate();
}

- if (!nbcon_context_try_acquire(ctxt))
+ if (!nbcon_context_try_acquire(ctxt, false))
goto out;

/*
@@ -1486,7 +1493,7 @@ static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq,
ctxt->prio = nbcon_get_default_prio();
ctxt->allow_unsafe_takeover = allow_unsafe_takeover;

- if (!nbcon_context_try_acquire(ctxt))
+ if (!nbcon_context_try_acquire(ctxt, false))
return -EPERM;

while (nbcon_seq_read(con) < stop_seq) {
@@ -1784,7 +1791,7 @@ bool nbcon_device_try_acquire(struct console *con)
ctxt->console = con;
ctxt->prio = NBCON_PRIO_NORMAL;

- if (!nbcon_context_try_acquire(ctxt))
+ if (!nbcon_context_try_acquire(ctxt, false))
return false;

if (!nbcon_context_enter_unsafe(ctxt))


Return-Path: <linux-kernel+bounces-675592-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id ADC3B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:20:01 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id CAF861898BAE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:20:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 45832286D6B;
Fri, 6 Jun 2025 10:19:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="o+QL947p";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="UQs12VE5"
Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32])
(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 9A9793234
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:19:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205193; cv=fail; b=m941FP1dx3GBlqrUPBD8OeNtAAbKZlYw8hdCnJ8G9iqF3Au9qStZbqiiZIUO/GPsQz5My+PWhobLGMBEhviTxZ7IkwF/c6Q3LN+k3795IpGvm+kyairzXHKx5HLddTr2WQN6PWZinOvY5W4vseUO6vFcLE5CDchhOPqM9VB0v0E=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205193; c=relaxed/simple;
bh=96KpHSEI7OyViUkOQlLImyOMA76rDvnL8aIQ210ljXM=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=CQC/aWeUeBTBeFGcxuszVtEI07h31eHi1gs83Bj2r5GA7GbmzZu8ICeAgYeY7fat0L6I1rIDcnz0unPskq1AY4n7O+1/uQct0AufDl77iRfciIzXoYH8cCVxPITprrMnXdBsmL/3AqJ+0otOI0z9rZvwQRTQIWcUvQLjJ4SsAa4=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=o+QL947p; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=UQs12VE5; arc=fail smtp.client-ip=205.220.165.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246629.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NCOv011366;
Fri, 6 Jun 2025 10:19:36 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=96KpHSEI7OyViUkOQl
LImyOMA76rDvnL8aIQ210ljXM=; b=o+QL947pidpPB26N9euHG8tYddgu7Xzsew
RnFNXYS119fQTaag13HS1T5SWjuw+ZeuFy31qk4La83CqKAONrVrozTyEo84m2VP
r0IEReWCo2FNxxShxEWqUH1keXb8bj9wzNCU5LNEj5kETVzacndEybUPm3h7SyM/
epOtFNEk+PpTNleXCRKiijEwMB9BIqNEgrdeV/+0ohZ+P3dxmuVSAeGtlBM8KEKT
YpdvRY/35EnGf1zuk9BNoqHe39QIMS33Oi2lQT7mBovOs6nv6ikYPF07oYaTwM/M
lQb4Fy9tQGibyGzMraXckLo8kccr78Q1AgPR0LbrZhPCcDYUFZig==
Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gwhfkkn-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:19:36 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5568nx0L040198;
Fri, 6 Jun 2025 10:19:35 GMT
Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11on2080.outbound.protection.outlook.com [40.107.220.80])
by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7dc78e-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:19:35 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=MK2PPXhc6KOiaGgpGHvl6eWierfY8xT3bbER064WK8rVtmswv8wxNJc21245P34Wz8Xcfded6IayS6v7XoIejhT8ugPxaaDAN1GN5I6nqxNNcT1mZII5WQ7bDMnMOCYMfMQ9nNjyaKx2zGwKEuBEgH7Xp+s/h6dJ5kjh8UcXe4XYzOaWiimUdwLk9EavBEaCy483eUSbseF1U1JXxxqYC+A0t+TL/ippHtR4LgTB8iFHqXjhRmh35x0vsARaNjOiXm8yMAuoOOImW4cP7Cim6di3ORXxMhO673kg4BENb9FToa3Y7RpAyy0ignzTJr74A2P2PRjgr+sBfemoYeNAvw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=96KpHSEI7OyViUkOQlLImyOMA76rDvnL8aIQ210ljXM=;
b=Y8TaylBI3eXTVBWAQb50+8vUUeBKvy2mC8Wc85kykguyf9P6iq8OoKqM2v10+FDSWx51whO0MZvombgCdNY3jrp7jwU7VyBJ14dz7fcgRThJnrJfXGtUDbUtJsUtNdyN0gJ5VcfL81aFNZvR+qnRSuxAc7vPHIIGFoXRywa31cu1LSRwj9WFmSaKfGYECC4g1K/sLpUIOx/CblAZJ2Zs0CTT8vSJLdicvuR5XwVEpKg5vuGO0IlLLAwjf3X3SfmYeWe76poA1/DydbapJLVImUFXOAS9FkB+pVoMN80YmEmWOYppE2y8TTDj4jvdUwCyx9/rRc1m5VPuPnbQS0eBpA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=96KpHSEI7OyViUkOQlLImyOMA76rDvnL8aIQ210ljXM=;
b=UQs12VE5j1rppFRTzVsD5K3jeI1tgVwywqJTKn301jfrcLUdTqnjz17IyBaCvCh90CzcGxzmUNabjNel8VU1EJDxXAB7OirDfYBXkcJmokXmWMvPgOETieTacXFQ4Y3xSfTY5gAK2ZZz09KqP6KC3DYapSsUKynLKhyjzSWfJa0=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by IA1PR10MB7336.namprd10.prod.outlook.com (2603:10b6:208:3ff::15) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.40; Fri, 6 Jun
2025 10:19:31 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
10:19:30 +0000
Date: Fri, 6 Jun 2025 11:19:28 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Michal Hocko <mhocko@xxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>,
John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
Message-ID: <50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aEK_R93gihEn-xW6@tiehlicka>
X-ClientProxiedBy: LNXP123CA0009.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:d2::21) To BL4PR10MB8229.namprd10.prod.outlook.com
(2603:10b6:208:4e6::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|IA1PR10MB7336:EE_
X-MS-Office365-Filtering-Correlation-Id: 607d381d-3f74-455d-7a42-08dda4e39fe2
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|7416014|1800799024;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?8vDFtyGgSzVc8TbXCagmaCEZRmgel6bV+WxXd1lFNrMgIm8Abzrx2M+Ht4io?=
=?us-ascii?Q?V1bpgID8KpioTBl3/j9po9D9VEoFZg1dYkrRbK4siyznPx9ajHD02aLp57uf?=
=?us-ascii?Q?VL8l1qSu9UvDgmMppNBbtvhE+5UvPqtIcv9Tc1UhSEQxVzw92T8TMmQcIpo0?=
=?us-ascii?Q?td6yV+z68wLKvyj1b2ZiAAvlY8xNBoyTm6UAMlDhgfyPZ5sZHPi0hdzVyNYU?=
=?us-ascii?Q?kwgEUg21Z/yDApiML0C6X6xGton45BB/wNtr3TOhpQnu2vY5RKnPJuXvXz80?=
=?us-ascii?Q?31Qn5J8o4snIUEinchLubrlUb0/lWbOS3qAlrcWYZwD36VbrlV197GWbEj4x?=
=?us-ascii?Q?AHEgRA7+FLoBirDtO0L8UzQOJHUtBnhQwP6rn3O5jvgmwiomxW2yV8A8szgS?=
=?us-ascii?Q?s58KyqR9b9Fltlx+slH/zuGtw60ZAwlv37qROHVy4uj+piM403y6+lT8QE1s?=
=?us-ascii?Q?j2KCzTO8eBnuMryvk41/MAS3oXUbWX5Q5ODCfCMoXUzzQdh3H5E8DrXplGrN?=
=?us-ascii?Q?4oKoRnV/sbvxsIIDOnfknqt7GxO04+MlnqbSEkpAnr51G8ZuttjbC5jeWuX4?=
=?us-ascii?Q?5g5K8Y5YB5Ki5dt8fUhyqukTsa/7MmtQh6LdnYORFoLmbiNQlQhqJt2WsRXs?=
=?us-ascii?Q?3jdpi0x+yyAtvEi+VH2JxzJUxxEbQxnWlGpf0NKCbsHOwuXT3RAvti2QHQ0p?=
=?us-ascii?Q?EpWGD5e8r4RvBXFtNv9ZQoS0ftSnBH0EmU/4bxeRHM0UBdqN46np06Pb8hOx?=
=?us-ascii?Q?qUg8t63qUJhnibEkixkmCRIu/nuRmkWVCKwnlndgkdEWE/6kslh2t3ZrZZQ1?=
=?us-ascii?Q?p1KZVn4uul8YOgMboHhxHilQRDtg/9gGTQAgkR7UDAseI934Eeo8E+ca0Tis?=
=?us-ascii?Q?bqfNKUuki9EXKr3oyVpajoB4HMAcJR7GF1AGV4Zd6rfFtzANud/SpOL5tX4E?=
=?us-ascii?Q?vgOXtr6a/wMWAYrWeG3i5UVfGa9YUnea+qcB7yAWuHynGQj4diihMHhDvLWp?=
=?us-ascii?Q?k9tjXQPDodmsDzyDnY/9hAm4B+hCaK77f3j1+U2im/ZYyzwbDwmEjdbZPc4m?=
=?us-ascii?Q?lZ14/RCdgUStAf75BhyFgswXnVbTNsobRHNIPeJnJAHNIqBwB/wq6y5EKbrt?=
=?us-ascii?Q?HBFUCVqesSg2lVdk/C6jZEqXRjc8oY29WWxpXYquv04DIj2bijhYoFjaFU6t?=
=?us-ascii?Q?Qg5KXFrE3+QEZJPUPna/wCHDBgNrBVdFjBoja1SVpL5Rl9xvpwUtMhEVD4Ei?=
=?us-ascii?Q?nc53nDpZcJStxI8vwZXhqgVdbyyOLYFpYeYw4WzN877neGiaB0EEy3pn0y1A?=
=?us-ascii?Q?RI9HcXSNe+cN9ApxGQx8UHQ2EYpnfu+og2qxHihDKzAwm0uMaKE4D5C8CMky?=
=?us-ascii?Q?iVi+2haSPKApd3ziCUwFN1jws6rcBuYBNiFZFyITuX9eJBhWm7If55Yp2ASx?=
=?us-ascii?Q?yS/tC1FhLIo=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(7416014)(1800799024);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?xBZWR6SMdt6AJTfmg08iH7VVO7X2QRAiCh43+zBwzUJ6jvttRemGNGVk6X+/?=
=?us-ascii?Q?qym29aJrbb1T5DOWSniqEWiWjpjrsxvRStipjkVsvj2fe+Op8Bj2HbfZXAhz?=
=?us-ascii?Q?/d9kYXoaXva1rh/LGFEBPNNCUhPdzg86DdUKuLJTeI9VdVUAr4HjoenYY6i+?=
=?us-ascii?Q?UtIfMd4gZrJksgnLdcKg3t5stSUbvPr+E/fb6SrS1tw2gUEA+I9Pp6IiOkqs?=
=?us-ascii?Q?BO8pd1rKM8amcR4q9smQrLNFbMBH27iFrUUQ4jmV16s7/7DY4dbzfSIylxKe?=
=?us-ascii?Q?AQ1XZ0aQiLgMMg41A/jM9yv7pVhodFFUyJPKY500MD5KJz0IQczyeKLN98jW?=
=?us-ascii?Q?09aii+YWlFJ24piaCaGCR52ryZ/ZfYVVCxnpJd2iqcmhOVABykWBqaAm5OFz?=
=?us-ascii?Q?6HvfE5ZeSVTuLsG8DFQ9qgcvTaUP/TaSMh9xpax71wkb6Qt0myyHjfG0hFtz?=
=?us-ascii?Q?z9iiqvBZrF61KkfsTpX/wNDl8ttN9dmw4t1O5P6VhADvBX3AJFGwpvAgCfsd?=
=?us-ascii?Q?p3sqAj+tXUKIGqRuxNVJEuVNfM4GP/aUnCv96C8qB+zT9OKX9AsvMzPbdl3g?=
=?us-ascii?Q?MzqKGfFzkrcRLlVhXtWfrpTNir2O7gQ22tjBDdI4uYkdIAzsAxfd/1TVUiPS?=
=?us-ascii?Q?JNiuWYgp/n3jm/N68cxakPVebMpotg6K6vOb1yj6bKsHNoS+eCqoPF1IpCJ6?=
=?us-ascii?Q?u51Pctf7VvTZ/42zkgEqhl8BSTGltxOmVBjYVPvX6LYHdg96v5iBAMpaEDG5?=
=?us-ascii?Q?70wrkmn0I5Bl66+6cmpcpe69RpBriavs/RdUtWy3BXbjkTbKh3A3nyV6nzne?=
=?us-ascii?Q?GRGQoWQ05Do9sgOMOW3UNd+QGUdpLwbX229BG49LlIsJRP7Ck5jDh1YVfD55?=
=?us-ascii?Q?IqGnPtPAREyUz8ylceyAfbsYjIGZFAnH0G5OMgt3HJq0lbLGfH/vI2eZof85?=
=?us-ascii?Q?8v2Xluc+1VX0b9mc9zMBqUI54qywVFQwh5Z+b82+Bd4GAO7n6kx6kOAyQ7QG?=
=?us-ascii?Q?q3pQxaR5VZOpSNEUjnkc08un+9iTiILKVhsgg4GlUCEhIjzoKEAiMBAVKZZW?=
=?us-ascii?Q?L/35Uu4TmiaxR6McggIhze5FbsXAFE9Q+b+CWecC8NzjCsjCJ4WSzDy6Y4lk?=
=?us-ascii?Q?6aUcR9tGRsdxGUvSJkOwY1ZD36F5vVNnDBtUt8vQyeaXc/x9hF8MUhvIGB81?=
=?us-ascii?Q?XtJJdjMz+MVIr6+rEZWr2732TGQjPSi1do4ZXf31IiSUYFcAHGgpn51ofM3l?=
=?us-ascii?Q?dxjJGbqLCnru7cnb6f6MwWJhivHKlE1P1rRziFsMyALNocv5ekN5PY8QTM85?=
=?us-ascii?Q?PIhH9LYC9p+W8vhx/l/8e12VGtic9xcWnIRxT9ZI0MXeVmJ6caN+M8lnVFs/?=
=?us-ascii?Q?CHRbm6hLeip062PAN2t0lOCparucr0OTRNOKC8B26p/aXTxPy5VmwWPLmBJO?=
=?us-ascii?Q?7U2nylQWDWWdYMwjFWlWbamfPfSugwCNQ3+3g2bwKRbYL2euOyQ49kFSOzWB?=
=?us-ascii?Q?XiXwy5AZAcLUc2C86zompP4Pqm+k7KDkKrIF8+b64USkgvXzgRjaBPLF06LO?=
=?us-ascii?Q?h7o6ZtqQPBSMYFnCjK15llaYDsQhPkHnj4oAJAT7j7Wz5j6uLbuNPFOvaKqh?=
=?us-ascii?Q?9A=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
3Q8svOKD/3WZGPHvGhciN7l7uWKeAIN5e7PhCMXH5j6lK8ktkpF/k0KWi4S6pxqQBUJX+ceH8oP6NSUWMJ5jaG37OOsH0EHb0+lxDrBbJsptcpH/F42xChyV7kyXL9FJBr1QACUkmUwjMSJi4YOMYInO2lsUAEvuI8TEi7QHM0MsJ2lYOUrlPss+qALB98oexM9MPbqfdIyPDNHo8uOa7lQSS0/i10ubcSNDvzWAmVsZWhZNQhfmsaKSZn+inLLc3/lfGBCSTz5+hXisPUuyr/9iy7Cid3YwtsrIwC2O+gzeTKb7ts7mmCS4tpC9zEvrc+ybopKPXh0uwp7BQxJs3h1oaA2ruzzTQBubgxFtI1rRl3tp5DGmRNSJhf+A8VkW1Efc7L9oca9G1d8/Jm89EGpmrtA8hfVVUSfuS48W3BlPFkDVVzPqXABGdBqKP+j0xGBGtiuuQvkzKuOHkncTgJDY6EpCXV/u5gxLyeQF+hvpbKRZHUJDCNO7O+bqXLKrhCIIa96+KQTSJ+MoZCbztEFqcS2uxU7yo+tg8+tXgTMZbsNDO42eSUkbDH5rD3eg/q5jDBviEX0lHShnT93D5IXB7gxqPHAWVwQaaM9Dd/U=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 607d381d-3f74-455d-7a42-08dda4e39fe2
X-MS-Exchange-CrossTenant-AuthSource: BL4PR10MB8229.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:19:30.8147
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: wy7CeKBs29u8zPkK9IRQyXqx2fB+Kh5fiCe/WX/2g20rtoRmqTJrS2qtVo51yWjUzj6nrLoxpmnmPzfphBfoubWu2DWBoAxcPmEgLGDecm4=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB7336
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 malwarescore=0
phishscore=0 mlxscore=0 mlxlogscore=411 suspectscore=0 bulkscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060094
X-Authority-Analysis: v=2.4 cv=Wu0rMcfv c=1 sm=1 tr=0 ts=6842c0b8 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=8IXTDK3gWPi9ZSE4_WgA:9 a=CjuIK1q_8ugA:10 cc=ntf awl=host:13206
X-Proofpoint-GUID: gcf8HNrDewP-meTKgehQvk9YSuKNb_CY
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5NCBTYWx0ZWRfX7cZ7gw1+nhVS GOiSyNepWf9bXr3hr9Kslc3JO71d2bTNvKQGHrm6SdgEl1hY4rSiR7yXMFyvCEj3z/M5Zmnwgnk I9vJrDMw9f7dW+GmbU0c+2L5iFlCYBOb4D0MC2s/H6XkE0c8MoIXnoE0G3ci5WtlWn37MHutQLf
xjVqCw2bQJiwcgvRdSFeX+sHdE4Qp0wb9WRb15o/JyMJzFQahDsUQhORAdzy5kfOgd+FGvUFEjQ i9b+OxRDQkubfUazP+Gu9Gamw0OIogOSrVS2dFX9ErdDZ+GFmUYhQejIzq64UZuaxGl4T5ZxJ6l 6Pav+7xuLAJpblnpd1oPFpnZCSpN922z/82vX5R/5MHU7nRmuWi/lpwM+oRfdxaS3uXp8/AXN7W
m7b+lsRzQpWILu3zVGLWtG1lGSIO9FcBd5VojIhgYgMAvLhYOq9AMD+DJUkuihLODDJXfmxs
X-Proofpoint-ORIG-GUID: gcf8HNrDewP-meTKgehQvk9YSuKNb_CY
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 12:13:27PM +0200, Michal Hocko wrote:
> On Fri 06-06-25 11:01:18, David Hildenbrand wrote:
> > On 06.06.25 10:31, Michal Hocko wrote:
> [...]
> > > Turning them into VM_WARN_ON
> > > should be reasonably safe as they are not enabled in production
> > > environment anyway so we cannot really rely on those. Having them in
> > > WARN form would be still useful for debugging and those that really need
> > > a crash dump while debugging can achieve the same result.
> >
> > One question is if we should be VM_WARN_ON vs. VM_WARN_ON_ONCE ...
>
> *WARN_ONCE ha a very limited use from code paths which are generally
> shared by many callers. You just see one and then nothing. Some time ago
> we have discussed an option to have _ONCE per call trace but I haven't
> see any follow up.
>
> Anyway starting without _ONCE seems like safer option because we are not
> losing potentially useful debugging information. Afterall this is
> debugging only thing. But no strong position on my side.
>
> > VM_BUG_ON is essentially a "once" thing so far, but then, we don't continue
> > ... so probably most should be _ONCE.
> >
> > >
> > > So while I agree that many of them could be dropped or made more clear
> > > those could be dealt with after a mass move. An advantage of this would
> > > be that we can drop VM_BUG_ON* and stop new instances from being added.
> >
> > As a first step we could probably just #define them to go to the
> > VM_WARN_ON_* variants and see what happens.
>
> You meand VM_BUG_ON expand to VM_WARN_ON by default?

Sorry to interject in the conversation, but to boldly throw my two English pence
into the mix:

As the "king of churn" (TM) you'll not be surprised to hear that I'm in favour
of us just doing a big patch and convert all VM_BUG_ON() -> VM_WARN_ON_ONCE()
and remove VM_BUG_ON*().

Pull the band-aid off... I think better than a #define if this indeed what you
meant David.

But of course, you'd expect me to have this opinion ;)

>
> --
> Michal Hocko
> SUSE Labs

Cheers, Lorenzo


Return-Path: <linux-kernel+bounces-675593-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 06BCD41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:20:43 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id BA0FC1893FBB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:20:56 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CC98286D72;
Fri, 6 Jun 2025 10:20:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VSBccEjm"
Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11E083234;
Fri, 6 Jun 2025 10:20:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205234; cv=none; b=qPxaPq2u2qtzitvP4R+zbjul7g1F5iwDHbsaqsVCN2WtjrrYx+sqtLxRiCPWYmE1TRHZqZMSR0xdNBt0htwC34NxTh30Asdt47InKMLVNcJ73yurZjvV8e8hi80qNbEyQy8PON0rcLFDxseBdcTGqsNCLoDA3JSuIZMv+BC7PJ8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205234; c=relaxed/simple;
bh=AI9QxnSNlM1JhP8O648z9WCcHecmjP9gRcEPyx816sU=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=tegrCi5E7x57Ndo/AUVEeju82upAxtEZvR8uX9uL/b6jtjscyPJ2okbfmV21c7oW0ToyV7vqQR2t66XCpa59b2OwmjugCW7wtuFvFVkjIQkKidwQAuzoQcFJ/mSscmHLHaQ9CaTNhRskRwBQM4fDA6IrxwCFq3VfMep+rqqL0tE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VSBccEjm; arc=none smtp.client-ip=209.85.215.177
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-b2c41acd479so1186012a12.2;
Fri, 06 Jun 2025 03:20:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749205232; x=1749810032; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=ETuL9D8RSnjYVVX5ojRIWsdvRALWmvbl6BZ2BJtWtAA=;
b=VSBccEjmiLIAmYLByxwObE8+PcsAhzQH0uyNzG2mrXaVjlWAbwg4+ZXjy+Ako87+K5
sbiGsfC328QyydzZKE9T4TgBhjPDjlop90iY/73OcnWdexOrzFh/WFjb/7DfRHdiZaY9
jRnMkLF1kb9e1bXwcQtQpVtWqjz5D8VbxqmA1ogCmcmfRipspEqgNk6KDaCYKT1jNIIB
MND+bsqqoWLC5w+QSzSnZi/D0TRnfa95/4K2sySwpZuCKTD4cVy0RSBTxxup1QrDoBy/
s6WGchTcsxATtqAeXOTVJlRNzrlPME24qMJ631yXgU59S1UEfczKlB5t8j0RTqwvUCFp
XR7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205232; x=1749810032;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ETuL9D8RSnjYVVX5ojRIWsdvRALWmvbl6BZ2BJtWtAA=;
b=j1ZpIGWYtjhCTqmbl9zxaH4RIUeBM0THKFEIi4U6nYEo4cLvEwYOzmM2FRJSzZhW9M
eHlVnB0ilJagZkJej8Q1SddsNNWONOG9SBn2y8/2Gyc6/f1kXPQPL0/iqbEY5E1FQd3C
MsN58Qob+qn3d4JnxfvFed95Op+VH6HQl+oSPDeRJav39pRq6yokHzSSEmC9CJXvgLR5
PGyAGEg+LxtNshC8BqZ5tA8hHRahTPM3ytyFXc17oKT6rhF6ct6rMN37BhLPsF8mrZFf
mNioiKr1ZNqLuxa9prgqnT87YmGGQMt0uhcYza6BjIFYYigjoOkoa0U9PPpL0RZULO/J
591Q==
X-Forwarded-Encrypted: i=1; AJvYcCUOXgksaAVb5IjauRWb5w7E+YOikf4JZgLwV+nYHDKTM6PDca+l/uuRrrc+wJX/EceozcnJDHmwKOQaHSEc@xxxxxxxxxxxxxxx, AJvYcCUped54cfgt9cmxkvKW9utAeFr2HYRqWwMAMA93bm9c0gsTYKZJSfZdklDDKjruyhaPaHPIBEv5mkY=@vger.kernel.org
X-Gm-Message-State: AOJu0Yyq47O/T6UBc+GP2BVuOBFrQjROBQVmVSvbGY/9sMVcX7Za1Rll
m2E+bEJWbvO5+oUAY/Y2ouN/uTcFML38iRRLHbTUCNMsctpg5tljUpWMuNO7I4A7QDWaBF7lvlG
QbKueSuvlHLdsX74PnZzTRZZ3vfaky/Pgz1ok
X-Gm-Gg: ASbGncsL48u8GLRD2PGgwRVKljlnLN3VLmuMjXV+ixfvLu/G0wdbBftDzhRvNbjStZN
cWwNOiHd2zzJKj0J1SBotN7rb6weRVwj/3ngIODaZwZQH+8JtlZFrPwWvWYW649wlNeFLsnHR81
DHvGaf5+5yztcehLuZ1jm887j/Q8IhExiEozmcGyXWgRtTiwa9tzLKNmc=
X-Google-Smtp-Source: AGHT+IGITB9DBn7CmTh1MRgISUua3cg7nL0VseDHA+PSfOIAybb0qSIsTuS4UM+XJFXPczOmhY1Qh5TlzqXxjNy32Bg=
X-Received: by 2002:a17:90b:4a45:b0:311:a623:676c with SMTP id
98e67ed59e1d1-3134767ec60mr4449882a91.27.1749205232170; Fri, 06 Jun 2025
03:20:32 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250519-timestamp-v1-0-fcb4f6c2721c@xxxxxxxxx>
<20250519-timestamp-v1-9-fcb4f6c2721c@xxxxxxxxx> <20250531191446.1b1d2e2f@jic23-huawei>
In-Reply-To: <20250531191446.1b1d2e2f@jic23-huawei>
From: Gyeyoung Baek <gye976@xxxxxxxxx>
Date: Fri, 6 Jun 2025 19:20:21 +0900
X-Gm-Features: AX0GCFsHqzI1dazPGDMbPbzMFgCJGMuZ1DrDeWG1LJC8Ri66fX2V3xX0UHuQhuk
Message-ID: <CAKbEznvpL6Wj9oOqZkcw5fRzjgDa4zx3Mk+=cj5BQmkLPZHNDA@xxxxxxxxxxxxxx>
Subject: Re: [PATCH RFC 9/9] iio: rpr0521: Use new timestamp-related APIs
To: Jonathan Cameron <jic23@xxxxxxxxxx>
Cc: David Lechner <dlechner@xxxxxxxxxxxx>, =?UTF-8?B?TnVubyBTw6E=?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Sun, Jun 1, 2025 at 3:14=E2=80=AFAM Jonathan Cameron <jic23@xxxxxxxxxx> =
wrote:
>
> On Mon, 19 May 2025 23:26:01 +0900
> Gyeyoung Baek <gye976@xxxxxxxxx> wrote:
>
> > This patch is an example that helps explain the previous series.
> > Now there is no need to handle timestamps differently depending on whet=
her
> > the consumer is attached to its own trigger or to another trigger.
> > And the own trigger of rpr0521 can simply pass a timestamp to consumer,
> > using `iio_trigger_store_time()`
> >
> > Not tested since I don't have the corresponding device.
> >
> > Signed-off-by: Gyeyoung Baek <gye976@xxxxxxxxx>
>
> Ah. So this is what the trigger grabbing timestamp thing is about.
>
> I'd just ignore this case for now and solve the simpler one
> of what to do the the pf->timestamp stuff.

Yes, since they can be logically separated, it seems much better to
split the patch series as well.
Thank you for the review.

> That part of the patch set looks promising to me.
>
> Jonathan
>
>
> > ---
> > drivers/iio/light/rpr0521.c | 22 ++++++----------------
> > 1 file changed, 6 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c
> > index 92e7552f3e39..32981db18428 100644
> > --- a/drivers/iio/light/rpr0521.c
> > +++ b/drivers/iio/light/rpr0521.c
> > @@ -186,7 +186,6 @@ struct rpr0521_data {
> > bool pxs_dev_en;
> >
> > struct iio_trigger *drdy_trigger0;
> > - s64 irq_timestamp;
> >
> > /* optimize runtime pm ops - enable/disable device only if needed=
*/
> > bool als_ps_need_en;
> > @@ -416,7 +415,7 @@ static irqreturn_t rpr0521_drdy_irq_handler(int irq=
, void *private)
> > struct iio_dev *indio_dev =3D private;
> > struct rpr0521_data *data =3D iio_priv(indio_dev);
> >
> > - data->irq_timestamp =3D iio_get_time_ns(indio_dev);
> > + iio_trigger_store_time(data->drdy_trigger0);
> > /*
> > * We need to wake the thread to read the interrupt reg. It
> > * is not possible to do that here because regmap_read takes a
> > @@ -446,15 +445,6 @@ static irqreturn_t rpr0521_trigger_consumer_handle=
r(int irq, void *p)
> > struct rpr0521_data *data =3D iio_priv(indio_dev);
> > int err;
> >
> > - /* Use irq timestamp when reasonable. */
> > - if (iio_trigger_using_own(indio_dev) && data->irq_timestamp) {
> > - pf->timestamp =3D data->irq_timestamp;
> > - data->irq_timestamp =3D 0;
> > - }
> > - /* Other chained trigger polls get timestamp only here. */
> > - if (!pf->timestamp)
> > - pf->timestamp =3D iio_get_time_ns(indio_dev);
> > -
> > err =3D regmap_bulk_read(data->regmap, RPR0521_REG_PXS_DATA,
> > data->scan.channels,
> > (3 * 2) + 1); /* 3 * 16-bit + (discarded) int clear reg=
. */
> > @@ -464,7 +454,6 @@ static irqreturn_t rpr0521_trigger_consumer_handler=
(int irq, void *p)
> > else
> > dev_err(&data->client->dev,
> > "Trigger consumer can't read from sensor.\n");
> > - pf->timestamp =3D 0;
> >
> > iio_trigger_notify_done(indio_dev->trig);
> >
> > @@ -867,8 +856,6 @@ static int rpr0521_init(struct rpr0521_data *data)
> > return ret;
> > #endif
> >
> > - data->irq_timestamp =3D 0;
> > -
> > return 0;
> > }
> >
> > @@ -984,6 +971,9 @@ static int rpr0521_probe(struct i2c_client *client)
> > goto err_pm_disable;
> > }
> > data->drdy_trigger0->ops =3D &rpr0521_trigger_ops;
> > + data->drdy_trigger0->early_timestamp =3D true;
> > + data->drdy_trigger0->trig_type =3D IIO_TRIG_TYPE_POLL_NES=
TED;
> > +
> > indio_dev->available_scan_masks =3D rpr0521_available_sca=
n_masks;
> > iio_trigger_set_drvdata(data->drdy_trigger0, indio_dev);
> >
> > @@ -1011,10 +1001,10 @@ static int rpr0521_probe(struct i2c_client *cli=
ent)
> > */
> >
> > /* Trigger consumer setup */
> > - ret =3D devm_iio_triggered_buffer_setup(indio_dev->dev.pa=
rent,
> > + ret =3D devm_iio_triggered_buffer_setup_new(indio_dev->de=
v.parent,
> > indio_dev,
> > - iio_pollfunc_store_time,
> > rpr0521_trigger_consumer_handler,
> > + true,
> > &rpr0521_buffer_setup_ops);
> > if (ret < 0) {
> > dev_err(&client->dev, "iio triggered buffer setup=
failed\n");
> >
>


Return-Path: <linux-kernel+bounces-675594-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0EB3941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:20:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id A545D3B0C70
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:20:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CE9A2874EC;
Fri, 6 Jun 2025 10:20:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="O2TBQgm+"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11])
(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 7E4743234;
Fri, 6 Jun 2025 10:20:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205248; cv=none; b=VRb7yRkASCC2Xws7ep6rAdaRaDpM8CkZWNZkytGAoOvKNug4aaN652170IUudt6ASnQ8eG8BsY9fgn3lhAsOLjqfK5aq6hySjuZkTv3LUA5KE5if6bQ3KWRhTrgjBaR5AFHjrroJG2FCVXfBM4g3pGHAPJpgwqewqLS+GznQU9Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205248; c=relaxed/simple;
bh=epgRitmYmh+pCl0kPJqy/dP9YSMXKOFMFlSBPo7GER4=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=LbyNekxqDFr7TVaMzK7IpAePgfK4olv5+Sai4fFlT+ax3+riwXYyTS7waDpit1GHUyPS9sB3jSypcnC4EZ1bFc7APy2LpE3rev/OScebsA/4wmydGZKnMxGeGCqsQZNKt5tOR1GZ2/gg+jy5ICivPu+eiIxoyCruzugceYEGRtk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=O2TBQgm+; arc=none smtp.client-ip=192.198.163.11
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749205245; x=1780741245;
h=date:from:to:cc:subject:message-id:references:
mime-version:content-transfer-encoding:in-reply-to;
bh=epgRitmYmh+pCl0kPJqy/dP9YSMXKOFMFlSBPo7GER4=;
b=O2TBQgm++oSOCd3h0ujKvAv3X3W9WGXwrkDhNSplE3bSoMHgaO3Kpptu
YhNFodgbszjxVuEZf8PO6GKXO/3TyTICyI8VAdo+q7Ve8ksE/5uQOwD9B
xC047ImBkGQT/QRYFBUg+CaJS3UTCFVdmvtvGyTcR3rgkQPvQ1mhdkRcR
HPmxSOLSRgwRABUJ7ui3mqiRzeUPhxin42uznFlyzj537iJJDX4CxykhA
7ZA2k3WFNo8H9+Fzdm7ILE3sn1YcM4hp1s65C2XJfxeubyhDq5YpAfKbp
j5EHZccL04GwpWJWVCgMM1FsyIAmVHcGLT41RhV26LRuLYllW1NRldn7Q
g==;
X-CSE-ConnectionGUID: cZvd/jjjQW+nzCaRVOY8zg==
X-CSE-MsgGUID: mVNE2ym8RNewz0vJ6MpeKQ==
X-IronPort-AV: E=McAfee;i="6800,10657,11455"; a="61977245"
X-IronPort-AV: E=Sophos;i="6.16,214,1744095600";
d="scan'208";a="61977245"
Received: from fmviesa008.fm.intel.com ([10.60.135.148])
by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 03:20:44 -0700
X-CSE-ConnectionGUID: +svysx1JSoyiYWiXgHUdlQ==
X-CSE-MsgGUID: xJW5mPRoTdOZzOxwMKJj3g==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,214,1744095600";
d="scan'208";a="146140174"
Received: from black.fi.intel.com ([10.237.72.28])
by fmviesa008.fm.intel.com with ESMTP; 06 Jun 2025 03:20:42 -0700
Received: by black.fi.intel.com (Postfix, from userid 1000)
id 2415E1FE; Fri, 06 Jun 2025 13:20:40 +0300 (EEST)
Date: Fri, 6 Jun 2025 13:20:40 +0300
From: "kirill.shutemov@xxxxxxxxxxxxxxx" <kirill.shutemov@xxxxxxxxxxxxxxx>
To: "Huang, Kai" <kai.huang@xxxxxxxxx>
Cc: "Edgecombe, Rick P" <rick.p.edgecombe@xxxxxxxxx>,
"seanjc@xxxxxxxxxx" <seanjc@xxxxxxxxxx>, "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, "bp@xxxxxxxxx" <bp@xxxxxxxxx>,
"dave.hansen@xxxxxxxxxxxxxxx" <dave.hansen@xxxxxxxxxxxxxxx>, "mingo@xxxxxxxxxx" <mingo@xxxxxxxxxx>,
"tglx@xxxxxxxxxxxxx" <tglx@xxxxxxxxxxxxx>, "Zhao, Yan Y" <yan.y.zhao@xxxxxxxxx>,
"pbonzini@xxxxxxxxxx" <pbonzini@xxxxxxxxxx>, "kvm@xxxxxxxxxxxxxxx" <kvm@xxxxxxxxxxxxxxx>,
"Yamahata, Isaku" <isaku.yamahata@xxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,
"linux-coco@xxxxxxxxxxxxxxx" <linux-coco@xxxxxxxxxxxxxxx>
Subject: Re: [RFC, PATCH 08/12] KVM: x86/tdp_mmu: Add phys_prepare() and
phys_cleanup() to kvm_x86_ops
Message-ID: <ukcotpjhkzs7mxrzp7u47skkljlxj26726wlefnq7gau6w6a7t@rzlqtq24jytf>
References: <20250502130828.4071412-1-kirill.shutemov@xxxxxxxxxxxxxxx>
<20250502130828.4071412-9-kirill.shutemov@xxxxxxxxxxxxxxx>
<aBn4pfn4aMXcFHd7@xxxxxxxxxxxxxxxxxxxxxxxxx>
<t2im27kgcfsl2qltxbf3cear35szyoafczgvmmwootxthnbcdp@dasmg4bdfd6i>
<aB1ZplDCPkDCkhQr@xxxxxxxxxxxxxxxxxxxxxxxxx>
<2bi4cz2ulrki62odprol253mhxkvjdu3xtq4p6dbndowsufnmu@7kzlzywmi22s>
<8668efe87d6e538b5a49a3c7508ade612a6d766b.camel@xxxxxxxxx>
<mgu7at7d3qy4h55bchxfmxj6yzqyi7gh4ieds4ecdvlv243frl@bzou376shiak>
<wwftow6boiueqbzrbfpedxs3e3ioelx3aqmsblzal6kxqdt3d5@dljyaozrfiry>
<46e0a089ea78613be5f0287eeca449231731f824.camel@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <46e0a089ea78613be5f0287eeca449231731f824.camel@xxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 10:21:46PM +0000, Huang, Kai wrote:
> On Thu, 2025-06-05 at 16:01 +0300, kirill.shutemov@xxxxxxxxxxxxxxx wrote:
> > On Fri, May 23, 2025 at 03:00:56PM +0300, kirill.shutemov@xxxxxxxxxxxxxxx wrote:
> > > On Wed, May 14, 2025 at 12:00:17AM +0000, Huang, Kai wrote:
> > > > On Mon, 2025-05-12 at 12:55 +0300, Kirill A. Shutemov wrote:
> > > > > On Fri, May 09, 2025 at 09:25:58AM +0800, Yan Zhao wrote:
> > > > > > On Thu, May 08, 2025 at 04:23:56PM +0300, Kirill A. Shutemov wrote:
> > > > > > > On Tue, May 06, 2025 at 07:55:17PM +0800, Yan Zhao wrote:
> > > > > > > > On Fri, May 02, 2025 at 04:08:24PM +0300, Kirill A. Shutemov wrote:
> > > > > > > > > The functions kvm_x86_ops::link_external_spt() and
> > > > > > > > > kvm_x86_ops::set_external_spte() are used to assign new memory to a VM.
> > > > > > > > > When using TDX with Dynamic PAMT enabled, the assigned memory must be
> > > > > > > > > covered by PAMT.
> > > > > > > > >
> > > > > > > > > The new function kvm_x86_ops::phys_prepare() is called before
> > > > > > > > > link_external_spt() and set_external_spte() to ensure that the memory is
> > > > > > > > > ready to be assigned to the virtual machine. In the case of TDX, it
> > > > > > > > > makes sure that the memory is covered by PAMT.
> > > > > > > > >
> > > > > > > > > kvm_x86_ops::phys_prepare() is called in a context where struct kvm_vcpu
> > > > > > > > > is available, allowing the implementation to allocate memory from a
> > > > > > > > > per-VCPU pool.
> > > > > > > > >
> > > > > > > > Why not invoke phys_prepare() and phys_cleanup() in set_external_spte_present()?
> > > > > > > > Or in tdx_sept_set_private_spte()/tdx_sept_link_private_spt()?
> > > > > > >
> > > > > > > Because the memory pool we allocated from is per-vcpu and we lost access
> > > > > > > to vcpu by then. And not all callers provide vcpu.
> > > > > > Maybe we can get vcpu via kvm_get_running_vcpu(), as in [1].
> > > > > > Then for callers not providing vcpu (where vcpu is NULL), we can use per-KVM
> > > > > > cache?
> > > > >
> > > > > Hm. I was not aware of kvm_get_running_vcpu(). Will play with it, thanks.
> > > >
> > > > I am not sure why per-vcpu cache matters.
> > > >
> > > > For non-leaf SEPT pages, AFAICT the "vcpu->arch.mmu_external_spt_cache" is just
> > > > an empty cache, and eventually __get_free_page() is used to allocate in:
> > > >
> > > > sp->external_spt = 
> > > > kvm_mmu_memory_cache_alloc(&vcpu->arch.mmu_external_spt_cache);
> > > >
> > > > So why not we actually create a kmem_cache for it with an actual 'ctor', and we
> > > > can call tdx_alloc_page() in that. This makes sure when the "external_spt" is
> > > > allocated, the underneath PAMT entry is there.
> > >
> > > I looked closer to this and while it is good idea, but ctor in kmem_cache
> > > cannot fail which makes this approach not viable.
> > >
> > > I guess we can a constructor directly into struct kvm_mmu_memory_cache.
> > > Let me play with this.
> >
> > I failed to make it work.
> >
> > We need to have destructor paired with the constructor that would do
> > PAMT-aware freeing. And redirect all free paths to it. It requires
> > substantial rework. I don't think it worth the effort.
> >
> > Will do manual PAMT management for SPT in TDX code.
>
> Thanks for the effort.
>
> Maybe something below?

With help of kvm_get_running_vcpu(), I localized these manipulations to
the internals of TDX code. No need to leak this to TDP.

phys_prepare/cleanup() is gone now.

https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git/commit/?h=tdx/dpamt-huge&id=72394699b5454aac6c027accab6d94a52d88819b

--
Kiryl Shutsemau / Kirill A. Shutemov


Return-Path: <linux-kernel+bounces-675595-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 59AB241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:21:12 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id EB075177C5D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:21:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 462D62874FA;
Fri, 6 Jun 2025 10:21:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HGsNv4cu"
Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B272F3234;
Fri, 6 Jun 2025 10:21:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205266; cv=none; b=Sgkg5cUFFCWrrsC0ePxZqGZvNuGBdghIai7AfTqgo5bZzFsiV5GaooU9Nc401rSIviUMnq2oF4/2rCr60vYmRuXwz05Qqv+w1V2nC5ABVeD5EfEF55dEyvDNJBHo227Lk3gCci+5a04xIwdne4Ax3kGtFXchau9qU0fKWFPEjks=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205266; c=relaxed/simple;
bh=RYf1MBF85kqiyEh6o51lvUtQzZdCLOMiZPIb6M9TABA=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qReRdw0RnsqsZ6KldT1bXYjzBYsLOmE0YIROEJXjlOcI7OlaOT6iJlP/+O3MvcJkIUvdf4o0TZa/na9z30e12lQ7CulRDfIaUTp9AbJMLIfzhHUAn7o36U6eiswxXjKDGQCpvzVW9hnrQCWX7hXuqeC49KSe/PktXskig1ZgAcA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HGsNv4cu; arc=none smtp.client-ip=209.85.208.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-606b6dbe316so3596423a12.3;
Fri, 06 Jun 2025 03:21:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749205263; x=1749810063; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=MiiOBFHtT5ZtQA/f0RodEb62SyXtn3/Wda9R6Uedtxg=;
b=HGsNv4cuy4slWAFFNRswX5oa46IVYHmJ5lWJ9Y+l2b77OHVtwoF4odq33j3h/NXNE+
Xe89vtnGP6oJ70s4K3n34xzT7qy7+hyg1+CAt8BoTmGaB1cxEpVGWTGgbrVu4B+APF7Z
R0QyWxWHfPT+VPAQfjPu6gJxHuf5XGZZ43l+qlb2WJvPA4YCsAh2TjqaM7r7hJ5Stw+x
rJMK1x9vI0juuBmD2NpdjIiBXpu+m7/qJDaf3FoRRrJzz/axO+Ae7ZDc6KS9vt/G1Ft2
3a5m87iNg+CUUHF5tiNNdhQRyBSfNPbDPOdixRIOr+eut/PFR3SmEGx0itfD1VF+bDKw
lJww==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205263; x=1749810063;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=MiiOBFHtT5ZtQA/f0RodEb62SyXtn3/Wda9R6Uedtxg=;
b=ep6Maz8A8C8PKWU2HJxmPOTLlcwKa10+XqrJex/oUa09aJYV/KajboJMNyX99Q6eza
fr7zrqC6x9Dgk9Tu65MLdDnJ4mqPCh7Bc5lG5uW5QpehorvvNBD4JmItr6GbHfahzKOj
z1F0indidQrF1Mdwn1vBMeprKveGlem4h+y5oz1ncm27lBjdUmqb+a3VRYoL/Fpp6B33
qdbgQ5z/w2IsE2kn3tmTRmf5yHLePA2J9KsvlVQXDr47tdXdRXI2YrbLYgYtFV5fihnH
Ofj0jKVIBdm3NZIG/picKJBxiksLGkB6uAgyr7py6IGAFHC9KIaawDBJ12LtNpQxP1Fc
dCJQ==
X-Forwarded-Encrypted: i=1; AJvYcCXG+ITMQjvMgQSeOk906vra+0uOrlR3PajHwVgStA6rGBh3WcTIgGzYRxtIrEqjIaLD5v3ko3UZQLzIF3M=@vger.kernel.org, AJvYcCXVBug28ZHilqyjodO0rTsL9u4/QoARhhsIMh/CFOjCIHKQD2mOUm1dt4hCi4G3HJ3zFXRwG/M/@vger.kernel.org
X-Gm-Message-State: AOJu0YxkrEoTEbzL1umdIokwNO/qYBGx5gGuERwo6fSb7BeW8czU7qlQ
uSyV91O7amzPPfT4cOA5AQxQVXhER/Nwgyg/pVSElQG+jCp0GfQesoD0
X-Gm-Gg: ASbGncu7q0TuQDab95EfE7H78UxyK3hJZ75oN6PuECpBXYpnzyxU71ZllaEZmSM6qLb
O0qgDFoCYXIzaMtZeo2QOC90pqBPRVlhrbJYiGYxv+zcKqXURJiVTzAw68i2quufv5JuVgn6lJ8
Y2/D6zj5G4KHNvcHtZpyJ+w8AU/eZ1ag64ixqsskFUNfe5NHF0pENHi2HP1X4WyWNwWr2Mg89Qv
WYw1EXDOpXxiy7p16syrgswRE7NG9IOXpAbloJDSON8rsYfoSwc1Ac88jttuBgxKddMMX7x5ND8
NmsZTnOWCjkr0olG/P1xkyxBEyBL+/Xpu+69D/J2do3MHKWnf4l+ompKCJb9L0h9KBQPlWQSHLc
=
X-Google-Smtp-Source: AGHT+IEhapm1K8w4bky257wfwPuqvgCoQuQfxgO95l+/hUIeSvoPyiy84rQ6sHS7x6VE6POMwqilxg==
X-Received: by 2002:a05:6402:1d4b:b0:606:f836:c666 with SMTP id 4fb4d7f45d1cf-60774a856bemr2463366a12.30.1749205262677;
Fri, 06 Jun 2025 03:21:02 -0700 (PDT)
Received: from archlinux.ad.harman.com ([212.133.80.198])
by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-607783dd3c5sm809256a12.57.2025.06.06.03.21.01
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:21:02 -0700 (PDT)
From: Bartlomiej Dziag <bartlomiejdziag@xxxxxxxxx>
To:
Cc: bartlomiejdziag@xxxxxxxxx,
Andrew Lunn <andrew+netdev@xxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>,
Paolo Abeni <pabeni@xxxxxxxxxx>,
Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>,
Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>,
Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>,
Daniel Machon <daniel.machon@xxxxxxxxxxxxx>,
Wojciech Drewek <wojciech.drewek@xxxxxxxxx>,
Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>,
=?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@xxxxxxxxxxx>,
netdev@xxxxxxxxxxxxxxx,
linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] net: stmmac: Change the busy-wait loops timing
Date: Fri, 6 Jun 2025 12:19:49 +0200
Message-ID: <20250606102100.12576-1-bartlomiejdziag@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

After writing a new value to the PTP_TAR or PTP_STSUR registers,
the driver waits for the addend/adjust operations to complete.
Sometimes, the first check operation fails, resulting in
a 10 milliseconds busy-loop before performing the next check.
Since updating the registers takes much less than 10 milliseconds,
the kernel gets stuck unnecessarily. This may increase the CPU usage.
Fix that with changing the busy-loop interval to 5 microseconds.
The registers will be checked more often.

Signed-off-by: Bartlomiej Dziag <bartlomiejdziag@xxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
index e2840fa241f2..f8e1278a1837 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
@@ -144,11 +144,11 @@ static int config_addend(void __iomem *ioaddr, u32 addend)
writel(value, ioaddr + PTP_TCR);

/* wait for present addend update to complete */
- limit = 10;
+ limit = 10000;
while (limit--) {
if (!(readl(ioaddr + PTP_TCR) & PTP_TCR_TSADDREG))
break;
- mdelay(10);
+ udelay(5);
}
if (limit < 0)
return -EBUSY;
@@ -187,11 +187,11 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec,
writel(value, ioaddr + PTP_TCR);

/* wait for present system time adjust/update to complete */
- limit = 10;
+ limit = 10000;
while (limit--) {
if (!(readl(ioaddr + PTP_TCR) & PTP_TCR_TSUPDT))
break;
- mdelay(10);
+ udelay(5);
}
if (limit < 0)
return -EBUSY;
--
2.49.0



Return-Path: <linux-kernel+bounces-675596-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6452041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:24:20 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 56AE67A4D5D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:22:59 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A45902874E7;
Fri, 6 Jun 2025 10:24:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Jt4FuuF5";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="tHM4xvs/"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 0170E286880;
Fri, 6 Jun 2025 10:24:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205449; cv=fail; b=m+knZs9OJLRcevf0FKPHY/Jk1HUxOrJBRpfG8zs4t+uc2g78SNR0dbjcGXiI1flvTyJaU9eJAcV8HpenPnXzq4O+vhcskh3M3ecTWnGPMOtDTqUaef37NP7Fk1k82Sjc/hDxG54fcnMkKe78pPsn0Xhy1+ql9k3uw1G9hVu//+U=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205449; c=relaxed/simple;
bh=+qDfhF2NZGQnv85s+FwLr1Hmxv0E35Isy8Xv5jhCTsk=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=oBSb5rfm6vx4oX8il9CAyUzVLg6IKmnNuuqe66J37fDQTjzQQrudTjGi2NR95PiXAw8z/I4vfeyo78MHmXp92EBMhLeUHowbIIMKVqnZvnmQZCogoXLjH51ZnpyFSXBDso9QNBSJmMlCXSjSkwHt4kWEw6qGUq1GOZudQRjJBlo=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Jt4FuuF5; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=tHM4xvs/; arc=fail smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246632.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NHON012606;
Fri, 6 Jun 2025 10:23:53 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=d2aXMs0+HrgnmkaJj8
8As2h+E2XzCKwrihwAloMNtdk=; b=Jt4FuuF5il3IO8ZslABMRHkoE0BDtNHFbF
nvu1IdKiKLNIGn/A6zwk/p6neH1JisFzuihXsovnGnMUBTfSv0/gD1IZCTC0Q4My
Rv6GM1YennKni8yIrpY63+aRx81B8WdqkjWCiDT65/lh6kS35kpTNw1Gh6+Zjr5O
T12zxFzpt2kNpDctAjYG8/GGk01pg1vfsAVsOSlC2bBzeMfRYHjzDKHgNu2RlUjy
XcMa2d5JvJJPoh0eiGoueEp8w1/KZSd23qI8G2DljQwoaCBWSut9DFfFCS5VVpHp
A/Lr/1c69cG4DQTF/aItv6HVbAkb24PhslYZfTHoafF2+p2Spohg==
Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8j7tr9-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:23:53 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5569KFmi040645;
Fri, 6 Jun 2025 10:23:52 GMT
Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11on2040.outbound.protection.outlook.com [40.107.223.40])
by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7dcb47-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:23:52 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=JOWz7hc7kjmWjZRACeJjP5czyJWwrR4W/fEqvd4PzupCbrJ7iH4zHJeWmBjQjnuh0RmE4C8PTsNJn53C+nzYnW+EgUuAzaCZ1UfHPmEkabDiKRZ0Z4c0OWiVSAsRAfgXEYhdcxdQ6yeBe7pyW+iovMZ+07d3NC/pngDd2ptfRpHjX8FB5AcoQpTQ6NcCbJl4KEu2VyYRz2m+3GJhftFi1w5NIEZTUa01QCtiGLNFANuzUQPDBTL9ceQdyop02oHJeKSFDFC5FGRzXkno7D04xYTWe40uTR/zFbXPo8+imixxRXRejJUE3kJGD2mifffdUw/JWuNuhbrNYcfH05uXcg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=d2aXMs0+HrgnmkaJj88As2h+E2XzCKwrihwAloMNtdk=;
b=xreYA0onXUSMupph3SWxkCV9AioqnTytCdDnIBzJxkvgclVtqePpAba7yoIaTYHk/JJKyH3CkurE3stkwoaKJnyc9IaIC0a0ryTaWW4W7w4z31g5+j8U7ioHCNSbkDnuO/yMTE4hgNt7HPTiFIeQVx0PyYK9Gio0Uhzj3L3jnBbv6WAdnfz6MJwFOghSNXMgRt9julQYNTAkyq8wy71r65TC1kEV8L465xbsfid8wrx1aXAjS/0P2OfrH+NDu9mC75invahO2oUaPXlVCG6VEaVx0Ve31Dm9FNi6FOl63V8x8bHKB0YpQwBtknSaN0Y5C2czkbqXLOuC1V/oUsbIvw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=d2aXMs0+HrgnmkaJj88As2h+E2XzCKwrihwAloMNtdk=;
b=tHM4xvs/eA+I8bJYblTFZr011/AEHeVQIci0wzaWJyZoQj5+i3q14joX+0weYJKA/Zh/i/CCYdlEluXZZxmYWWkGHXUio9xrPaOcn6QzJ7KAmPibOmnMYtTBv1sGNCCOqqKaNhaV2KMOkG8T9BaaL9NKet6CB5eOS65wfroN0Y0=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by IA1PR10MB7336.namprd10.prod.outlook.com (2603:10b6:208:3ff::15) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.40; Fri, 6 Jun
2025 10:23:50 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
10:23:50 +0000
Date: Fri, 6 Jun 2025 11:23:47 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Mark Brown <broonie@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Shuah Khan <shuah@xxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kselftest@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] selftests/mm: Skip failed memfd setups in gup_longterm
Message-ID: <f484337b-3f86-402d-93b1-e451ef596520@lucifer.local>
References: <20250605-selftest-mm-gup-longterm-tweaks-v1-1-2fae34b05958@xxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250605-selftest-mm-gup-longterm-tweaks-v1-1-2fae34b05958@xxxxxxxxxx>
X-ClientProxiedBy: LO6P265CA0021.GBRP265.PROD.OUTLOOK.COM
(2603:10a6:600:2ff::14) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|IA1PR10MB7336:EE_
X-MS-Office365-Filtering-Correlation-Id: 0601926b-cbbe-40d7-0bf6-08dda4e43ab3
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024|7053199007;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?KtRpllf8SBMgNWOSPeQDYh9pPII6ifxMAaozEDkQE8xWzMEgcvPmZ3q/3gt/?=
=?us-ascii?Q?nRJLsStzvvA10z5XY/d9CZtt5RLDFCCwizfSHgKmiLIu62JCSgDJjqXwtY9Q?=
=?us-ascii?Q?JjQL8c/QTKLmKVN46MmMsCFIFAoAPmSZYCk8QtfqP7d/P01Bupy+R9ESyH9y?=
=?us-ascii?Q?cot4r6eqktsK2I+PnZ4qztHLsqd9gvHq5pzJaaQ2XcethBaSs4QbXv8FUdqh?=
=?us-ascii?Q?mq7VcmGvpmRIdm8OaRZXU+hmsdlL4HnElingbo0hsojscAnK/czWvWbkIpI/?=
=?us-ascii?Q?oOtQBoMDOt+ckneJqtZ93wCxs+wHA0ld1PjTnmoaFz/US+lXo/YgiKXY9AwA?=
=?us-ascii?Q?gaXO9GXcDuLeBul9FGj+gBi2eNeoxnBjP9TXm6n8z/9wv99SBGp1AS+hSW1K?=
=?us-ascii?Q?aV22HbJbe9wuGIVcN+/09nIe96aLjqiKWRBusL3vm08VM5Sdz2x2x8tqnet6?=
=?us-ascii?Q?aGJwM/ov2KsQ/PhBtugl4wNRsbLkHvM+fp9ulJ3febeaUIKyfGdynV8j0N75?=
=?us-ascii?Q?9tEL9uO29xu8PA3FtxBMj5mkiAt3ZHa/1Z8rH1ty+vywScFoaQYfbsXH4vOd?=
=?us-ascii?Q?6M/QBn2m6AVWvumj0m9ct7vNWUw0VVSzRRus6AljkwtyW+W8p/PelCs249sO?=
=?us-ascii?Q?s+ic8OTKhZpV7zwflcTz2Zao1ELxZe0koQkdaD4Trem0Pxfb8W8Tp+txsBwx?=
=?us-ascii?Q?vXAyqY3rblInHo/GPI9Re1huYBnR98L97tF9UhNZ3EQQvxbTl07ukYIjbgaq?=
=?us-ascii?Q?o4ApCpQq+LULLvWeDtE66WKMWuDvNCwgTLdNw/AT8eJEyqgS1YXpuvORCgjn?=
=?us-ascii?Q?0y3nS0bVB9pL0N3QCXIYsFk48AREcMcJfycORDUi3p1CHOUuk41Mdd5cBchq?=
=?us-ascii?Q?tgxJ/XVxl/kDYDWQRanAlpBONMeOnmdPr2IrEGMcPUAdBqoXT5Ur/HnbmGxd?=
=?us-ascii?Q?Me5zA7UDmlUVOCbjtsQlTm/1bB8j9JLYSFn56nTw5oODMGdC9e8sTiWLeT6Z?=
=?us-ascii?Q?wYUmSQWbGs2c63uJO4wRxVBewsu2LEEzkqgYpRrUCEae6Oq4J0ay9NCKzpvC?=
=?us-ascii?Q?WB2IObbmxGFsAxKcNEXJsf9pHtDdT+Jnah9lIVv2EJHQOod6/mDkVIiVwCv1?=
=?us-ascii?Q?2GpxII7mtfJsdhmSFubrBAb5kEorS+EKs1epZVX+47PI6ejciN8d1SdfmLkT?=
=?us-ascii?Q?tHZfWRN/DNukp61msBsZlpwiSqI/CWQtzt+OztURWMKYSpjYPOlxBxy298z4?=
=?us-ascii?Q?AC0KDT1lZ3fChHakV1aKT205fPVHohdjpFvpOQtQ3eeY6EY9vVeFLa9MxHOQ?=
=?us-ascii?Q?F7Mf4Sx2za2h5reUKYXLtTjiqU9FVIFb1bwp3qgIUCzZ/8hDGID6myawG2r3?=
=?us-ascii?Q?iqGzZB3l7nCLKcWd1ne4jGqqYR7XxGEAmxFYEsCVzVOg+Q3bK6hiCSyApoSC?=
=?us-ascii?Q?F3JQDJyGY6Q=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024)(7053199007);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?OU0et/Vyn36kXyF/8q9ChN9VawEqhS8yaAwrpEQ15zU4WS5NIZFqjd5XAXRl?=
=?us-ascii?Q?aWH3DsJrWh/PBXLFby128ZoWPNBeWYalSpu6bqw5vIt2zqKeYiuOtKPNablk?=
=?us-ascii?Q?flT06yu4kX5yvhFR0sTh/I7lJNbKYQbd/InIgY03NCvkMJBmVfllXUckDsdQ?=
=?us-ascii?Q?jgg2rKWV/eYRDi0rCJ+PcCLQ0I2xIx0gBmADgnwgFvJiyiKrDjoBNf/lsgqy?=
=?us-ascii?Q?0AHOK8CKsR35+ehNECfawdtSqmziSFIzw6xovZ1Umy+dezN6murA1J2tGS0A?=
=?us-ascii?Q?j4fDKGQPAd7FSqJn6UwX+EbYE41OrihHTpsP9/2e2ZSOlW/vBCPLyeBzhjDd?=
=?us-ascii?Q?PwvuAgvO9RlEqwP/Jrm8W/cltREdjNIIM/2QDMa1drGNbTSkUo5r6SxbD67h?=
=?us-ascii?Q?MsULvTQawuFZCbkE8f82toeaPEZLrVD2x4kChqeYfQS94A2QGXIwpTwoxfU+?=
=?us-ascii?Q?cDSWd1NBE3Ed/bVYAIyKfHQpElkQCVloD10ZdP8T0GRJYXRRZAr2NIiSGmXE?=
=?us-ascii?Q?Gs7pVlUbpsTdbe6R6fIT+U5svwqRwfG7mdqNuxm5Er7xbrm7vHsUgiXPKOdh?=
=?us-ascii?Q?Pnfu1PFXTWHkpJR1964qYXNWewCjdkylM1LrByvz3QD4E5FUQH7iXZNHt0hf?=
=?us-ascii?Q?+CdMSOxKL79HFAQ7GtDnj/8bjdQxGy3Iv0AFsvvB8nD8T+ZRW8QMhXjCKefX?=
=?us-ascii?Q?h5ikYU5HUYcW7eGIc4yB2HAs6F08ZwDzYGvitoIY2UhnCTMcbyP7Ul2v9B9U?=
=?us-ascii?Q?wWcde/zcbP3HqAsebGlw/NNQsbIHsQTNxAVk3wHTyeRKz2J1bOT/clJP38Ge?=
=?us-ascii?Q?Ar4pn+LQOwcCgBQQ522vDv2bhK77qtl3VD4cnzH2b8bAeq7LTQRTZDAvAwN6?=
=?us-ascii?Q?KGKi7x3O878/HCLn4JarjgkVZdQgA5tiqtOKVLbgQIcUypAODpzakGf1xz1f?=
=?us-ascii?Q?2wM8tAq9rXDlW2GeiCfuz8sGqP53wzerhh/0lzHoFnbbaJqIEWgr4ODxWXzR?=
=?us-ascii?Q?MndfePdJ8SkQEVlkkzpSY3bnGrm/ccmpWCUCfKy50kyR8EeQEARaaya3iZBR?=
=?us-ascii?Q?W3JWYSfqweWn8WbV1RUaTBUhMxL4xZ59oJSF2uqT9gnigFgbF+8C4slaa6PG?=
=?us-ascii?Q?6DqAM43jY4im63CST0EP4/vfLozxViyRwNrlqejMUmN0dq8yr23Z5QGONLzD?=
=?us-ascii?Q?tPeYpsY4gbOow/R10AWEm+cUo5x6AAvFtdfB0J3n/iszUnuWIVs18Ws5HdkF?=
=?us-ascii?Q?fp7J4x92YvEg28QJuoCSPKYRmIZkU0DW8+8wVfUEXEgEybFiI79/9wLOOvFp?=
=?us-ascii?Q?Y6ZVSN1fOc5MiAMc23BQY0LsDtePyTQb/HcVXtYqVUfJr5b78m/RSLvgYA76?=
=?us-ascii?Q?+FCFLnmUMvd5Fi8wbpmZptZXl5AxLjhmNy+WzYzDuXW74WFwp8CcSXHX6SBx?=
=?us-ascii?Q?o7BdtEVAENnHybW8IqJbzil7CVGvPmZF3U5wCZQNIw7LgVOvLdlo5dkIXoW1?=
=?us-ascii?Q?i3eZZYZCpvZqUylh0tDz8pJ5wD0hy/pcjRq9vidElQ+S3yLeL+OL5YAE7jOI?=
=?us-ascii?Q?/jILg22FTZwmUQllfB8dedJFebvN+7c0ubs3oFel4tJ3zXHtmdNQ8yPo056n?=
=?us-ascii?Q?Xg=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
cAKMjM9hnBosEmRy/QVH/PhBWejtftcDOTzmzj+I3XaB6Ervp01guR0xm/5c1eoXBpDkAZkI2RjM9m0vRpY1JuaOUbnEZefl5ln+73xcdXlBoHsF0BVMCuduiNvKLKYB//H+S0v9fTJbXdB3XZYZgM0XplchKv9QnNeGnWzLyYu3gAmuPoYEUOfYJu/t70DhNTgdIW0CENiYKOPB2SzED2rq+XxvGmJH6OzRYT9xQPbHiF4BKJ+2sP+lQDcojJr8LhNL7eqYOin2kIAcQ93p0Fagmz9Wx5Xkqu+igDEcUQ1kXFS/jgX/opgyffcdm9P7tI7YrMQPW5HjzC755n8xacd/9tGSI49PzMrsOdxb4fz9YihbUoIoeVJVygZYFwm+iofrOGAN1bv/iKbySO9UYI0MUrKO/XwebYDuiRCMW0Amx7VWyxuOwZX+6wVAj0cbqapVtSqYgy6MSG3+1iR3Z8FqDsJ+p97lszsqrIN25qpWZ8WQDzsNA36X35aFbzz2JhzCpOJGkN3wLyILb2LHZnUT9LSpHACMkqE+Vem617BFWH7kuooOTaiYNfaQXgHZBp2U2tD98bjJPox4K7KH1yaB91LkbfRlocC3UqKW9mk=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 0601926b-cbbe-40d7-0bf6-08dda4e43ab3
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:23:50.1975
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: UdcHUVfQguSIOajo+We+i6moARe29JlWhEsTJcyw5+FBNs8RFEw7XKfcjaJldRzIGNafYoMO3opq4DO//ZhaXEv/ipfKj6RH7PClCx5vdR4=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB7336
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 malwarescore=0
phishscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060095
X-Proofpoint-GUID: 82dgC6lnjtKkNGoJjGfuQB9F5G-2T_p1
X-Proofpoint-ORIG-GUID: 82dgC6lnjtKkNGoJjGfuQB9F5G-2T_p1
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5NSBTYWx0ZWRfX26vYb9iAUidM tT+OE0su1YgaIf2D7R7YLWCiZj2IvAQ4kQoWrvYE49MWiGbGrLtRPizvrGm/lg4xecyESwWQCdA d9/F5h8vANW956xxlYyKry+MUbOtTi3LOda0dQ0nLapQkAG4lnDYuMIX0te6AEAtyTpfNIPeEdQ
wAxT5oANFvP8In43C+UToDJBGioB7D4BpbAucI1bCjzYevnD1/8NZcskA0fFsWuUYMKj6nVZhQJ /0bK2xR+tyZXfAk4seeR623Ziq47NttkyBvrRUK61Jt5H6nAWa10Uy9yD2SY9hUC3JsIsxd9Eb1 Id0uKAPEGvQwaNHTdw+1RcnezJkUPTo5n5e/jHmnd4vctSzbzR+vyeNjB5CQAiVDi4idhJIxNHB
WCUepYol0ePmw3w0aoO5Pjx07zYctW4ZCEVacj/mgM9n2Ecu9fcThJPf8If2RurUVrRufd6u
X-Authority-Analysis: v=2.4 cv=QI1oRhLL c=1 sm=1 tr=0 ts=6842c1b9 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=VwQbUJbxAAAA:8 a=yPCof4ZbAAAA:8 a=ZiO-fQl754xuO2oiRLUA:9 a=CjuIK1q_8ugA:10 cc=ntf awl=host:13206
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 10:34:31PM +0100, Mark Brown wrote:
> Unlike the other cases gup_longterm's memfd tests previously skipped the
> test when failing to set up the file descriptor to test, restore this
> behaviour.
>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>

Thanks, LGTM. I tested locally and this resolves the issue, appreciate it!

Feel free to add:

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Tested-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>

> ---
> tools/testing/selftests/mm/gup_longterm.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/gup_longterm.c b/tools/testing/selftests/mm/gup_longterm.c
> index 8a97ac5176a4..29047d2e0c49 100644
> --- a/tools/testing/selftests/mm/gup_longterm.c
> +++ b/tools/testing/selftests/mm/gup_longterm.c
> @@ -298,8 +298,11 @@ static void run_with_memfd(test_fn fn, const char *desc)
> log_test_start("%s ... with memfd", desc);
>
> fd = memfd_create("test", 0);
> - if (fd < 0)
> + if (fd < 0) {
> ksft_print_msg("memfd_create() failed (%s)\n", strerror(errno));
> + log_test_result(KSFT_SKIP);
> + return;
> + }
>
> fn(fd, pagesize);
> close(fd);
> @@ -366,6 +369,8 @@ static void run_with_memfd_hugetlb(test_fn fn, const char *desc,
> fd = memfd_create("test", flags);
> if (fd < 0) {
> ksft_print_msg("memfd_create() failed (%s)\n", strerror(errno));
> + log_test_result(KSFT_SKIP);
> + return;
> }
>
> fn(fd, hugetlbsize);
>
> ---
> base-commit: ec7714e4947909190ffb3041a03311a975350fe0
> change-id: 20250603-selftest-mm-gup-longterm-tweaks-e685a8ae9751
>
> Best regards,
> --
> Mark Brown <broonie@xxxxxxxxxx>
>


Return-Path: <linux-kernel+bounces-675597-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D799141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:27:39 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id EF0BE17274B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:27:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C3CFF2874E5;
Fri, 6 Jun 2025 10:27:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hFPQkX3c"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 94970286429
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:27:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205652; cv=none; b=qt7+45TrqFLCaICZ91vPf0LXpMfEV4Q+2ySujhBEC87pHC/mz9rFi32FYALjIMxI406osiKwScIjIB6YL6Nmdb5AKd+JH285/xVJ9m/SDrLzgGyMkLKozHsPhCtGvZ0qXVThl/1yv37NwyMfnyi5eMr24XOzsZ/xHh2H38ylZIs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205652; c=relaxed/simple;
bh=c0gmJhz6Vo5J5fS8JVlxk3484ukkLDXwOpoG2XbOVHo=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=STe8NBbYysZsIvUjFZHBtJHl2SAWFX/OSltsG/vCj7eK80TpdvFG5R1I0mnzufGQHt5kZKaPz7hMSIYRUXFedA5Y44ib6FdYSDUTcEw5g6nCQeBAwBbicBVGS5cRvdihsaWZX3Q2Hke0pv8uNxgh4xaBRmMTjjrW5taerGveR7o=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hFPQkX3c; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749205649;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=B2FoVaJKHKmklTyZk1cv0vTh0MbuFjlj3z+B0k4EatA=;
b=hFPQkX3cTzW0cQBkv266xz0If5p0dPIX7ejyKoYqEJ7Y0fIawveBOnk9bnMldnPuADJnGs
iulxsIgl6XDv/5TNl0Y8hTXFF9LDE+dqXsd+H6l4QpnvAV2GU0EhAnRHbLfSZFjOKQnMUj
pFc0n9niaXAO7CUPDX2UUpG6rqdoMFo=
Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com
[209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-696-1qah_E5QMFSi9VcbT8TZLQ-1; Fri, 06 Jun 2025 06:27:28 -0400
X-MC-Unique: 1qah_E5QMFSi9VcbT8TZLQ-1
X-Mimecast-MFC-AGG-ID: 1qah_E5QMFSi9VcbT8TZLQ_1749205647
Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-450db029f2aso9725535e9.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:27:28 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205647; x=1749810447;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=B2FoVaJKHKmklTyZk1cv0vTh0MbuFjlj3z+B0k4EatA=;
b=GgcagfzxLv39hcJqg2y/EYQx3Lm9eEMgLIdQFNuG0ZQoH+9uRUAuGsBTlwOuUmVVYR
rL//JaK/6VXjFPZiShQJAfjyN160Eycn5uIWLNmDL9TRsBuTzXBRepJzNOf7uDbdg1sm
qOkG/jiUfHGrn4l5CKLEzMRIDnADG7/9XX+fW3A1qgpni1chYg+RjP44IQT9ghAg4sXQ
RRfZH7/UOWfbrljz+ydrCanNPEY9y8xYf1L+lEiKWTFZY8o8VQJjTYsvooYAz6zcFShd
isMNg5D2jWCwdjcJ/KnXsIqz5N0k6jP5M7j1gXCKdlMQMdqaHICrztHUbY5l+Z9UWmIl
6r4w==
X-Gm-Message-State: AOJu0YzFtQP7xy+OLg/aE8OB/8w2guzc4SeymWT0rmi+tFCnYz1RqUuE
JXUriwwGj7EJODydIdoqqBgZtnIZVHQfhaW7sGAckvpC/r23Ytv4W3dum/ivUCzZ+n4XKVNCYBW
emHsKkmmcqpnuvxfEeUaWEwA+g+nfq3PXAa03lqy7ExPGMskTE48SHdTfeM6uMAPT7Q==
X-Gm-Gg: ASbGnct4tnumN8mQXqXV/DqD7yXpQPytrxE1sRtcbiy7QMuTO1Sor6fMOHkpK4Tm6N7
TiYfH+w7PCkcJxIipJuAay17Pt0NjTLLg1NFMkSzJIqDoaEMSAd0dco1rpPsE/xPOckI40rGpLf
M6ZuIfNg6zgkZcgHYXOuDxGmaeggS0yCjAabYtw5rh7hwpaFzr+V5pzKvEk+9zFtDYNhF3s1zSC
WNTiwSRnOGMs7fDwjg/wtFaoAowsphnFFwBkBjB9hPKFXTQxLZZxtuoM3uRGX6btiylCxVfGPkr
Dh2C0dwMkrVRXyphXnP/JxS9IuczfVBB3l20a89WPMa4IDZuy7wZ19AauMo70uF5JNOpNoWTfLb
pGgIoIyx7NFb7VdqiVhJW9L4S2wb9XAs=
X-Received: by 2002:a05:600c:c163:b0:43c:fd27:a216 with SMTP id 5b1f17b1804b1-452fa7ed515mr10712215e9.23.1749205646954;
Fri, 06 Jun 2025 03:27:26 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHEmbcYjLTgLVCUtyFzzP95tBUCDltp5qdbSNrDM3KqC5dmjOdzJWRJz8svdB+Fvl+EBl5V/w==
X-Received: by 2002:a05:600c:c163:b0:43c:fd27:a216 with SMTP id 5b1f17b1804b1-452fa7ed515mr10711905e9.23.1749205646496;
Fri, 06 Jun 2025 03:27:26 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-452730b9b3esm16346055e9.25.2025.06.06.03.27.25
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 03:27:26 -0700 (PDT)
Message-ID: <03fa1946-e02f-4bd5-96bd-e8a2f77c0807@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:27:25 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
To: Michal Hocko <mhocko@xxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>, Vlastimil Babka
<vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>,
John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <aEK_R93gihEn-xW6@tiehlicka>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 12:13, Michal Hocko wrote:
> On Fri 06-06-25 11:01:18, David Hildenbrand wrote:
>> On 06.06.25 10:31, Michal Hocko wrote:
> [...]
>>> Turning them into VM_WARN_ON
>>> should be reasonably safe as they are not enabled in production
>>> environment anyway so we cannot really rely on those. Having them in
>>> WARN form would be still useful for debugging and those that really need
>>> a crash dump while debugging can achieve the same result.
>>
>> One question is if we should be VM_WARN_ON vs. VM_WARN_ON_ONCE ...
>
> *WARN_ONCE ha a very limited use from code paths which are generally
> shared by many callers. You just see one and then nothing. Some time ago
> we have discussed an option to have _ONCE per call trace but I haven't
> see any follow up.

While true, getting a flood of the same events is absolutely not helpful
in my experience.

Usually one cares about a single instance of any events, even if
triggered by various code paths.

Sure, there are some other cases ... which brings me back of my original
point of doing it stepwise.

>
> Anyway starting without _ONCE seems like safer option because we are not
> losing potentially useful debugging information. Afterall this is
> debugging only thing. But no strong position on my side.

Yeah.

>
>> VM_BUG_ON is essentially a "once" thing so far, but then, we don't continue
>> ... so probably most should be _ONCE.
>>
>>>
>>> So while I agree that many of them could be dropped or made more clear
>>> those could be dealt with after a mass move. An advantage of this would
>>> be that we can drop VM_BUG_ON* and stop new instances from being added.
>>
>> As a first step we could probably just #define them to go to the
>> VM_WARN_ON_* variants and see what happens.
>
> You meand VM_BUG_ON expand to VM_WARN_ON by default?

That's one approach with little churn, that still allows us easily to go
through them and re-evaluate them later as we actually remove them.

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675598-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0CAE641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:28:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id DEC993B1123
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:27:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 140272874F2;
Fri, 6 Jun 2025 10:28:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BfYixcle"
Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05B57286429;
Fri, 6 Jun 2025 10:28:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205689; cv=none; b=XMMfzeQYlSY6Dqz6nJ2j03jRa/QM5ewKEuBCoXHJlfGnJqPauyCjiCxiNpSNF11UfqE30iirOfBOqnu54Pm8FodsPghF8jizvgrXmX0J3qlDXAKWbw8rDqKGECYo35KejbmsJp+C+4gOPtxCi6qAGE+vbtLUdxmdNQXuSpU0WGc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205689; c=relaxed/simple;
bh=FMzX1ASQKqkQ1tt/369NITjzbVxz4J5tb33XHDzXWjA=;
h=From:To:Subject:Date:Message-ID:MIME-Version; b=EAotq3tLL/CTUw0ZJDzCzDwDPBCcmK0s98+m+Hmm/oYm2SAKEusiB/r1Ql1lBqfekukKAD+Bm7dubTsrDn1JdA6N5OpBeTPXooducso/i7uPLZP9Xlf/BcH1Yg7Kjl7Si3hNaCLUrIENwJbk6qp1sYprq9wWBpmwRUIRGapHBBM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BfYixcle; arc=none smtp.client-ip=209.85.214.179
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-235ea292956so19742175ad.1;
Fri, 06 Jun 2025 03:28:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749205687; x=1749810487; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:to
:from:from:to:cc:subject:date:message-id:reply-to;
bh=Kq75SIqPsOJ1DQd3x8jl/mu37HxVt1wTwstMgXOJ46M=;
b=BfYixcleDyBWI4HRlNMcYxDzBq2wxphfwZko5RtzshLqs30R/fnUw9dcLrkynZFSWo
wDAyZKyvPYd4bUfA+kNg+L7p9CWYuK/hKGBw0yikF3u57wqQ0uaNhLOFw581hQQPosj4
s8ucO/bLrgpIgjquFG5hGuAOUSWt7L9uKwG7EXhj9s5CbMyu+2zhyZsNibbxufgTcvht
+Kf+ak/dPF7/cSxn1+/lZpxtqHfBP+75fFwi1jlybOHOsjLxgpMbeOwZ//8ElOaSKE0O
58YDzfYHYHm2hjpQ3MfKHhmmEIABaWUhstL24EFJUAvfi8/cHaCSybpDbGT6jv0MA23W
RAgQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205687; x=1749810487;
h=content-transfer-encoding:mime-version:message-id:date:subject:to
:from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=Kq75SIqPsOJ1DQd3x8jl/mu37HxVt1wTwstMgXOJ46M=;
b=dUd4m93fghCkantWuqG3GIFNfyF7Z4IkSvnjpM46Wjps1w6xNC97pqEtbVJeUHo/UZ
tpgdf6WILrCfGHB7XoFx7O67kbZ7jV5/ibIMchb1b/Mm+ewH6ROmtzBtYSd0yd79Rhyb
PTDc4MNFhRl5QQI+EuqiZJPnM7EbhVoZ/D5We6HDa9gmSho3XzWiDPZBWRMshwLwoTyq
HeHA+ZpD1PA7etFttBBdTOLeYj6YkLFPdC7iwF7twtCmWRlhedth8xo/UtYLuJ8qhXcO
isZIIf72rIYdgKZkaDV+HMqN4s5bsK1sWXF1XlRC1QHsMp4yOleXZpG6O5d6j12ttHTE
zCyQ==
X-Forwarded-Encrypted: i=1; AJvYcCURlYXW4kygtC2xycb86BW0ssBiAY/sULOwcNg9gUN2pqdlvSRJo4p3IOk4qE93oCbfUxXTZNtBqw3lo+7h@xxxxxxxxxxxxxxx, AJvYcCWe6AHIRtX5LyDPSq3EcqKwrsbAUquFP79tkOnaXE14RT5kABjTn5xl2QF4ZyLwpnLhI4W75GSs9OVI@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzgYIn1ttMqOICpVpqoMnOlakdhqCPk+Tc/q2LTrSQYgzLfpfKj
E1IT7gFKoyWZD5nve/wOBp2WKakDC9CImM9KmLbSN6tQ2qX6mUcG8l6+
X-Gm-Gg: ASbGncul03+0HM8sHpJpgTx/Nu1S/bES/4Vm57hSrZvCIdT4c9Gc1NCekpeIiCziCbX
bjFh2V1wvr7QQGK1/ALLH6JFdArbsgtZy/5s5DMCH+uEG09+K8144p+PklB3qX188HJj40hMcOr
vJm6VqOe4WjEu5v5ew0tdPbw/mpEwDBMsfocpAIjS9cTFZvWKJfBcUVN75ISuif8QiOHnJ+F/vG
euA+z+dAHt6crTAj0Z88DETjQaJ2iFhmmNdyfV3wG6/JpgTmseiQdrCvks80QVBbbCd+8UlkbJn
vuO7/Tm647ifTjRyBuVjB+G3USv2nnQUSN2j5VnPWcyfx6w9sjzuCFIZfqyCU4O9C5JHs741yNk
TqWdIYwHNW92aUpfroCDdWr8KeR/A57Wn5cmHJfHNZzMyFnByZB7oug0xUMzDN+bAWfq+LsD1QD
o=
X-Google-Smtp-Source: AGHT+IHWIRzmPF9hBfCr89nWxfu/OXV/L7N6WZrJscNojX76/huWUu2nhvxP0kFj4o42XVFggGnTGQ==
X-Received: by 2002:a17:902:f652:b0:235:779:edfd with SMTP id d9443c01a7336-23601d97820mr40085765ad.39.1749205687155;
Fri, 06 Jun 2025 03:28:07 -0700 (PDT)
Received: from fred-System-Product-Name.. (2001-b400-e35c-06eb-80f3-97a6-ae1b-00f8.emome-ip6.hinet.net. [2001:b400:e35c:6eb:80f3:97a6:ae1b:f8])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-2360307813bsm9632885ad.22.2025.06.06.03.28.04
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:28:06 -0700 (PDT)
From: Fred Chen <fredchen.openbmc@xxxxxxxxx>
To: Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Joel Stanley <joel@xxxxxxxxx>,
Andrew Jeffery <andrew@xxxxxxxxxxxxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-aspeed@xxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 0/2] Add Meta(Facebook) Santabarbara BMC(AST2600)
Date: Fri, 6 Jun 2025 18:27:52 +0800
Message-ID: <20250606102802.1821638-1-fredchen.openbmc@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Summary:
Add linux device tree entry related to Meta(Facebook) Santabarbara
specific devices connected to BMC(AST2600) SoC.

Fred Chen (2):
dt-bindings: arm: aspeed: add Meta Santabarbara board
ARM: dts: aspeed: santabarbara: Add Meta Santabarbara BMC

.../bindings/arm/aspeed/aspeed.yaml | 1 +
arch/arm/boot/dts/aspeed/Makefile | 1 +
.../aspeed-bmc-facebook-santabarbara.dts | 978 ++++++++++++++++++
3 files changed, 980 insertions(+)
create mode 100644 arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts

--
2.49.0



Return-Path: <linux-kernel+bounces-675599-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0F01541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:28:29 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2E36716308C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:30 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 65A0A286D48;
Fri, 6 Jun 2025 10:28:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YFnNna53"
Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58F3028750D;
Fri, 6 Jun 2025 10:28:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205693; cv=none; b=RkewudAsXl5tVTXvFlhm2sMq03pERGOBnXx/xPDBXG1QHTqARUYdD28xt8Bx1dDxTY9I9e9MMe+omE9s09aVbsPykrfn/2kbvBtOxayvmjhvsNeYcYUXbNQKdLfsfh1zh7fGabH+nDU9Wnu8Ey/2uyhLqOxw1wAI4pGR4gpLqLg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205693; c=relaxed/simple;
bh=VW1z7quOUVaSxQgJ+9/BOsabZt0GNXzoFywJfXHGils=;
h=From:To:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=Xrm4fBEdQwbLmBZxNJNGzwok6bxV8Oe2MG5JPCiWa2CI3B/6Aa76BdcID1OTZKh1gh+i5pBnpTyh+jH85LkgG6gACqEyh29c8wiiDT7CTDAp2F/NEB04S1RtAikEWn1aNrHZ2woMZn/t+rTgzhMLLz/WW0GdicshtA4BSPqEp30=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YFnNna53; arc=none smtp.client-ip=209.85.214.174
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-231e8553248so20023055ad.1;
Fri, 06 Jun 2025 03:28:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749205691; x=1749810491; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:to:from:from:to:cc:subject:date:message-id
:reply-to;
bh=f2k6QLhMs+Ybe7hFRFwIVvK0vEsmpmU+VkYws59KtZA=;
b=YFnNna53aGiWA9VE/xIMEnXU6h2RAsRP/8fQ2iW9V2LWyZGeGWxKOKyi1N/IjjtAT4
DaR0zEEWnBPqXwy/w0JMgmkwaE/5kC2PQN1COP12m36cx0CM/uXFcix0pcgguWeeahtr
py5Dnl7ZrRZRafL9wMtqf/4dVAxrMIlqokm7pCLFXWL3bm20FW6DUsTF/igyFTUNQezQ
+4AwRLabUkCDt2IMJxRV6zNpQFWaupkqJBClz9SuxxRTuYw2562TtuiAgtjIAYzlRszj
B6CBBOOmrxQ0KTl/AtoDZb7OvOE4vxc8XMUu0p8ECT815L7+Kh1KJmFFDoGJdxkAE8ZT
IjFA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205691; x=1749810491;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=f2k6QLhMs+Ybe7hFRFwIVvK0vEsmpmU+VkYws59KtZA=;
b=t4dGKVyi4krXXxIatWgjcVJeOsNUN/4KrpHJW0Zxmh0zXCS1q766mSP8SUvS8TuU2w
K2Kq6B79QBVvPgmpwlqGagsKaE5xb2t50VYY60emWPReOhAxY6EeHEIVAklu1V5S8+wF
M8msPGBr3HllgoitvxAU7zQmy/HhPjd3ndEMCeGn3tGJpXT3211QGlFlOr0cO+zZ1Orz
XCclFYx+veQyoE8jm6d/aJlpIu13wNzcrmaYBZERuDdRQmtkr3X2sAqhxnE6OI5bK+UH
wtqgAz0L10egGZUDgXknYB1bxil/kIUgIssN+pvuJzwrMpa9qq1mUyC+VRElYHuIrHnM
aNoA==
X-Forwarded-Encrypted: i=1; AJvYcCUb/I9947bIVhK2UvQ0kJxf3Fs+AXDkIAZq62s7xYLthlAfkNjUj47UsLuQAaJLY7EmKDIukKFcYvtq7LeF@xxxxxxxxxxxxxxx, AJvYcCUlczBeVvPelSKnE4/Ww6UuWifnEJew+u7iULqp99R7et0w9JjWdau/C82kWe4/FNbuUD/+DQ7+qW2W@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YxaK78X5OMAE9pWgHKte/Gxq/yYtIih6oInJEKVe6dy7B/5qXqj
Kdqr5lzhDVzQv8ZopfV3QFSV3B3ZAeg3D7vvhoFv/3I8LTmB/19d7KXc
X-Gm-Gg: ASbGnct+X4yyNSgU56ISy967QYVBi0onAqsFK1l9jhAPQ4tzenioTZ4VeKZDLhfIDyP
UupWILFWlckCC1ByKF6qh+2P3/wUBU7s//ZBalvZn0VXnFcWS4B9D+/iKbe9qJeFMjpnZeISIVP
k40rLDppCf7N42cPEYyzdOrvI1Smtj0AYS0DQnXbrE4Kj5UlXclM5g44yg51iYfv04vdbaCPAgs
eGKjQ9V5R2VWS+yMzH89JH97CD0EvGhh7sEfAgE6Vi7KDACR4v1NooC+cZlz7NN02xzPG0xjnhE
ZtTrBOa0cobW7aHl0Ft5aOiXzQe4PYTsllGLsYVylpKGwg3El5J3gtomtneX+bwgvqrkZuVOb4Y
TPZtfGYldFnIMr3NLYen3c9QgYIbiExx9s77fYyFxBOsqZf+Jef0Fc5ogu1gtoIxjx0NoCs/l9I
OLrTPiCucxLA==
X-Google-Smtp-Source: AGHT+IHdkRnMxTdMkIPYO52HyIjgNRpDvU7O4+2NT2FszwjIZ6VSApJKtT1r2YkGVF9r+aJyzdfHBw==
X-Received: by 2002:a17:902:db10:b0:235:91a:2c with SMTP id d9443c01a7336-23601d82d3fmr34529105ad.42.1749205691572;
Fri, 06 Jun 2025 03:28:11 -0700 (PDT)
Received: from fred-System-Product-Name.. (2001-b400-e35c-06eb-80f3-97a6-ae1b-00f8.emome-ip6.hinet.net. [2001:b400:e35c:6eb:80f3:97a6:ae1b:f8])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-2360307813bsm9632885ad.22.2025.06.06.03.28.09
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:28:11 -0700 (PDT)
From: Fred Chen <fredchen.openbmc@xxxxxxxxx>
To: Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Joel Stanley <joel@xxxxxxxxx>,
Andrew Jeffery <andrew@xxxxxxxxxxxxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-aspeed@xxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 1/2] dt-bindings: arm: aspeed: add Meta Santabarbara board
Date: Fri, 6 Jun 2025 18:27:53 +0800
Message-ID: <20250606102802.1821638-2-fredchen.openbmc@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250606102802.1821638-1-fredchen.openbmc@xxxxxxxxx>
References: <20250606102802.1821638-1-fredchen.openbmc@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Document the new compatibles used on Facebook Santabarbara.

Signed-off-by: Fred Chen <fredchen.openbmc@xxxxxxxxx>
---
Documentation/devicetree/bindings/arm/aspeed/aspeed.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/aspeed/aspeed.yaml b/Documentation/devicetree/bindings/arm/aspeed/aspeed.yaml
index 01333ac111fb..a965f1a03051 100644
--- a/Documentation/devicetree/bindings/arm/aspeed/aspeed.yaml
+++ b/Documentation/devicetree/bindings/arm/aspeed/aspeed.yaml
@@ -87,6 +87,7 @@ properties:
- facebook,greatlakes-bmc
- facebook,harma-bmc
- facebook,minerva-cmc
+ - facebook,santabarbara-bmc
- facebook,yosemite4-bmc
- ibm,blueridge-bmc
- ibm,everest-bmc
--
2.49.0



Return-Path: <linux-kernel+bounces-675600-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E500B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:28:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1C4C01776D0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F70228750D;
Fri, 6 Jun 2025 10:28:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iBEcFRmL"
Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99DDE2874E9;
Fri, 6 Jun 2025 10:28:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205699; cv=none; b=Bu7jvr45GCVIZUVktSig856vF1PbyKp0li/V7c3ECBsTDuuw/HigGDStPn4Q4DCUY8Zx44GPLsrmxvVjtnEGKS2UruyM+xqSI6PbtH4E3cQVZqixMG8cVO7XzSnG235GHSQJ7G68Cqf1hEXkg4QX7JIP8/C7nTYKyOMtKKbfVOM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205699; c=relaxed/simple;
bh=lSLV0MhntI3Uti28xEokkjrQIoWikVnLM0hqi8ViBhg=;
h=From:To:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=JeXD7uQ2h9W9VNJVzwddKexOUMj43i3Te+313rAkVxgVqyBxxDetHj2O8WAdZxYIYT5Kg9nfXcja2CUIt62iNIuTathRtA3H/NReW8cF3BFtsabaFVNbahPAZg1IAQZ2ecZhRwI8Jed/NfDp0u8Cq2YOiNCcJlWGrWYQTGD+Bi4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iBEcFRmL; arc=none smtp.client-ip=209.85.214.173
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2352400344aso18227555ad.2;
Fri, 06 Jun 2025 03:28:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749205697; x=1749810497; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:to:from:from:to:cc:subject:date:message-id
:reply-to;
bh=6FuwAcAYxwLpn9cchA975j9Xj8eJ1TYxbCYiCle/9/k=;
b=iBEcFRmLTYlLIX5I3faJ4SirE35eFOu1DgkAYER5Xpbjom+Wz6rOnsMOBTXv8RJdq7
UmfW8gYAmRvXthDN/g/vgNkIF26oV9R8OINuts6XwbeQtQ8q/VRBynX+GNYyOKeWx+2I
uggoHSdCO4SXn4eJpXf9wVxPFF57PhM5fw/yEIWrvda35aWwCwDo/wW0C9ol+h23BW18
E7sPDtLTB4xR6cD1/X3gDBbUDi256txU1Tc++NQzd6LSatqzAYruw8as9BTwWzklYRmw
Y4U4ceBYJxTxPGaDV4VUMBerMfqpSZCdgw7BYaN8ATgLbX8F+dg+QEcv6kN9AkOkl18Y
PZKA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205697; x=1749810497;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=6FuwAcAYxwLpn9cchA975j9Xj8eJ1TYxbCYiCle/9/k=;
b=Swo3QGiRasyUGPNmWqgAm16VccD+MrYdxty8XCM4rnfUlXb/waF/tyhAhvFE1w8N6H
dIILxLDiSx0amsuGbo2IhV74oBrNh0yC90EUrsAFm0Spx9XKK/L0od8FQJ0KHhotW19c
DBl65EAgcvmxGq/n+tQZ9FdOQ5JJpID76hBUGd0XBY/+siA96uy+bRRtKuWxZpBaiJ5J
JvJCss9nJLJrF99HvptlO76bpAj9+g2RIZWaoz4+FJ2OO7YNdTDW8QrDk/HaKR6c4Wx2
OCUYxJSOXNELX/wvIYoDkAgfj0eRgnC0zAzOuiQMATlTRrur1IEUgBmgZsCj6ziik5++
WE4Q==
X-Forwarded-Encrypted: i=1; AJvYcCUh0qhiWSm4LFafIkQjm2E26FPQxpnptjC9QNx6PD7oAw6Jf4VaKiBKj41sDo2oXu4KDobDdx6pAsDGJZwx@xxxxxxxxxxxxxxx, AJvYcCVIyVmk0Na+aaPfI0eos40IxRb5BZlMwIQlZmEEot24pg4LCnC7gv2UrH3am/ejCEBXp1AJ6hlJIxa4@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YyrUoRZ2WQhI3lwG14BPeVgiRZJPOtzZaF7Mx+LiTd/+FfjUnoA
XRpPLFxN+seyU4xa+ZrELfeuvB1P8fzaWiBDwZYCK2m9qgHWn3es9fCl
X-Gm-Gg: ASbGnctba6TnrUqTXZ5olj1xWYAWAT33IAQg8iVkIdapKuzKyOgiIcP7YhWGYgUX5DV
7s1f88Shpyphv0wnOL7FR4M9bm6GgACZ6mRXzd32K9mjUfH80IL7uWU1uclXSMRwq9DCqBWJ6hc
plNzahnX3BWLwCxHZ7CgqQ2Q6BAaXpgwLWYM33Aax+BJA1O+TrHxZlm5lTUmriXKhiYXpxiXDHT
OPZ/eM2ooCBvRmsZtnUZuegs23tt5wIYWl0QzO/aRsYe9r8/FXrvuiguJUkQnRbaaoQ6DuhNMi4
o1QnbaRSJpUWi6dhyTl/0325k1jC7gu/aiZXsm0Jv/MnoUwS/8INbUo9uBvrq1w0YPkJ/Jw/Jwo
UceRGWY2CTgYTCRMmsjP0sEheKZWp8fKVL57C6qJB5VS0OveFBYLVspoFD1o0Nfu7f0mCUPHCnx
Y=
X-Google-Smtp-Source: AGHT+IH4J91L2aDxjjQr7iT8Z7j1Q4ogvAFc9RSoJ0FjgokqAcs7pYI+t4+uY+PnXxPaHD5ArLFGKQ==
X-Received: by 2002:a17:902:d483:b0:234:9052:2be6 with SMTP id d9443c01a7336-23601d73edamr42409975ad.41.1749205696668;
Fri, 06 Jun 2025 03:28:16 -0700 (PDT)
Received: from fred-System-Product-Name.. (2001-b400-e35c-06eb-80f3-97a6-ae1b-00f8.emome-ip6.hinet.net. [2001:b400:e35c:6eb:80f3:97a6:ae1b:f8])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-2360307813bsm9632885ad.22.2025.06.06.03.28.14
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:28:16 -0700 (PDT)
From: Fred Chen <fredchen.openbmc@xxxxxxxxx>
To: Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Joel Stanley <joel@xxxxxxxxx>,
Andrew Jeffery <andrew@xxxxxxxxxxxxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-aspeed@xxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 2/2] ARM: dts: aspeed: santabarbara: Add Meta Santabarbara BMC
Date: Fri, 6 Jun 2025 18:27:54 +0800
Message-ID: <20250606102802.1821638-3-fredchen.openbmc@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250606102802.1821638-1-fredchen.openbmc@xxxxxxxxx>
References: <20250606102802.1821638-1-fredchen.openbmc@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,WEIRD_QUOTING autolearn=ham autolearn_force=no
version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add linux device tree entry related to the Meta(Facebook) computer-node
system use an AT2600 BMC.
This node is named "Santabarbara".

Signed-off-by: Fred Chen <fredchen.openbmc@xxxxxxxxx>
---
arch/arm/boot/dts/aspeed/Makefile | 1 +
.../aspeed-bmc-facebook-santabarbara.dts | 978 ++++++++++++++++++
2 files changed, 979 insertions(+)
create mode 100644 arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts

diff --git a/arch/arm/boot/dts/aspeed/Makefile b/arch/arm/boot/dts/aspeed/Makefile
index 2e5f4833a073..6a8fb3addf0f 100644
--- a/arch/arm/boot/dts/aspeed/Makefile
+++ b/arch/arm/boot/dts/aspeed/Makefile
@@ -27,6 +27,7 @@ dtb-$(CONFIG_ARCH_ASPEED) += \
aspeed-bmc-facebook-harma.dtb \
aspeed-bmc-facebook-minerva.dtb \
aspeed-bmc-facebook-minipack.dtb \
+ aspeed-bmc-facebook-santabarbara.dtb \
aspeed-bmc-facebook-tiogapass.dtb \
aspeed-bmc-facebook-wedge40.dtb \
aspeed-bmc-facebook-wedge100.dtb \
diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts
new file mode 100644
index 000000000000..139b986bbfbf
--- /dev/null
+++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts
@@ -0,0 +1,978 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// Copyright 2025 Facebook Inc.
+
+/dts-v1/;
+#include "aspeed-g6.dtsi"
+#include <dt-bindings/gpio/aspeed-gpio.h>
+#include <dt-bindings/i2c/i2c.h>
+
+/ {
+ model = "Facebook Santabarbara BMC";
+ compatible = "facebook,santabarbara-bmc", "aspeed,ast2600";
+
+ aliases {
+ serial0 = &uart1;
+ serial2 = &uart3;
+ serial3 = &uart4;
+ serial4 = &uart5;
+ i2c16 = &i2c4mux0ch0;
+ i2c17 = &i2c4mux0ch1;
+ i2c18 = &i2c4mux0ch2;
+ i2c19 = &i2c4mux0ch3;
+ i2c20 = &i2c4mux0ch4;
+ i2c21 = &i2c4mux0ch5;
+ i2c22 = &i2c4mux0ch6;
+ i2c23 = &i2c4mux0ch7;
+ i2c24 = &i2c5mux0ch0;
+ i2c25 = &i2c5mux0ch1;
+ i2c26 = &i2c5mux0ch2;
+ i2c27 = &i2c5mux0ch3;
+ i2c28 = &i2c5mux1ch0;
+ i2c29 = &i2c5mux1ch1;
+ i2c30 = &i2c5mux1ch2;
+ i2c31 = &i2c5mux1ch3;
+ i2c32 = &i2c12mux0ch0;
+ i2c33 = &i2c12mux0ch1;
+ i2c34 = &i2c12mux0ch2;
+ i2c35 = &i2c12mux0ch3;
+ i2c36 = &i2c12mux0ch4;
+ i2c37 = &i2c12mux0ch5;
+ i2c38 = &i2c12mux0ch6;
+ i2c39 = &i2c12mux0ch7;
+ };
+
+ chosen {
+ stdout-path = "serial4:57600n8";
+ };
+
+ memory@80000000 {
+ device_type = "memory";
+ reg = <0x80000000 0x80000000>;
+ };
+
+ iio-hwmon {
+ compatible = "iio-hwmon";
+ io-channels = <&adc0 0>, <&adc0 1>, <&adc0 2>, <&adc0 3>,
+ <&adc0 4>, <&adc0 5>, <&adc0 6>, <&adc0 7>,
+ <&adc1 2>;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led-0 {
+ label = "bmc_heartbeat_amber";
+ gpios = <&gpio0 ASPEED_GPIO(P, 7) GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "heartbeat";
+ };
+
+ led-1 {
+ label = "fp_id_amber";
+ default-state = "off";
+ gpios = <&gpio0 ASPEED_GPIO(B, 5) GPIO_ACTIVE_HIGH>;
+ };
+
+ led-2 {
+ label = "power_blue";
+ default-state = "off";
+ gpios = <&gpio0 ASPEED_GPIO(P, 4) GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ spi_gpio: spi {
+ status = "okay";
+ compatible = "spi-gpio";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ sck-gpios = <&gpio0 ASPEED_GPIO(Z, 3) GPIO_ACTIVE_HIGH>;
+ mosi-gpios = <&gpio0 ASPEED_GPIO(Z, 4) GPIO_ACTIVE_HIGH>;
+ miso-gpios = <&gpio0 ASPEED_GPIO(Z, 5) GPIO_ACTIVE_HIGH>;
+ num-chipselects = <1>;
+ cs-gpios = <&gpio0 ASPEED_GPIO(Z, 0) GPIO_ACTIVE_LOW>;
+
+ tpm@0 {
+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
+ spi-max-frequency = <33000000>;
+ reg = <0>;
+ };
+ };
+
+ p3v3_bmc_aux: regulator-p3v3-bmc-aux {
+ compatible = "regulator-fixed";
+ regulator-name = "p3v3_bmc_aux";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-always-on;
+ };
+};
+
+// HOST BIOS Debug
+&uart1 {
+ status = "okay";
+};
+
+&uart3 {
+ status = "okay";
+};
+
+&uart4 {
+ status = "okay";
+};
+
+// BMC Debug Console
+&uart5 {
+ status = "okay";
+};
+
+&uart_routing {
+ status = "okay";
+};
+
+&wdt1 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_wdtrst1_default>;
+ aspeed,reset-type = "soc";
+ aspeed,external-signal;
+ aspeed,ext-push-pull;
+ aspeed,ext-active-high;
+ aspeed,ext-pulse-duration = <256>;
+};
+
+&mac2 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_rmii3_default>;
+ use-ncsi;
+};
+
+&fmc {
+ status = "okay";
+
+ flash@0 {
+ status = "okay";
+ m25p,fast-read;
+ label = "bmc";
+ spi-max-frequency = <50000000>;
+#include "openbmc-flash-layout-128.dtsi"
+ };
+
+ flash@1 {
+ status = "okay";
+ m25p,fast-read;
+ label = "alt-bmc";
+ spi-max-frequency = <50000000>;
+ };
+};
+
+// BIOS Flash
+&spi2 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_spi2_default>;
+
+ flash@0 {
+ status = "okay";
+ m25p,fast-read;
+ label = "pnor";
+ spi-max-frequency = <12000000>;
+ spi-tx-bus-width = <2>;
+ spi-rx-bus-width = <2>;
+ };
+};
+
+&kcs2 {
+ status = "okay";
+ aspeed,lpc-io-reg = <0xca8>;
+};
+
+&kcs3 {
+ status = "okay";
+ aspeed,lpc-io-reg = <0xca2>;
+};
+
+&i2c0 {
+ status = "okay";
+
+ // MB FRU
+ eeprom@53 {
+ compatible = "atmel,24c128";
+ reg = <0x53>;
+ };
+
+ rtc@68 {
+ compatible = "dallas,ds1339";
+ reg = <0x68>;
+ };
+};
+
+&i2c1 {
+ status = "okay";
+
+ fan-controller@21{
+ compatible = "maxim,max31790";
+ reg = <0x21>;
+ };
+
+ gpio@20 {
+ compatible = "nxp,pca9555";
+ reg = <0x20>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-parent = <&sgpiom0>;
+ interrupts = <112 IRQ_TYPE_LEVEL_LOW>;
+ gpio-line-names =
+ "FM_NIC_PPS_IN_OE_N","FM_NIC_PPS_OUT_OE_N",
+ "FM_CPU0_TRIGGERTSC_OE_N","FM_NIC_PPS_IN_MUX_OE_N",
+ "FM_CPU0_CORETYPE0","FM_CPU0_CORETYPE1",
+ "FM_CPU0_CORETYPE2","FM_NIC_PPS_OUT_MUX_OE",
+ "CLKMUX_INPUT_LOSS_U45_R_N","FM_CPU0_SP7R1",
+ "FM_CPU0_SP7R2","FM_CPU0_SP7R3",
+ "FM_CPU0_SP7R4","",
+ "FM_NIC_PPS_IN_S0_R","FM_NIC_PPS_IN_S1_R";
+ };
+
+ gpio@22 {
+ compatible = "nxp,pca9555";
+ reg = <0x22>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-parent = <&sgpiom0>;
+ interrupts = <116 IRQ_TYPE_LEVEL_LOW>;
+ gpio-line-names =
+ "FM_CBL_PRSNT_0A_N","FM_CBL_PRSNT_0B_N",
+ "FM_CBL_PRSNT_1A_N","FM_CBL_PRSNT_1B_N",
+ "FM_MODULE_PWRGD_0A","FM_MODULE_PWRGD_0B",
+ "CLKMUX_INPUT_LOSS_U88_R_N","FM_MODULE_PWRGD_1B",
+ "","",
+ "CLKMUX_INPUT_LOSS_U83_R_N","CLKMUX_INPUT_LOSS_U84_R_N",
+ "FM_P3V3_E1S_0_FAULT_R_N","FM_P3V3_E1S_1_FAULT_R_N",
+ "E1S_0_P12V_ADC_R_ALERT","E1S_1_P12V_ADC_R_ALERT";
+ };
+
+ gpio@24 {
+ compatible = "nxp,pca9555";
+ reg = <0x24>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-parent = <&sgpiom0>;
+ interrupts = <114 IRQ_TYPE_LEVEL_LOW>;
+ gpio-line-names =
+ "FM_CBL_PRSNT_2A_N","FM_CBL_PRSNT_2B_N",
+ "FM_CBL_PRSNT_3A_N","FM_CBL_PRSNT_3B_N",
+ "FM_CBL_PRSNT_4A_N","FM_CBL_PRSNT_4B_N",
+ "FM_P3V3_NIC_400G_FAULT_R_N","FM_MODULE_PWRGD_2B",
+ "OCP_SFF_P12V_ADC_R_ALERT","FM_MODULE_PWRGD_3B",
+ "FM_THERMAL_ALERT_R_N","FM_MODULE_PWRGD_4B",
+ "FM_CBL_PRSNT_OSFP_A_N","FM_CBL_PRSNT_OSFP_B_N",
+ "FM_JTAG_MCIO_MUX_S0","FM_JTAG_MCIO_MUX_S1";
+ };
+
+ gpio@26 {
+ compatible = "nxp,pca9555";
+ reg = <0x26>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-parent = <&sgpiom0>;
+ interrupts = <118 IRQ_TYPE_LEVEL_LOW>;
+ gpio-line-names =
+ "FAN_0_PRSNT_R1_N","FAN_1_PRSNT_R1_N",
+ "FAN_2_PRSNT_R1_N","FAN_3_PRSNT_R1_N",
+ "P12V_FAN_0_ADC_ALERT","P12V_FAN_1_ADC_ALERT",
+ "P12V_FAN_2_ADC_ALERT","P12V_FAN_3_ADC_ALERT",
+ "P12V_FAN0_PWRGD_R","P12V_FAN1_PWRGD_R",
+ "P12V_FAN2_PWRGD_R","P12V_FAN3_PWRGD_R",
+ "","","","";
+ };
+};
+
+&i2c4 {
+ status = "okay";
+
+ i2c-mux@70 {
+ compatible = "nxp,pca9548";
+ reg = <0x70>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ i2c-mux-idle-disconnect;
+
+ i2c4mux0ch0: i2c@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+
+ // HPM Board ID EEPROM
+ eeprom@51 {
+ compatible = "atmel,24c128";
+ reg = <0x51>;
+ };
+
+ // SCM Board ID EEPROM
+ eeprom@53 {
+ compatible = "atmel,24c128";
+ reg = <0x53>;
+ };
+ };
+ i2c4mux0ch1: i2c@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+ };
+ i2c4mux0ch2: i2c@2 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <2>;
+ };
+ i2c4mux0ch3: i2c@3 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <3>;
+
+ power-monitor@40 {
+ compatible = "ti,ina230";
+ reg = <0x40>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@42 {
+ compatible = "ti,ina230";
+ reg = <0x42>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@44 {
+ compatible = "ti,ina230";
+ reg = <0x44>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@46 {
+ compatible = "ti,ina230";
+ reg = <0x46>;
+ shunt-resistor = <2000>;
+ };
+
+ temperature-sensor@4c {
+ compatible = "ti,tmp75";
+ reg = <0x4c>;
+ };
+
+ temperature-sensor@4e {
+ compatible = "ti,tmp75";
+ reg = <0x4e>;
+ };
+
+ voltage-sensor@48 {
+ compatible = "ti,ads7830";
+ reg = <0x48>;
+ vref-supply = <&p3v3_bmc_aux>;
+ };
+
+ voltage-sensor@4a {
+ compatible = "ti,ads7830";
+ reg = <0x4a>;
+ vref-supply = <&p3v3_bmc_aux>;
+ };
+ };
+ i2c4mux0ch4: i2c@4 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <4>;
+ };
+ i2c4mux0ch5: i2c@5 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <5>;
+ };
+ i2c4mux0ch6: i2c@6 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <6>;
+
+ power-monitor@40 {
+ compatible = "ti,ina230";
+ reg = <0x40>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@42 {
+ compatible = "ti,ina230";
+ reg = <0x42>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@44 {
+ compatible = "ti,ina230";
+ reg = <0x44>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@46 {
+ compatible = "ti,ina230";
+ reg = <0x46>;
+ shunt-resistor = <2000>;
+ };
+
+ voltage-sensor@48 {
+ compatible = "ti,ads7830";
+ reg = <0x48>;
+ };
+ };
+ i2c4mux0ch7: i2c@7 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <7>;
+
+ // FIO FRU
+ eeprom@53 {
+ compatible = "atmel,24c512";
+ reg = <0x53>;
+ };
+
+ temperature-sensor@4b {
+ compatible = "ti,tmp75";
+ reg = <0x4b>;
+ };
+
+ temperature-sensor@4f {
+ compatible = "ti,tmp75";
+ reg = <0x4f>;
+ };
+ };
+ };
+};
+
+&i2c5 {
+ status = "okay";
+
+ // E1S BP FRU
+ eeprom@52 {
+ compatible = "atmel,24c64";
+ reg = <0x52>;
+ };
+
+ i2c-mux@71 {
+ compatible = "nxp,pca9546";
+ reg = <0x71>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ i2c-mux-idle-disconnect;
+
+ i2c5mux0ch0: i2c@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+ };
+ i2c5mux0ch1: i2c@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+ };
+ i2c5mux0ch2: i2c@2 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <2>;
+ };
+ i2c5mux0ch3: i2c@3 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <3>;
+ };
+ };
+
+ i2c-mux@72 {
+ compatible = "nxp,pca9546";
+ reg = <0x72>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ i2c-mux-idle-disconnect;
+
+ i2c5mux1ch0: i2c@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+
+ voltage-sensor@48 {
+ compatible = "ti,ads7830";
+ reg = <0x48>;
+ };
+ };
+ i2c5mux1ch1: i2c@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+
+ temperature-sensor@48 {
+ compatible = "ti,tmp75";
+ reg = <0x48>;
+ };
+ };
+ i2c5mux1ch2: i2c@2 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <2>;
+
+ power-monitor@40 {
+ compatible = "ti,ina230";
+ reg = <0x40>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@41 {
+ compatible = "ti,ina230";
+ reg = <0x41>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@44 {
+ compatible = "ti,ina230";
+ reg = <0x44>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@45 {
+ compatible = "ti,ina230";
+ reg = <0x45>;
+ shunt-resistor = <2000>;
+ };
+ };
+ i2c5mux1ch3: i2c@3 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <3>;
+
+ gpio@74 {
+ compatible = "nxp,pca9539";
+ reg = <0x74>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-line-names =
+ "P12V_E1S_ADC_ALERT","BUFF0_100M_LOSB_PLD",
+ "E1S_BP_SKU_ID0","E1S_BP_SKU_ID1",
+ "E1S_BP_SKU_ID2","E1S_BP_REV_ID0",
+ "E1S_BP_REV_ID1","E1S_BP_REV_ID2",
+ "P3V3_E1S_1_FAULT_R_N","P3V3_E1S_2_FAULT_R_N",
+ "P3V3_E1S_3_FAULT_R_N","P3V3_E1S_4_FAULT_R_N",
+ "P12V_E1S_1_FAULT_R_N","P12V_E1S_2_FAULT_R_N",
+ "P12V_E1S_3_FAULT_R_N","P12V_E1S_4_FAULT_R_N";
+ };
+ };
+ };
+};
+
+&i2c6 {
+ status = "okay";
+
+ // Rainbow0 FRU
+ eeprom@52 {
+ compatible = "atmel,24c256";
+ reg = <0x52>;
+ };
+};
+
+&i2c7 {
+ status = "okay";
+};
+
+&i2c8 {
+ status = "okay";
+
+ // Rainbow2 FRU
+ eeprom@52 {
+ compatible = "atmel,24c256";
+ reg = <0x52>;
+ };
+};
+
+&i2c9 {
+ status = "okay";
+
+ // SCM FRU
+ eeprom@50 {
+ compatible = "atmel,24c128";
+ reg = <0x50>;
+ };
+
+ // BSM FRU
+ eeprom@56 {
+ compatible = "atmel,24c64";
+ reg = <0x56>;
+ };
+
+ temperature-sensor@4b {
+ compatible = "ti,tmp75";
+ reg = <0x4b>;
+ };
+};
+
+&i2c10 {
+ status = "okay";
+
+ // Rainbow3 FRU
+ eeprom@52 {
+ compatible = "atmel,24c256";
+ reg = <0x52>;
+ };
+};
+
+&i2c11 {
+ status = "okay";
+
+ // OCP NIC TEMP
+ temperature-sensor@1f {
+ compatible = "ti,tmp421";
+ reg = <0x1f>;
+ };
+
+ // OCP NIC FRU
+ eeprom@50 {
+ compatible = "atmel,24c64";
+ reg = <0x50>;
+ };
+};
+
+&i2c12 {
+ status = "okay";
+
+ // SWB FRU
+ eeprom@52 {
+ compatible = "atmel,24c64";
+ reg = <0x52>;
+ };
+
+ i2c-mux@72 {
+ compatible = "nxp,pca9548";
+ reg = <0x72>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ i2c-mux-idle-disconnect;
+
+ i2c12mux0ch0: i2c@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+
+ temperature-sensor@48 {
+ compatible = "ti,tmp75";
+ reg = <0x48>;
+ };
+ };
+ i2c12mux0ch1: i2c@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+
+ power-monitor@42 {
+ compatible = "mps,mp2971";
+ reg = <0x42>;
+ };
+
+ power-monitor@43 {
+ compatible = "mps,mp2971";
+ reg = <0x43>;
+ };
+ };
+ i2c12mux0ch2: i2c@2 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <2>;
+
+ power-monitor@40 {
+ compatible = "ti,ina230";
+ reg = <0x40>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@41 {
+ compatible = "ti,ina230";
+ reg = <0x41>;
+ shunt-resistor = <2000>;
+ };
+ };
+ i2c12mux0ch3: i2c@3 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <3>;
+
+ power-monitor@44 {
+ compatible = "ti,ina230";
+ reg = <0x44>;
+ shunt-resistor = <2000>;
+ };
+
+ power-monitor@45 {
+ compatible = "ti,ina230";
+ reg = <0x45>;
+ shunt-resistor = <2000>;
+ };
+ };
+ i2c12mux0ch4: i2c@4 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <4>;
+
+ voltage-sensor@49 {
+ compatible = "ti,ads7830";
+ reg = <0x49>;
+ };
+ };
+ i2c12mux0ch5: i2c@5 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <5>;
+ };
+ i2c12mux0ch6: i2c@6 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <6>;
+ };
+ i2c12mux0ch7: i2c@7 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <7>;
+ };
+ };
+};
+
+&i2c13 {
+ status = "okay";
+
+ // Rainbow1 FRU
+ eeprom@52 {
+ compatible = "atmel,24c256";
+ reg = <0x52>;
+ };
+};
+
+&i2c14 {
+ status = "okay";
+};
+
+&i2c15 {
+ status = "okay";
+};
+
+&adc0 {
+ aspeed,int-vref-microvolt = <2500000>;
+ status = "okay";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_adc0_default &pinctrl_adc1_default
+ &pinctrl_adc2_default &pinctrl_adc3_default
+ &pinctrl_adc4_default &pinctrl_adc5_default
+ &pinctrl_adc6_default &pinctrl_adc7_default>;
+};
+
+&adc1 {
+ aspeed,int-vref-microvolt = <2500000>;
+ status = "okay";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_adc10_default>;
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&ehci1 {
+ status = "okay";
+};
+
+&gpio0 {
+ pinctrl-names = "default";
+ gpio-line-names =
+ /*A0-A7*/ "","","","","","","","",
+ /*B0-B7*/ "rtc-battery-voltage-read-enable","","","BMC_READY",
+ "","led-identify","","",
+ /*C0-C7*/ "","","","","","","","",
+ /*D0-D7*/ "","","","","","","","",
+ /*E0-E7*/ "","","","","","","","",
+ /*F0-F7*/ "","","","","","","","",
+ /*G0-G7*/ "","","","","","","","",
+ /*H0-H7*/ "","","","","","","","",
+ /*I0-I7*/ "","","","","","","","",
+ /*J0-J7*/ "","","","","","","","",
+ /*K0-K7*/ "","","","","","","","",
+ /*L0-L7*/ "","","","","","","","",
+ /*M0-M7*/ "","","","","","","","",
+ /*N0-N7*/ "led-postcode-0","led-postcode-1",
+ "led-postcode-2","led-postcode-3",
+ "led-postcode-4","led-postcode-5",
+ "led-postcode-6","led-postcode-7",
+ /*O0-O7*/ "","","","","","","","",
+ /*P0-P7*/ "power-button","","reset-button","",
+ "led-power","","","",
+ /*Q0-Q7*/ "","","","","","","","",
+ /*R0-R7*/ "","","","","","","","",
+ /*S0-S7*/ "","","power-host-control","","","","","",
+ /*T0-T7*/ "","","","","","","","",
+ /*U0-U7*/ "","","","","","","","",
+ /*V0-V7*/ "","","","","","","","",
+ /*W0-W7*/ "","","","","","","","",
+ /*X0-X7*/ "","","","","","","","",
+ /*Y0-Y7*/ "","","","","","","","",
+ /*Z0-Z7*/ "","","","","","","","";
+};
+
+&gpio1 {
+ gpio-line-names =
+ /*18A0-18A7*/ "","","","","","","","",
+ /*18B0-18B7*/ "","","","",
+ "FM_BOARD_BMC_REV_ID0","FM_BOARD_BMC_REV_ID1",
+ "FM_BOARD_BMC_REV_ID2","",
+ /*18C0-18C7*/ "SPI_BMC_BIOS_ROM_IRQ0_R_N","","","","","","","",
+ /*18D0-18D7*/ "","","","","","","","",
+ /*18E0-18E3*/ "FM_BMC_PROT_LS_EN","AC_PWR_BMC_BTN_R_N","","";
+};
+
+&sgpiom0 {
+ status = "okay";
+ ngpios = <128>;
+ bus-frequency = <2000000>;
+ gpio-line-names =
+ /*in - out - in - out */
+ /*A0-A3 line 0-7*/
+ "PDB1_HSC_PWR_OK","power-chassis-control",
+ "PDB2_HSC_PWR_OK","FM_MODULE_PWRGD_0A_OUT",
+ "PWRGD_P12V_MEM","FM_MODULE_PWRGD_0B_OUT",
+ "PWRGD_P12V_SCM","FM_MODULE_PWRGD_1B_OUT",
+ /*A4-A7 line 8-15*/
+ "PWRGD_P12V_FAN","FM_MODULE_PWRGD_2B_OUT",
+ "PWRGD_P5V_AUX","FM_MODULE_PWRGD_3B_OUT",
+ "power-chassis-good","FM_MODULE_PWRGD_4B_OUT",
+ "PWRGD_P1V8_LDO","FM_CBL_PRSNT_0A_N_OUT",
+ /*B0-B3 line 16-23*/
+ "PWRGD_P1V_LDO","FM_CBL_PRSNT_0B_N_OUT",
+ "PWRGD_PVDD33_S5","FM_CBL_PRSNT_1A_N_OUT",
+ "PWRGD_PVDD18_S5_P0","FM_CBL_PRSNT_1B_N_OUT",
+ "CPU0_SLP_S5_N","FM_CBL_PRSNT_2A_N_OUT",
+ /*B4-B7 line 24-31*/
+ "PWRGD_PVDDIO_MEM_S3_P0","FM_CBL_PRSNT_2B_N_OUT",
+ "CPU0_SLP_S3_N","FM_CBL_PRSNT_3A_N_OUT",
+ "FM_MODULE_PWRGD_1B","FM_CBL_PRSNT_3B_N_OUT",
+ "FM_MODULE_PWRGD_2B","FM_CBL_PRSNT_4A_N_OUT",
+ /*C0-C3 line 32-39*/
+ "FM_MODULE_PWRGD_3B","FM_CBL_PRSNT_4B_N_OUT",
+ "FM_MODULE_PWRGD_4B","P12V_FAN0_PWRGD_OUT",
+ "FM_MODULE_PWRGD_0B","P12V_FAN1_PWRGD_OUT",
+ "PWRGD_PVDDIO_P0","P12V_FAN2_PWRGD_OUT",
+ /*C4-C7 line 40-47*/
+ "PWRGD_PVDDCR_SOC_P0","P12V_FAN3_PWRGD_OUT",
+ "PWRGD_PVDDCR_CPU0_P0","P12V_FAN4_PWRGD_OUT",
+ "PWRGD_PVDDCR_CPU1_P0","P12V_FAN5_PWRGD_OUT",
+ "FM_CPU0_PWR_GOOD","P12V_FAN6_PWRGD_OUT",
+ /*D0-D3 line 48-55*/
+ "host0-ready","P12V_FAN7_PWRGD_OUT",
+ "FM_PWRGD_CPU0_PWROK","FAN_0_PRSNT_R1_N_OUT",
+ "FM_RST_CPU0_RESETL_N","FAN_1_PRSNT_R1_N_OUT",
+ "RST_CPU0_PERST0_R_N","FAN_2_PRSNT_R1_N_OUT",
+ /*D4-D7 line 56-63*/
+ "RST_CPU0_PERST1_R_N","FAN_3_PRSNT_R1_N_OUT",
+ "BIOS_POST_CMPLT","FAN_4_PRSNT_R1_N_OUT",
+ "","FAN_5_PRSNT_R1_N_OUT",
+ "","FAN_6_PRSNT_R1_N_OUT",
+ /*E0-E3 line 64-71*/
+ "FM_PWRGD_CHAD_CPU0","FAN_7_PRSNT_R1_N_OUT",
+ "FM_PWRGD_CHEH_CPU0","TRAY_SLOT_ID0_OUT",
+ "FM_PWRGD_CHIL_CPU0","TRAY_SLOT_ID1_OUT",
+ "FM_PWRGD_CHMP_CPU0","TRAY_SLOT_ID2_OUT",
+ /*E4-E7 line 72-79*/
+ "P12V_E1S_0_PWRGD","TRAY_SLOT_ID3_OUT",
+ "P12V_E1S_1_PWRGD","TRAY_SLOT_ID4_OUT",
+ "P3V3_E1S_0_PWRGD","SCM_JTAG_MUX_S0_R",
+ "P3V3_E1S_1_PWRGD","SCM_JTAG_MUX_S1_R",
+ /*F0-F3 line 80-87*/
+ "FM_MODULE_PWRGD_0A","BMC_SGPIO_READY",
+ "OCP_V3_1_P3V3_PLD_R_PWRGD","CPU0_SYS_RESET_N",
+ "P12V_OCP_V3_1_PLD_PWRGD","RST_CPU0_KBRST_N",
+ "PWRGD_OCP_SFF_PWR_GOOD","BIOS_DEBUG_MODE",
+ /*F4-F7 line 88-95*/
+ "","CLR_CMOS",
+ "","I3C_SPD_MUX_FORCE_SEL",
+ "","FM_JTAG_HOST_SEL",
+ "","TRAY_PRESENT_N",
+ /*G0-G3 line 96-103*/
+ "MB_REV_ID_0","UART_BMC_SEL0",
+ "MB_REV_ID_1","UART_BMC_SEL1",
+ "MB_REV_ID_2","SCM_USB_SEL",
+ "MB_SKU_ID_0","FORCE_ALL_PWRON",
+ /*G4-G7 line 104-111*/
+ "MB_SKU_ID_1","PASSWORD_CLEAR",
+ "MB_SKU_ID_2","",
+ "MB_SKU_ID_3","",
+ "","BIOS_DEBUG_MODE",
+ /*H0-H3 line 112-119*/
+ "FM_IOEXP_U538_INT_N","",
+ "FM_IOEXP_U539_INT_N","",
+ "FM_IOEXP_U540_INT_N","",
+ "FM_IOEXP_U541_INT_N","",
+ /*H4-H7 line 120-127*/
+ "FM_IOEXP_PDB2_U1003_INT_N","",
+ "","","","","","",
+ /*I0-I3 line 128-135*/
+ "","","","",
+ "PDB_IRQ_PMBUS_ALERT_ISO_R_N","",
+ "PDB_UV_ALERT_ISO_R_N","",
+ /*I4-I7 line 136-143*/
+ "P12V_SCM_ADC_ALERT","",
+ "CPU0_REGS_I2C_ALERT_N","",
+ "FM_RTC_ALERT_N","",
+ "APML_CPU0_ALERT_R_N","",
+ /*J0-J3 line 144-151*/
+ "SMB_RJ45_FIO_TMP_ALERT","",
+ "FM_SMB_ALERT_MCIO_0A_N","",
+ "I3C_MCIO_0B_ALERT_ISO_R_N","",
+ "FM_SMB_ALERT_MCIO_1A_N","",
+ /*J4-J7 line 152-159*/
+ "I3C_MCIO_1B_ALERT_ISO_R_N","",
+ "FM_SMB_ALERT_MCIO_2A_N","",
+ "I3C_MCIO_2B_ALERT_ISO_R_N","",
+ "FM_SMB_ALERT_MCIO_3A_N","",
+ /*K0-K3 line 160-167*/
+ "I3C_MCIO_3B_ALERT_ISO_R_N","",
+ "FM_SMB_ALERT_MCIO_4A_N","",
+ "I3C_MCIO_4B_ALERT_ISO_R_N","",
+ "","",
+ /*K4-K7 line 168-175*/
+ "","","","","","","","",
+ /*L0-L3 line 176-183*/
+ "FM_CPU0_THERMTRIP_N","",
+ "FM_CPU0_PROCHOT_N","",
+ "FM_CPU0_SMERR_N","",
+ "FM_PVDDCR_CPU0_P0_OCP_N","",
+ /*L4-L7 line 184-191*/
+ "FM_PVDDCR_CPU1_P0_OCP_N","",
+ "FM_PVDDCR_SOC_P0_OCP_N","",
+ "FM_OCP_PWRBRK_R_N","",
+ "PMIC_ERROR_N","",
+ /*M0-M3 line 192-199*/
+ "","","","","","","","",
+ /*M4-M7 line 200-207*/
+ "","","","","","","","",
+ /*N0-N3 line 208-215*/
+ "FM_PRSNT_CPU0_N","",
+ "OCP_SFF_PRSNT_N","",
+ "E1S_0_PRSNT_R_N","",
+ "E1S_BP_0_PRSNT_R_N","",
+ /*N4-N7 line 216-223*/
+ "E1S_BP_1_PRSNT_R_N","",
+ "E1S_BP_2_PRSNT_R_N","",
+ "E1S_BP_3_PRSNT_R_N","",
+ "PDB_PRSNT_J311_N","",
+ /*O0-O3 line 224-231*/
+ "PDB_PRSNT_J312_N","",
+ "PDB_PRSNT_J313_N","",
+ "PDB_PRSNT_J314_N","",
+ "PRSNT_RJ45_FIO_N_R","",
+ /*O4-O7 line 232-239*/
+ "PRSNT_LEAK_CABLE_1_R_N","",
+ "PRSNT_LEAK_CABLE_2_R_N","",
+ "PRSNT_HDT_N","",
+ "","",
+ /*P0-P3 line 240-247*/
+ "","","","","","","","",
+ /*P4-P7 line 248-255*/
+ "","","","","","","","";
+};
--
2.49.0



Return-Path: <linux-kernel+bounces-675601-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EDDA541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:28:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0C70D3B11C9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C2162874E7;
Fri, 6 Jun 2025 10:28:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="a80i3Q4m"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 A16A9286D48
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205715; cv=none; b=jB7isjMfMMoyBDPJRnPGZEDstsFvbZmoUcOOd2XLAxkjI7vqkMDqPifCg5bG/cJ+VRtv3b6f09/YtqIQKZAua2wu+X3kIUXO9AaKggCGfbiZji9XWjJopfIo2KGN7BAR4icG7BYwE2PUMtsth1iMfqWNDzKCrjoQzHfShfIv/vU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205715; c=relaxed/simple;
bh=kACviEvGUPXG/4M4+fT5j0GojhVVgJbgRf1+6PxoGjQ=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=eEcVep82B2cHKRHJZFeIoquUJmXGqrkYjBxAXRuzY2XdTRY0mijw/6VaSwjbtWZ5T311KLtlkLb9J97uQ/vKpGbg1m1jRKBwxHf2IkdawKpGIcL3GHXTp1B2DJ/yBMry2xbhkQCp7umC2sKF4ojEo1P2cTNWQJD+5LPn7bdUTt4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=a80i3Q4m; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749205712;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=wKVfXE5LvAUMRplqpv2/XdSj/f7PTYuXtEH5Yx/Ix2o=;
b=a80i3Q4mkn3nvziWjCfrGdCpS6dervW+DAaJFItAhmaxr7/8PQlTBudQ9DjyooUtXJgw4Z
6DKSj2oKbFitN91qB2gouSbq145f6vGoXbCcNBeg+3rptCMSp92kU+63cAfhHfJNd3mLX6
91zRIMdXXBOKIed4rw0GxdUKa6wL3KA=
Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com
[209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-695-qn8QNg5QPqKM0Wd0vkN3gg-1; Fri, 06 Jun 2025 06:28:31 -0400
X-MC-Unique: qn8QNg5QPqKM0Wd0vkN3gg-1
X-Mimecast-MFC-AGG-ID: qn8QNg5QPqKM0Wd0vkN3gg_1749205710
Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3a4f3796779so1423770f8f.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:28:31 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205710; x=1749810510;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=wKVfXE5LvAUMRplqpv2/XdSj/f7PTYuXtEH5Yx/Ix2o=;
b=i1AQO7IGPGkgKfAceQmAvmzKWuRrxWJO/0BVAR7z1N2NTpj++X3xV3aKNEq0/6wuCA
EyjYpdCvaFUJd9PMvW7mREofOOGTmBRUMqw5CJQczwctmm1G9krp1N3xjdzE/AItziQ9
q2Of9Y4TkmYgSskeJN5wh13L+/PyWhZTbZlmCJZXK3aXDkv6RX50dZS/3u8fRSdNV6Ra
G/VGDdM03w8/I3mAA2PgOBkQ1IYf/c1sAJiLzT/NmToQXmaTOzxIQPnJ6yp9h9/F8Ao0
qcnVSBYDmmYjvsU9PtOgyX/tl+JU+Y/gyYlE+phqfQEYdJuMFup4wmHnxtFn2NfLzOFH
ipAw==
X-Gm-Message-State: AOJu0YwauEdKBZ7a/4t4g64qcscJaserCmH+U8f3ctw5meHnqgTgZQfL
/fXys/buSjFpc/RVyioBxqkw62kLq9WfurilaTqEozwBO+7vCfDoasfVZdm9eKSU7oTQsnC1hvr
rXL/NBEZQfKSb3kNDEmWWdHO2gDesWDafPMj0pANwJ1DvQkQWNx3bCUy/pF0iwXAisw==
X-Gm-Gg: ASbGncvkpz0y5RNvxeum68H2FKS67S2fXR8Jfkjj1Hmy805G8r8y2iwncD2xln38BhM
7VBTtWbdGf9zI1ALNDteZue1RvAm15J7U3S3Os1F2ORyffefZ+pqEFOJknqY8aC/GVNFFjt82ZN
DOeBRD7gCPJfi6sOJJYP5fE+msKVdhAdv4ljjQm3bhE0X82/+QL2Fj9Ptl08KWsp3AD3Xbs5eOg
Tq+bym6itKYNKlwFz08BNVNGqkUrzaO56KAgGRnIRZ4BglgxLgmaBkgLhiMF6rPzGvfO1EvHt7E
dhTz6C2wGVjZhVZI7c/KVH+Azt+V+F86QjhdHFvoqBg1k1SaVnbnynLpbxu7ZdyasA65Rqj52Mf
Law8CE5g4+/suyFlQgpVpPP6LFOWsOoQ=
X-Received: by 2002:a05:6000:2f88:b0:3a4:dd63:4adf with SMTP id ffacd0b85a97d-3a5319a2f10mr2497849f8f.34.1749205710163;
Fri, 06 Jun 2025 03:28:30 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IEKWiQBw/SFRtOD2IfGZYydjryehOqCEDvXvqvtVCdB4/fm2qrI6chgbNP+mu48KPOr7/8IHQ==
X-Received: by 2002:a05:6000:2f88:b0:3a4:dd63:4adf with SMTP id ffacd0b85a97d-3a5319a2f10mr2497824f8f.34.1749205709720;
Fri, 06 Jun 2025 03:28:29 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a532435f94sm1459782f8f.60.2025.06.06.03.28.28
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 03:28:29 -0700 (PDT)
Message-ID: <e5fa4a36-2af8-48e9-811e-680881c06b86@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:28:28 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
Michal Hocko <mhocko@xxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>, Vlastimil Babka
<vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>,
John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
<50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 12:19, Lorenzo Stoakes wrote:
> On Fri, Jun 06, 2025 at 12:13:27PM +0200, Michal Hocko wrote:
>> On Fri 06-06-25 11:01:18, David Hildenbrand wrote:
>>> On 06.06.25 10:31, Michal Hocko wrote:
>> [...]
>>>> Turning them into VM_WARN_ON
>>>> should be reasonably safe as they are not enabled in production
>>>> environment anyway so we cannot really rely on those. Having them in
>>>> WARN form would be still useful for debugging and those that really need
>>>> a crash dump while debugging can achieve the same result.
>>>
>>> One question is if we should be VM_WARN_ON vs. VM_WARN_ON_ONCE ...
>>
>> *WARN_ONCE ha a very limited use from code paths which are generally
>> shared by many callers. You just see one and then nothing. Some time ago
>> we have discussed an option to have _ONCE per call trace but I haven't
>> see any follow up.
>>
>> Anyway starting without _ONCE seems like safer option because we are not
>> losing potentially useful debugging information. Afterall this is
>> debugging only thing. But no strong position on my side.
>>
>>> VM_BUG_ON is essentially a "once" thing so far, but then, we don't continue
>>> ... so probably most should be _ONCE.
>>>
>>>>
>>>> So while I agree that many of them could be dropped or made more clear
>>>> those could be dealt with after a mass move. An advantage of this would
>>>> be that we can drop VM_BUG_ON* and stop new instances from being added.
>>>
>>> As a first step we could probably just #define them to go to the
>>> VM_WARN_ON_* variants and see what happens.
>>
>> You meand VM_BUG_ON expand to VM_WARN_ON by default?
>
> Sorry to interject in the conversation, but to boldly throw my two English pence
> into the mix:
>
> As the "king of churn" (TM) you'll not be surprised to hear that I'm in favour
> of us just doing a big patch and convert all VM_BUG_ON() -> VM_WARN_ON_ONCE()
> and remove VM_BUG_ON*().
>
> Pull the band-aid off... I think better than a #define if this indeed what you
> meant David.
>
> But of course, you'd expect me to have this opinion ;)

See my reply to Michal regarding keeping VM_BUG_ON() until we actually
decided what the right cleanup is.

I don't have a very strong opinion on any of this ... as long as
VM_BUG_ON() goes away one way or the other.

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675602-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D459341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:29:03 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id EFD8B3B1224
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:41 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 795DB2882A3;
Fri, 6 Jun 2025 10:28:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="JFGXqId6"
Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AD41286D6B
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205717; cv=none; b=g2bhwbYzOqFuihTAi0VeLqeDO6ST72KZEtOkQmd6HQ57POEu2hy7zVYI86BatDu4Wx3qSsUPX6qMLc66JvKVwfp8K+yckalswUZI9BdWI60gS/6cMeY+4w5Iwn6OhreYrm/P4TaLAv3vt6gqriW650Aoo/FfTjEv2yvAc7E8444=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205717; c=relaxed/simple;
bh=fb/cqwm8IPgZDM2BO5J8THRZMZ4T6ouGM/u2A4WTIyA=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=kBe9Fk1PV7LxJrEFldAkCaHP1OQJXqi4nt3HTkGIovqyT4ziQBkJgkAYQX+HZ6BXmT7DScrGKqb6neZ9h7NFu1kJC167+47HV+GlaE9oXTy9cINzGRXfJHS8Fk0EuzTCmIB1bqw6sX8+wEhKu2GU4qyQlFSenJulD6BXP4vQhYw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=JFGXqId6; arc=none smtp.client-ip=209.85.128.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com
Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-442fda876a6so16303825e9.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:28:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=suse.com; s=google; t=1749205713; x=1749810513; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=0y7ijdQypxqLTvbk+opJt5eDnn2DOdTCBFw/PW90tvs=;
b=JFGXqId6voMsueIE1FRUlNIp4LyGKvnbrbefU0fkmx6M+Xrenk0IgjRLJUBU/J31d/
VaDQOwRJJ+ARwSODvGMl87d8foVwXBTquNXnzOfGCRYCcv5+lzs527PQGmgwgCWZKhxk
zg4rBl3kilCP3sm5YqEfWQSo/YllMOS/8LrxtR+OhPIDo+aYMF3uG9tYeg49qFIbkFyA
RnWoBZCG7iqHRp2ufzkTIg5WraJL6s9NXdKUeFMLqu06PkxXp4XAgNbKy1uY4Ub6MlZY
qbhsEE6ZvZO8uaU86r4x6qplZ1tWD6OxVYT1MXYUylrXrQwBaSbTU3OaAy+73G/KrBxW
Ys5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205713; x=1749810513;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=0y7ijdQypxqLTvbk+opJt5eDnn2DOdTCBFw/PW90tvs=;
b=ogyRDCAP6ffEgPymAIIq78ZuiqIFs7bojaIgpRSIUbl0G9MPsOzsc6dGqL4d/HOmvx
JOMSg2PMupcQC9He2MHXcVLGRH4GpKZ8fWHJetBXnSEXQ25vPH4Rmk0HT//mrgnlTplE
i3vUwLe3nAlrUFmqgMybhSYkyKqaq9dXa4pLB32tJB3hXg/zo5P6wPoLGfbMXVSZwqzu
akfZLcEPp4YEDtAhfdvOVZCrfd0uAZj2Qy3Hon7HXvF44/eM0v6a8WllIowTZu1F5IUX
PrxavpB4XWONX4W9CrQ2w6fLlg4anVPVlfqs6Q9ROXLhQnD2y87Ye/UDK1Rw6VmcB3qz
yESQ==
X-Forwarded-Encrypted: i=1; AJvYcCUf/oEaM5wHEXaHMHe/+IP8t+JOogPfAeIzmAdY1Tj2jsitvPcxwSIflpCk1IC5QHB7m2oCbFXKu1iTnnc=@vger.kernel.org
X-Gm-Message-State: AOJu0Yynt+LnEsn71C6NcGQXaYezTMWk9FUFDHFbXPMZ6KzpK8WMICqm
3X4aQUbnSaZul5iLdy/AAd95DYxx8VHYicCMOjLqHp0bLMyZmmvc4EnoHKUa5tX2/2I=
X-Gm-Gg: ASbGnctEBHdwlE2SMY/ErCY6Ko63MVqZU9Cm+ptkh1/NRVzlJdndnGpGjy69bXxbeBp
2zGAptyY88OmIjQqm/DHnxsye/fkGhqS3O+oeA2pRw32LSc+aoexLuAqkFcJesYoFTggesaCdJ/
yDGj50O7qbn4Ad3xUmFS830NAp9vYQrhWZOvU8f+9OfLXOjwMxQlEPFYUkwSAhjqHgCITeb/3g3
5GamaG8tH8avCBcceqLMyMbwC3shP1f8fo3w8Y0eE0nFnsHsfnKirHqO7aDFYEHlX1R8XINgxe5
AMHRsYoux0dIfUatBq3fpcGNOiOOuN+NPAUbRZ2C0tdWnPeuruDDxbSZLUBCPzeWPDKxdHROpHQ
=
X-Google-Smtp-Source: AGHT+IGCtW3+HsBx2trqj05+wy5vuf0bHkM0mnvh4NmRgCfrhoDGHG+3c937IQeNhCYs4Lgn9vMx7Q==
X-Received: by 2002:a05:600c:8b72:b0:43d:9f2:6274 with SMTP id 5b1f17b1804b1-45201360d06mr30369075e9.14.1749205713596;
Fri, 06 Jun 2025 03:28:33 -0700 (PDT)
Received: from localhost (109-81-91-107.rct.o2.cz. [109.81.91.107])
by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a53229ddebsm1474197f8f.17.2025.06.06.03.28.33
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:28:33 -0700 (PDT)
Date: Fri, 6 Jun 2025 12:28:32 +0200
From: Michal Hocko <mhocko@xxxxxxxx>
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Jason Gunthorpe <jgg@xxxxxxxx>, John Hubbard <jhubbard@xxxxxxxxxx>,
Peter Xu <peterx@xxxxxxxxxx>
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
Message-ID: <aELC0KqiTttqJNs-@tiehlicka>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
<50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri 06-06-25 11:19:28, Lorenzo Stoakes wrote:
> As the "king of churn" (TM) you'll not be surprised to hear that I'm in favour
> of us just doing a big patch and convert all VM_BUG_ON() -> VM_WARN_ON_ONCE()
> and remove VM_BUG_ON*().

Yes please! I really think this is the most viable way to get rid of
VM_BUG_ON which I believe is a generally agreed way to go.

Thanks and let there be a force with your boldness.
--
Michal Hocko
SUSE Labs


Return-Path: <linux-kernel+bounces-675603-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A5B5741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:29:57 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 61D447AA0AB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:28 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 59F4C287500;
Fri, 6 Jun 2025 10:29:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="vY5ufT6Y"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 E4BCE286D48;
Fri, 6 Jun 2025 10:29:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205774; cv=none; b=Ygct07elApVtFQgjlLljN1Uq5/6p6aal4gl6MmSpYn0+yX1bmy7SuHbL9u114s8J+2e9HAJGNkj8FGRiN99wLN+zPHZ4W0JsPjb3DhtvBtiasHcA/e08RJAtuu4yT3AbIcIWfZntnQdXPuEeFeX91wRJjFs/O/Y6cDf4J62WS9c=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205774; c=relaxed/simple;
bh=txbxer0KAPdPC189YbZbWLopsJnSLNb/anti8PSwHIM=;
h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=HHkJDnoaYLSfy6aGsBegyY7jr2WTAr/qhngHlkaNRNs5Gm4hWREdZCprvpYTaOrGea+Ks2mgUxVqV4I1mgNytVDQUbKiWRdH5hz70A5l8RvkU9NvV9JAT8HdK0kLmpx5BkCHBb0hWAVHWawsikWtyC4mh45PrsyCdf+oxVHRL6s=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=vY5ufT6Y; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 92ECB11DD;
Fri, 6 Jun 2025 12:29:25 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749205766;
bh=txbxer0KAPdPC189YbZbWLopsJnSLNb/anti8PSwHIM=;
h=From:Subject:Date:To:Cc:From;
b=vY5ufT6YH5BJ6+pQUGtxa6/DA4Tfymt4RXZJ0AiPdAoJZRZwjsxpsK3xpFASk1rrG
MLYLifH1qAqT6blZ8hDkzZPYPH/Wt1AFZmugkmhPtZ3mGksLeGPDaztoo3n34qUR1+
gg1fj/+AmO1/PxzDCvOxiagjJikOuqtckwItaADw=
From: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: [PATCH v7 0/4] media: pisp-be: Split jobs creation and scheduling
Date: Fri, 06 Jun 2025 12:29:20 +0200
Message-Id: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
X-B4-Tracking: v=1; b=H4sIAADDQmgC/5WNQQqDMBBFryJZd0qibYpd9R7FRXRGnaJJyIi0i
Hdv6g0Kf/M+n/82JZSYRN2LTSVaWTj4DLdTobrR+YGAMbMqdXnRdaUhssSWYHbsJ/YEEide4BV
agbzH3A2wWjBX7IwlY6hyKp/FRD2/D9GzyTyyLCF9Du9qf+3fihwNtkKr+xrR6P7BSE6Cb4NLe
O7CrJp937+VDhfn4wAAAA==
X-Change-ID: 20240930-pispbe-mainline-split-jobs-handling-v6-15dc16e11e3a
To: Naushir Patuck <naush@xxxxxxxxxxxxxxx>,
Nick Hollinghurst <nick.hollinghurst@xxxxxxxxxxxxxxx>,
David Plowman <david.plowman@xxxxxxxxxxxxxxx>,
Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Raspberry Pi Kernel Maintenance <kernel-list@xxxxxxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
Hans Verkuil <hverkuil@xxxxxxxxx>
Cc: linux-media@xxxxxxxxxxxxxxx, linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>, stable@xxxxxxxxxxxxxxx
X-Mailer: b4 0.15-dev-c25d1
X-Developer-Signature: v=1; a=openpgp-sha256; l=3076;
i=jacopo.mondi@xxxxxxxxxxxxxxxx; h=from:subject:message-id;
bh=txbxer0KAPdPC189YbZbWLopsJnSLNb/anti8PSwHIM=;
b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoQsMIO75DdqfQ/t8A6NKKf9eAFUOd+N9w6nemF
8qPNi9sQJuJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaELDCAAKCRByNAaPFqFW
PBGID/0Ut910UF1VVZnqZg7XfAARRO10t1TXpcUMY9GBM+jh+2JRp6sYkAC7IhQRlb70AENym/Q
wekFzbnB92U5VLc7PL8oD/hHOkIWiXt5nARfjf4MYHFfZ+hA59lDu/U2E3bT0c43GTyVwDWdamD
3uFZKvhpp3iTwbH0CjCnTAesJZms9O/buNaXiuVOew3bWW6t8s255iXY8I4mlGXjoSD+1J9cEsj
5ZExVW/edUKPHRnUnpLFyCFe2Q+ybisjmjClCUq0F+5LkXjB0kxT+1eoJopcC+VnX4O15izPdpF
xrBWgyuoQnyK0bQfCt7c/QT3o5arCVdEl9SYRapPYsusKqNwoJtWRSFjybnjPNKTTOTEd77dU2W
qpJB1qB500vzbTdc/tmwBlSU5LIkdgI2u6dDsSzGGOBAy/dC1R7nQsfrRFO9a/rnXzeN+IQWiar
xH47zSFqsUC4Wx32ATkGUXybko/dhBVdS9W2D0i3lyjc539EDJFW9Vj9yK0da4o7uJ5Q7gU5Xn2
U9pcqfiIRBNm6TAY4JlRN5QUKCKooJbGKkKyUs9G0AdJFuuWu4U2Mdg9LtaHLwxdgkta5DDcWj0
hhdpVJXNXX0+8I+OqRtrztwIJOikHyiqq8vG8SKBzbyw35PiJme8zSVTxXNFSmzywaD8z02x/8u
2xXElPRfUFiRAMQ==
X-Developer-Key: i=jacopo.mondi@xxxxxxxxxxxxxxxx; a=openpgp;
fpr=72392EDC88144A65C701EA9BA5826A2587AD026B
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Currently the 'pispbe_schedule()' function does two things:

1) Tries to assemble a job by inspecting all the video node queues
to make sure all the required buffers are available
2) Submit the job to the hardware

The pispbe_schedule() function is called at:

- video device start_streaming() time
- video device qbuf() time
- irq handler

As assembling a job requires inspecting all queues, it is a rather
time consuming operation which is better not run in IRQ context.

To avoid executing the time consuming job creation in interrupt
context, split the job creation and job scheduling in two distinct
operations. When a well-formed job is created, append it to the
newly introduced 'pispbe->job_queue' where it will be dequeued from
by the scheduling routine.

At start_streaming() and qbuf() time immediately try to schedule a job
if one has been created as the irq handler routine is only called when
a job has completed, and we can't solely rely on it for scheduling new
jobs.

Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
---
Changes in v7:
- Rebased on media-committers/next
- Fix lockdep warning by using the proper spinlock_irq() primitive in
pispbe_prepare_job() which can race with the IRQ handler
- Link to v6: https://lore.kernel.org/r/20240930-pispbe-mainline-split-jobs-handling-v6-v6-0-63d60f9dd10f@xxxxxxxxxxxxxxxx

v5->v6:
- Make the driver depend on PM
- Simplify the probe() routine by using pm_runtime_
- Remove suspend call from remove()

v4->v5:
- Use appropriate locking constructs:
- spin_lock_irq() for pispbe_prepare_job() called from non irq context
- spin_lock_irqsave() for pispbe_schedule() called from irq context
- Remove hw_lock from ready_queue accesses in stop_streaming and
start_streaming
- Fix trivial indentation mistake in 4/4

v3->v4:
- Expand commit message in 2/4 to explain why removing validation in schedule()
is safe
- Drop ready_lock spinlock
- Use non _irqsave version of safe_guard(spinlock
- Support !CONFIG_PM in 4/4 by calling the enable/disable routines directly
and adjust pm_runtime usage as suggested by Laurent

v2->v3:
- Mark pispbe_runtime_resume() as __maybe_unused
- Add fixes tags where appropriate

v1->v2:
- Add two patches to address Laurent's comments separately
- use scoped_guard() when possible
- Add patch to fix runtime_pm imbalance

---
Jacopo Mondi (4):
media: pisp_be: Drop reference to non-existing function
media: pisp_be: Remove config validation from schedule()
media: pisp_be: Split jobs creation and scheduling
media: pisp_be: Fix pm_runtime underrun in probe

drivers/media/platform/raspberrypi/pisp_be/Kconfig | 1 +
.../media/platform/raspberrypi/pisp_be/pisp_be.c | 187 ++++++++++-----------
2 files changed, 90 insertions(+), 98 deletions(-)
---
base-commit: 5e1ff2314797bf53636468a97719a8222deca9ae
change-id: 20240930-pispbe-mainline-split-jobs-handling-v6-15dc16e11e3a

Best regards,
--
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675604-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0E82441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:30:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6204A7AA364
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 17617287517;
Fri, 6 Jun 2025 10:29:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fulbXStv"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 C01CB286D72;
Fri, 6 Jun 2025 10:29:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205775; cv=none; b=jPSFFvjWgMR6mrZ6GypCqmf9cX7CmIj2NvoyWv4xUs4b3/2jycWd+rpmLx6KDoXF+GBwvJ9w9o2bSbLaCm/COttv0HON7ckgZOVMbKGxfm9XyemtoQtO4elJrxYyctF/FQhxQ9xvc4HllQ2CSPj6rcAxS3zMUDDmBcIb+GV3XJ0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205775; c=relaxed/simple;
bh=He0s+tyNVfHnUMKL1lDOSU+7xlicumSDIBITTA0IwMQ=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=kRJRD1/Li0VqJjtTKOxbgHmm5v1UcskPcT9CaKLT1d53KpdpYzAhGziWeXVHPerb5Cw6P9AEnjt9R5En6ndU+VrJCEoz9XGZ03Tfdj7SWr9bFg9f1MyMiRwpNEskxrEUy3LjTaSpP4+65WAu5sjsqOUqJlX905PexubPA1ELBbQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=fulbXStv; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9C77A1340;
Fri, 6 Jun 2025 12:29:26 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749205767;
bh=He0s+tyNVfHnUMKL1lDOSU+7xlicumSDIBITTA0IwMQ=;
h=From:Date:Subject:References:In-Reply-To:To:Cc:From;
b=fulbXStvWLTGnWN2A5klkVTQroHmlPbqPwV3QlyEmb7anyPGjeyGELJhCLqRZgoBH
01HHbyMRund+RQtQWAOfK20l7a1qDMzq4Bl3dBKNFmAdOH7VgerdLczOv3AgQpLInT
jJpyq4EJ6UDdxV/t3sUbX5TdvS35WWU0ASTbpcm8=
From: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 12:29:21 +0200
Subject: [PATCH v7 1/4] media: pisp_be: Drop reference to non-existing
function
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-1-46169f0622b7@xxxxxxxxxxxxxxxx>
References: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
In-Reply-To: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
To: Naushir Patuck <naush@xxxxxxxxxxxxxxx>,
Nick Hollinghurst <nick.hollinghurst@xxxxxxxxxxxxxxx>,
David Plowman <david.plowman@xxxxxxxxxxxxxxx>,
Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Raspberry Pi Kernel Maintenance <kernel-list@xxxxxxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
Hans Verkuil <hverkuil@xxxxxxxxx>
Cc: linux-media@xxxxxxxxxxxxxxx, linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
X-Mailer: b4 0.15-dev-c25d1
X-Developer-Signature: v=1; a=openpgp-sha256; l=1155;
i=jacopo.mondi@xxxxxxxxxxxxxxxx; h=from:subject:message-id;
bh=He0s+tyNVfHnUMKL1lDOSU+7xlicumSDIBITTA0IwMQ=;
b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoQsMIGt1fda006Td2LBAA5RnOpAz2jRvhSDLeH
d/T88NxQzGJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaELDCAAKCRByNAaPFqFW
PDOvD/9DtemdGJeu46ceFrfKReelpDD0ARPiehQx9Q3Fesv2XCKxRDYPras92HBq2nV3tTuGMAR
vFUIgqziS7COcYUU+cjBC7kPMzWxnY7bjtQW4D9WPdCnKgumq7fOPrIDGiJmxvQv8XWY0dZpPNV
gGCoS2l/wXlZxX3W7CXtLJ5sRbiKhD6vLnzQx071Ao05sK9N2WsmJA/2vqgZKZmoWaBgxl+LL1J
y/DHtKdaL27MerUcQ8dU1ZlZ+MwDRrj/l3d8hcI1tq3/xsCOGefkQBhmEYRyfrcAVkVTsfLUqj5
dANQbKmUNeIINPlQ5d3Gg4suvCGycGR8P3f8scTd1byHPwHpxbT6DVwlMy/JL6LieG6ircf43FH
n4rUmFPzrzhDTeN24PK2kZl19rUYFNh9zBvj0JQmqL4oz3lvNi8bn3TDEeFpTlk7yYmTgEAqPOL
hTSV3633VzS90DU9zAngZ8bT37Yx5pWpfm+m93+UYgm9EJuZcg9HM0wL8BEK0RLa3CLpjc50y7D
j+pIJ6x6q5zKwFY3HSApDdpqrt8P7B8xW7oW+H+QLyNM809ZWr/ZHXCPMdLa6xGaRegfHHm4L25
1NniFBdNIW6XeS4SstPjaGC6I9isRb6Qklk8oFzhTdb095Ef52N6O58ZVLgA0vOayAbYsnMX7lp
jICGNfv5DkSJjAg==
X-Developer-Key: i=jacopo.mondi@xxxxxxxxxxxxxxxx; a=openpgp;
fpr=72392EDC88144A65C701EA9BA5826A2587AD026B
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

A comment in the pisp_be driver references the
pispbe_schedule_internal() function which doesn't exist.

Drop it.

Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/raspberrypi/pisp_be/pisp_be.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
index 7596ae1f7de6..b1449245f394 100644
--- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
+++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
@@ -368,10 +368,7 @@ static void pispbe_xlate_addrs(struct pispbe_dev *pispbe,
ret = pispbe_get_planes_addr(addrs, buf[MAIN_INPUT_NODE],
&pispbe->node[MAIN_INPUT_NODE]);
if (ret <= 0) {
- /*
- * This shouldn't happen; pispbe_schedule_internal should insist
- * on an input.
- */
+ /* Shouldn't happen, we have validated an input is available. */
dev_warn(pispbe->dev, "ISP-BE missing input\n");
hw_en->bayer_enables = 0;
hw_en->rgb_enables = 0;

--
2.49.0



Return-Path: <linux-kernel+bounces-675606-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A974D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:30:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id B86D13B12F1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:30:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AEAF12882CE;
Fri, 6 Jun 2025 10:29:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Ze36v+A2"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 663BD2882AE;
Fri, 6 Jun 2025 10:29:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205779; cv=none; b=Hkm902TZK7bV0RRtZfciShgqx3AvUQpSMimtWap3XRHfUTmbj1V+Sn15ArnHpB5Kt8ocTeYMCuSRR3JsnRvNrEXftGRlaJFzNCcEVDop0UUA5mFkvFAEqNd0A7gBDy18nqpT29NSMm45pYC6qL54BqTxTALjAfMkAOlgMoLJIOg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205779; c=relaxed/simple;
bh=8CEzxdIV+2aRtC0PtQKkli9DkHXfXShenAcDp/owwRY=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=L8qboqDv0UPPqiMDs8OvoVWjy3jE9KflYsz2L6Qc9NoWYUsi6wX3Giv3IqJCWUJj+D62m5FkvJYqFL9ksmjWkdPZ8+0tJX8Yx3x/YSxW5axhhFdzwldTdL4wDyeHArc4l0uMdFOX3TL9zEU6VQqcIBW2TV1ZvCxipn6G/M5gg8Q=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Ze36v+A2; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8B5BA149B;
Fri, 6 Jun 2025 12:29:28 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749205769;
bh=8CEzxdIV+2aRtC0PtQKkli9DkHXfXShenAcDp/owwRY=;
h=From:Date:Subject:References:In-Reply-To:To:Cc:From;
b=Ze36v+A21xfr61znbfxYt4Rk4zxuLKsTvpN4xS3IcvO+gJr34cyhKkBFoG03c+Zm0
lZSo0gH+68a7yGZKND7LY9EcBVPjhptS2BAaeLZnmrmzNiMoHmRBlwOuO+KZV/RzcW
FqKxiFBl/od/cE0bXIxcr/iMfNZ61T3qe3eEjTG8=
From: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 12:29:23 +0200
Subject: [PATCH v7 3/4] media: pisp_be: Split jobs creation and scheduling
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-3-46169f0622b7@xxxxxxxxxxxxxxxx>
References: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
In-Reply-To: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
To: Naushir Patuck <naush@xxxxxxxxxxxxxxx>,
Nick Hollinghurst <nick.hollinghurst@xxxxxxxxxxxxxxx>,
David Plowman <david.plowman@xxxxxxxxxxxxxxx>,
Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Raspberry Pi Kernel Maintenance <kernel-list@xxxxxxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
Hans Verkuil <hverkuil@xxxxxxxxx>
Cc: linux-media@xxxxxxxxxxxxxxx, linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
X-Mailer: b4 0.15-dev-c25d1
X-Developer-Signature: v=1; a=openpgp-sha256; l=12686;
i=jacopo.mondi@xxxxxxxxxxxxxxxx; h=from:subject:message-id;
bh=8CEzxdIV+2aRtC0PtQKkli9DkHXfXShenAcDp/owwRY=;
b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoQsMJIQuMTolpJr/4egEnJNl3dkYnu8L3fh3Gf
wPmHtDWIfyJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaELDCQAKCRByNAaPFqFW
PA64EADDySBRRHXygcfzeR5Tz6wsWq8pwNjcsAjr2sjDeI5tU2GjdZ8CEZYGZK/rukOJBdU/SLH
TY9bx+H+SJ3/G1s24BSUHFAGDqz4JxRm4BkWP6Wpvhhq5N0Vczsd/SCgo0vcX/lKLYA0ejnSz4B
qzhrUWiWSpj/rZi59wM3yS/NK1ccQqPIiXTCwIj46e9woIwFE1/01WLqOxGxP6Opw9PNPCGaBUg
P8Xt3g+Rpnhl5YCeQDHJ/PNuInEmwp3yrdI09dg7td8t5bVDKxwOXWxMCyPZKq5MWeDso+cRD1B
R6mg56sMvJXBlpLiAo5fqZiFLjvKN7KIRdVS61m0N8S/CY26ZMdviHleiEyH/I4mjPfRGXbnAIB
8MTIaOlwLxw1QW4Cf7hszfPU48HnVt6/GreK3QxuRMScmXXb47q1NbKE3+p7SkbIa9hznviFknM
GA4BnSM3b5agSmitdao7YBWirszsEXw8NFGHdXb6OmMaQy/ckA+pGLCH9myyWwhXalbrcuGpg4w
1E0GlVz+iXCKt/TreWgSnlgade2elKfsH595lHyLTRzC982aYB/DAg2NkAOGc0l09jNXQUihPJX
Nfd8aYFG7BV4l5jvBfOHtCsIb6I/dqqg2N8VuXVIo4HWicyiVI2VVkKB/OnXR7xixWdHLwgBZgs
yupODJLPudPjCAQ==
X-Developer-Key: i=jacopo.mondi@xxxxxxxxxxxxxxxx; a=openpgp;
fpr=72392EDC88144A65C701EA9BA5826A2587AD026B
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Currently the 'pispbe_schedule()' function does two things:

1) Tries to assemble a job by inspecting all the video node queues
to make sure all the required buffers are available
2) Submit the job to the hardware

The pispbe_schedule() function is called at:

- video device start_streaming() time
- video device qbuf() time
- irq handler

As assembling a job requires inspecting all queues, it is a rather
time consuming operation which is better not run in IRQ context.

To avoid the executing the time consuming job creation in interrupt
context split the job creation and job scheduling in two distinct
operations. When a well-formed job is created, append it to the
newly introduced 'pispbe->job_queue' where it will be dequeued from
by the scheduling routine.

As the per-node 'ready_queue' buffer list is only accessed in vb2
ops callbacks, protected by a mutex, it is not necessary to guard it
with a dedicated spinlock so drop it. Also use the spin_lock_irq()
variant in all functions not called from an IRQ context where the
spin_lock_irqsave() version was used.

Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
---
.../media/platform/raspberrypi/pisp_be/pisp_be.c | 152 +++++++++++----------
1 file changed, 79 insertions(+), 73 deletions(-)

diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
index 92c452891d6c..c25f7d9b404c 100644
--- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
+++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
@@ -161,8 +161,6 @@ struct pispbe_node {
struct mutex node_lock;
/* vb2_queue lock */
struct mutex queue_lock;
- /* Protect pispbe_node->ready_queue and pispbe_buffer->ready_list */
- spinlock_t ready_lock;
struct list_head ready_queue;
struct vb2_queue queue;
struct v4l2_format format;
@@ -190,6 +188,8 @@ struct pispbe_hw_enables {

/* Records a job configuration and memory addresses. */
struct pispbe_job_descriptor {
+ struct list_head queue;
+ struct pispbe_buffer *buffers[PISPBE_NUM_NODES];
dma_addr_t hw_dma_addrs[N_HW_ADDRESSES];
struct pisp_be_tiles_config *config;
struct pispbe_hw_enables hw_enables;
@@ -215,8 +215,10 @@ struct pispbe_dev {
unsigned int sequence;
u32 streaming_map;
struct pispbe_job queued_job, running_job;
- spinlock_t hw_lock; /* protects "hw_busy" flag and streaming_map */
+ /* protects "hw_busy" flag, streaming_map and job_queue */
+ spinlock_t hw_lock;
bool hw_busy; /* non-zero if a job is queued or is being started */
+ struct list_head job_queue;
int irq;
u32 hw_version;
u8 done, started;
@@ -440,41 +442,47 @@ static void pispbe_xlate_addrs(struct pispbe_dev *pispbe,
* For Output0, Output1, Tdn and Stitch, a buffer only needs to be
* available if the blocks are enabled in the config.
*
- * Needs to be called with hw_lock held.
+ * If all the buffers required to form a job are available, append the
+ * job descriptor to the job queue to be later queued to the HW.
*
* Returns 0 if a job has been successfully prepared, < 0 otherwise.
*/
-static int pispbe_prepare_job(struct pispbe_dev *pispbe,
- struct pispbe_job_descriptor *job)
+static int pispbe_prepare_job(struct pispbe_dev *pispbe)
{
struct pispbe_buffer *buf[PISPBE_NUM_NODES] = {};
+ struct pispbe_job_descriptor *job;
+ unsigned int streaming_map;
unsigned int config_index;
struct pispbe_node *node;
- unsigned long flags;

- lockdep_assert_held(&pispbe->hw_lock);
+ scoped_guard(spinlock_irq, &pispbe->hw_lock) {
+ static const u32 mask = BIT(CONFIG_NODE) | BIT(MAIN_INPUT_NODE);

- memset(job, 0, sizeof(struct pispbe_job_descriptor));
+ if ((pispbe->streaming_map & mask) != mask)
+ return -ENODEV;

- if (((BIT(CONFIG_NODE) | BIT(MAIN_INPUT_NODE)) &
- pispbe->streaming_map) !=
- (BIT(CONFIG_NODE) | BIT(MAIN_INPUT_NODE)))
- return -ENODEV;
+ /*
+ * Take a copy of streaming_map: nodes activated after this
+ * point are ignored when preparing this job.
+ */
+ streaming_map = pispbe->streaming_map;
+ }
+
+ job = kzalloc(sizeof(*job), GFP_KERNEL);
+ if (!job)
+ return -ENOMEM;

node = &pispbe->node[CONFIG_NODE];
- spin_lock_irqsave(&node->ready_lock, flags);
buf[CONFIG_NODE] = list_first_entry_or_null(&node->ready_queue,
struct pispbe_buffer,
ready_list);
- if (buf[CONFIG_NODE]) {
- list_del(&buf[CONFIG_NODE]->ready_list);
- pispbe->queued_job.buf[CONFIG_NODE] = buf[CONFIG_NODE];
+ if (!buf[CONFIG_NODE]) {
+ kfree(job);
+ return -ENODEV;
}
- spin_unlock_irqrestore(&node->ready_lock, flags);

- /* Exit early if no config buffer has been queued. */
- if (!buf[CONFIG_NODE])
- return -ENODEV;
+ list_del(&buf[CONFIG_NODE]->ready_list);
+ job->buffers[CONFIG_NODE] = buf[CONFIG_NODE];

config_index = buf[CONFIG_NODE]->vb.vb2_buf.index;
job->config = &pispbe->config[config_index];
@@ -495,7 +503,7 @@ static int pispbe_prepare_job(struct pispbe_dev *pispbe,
continue;

buf[i] = NULL;
- if (!(pispbe->streaming_map & BIT(i)))
+ if (!(streaming_map & BIT(i)))
continue;

if ((!(rgb_en & PISP_BE_RGB_ENABLE_OUTPUT0) &&
@@ -522,25 +530,25 @@ static int pispbe_prepare_job(struct pispbe_dev *pispbe,
node = &pispbe->node[i];

/* Pull a buffer from each V4L2 queue to form the queued job */
- spin_lock_irqsave(&node->ready_lock, flags);
buf[i] = list_first_entry_or_null(&node->ready_queue,
struct pispbe_buffer,
ready_list);
if (buf[i]) {
list_del(&buf[i]->ready_list);
- pispbe->queued_job.buf[i] = buf[i];
+ job->buffers[i] = buf[i];
}
- spin_unlock_irqrestore(&node->ready_lock, flags);

if (!buf[i] && !ignore_buffers)
goto err_return_buffers;
}

- pispbe->queued_job.valid = true;
-
/* Convert buffers to DMA addresses for the hardware */
pispbe_xlate_addrs(pispbe, job, buf);

+ scoped_guard(spinlock_irq, &pispbe->hw_lock) {
+ list_add_tail(&job->queue, &pispbe->job_queue);
+ }
+
return 0;

err_return_buffers:
@@ -551,33 +559,39 @@ static int pispbe_prepare_job(struct pispbe_dev *pispbe,
continue;

/* Return the buffer to the ready_list queue */
- spin_lock_irqsave(&n->ready_lock, flags);
list_add(&buf[i]->ready_list, &n->ready_queue);
- spin_unlock_irqrestore(&n->ready_lock, flags);
}

- memset(&pispbe->queued_job, 0, sizeof(pispbe->queued_job));
+ kfree(job);

return -ENODEV;
}

static void pispbe_schedule(struct pispbe_dev *pispbe, bool clear_hw_busy)
{
- struct pispbe_job_descriptor job;
- unsigned long flags;
- int ret;
+ struct pispbe_job_descriptor *job;
+
+ scoped_guard(spinlock_irqsave, &pispbe->hw_lock) {
+ if (clear_hw_busy)
+ pispbe->hw_busy = false;
+
+ if (pispbe->hw_busy)
+ return;

- spin_lock_irqsave(&pispbe->hw_lock, flags);
+ job = list_first_entry_or_null(&pispbe->job_queue,
+ struct pispbe_job_descriptor,
+ queue);
+ if (!job)
+ return;

- if (clear_hw_busy)
- pispbe->hw_busy = false;
+ list_del(&job->queue);

- if (pispbe->hw_busy)
- goto unlock_and_return;
+ for (unsigned int i = 0; i < PISPBE_NUM_NODES; i++)
+ pispbe->queued_job.buf[i] = job->buffers[i];
+ pispbe->queued_job.valid = true;

- ret = pispbe_prepare_job(pispbe, &job);
- if (ret)
- goto unlock_and_return;
+ pispbe->hw_busy = true;
+ }

/*
* We can kick the job off without the hw_lock, as this can
@@ -585,16 +599,8 @@ static void pispbe_schedule(struct pispbe_dev *pispbe, bool clear_hw_busy)
* only when the following job has been queued and an interrupt
* is rised.
*/
- pispbe->hw_busy = true;
- spin_unlock_irqrestore(&pispbe->hw_lock, flags);
-
- pispbe_queue_job(pispbe, &job);
-
- return;
-
-unlock_and_return:
- /* No job has been queued, just release the lock and return. */
- spin_unlock_irqrestore(&pispbe->hw_lock, flags);
+ pispbe_queue_job(pispbe, job);
+ kfree(job);
}

static void pispbe_isr_jobdone(struct pispbe_dev *pispbe,
@@ -846,18 +852,16 @@ static void pispbe_node_buffer_queue(struct vb2_buffer *buf)
container_of(vbuf, struct pispbe_buffer, vb);
struct pispbe_node *node = vb2_get_drv_priv(buf->vb2_queue);
struct pispbe_dev *pispbe = node->pispbe;
- unsigned long flags;

dev_dbg(pispbe->dev, "%s: for node %s\n", __func__, NODE_NAME(node));
- spin_lock_irqsave(&node->ready_lock, flags);
list_add_tail(&buffer->ready_list, &node->ready_queue);
- spin_unlock_irqrestore(&node->ready_lock, flags);

/*
* Every time we add a buffer, check if there's now some work for the hw
* to do.
*/
- pispbe_schedule(pispbe, false);
+ if (!pispbe_prepare_job(pispbe))
+ pispbe_schedule(pispbe, false);
}

static int pispbe_node_start_streaming(struct vb2_queue *q, unsigned int count)
@@ -865,17 +869,16 @@ static int pispbe_node_start_streaming(struct vb2_queue *q, unsigned int count)
struct pispbe_node *node = vb2_get_drv_priv(q);
struct pispbe_dev *pispbe = node->pispbe;
struct pispbe_buffer *buf, *tmp;
- unsigned long flags;
int ret;

ret = pm_runtime_resume_and_get(pispbe->dev);
if (ret < 0)
goto err_return_buffers;

- spin_lock_irqsave(&pispbe->hw_lock, flags);
- node->pispbe->streaming_map |= BIT(node->id);
- node->pispbe->sequence = 0;
- spin_unlock_irqrestore(&pispbe->hw_lock, flags);
+ scoped_guard(spinlock_irq, &pispbe->hw_lock) {
+ node->pispbe->streaming_map |= BIT(node->id);
+ node->pispbe->sequence = 0;
+ }

dev_dbg(pispbe->dev, "%s: for node %s (count %u)\n",
__func__, NODE_NAME(node), count);
@@ -883,17 +886,16 @@ static int pispbe_node_start_streaming(struct vb2_queue *q, unsigned int count)
node->pispbe->streaming_map);

/* Maybe we're ready to run. */
- pispbe_schedule(pispbe, false);
+ if (!pispbe_prepare_job(pispbe))
+ pispbe_schedule(pispbe, false);

return 0;

err_return_buffers:
- spin_lock_irqsave(&pispbe->hw_lock, flags);
list_for_each_entry_safe(buf, tmp, &node->ready_queue, ready_list) {
list_del(&buf->ready_list);
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
}
- spin_unlock_irqrestore(&pispbe->hw_lock, flags);

return ret;
}
@@ -903,7 +905,6 @@ static void pispbe_node_stop_streaming(struct vb2_queue *q)
struct pispbe_node *node = vb2_get_drv_priv(q);
struct pispbe_dev *pispbe = node->pispbe;
struct pispbe_buffer *buf;
- unsigned long flags;

/*
* Now this is a bit awkward. In a simple M2M device we could just wait
@@ -915,11 +916,7 @@ static void pispbe_node_stop_streaming(struct vb2_queue *q)
* This may return buffers out of order.
*/
dev_dbg(pispbe->dev, "%s: for node %s\n", __func__, NODE_NAME(node));
- spin_lock_irqsave(&pispbe->hw_lock, flags);
do {
- unsigned long flags1;
-
- spin_lock_irqsave(&node->ready_lock, flags1);
buf = list_first_entry_or_null(&node->ready_queue,
struct pispbe_buffer,
ready_list);
@@ -927,15 +924,23 @@ static void pispbe_node_stop_streaming(struct vb2_queue *q)
list_del(&buf->ready_list);
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
}
- spin_unlock_irqrestore(&node->ready_lock, flags1);
} while (buf);
- spin_unlock_irqrestore(&pispbe->hw_lock, flags);

vb2_wait_for_all_buffers(&node->queue);

- spin_lock_irqsave(&pispbe->hw_lock, flags);
+ spin_lock_irq(&pispbe->hw_lock);
pispbe->streaming_map &= ~BIT(node->id);
- spin_unlock_irqrestore(&pispbe->hw_lock, flags);
+
+ /* Release all jobs once all nodes have stopped streaming. */
+ if (pispbe->streaming_map == 0) {
+ struct pispbe_job_descriptor *job, *temp;
+
+ list_for_each_entry_safe(job, temp, &pispbe->job_queue, queue) {
+ list_del(&job->queue);
+ kfree(job);
+ }
+ }
+ spin_unlock_irq(&pispbe->hw_lock);

pm_runtime_mark_last_busy(pispbe->dev);
pm_runtime_put_autosuspend(pispbe->dev);
@@ -1393,7 +1398,6 @@ static int pispbe_init_node(struct pispbe_dev *pispbe, unsigned int id)
mutex_init(&node->node_lock);
mutex_init(&node->queue_lock);
INIT_LIST_HEAD(&node->ready_queue);
- spin_lock_init(&node->ready_lock);

node->format.type = node->buf_type;
pispbe_node_def_fmt(node);
@@ -1677,6 +1681,8 @@ static int pispbe_probe(struct platform_device *pdev)
if (!pispbe)
return -ENOMEM;

+ INIT_LIST_HEAD(&pispbe->job_queue);
+
dev_set_drvdata(&pdev->dev, pispbe);
pispbe->dev = &pdev->dev;
platform_set_drvdata(pdev, pispbe);

--
2.49.0



Return-Path: <linux-kernel+bounces-675605-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A547841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:30:37 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 226DD7AAC70
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:59 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F1CD2882CB;
Fri, 6 Jun 2025 10:29:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="er7gwa/t"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 16A88287516;
Fri, 6 Jun 2025 10:29:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205777; cv=none; b=m6Nks+ed82bCPIlcJ7KEPeOlHoBTf4LIGEAKT2Y8NRV8SGS7PFBf7PLdVY1EnhbLhYsb9Ft4z5wXnazxo873F73xTwSJqZodUi9/4W65Sr0PefoAlIUYtCxYmfTAWGYJ2QGke9mSVfgxJmVSp15trZlwSS498Bs6OQLRSUi04bY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205777; c=relaxed/simple;
bh=9MM74xoBnZjeb+7dlcAgIXr4ZI2P++CHv1REUpu+GeY=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=nd8mRtDDOgn3OFa3cvBUx3uLLn1SNvp0Mt27STdTPoZQ1KkximxUv4QuJBt70TtFajgZvL7FcMeDgdTm/iaMqr2g1LNbq/MlGZtFfmyF2FejDk3FDzzx/2pWhtnmvEr5UupQFAnU+aIdYqo6SVqPVn2RFOHf64exwyqaCof6hdc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=er7gwa/t; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 93FEB1449;
Fri, 6 Jun 2025 12:29:27 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749205768;
bh=9MM74xoBnZjeb+7dlcAgIXr4ZI2P++CHv1REUpu+GeY=;
h=From:Date:Subject:References:In-Reply-To:To:Cc:From;
b=er7gwa/tSh7C4H/PxSZsAhdzkpBC6d9YzX0Xc1X+dcVMz4NsSoRAqbo7uSCi9gPRO
ujHcJvb+EYg2cT8HfW3Tqwa6qjZtK5nvIfBofSR1Iy5V51YdSdnV/X1tc63Q9WW9Hd
nDT5vSrL4edUEMVsQIrpRxNrX6Hr2Hv5APrL442o=
From: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 12:29:22 +0200
Subject: [PATCH v7 2/4] media: pisp_be: Remove config validation from
schedule()
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-2-46169f0622b7@xxxxxxxxxxxxxxxx>
References: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
In-Reply-To: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
To: Naushir Patuck <naush@xxxxxxxxxxxxxxx>,
Nick Hollinghurst <nick.hollinghurst@xxxxxxxxxxxxxxx>,
David Plowman <david.plowman@xxxxxxxxxxxxxxx>,
Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Raspberry Pi Kernel Maintenance <kernel-list@xxxxxxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
Hans Verkuil <hverkuil@xxxxxxxxx>
Cc: linux-media@xxxxxxxxxxxxxxx, linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
X-Mailer: b4 0.15-dev-c25d1
X-Developer-Signature: v=1; a=openpgp-sha256; l=2974;
i=jacopo.mondi@xxxxxxxxxxxxxxxx; h=from:subject:message-id;
bh=9MM74xoBnZjeb+7dlcAgIXr4ZI2P++CHv1REUpu+GeY=;
b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoQsMJrEbciS8x2BHdIWih/2w10/v2vY3ocpNYy
+Fd9/iyT8KJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaELDCQAKCRByNAaPFqFW
PGTXD/0UhSC7RVmTpo7+6azLUS7zBmkMT5p/G08Lu2Wz9NEezo5GvXp2P4dx3ruWpU6OowFF/1W
tPjwlj4rC1K1ZG0ZSt1xQFsmr76YjKRUrAHJIsaaKoYYnskRlOKZ2DereCPP2XePKeA7EGp9/iZ
bx9uNfBMbyPvProqMdb65iuiwawNCXQMOUxjGabt5Wi0m0cT9WiEYeULiJE7xDwgRg461bIh1rE
n5CVOC+crpNPBCsUa9ZEQjvKJSCu9sL1hBYupMDV/U6DE39oeNyKbgwZjGxtY6lX+D2HI691YHP
snqwIL+fk52+jAr2PJq6ra0waUAEtQmNFVWD5i+3C98KJ+fbZNIfxA77trkJwCjnoaiQiCHM579
2Msc4h0secTqAh+4K0AE/HJR4BkKK3ifXaXnfu9boznO0KCYlYFIpOoHA5ZoVfpRHm/mYBiI/M/
Wow6KHFqzkaFB14cd/STuDAV2CVB9mePsvcyl9x4Tz0FP0tY8YTe3FyaBmkI32S1rtnjjqKrTh8
wPnH6hR9iEsmvqhNShfZ57smIAPazXg/+eSZTTiS3bBhN9Tf85ruh8WBD1wHd2u6dqoOSqN0Tul
Nj8Dqbm0WyPR3xNtvBSCpokm4Ek1Hk0Dnesf4upKXwH8WCxTbEksz9HUFDpXTEa3S0G6/a1BhVw
2hXbLEgfTTTgQGA==
X-Developer-Key: i=jacopo.mondi@xxxxxxxxxxxxxxxx; a=openpgp;
fpr=72392EDC88144A65C701EA9BA5826A2587AD026B
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The config parameters buffer is already validated in
pisp_be_validate_config() at .buf_prepare() time.

However some of the same validations are also performed at
pispbe_schedule() time. In particular the function checks that:

1) config.num_tiles is valid
2) At least one of the BAYER or RGB input is enabled

The input config validation is already performed in
pisp_be_validate_config() and while job.hw_enables is modified by
pispbe_xlate_addrs(), the function only resets the input masks if

- there is no input buffer available, but pispbe_prepare_job() fails
before calling pispbe_xlate_addrs() in this case
- bayer_enable is 0, but in this case rgb_enable is valid as guaranteed
by pisp_be_validate_config()
- only outputs are reset in rgb_enable

For this reasons there is no need to repeat the check at
pispbe_schedule() time.

The num_tiles validation can be moved to pisp_be_validate_config() as
well. As num_tiles is a u32 it can'be be < 0, so change the sanity
check accordingly.

Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
.../media/platform/raspberrypi/pisp_be/pisp_be.c | 25 ++++++----------------
1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
index b1449245f394..92c452891d6c 100644
--- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
+++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
@@ -588,24 +588,6 @@ static void pispbe_schedule(struct pispbe_dev *pispbe, bool clear_hw_busy)
pispbe->hw_busy = true;
spin_unlock_irqrestore(&pispbe->hw_lock, flags);

- if (job.config->num_tiles <= 0 ||
- job.config->num_tiles > PISP_BACK_END_NUM_TILES ||
- !((job.hw_enables.bayer_enables | job.hw_enables.rgb_enables) &
- PISP_BE_BAYER_ENABLE_INPUT)) {
- /*
- * Bad job. We can't let it proceed as it could lock up
- * the hardware, or worse!
- *
- * For now, just force num_tiles to 0, which causes the
- * H/W to do something bizarre but survivable. It
- * increments (started,done) counters by more than 1,
- * but we seem to survive...
- */
- dev_dbg(pispbe->dev, "Bad job: invalid number of tiles: %u\n",
- job.config->num_tiles);
- job.config->num_tiles = 0;
- }
-
pispbe_queue_job(pispbe, &job);

return;
@@ -703,6 +685,13 @@ static int pisp_be_validate_config(struct pispbe_dev *pispbe,
return -EIO;
}

+ if (config->num_tiles == 0 ||
+ config->num_tiles > PISP_BACK_END_NUM_TILES) {
+ dev_dbg(dev, "%s: Invalid number of tiles: %d\n", __func__,
+ config->num_tiles);
+ return -EINVAL;
+ }
+
/* Ensure output config strides and buffer sizes match the V4L2 formats. */
fmt = &pispbe->node[TDN_OUTPUT_NODE].format;
if (bayer_enables & PISP_BE_BAYER_ENABLE_TDN_OUTPUT) {

--
2.49.0



Return-Path: <linux-kernel+bounces-675607-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 109CB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:30:43 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 22D5A3B12F3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:30:21 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 226AA28852D;
Fri, 6 Jun 2025 10:29:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LyobtJeS"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 B57B42882DF;
Fri, 6 Jun 2025 10:29:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205781; cv=none; b=HARJtwyhYyEwvqr+VJDGf2WEpObqoNryIBD/k+vrpp3YIo0uSrQy0RslWSq/oRCVXAaADnttIBb78QC0irvKXK4DmY8LKJxrpOVHJIYboxGHr1OagwMlBRRMotS7f4R4U1Q1Kf0BU2pIqg0n2cJhT4pvGw9oB/KfK2QptGsYyps=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205781; c=relaxed/simple;
bh=V+Ek8KvYXVxMnGDCEA+ZZupIN9VfOzRn2A+zOM1rIFI=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=oEszg5AlObZLJjADxDWAg0DiKw0+I1UdEYlM9pMZHxwu1HmJEuRXqqts3IcBzhsy2syQVgany+TnJJmLkcU9TSX5JHCRhqWHfbsysxu3tH4dVL+G47CEJZO3GDzemFxHcaUIxzi51MuTW9zDXg4hqRST4TXBwHxBFXsLvGKhcFw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=LyobtJeS; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 910C31648;
Fri, 6 Jun 2025 12:29:29 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749205770;
bh=V+Ek8KvYXVxMnGDCEA+ZZupIN9VfOzRn2A+zOM1rIFI=;
h=From:Date:Subject:References:In-Reply-To:To:Cc:From;
b=LyobtJeSR70kPu/NJewF6WvjT8KSCw1gBtLv2N60eJvVep1KxdIMKo+yJFYWyLxLI
a/C3EctwsYf1Tl0hOPeG0s4X7T4UckFvl716UipY5Rjm9MQKVK3ssUBgVnK6l6RNVj
jMGOzQZDvQXnGUwkQ50NLofmFC+Q7ausn4aZS0Y8=
From: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 12:29:24 +0200
Subject: [PATCH v7 4/4] media: pisp_be: Fix pm_runtime underrun in probe
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-4-46169f0622b7@xxxxxxxxxxxxxxxx>
References: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
In-Reply-To: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-0-46169f0622b7@xxxxxxxxxxxxxxxx>
To: Naushir Patuck <naush@xxxxxxxxxxxxxxx>,
Nick Hollinghurst <nick.hollinghurst@xxxxxxxxxxxxxxx>,
David Plowman <david.plowman@xxxxxxxxxxxxxxx>,
Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Raspberry Pi Kernel Maintenance <kernel-list@xxxxxxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
Hans Verkuil <hverkuil@xxxxxxxxx>
Cc: linux-media@xxxxxxxxxxxxxxx, linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>, stable@xxxxxxxxxxxxxxx
X-Mailer: b4 0.15-dev-c25d1
X-Developer-Signature: v=1; a=openpgp-sha256; l=3094;
i=jacopo.mondi@xxxxxxxxxxxxxxxx; h=from:subject:message-id;
bh=V+Ek8KvYXVxMnGDCEA+ZZupIN9VfOzRn2A+zOM1rIFI=;
b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoQsMJy30vmgezVQQsGohmNhEl7scj92nRO6VT+
83ukN8V4LqJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaELDCQAKCRByNAaPFqFW
PLwBD/4jPLV38ukgCPlmkOKp/S5DffYm09zKURW5qlvF2508WzIcSyvSUqDlH0oc1+OzTnU6uaA
tvkt8OjmyqHCJQGsWQ/K2OSTvs/Q++BngwUkyduUk180Xc3qlpZlI9Qt9QHpsI5imCxa0vFZWzB
7pcP9r2+k/2Npa37fxuS23zrwG9UGcwcHlZAummjU2z4eLQMHfSNgnvUJdwNcOSJMxtjCKxMAtS
p1XUvMATHwzi2DZss2yj/PBjwQv07zIXi+oJAuaaC1vVd9lKlAT55DbxewopHQnTXsJLj52iHqd
tVYHeuuzAuk0ACtEqEkXhJnvI77s8KbWQa0FHEvNfR2UK4TSDrIJqbE74COoyJKSJLQkS/1+x2B
3Oo3AV6uIYMg22nFy5opWcjeDROQJkrSVJNWO4TOAFZ83lsmySSUtxFyY8JH21aLgkYQxMVaZUd
26p6NYdGlMI0Kl9IbwefIuD9UVY62zmVmw5KoOvI8DnGcxGpLQyedyxSyLyAindzmt89jq6ilZ6
8SOpvj/908p9v3uJem0eNt0Ow/ZrhW4PvVAtyw4QBZiAKNjPmPmjc9epAUCLR51ZGdrlIgYrcw9
UEC7p5Q7ks5Pxm7sRpScEDFzqYqN+Nv5tk3mUzog08SKZQpGU/RFDCYAwPFMEd4ourQvHMDCMsW
EIlxkCnCrIBAM4Q==
X-Developer-Key: i=jacopo.mondi@xxxxxxxxxxxxxxxx; a=openpgp;
fpr=72392EDC88144A65C701EA9BA5826A2587AD026B
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

During the probe() routine, the PiSP BE driver needs to power up the
interface in order to identify and initialize the hardware.

The driver resumes the interface by calling the
pispbe_runtime_resume() function directly, without going
through the pm_runtime helpers, but later suspends it by calling
pm_runtime_put_autosuspend().

This causes a PM usage count imbalance at probe time, notified by the
runtime_pm framework with the below message in the system log:

pispbe 1000880000.pisp_be: Runtime PM usage count underflow!

Fix this by resuming the interface using the pm runtime helpers instead
of calling the resume function directly and use the pm_runtime framework
in the probe() error path. While at it, remove manual suspend of the
interface in the remove() function. The driver cannot be unloaded if in
use, so simply disable runtime pm.

To simplify the implementation, make the driver depend on PM as the
RPI5 platform where the ISP is integrated in uses the PM framework by
default.

Fixes: 12187bd5d4f8 ("media: raspberrypi: Add support for PiSP BE")
Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>

--

Cc: stable@xxxxxxxxxxxxxxx
---
drivers/media/platform/raspberrypi/pisp_be/Kconfig | 1 +
drivers/media/platform/raspberrypi/pisp_be/pisp_be.c | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/raspberrypi/pisp_be/Kconfig b/drivers/media/platform/raspberrypi/pisp_be/Kconfig
index 46765a2e4c4d..a9e51fd94aad 100644
--- a/drivers/media/platform/raspberrypi/pisp_be/Kconfig
+++ b/drivers/media/platform/raspberrypi/pisp_be/Kconfig
@@ -3,6 +3,7 @@ config VIDEO_RASPBERRYPI_PISP_BE
depends on V4L_PLATFORM_DRIVERS
depends on VIDEO_DEV
depends on ARCH_BCM2835 || COMPILE_TEST
+ depends on PM
select VIDEO_V4L2_SUBDEV_API
select MEDIA_CONTROLLER
select VIDEOBUF2_DMA_CONTIG
diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
index c25f7d9b404c..e49e4cc322db 100644
--- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
+++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
@@ -1718,7 +1718,7 @@ static int pispbe_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(pispbe->dev);
pm_runtime_enable(pispbe->dev);

- ret = pispbe_runtime_resume(pispbe->dev);
+ ret = pm_runtime_resume_and_get(pispbe->dev);
if (ret)
goto pm_runtime_disable_err;

@@ -1740,7 +1740,7 @@ static int pispbe_probe(struct platform_device *pdev)
disable_devs_err:
pispbe_destroy_devices(pispbe);
pm_runtime_suspend_err:
- pispbe_runtime_suspend(pispbe->dev);
+ pm_runtime_put(pispbe->dev);
pm_runtime_disable_err:
pm_runtime_dont_use_autosuspend(pispbe->dev);
pm_runtime_disable(pispbe->dev);
@@ -1754,7 +1754,6 @@ static void pispbe_remove(struct platform_device *pdev)

pispbe_destroy_devices(pispbe);

- pispbe_runtime_suspend(pispbe->dev);
pm_runtime_dont_use_autosuspend(pispbe->dev);
pm_runtime_disable(pispbe->dev);
}

--
2.49.0



Return-Path: <linux-kernel+bounces-675608-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7573A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:31:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 885563B1298
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:30:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 407272868A4;
Fri, 6 Jun 2025 10:30:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dITYTa3j"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 C1FB7253355
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:30:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205838; cv=none; b=QJp1MBclFWv5YJd/Kz4pNlgeGIG6ODtIwO4kWBfi4ZrTDkbIyZr0oov5NxVfq4FpITs00cheb5ZvlkfofGe9pxnaKrY4bFDAY1xtAce2XhFOV2HwQl8gr88fiQUVDnTrXcxVpqdLgWrSHI9MaOt1DOUkC5wD2VxwueV/OdQyAUk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205838; c=relaxed/simple;
bh=3Z5xaT5zKkEE4PAdWP7WsmhS5IlnEFQjdxzTWBMpMTA=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=h0UmX16Ryiyo7sS50a4R7ijw2U2TkfknjYivO5+EwlT9QPiyPHrzMQV4Aekr8CVN4Zboy7a6AAW0oQ0pku03NvXOFpsXrwBjtjC75BXCC0ebn7KawPMlVWZlJff6URILzJ/hLMdHI5wB1x01tBUWAZZ79f06y9yiUE8Mz2QGzxI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dITYTa3j; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749205835;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=2bTEZ1vLd2ySBvqwuRAeBvN6sKQAY124DUV80JjBS0w=;
b=dITYTa3jlqQ82cagOCgc0FdmFaWKP4S8/NlqBwEf1HisfGwO1cWrmtI/02fvx+vFZUKP8n
AbsetQK9EsDgb8XLTz4/lzk0NOpJQYEHXmguMo5Eaq53udo2B2QH9RWfBn1R00A2RzfA5K
ZD1r5Gu9s/vALF9GMe/bDWN9Faf/zJw=
Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com
[209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-74-UCWrq5oTMJCjN6uROokifA-1; Fri, 06 Jun 2025 06:30:34 -0400
X-MC-Unique: UCWrq5oTMJCjN6uROokifA-1
X-Mimecast-MFC-AGG-ID: UCWrq5oTMJCjN6uROokifA_1749205833
Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3a5058f9ef4so1052745f8f.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:30:33 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205833; x=1749810633;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=2bTEZ1vLd2ySBvqwuRAeBvN6sKQAY124DUV80JjBS0w=;
b=DxNxtH+QljUcaVfeZLm5vCHOXkOVUIDrzJCcaQSADP7cULpxtM9WJrnpLSdbtoJPJX
K2gQwqozCD3XAXfZ0vDuqy3LxIr8O+ifOqrUeOeDD00wZXFt7UWnvYrEwXpL+dQAPdYa
th7vG9HX8oAjZXYosizuRNWdfT4/DAJUOowaI9hZR+gly5A/Vncfykw5c+eAub1CVawQ
I0bCHCTaMgDdQP3StQ/0cHrbMHYY9zCeCRzf9823v4Bbuc6sHgNEhqLoWZQU1prqkvSv
IBa2ZOm48sr5tWaLHLl3NpNS/hgyK0OZYPzWUDyOKkHSRyJsq074zvhtgzxeQtRrL5i+
6L4Q==
X-Forwarded-Encrypted: i=1; AJvYcCV4BXJW74P28OwIfXRuCU6UYellssBxQznaewYbXn1aIBeQOvB8kNfAGO99NtjUnyHRmcrQZ2FhEJ1zP2U=@vger.kernel.org
X-Gm-Message-State: AOJu0YzTC2yfFoaRSM2eDLrNrkx4JcwNWVN3vgA7q2fviYypOcnmtb97
yqgm0ixV277hlHH55ScstZ70QjMUVHyQKiubNp8Gq4qomq2CtJt7RUU32BGkYB0cG6iW9yuIF04
Rz1siO0REggsYbG6qI1e/0DMQxQStp1YXF0SjiCKEli0JMe91DW6bOqZzYwT4aUdi1w==
X-Gm-Gg: ASbGncvZm0G0R/i6DmUObCdEoZyK3u0SNtlb72OA4SChFEX0L9pyQwrXFnUfbzlvxpU
0VJrucZJQCvD0ayDTP3RoqUwXCUvYaV1XYT1qP9NDffZc1ZCs/kvPcqnwsDVDwL3a8/gE6hbAeP
4rS0x48h6ZvP+4uftlUGn29wjx7mlHMF85CZvhkGIZN4DLbYcI8fmjXioWtix6Ntz19VCCbsmX/
2NeG6DA6jaS0rjVqbPI9pBkXGHWFf1yP4MmCrneWYxMg7GVXwL1Qe9hCgDlsBczXC7rRqDLMPlK
hHgFL7QX+7cOXU14V8eW+l5Flr/tYR/XekhNIGmDPdsKb5nDaZaGP8971ixkbw8Ed1sHLiUkXdE
KttIyr6JMy6kNaBnvLTNwIBMfJF5reUvKhalCD4kCjw==
X-Received: by 2002:a5d:5c84:0:b0:3a5:2182:bd11 with SMTP id ffacd0b85a97d-3a53189b6d1mr2385096f8f.20.1749205832822;
Fri, 06 Jun 2025 03:30:32 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHZ8zn1DJwYaoBTRpNkad0mZiAjY2iLHqkNZy1mWBuUYEv02AEOeaCRfW88O1wnKzjCVIId1A==
X-Received: by 2002:a5d:5c84:0:b0:3a5:2182:bd11 with SMTP id ffacd0b85a97d-3a53189b6d1mr2385070f8f.20.1749205832424;
Fri, 06 Jun 2025 03:30:32 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a532463905sm1468475f8f.92.2025.06.06.03.30.31
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 03:30:31 -0700 (PDT)
Message-ID: <59559bf8-fded-458d-9e6e-5bdfd5cbd816@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:30:30 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] selftests/mm: Skip failed memfd setups in gup_longterm
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>
Cc: Shuah Khan <shuah@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kselftest@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
References: <20250605-selftest-mm-gup-longterm-tweaks-v1-1-2fae34b05958@xxxxxxxxxx>
<20250605180421.c8d8c48f3e340f9488937ab7@xxxxxxxxxxxxxxxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250605180421.c8d8c48f3e340f9488937ab7@xxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 03:04, Andrew Morton wrote:
> On Thu, 05 Jun 2025 22:34:31 +0100 Mark Brown <broonie@xxxxxxxxxx> wrote:
>
>> Unlike the other cases gup_longterm's memfd tests previously skipped the
>> test when failing to set up the file descriptor to test, restore this
>> behaviour.
>>
>> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
>
> I added a bunch of stuff to this. Please check?
>
>
> From: Mark Brown <broonie@xxxxxxxxxx>
> Subject: selftests/mm: skip failed memfd setups in gup_longterm
> Date: Thu, 05 Jun 2025 22:34:31 +0100
>
> Unlike the other cases gup_longterm's memfd tests previously skipped the
> test when failing to set up the file descriptor to test. Restore this
> behavior to avoid hitting failures when hugetlb isn't configured.
>
> Link: https://lkml.kernel.org/r/20250605-selftest-mm-gup-longterm-tweaks-v1-1-2fae34b05958@xxxxxxxxxx
> Fies: 66bce7afbaca ("selftests/mm: fix test result reporting in gup_longterm")

"Fixes:"

> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
> Reported-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Closes: https://lkml.kernel.org/r/a76fc252-0fe3-4d4b-a9a1-4a2895c2680d@lucifer.local
> Cc: David Hildenbrand <david@xxxxxxxxxx>
> Cc: Shuah Khan <shuah@xxxxxxxxxx>
>

Acked-by: David Hildenbrand <david@xxxxxxxxxx>

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675609-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8FE8041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:33:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3F5E83B0926
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:32:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A704284689;
Fri, 6 Jun 2025 10:33:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BlNAwxvu"
Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AF902C3242;
Fri, 6 Jun 2025 10:33:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.45
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749205983; cv=none; b=kNowh+Ho+8CjdaxTPK6vZnLevVkoV6+D5MwwYwxaU+C/mMcigAkG+gWsroXa5PtiuoMLeNde+6hUzbCtMu0nZWWjTcnoCtZxXzjV+foA6Xwd34+a4siHiUe0fyJd/cxZhF4gvwOQIs57cT/cIoxbB5ebi7gXfEQOPSzp1+KCHC4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749205983; c=relaxed/simple;
bh=EWmGOY2fETYBex1yy7JXLNMgL5UaZwO+d6xDM+yA6e0=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=frryZTqEWRwUv19O5AWMNw61u6t0UnMZW3TukSuPveKhYSzGFTPMAhxn0eYc1EvfgXN1q9pEWnFKIGDmnsoxNJrkpkHWXgVtW3SOO15GFXHwUjca/2k8m6WwGfeu/GRF9X5/yy6GmcvDuWOf2czgRPR5ofkrn5kIBf/BMUaGYOQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BlNAwxvu; arc=none smtp.client-ip=209.85.217.45
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vs1-f45.google.com with SMTP id ada2fe7eead31-4e45cfc3a26so1394467137.0;
Fri, 06 Jun 2025 03:33:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749205980; x=1749810780; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=MSCRtgJh3mrO0HRWQido0oMhIOru4mIvGKrAajD/acI=;
b=BlNAwxvuHpX4hfRJypQKHlqlxXJA4jap2RDxYgXnURCbtBOss+ILN9pUyXBwRImxdk
n6giTy1JIpyniLI6+oN8hltZ9z63Bg06TYp1FZk0rGOhd2m9XvoxJDPU6hJyKBKR0mcL
ULlS+3cnR4qT8ovoYBCNche/0bwkUHwH8Zf4ryz5wdTKtL8fTuhPjQH0WHczCvCyKha9
RjmPaC9xeKkmrwNY1G6u8ex/EutQAKsJ66NVb93lj5MBGVtDzPjoaevaEcl2C0X/ozSL
FJqEgqnR9F0QSd1AKsuvA+NgK1l06PLVAAMcphxDdYBBHbsjOzXdipa84jqzY/TJuDsH
V4TA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749205980; x=1749810780;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=MSCRtgJh3mrO0HRWQido0oMhIOru4mIvGKrAajD/acI=;
b=qPVbIWHfZ5OI5WBnNkRyOgXHhNOd/D2c5PUse3jsKre8qHY3ry9JtkmuekpVz4NzPk
P8ygVxjLdw7NdKOTAPt5WIW9vnwX7js+bvTooHxugRf+WUXr+XmlX1qR0tLLgDfRDbLu
dxjizr2P54dUEBplw5ihi3Rg67yjdFSVQeML4kDtCbmTaONg6w2t2A8b0N05sVnsbcl4
RFEcWX9G/S5f6q6eRrM5LYu5NaBgiEMOFKKOjIs0YjPGgQqflRl3SFRGnOdaQAsXWxWn
Qdkh9vf7t7zwNKvIAfC0r7jQRSdsEoqxiS3+T3muLF+pa5NNejj1QSBpBiuIKTFYtUiL
8zTg==
X-Forwarded-Encrypted: i=1; AJvYcCVQGHBZb0s5kPvh7rRwPGbXS/+AKOcANJ9EDxlB8v2Hq/7HH8zGYljNh5xFy71aAF862H7fZCMVt8pRYmc=@vger.kernel.org, AJvYcCVrVhUo7sXmfW1Y4bQH/WCTTLDoirP7/juFNzOXIHD6js+KmOiperJBR6ysRD/IL0UlpVpatWNJTAeG@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzDyDFxZS3mV9pJo3/61eXHxbrlq9/Jt0MFofiAoyfFLqSryc+j
yv5lSTYnbPzp778A5yUJiqbWqXPm6rIDz+5z4eFV3nj0aFSlqKNhnYi6v2h/BdMpxZ29R+qrqZ5
d+kB0U6cprZBruGX6zYJfaEfXI2qouJ67gua7
X-Gm-Gg: ASbGnctVlY+6MrhW+Kr63y+LOOcrkmyn7ums1foahEAThRJy7vDEq6HseZbde4DNVBy
WDFwG3JLjg2/Vqjob5QDDAr3BopcIDJ3y3gCN7FxkRg4xdj9JzTj4xnWNtMaoY8u6bWmdleOgwr
gWhW1GInSPzSP/ypQM5TwJgsRyOGhgg0DdRmQqyz4KYz8IYSuVS71489dogpuvOdndmw==
X-Google-Smtp-Source: AGHT+IGOU9vZErXkR16hmHisOuyevRgplZOoNNGLBXXZWihYYDanMFHkCRIUkTwK/lR/zMYAuNMpHitCjxQNZcxLuYs=
X-Received: by 2002:a05:6122:338a:b0:530:ba70:cfc9 with SMTP id
71dfb90a1353d-530e5025eb2mr2261725e0c.0.1749205969153; Fri, 06 Jun 2025
03:32:49 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250523110155.10451-1-victorshihgli@xxxxxxxxx>
<20250523110155.10451-3-victorshihgli@xxxxxxxxx> <20d2730f-1e1b-4f47-b208-201468e21029@xxxxxxxxx>
In-Reply-To: <20d2730f-1e1b-4f47-b208-201468e21029@xxxxxxxxx>
From: Victor Shih <victorshihgli@xxxxxxxxx>
Date: Fri, 6 Jun 2025 18:32:36 +0800
X-Gm-Features: AX0GCFuCsh_QPaMAcJWsev2oqyRwidon6gRsisjqQtww0hDLSd6tUsDIB2dWTJ4
Message-ID: <CAK00qKB3QZZjXFvwQazE7iYG_W-0PgsQzYWWTMKt8fAr5ePiyw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH RESEND V2 2/2] mmc: sdhci-uhs2: Adjust some error messages
and register dump for SD UHS-II card
To: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: ulf.hansson@xxxxxxxxxx, linux-mmc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, benchuanggli@xxxxxxxxx,
HL.Liu@xxxxxxxxxxxxxxxxxxx, Greg.tu@xxxxxxxxxxxxxxxxxxx,
Ben.Chuang@xxxxxxxxxxxxxxxxxxx, Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, May 28, 2025 at 8:10=E2=80=AFPM Adrian Hunter <adrian.hunter@intel.=
com> wrote:
>
> On 23/05/2025 14:01, Victor Shih wrote:
> > From: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
> >
> > Adjust some error messages to debug mode and register dump to dynamic
> > debug mode to avoid causing misunderstanding it is an error.
> >
> > Signed-off-by: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
>
> I think Ulf asked for the drivers/mmc/host/sdhci.h change to be
> a separate patch.
>
> In any case:
>
> Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
>

Hi, Adrian

I left this part out, I'll resend the patch for the new series to
match this thing,
and I will also keep your acked tag.

Thanks, Victor Shih

> > ---
> > drivers/mmc/host/sdhci-uhs2.c | 20 ++++++++++----------
> > drivers/mmc/host/sdhci.h | 16 ++++++++++++++++
> > 2 files changed, 26 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs=
2.c
> > index c53b64d50c0d..0efeb9d0c376 100644
> > --- a/drivers/mmc/host/sdhci-uhs2.c
> > +++ b/drivers/mmc/host/sdhci-uhs2.c
> > @@ -99,8 +99,8 @@ void sdhci_uhs2_reset(struct sdhci_host *host, u16 ma=
sk)
> > /* hw clears the bit when it's done */
> > if (read_poll_timeout_atomic(sdhci_readw, val, !(val & mask), 10,
> > UHS2_RESET_TIMEOUT_100MS, true, host=
, SDHCI_UHS2_SW_RESET)) {
> > - pr_warn("%s: %s: Reset 0x%x never completed. %s: clean re=
set bit.\n", __func__,
> > - mmc_hostname(host->mmc), (int)mask, mmc_hostname(=
host->mmc));
> > + pr_debug("%s: %s: Reset 0x%x never completed. %s: clean r=
eset bit.\n", __func__,
> > + mmc_hostname(host->mmc), (int)mask, mmc_hostname=
(host->mmc));
> > sdhci_writeb(host, 0, SDHCI_UHS2_SW_RESET);
> > return;
> > }
> > @@ -335,8 +335,8 @@ static int sdhci_uhs2_interface_detect(struct sdhci=
_host *host)
> > if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_IF_DETE=
CT),
> > 100, UHS2_INTERFACE_DETECT_TIMEOUT_100MS, t=
rue,
> > host, SDHCI_PRESENT_STATE)) {
> > - pr_warn("%s: not detect UHS2 interface in 100ms.\n", mmc_=
hostname(host->mmc));
> > - sdhci_dumpregs(host);
> > + pr_debug("%s: not detect UHS2 interface in 100ms.\n", mmc=
_hostname(host->mmc));
> > + sdhci_dbg_dumpregs(host, "UHS2 interface detect timeout i=
n 100ms");
> > return -EIO;
> > }
> >
> > @@ -345,8 +345,8 @@ static int sdhci_uhs2_interface_detect(struct sdhci=
_host *host)
> >
> > if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_LANE_SY=
NC),
> > 100, UHS2_LANE_SYNC_TIMEOUT_150MS, true, ho=
st, SDHCI_PRESENT_STATE)) {
> > - pr_warn("%s: UHS2 Lane sync fail in 150ms.\n", mmc_hostna=
me(host->mmc));
> > - sdhci_dumpregs(host);
> > + pr_debug("%s: UHS2 Lane sync fail in 150ms.\n", mmc_hostn=
ame(host->mmc));
> > + sdhci_dbg_dumpregs(host, "UHS2 Lane sync fail in 150ms");
> > return -EIO;
> > }
> >
> > @@ -417,12 +417,12 @@ static int sdhci_uhs2_do_detect_init(struct mmc_h=
ost *mmc)
> > host->ops->uhs2_pre_detect_init(host);
> >
> > if (sdhci_uhs2_interface_detect(host)) {
> > - pr_warn("%s: cannot detect UHS2 interface.\n", mmc_hostna=
me(host->mmc));
> > + pr_debug("%s: cannot detect UHS2 interface.\n", mmc_hostn=
ame(host->mmc));
> > return -EIO;
> > }
> >
> > if (sdhci_uhs2_init(host)) {
> > - pr_warn("%s: UHS2 init fail.\n", mmc_hostname(host->mmc))=
;
> > + pr_debug("%s: UHS2 init fail.\n", mmc_hostname(host->mmc)=
);
> > return -EIO;
> > }
> >
> > @@ -504,8 +504,8 @@ static int sdhci_uhs2_check_dormant(struct sdhci_ho=
st *host)
> > if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_IN_DORM=
ANT_STATE),
> > 100, UHS2_CHECK_DORMANT_TIMEOUT_100MS, true=
, host,
> > SDHCI_PRESENT_STATE)) {
> > - pr_warn("%s: UHS2 IN_DORMANT fail in 100ms.\n", mmc_hostn=
ame(host->mmc));
> > - sdhci_dumpregs(host);
> > + pr_debug("%s: UHS2 IN_DORMANT fail in 100ms.\n", mmc_host=
name(host->mmc));
> > + sdhci_dbg_dumpregs(host, "UHS2 IN_DORMANT fail in 100ms")=
;
> > return -EIO;
> > }
> > return 0;
> > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> > index f9d65dd0f2b2..70ada1857a4c 100644
> > --- a/drivers/mmc/host/sdhci.h
> > +++ b/drivers/mmc/host/sdhci.h
> > @@ -900,4 +900,20 @@ void sdhci_switch_external_dma(struct sdhci_host *=
host, bool en);
> > void sdhci_set_data_timeout_irq(struct sdhci_host *host, bool enable);
> > void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *=
cmd);
> >
> > +#if defined(CONFIG_DYNAMIC_DEBUG) || \
> > + (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODU=
LE))
> > +#define SDHCI_DBG_ANYWAY 0
> > +#elif defined(DEBUG)
> > +#define SDHCI_DBG_ANYWAY 1
> > +#else
> > +#define SDHCI_DBG_ANYWAY 0
> > +#endif
> > +
> > +#define sdhci_dbg_dumpregs(host, fmt) =
\
> > +do { \
> > + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
> > + if (DYNAMIC_DEBUG_BRANCH(descriptor) || SDHCI_DBG_ANYWAY) \
> > + sdhci_dumpregs(host); \
> > +} while (0)
> > +
> > #endif /* __SDHCI_HW_H */
>


Return-Path: <linux-kernel+bounces-675610-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 39EC741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:35:19 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id A86A63B0F7C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:34:56 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B580284689;
Fri, 6 Jun 2025 10:35:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tY4fxOkz";
dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="nRJZ20Ac"
Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55])
(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 DCC2A2C3242;
Fri, 6 Jun 2025 10:35:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206110; cv=none; b=M/XokEQwUKVmVlC2Ytr1Zw9xYMvlvfKnB2c0zTwBUpQ1qB0aFbf1WMX0mNRIEC9icnZH5SKP0aCBAWbwvBAoIE1pWBSl//ZyfMvl/izoA4XHqzJ2qjPSDf448hm17zfRS55UqZ9mX8ypL6Vi5cL6p5CO1QHURj4XIb8FiJyjMvA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206110; c=relaxed/simple;
bh=FVNLm1VrL8jaqyqM/ByJ16XfYaxZyZvq2f7/obGxSPY=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
MIME-Version:Content-Type; b=lonP6t8nrTWxsWWoLHS+von23d81yl7IasjrcKEFS1mVGV7LPaRL8/IakLuEAGDFxjE7PMM4bv6l119n7Jx6WBxpjRNV3N9TCDREZMibUsYtz92y4mZHEra2MU57AdtbzlQvAmXgb4VLh+oKF1AabWCPggWNirCHFr9FKNB/Nhw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tY4fxOkz; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=nRJZ20Ac; arc=none smtp.client-ip=193.142.43.55
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de
From: John Ogness <john.ogness@xxxxxxxxxxxxx>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de;
s=2020; t=1749206106;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=FNlEqQbY+fa98gHMzcIrLM+qc3h/stf4tBXFHk8HQmQ=;
b=tY4fxOkzUOGEzSfuyTD1Xd7XXCr0wIg9z+OmDJ1uHXs/0D6FrBM/ARQL+JKenmmx/SpN1Z
JAaEnnksFD2pAgpGepixdsCDbPwxD74kL6ismmFvB9cLDuRgf8ibnKAFi5/2b5701+mDCg
5VpEE4EglAvv54Fl8fO/P2s7xX4L3DtAiHURV80AJrT7N47nWHbrRREZFuqYmx38diQKZs
BKUf+HgD+rtvBpRhYWfMzpNZuqVoW4oPOpDSwEJeV5WekTNskz0yvoEUH1kCnq2ICR1vVE
YbvnoKZtWzTI3AC6z4Ds2rIK1sD6dpBSviLaFZzF+GvfnCIm4DZojFmf8kxmVA==
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
s=2020e; t=1749206106;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=FNlEqQbY+fa98gHMzcIrLM+qc3h/stf4tBXFHk8HQmQ=;
b=nRJZ20AcwHFYUmZVwaWsjyLVYVVIrcXFd2uY86bpZxAlNp2w/pQPxHQZvAEKp0MqcL8Y+l
KcVTJEOFTSVwaWBg==
To: Petr Mladek <pmladek@xxxxxxxx>, "Toshiyuki Sato (Fujitsu)"
<fj6611ie@xxxxxxxxxxx>
Cc: 'Michael Kelley' <mhklinux@xxxxxxxxxxx>, 'Ryo Takakura'
<ryotkkr98@xxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Greg
Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Jiri Slaby
<jirislaby@xxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx"
<linux-kernel@xxxxxxxxxxxxxxx>, "linux-serial@xxxxxxxxxxxxxxx"
<linux-serial@xxxxxxxxxxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx"
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: Problem with nbcon console and amba-pl011 serial port
In-Reply-To: <84frgdcgug.fsf@xxxxxxxxxxxxxxxxxxxxx>
References: <SN6PR02MB4157A4C5E8CB219A75263A17D46DA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<OS7PR01MB13775FE1A20762D1EA4A38D0ED76DA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<84y0u95e0j.fsf@xxxxxxxxxxxxxxxxxxxxx>
<84plfl5bf1.fsf@xxxxxxxxxxxxxxxxxxxxx>
<TY4PR01MB13777674C22721FCD8ACF4FCCD76CA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<aEApOPTqbVOR35F_@xxxxxxxxxxxxxxx> <84o6v3ohdh.fsf@xxxxxxxxxxxxxxxxxxxxx>
<aEBNLMYVUOGzusuR@xxxxxxxxxxxxxxx>
<TY4PR01MB13777CC92C858572B9C19394FD76FA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<aEGeARVcCwqcoHb8@xxxxxxxxxxxxxxx> <84frgdcgug.fsf@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 12:41:06 +0206
Message-ID: <84cybhcg4l.fsf@xxxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Status: No, score=-2.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INVALID_DATE_TZ_ABSURD,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 2025-06-06, John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
> On 2025-06-05, Petr Mladek <pmladek@xxxxxxxx> wrote:
>> The question is if it is worth it. Is the clean up really important?
>
> I must admit that I am not happy about encouraging the proposed solution
> so far (i.e. expecting driver authors to create special unsafe code in
> the panic situation). It leads down the "hope and pray" path that nbcon
> was designed to fix.
>
> What if during non-panic-CPU shutdown, we allow reacquires to succeed
> only for _direct_ acquires? The below diff shows how this could be
> implemented. Since it only supports direct acquires, it does not violate
> any state rules. And also, since it only involves the reacquire, there
> is no ugly battling for console printing between the panic and non-panic
> CPUs.

Thinking about it some more, since it does not involve printing, why not
just always allow reacquiring directly in panic?

This simplifies the diff significantly.

John

diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index d60596777d278..26c229b7f56ea 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -235,7 +235,8 @@ static void nbcon_seq_try_update(struct nbcon_context *ctxt, u64 new_seq)
* the handover acquire method.
*/
static int nbcon_context_try_acquire_direct(struct nbcon_context *ctxt,
- struct nbcon_state *cur)
+ struct nbcon_state *cur,
+ bool ignore_other_cpu_in_panic)
{
unsigned int cpu = smp_processor_id();
struct console *con = ctxt->console;
@@ -249,7 +250,7 @@ static int nbcon_context_try_acquire_direct(struct nbcon_context *ctxt,
* nbcon_waiter_matches(). In particular, the assumption that
* lower priorities are ignored during panic.
*/
- if (other_cpu_in_panic())
+ if (other_cpu_in_panic() && !ignore_other_cpu_in_panic)
return -EPERM;

if (ctxt->prio <= cur->prio || ctxt->prio <= cur->req_prio)
@@ -568,7 +569,7 @@ static struct printk_buffers panic_nbcon_pbufs;
* in an unsafe state. Otherwise, on success the caller may assume
* the console is not in an unsafe state.
*/
-static bool nbcon_context_try_acquire(struct nbcon_context *ctxt)
+static bool nbcon_context_try_acquire(struct nbcon_context *ctxt, bool ignore_other_cpu_in_panic)
{
unsigned int cpu = smp_processor_id();
struct console *con = ctxt->console;
@@ -577,7 +578,7 @@ static bool nbcon_context_try_acquire(struct nbcon_context *ctxt)

nbcon_state_read(con, &cur);
try_again:
- err = nbcon_context_try_acquire_direct(ctxt, &cur);
+ err = nbcon_context_try_acquire_direct(ctxt, &cur, ignore_other_cpu_in_panic);
if (err != -EBUSY)
goto out;

@@ -913,7 +914,7 @@ void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt)
{
struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt);

- while (!nbcon_context_try_acquire(ctxt))
+ while (!nbcon_context_try_acquire(ctxt, true))
cpu_relax();

nbcon_write_context_set_buf(wctxt, NULL, 0);
@@ -1101,7 +1102,7 @@ static bool nbcon_emit_one(struct nbcon_write_context *wctxt, bool use_atomic)
cant_migrate();
}

- if (!nbcon_context_try_acquire(ctxt))
+ if (!nbcon_context_try_acquire(ctxt, false))
goto out;

/*
@@ -1486,7 +1487,7 @@ static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq,
ctxt->prio = nbcon_get_default_prio();
ctxt->allow_unsafe_takeover = allow_unsafe_takeover;

- if (!nbcon_context_try_acquire(ctxt))
+ if (!nbcon_context_try_acquire(ctxt, false))
return -EPERM;

while (nbcon_seq_read(con) < stop_seq) {
@@ -1784,7 +1785,7 @@ bool nbcon_device_try_acquire(struct console *con)
ctxt->console = con;
ctxt->prio = NBCON_PRIO_NORMAL;

- if (!nbcon_context_try_acquire(ctxt))
+ if (!nbcon_context_try_acquire(ctxt, false))
return false;

if (!nbcon_context_enter_unsafe(ctxt))


Return-Path: <linux-kernel+bounces-675611-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 85B1541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:37:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id B05C53AE06A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:36:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ADDFA286893;
Fri, 6 Jun 2025 10:37:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h23P9u9P"
Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A988C2C3242;
Fri, 6 Jun 2025 10:37:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206232; cv=none; b=EcVY3vXtEH8c7xPScQpz98ob8e4kxXthoFI4fJO3f3lprhlAKG2q9QJvURFF6lvCvDRDjjZbugL1W8OQu8l6EdyoaFW99E9LLuA4mRHgBA/Htl56grG8LM9gjToIOYmhX5J3Ew+yj2K1P4oe2KkfcMaLakQIx4U50af3CFfU25Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206232; c=relaxed/simple;
bh=Mq4k4ekcbiqjRIxZJ0xXM1aKpS5twuBvYi6/9eFoJo8=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bito4myopx6FUom7ZrV5ZDAPnbPQZl/QDodtZu8kayN3vj8xaWXUAsNAoU0c871UGLRIs5GjW4k/+NZqx1m4Ko/ZRAialG6V8bfuZr/+AA4Y24TlGL9gEi+UwbPvLzseYm06ZJkF3IaZ3/Sr+D14N7hOI8IoIRAx4jo9RcNQWvc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=h23P9u9P; arc=none smtp.client-ip=209.85.210.169
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-7399a2dc13fso2306682b3a.2;
Fri, 06 Jun 2025 03:37:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749206230; x=1749811030; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=NdtxJEbjhatRvCDWF7ffdW5RJ6Yji8odY3/KOt6aPsc=;
b=h23P9u9P2iy1P2igEqGnvqgONTTZVKs1Q6TsQBOJLmqfiZc96aMUK5gZMLlvPX6XgB
NxLUfDQhrooStQA/KCf8fkEv7qM3F+WMbL1AvP/h46DGnIiavzDmhzRiZkKXfSQX/6tC
Xp2i6ww3pg3IWGwHBaSTMHKqgfp5aTgXMK7EIZtMBoWBZwjE5aIrCPHvMPRoKagjry0g
17XyZJOB+mq7pFgESTxiM/4c37D4w0jgu39gD6wIpMTCxrgm1wHGlHbgJehAwptDdirM
4T8u8BmS5G9Ljk7s6V89tthYuGij8SmsrPK9B/6KNdpp99ehXi9If3pYMe5GGQ4+Y+mI
j9MQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749206230; x=1749811030;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=NdtxJEbjhatRvCDWF7ffdW5RJ6Yji8odY3/KOt6aPsc=;
b=fC5UhgUa0tcMvDfKJakc0+KG3rUvH+p4NuV0FyN54J5U0cUI7Uq/qtdYTivDDzio7B
4XN/OyNGnAbn4mobnaJ20+WirD4uzkHEpVcXtbbkHl2XOzu6KSg8B69ibkR1gtSWXiRG
2PLwvGmNEOE6zy8GWJgkTe4krEfidqJ9QF3hOOLl5LgYQGtYb8k/Mc0/lzcmvIL/4j7e
JzFc8s659u172rUoF4D7d5B03JFnggOx7oMbHHpQXEwjo1LOD65Fd+cvFJ0YvYskLkYW
Ov0NOzbNvknZ4NBsN8BnkpZkfVXIapL5Q09xUDFZu2o+dpOyi7ZxG1Y+iD2+zuVQOE3L
f0IQ==
X-Forwarded-Encrypted: i=1; AJvYcCUOsqiPL2Xrm8e5TgCh6WhQpFug+rr6wl5M6+a2dsZge2Mbk89won+XE3FkloA/Kn+dsIiijlrtb3JIHIU=@vger.kernel.org, AJvYcCVMrbhVHhXpFydSWFAIhhwVS1BDwKDgP9PaTO/Dbtbl2p2CIhgqpC8HDV/V49gvU320RgpBHIeu@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YxhbkTs/rxMXaiECD8/4U1mWvDPeEgU0NTMUG08Z2B2dBlYVrWN
wpqPA5zeKsB/4SN4CsX2XkxiFQiq3TakmFd+rmZ5ZyW69mzwhS3TmUzs
X-Gm-Gg: ASbGncvkKNcCkq0GL3oRZFXNhNhEg7J/kPF7mxQ+SGAGUvJ4cUxTozxxvvI/q0kA4Ad
E3HvyaVQnBMazt9Lwr3M+6g6FMtR+zdBKpuzVkz6GaHjaNWGUVwwN8mcPB+StyLSZEDOZJWLSBX
VlUWdHxYNCz9tlPxtisx3euuhdeFsBVM+ebrTHVqaHPIjpAUbvS90olehiAFaPwjYNWSd60Ql86
4N0rQVf9TA2BPH/OZ8PWRzWqhUjca4f5keaTXg5hLBHm1iQ9IxyAfLV6RVeVhLIV0cEDjQVneIL
shPmtEnD7gKkVXX423a/qbllh7NHSavGSYYmQNJJpoQPVx9DrwM8CTAolUB6s44WdaLPhACEKIR
gDyuYFQjAGJZ8uoA=
X-Google-Smtp-Source: AGHT+IESWEQByLV3zPRY07M398R8ZoM9qPk001wtKdUGokyw0THc1FuuH31hxl2c0VkrBS+61mTUzA==
X-Received: by 2002:a05:6a00:2e0d:b0:746:24c9:c92e with SMTP id d2e1a72fcca58-74827e810demr4833871b3a.8.1749206229803;
Fri, 06 Jun 2025 03:37:09 -0700 (PDT)
Received: from localhost.localdomain ([121.185.186.233])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482b084695sm1033041b3a.96.2025.06.06.03.37.07
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:37:09 -0700 (PDT)
From: Jeongjun Park <aha310510@xxxxxxxxx>
To: richardcochran@xxxxxxxxx
Cc: andrew+netdev@xxxxxxx,
davem@xxxxxxxxxxxxx,
edumazet@xxxxxxxxxx,
kuba@xxxxxxxxxx,
pabeni@xxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Jeongjun Park <aha310510@xxxxxxxxx>
Subject: [PATCH] ptp: remove unnecessary brace in ptp_clock_unregister()
Date: Fri, 6 Jun 2025 19:36:59 +0900
Message-ID: <20250606103659.8336-1-aha310510@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

There are unnecessary brace used in the conditional statement where
ptp_vclock_in_use() is used in ptp_clock_unregister(). This should be
removed.

Signed-off-by: Jeongjun Park <aha310510@xxxxxxxxx>
---
drivers/ptp/ptp_clock.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 35a5994bf64f..0ae9f074fc52 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -412,9 +412,8 @@ static int unregister_vclock(struct device *dev, void *data)

int ptp_clock_unregister(struct ptp_clock *ptp)
{
- if (ptp_vclock_in_use(ptp)) {
+ if (ptp_vclock_in_use(ptp))
device_for_each_child(&ptp->dev, NULL, unregister_vclock);
- }

ptp->defunct = 1;
wake_up_interruptible(&ptp->tsev_wq);
--


Return-Path: <linux-kernel+bounces-675612-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BDF8D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:40:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id A787D3ADD26
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:40:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D7DBB286893;
Fri, 6 Jun 2025 10:40:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LlhYlBT/"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7981B253355;
Fri, 6 Jun 2025 10:40:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206437; cv=none; b=PluaLMWsTxDOtadCParaKFB7bwlN9n679cZkK35g41MdBC1jjjDa9YEUEZuXiBeZQr3Viatso81PYAAYMY8N8UIEed1663GJ3Cl8lZRE1dCJOoQozhzptKFf/ylyNJdNt96VAEQNDaeQH2hPD7xxw2aw+tXQkfD0DlVzeU6daP4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206437; c=relaxed/simple;
bh=N0dWlwt/wUZAlKZIKffM0LxIo2EDg6xSxq+YVnEkUYs=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=eQUurBhX5k5RBjYuQ1YIFQmYoHyp2ZG4dlpnEb+4xFh0tqyvPhIFU8Awlwwy4U2sg7exl2qpx+V6ebxQ0I0g36GTqumDXk3TDiL+86Ji4rwOyf3BDAfmqigxdUZ4O1yt4mgqFgZveV21Vu2vOIGGYpjasKnimVbDpymekC+zcdY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LlhYlBT/; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23A3AC4CEEB;
Fri, 6 Jun 2025 10:40:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749206436;
bh=N0dWlwt/wUZAlKZIKffM0LxIo2EDg6xSxq+YVnEkUYs=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=LlhYlBT/0EQdYF0dX9loZ15WZBxDzM3zowld8tKGu4uUwK1OzXcDwNyxHMks1wjgt
SawS3DS6Mp5CtUbz+FNqcguL78XRgRIPU7TTSL5G7Wjbcneo3sI+leO5/03MpLxD1z
P9b1eBOXp1zO84Srh5X8sbMZxP+loTc6DOAv3CFg=
Date: Fri, 6 Jun 2025 12:40:34 +0200
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Yunhui Cui <cuiyunhui@xxxxxxxxxxxxx>
Cc: arnd@xxxxxxxx, andriy.shevchenko@xxxxxxxxxxxxxxx,
benjamin.larsson@xxxxxxxxxx, heikki.krogerus@xxxxxxxxxxxxxxx,
ilpo.jarvinen@xxxxxxxxxxxxxxx, jirislaby@xxxxxxxxxx,
jkeeping@xxxxxxxxxxxxxxxxx, john.ogness@xxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-serial@xxxxxxxxxxxxxxx,
markus.mayer@xxxxxxxxxx, matt.porter@xxxxxxxxxx,
namcao@xxxxxxxxxxxxx, paulmck@xxxxxxxxxx, pmladek@xxxxxxxx,
schnelle@xxxxxxxxxxxxx, sunilvl@xxxxxxxxxxxxxxxx,
tim.kryger@xxxxxxxxxx
Subject: Re: [PATCH v7 1/4] serial: 8250: fix panic due to PSLVERR
Message-ID: <2025060621-hankie-groovy-bad6@gregkh>
References: <20250528062609.25104-1-cuiyunhui@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250528062609.25104-1-cuiyunhui@xxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, May 28, 2025 at 02:26:06PM +0800, Yunhui Cui wrote:
> When the PSLVERR_RESP_EN parameter is set to 1, the device generates
> an error response if an attempt is made to read an empty RBR (Receive
> Buffer Register) while the FIFO is enabled.
>
> In serial8250_do_startup(), calling serial_port_out(port, UART_LCR,
> UART_LCR_WLEN8) triggers dw8250_check_lcr(), which invokes
> dw8250_force_idle() and serial8250_clear_and_reinit_fifos(). The latter
> function enables the FIFO via serial_out(p, UART_FCR, p->fcr).
> Execution proceeds to the serial_port_in(port, UART_RX).
> This satisfies the PSLVERR trigger condition.
>
> When another CPU (e.g., using printk()) is accessing the UART (UART
> is busy), the current CPU fails the check (value & ~UART_LCR_SPAR) ==
> (lcr & ~UART_LCR_SPAR) in dw8250_check_lcr(), causing it to enter
> dw8250_force_idle().
>
> Put serial_port_out(port, UART_LCR, UART_LCR_WLEN8) under the port->lock
> to fix this issue.
>
> Panic backtrace:
> [ 0.442336] Oops - unknown exception [#1]
> [ 0.442343] epc : dw8250_serial_in32+0x1e/0x4a
> [ 0.442351] ra : serial8250_do_startup+0x2c8/0x88e
> ...
> [ 0.442416] console_on_rootfs+0x26/0x70
>
> Fixes: c49436b657d0 ("serial: 8250_dw: Improve unwritable LCR workaround")
> Link: https://lore.kernel.org/all/84cydt5peu.fsf@xxxxxxxxxxxxxxxxxxxxx/T/
> Signed-off-by: Yunhui Cui <cuiyunhui@xxxxxxxxxxxxx>
> ---
> drivers/tty/serial/8250/8250_port.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 6d7b8c4667c9c..07fe818dffa34 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2376,9 +2376,10 @@ int serial8250_do_startup(struct uart_port *port)
> /*
> * Now, initialize the UART
> */
> - serial_port_out(port, UART_LCR, UART_LCR_WLEN8);
>
> uart_port_lock_irqsave(port, &flags);
> + serial_port_out(port, UART_LCR, UART_LCR_WLEN8);
> +
> if (up->port.flags & UPF_FOURPORT) {
> if (!up->port.irq)
> up->port.mctrl |= TIOCM_OUT1;
> --
> 2.39.5
>
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot


Return-Path: <linux-kernel+bounces-675613-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D908941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:40:58 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 144DC7A8B2E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:39:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BEC0E287507;
Fri, 6 Jun 2025 10:40:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="aeVSWA2W";
dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="aeVSWA2W"
Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011050.outbound.protection.outlook.com [52.101.70.50])
(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 D87EF286D5F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:40:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.50
ARC-Seal:i=3; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206442; cv=fail; b=EJbuCilWa4YXknD4JtN2rPrauBkt/sHkHD6sggNgy7qrbtTQ7o2xgY10gt0qtuGlTK2j7c/+01aNkB2rPpcqr2leOC2iXx/a5VK4LLdvubwD/2HavUvzQQDUW3XXryJH+2eorCjYgj23V3UIpOsUTB5XHV6LxI53oHCetyidlT8=
ARC-Message-Signature:i=3; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206442; c=relaxed/simple;
bh=cPj0ROG/A2whM3e+ViuEtQPDMKYhO5ckQPkSSbM9/mc=;
h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To:
Content-Type:MIME-Version; b=eCUzmT0RHOkWtZfKkJI2r7+rYbh2EwgF0GEctDkrWjHMMK7aFBtor9+fuDsD2s4Y707RVRimcQKm0jpGv3P3SK40UVeWGTZzTKMZygPSoMi5sTHCOQlH1c1lTsh974l/DELd39cMH4xkG7QesAbOc2t/ctawOrYks1Axytuy42A=
ARC-Authentication-Results:i=3; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=aeVSWA2W; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=aeVSWA2W; arc=fail smtp.client-ip=52.101.70.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass;
b=SGKjZZy069PcD7jyWYL1dqbOtYEJ/mQ7LHxkdQoeFp/LDNftAf22RXijG7YVUUtQ5qkuY/s0BYH9QO9FUK//UB8yAJZmHl77W9nqCa1KLy+ge67j0AHHeUesc3ZtbLToEVbQ3/BcPpC00EOC5GngJhm/XAw4x+TyZpUWQvyv+xF/w+LUyBdRUUJ9NxOh9Sjs4P5D+ezWy1lRoZD6YGJG85JTGO7uUNXxAIpcqy2a3GsizY9JlYw3SNCaMjVRnFeO4blMkNS/XfY54fDKikUR0eHaoU7NbW9bB5Qu6jkQvYGKlZU7xJGHvgo1nXxkhmbI5TTQwJQXoBmCDJc6IM1Xgg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=961aqrBQ0f+htkBIvOVIbfhfEgaVeWmdPKZzAqm78fk=;
b=UlIiplBzw3O2EIoGjUWts+jNZPGWWwKrmN4NgapzhuqkW9NcpnAEJocdTms5UYdWTneK24szHHAD2GAp9TOc+dAZOdE5wPS8lrCEUL6qKMvyLLvj5zkRaPSKB+TVkg8KuPzp9oCUJF9j1aFxJeG8R+UxaO7M6XnRXUoP+7X4ZYClhUBoZOa7evejiSWhqqQS59V4td0br/tfGymrvrk0pas1KPcWYxO6heJJHQrW66H3SBG528lddBWhg1MX2qbTlFQFX1/7VYgR0sWdiTLOZMZuYtu+BAMfK+OBZ7SmsuhwSWazXvKjntfLLqnPVMyjBBYKYlMOTQogQtzzrcBzPw==
ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is
4.158.2.129) smtp.rcpttodomain=oracle.com smtp.mailfrom=arm.com; dmarc=pass
(p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass
(signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1
spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com]
dmarc=[1,1,header.from=arm.com])
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=961aqrBQ0f+htkBIvOVIbfhfEgaVeWmdPKZzAqm78fk=;
b=aeVSWA2Wb1nMsH98WaVdsQw+09CMYu+gGwsQjOqcuooxzK5CFOgntU32KfclYbTvoq3MmJSV3XRDofsvGwif7RzUSLQplPWbZ9QmACH+WRHt7ac2wwokWk8WAx4q7YJIWuTFj+pG/KogG5RhFgvYb5zbrZsPKTq8bmuQxdqa2dQ=
Received: from PR3P251CA0026.EURP251.PROD.OUTLOOK.COM (2603:10a6:102:b5::30)
by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 10:40:33 +0000
Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com
(2603:10a6:102:b5:cafe::a2) by PR3P251CA0026.outlook.office365.com
(2603:10a6:102:b5::30) with Microsoft SMTP Server (version=TLS1_3,
cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.19 via Frontend Transport; Fri,
6 Jun 2025 10:40:33 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129)
smtp.mailfrom=arm.com; dkim=pass (signature was verified)
header.d=arm.com;dmarc=pass action=none header.from=arm.com;
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates
4.158.2.129 as permitted sender) receiver=protection.outlook.com;
client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C
Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by
AMS0EPF000001AC.mail.protection.outlook.com (10.167.16.152) with Microsoft
SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.29
via Frontend Transport; Fri, 6 Jun 2025 10:40:31 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=poCmkboU0jnesBJtiIEvaFj2LWgKJ4H+5RocwiUXOYIx06SnxcZmNdGtC6lSP3bKtl+WoRKWqyux0+o3iKQ3QZV+3IyDvjuYkdXpQzstezexDPPz5bb/f4IlhS/PbC1LcGg3ri0ZT92pCFrPG7L9fQOyrf+FUN1aDAX599zsYpvhsai3IKidmLTz87URFwgg5M/4eFwUTGtvtogDqRfDJoUXAxcWwCFRkPbkuXlZeB0YoiU1Z2iluui1oqmsTQgUC2UkBdwVo29h27R4N4Rs5ti5B21FcQ5Lsd4rYTqujqA/a4fETNtDWdHz3SoCGJtujAd3XsCoUocVKqjPNCn4CA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=961aqrBQ0f+htkBIvOVIbfhfEgaVeWmdPKZzAqm78fk=;
b=Z3o4Qd+W5WDNQXFE8LvwPn2m38DiLVrFNx7r7Co9ceu2Hx6mEcB1CLlwIozCMaEeflhjHPwOPyWfDGjJxAh4sK/1fn7U800mD1trn/ei77863RVWMbei6FFlqObXSs6sfrdlxpZeIQG1whvMjrtZojt237obvgAbMQY9RdARe+m88o7B7o1voX4/v/9+i/03fS8gKuF1VRxl2kjHGD2mpxreZ7rzo3vLGiPG6QOxuPVpbyhZSZMB6lLGsxPCYJtqECDqUorFTpN6R6iIAQAVMKTPqICqh+/ayGA4adF+VkTAQ9fE6U1mm1YxqkCfLGT4OuozC7pEllX0hfvBRGnz7w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass
header.d=arm.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=961aqrBQ0f+htkBIvOVIbfhfEgaVeWmdPKZzAqm78fk=;
b=aeVSWA2Wb1nMsH98WaVdsQw+09CMYu+gGwsQjOqcuooxzK5CFOgntU32KfclYbTvoq3MmJSV3XRDofsvGwif7RzUSLQplPWbZ9QmACH+WRHt7ac2wwokWk8WAx4q7YJIWuTFj+pG/KogG5RhFgvYb5zbrZsPKTq8bmuQxdqa2dQ=
Authentication-Results-Original: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=arm.com;
Received: from AM9PR08MB7120.eurprd08.prod.outlook.com (2603:10a6:20b:3dc::22)
by AS2PR08MB9666.eurprd08.prod.outlook.com (2603:10a6:20b:606::13) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 10:39:57 +0000
Received: from AM9PR08MB7120.eurprd08.prod.outlook.com
([fe80::2933:29aa:2693:d12e]) by AM9PR08MB7120.eurprd08.prod.outlook.com
([fe80::2933:29aa:2693:d12e%2]) with mapi id 15.20.8813.018; Fri, 6 Jun 2025
10:39:57 +0000
Message-ID: <f6b203cc-de3e-45ac-b2e3-b2d9f8ae0c31@xxxxxxx>
Date: Fri, 6 Jun 2025 16:09:51 +0530
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 2/3] arm64: pageattr: Use walk_page_range_novma() to
change memory permissions
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: akpm@xxxxxxxxxxxxxxxxxxxx, david@xxxxxxxxxx, catalin.marinas@xxxxxxx,
will@xxxxxxxxxx, Liam.Howlett@xxxxxxxxxx, vbabka@xxxxxxx, rppt@xxxxxxxxxx,
surenb@xxxxxxxxxx, mhocko@xxxxxxxx, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, suzuki.poulose@xxxxxxx, steven.price@xxxxxxx,
gshan@xxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
References: <20250530090407.19237-1-dev.jain@xxxxxxx>
<20250530090407.19237-3-dev.jain@xxxxxxx>
<f528506e-b04d-4c80-93c3-93ba4ca385bd@lucifer.local>
Content-Language: en-US
From: Dev Jain <dev.jain@xxxxxxx>
In-Reply-To: <f528506e-b04d-4c80-93c3-93ba4ca385bd@lucifer.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: MA0PR01CA0090.INDPRD01.PROD.OUTLOOK.COM
(2603:1096:a01:ae::19) To AM9PR08MB7120.eurprd08.prod.outlook.com
(2603:10a6:20b:3dc::22)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-TrafficTypeDiagnostic:
AM9PR08MB7120:EE_|AS2PR08MB9666:EE_|AMS0EPF000001AC:EE_|DBBPR08MB10554:EE_
X-MS-Office365-Filtering-Correlation-Id: 11712f1f-4818-43ea-3637-08dda4e68fb2
x-checkrecipientrouted: true
NoDisclaimer: true
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam-Untrusted:
BCL:0;ARA:13230040|1800799024|376014|7416014|366016;
X-Microsoft-Antispam-Message-Info-Original:
=?utf-8?B?V081SFhSeDZFZDgwdlVEcDBldHBHT1pQbDJGYk1CNWVlNjMydGtzMS9LbytQ?=
=?utf-8?B?Y1dta3RyVVNnSkFROUhMcUVwSUxuWW5tZmJjZEhqWU5xUmMyc0NLMjNRWE5M?=
=?utf-8?B?a0Z1WlFqZXEvdFJzU09TRWw2MlJ5T0ZPMXUydHNZQk1rdzBHbzBvOUsyY2lx?=
=?utf-8?B?ZVNMdXZZcTV3R1o2YTVzWXB6VktXbmVoa3FsaEpHV1hyTDQ4cFU1b2U4RVU4?=
=?utf-8?B?N0EvYmwzbDRBUHJDWGVJdXR3R09EbnVpNWNVNjV3eWJtUVZuRU5kUlBqdVYy?=
=?utf-8?B?alNhTmZPSVc5UU0zSEkxS2d6QWNQTEdnZElqREFFcllyRWxZQUxUNEQ2QlB2?=
=?utf-8?B?R1p5UkpockdrQnQwUXR5ZnVmT2xJVERCOGl1V20weFBQaStGbHhaaU92dWhZ?=
=?utf-8?B?Vy9QbTBGeGpzTmRvUi96c0dya1puMnQ0SjJVNjJXZFliZHBqTSs3Z3hPK3N3?=
=?utf-8?B?eEhZa0NUQzB1bVNsQXozL1VBMXRYN3R0VlhCeUxTOTFBRElReWhGck52SXU0?=
=?utf-8?B?c2Z0d0xhVkRITXRHdE0ybEpMOE5vTGY1UDhlVkJpM2lteUFsSi83YTF0emJm?=
=?utf-8?B?eUpTMkE0MTMvbFR5dTVQMEY2WW04cEFvK1Q5a1FVeTNOOWJjVnNUcXU2NnNM?=
=?utf-8?B?UGVkemJtU0lWVy9PUkFLYWpUZ1ROQlpGbVJIbEdpa09NUmdJNEdaajlzZFhz?=
=?utf-8?B?bEt6cDFKYlY4bjBKbm9HZDdZRTFSOTY4VUovYUZwMU95RWNIRE91cXByUlRF?=
=?utf-8?B?bGpadXgvTDhPUVRPS0U4Rk8vWDJGZjRaQ0Q4YVdYSmdMSkVUVEl2YVBtZzV2?=
=?utf-8?B?Ykh1ak1QUGRnVTloY3pudTZmMUtvY1VodjlTSmxpelV2cER5T29EYUNQamFt?=
=?utf-8?B?cGI3dlVHdjEzcTVnVDdmSCswODhNTXVpTmhaVC9od3hzZWRQc0k2NUd4V2dW?=
=?utf-8?B?RG5YbWlHKzNGbjZlTTFiUmhpTmNremlreGdFcmVKYWtlUEFiNXhzb0NBK1hR?=
=?utf-8?B?YVdnWHhRbE50WDBYTm5aMnFCM3ovdmJ0bng2dnJDeDNBSDRuZm9relRoYitj?=
=?utf-8?B?K01xcHlsck4zb1dJRHJWME8welJGNlRJdE1GWm50a1YyRFBhVDI5QUdGczgy?=
=?utf-8?B?KzQxMTRvdWhXSWtlSTZ6Tmp6VW5aOW9jMm9xMm1hNHpWR2YxK3JGM1pxeUlH?=
=?utf-8?B?VTNmakVGM2VpVkZMOGpjYy8wdXJaSnhmUHkzbDFEZFJ3N2p6RlVtUys3Q0t6?=
=?utf-8?B?VVR3dnFRcmZqZ3dKNUFlWUpvQm94VUVzcm83WCsxZytLOEZVTks5ZVlQdDhx?=
=?utf-8?B?eEs3aTJMWUVyQzhxZjB5SEIvSmdUd2IxTGFaVXdQL3U0VmN4U2tzR3dzRVRY?=
=?utf-8?B?dWY5MlJQL2phVXdtSUxKVzhzRXNvd1E4enUyZVJhZkFKVTh1bnRkZjl0cGlr?=
=?utf-8?B?ZnVmRkdlbGJITlFtY2FRNzdycTdYRUpBaWhYWmhZMm1ybWRuRnFDeHVvckdC?=
=?utf-8?B?M2RFakxzTDV2MjdQWW1LS2FpeHlhdFJVa3p6VE0rRVBoOENyOFdLVWFUeEpm?=
=?utf-8?B?TEJncVg5TEhkY0NJVnNOU3dZbnNrbFlxaEJBWWt6M0YwR3U2NkgvTTBId3ZC?=
=?utf-8?B?NnVQaHNWZTZkeUxwT1JQSWd3ekRDLzl3dnpGb2tldHhBU0VnYlZrMGpiUlRD?=
=?utf-8?B?WW50ZUFPY2VqMVZKT0Fld2dkNlkxWjlLU2pwVVVQb3VwS1pMRzNjZUQwQTBl?=
=?utf-8?B?QTJHVFFPa1lDZGxDM0dRbnh0L29OVlduTGI4NStqaGI3QUpzcm1tU1VJQU9h?=
=?utf-8?B?WVphTGxmaFFsZE1SYjRNa1d6dStjZXo4cE1LYzVRcFplSTlNaWVNVjdkNlpU?=
=?utf-8?B?ckNrZzVnTW9qNVhiMlNTeWpCNHJkUkZIUGhWeUwvYS9OL1VMZnNST1NTUGVX?=
=?utf-8?Q?n4Cih1p8bSY=3D?=
X-Forefront-Antispam-Report-Untrusted:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR08MB7120.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016);DIR:OUT;SFP:1101;
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9666
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
AMS0EPF000001AC.eurprd05.prod.outlook.com
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id-Prvs:
84369619-d634-4937-bbb1-08dda4e67b33
X-Microsoft-Antispam:
BCL:0;ARA:13230040|14060799003|35042699022|82310400026|376014|7416014|1800799024|36860700013;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?cWRpanlscWpZRVBSaEltWDNVM08ydHdKcWI4bjQyS0pVdHluOHN6K2g3SlJF?=
=?utf-8?B?U1NTalhWR0k1SGRlaVBBUmp6TStOYkFqMDUwbTlCTmx4K3lFSnJyNkNyUWVo?=
=?utf-8?B?c25scVdBTExFSlZIR2o1L1lmK3hmbGJQUHh6UEhoZ2JLeUtTQzE5dVlFWkdC?=
=?utf-8?B?M1U0WXNQT3MxcE40NEhIbW1McmJEMHNnYWJsQXk2SGpWQXRoa09xMTFZR1dk?=
=?utf-8?B?WDB3NmtEbGdWUEVSekVoT2s5SWtsM3NxaGI5bFBKcXZRMzNPUC9yUzkvUzBq?=
=?utf-8?B?VlUwSXpyWHZPUW96M1Q3RnRIVHZ2dXdJSEh4N2dIbXFnUDVzVXpoWXM5NWZ5?=
=?utf-8?B?VUVWVHJ6TmtYbzRQUmFzT1V2dE5DcXNpb09ZVmczWXR6TVdJeU9MZlFNd3hH?=
=?utf-8?B?QytrQ0FVak1wWVp6Nkg4dEoxY1VtRytsK1d2TFFxNzhidWdzUG1SOGd2N2Rx?=
=?utf-8?B?R3NzWHpRS1hmWFJMdjhNVlhiRUpNTUVocC9iNUlMV09ZK1l5V0NzUU45VzZl?=
=?utf-8?B?R2JNSUxxQkZRZXJQMTBXQTd0VGFlYVdCbHFHNzJMZEVFSUVnNUtnTURycEVz?=
=?utf-8?B?aXdGTzk3RHYzWFJ5WitOWnBWSy9NdG5RTlFlbVJKak9zNjJHYzE2YWdITE5i?=
=?utf-8?B?NzZScXRhdWFWTWdRWjNLbkU4QjB1Wk5Ja0VoM2ZtdGxWZE1JdXBBVHdpMkls?=
=?utf-8?B?cTczV1FoKzZremZxbHJieGM3dDB0RjRBQ2RPeGxLSllGdnQrZWcvOGhvcHRL?=
=?utf-8?B?K2NkODdZZlF6ZGlDdkl1ZTNzdkFCa3dhQlQ3bHA4WnMwTTYxdjY4bno2dUhR?=
=?utf-8?B?b2NQQnZUZVV2NU5JM0FNbElobDBwWm1CVE9IeGFIb1JuNTJ6MXFrQnRyaVY1?=
=?utf-8?B?WlpwbUdhY3Y1bmttN3h1ZDN0VDhRWUZVMmI2bUMzUkFLQTBSYXd2cEpLYWEz?=
=?utf-8?B?ZDJUZTEzMVVGTmY2OTVUR2U4cTB0WlVJOXpEaGtXZ1JkcWFaZUsvWDFhVWVK?=
=?utf-8?B?emRpTDRQNmZWb1JYZ0JQRCtYbkpZTG5XSG91d2xIdnBjVDRLd3NCRDZxVnIz?=
=?utf-8?B?Wm5GZUNxUG9VbHh4OVpQUUxjWEpaZDNPTVhuakV0Znd0S2NzVUZsNW9IUUE4?=
=?utf-8?B?b1A4VUVSZlluZ2RVSSt6dnk2QW4vem5sSUYvN1ZXTm5tUDZQL2VTNWlETVY3?=
=?utf-8?B?c3FEU3J2MzFVM2hwVm5SbGdvSlUvY2lqZUw1RmpNcFlUazR2Qm5MTTR3YXhq?=
=?utf-8?B?dnNRek50eGxhaUdHNER4T3VtbC9ZM1EzSHM5anI4eDlyeWI2Yk9ncDc2N0Iy?=
=?utf-8?B?eVZuMUpzTXA2b1JGL0VGS042cFdYaE5ZM3VIM0RvUGZYeUtwSUltNTFoa0lW?=
=?utf-8?B?eXN5VXRKdmNjTWE0NzdWWmRLZXRJdjNQUWtSNitHMlBEZ0ROSUFpdTNSSDZ1?=
=?utf-8?B?ekNBdi9nbWJqVmpsL1BDTFJsbWRid1JKakl4b0U1QTVxK2hZSHFMTUN3WjlC?=
=?utf-8?B?V3B1bHRHaUFTeGQ5dTRtdThyeEZrSU9sQjFOeUxwdkRFTlgvWWZGUjBMVmRm?=
=?utf-8?B?bTdYenNqUVJOaytNUUxMMmxQRU14aVJNVDJua29NaWM3Tm5rMGMxZnNndnlO?=
=?utf-8?B?WUNTa1ZLL2lqekJoaDFLTURtdml0NzVSRms2OTlGcGNXY2VpZ3NPdGlST3pl?=
=?utf-8?B?S0xGakdySW0wNWxlYzl1ZVJCZ2R2a3NSVXpxMHRCYzJYUjBtajBYKzFjUGVU?=
=?utf-8?B?clVOb084M1ZXK09xa1YwRXpHY2NOTGtBNTFCTy9mc0NnQjNoczlkVHVDekV4?=
=?utf-8?B?aDJlVXRGTnpFSCtpUEpVbERxazg0QmY3WDBWMTlWNGdlejVENU9qa05QNUJZ?=
=?utf-8?B?ajY0V251WGZ5d2JFVXJJSEdoc3FKZEhrQUpJQWNPU01GTkU5a0Q1RGZnbm51?=
=?utf-8?B?Q3ZyNHhva1NieVg1Y3VjVjJ5YStCcFBKVkVnUTU1SzFpQzhSSUZtckQzbjVt?=
=?utf-8?B?RTRYV0lVb05DbFVxWlYrKzJZVVBvaTdobmlkT3FPVDE0UFlTRC9DSFhSZHAx?=
=?utf-8?Q?iNoa3C?=
X-Forefront-Antispam-Report:
CIP:4.158.2.129;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:outbound-uk1.az.dlp.m.darktrace.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(14060799003)(35042699022)(82310400026)(376014)(7416014)(1800799024)(36860700013);DIR:OUT;SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:40:31.5769
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 11712f1f-4818-43ea-3637-08dda4e68fb2
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[4.158.2.129];Helo=[outbound-uk1.az.dlp.m.darktrace.com]
X-MS-Exchange-CrossTenant-AuthSource:
AMS0EPF000001AC.eurprd05.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 06/06/25 3:19 pm, Lorenzo Stoakes wrote:
> On Fri, May 30, 2025 at 02:34:06PM +0530, Dev Jain wrote:
>> Move away from apply_to_page_range(), which does not honour leaf mappings,
>> to walk_page_range_novma(). The callbacks emit a warning and return EINVAL
>> if a partial range is detected.
> Hm a follow up question here - why not just improve apply_to_page_range() to
> honour leaf mappings?
>
> What does honouring leaf mappings actually mean? You mean handling huge pages?

Sorry, I always confuse between block, page and leaf mappings :) I mean to say
block mappings, yes, huge pages.

>
> Would it be all that difficult to implement?

That is how I did it initially. But I think we get into the same problem
which you are describing w.r.t extending walk_page_range_novma - currently we
return EINVAL in case we encounter a block mapping in apply_to_page_range,
basically asserting that the callers always operate on page mappings. Removing this
assertion and generalizing apply_to_page_range kind of sounds the same as
removing the locking assertion and generalizing walk_page_range_novma...

>
> It seems like you're pushing a bunch of the 'applying' logic over from there to
> a walker that isn't maybe best suited to it and having to introduce an iffy new
> form of locking...

IMHO I think it is the reverse. Commit aee16b3cee2746880e40945a9b5bff4f309cfbc4
introduces apply_to_page_range, and commit e6473092bd9116583ce9ab8cf1b6570e1aa6fc83
introduces pagewalk. The commit messages say that the former is meant to be used
on page mappings, while the latter is generic. The latter implies that the former
was actually never meant to exist...

>
> Can we go vice-versa? :)
>
> Also obviously walk_page_range_novma() doesn't exist any more :P
> walk_kernel_page_table_range() is the preferred solution.
>
>> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
>> ---
>> arch/arm64/mm/pageattr.c | 69 +++++++++++++++++++++++++++++++++++++---
>> 1 file changed, 64 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
>> index 39fd1f7ff02a..a5c829c64969 100644
>> --- a/arch/arm64/mm/pageattr.c
>> +++ b/arch/arm64/mm/pageattr.c
>> @@ -8,6 +8,7 @@
>> #include <linux/mem_encrypt.h>
>> #include <linux/sched.h>
>> #include <linux/vmalloc.h>
>> +#include <linux/pagewalk.h>
>>
>> #include <asm/cacheflush.h>
>> #include <asm/pgtable-prot.h>
>> @@ -20,6 +21,67 @@ struct page_change_data {
>> pgprot_t clear_mask;
>> };
>>
>> +static pteval_t set_pageattr_masks(unsigned long val, struct mm_walk *walk)
>> +{
>> + struct page_change_data *masks = walk->private;
>> + unsigned long new_val = val;
>> +
>> + new_val &= ~(pgprot_val(masks->clear_mask));
>> + new_val |= (pgprot_val(masks->set_mask));
>> +
>> + return new_val;
>> +}
>> +
>> +static int pageattr_pud_entry(pud_t *pud, unsigned long addr,
>> + unsigned long next, struct mm_walk *walk)
>> +{
>> + pud_t val = pudp_get(pud);
>> +
>> + if (pud_leaf(val)) {
>> + if (WARN_ON_ONCE((next - addr) != PUD_SIZE))
>> + return -EINVAL;
>> + val = __pud(set_pageattr_masks(pud_val(val), walk));
>> + set_pud(pud, val);
>> + walk->action = ACTION_CONTINUE;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static int pageattr_pmd_entry(pmd_t *pmd, unsigned long addr,
>> + unsigned long next, struct mm_walk *walk)
>> +{
>> + pmd_t val = pmdp_get(pmd);
>> +
>> + if (pmd_leaf(val)) {
>> + if (WARN_ON_ONCE((next - addr) != PMD_SIZE))
>> + return -EINVAL;
>> + val = __pmd(set_pageattr_masks(pmd_val(val), walk));
>> + set_pmd(pmd, val);
>> + walk->action = ACTION_CONTINUE;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static int pageattr_pte_entry(pte_t *pte, unsigned long addr,
>> + unsigned long next, struct mm_walk *walk)
>> +{
>> + pte_t val = ptep_get(pte);
>> +
>> + val = __pte(set_pageattr_masks(pte_val(val), walk));
>> + set_pte(pte, val);
>> +
>> + return 0;
>> +}
>> +
>> +static const struct mm_walk_ops pageattr_ops = {
>> + .pud_entry = pageattr_pud_entry,
>> + .pmd_entry = pageattr_pmd_entry,
>> + .pte_entry = pageattr_pte_entry,
>> + .walk_lock = PGWALK_NOLOCK,
>> +};
>> +
>> bool rodata_full __ro_after_init = IS_ENABLED(CONFIG_RODATA_FULL_DEFAULT_ENABLED);
>>
>> bool can_set_direct_map(void)
>> @@ -49,9 +111,6 @@ static int change_page_range(pte_t *ptep, unsigned long addr, void *data)
>> return 0;
>> }
>>
>> -/*
>> - * This function assumes that the range is mapped with PAGE_SIZE pages.
>> - */
>> static int __change_memory_common(unsigned long start, unsigned long size,
>> pgprot_t set_mask, pgprot_t clear_mask)
>> {
>> @@ -61,8 +120,8 @@ static int __change_memory_common(unsigned long start, unsigned long size,
>> data.set_mask = set_mask;
>> data.clear_mask = clear_mask;
>>
>> - ret = apply_to_page_range(&init_mm, start, size, change_page_range,
>> - &data);
>> + ret = walk_page_range_novma(&init_mm, start, start + size,
>> + &pageattr_ops, NULL, &data);
>>
>> /*
>> * If the memory is being made valid without changing any other bits
>> --
>> 2.30.2
>>


Return-Path: <linux-kernel+bounces-675614-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6F2F441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:41:21 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C74DD189C2DF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:41:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B0A332868B2;
Fri, 6 Jun 2025 10:41:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="peLdSwy7"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D67A0284689;
Fri, 6 Jun 2025 10:41:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206472; cv=none; b=H0mYAL1gKXjw0clEFgpOvH7ufKDlmpuU/KsvRIE+IsZqJOvMGmVbUO/rbllfieiiLSEoodBK8kM18pwkx1zbDrulMSH7e8MAgBL/AO9WzqyHSB2FhPBPVdoXrQ5j4Cb6JszuWa8/DsR58ySQhxshxi0oy567XpRefNPMH/0isU0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206472; c=relaxed/simple;
bh=1RAJDfmY+lnaXEvqMTdbBLC/C9yMjAtki0kirkAjUxY=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=J8iBUJEk1gQmCQm0Yk06HYPsOw7wVLAFV6zWPx9fHJeRpZoRzq0Z0ZECxVQCKd3vwOlchzne/YfXh+s9/apygN72r3rXKz0OYUvnxNWNKZjoZ4PtAso7EUe+ZKCGZZ2Gjx7ax0CPFcms3Ejb1rysAmzRbkYA28f7wZE3xlimwjw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=peLdSwy7; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5EEEC4CEF1;
Fri, 6 Jun 2025 10:41:11 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749206472;
bh=1RAJDfmY+lnaXEvqMTdbBLC/C9yMjAtki0kirkAjUxY=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=peLdSwy7fJQdXOeMxrAFU3BAJG7QZRkfdVx0hSNDBwfu8WQlCsAxQy5D1+ZFFm2mm
gyUKLHu2IkAPqt+SpRshb8Ytp+7fINvHQ2TMOH/C6DsArXlR8mxrh3TEMSZdNy7FFR
tGWHRWeCMUxqeF+imif1ruWHeB4wNFUXmbTvh9YI=
Date: Fri, 6 Jun 2025 12:41:09 +0200
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Yunhui Cui <cuiyunhui@xxxxxxxxxxxxx>
Cc: arnd@xxxxxxxx, andriy.shevchenko@xxxxxxxxxxxxxxx,
benjamin.larsson@xxxxxxxxxx, heikki.krogerus@xxxxxxxxxxxxxxx,
ilpo.jarvinen@xxxxxxxxxxxxxxx, jirislaby@xxxxxxxxxx,
jkeeping@xxxxxxxxxxxxxxxxx, john.ogness@xxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-serial@xxxxxxxxxxxxxxx,
markus.mayer@xxxxxxxxxx, matt.porter@xxxxxxxxxx,
namcao@xxxxxxxxxxxxx, paulmck@xxxxxxxxxx, pmladek@xxxxxxxx,
schnelle@xxxxxxxxxxxxx, sunilvl@xxxxxxxxxxxxxxxx,
tim.kryger@xxxxxxxxxx
Subject: Re: [PATCH v7 4/4] serial: 8250_dw: fix PSLVERR on RX_TIMEOUT
Message-ID: <2025060659-reason-renewal-bff9@gregkh>
References: <20250528062609.25104-1-cuiyunhui@xxxxxxxxxxxxx>
<20250528062609.25104-4-cuiyunhui@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250528062609.25104-4-cuiyunhui@xxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, May 28, 2025 at 02:26:09PM +0800, Yunhui Cui wrote:
> The DW UART may trigger the RX_TIMEOUT interrupt without data
> present and remain stuck in this state indefinitely. The
> dw8250_handle_irq() function detects this condition by checking
> if the UART_LSR_DR bit is not set when RX_TIMEOUT occurs. When
> detected, it performs a "dummy read" to recover the DW UART from
> this state.
>
> When the PSLVERR_RESP_EN parameter is set to 1, reading the UART_RX
> while the FIFO is enabled and UART_LSR_DR is not set will generate a
> PSLVERR error, which may lead to a system panic. There are two methods
> to prevent PSLVERR: one is to check if UART_LSR_DR is set before reading
> UART_RX when the FIFO is enabled, and the other is to read UART_RX when
> the FIFO is disabled.
>
> Given these two scenarios, the FIFO must be disabled before the
> "dummy read" operation and re-enabled afterward to maintain normal
> UART functionality.
>
> Fixes: 424d79183af0 ("serial: 8250_dw: Avoid "too much work" from bogus rx timeout interrupt")
> Signed-off-by: Yunhui Cui <cuiyunhui@xxxxxxxxxxxxx>
> ---
> drivers/tty/serial/8250/8250_dw.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index 8b0018fadccea..686f9117a3339 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -301,9 +301,17 @@ static int dw8250_handle_irq(struct uart_port *p)
> uart_port_lock_irqsave(p, &flags);
> status = serial_lsr_in(up);
>
> - if (!(status & (UART_LSR_DR | UART_LSR_BI)))
> + if (!(status & (UART_LSR_DR | UART_LSR_BI))) {
> + /* To avoid PSLVERR, disable the FIFO first. */
> + if (up->fcr & UART_FCR_ENABLE_FIFO)
> + serial_out(up, UART_FCR, 0);
> +
> serial_port_in(p, UART_RX);
>
> + if (up->fcr & UART_FCR_ENABLE_FIFO)
> + serial_out(up, UART_FCR, up->fcr);
> + }
> +
> uart_port_unlock_irqrestore(p, flags);
> }
>
> --
> 2.39.5
>
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot


Return-Path: <linux-kernel+bounces-675615-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 82C7441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:43:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6FE873B09A8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:42:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D0506286D50;
Fri, 6 Jun 2025 10:42:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="YibZ/noB"
Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37F6A2853EB
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:42:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206578; cv=none; b=fdRXIKWOtXIdjUHwQPKSmr2MnAuDNP6WpuOWV1iV3rBaY6xGvfWdOB8wXJwl68OT4CxWcCtDARmbOJQ7ihtMiwpkHEvL9kQaBy0/ybqCmHlgUgK/fTuGB+caT93iTd/taAPb/U4l+GbafPJaR6k95+ePmy4+yIP6ojcI8nLqcKg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206578; c=relaxed/simple;
bh=vkmochM2SrgurI2OOeUhLIqKvSLPLxHe2qx4RPVkYM0=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=dr+Ew+/YgXL6pZ1fXxmLCHKltvCR0bFyRcjAvVAiE9GJBwvP+ipV4jxZ+sH0DL9uXcDA+ynqadoBb2/Q38rS+G3oHYH4buPsKT12jxzrGw6yVmgHX3L8/WbEZ4MI5bSLF2RieWvSNLJfEn2vNS6/9MqA7JBjJfE3AES9DsVLMH0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=YibZ/noB; arc=none smtp.client-ip=209.85.221.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org
Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3a376ba6f08so1157161f8f.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:42:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1749206573; x=1749811373; darn=vger.kernel.org;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date:from:to
:cc:subject:date:message-id:reply-to;
bh=y+nokHFtXpu0WDXP27AgjIbn53JQRm7K0yzN0KncLEM=;
b=YibZ/noBW9p5fbTljedjX37/LW/rNg2zIH6cr8A6m9dgCxyI/m2NBw1zs8mQZRGboO
6LcQyjx1+X76kagCCIGGm8/grQR4hBJuAJ6+UR1rdLXT0W3dzk02Wzk281wQclxppJ6x
FoPB95Z76o3ajldDZ4xQDn+QXazOexsRrOYD/01ICMknb6tGRTFpvXzJtmdMchDC9x4i
hxG+SRAQ7fdav9+ofvxi4tRHytVAGHVZpIO5z5+UmoXOYi/AtxiNunHlEdA9UwRe6Pp+
ul9bWJehKOO2uc3BGMJXjUS7C7YLrHB1zsRwb8lHSp0jybyOwUyWspHPG46U8Jezp1qx
V3bQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749206573; x=1749811373;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=y+nokHFtXpu0WDXP27AgjIbn53JQRm7K0yzN0KncLEM=;
b=UtBokfZcsmuqLvHgnMMn8+o61O6wGHt3VYnZkYjZ8JvoanDAvXCUE9AFoMQgKFxfwG
B4EwBXPqiuqHUljjSnX2lCUw72rzU00wjiQfATiKSQTlkUbJ8FVOSdfLWAdRM2n3N00m
EAv+U0I1Jyd39f+/zm4R8QeSN6YLanlf+iqUAVmGltFQFn2zknr6yEpVrNSQfEn1Isi5
qdQgKj1zC/6ifY8nNqfq9aUaM7ZL3zI355BMYXut3hOX4ThXzvav3/GOFIYLz/W1qlBx
yo14fUljwe8hOE3Kiw8Prf/+fmTERjI8a3mrUBpnh2oz0wd6g3JM2qNjxiAv0WXE0ZAa
iZ3g==
X-Forwarded-Encrypted: i=1; AJvYcCWq4ADjCdbxVriIHEJEzyVoo2S+/gb/BYzdl8p8wEfoHDaznKOQbUcxhtqDMAHPzjqj+T5Wau2Z5C8psfM=@vger.kernel.org
X-Gm-Message-State: AOJu0YwxOQGrN6N7lz7Rnmjkt5rp7dhbkiqdN//2zPVhoqxS/0cDHfuL
n3IvxEUdeBelQ44YBnwUCIW+r+TY0kUAcxCG8HTZdINhv+dhYHzxAg/QL8aQbCPa8iQ=
X-Gm-Gg: ASbGncucQ1FylYIrwStDfdkCRSaJfwWzckdzcG1xgci1tBlHt5NA3BiV2t9u72PgHWb
2cnyu8deC29sTtdTy94MluDT9oMHswNtk30Jpy/O0RGQIDy1UeRBlvZq9ReAhN+DAIHU+UjhuRB
w+l/KcCIDn2du0ZQSGFVD0xXQelbUqj1NkvPR4hrswMPRXGnFrpTYGLAW1CC7S24WbxlwIqP8fQ
2i8QLLvOtloPuNBxpCriIM448e2vMKOnG0TnhshRkebAtedZ2V9Ww7nd18++DohgdPzdVbRL1yf
cco/qhwrRuk5E2LizfPra8+3grCVlTEcLMYE0gZfHR6x8VMS
X-Google-Smtp-Source: AGHT+IEtx3a0U8v1fBCckXwCRNLbBtPgODWu90k6CS+zdoTBmpVDSFh/aW2UVu82FYy50xGmDq3LCA==
X-Received: by 2002:a05:6000:2dc9:b0:3a3:6415:96c8 with SMTP id ffacd0b85a97d-3a5319a78fcmr2195820f8f.41.1749206573116;
Fri, 06 Jun 2025 03:42:53 -0700 (PDT)
Received: from localhost ([2a02:8071:6401:180:da11:6260:39d6:12c])
by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a5324361ffsm1461768f8f.47.2025.06.06.03.42.52
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:42:52 -0700 (PDT)
Date: Fri, 6 Jun 2025 12:42:48 +0200
From: Johannes Weiner <hannes@xxxxxxxxxxx>
To: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
Cc: Jemmy Wong <jemmywong512@xxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>,
Michal =?iso-8859-1?Q?Koutn=FD?= <mkoutny@xxxxxxxx>,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
Alexei Starovoitov <ast@xxxxxxxxxx>,
Daniel Borkmann <daniel@xxxxxxxxxxxxx>,
Andrii Nakryiko <andrii@xxxxxxxxxx>,
Eduard Zingerman <eddyz87@xxxxxxxxx>, Song Liu <song@xxxxxxxxxx>,
Yonghong Song <yonghong.song@xxxxxxxxx>,
John Fastabend <john.fastabend@xxxxxxxxx>,
KP Singh <kpsingh@xxxxxxxxxx>, Stanislav Fomichev <sdf@xxxxxxxxxxx>,
Hao Luo <haoluo@xxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>,
"open list:CONTROL GROUP (CGROUP)" <cgroups@xxxxxxxxxxxxxxx>,
LKML <linux-kernel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH v0] cgroup: Add lock guard support
Message-ID: <20250606104248.GA1118@xxxxxxxxxxx>
References: <20250605211053.19200-1-jemmywong512@xxxxxxxxx>
<CAADnVQJyATTb9GFyBhOy5V_keAO5NZ6+zucLRyN27Cmg2FGPVA@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAADnVQJyATTb9GFyBhOy5V_keAO5NZ6+zucLRyN27Cmg2FGPVA@xxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 05:54:15PM -0700, Alexei Starovoitov wrote:
> On Thu, Jun 5, 2025 at 2:11â?¯PM Jemmy Wong <jemmywong512@xxxxxxxxx> wrote:
> >
> > This change replaces manual lock acquisition and release with lock guards
> > to improve code robustness and reduce the risk of lock mismanagement.
> > No functional changes to the cgroup logic are introduced.
> >
> > Signed-off-by: Jemmy Wong <jemmywong512@xxxxxxxxx>
> >
> > ---
> > include/linux/cgroup.h | 7 +
> > kernel/bpf/cgroup.c | 96 +++---
> > kernel/bpf/local_storage.c | 12 +-
>
> Nack for bpf bits.
> It only uglifies the code.

I agree with this.

The extra indentation from scoped guard is unfortunate.

The guard with implicit unlock gives me the heebeejeebees - it's
asymmetric and critical sections don't stand out visually at all.

Adjusting critical section boundaries with guard means either:
* indentation churn to convert to scoped guard,
* forcing abstraction splits along critical sections (non-API
_locked functions), which makes the code flow harder to follow,
* or straight-up violating abstraction layering and adding
non-critical stuff to callers where it doesn't make sense.

I don't remember the last production bug from forgetting to drop a
lock. Meanwhile, the things that people actually seem to struggle with
when it comes to locks appear to become harder with those primitives.


Return-Path: <linux-kernel+bounces-675616-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 87FF141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:44:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id AD3DE176BA2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:44:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6552E28750C;
Fri, 6 Jun 2025 10:44:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="fEP5eueZ"
Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2083.outbound.protection.outlook.com [40.107.244.83])
(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 D785220297C;
Fri, 6 Jun 2025 10:44:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.83
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206642; cv=fail; b=IrN184GO2WdGSB+S5lAzTgNGzMREtBt9M9RkuB6dXMol39ipPrGMTYCR7g4OPGP+hBxTE5rB9nHUiXTiNmvWz17OoBVQ9rNyzq36v56iDDT/KG/uqNiPZLPBmj/H6vRg5p/mpUh5jYucSWvdtHl5jNjSfvei1kmauidEGWRxBt4=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206642; c=relaxed/simple;
bh=UOthyO9ecjNpvPpbB18jjIcb00RU7+BW+neDeAYFcTo=;
h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
Content-Type:MIME-Version; b=Qzhc8utPkUUAI8NgcPWDGUBOwJ9Ty1lpRBoAvzdjRzAbYLCmEwlYfC6Y4/tTXexcIkGhferay0lAfZw1lTXm3b/l5KhRmJHVfKbRmdgCH3meooSFbrzr5rOGgbQHWVIVX0IfuctzuZe+WN2ofC7RKYO3RiVnjTTNpN1LtMxmJGU=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=fEP5eueZ; arc=fail smtp.client-ip=40.107.244.83
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=GNgUlAwF+sdRWaS8+7FI4R9PPjZZwpXqfdCAwYLuXaG2pPAykLGXRCrUehGNhgkMMkSkfzKTXa9TFRNxMhekY26NJWOHMNaFDwOAMtO0ivPcdSDKxUuBFxHZJDdRbPkZixVFtL6Ij8KXQpA4oPzI5o+rD44H3QaHMTaLrVj/6FfByep/51gJIj4oplp1pqT6ZpewOaFGv3UhmFrVnkVF7WvnM2rtRQjLDBFcUxirfOnyykniga1a7aqx6yc/7YJfB4v48/YJLnd026tvvNb0h16KYGm9oR7hWzNjuFxUgwzR+H3863mi8st16yYpmY676GZ6maptGQAaZSTKpeynDg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=UOthyO9ecjNpvPpbB18jjIcb00RU7+BW+neDeAYFcTo=;
b=ucUo5MTvvhr749HMMpEbuASqSXzEEoW+ItikZh1l2Vmftz+Tr2NFPDjXpzOTQJ2+zqL9OGmLUUwZx/pyT9YYnRgA5f4gJ77iXe+OA4ivbOwLhaAcRFCzCuHv+OFQOTB1iquBOeZOKV3bH9qC//PCzoiUegd48NCSexd9YXWLbig1g0HdEemKXpZIOolLrJlO0h4URwXhNc5n7vxLsGtrQjMTXvYToRMa4YIeZtIcgH8RF3Na2yjY7jGqo2/6LgCoymbAaXzCRecAUOj1PErB+PUu2Cpbvymt2vU+TkX8gkfyd5P/pEygAX0FJWxofbBfPmTV9K46BK2YbvWtDETj/A==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
dkim=pass header.d=nvidia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=UOthyO9ecjNpvPpbB18jjIcb00RU7+BW+neDeAYFcTo=;
b=fEP5eueZwQ6MN75h8EKqHFpSerw1hbU8/NzLcHuFETculcQHlUBJ34nt0YAWrwDsMM8zY+7UW5T0G/BM3RxcMh1LpX1XDBTHQ/cc9obg/CaH2TkL70G+u+8gCoQ231YkMyUzA/rNMxMJgSCsC2UkS8Zs3Gee0WDr5NTVwPRciN7XNSB+eGNK2Qb11r24NFyjK7UssAOznzApFhh8AR7CL+nzyTGZTviA1MnbvYb2V/i/JtNs4R+PT26tmWWfJyiHCkPJQJqASY0RlK1DbduM+n8z2l9plieCqlSg5pfgdkzCUuh0tknHcNNVcsrmsTdVUK43oPF53svI1IbjBOmSvA==
Received: from DS5PPF266051432.namprd12.prod.outlook.com
(2603:10b6:f:fc00::648) by DM6PR12MB4250.namprd12.prod.outlook.com
(2603:10b6:5:21a::9) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.34; Fri, 6 Jun
2025 10:43:47 +0000
Received: from DS5PPF266051432.namprd12.prod.outlook.com
([fe80::a991:20ac:3e28:4b08]) by DS5PPF266051432.namprd12.prod.outlook.com
([fe80::a991:20ac:3e28:4b08%6]) with mapi id 15.20.8655.033; Fri, 6 Jun 2025
10:43:46 +0000
From: Cosmin Ratiu <cratiu@xxxxxxxxxx>
To: "kuba@xxxxxxxxxx" <kuba@xxxxxxxxxx>, "saeed@xxxxxxxxxx" <saeed@xxxxxxxxxx>
CC: "andrew+netdev@xxxxxxx" <andrew+netdev@xxxxxxx>, "hawk@xxxxxxxxxx"
<hawk@xxxxxxxxxx>, "davem@xxxxxxxxxxxxx" <davem@xxxxxxxxxxxxx>,
"john.fastabend@xxxxxxxxx" <john.fastabend@xxxxxxxxx>, "leon@xxxxxxxxxx"
<leon@xxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx"
<linux-kernel@xxxxxxxxxxxxxxx>, "edumazet@xxxxxxxxxx" <edumazet@xxxxxxxxxx>,
"linux-rdma@xxxxxxxxxxxxxxx" <linux-rdma@xxxxxxxxxxxxxxx>, "ast@xxxxxxxxxx"
<ast@xxxxxxxxxx>, "pabeni@xxxxxxxxxx" <pabeni@xxxxxxxxxx>,
"richardcochran@xxxxxxxxx" <richardcochran@xxxxxxxxx>, Dragos Tatulea
<dtatulea@xxxxxxxxxx>, Mark Bloch <mbloch@xxxxxxxxxx>, "bpf@xxxxxxxxxxxxxxx"
<bpf@xxxxxxxxxxxxxxx>, Tariq Toukan <tariqt@xxxxxxxxxx>, Saeed Mahameed
<saeedm@xxxxxxxxxx>, "netdev@xxxxxxxxxxxxxxx" <netdev@xxxxxxxxxxxxxxx>, Gal
Pressman <gal@xxxxxxxxxx>, "daniel@xxxxxxxxxxxxx" <daniel@xxxxxxxxxxxxx>,
Moshe Shemesh <moshe@xxxxxxxxxx>
Subject: Re: [PATCH net-next V2 07/11] net/mlx5e: SHAMPO: Headers page pool
stats
Thread-Topic: [PATCH net-next V2 07/11] net/mlx5e: SHAMPO: Headers page pool
stats
Thread-Index: AQHby2KBqo+uwhRiLEu0s5b5lYH7pbPfO9AAgAAHioCAFsWjAA==
Date: Fri, 6 Jun 2025 10:43:46 +0000
Message-ID: <2c0dbde8d0e65678eeb0847db1710aaef3a8ce91.camel@xxxxxxxxxx>
References: <1747950086-1246773-1-git-send-email-tariqt@xxxxxxxxxx>
<1747950086-1246773-8-git-send-email-tariqt@xxxxxxxxxx>
<20250522153142.11f329d3@xxxxxxxxxx> <aC-sIWriYzWbQSxc@x130>
In-Reply-To: <aC-sIWriYzWbQSxc@x130>
Reply-To: Cosmin Ratiu <cratiu@xxxxxxxxxx>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nvidia.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: DS5PPF266051432:EE_|DM6PR12MB4250:EE_
x-ms-office365-filtering-correlation-id: 8e87ada2-cfea-42b9-d92a-08dda4e70409
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
BCL:0;ARA:13230040|376014|1800799024|7416014|366016|38070700018;
x-microsoft-antispam-message-info:
=?utf-8?B?dWl3Tzg3bVBoYkdLUGxTSnhNS0dCSUNMdHp6REFSMWUvOFJJcEZnWGl4bXpT?=
=?utf-8?B?OTFnM0d1aHgwSlp5SmZuNjh4ZUVaaXk1UWN4U29wczVJNng2bTI5YWlLbE5k?=
=?utf-8?B?enRpS09sc1F3bmRFa2l6VnFaQldrS25wcWxJMVdwTDl1WVErNkF2b29TWjhY?=
=?utf-8?B?MXZjNWJmMmFBa1lySFU5UzRmcjl1SHBSUFgzd2VSak5vWjkxd0paR2IvR0lZ?=
=?utf-8?B?L2dmeDUxRHlCNmplSDJYcWpWN2h3endVbndsb0Z3NzdQd2xqMFVHY0ZyYWg4?=
=?utf-8?B?MHNkZElROWE3UkE3MHJWREhES05abHpKMWlTOVpiS3VoMG9ZR0JlbjdzUWI5?=
=?utf-8?B?NklmV2FacEwvY2NneGRVbTB0TXJ5cWROOW5sZUs5M3NLb2ZsUCtqS0NHSTg1?=
=?utf-8?B?R3J5d1BtUE9QdlhNVklJY1A2aVN0c0dLVlB0UVNDaVh2a0gxY01nWkFUZXEw?=
=?utf-8?B?NWdkNW8vNnFEeG1BWGdRUHZLV3FkOVg3blFxczNKR2lRWk9BdHdQanJJaHln?=
=?utf-8?B?YW9yZEZnNHNjSHhGSmcwTnJsYmE1Vkp2ZFY0VmRNdVNOSHNDcnpsRnZkQmRa?=
=?utf-8?B?NjJYRVp1WGZCZUFESTkzVjFrdE9ZNldmRmNPMVVmb2JONXI5Z1JHNWorbkRI?=
=?utf-8?B?bmhGcFdtQnk3MmJkNXJtQ2FDSStHZFJzTURtTWE1eHJJdzFxZ1JUNVJDbC9Y?=
=?utf-8?B?cW9OUEZUWVlrTmZHREYram95SmthQnRRRm1aVkV3dW91SThQaUhPU3hPVm52?=
=?utf-8?B?SnpFeUhFd29NNWxBMlJGMjFZL3g5RkMrMjVoUHdKeWs5UlgyRlMzLzFZV3V3?=
=?utf-8?B?elNkajl4MHIvV3lQWjZaQWk0RUJJR0lPMkZsYWJja2x2YjFMYjl6c3hsVi9u?=
=?utf-8?B?SGZUU1NPSHpQMGVhcXVNNW94QVFBdEs4djRiNGZJSUU4VEx6STQwOWlwQTZn?=
=?utf-8?B?bnpVTjhrYm4rUUd4REVsUVl5UkhvVG9mUWJhRlJaNTE1elZYSDN2NzQ5Ykda?=
=?utf-8?B?RXFZU2V2dlNITzd3WjNKUjBuc1l4YmtpWEpIQTJIaDh0YnN1N0lLS3NjL3FW?=
=?utf-8?B?ZThnR1VEanA2Zlljd09tbjhjK0NYZDNSdzQ1SE5xWmhJQUoySGpvWmNqRnRM?=
=?utf-8?B?bEhTdU5hbmxxTVdLRm9SeVdGakNPbHlJSlR3ZCtoa0QweDN5bkpaUWw1K2c2?=
=?utf-8?B?ZWZ6MXNmOTZwdi9TU0E2UHAycHIvKzdqeEt3ZnJlSjhUSjFMS3YrNm45K0c4?=
=?utf-8?B?TUJuU3NxckF0a3d4dWYyME43dWhVK3FVYmVlNStodXk2NTZweGRqRWlEY1FN?=
=?utf-8?B?YjdKMFZNQitWNTB3alA0NFRqN3hON3V5NXZOS29xVWtJNFkxb2EvMEljWEc4?=
=?utf-8?B?Nks1QmdLTk1UYkFwM0FaSjl3UGpVOEQ5eUIyTmpXUnVDSVJvTWRacGY0VXJY?=
=?utf-8?B?N01iMlJwWDFJSDVxdnNZMXdxUGNhTWlENEs3WUZvb0F4VThZMFlSRERyb0ky?=
=?utf-8?B?L1lnVlVyd0xMWGU5dVZoS21YY3VydFh4QkZYRWtkQlR0c0hOZUZsdkJIOUMx?=
=?utf-8?B?QTFJclRZU1JDcmNDb0xGUlFEOElxZHBibFhoOWNtaDhzMnFGYUoxT3NaOU9t?=
=?utf-8?B?KzVWZE9hNWE5dExYTDl3NTVaUmI2aFoxbGpnMGxjTmhpWllxSm1UQU56NkFC?=
=?utf-8?B?ZlZSaTkzRDZYMXpHTTF2K2IrNFpRM0ZhQmQ2cWZsaGdRTW5kMkxOT0kvbDZR?=
=?utf-8?B?VFM4WktpTWpjZGsxOTFpcWptdVZHR21vT0ZNaGN1SkErVnNBdUMrelh4Q3pE?=
=?utf-8?B?ZTBtejZIMTU1L3VzK1lMMndzTXlFY3prN2xiaGozRUxVSzZ4RDZrdTdmKzM5?=
=?utf-8?B?dGdOWTFMT0gxZmt2VXluMWUrMGRWY3NiM0FjaFF4SEkrZ1Z0ZC9Wc29jU1Q1?=
=?utf-8?B?S3NQc0FFWnR5VGVQTzc1ZGE1Z1Z2Qlo4MDQvUFFTL2VaemZlQllqRCsxVUw0?=
=?utf-8?Q?Ot6oRQVsZNJJhHoW2xrLpKCs6Jgytk=3D?=
x-forefront-antispam-report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS5PPF266051432.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(7416014)(366016)(38070700018);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
=?utf-8?B?UkJJNUFhOG9kTTc4eEljQmMrQ3o0RlluWXIvTnlLTHg4ZTdLenN1QVZ2L2U5?=
=?utf-8?B?QWoxbC85U2JPOTVoMllNVmI5NTJhRHlhejhXUFlveEYzN2ZFTHNaUTY2dWNt?=
=?utf-8?B?Z1I2RkViRzNRSkJEam5MV2RhQ2tKMTRNUnFCNCtraDFnQjI5YnA1T3RWQ1Fy?=
=?utf-8?B?ZVUxYlhvN1FiRXNsZ3gveHQ5djE4ekZ2aUF2eHNwTDZlWnNvZzdZY2dYbDQ3?=
=?utf-8?B?VUJRckxwR1NxOWtSRDgvbHg3SGpoN3BZU3FFV0FRSnJpZ2N0cVoyVkpqVi8y?=
=?utf-8?B?M3ZVUG1HZzV5WkR3UEFCZnNyVGQzbzFGT0hXdnUxVGxZT09hMThHV3ZwZmc5?=
=?utf-8?B?dXRjUk5tczR0MlVaTURMZHZGeVdMZ1pKaGZwSkh6bUZTVllHUzdHU0JBcGcv?=
=?utf-8?B?NkZOVk1WSjRIU1lWV2lZZmlId0xPeFRmL1N4OHdzWjJ2ZksyMXQ4Nzc4UHFK?=
=?utf-8?B?Q25qTlpQcmcrZ1JZam1OUXdTS1g3cEdDY1NOVHpnZEdjUjdzQmQyUVQvdWZS?=
=?utf-8?B?UHdqM3JOQS9ZMmZSQjRGVzlhbGM5ckdSaG9TbGxrMUFFSWF1QWhnUDJCekQ5?=
=?utf-8?B?SUcrcmhqRDJvQk1WY0pPcG5SWjFtN1ZaU3Bac2FTQzNwUjVTVmkvYWpHQ0hL?=
=?utf-8?B?S2R4V210TFNMb1QzM3B3UFFUbThkRGU5b3EyK1hrSnVjZzJaa3pXeGw5QTVa?=
=?utf-8?B?bDAvYWJjeGFOY0ppSERKNW1KT0VLOEFFUTJIR0pMRnorbmVpQXZ3eFBaT2dC?=
=?utf-8?B?SzlKd3BoMjZrSytRRkU4amVsbGNVcSs3MGxzOUFucXNUMytXRzl3ajkxM2Nz?=
=?utf-8?B?cVpsT1ozaXFraWxpbkhBZTMyM0NrbDU5UzMzQmp6c0VLblU4Sk5zVmJFOHBz?=
=?utf-8?B?QnFFWEIwZVIrRWlTR1BUUWkzMmdmN0g2cE1JMU04WGRLQUpzdEZCY3owRkVB?=
=?utf-8?B?WHdtY2l6RTZNV0llam9VdHpWbGEzZEVOSHRJTElBRTNNQmNEb1pJU0w3WG8w?=
=?utf-8?B?cXlySzZMOXdEcDJEMHhtTGRqQ2V0TnVmak02ekZWamdVdThiUWpVSW0wSUcw?=
=?utf-8?B?c1llWmp4UWxJQk9PdnVjcnRxTmVncHEva21MNmpvcDQzZDJ2bnU5ZCtheUhp?=
=?utf-8?B?WUZENW1ac3FzUFFpNmV1SmhJaUhXNXpWL0Y4aGxpOUZ2V01QN2EyRWY2NFUv?=
=?utf-8?B?TXNnS2NBNldoaW05OXEzQkYxcWxYYTR3dkY0LzJWWk1ZZXI2bmdvUDlrNTJN?=
=?utf-8?B?MHE3Tm96NEN0enpUWFY4SzFQRzZ0MVU0NVJsWFFZVXlydWM2QVVWWXh3dEx5?=
=?utf-8?B?SFFDczBTRmRLVTlmTUt4enBncWs0MklPOVd5WTVmMDQwbUZKWDIzc2RsT0tN?=
=?utf-8?B?SlE3OVV3aHVrVVBCRHI1bHAxMGN3RldCYjcrcU1TMXo3UmZBMXVscDZiVFRX?=
=?utf-8?B?K3NZbjMwNDUzWkM2VEZUNmxKbFZGRDNqS2pDMTFibTFBQWxTWktwS01OOGFh?=
=?utf-8?B?cEpKbTF6Q29XeTFpSGtac1ErbFpDaHZFbTVHblNHSlljS3ZBeHFqRGp1eGly?=
=?utf-8?B?WDNhem1EQk42QmNGVG5LY2VPcnFBMlduSUhjU2xEV012TkhNQWlIOGFCZmFZ?=
=?utf-8?B?SEFJSGVXY1U4eTVjd2VvUlhmZUJsbHdaQWpHc1F5aFNUSUpuTWllNEhKaWox?=
=?utf-8?B?aEdPQlptT2NmTG5pTDB5Tm1jdkhzdlBqbGRzeWJKU1oyRFF2RUdUbStYSi8x?=
=?utf-8?B?aFVraEhBS1FOL28zZ3VTeG5JdWZIODJiQjIxcDhub3pjVkd4UnRpa015Qzhx?=
=?utf-8?B?c1ZOM3lmL2NodmxETTV6R2tKMWE1ZWFvdFNZKzJTRXVESHRTM0Y5TFJrRGxv?=
=?utf-8?B?dmgrRGx5OVJid2o5V2RYbFVWYTh0ZUlKTWhvSVpybmVtMFgxSnYwV2RpZDdU?=
=?utf-8?B?Yk9OcWswYXFTMWQzMUluUGdGR0lLN0tPUjA4WnhlbERHd09KVWhlaDVFM3F0?=
=?utf-8?B?RVBQSEpSZkpFc1B2ZUNjNFlueTN0UDVUWGZSeTRXTi9FM09oZ3pKN0hMNEc4?=
=?utf-8?B?VWVTN2QrQUVVOSsxUVlRRnlzYm5KYnFKM1ppakhYTDMveFhlb1A4azdsRUpG?=
=?utf-8?Q?VvZy3+Jld0Z+HxBBsqOnhKleC?=
Content-Type: text/plain; charset="utf-8"
Content-ID: <10E04FD912DA2241BB64AB893A059987@xxxxxxxxxxxxxxxxxxxxxxxxx>
Content-Transfer-Encoding: base64
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DS5PPF266051432.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 8e87ada2-cfea-42b9-d92a-08dda4e70409
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jun 2025 10:43:46.8035
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: RSrbj8MCCl26x5jS+OVGL32/Pok90PFCmzQ/xxOYnyDJJbPuW5bWxqEpBSSrVQhwHS8ZdEEy+bw9CmjtQZTbsw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4250
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

T24gVGh1LCAyMDI1LTA1LTIyIGF0IDE1OjU4IC0wNzAwLCBTYWVlZCBNYWhhbWVlZCB3cm90ZToN
Cj4gT24gMjIgTWF5IDE1OjMxLCBKYWt1YiBLaWNpbnNraSB3cm90ZToNCj4gPiBPbiBGcmksIDIz
IE1heSAyMDI1IDAwOjQxOjIyICswMzAwIFRhcmlxIFRvdWthbiB3cm90ZToNCj4gPiA+IEV4cG9z
ZSB0aGUgc3RhdHMgb2YgdGhlIG5ldyBoZWFkZXJzIHBhZ2UgcG9vbC4NCj4gPiANCj4gPiBOb3Bl
LiBXZSBoYXZlIGEgbmV0bGluayBBUEkgZm9yIHBhZ2UgcG9vbCBzdGF0cy4NCj4gPiANCj4gDQo+
IFdlIGFscmVhZHkgZXhwb3NlIHRoZSBzdGF0cyBvZiB0aGUgbWFpbiBwb29sIGluIGV0aHRvb2wu
DQo+IFNvIGl0IHdpbGwgYmUgYW4gaW5jb252ZW5pZW5jZSB0byBrZWVwIGV4cG9zaW5nIGhhbGYg
b2YgdGhlIHN0YXRzLg0KPiBTbyBlaXRoZXIgd2UgZGVsZXRlIGJvdGggb3Iga2VlcCBib3RoLiBT
b21lIG9mIHVzIHJlbHkgb24gdGhpcyBmb3INCj4gZGVidWcNCj4gDQoNCldoYXQgaXMgdGhlIGNv
bmNsdXNpb24gaGVyZT8NCkRvIHdlIGtlZXAgdGhpcyBwYXRjaCwgdG8gaGF2ZSBhbGwgdGhlIHN0
YXRzIGluIHRoZSBzYW1lIHBsYWNlPw0KT3IgZG8gd2UgcmVtb3ZlIGl0LCBhbmQgdGhlbiBoYWxm
IG9mIHRoZSBzdGF0cyB3aWxsIGJlIGFjY2Vzc2libGUNCnRocm91Z2ggYm90aCBldGh0b29sIGFu
ZCBuZXRsaW5rLCBhbmQgdGhlIG90aGVyIGhhbGYgb25seSB2aWEgbmV0bGluaz8NCg0KQ29zbWlu
Lg0K


Return-Path: <linux-kernel+bounces-675617-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1F9C341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:44:49 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5D3E517783F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:44:50 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 526C8286D6B;
Fri, 6 Jun 2025 10:44:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jo2tSibp";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="LAdf4wV6"
Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32])
(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 053563234
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:44:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206681; cv=fail; b=rYH79AV2za8BPX1qAfrS8m11TumsRHh08CioqSXhtDepE2Jt2FfH/gxwFbYgFbFTJYS2yDaYbKi5tdJrhXootrqccAyfCu5DvsNHQ2amv5jpdo7Fj8/TmpS5w6xO2pLELzXRcRaL6CZnTpWroxHAD6h1wWvNvrsSTCgqyMyN9wg=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206681; c=relaxed/simple;
bh=2gGkTn9eerW7Mb3q5/oepd/fQDHg4LIcbinn0GgMTW8=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=bh4t/HWjq8p7TskyY0A8xjRyij8ypC/v2SYbZjNzJQV3+idBR9R0LH1p5np93OLUIK4Swn9EVZImnxTSZeiQa2Jm9VaZgtVzTRm44I7V9e1VC0TjouLWVyoVGr9VwE01Und0eLLHQchN7ISR4oOxj68tdwbozcM5e+sox0tfycI=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=jo2tSibp; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=LAdf4wV6; arc=fail smtp.client-ip=205.220.165.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246627.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NEff032745;
Fri, 6 Jun 2025 10:44:16 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=
corp-2025-04-25; bh=+79iV2X/90oQWOVa1w4+HhAblMbL1NKPbHEsls0SsfE=; b=
jo2tSibpyqvwVBTLKoPYnjUz7jvEdt4rOFoHTX+xuUUeWYc8pBrbvpM8t5v1zM1y
1dEZwe90KypzQvYomoK3LnjzACuVbzQJKIEzfU9znaMeeMdvMIV6QOmj0ZuocoGZ
X5qo0ev91xS+Amb8JNwQdTTbj0GmAHrGR+Xc7BIs37dbIxD2ppjusGwYl7XXdEbz
UgKhlHTbJvjOuKYqMHAGtYJ1vQhJ9ET4dvvjPRvc70TzRH/Yd2dGIYi2Fz2d8XnZ
HpiEwNXLzfSjxx41q5IgbhFIgLo+AMRNUg9cj3FSusAbqNbLaRQbHaKwFq8C/Cec
G2dEXaZgHXDDU07fUFhT3A==
Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8cysna-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:44:16 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5569kH35033797;
Fri, 6 Jun 2025 10:44:14 GMT
Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12on2071.outbound.protection.outlook.com [40.107.237.71])
by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7d51fm-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:44:14 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=Ogg/RKPfo0a8ewBEYFN3FT/kbGXX62vnxFSVKg9hPnFuOQ85mU+dXz682DnHn2HQnPK0jTg0dogJhKYGBCNDntp1JBGncl5xQh8l5ezWSqyEMw+rtplmPiL8OX77WqTUpTlCtxQWdn2o8NgIlA4AjM59tFmYXpUzlDdrr6OVYPi9wKKp8kTdQMhI32SFCK2jlf4CL8AZojXsatElQuDC3gZ9Z3vK6ukvGUlSDC9lRugYlUSm3K4CNW8y6Iu6E5UQzUE/4SJuIhysZEuD6IUGyy0HovziEATi5i3WfveQzqaEUKSJMbMsyVOZf1rZsttjqVHxzGsqmsT8+r01kkiAjg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=+79iV2X/90oQWOVa1w4+HhAblMbL1NKPbHEsls0SsfE=;
b=R6GAGemuUjS7URd0qd5KIR///nuG167el+1IVR3WQVnFDk8+OIJ3pjoYamvliKe++f3N7TmELG5R5onmaHi/mLOZVL0Q44KUzFFLj3rezTUaVRgZKCnpZD3qdG98mny17PzQcqY78EDDNRTGbvxXoL8+gWIq7wc72XCu5rRNvxgFhZcGDZlufc9ZmnuvNVV/gN0VtmOl8XYnY6rHUrSSVFXIlc5Bg/OcSqMMlS7RKA+vTkHCx9IckqmR/6HqNfMYmo/SWfTG6GWFF6neDyPmh39IRKINYxIvvmfPd2lV+MvIAuBF03NWck7ZSwjezYnRwzInqC6/z/bCjkWtBVMC7A==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=+79iV2X/90oQWOVa1w4+HhAblMbL1NKPbHEsls0SsfE=;
b=LAdf4wV6Swlnodb9QYCiwl548MOymFZpiidi6b7d8aO9sQJ7fm/SYuUUurRACWQ7UdwbQ+VYvzurKtW6TDOIaFiP19M3Jd1302G4OoKgzz9tXUFT0h+ohnXKIBeaYWO1B13xWnHFGjvCxk0TRO/qo9cStSz1GaKbSh9gI5qyh3M=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by CY5PR10MB6165.namprd10.prod.outlook.com (2603:10b6:930:33::15) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.35; Fri, 6 Jun
2025 10:44:13 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
10:44:12 +0000
Date: Fri, 6 Jun 2025 11:44:10 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
Cc: Jann Horn <jannh@xxxxxxxxxx>, Barry Song <21cnbao@xxxxxxxxx>,
akpm@xxxxxxxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Barry Song <v-songbaohua@xxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Lokesh Gidra <lokeshgidra@xxxxxxxxxx>,
Tangquan Zheng <zhengtangquan@xxxxxxxx>
Subject: Re: [PATCH RFC v2] mm: use per_vma lock for MADV_DONTNEED
Message-ID: <d68ba9d4-5850-4b70-bbf3-00d79f19fd3f@lucifer.local>
References: <20250530104439.64841-1-21cnbao@xxxxxxxxx>
<CAG48ez11zi-1jicHUZtLhyoNPGGVB+ROeAJCUw48bsjk4bbEkA@xxxxxxxxxxxxxx>
<0fb74598-1fee-428e-987b-c52276bfb975@xxxxxxxxxxxxx>
<c6dbfb68-413a-4a98-8d21-8c3f4b324618@lucifer.local>
<3cb53060-9769-43f4-996d-355189df107d@xxxxxxxxxxxxx>
<c813c03a-5d95-43a6-9415-0ceb845eb62c@lucifer.local>
<7cb990bf-57d4-4fc9-b44c-f30175c0fb7a@xxxxxxxxxxxxx>
<bfb56be6-d55e-4dcc-93a3-4c7e6faf790f@lucifer.local>
<f0069b65-9ca8-44e5-8c98-1d377798c31e@xxxxxxxxxxxxx>
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <f0069b65-9ca8-44e5-8c98-1d377798c31e@xxxxxxxxxxxxx>
X-ClientProxiedBy: LO4P265CA0203.GBRP265.PROD.OUTLOOK.COM
(2603:10a6:600:318::17) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|CY5PR10MB6165:EE_
X-MS-Office365-Filtering-Correlation-Id: 52293322-a206-44cd-e274-08dda4e7135d
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?VUZ4SkFtTE5tNHlEbnBVeFpRMFkxMi9TNnJqanorMTI4Z0Rwd1VCZVdLNjAr?=
=?utf-8?B?SGpzSmUzT2QxM01TK0RZSThrYnZBQXRZaUxDNFQxS1JRYkt2NWdNZWx0cDBr?=
=?utf-8?B?QnVOUHU5S2NqR3VZZzNxVFRMTlh2VWJEUmFiUHJQb3oxZ1F2RG5yUjFoTFFo?=
=?utf-8?B?QWNCWUxjS0xFLy9uZHZLRGcrRmFsTk5LV3R4Z2hWZWxKS2pMVVpPNWxrQzMw?=
=?utf-8?B?TThVK2ZBUmpSbnM5cDZvbTNHdU0xTEJGeGFDWHNyd1pXRGp5WEJXWERFZVlk?=
=?utf-8?B?Z2xmQzVVTmR0UW5HRVl4WnJEQzk4WWQzeDZvZjhCM3diQ042U1FtSDd0dGEw?=
=?utf-8?B?VGhVQVJBOWcwSE9oWm4vRWltbzE4S0phVHlab01Jc0dXdGp0aHJRa1NrclVW?=
=?utf-8?B?NFNUb0lYMzZZMG9oZDUwb1pKVE9pTVR0NUM3RVB0RFlObHZNc3hlVXNOYUVL?=
=?utf-8?B?dHVxeFJZVEt3cjU3dHE3TGtEbzBkWXRsczRjakdEUXNhUXZrb0dSTTNDdmpa?=
=?utf-8?B?RjVWMVdIaW1WMXc4QzBCYUxUVnhnL2N2ajJydUVpYWxjZVpYcVRvTlNDTEZw?=
=?utf-8?B?R1BqNjJONHZLaldHdElyZ1kxVjRDTk5TOVVoSVJURlpGOE5RdXVuRWRjQU5s?=
=?utf-8?B?bDZGWW1zdXdGNHJ3VkE5TlJINkcrSXhuK1hBUFYxbldVelR0K1lnNmxac2ZE?=
=?utf-8?B?VTlZaFNZem1MQi9yMXQxTVdGSjZibHN6Q0tWYTllTkRMbG4zSi8zVDlGSW9q?=
=?utf-8?B?Wnk2eW1FcTQ0UHNUY20rTyt2bFVGWjBuRkNPUEJLSG11c29iS2hhUXptV2dh?=
=?utf-8?B?d3pFVEptdFBienZqQ3d5bVZOcUxIdEJoYmhreStNNWFXSDlZZmp0c0xKck9L?=
=?utf-8?B?ZWl3VDZhM0Nvek95NURMazI4bDVOZkZPRVRkMXlVeFNMQld1T0YxRzlxZDJj?=
=?utf-8?B?SmdISFo4U2xHVlQ4M1FHZmpOb0V2YVRIUVo5aFhibjNITk9XK0N4WTM5RDJy?=
=?utf-8?B?ajhic1duVTkzSU52aDhXMnE0ZllpVFhmQ2o3MTBEeVExRWpZVzJHZHF2TmJj?=
=?utf-8?B?aGRITmVCU0ZiUDhUcEh6S1l6YVpZYTZjZnY4bDg2NldLOUxob2dNcGUxdmk5?=
=?utf-8?B?Rk9qOU53cEhpQmwrZS9qQ3Z0QVdmUk9LdXIrcFM3bmcvZk9LUkRWVkRWVENF?=
=?utf-8?B?R09nakt1SzhHQmlHWGZYN0tEL0dvdVY3VDlhZnlINlFkRFR3bG5rSm0vWS9q?=
=?utf-8?B?cEJERmdTeHc4dEFOQjdYUjViYWRycTY3ODJ6cjhzRUVyN2xwSEtBWGdDbWd5?=
=?utf-8?B?N1l6NDRnUkRPditpMDFib3BMZklVTFpnQnRqaDBwUUhLWHV1OHpxU1J4eHpy?=
=?utf-8?B?czcxQVJ3Mmx5eFB5QmdJYUJPTEYwNU1oNWN6TlpQZWVleXZWSGNTQTN1Yk5T?=
=?utf-8?B?akU1TWNpYk1hVktnUGQ5dDhCTkRBZWFRNFA5ZkdDdjVpNUpRRTJ5QktLUGsv?=
=?utf-8?B?THBlWjF3TUNQeDJUeWxrSzBXTlVaRFJuVXpJVmVReXdHc2RhOHBuMmQ3SENP?=
=?utf-8?B?NzViK0tlUlZ3b3NwYTkvNFBGM1h4a1hEM1lpNWZFb2d1YjN3b09lU3kyNEE5?=
=?utf-8?B?LzFjaHFZQ2ZDRUNubVhubVpwdHpDYmpRZ21PcGhsbGswZzBWTWkrNUsyTkIy?=
=?utf-8?B?MGtxVzdmWlBHTitpOGZQckd4TnNFbnRCZ0x2SkhOWGpnSHVMTGxINUFqZzI2?=
=?utf-8?B?cXdveVhLMnBDcVJPZFVqa3U0dHl1ZllBdUpkallsclo4OW5SOG9iaVRzNzcz?=
=?utf-8?B?WTdlQjVlOTlhZXpMRzA4bzhaZmVsampCMHNhQ0JPc3JhbjBTNGpoOHF6ZUJt?=
=?utf-8?B?am5CVmR6amZGL3ZlL2tzTGo1S2V3NllEeVhRZmJXNjYwK3c9PQ==?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?RDY2eWJTWVBucVgyWXl0aUplSXd2ejh5eHJnZUtZeUlzUjZoTlpsUmk3cDFY?=
=?utf-8?B?RlNzMTJzK0xyb005cjlJUGlOSmJ6bUkwenFveStUMjZPYkFYR3BkSHp0MU5j?=
=?utf-8?B?SHBtaW53eVlvY01EN2Vlb2ZGaWRRZk9jMWpyV2xRTE92OS9KMlV6dnQ5Vkd3?=
=?utf-8?B?QTczYmpReHNDODkwK01ENUw0VW16T0IwTWVsVmhhZHB4WjNIckJ4ZnVDWTVw?=
=?utf-8?B?UFF6WVhJbXJLM1E4RzlPOVUrZTVYS29HenZUQ2ZNMFBldnFaV1VWNERUUkVV?=
=?utf-8?B?UGVLaXNBbmxtMVViZWRmYUwyRU5QNm81OHFWc2Z5a2ZuN0h5SVhROVI3endY?=
=?utf-8?B?ZUp5allKRHZiYkdvY05CdG0vTlRDOVlSNTd6NFFMd3F4cXlCVERKeEpGNzMy?=
=?utf-8?B?RTdnTEJ4dWJ2UnV6Vlp4R3ppcTRTWFlTSHZGTzFWek0yeXphU3ljSTA2OXp5?=
=?utf-8?B?cFdLTnV1S0dOdHd2U0twRU5WTmFZeG9SSEdoRHVCT2d5ODVJSVFFa3F2SnV6?=
=?utf-8?B?QUtSbDc5KzNUdjB6WGZMcTlZWGR3TkYxd08zUWd3TnhJdm9UQmZPMkY5b3Zs?=
=?utf-8?B?VEVUZUFYdUdmd3VibC9yNDBVUGZUSnZIbWVsWkRGTHo0OXlCdFhZT3ZEbDhY?=
=?utf-8?B?bTQ0QTdSZlMwTnI3ZjY5K01ZUERPL21mcldZeTVNZURyeXJiV0cxbU9HZjFy?=
=?utf-8?B?bXV3YmVjRFU2THZ5YnpYekd4NVAycFM3eEg4THJlSGlEdlVyZUYwbkVWcDVh?=
=?utf-8?B?VE1CaFl0SFZoY1M1RVlJK2VSYW5zclFPNmpPUjhRMTdIQ1ZKM3lIUjN6c3hF?=
=?utf-8?B?ODNOODNaNnAvU2t3d283TVNVQjg0ZlJORE9rYkhDS3RKaVdvTzREMGV2M1ZX?=
=?utf-8?B?MkNrTWY1TzBFbmpnMjRTMlRFd2RHbzZpMi9PZUhmdnRoNHlzbXB6OGdPYkhW?=
=?utf-8?B?Tlp5ajRxNnNlR3YyRTVEcnZsQjRwRW9zc0xjK0hITGpVMm9vSDNGckRJTExM?=
=?utf-8?B?VmszcHhHZFJsMHV1bGtFRzM4V2RqelRLZVoycU9qMkF3NzQxZFRjbm5DQnNN?=
=?utf-8?B?VEFqZms2YVVkbFpuYlo1amVZWTlxTnlja0wxNzNYT3ZZSG5BWUFtYXlNK1pW?=
=?utf-8?B?TlRZK0JmZENMVzNVdzNIMXo1MDZlaEVrUGxvZk5TNU9YUDNMaTdNQm13Tllj?=
=?utf-8?B?QzF6dFF0NGxPa0ZVRit5Y255c1VscmxKeDZOWXRMQ0JFUzhoUDRaeXVRcFNy?=
=?utf-8?B?TUhXRzlEa1I1Q3hBVnNSd05uZlRmQ1ZtRGxvT0ptZ2swZ013VEVFV2VnSW9a?=
=?utf-8?B?UDBQdFBJcURoV2lGcW1UcmpFdU4rYjBTMzNzdDNUMTBjOVZDMEdYTHE1NXl2?=
=?utf-8?B?eFpHS2F0SjlwR0dvdnZpTE1CWGpubEJHNlExMGZFcThEbzhvZHh0ZGRmbTc0?=
=?utf-8?B?RWhvNXJ4Qm42Z29qc05wTU15dncwcWx1YXYrSVRDdzY5Nk5MWHIzVkFnOGQz?=
=?utf-8?B?amJ4Kzkrd3R5a1JXM1E4WmcwZ0FmNERnMXBVSkxrWGxLZ1FPbkliTjlwZWE4?=
=?utf-8?B?c3lSdjdyeEVUTW82UFFyc045UlV6L29Vc1ZzeVhtbkpYdUsvWk05WXNxckRV?=
=?utf-8?B?eUpQN0pSRVNQOEw0bzM0V0R0UEsrcWlUZDAvWGFTNG52WCtJV0Fram0xck1I?=
=?utf-8?B?OERXSHlHWDQ5LzRRNWhzMUgwRmpza2xJV3UwTDhtOG0xYUFDdzNlWG9FRFY0?=
=?utf-8?B?NXZQRGhTU2VhY1VyczJjbnE2RlJDT2Rjb3AxSU5SajdLVTRiUlV2akthSkhR?=
=?utf-8?B?alY5a3hJOVlyM2tGRlp3dE9KTG52OGp6TEQ3UHcxMlpReTFRdmhIZkJmQlYw?=
=?utf-8?B?VXoxNFZIWTdJQlMrcnZvVXhVQTNUQzJhdXNuZW9vSlYzVTJEUy9GbUltcUZn?=
=?utf-8?B?dytJMjNvbDBBeXg1Y1h0QnVCUnBrVE1mU0cwNHp1akttMlA2aWExU3gvay9z?=
=?utf-8?B?dFVWYUpIa1FpM0dTUkw2SlNwd1V5RzlVM2lzOTZseVhrMnFWYkhpQXBqT1RR?=
=?utf-8?B?NHlGVWJBeUU1Y2VaNjh4YUJHYnVYWXZDRHpvZmJvbUV4TjlaYXJ5OU4xc0N6?=
=?utf-8?B?NUhuL2tuMDU1MGU5cEZ1cTlsbmFmNlcwMWtKMVlDMjVuQkx3UmFNa2Q3VkZw?=
=?utf-8?B?a3c9PQ==?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
18hDQbViQdV4vrLlbHN4woAwG7CMnJKallFbtEprVh1T9UqR+8WuXpXYRf3CdhPHTtM3MvdBwAJNCWmBKzWzAYHHy4mCBZskb8md7OpOScVJvbRgZzJb92E3R2NQUkRZOXQ5N6gzfNSWyTc//LnZ9zWPVXNMM8vHaT0+UmDqrKuItq46gnlLNz8oak+32RidRmf2nXr8mnSJ8Z9QciW5ZPyXzjY8OP4uQVeyiRRghPbLkhZD95iryQU2SgDL39pSihynM8Nd6uHzb9UfkFL4i4pEv6aNBR/GQbNu920T1BdbJoyz6qzLjbQ15vOTeiUhsryurEdF6athvni6RmwrvX7Mt6fvwuYTd+PCLz3M7rjavNolPWpZgzWSdqB5iT1fp+AYdzEIhNkO/ZHpWHBodD26obD7hPsIjLCuJQazCa2P2UDyqTwWQajyfeHo+3OakdwVM5re3RddE9UrscpaRA1a4BBMeIUHYZ1kzcr4Dh1G7Wp1VxpbdQDoG9lgwIjK6At/EdM+WuYF3NtLcNxI8CDeT7rsekCFjMJEORLb35M6DcuokFZEI21ZajhVAdcX7Qg/TVssuIBjw9eOdDmdUhJyqJAailzKIPiay1xrPUA=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 52293322-a206-44cd-e274-08dda4e7135d
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:44:12.7599
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: aOqw85zJDM3VcIFJKxn7OQ4pSYVthXpWNOwixYNpuZ4zXpZ/L+G5i5X7am5PfYjxo/C9VqqFH7anOZhLb0vgLzJuRBUuKzhLkzxVQ3OORac=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6165
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 bulkscore=0
mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 adultscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060096
X-Proofpoint-GUID: DLZK0k18Oe1VbyBwilS09hzKTLFJjr0e
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5NyBTYWx0ZWRfX9NiavR2AS3ai 5rvpnyGY/74B8v1tZ9BWv+7jiAVMIPD+H79DajXy+Kn0pwdC5OSJqXJng13mwOXzQimaZ7Uu6Y7 K+rLuT6RFHxZfiKvIcj9xtEogCaEWQ9FCXBbURU8Os4tBK7QEdg95baFiDrQRyS04g3X45LEmaU
zoXqEjPAjoYdTNQAkfaOM7cAureFCXK51ZR4neQ5SsZ6kJEKb/bXC++vvGUGo85mn4XT8tE8kas Z8stvMuXcXJUGWxChjOKb3DT0AhZjT2CgQtq6F7w4ZTuE00JItfPNP54yEjQfWeoRH0rFjHItZb ewE2tjiUYEsDksoF7LfD++AM48pdd3NfV63sPv0nbzI2+tyzSYTJXSSRnjszrgF0arGM/wV7fBT
/0IakwWq5GJxkkP8KUlSHDSlhHxR1V7QlN7UaE5LW8XS4oNMDFobdRo3MfgWB6cpXuWYCsI7
X-Authority-Analysis: v=2.4 cv=KaTSsRYD c=1 sm=1 tr=0 ts=6842c680 b=1 cx=c_pps a=qoll8+KPOyaMroiJ2sR5sw==:117 a=qoll8+KPOyaMroiJ2sR5sw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=pGLkceISAAAA:8 a=1u_FStEZLfeRFz8b3xYA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 cc=ntf awl=host:13207
X-Proofpoint-ORIG-GUID: DLZK0k18Oe1VbyBwilS09hzKTLFJjr0e
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Qi - thanks very much for your insightful response, will stash this
somewhere to revisit.

On Fri, Jun 06, 2025 at 11:55:56AM +0800, Qi Zheng wrote:
> Hi Lorenzo,
>
> On 6/5/25 10:04 PM, Lorenzo Stoakes wrote:
> > On Thu, Jun 05, 2025 at 11:23:18AM +0800, Qi Zheng wrote:
> > >
> > >
> > > On 6/5/25 1:50 AM, Lorenzo Stoakes wrote:
> > > > On Wed, Jun 04, 2025 at 02:02:12PM +0800, Qi Zheng wrote:
> > > > > Hi Lorenzo,
> > > > >
> > > > > On 6/3/25 5:54 PM, Lorenzo Stoakes wrote:
> > > > > > On Tue, Jun 03, 2025 at 03:24:28PM +0800, Qi Zheng wrote:
> > > > > > > Hi Jann,
> > > > > > >
> > > > > > > On 5/30/25 10:06 PM, Jann Horn wrote:
> > > > > > > > On Fri, May 30, 2025 at 12:44â?¯PM Barry Song <21cnbao@xxxxxxxxx> wrote:
> > > > > > > > > Certain madvise operations, especially MADV_DONTNEED, occur far more
> > > > > > > > > frequently than other madvise options, particularly in native and Java
> > > > > > > > > heaps for dynamic memory management.
> > > > > > > > >
> > > > > > > > > Currently, the mmap_lock is always held during these operations, even when
> > > > > > > > > unnecessary. This causes lock contention and can lead to severe priority
> > > > > > > > > inversion, where low-priority threadsâ??such as Android's HeapTaskDaemonâ??
> > > > > > > > > hold the lock and block higher-priority threads.
> > > > > > > > >
> > > > > > > > > This patch enables the use of per-VMA locks when the advised range lies
> > > > > > > > > entirely within a single VMA, avoiding the need for full VMA traversal. In
> > > > > > > > > practice, userspace heaps rarely issue MADV_DONTNEED across multiple VMAs.
> > > > > > > > >
> > > > > > > > > Tangquanâ??s testing shows that over 99.5% of memory reclaimed by Android
> > > > > > > > > benefits from this per-VMA lock optimization. After extended runtime,
> > > > > > > > > 217,735 madvise calls from HeapTaskDaemon used the per-VMA path, while
> > > > > > > > > only 1,231 fell back to mmap_lock.
> > > > > > > > >
> > > > > > > > > To simplify handling, the implementation falls back to the standard
> > > > > > > > > mmap_lock if userfaultfd is enabled on the VMA, avoiding the complexity of
> > > > > > > > > userfaultfd_remove().
> > > > > > > >
> > > > > > > > One important quirk of this is that it can, from what I can see, cause
> > > > > > > > freeing of page tables (through pt_reclaim) without holding the mmap
> > > > > > > > lock at all:
> > > > > > > >
> > > > > > > > do_madvise [behavior=MADV_DONTNEED]
> > > > > > > > madvise_lock
> > > > > > > > lock_vma_under_rcu
> > > > > > > > madvise_do_behavior
> > > > > > > > madvise_single_locked_vma
> > > > > > > > madvise_vma_behavior
> > > > > > > > madvise_dontneed_free
> > > > > > > > madvise_dontneed_single_vma
> > > > > > > > zap_page_range_single_batched [.reclaim_pt = true]
> > > > > > > > unmap_single_vma
> > > > > > > > unmap_page_range
> > > > > > > > zap_p4d_range
> > > > > > > > zap_pud_range
> > > > > > > > zap_pmd_range
> > > > > > > > zap_pte_range
> > > > > > > > try_get_and_clear_pmd
> > > > > > > > free_pte
> > > > > > > >
> > > > > > > > This clashes with the assumption in walk_page_range_novma() that
> > > > > > > > holding the mmap lock in write mode is sufficient to prevent
> > > > > > > > concurrent page table freeing, so it can probably lead to page table
> > > > > > > > UAF through the ptdump interface (see ptdump_walk_pgd()).
> > > > > > >
> > > > > > > Maybe not? The PTE page is freed via RCU in zap_pte_range(), so in the
> > > > > > > following case:
> > > > > > >
> > > > > > > cpu 0 cpu 1
> > > > > > >
> > > > > > > ptdump_walk_pgd
> > > > > > > --> walk_pte_range
> > > > > > > --> pte_offset_map (hold RCU read lock)
> > > > > > > zap_pte_range
> > > > > > > --> free_pte (via RCU)
> > > > > > > walk_pte_range_inner
> > > > > > > --> ptdump_pte_entry (the PTE page is not freed at this time)
> > > > > > >
> > > > > > > IIUC, there is no UAF issue here?
> > > > > > >
> > > > > > > If I missed anything please let me know.
> > > >
> > > > Seems to me that we don't need the VMA locks then unless I'm missing
> > > > something? :) Jann?
> > > >
> > > > Would this RCU-lock-acquired-by-pte_offset_map also save us from the
> > > > munmap() downgraded read lock scenario also? Or is the problem there
> > > > intermediate page table teardown I guess?
> > > >
> > >
> > > Right. Currently, page table pages other than PTE pages are not
> > > protected by RCU, so mmap write lock still needed in the munmap path
> > > to wait for all readers of the page table pages to exit the critical
> > > section.
> > >
> > > In other words, once we have achieved that all page table pages are
> > > protected by RCU, we can completely remove the page table pages from
> > > the protection of mmap locks.
> >
> > Interesting - so on reclaim/migrate we are just clearing PTE entries with
> > the rmap lock right? Would this lead to a future where we could also tear
> > down page tables there?
> >
> > Another point to remember is that when we are clearing down higher level
> > page tables in the general case, the logic assumes nothing else can touch
> > anything... we hold both rmap lock AND mmap/vma locks at this point.
> >
> > But I guess if we're RCU-safe, we're same even from rmap right?
>
> Yeah, and we have already done something similar. For more details,
> please refer to retract_page_tables(). It only holds i_mmap_rwsem read
> lock and then calls pte_free_defer() to free the PTE page through RCU.

Yeah, but that i_mmap_rwsem is important :) as it protects against other
rmap users.

Interesting that we only do this for shmem case not anon...

>
> For migrate case, the pte entry will store a migrate entry, right? And a
> new physical page will be installed soon through a page fault, so I
> don't think it is necessary to free the corresponding PTE page.

Yeah.

>
> For reclaim case, there is a problem that only PTE entries that mapped
> to a physical page are operated each time. If we want to free the entire
> PTE page, we need to check the adjacent PTE entries. Maybe MGLRU can
> help with this. I remember that MGLRU has an optimization that will check
> the adjacent PTE entries.

Yeah indeed, we'd need to take the 'very simple' reclaim code and have it
do _even more_ in this case :P

>
> >
> > >
> > > Here are some of my previous thoughts:
> > >
> > > ```
> > > Another plan
> > > ============
> > >
> > > Currently, page table modification are protected by page table locks
> > > (page_table_lock or split pmd/pte lock), but the life cycle of page
> > > table pages are protected by mmap_lock (and vma lock). For more details,
> > > please refer to the latest added Documentation/mm/process_addrs.rst file.
> > >
> > > Currently we try to free the PTE pages through RCU when
> > > CONFIG_PT_RECLAIM is turned on. In this case, we will no longer
> > > need to hold mmap_lock for the read/write op on the PTE pages.
> > >
> > > So maybe we can remove the page table from the protection of the mmap
> > > lock (which is too big), like this:
> > >
> > > 1. free all levels of page table pages by RCU, not just PTE pages, but
> > > also pmd, pud, etc.
> > > 2. similar to pte_offset_map/pte_unmap, add
> > > [pmd|pud]_offset_map/[pmd|pud]_unmap, and make them all contain
> > > rcu_read_lock/rcu_read_unlcok, and make them accept failure.
> > >
> > > In this way, we no longer need the mmap lock. For readers, such as page
> > > table wallers, we are already in the critical section of RCU. For
> > > writers, we only need to hold the page table lock.
> > >
> > > But there is a difficulty here, that is, the RCU critical section is not
> > > allowed to sleep, but it is possible to sleep in the callback function
> > > of .pmd_entry, such as mmu_notifier_invalidate_range_start().
> > >
> > > Use SRCU instead? Or use RCU + refcount method? Not sure. But I think
> > > it's an interesting thing to try.
> >
> > Thanks for the information, RCU freeing of page tables is something of a
>
> RCU-freeing is relatively simple, tlb_remove_table() can be easily
> changed to free all levels of page table pages through RCU. The more
> difficult is to protect the page table pages above PTE level through RCU
> lock.
>
> > long-term TODO discussed back and forth :) might take a look myself if
> > somebody else hasn't grabbed when I have a second...
>
> This is awesome, I'm stuck with some other stuff at the moment, I'll
> also take a look at it later when I have time.

Yeah, I guess good to ping on-list if/when one of us/somebody else takes a
look to synchronise :)

>
> >
> > Is it _only_ the mmu notifier sleeping in this scenario? Or are there other
> > examples?
>
> I'm not sure, need some investigation.
>
> >
> > We could in theory always add another callback .pmd_entry_sleep or
> > something for this one case and document the requirement...
>
> Maybe, but the SRCU critical section cannot prevent the PTE page from
> being freed via RCU. :(

Idea is we'd fall back to non-RCU in this case and take locks... but then
ugh we'd race everything RCU and no it's all or nothing isn't it?

Overall - I will stash this response somewhere and come back to it if
somebody else doesn't in the meantime :)

>
> Thanks!
>
> >
> > > ```
> > >
> > > Thanks!
> > >
> > >
> >
> > Cheers, Lorenzo
>


Return-Path: <linux-kernel+bounces-675618-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0414E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:45:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 719451896156
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:46:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E06E9286887;
Fri, 6 Jun 2025 10:45:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UMxbp4zu"
Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB705214209
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:45:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206747; cv=none; b=Oh688pDH26b2/kc5xnlLHvzRDB2s6aoAH+swVy7noYSBr1AmNcOjKT4AHrOOYnrdawf76vWDyeRECPTAZgZaDM7wHG7clJvUY9PTCI7fjj2WVxJPpgo4mXL3yns+1/O/0c040AmeqKEIgQw3LuxdXwEphuzrSS/4YfbV499HcI0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206747; c=relaxed/simple;
bh=YkGEBOcrE27T8r3ixhzP0IJ28+ma+k+fBnXwC3McJO4=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=OxZzEcW/QEKF5FbzWHQqxubthY1bailKkOtl97qd5LhpjGaOe82+4e3eAVdMqsZCRhJOEX8p8QtOPXgvqn9Pz/qE2DZKTR5Xl02r/atbYysXSEkwj1j0VaGQCb8b2NK+MJEc4XmVEOhdihdoIyx/jmmr3jXobB5yKKwlrw/vfQI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UMxbp4zu; arc=none smtp.client-ip=209.85.221.45
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3a3798794d3so1555215f8f.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:45:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749206743; x=1749811543; darn=vger.kernel.org;
h=cc:to:message-id:content-transfer-encoding:mime-version:subject
:date:from:from:to:cc:subject:date:message-id:reply-to;
bh=BRFHALx1m3zetPOEUD4i+1o0+6rIFbdrwCz54veiK6s=;
b=UMxbp4zuUrI9sk8FEUuDGdtPYJH9WPP5J5PKKhMNv8n2V/ZBaYFbr55YcM/R8KZ0BU
IpqWF9fTkgl9lrf6dAOw3jUDFmKj0RX+K0FMxDm/L7tHqS9OUXNnEzNRipASZUJNt6c8
wqEB0300TEqNww5/gon7BddbQaSOaRMs7OSvN2r9LbmO5YaxQhRiikrdIDq67tnOJUL0
8SJZmq5rIkBRmtya97v1P+cCjKbXlxUwvcm1HEfqvIRdC3DEjVXb36pWlbbXMx2zi7Ir
/fic9kl0IZvdwEwdiMJAcTbRSthYfgGKO3NTedw5TdxvXmhKZ44mWrrxPtBYNiQoCRPg
5DgQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749206743; x=1749811543;
h=cc:to:message-id:content-transfer-encoding:mime-version:subject
:date:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=BRFHALx1m3zetPOEUD4i+1o0+6rIFbdrwCz54veiK6s=;
b=pHFED+EDbbLGF7FXRvcrVHVMAB0lgL6dzYmCc6pMNywAoNFDLafDgZ0fsjmu7QCiU0
PU55ID8lqqUoJXp3nIdCYUu4Kc/6oybkEBjD8o15gXi6oC9TRwhgKfTF5vkjeFez9Egi
8fNmS7ucbnuyUwzcxqX+kjrqRE1ZBmZFJASgGtyAdQfbNxG3RGD30J5NPQlPs3ddwktJ
lGEoM61MtF8OdqriAYZX38k+dtziJBOvqdbPfszFc4/XxdEYvwPcH4cFvSKlGDjoURYw
M5ebs0nHfByhNh3/qD+PfYEb2jtbd7Wuri5q6+1AzZ5Nz0dI/FaNA+WlPB2TNAv9bz4S
IvJw==
X-Forwarded-Encrypted: i=1; AJvYcCVvXzJJ3cE99N32Awg7hvj6Yno6zxl0Y820yolFF4P/687+pm7DdEf0NKO5ZKvizqY4yCaYhSP1RWbgw/s=@vger.kernel.org
X-Gm-Message-State: AOJu0YyxV0VRykrKD/XLHnYODdjYMWB7KD7trU/+CWz7q/VZeOerzy6E
GgUa80LIbT30Mk34oZEWOa3BSVs6RUKEAqsVu3mog6cNPW5Up5CbopZ47q0dJvqYYMM=
X-Gm-Gg: ASbGnct/Yd5bO8p7EawmUsAqTu/Z4RYz00+dAOQX0UNwaB60I3X+QQ07XcZfLoA5kQ2
WCXrGb6v7liRtEJ0IEqwGBawpb0hzm6iGTwGJn2OOygxm6ZvvViYpmsFti46M9Nd/WM+QVlzGEm
tQaO/PZn6TJTwXYHGSAPx0QmJOo2OG6zfMgQ7tjrzUerdN9E1/aN7L/pXvQ48rVdABXvmw0CQXl
YQgs/iRIHg38yhLLSUBUOjJFFPJk4UWZaaBJfb5DsJ1E8fALqfF2LgzSvJn6qeLs/BOaW2vnp5L
iBCLWuXXaLyQegNbY3DC92Wup8JhOl1OU4DEHcCqG8slidBQftzlIdlBiKzPOjvcakiVwpBJ/SW
gA2gA0bZORIqG/tzszy5f5UBK/l+Nr85/VZaQWqiG1w==
X-Google-Smtp-Source: AGHT+IG81ROpSS11hYFgizfgeqwfBE+434gV6QInGeIi/uhBiwAIOcylPzJAGiQB9jMO1IoJY5jW7A==
X-Received: by 2002:a5d:64c7:0:b0:3a4:d0dc:184f with SMTP id ffacd0b85a97d-3a531cdcfa0mr2411229f8f.39.1749206743044;
Fri, 06 Jun 2025 03:45:43 -0700 (PDT)
Received: from ta2.c.googlers.com (213.20.187.35.bc.googleusercontent.com. [35.187.20.213])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5323bee86sm1468810f8f.43.2025.06.06.03.45.42
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 03:45:42 -0700 (PDT)
From: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 10:45:37 +0000
Subject: [PATCH v2] firmware: exynos-acpm: fix timeouts on xfers handling
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-acpm-timeout-v2-1-306b1aa07a6c@xxxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIANDGQmgC/3WMyw6CMBBFf4XM2prShxpX/IdhUegAk0hL2tpoS
P/dyt7c1bnJOTtEDIQR7s0OATNF8q6CODUwLsbNyMhWBsGF5heumRm3lSVa0b8SU1Lp601zbqS
CqmwBJ3ofuUdfeaGYfPgc9dz+3j+h3LI6O0x2QJTcmu5JzgR/9mGGvpTyBXlSLqOpAAAA
X-Change-ID: 20250605-acpm-timeout-434578500a34
To: Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Alim Akhtar <alim.akhtar@xxxxxxxxxxx>
Cc: Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>,
Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
arm-scmi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-samsung-soc@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749206742; l=5028;
i=tudor.ambarus@xxxxxxxxxx; s=20241212; h=from:subject:message-id;
bh=YkGEBOcrE27T8r3ixhzP0IJ28+ma+k+fBnXwC3McJO4=;
b=/ygRXRUpI7htlMsGDL1WdAqzFsl3yUxqAWzsl8X50cOc+eJBsU4cW6YrAzSyW/kOU4+5Rcj1m
7EAslsdO6LiCG5U41ftFPI1qbJm37L6utdNYTfU8JCZQs6jnxC05Vta
X-Developer-Key: i=tudor.ambarus@xxxxxxxxxx; a=ed25519;
pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI=
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The mailbox framework has a single inflight request at a time. If
a request is sent while another is still active, it will be queued
to the mailbox core ring buffer.

ACPM protocol did not serialize the calls to the mailbox subsystem so we
could start the timeout ticks in parallel for multiple requests, while
just one was being inflight.

Consider a hypothetical case where the xfer timeout is 100ms and an ACPM
transaction takes 90ms:
| 0ms: Message #0 is queued in mailbox layer and sent out, then sits
| at acpm_dequeue_by_polling() with a timeout of 100ms
| 1ms: Message #1 is queued in mailbox layer but not sent out yet.
| Since send_message() doesn't block, it also sits at
| acpm_dequeue_by_polling() with a timeout of 100ms
| ...
| 90ms: Message #0 is completed, txdone is called and message #1 is sent
| 101ms: Message #1 times out since the count started at 1ms. Even though
| it has only been inflight for 11ms.

Fix the problem by moving mbox_send_message() and mbox_client_txdone()
immediately after the message has been written to the TX queue and while
still keeping the ACPM TX queue lock. We thus tie together the TX write
with the doorbell ring and mark the TX as done after the doorbell has
been rung. This guarantees that the doorbell has been rang before
starting the timeout ticks. We should also see some performance
improvement as we no longer wait to receive a response before ringing
the doorbell for the next request, so the ACPM firmware shall be able to
drain faster the TX queue. Another benefit is that requests are no
longer able to ring the doorbell one for the other, so it eases
debugging. Finally, the mailbox software queue will always contain a
single doorbell request due to the serialization done at the ACPM TX
queue level. Protocols like ACPM, that handle their own hardware queues
need a passthrough mailbox API, where they are able to just ring the
doorbell or flip a bit directly into the mailbox controller. The mailbox
software queue mechanism, the locking done into the mailbox core is not
really needed, so hopefully this lays the foundation for a passthrough
mailbox API.

Reported-by: André Draszik <andre.draszik@xxxxxxxxxx>
Fixes: a88927b534ba ("firmware: add Exynos ACPM protocol driver")
Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>
---
Changes in v2:
- update commit message and fix the time shown in the example.
- pass zero for the second argument of mbox_client_txdone().
mbox_send_message() returns a non negative token on success, and
mbox_client_txdone() expects the status of last transmission. Doesn't
change behavior for ACPM, but fix it for correctness.
- add to Cc the arm_scmi list, they had a similar fix at:
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=da1642bc97c4e
- chckpatch complains that Reported-by: shall be followed by Closes:,
but the problem was reported offline, so I don't have a Closes: tag.
- Link to v1: https://lore.kernel.org/r/20250605-acpm-timeout-v1-1-1dbfdbee30da@xxxxxxxxxx
---
drivers/firmware/samsung/exynos-acpm.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/firmware/samsung/exynos-acpm.c b/drivers/firmware/samsung/exynos-acpm.c
index e02f14f4bd7c96de6ebb50473005de520aba1c4f..3a69fe3234c75e0b5a93cbea6bb210dc6f69d2a6 100644
--- a/drivers/firmware/samsung/exynos-acpm.c
+++ b/drivers/firmware/samsung/exynos-acpm.c
@@ -430,6 +430,9 @@ int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer *xfer)
return -EOPNOTSUPP;
}

+ msg.chan_id = xfer->acpm_chan_id;
+ msg.chan_type = EXYNOS_MBOX_CHAN_TYPE_DOORBELL;
+
scoped_guard(mutex, &achan->tx_lock) {
tx_front = readl(achan->tx.front);
idx = (tx_front + 1) % achan->qlen;
@@ -446,25 +449,15 @@ int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer *xfer)

/* Advance TX front. */
writel(idx, achan->tx.front);
- }

- msg.chan_id = xfer->acpm_chan_id;
- msg.chan_type = EXYNOS_MBOX_CHAN_TYPE_DOORBELL;
- ret = mbox_send_message(achan->chan, (void *)&msg);
- if (ret < 0)
- return ret;
-
- ret = acpm_wait_for_message_response(achan, xfer);
+ ret = mbox_send_message(achan->chan, (void *)&msg);
+ if (ret < 0)
+ return ret;

- /*
- * NOTE: we might prefer not to need the mailbox ticker to manage the
- * transfer queueing since the protocol layer queues things by itself.
- * Unfortunately, we have to kick the mailbox framework after we have
- * received our message.
- */
- mbox_client_txdone(achan->chan, ret);
+ mbox_client_txdone(achan->chan, 0);
+ }

- return ret;
+ return acpm_wait_for_message_response(achan, xfer);
}

/**

---
base-commit: a0bea9e39035edc56a994630e6048c8a191a99d8
change-id: 20250605-acpm-timeout-434578500a34

Best regards,
--
Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675619-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9930441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:46:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id CD78B189AC1F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:46:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5973A287517;
Fri, 6 Jun 2025 10:46:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b="b93hJzPk"
Received: from smtp1.tecnico.ulisboa.pt (smtp1.tecnico.ulisboa.pt [193.136.128.21])
(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 82ECD28689C;
Fri, 6 Jun 2025 10:46:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.136.128.21
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206766; cv=none; b=IzslGy1UnIronFR4C9dFXKpH63nqvfaVkoQ67/RbYU9gQeWalRve/kYSYzM3LmHTpBxfJwAAZjUkIWMSHCjrsESDddcR2mS5LlQNUfqYxm0caUrCI1EBq33E/ww3Y9omnS+VcVba6dXhTgqGHU5BgYnLgWs7+GvimvvbpO2Qtwk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206766; c=relaxed/simple;
bh=b/UYcG1Ax9LboqUqxefB6TY4tC5jNdkFojL1htmMLXc=;
h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=MBJkTR5KiX5KF5F9E8hZoD5mkzDF+MEKzFvFTbkxgXNH8OoDcAc5e5Ge2qcm5sdOd0+4LXG5cz+wEyXHhE8jsoOeVXYZkzgsnmwoAFGDeoowoCo8h/Mg7A8EyNhDvtPH3nvg/PVlaIPSY9MoH/17Z7kUfuwU8KRIhjMzi3ILbdo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt; spf=pass smtp.mailfrom=tecnico.ulisboa.pt; dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b=b93hJzPk; arc=none smtp.client-ip=193.136.128.21
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tecnico.ulisboa.pt
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTP id 293D16002C16;
Fri, 6 Jun 2025 11:45:57 +0100 (WEST)
X-Virus-Scanned: by amavis-2.13.0 (20230106) (Debian) at tecnico.ulisboa.pt
Received: from smtp1.tecnico.ulisboa.pt ([127.0.0.1])
by localhost (smtp1.tecnico.ulisboa.pt [127.0.0.1]) (amavis, port 10025)
with LMTP id QggEUngRi67p; Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
Received: from mail1.tecnico.ulisboa.pt (mail1.ist.utl.pt [193.136.128.10])
by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTPS id 32DC06003C30;
Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tecnico.ulisboa.pt;
s=mail; t=1749206751;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=cWq3jC53oW+9ppyzQ0zjaoRHRCrCbgV8CsuK0KJm/0w=;
b=b93hJzPk7nUW0Qy8BC62GlEqW6wlgHXJms5sTLUmtL1iZYwkVHfFu/6OyI6lEs66UkBv1z
C+fEgpUsBwAfnej1nedMLTdikYsF8FpkShQqodCC/ZO2dO0Pk1ixmrMNPHo89iJiBZt4x7
cnjFyWSYPpZzk/eWonXJX3OZ5t68gXQ=
Received: from [192.168.1.151] (unknown [IPv6:2001:8a0:57db:f00:3ee2:38aa:e2c9:7dde])
(Authenticated sender: ist187313)
by mail1.tecnico.ulisboa.pt (Postfix) with ESMTPSA id CDF40360085;
Fri, 6 Jun 2025 11:45:48 +0100 (WEST)
From: Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
Subject: [PATCH 0/3] NVIDIA Tegra210 NVJPG support
Date: Fri, 06 Jun 2025 11:45:33 +0100
Message-Id: <20250606-diogo-nvjpg-v1-0-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
X-B4-Tracking: v=1; b=H4sIAM3GQmgC/x3MQQqAIBBA0avErBtQSYOuEi1CJ5sWKgoSiHdPW
r7F/w0KZaYC29QgU+XCMQzIeQJ7n8ETshsGJZQWRmh0HH3EUJ/kkYRbrF6lMlbDKFKmi9//th+
9f+hludZdAAAA
X-Change-ID: 20250605-diogo-nvjpg-e0d4c57126c5
To: Thierry Reding <thierry.reding@xxxxxxxxx>,
Mikko Perttunen <mperttunen@xxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>, Jonathan Hunter <jonathanh@xxxxxxxxxx>,
Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-tegra@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749206748; l=2115;
i=diogo.ivo@xxxxxxxxxxxxxxxxxx; s=20240529; h=from:subject:message-id;
bh=b/UYcG1Ax9LboqUqxefB6TY4tC5jNdkFojL1htmMLXc=;
b=PEvbpcOdAxmeIrGehqWEUNKIoROMhlmdF8sd/PteghNuUOrJdekELHTyLPmPJyKGamfyRTckc
dQdJcZ/Bd1YCgqMWWqY3GgROdXjrEYSBKpAjs3MnjvrjL7d+JbvJ5VR
X-Developer-Key: i=diogo.ivo@xxxxxxxxxxxxxxxxxx; a=ed25519;
pk=BRGXhMh1q5KDlZ9y2B8SodFFY8FGupal+NMtJPwRpUQ=
X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello,

This series adds support for the NVJPG hardware accelerator found in the
Tegra210 SoC.

The kernel driver is essentially a copy of the NVDEC driver as both
engines are Falcon-based.

For the userspace part I have written a Mesa Gallium backend [1] that,
while still very much experimental, works in decoding images with VA-API.

I have been using ffmpeg to call VA-API with the following command:

ffmpeg -v verbose -hwaccel vaapi -hwaccel_device /dev/dri/renderD129 -i <input.jpg> -pix_fmt bgra -f fbdev /dev/fb0

which decodes <input.jpg> and shows the result in the framebuffer.

The firmware for the engine can be obtained from a Linux for Tegra
distribution. Due to the way the Gallium implementation works for Tegra
the GPU also needs to be enabled.

Thanks!

Diogo

To: Thierry Reding <thierry.reding@xxxxxxxxx>
To: Mikko Perttunen <mperttunen@xxxxxxxxxx>
To: David Airlie <airlied@xxxxxxxxx>
To: Simona Vetter <simona@xxxxxxxx>
To: Jonathan Hunter <jonathanh@xxxxxxxxxx>
To: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
To: Rob Herring <robh@xxxxxxxxxx>
To: Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>
To: Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Cc: linux-tegra@xxxxxxxxxxxxxxx
Cc: devicetree@xxxxxxxxxxxxxxx
Signed-off-by: Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>

[1]: https://gitlab.freedesktop.org/d.ivo/mesa/-/tree/diogo/vaapi_gl?ref_type=heads

---
Diogo Ivo (3):
drm/tegra: Add NVJPG driver
arm64: tegra: Add NVJPG power-domain node
arm64: tegra: Add NVJPG node

arch/arm64/boot/dts/nvidia/tegra210.dtsi | 14 +-
drivers/gpu/drm/tegra/Makefile | 1 +
drivers/gpu/drm/tegra/drm.c | 2 +
drivers/gpu/drm/tegra/drm.h | 1 +
drivers/gpu/drm/tegra/nvjpg.c | 379 +++++++++++++++++++++++++++++++
5 files changed, 396 insertions(+), 1 deletion(-)
---
base-commit: 386b76a190ce68afc19d481f17cab1f5479c719b
change-id: 20250605-diogo-nvjpg-e0d4c57126c5

Best regards,
--
Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675620-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1E65541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:46:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 4D2D01899907
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:46:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BCDC42882AD;
Fri, 6 Jun 2025 10:46:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b="nN76/b5F"
Received: from smtp1.tecnico.ulisboa.pt (smtp1.tecnico.ulisboa.pt [193.136.128.21])
(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 82E6C286887;
Fri, 6 Jun 2025 10:46:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.136.128.21
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206767; cv=none; b=RSRpSLP3G8YLcDtU/Y5nJjnZPLda8SnIvJUv3ZpOGkRcqEXnMA0y0Cj/Wwx18KuYVCWDg7FFxOQsjFeQrgF6FL3KiSHYz87jSmEd659Jx7RH8KDLpBxPQlLFMrb+Zy0tYnBREyjyJKscb+miUSnD88BbN/MX2Wkk06BuzY4qly8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206767; c=relaxed/simple;
bh=q9+0oSCFBDd2MWoVLijNz55CY4fughnVcsPn8mNInYs=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=dkwa5uASRYz6QfKn32AEihFeyFC6xijAYe9nfkoH/v70QAW4aC6iyU71S2sveoAK+poaj0B9LRypWG7ykeVc487BXx6M2F/sutx/F95q+Vdzf0bZ3/b8DbepFZfwpYY1PifiXAEtIiMdlldv7Y5spg3ALFqjhZ30CPTZtj/Lya4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt; spf=pass smtp.mailfrom=tecnico.ulisboa.pt; dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b=nN76/b5F; arc=none smtp.client-ip=193.136.128.21
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tecnico.ulisboa.pt
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTP id 1313E600025B;
Fri, 6 Jun 2025 11:45:57 +0100 (WEST)
X-Virus-Scanned: by amavis-2.13.0 (20230106) (Debian) at tecnico.ulisboa.pt
Received: from smtp1.tecnico.ulisboa.pt ([127.0.0.1])
by localhost (smtp1.tecnico.ulisboa.pt [127.0.0.1]) (amavis, port 10025)
with LMTP id SKFrJ_ufbfh2; Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
Received: from mail1.tecnico.ulisboa.pt (mail1.ist.utl.pt [193.136.128.10])
by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTPS id 669866003C38;
Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tecnico.ulisboa.pt;
s=mail; t=1749206751;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=ZaEG+cKz+JD7aGSqShRfi6WuHINMdAa8GgHkpLiaHhg=;
b=nN76/b5Fc9fyfazu0yO0KBn+vM+8+8tl9N5fWxOVFy+I8pjCzdBXaUeivJaffJjKVYtolc
GJgeZsZoA4bPsjYmOgWHdtjBMn9vbhI4SIvReWQUEBaQJJHRSB0mB7Hib5d5/YHpbtmxKz
5bTrPnw7B1V9JV999yBWUGIWTmhZexE=
Received: from [192.168.1.151] (unknown [IPv6:2001:8a0:57db:f00:3ee2:38aa:e2c9:7dde])
(Authenticated sender: ist187313)
by mail1.tecnico.ulisboa.pt (Postfix) with ESMTPSA id 42E1036008A;
Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
From: Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 11:45:35 +0100
Subject: [PATCH 2/3] arm64: tegra: Add NVJPG power-domain node
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-diogo-nvjpg-v1-2-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
References: <20250606-diogo-nvjpg-v1-0-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
In-Reply-To: <20250606-diogo-nvjpg-v1-0-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
To: Thierry Reding <thierry.reding@xxxxxxxxx>,
Mikko Perttunen <mperttunen@xxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>, Jonathan Hunter <jonathanh@xxxxxxxxxx>,
Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-tegra@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749206748; l=837;
i=diogo.ivo@xxxxxxxxxxxxxxxxxx; s=20240529; h=from:subject:message-id;
bh=q9+0oSCFBDd2MWoVLijNz55CY4fughnVcsPn8mNInYs=;
b=t8KGWayT1F1ZRaHRceA/xKDnrS5cgasfW6I8W+gARg/gYoalH/NIMfV+R8JL2J5vnJPiZDmpj
drsywr+cHJzCOkrYb0fzGtqS+sBMw0GedI2DZjsU7tLm4/sCmTTve2r
X-Developer-Key: i=diogo.ivo@xxxxxxxxxxxxxxxxxx; a=ed25519;
pk=BRGXhMh1q5KDlZ9y2B8SodFFY8FGupal+NMtJPwRpUQ=
X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add the NVJPG power-domain node in order to support the NVJPG
accelerator.

Signed-off-by: Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
---
arch/arm64/boot/dts/nvidia/tegra210.dtsi | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra210.dtsi b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
index 402b0ede1472af625d9d9e811f5af306d436cc98..6f8cdf012f0f12a16716e9d479c46b330bbb7dda 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
@@ -947,6 +947,12 @@ pd_xusbhost: xusbc {
resets = <&tegra_car TEGRA210_CLK_XUSB_HOST>;
#power-domain-cells = <0>;
};
+
+ pd_nvjpg: nvjpg {
+ clocks = <&tegra_car TEGRA210_CLK_NVJPG>;
+ resets = <&tegra_car 195>;
+ #power-domain-cells = <0>;
+ };
};
};


--
2.49.0



Return-Path: <linux-kernel+bounces-675621-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 93E8C41E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:46:33 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id DC6011895CD3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:46:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E89BB2882B8;
Fri, 6 Jun 2025 10:46:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b="Xc9ZCPYr"
Received: from smtp1.tecnico.ulisboa.pt (smtp1.tecnico.ulisboa.pt [193.136.128.21])
(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 82D8A28643F;
Fri, 6 Jun 2025 10:46:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.136.128.21
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206767; cv=none; b=KOOt09dkz+XFJoN9ydCn54Pbm40hucp4pUSHlpFZCNSwZ/tC4YHpd612lhbkg0raesApbrazMQyPQ+Dx540lUm0QMfh89UQSmtil42m7kRWAVFP9aadeLNljQzV42DLhwoQuV+N2WsSlZEY89XDr+QRn7g1yCNgcNu/A17aj4+8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206767; c=relaxed/simple;
bh=+723/NY6KvxdN/NVCwc/Xg4at7iqHe19s5FcoIyfirg=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=Fxsq6Qd9RLHu9xuX/h99LAv1YbYcJVn6ySDsncIIfFg58lK6XZ0AFWNlcGRqCRQ8EDbmrYYdEur9ZAMHwiMTGIQovapHHglVsaHgIUe18G6a54pW+ZLCEwtv00cKtyXcglpMB0iqARTZBzcMw0S+3rWw4EhPz/9PAhTE7RG/siw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt; spf=pass smtp.mailfrom=tecnico.ulisboa.pt; dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b=Xc9ZCPYr; arc=none smtp.client-ip=193.136.128.21
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tecnico.ulisboa.pt
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTP id 5A3AD6002C18;
Fri, 6 Jun 2025 11:45:57 +0100 (WEST)
X-Virus-Scanned: by amavis-2.13.0 (20230106) (Debian) at tecnico.ulisboa.pt
Received: from smtp1.tecnico.ulisboa.pt ([127.0.0.1])
by localhost (smtp1.tecnico.ulisboa.pt [127.0.0.1]) (amavis, port 10025)
with LMTP id DAvTjK_YH0C4; Fri, 6 Jun 2025 11:45:52 +0100 (WEST)
Received: from mail1.tecnico.ulisboa.pt (mail1.ist.utl.pt [193.136.128.10])
by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTPS id 810AB6003C3B;
Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tecnico.ulisboa.pt;
s=mail; t=1749206751;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=g3RaW7nJDY4u0LgCaykCArI3bAHh2H+SVvOp/hfhgUg=;
b=Xc9ZCPYrHFG5E5SkpLETHHz2Kkbzf5BzgsIeC7MhYq8dyOF4d8glxXhgu0rbb3jkMaDiHp
8qUTrvEdB9rYPUSBg2WQ88eaDohmZegGtvakWR1o7C+PHYslhg4cONyvF034pdaYhFwc7w
9r5nKQnYON05kBIiDk3NF6yInetiMpI=
Received: from [192.168.1.151] (unknown [IPv6:2001:8a0:57db:f00:3ee2:38aa:e2c9:7dde])
(Authenticated sender: ist187313)
by mail1.tecnico.ulisboa.pt (Postfix) with ESMTPSA id 5B86336008B;
Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
From: Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 11:45:36 +0100
Subject: [PATCH 3/3] arm64: tegra: Add NVJPG node
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-diogo-nvjpg-v1-3-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
References: <20250606-diogo-nvjpg-v1-0-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
In-Reply-To: <20250606-diogo-nvjpg-v1-0-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
To: Thierry Reding <thierry.reding@xxxxxxxxx>,
Mikko Perttunen <mperttunen@xxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>, Jonathan Hunter <jonathanh@xxxxxxxxxx>,
Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-tegra@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749206748; l=1018;
i=diogo.ivo@xxxxxxxxxxxxxxxxxx; s=20240529; h=from:subject:message-id;
bh=+723/NY6KvxdN/NVCwc/Xg4at7iqHe19s5FcoIyfirg=;
b=vLVZFQrZn4UcAC2DS79V2Tka/+rkbmSG2SzFuLdk4ZaguRvAfmXaJBG5imLAXrQZTN3HcBvjK
2koOIxwEcb8CUFXkIxVk29ff3avixffo84Bk5LHkmdxtHFSMpUXoJBU
X-Developer-Key: i=diogo.ivo@xxxxxxxxxxxxxxxxxx; a=ed25519;
pk=BRGXhMh1q5KDlZ9y2B8SodFFY8FGupal+NMtJPwRpUQ=
X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The Tegra X1 chip contains a NVJPG accelerator capable of
encoding/decoding JPEG files in hardware, so add its DT node.

Signed-off-by: Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
---
arch/arm64/boot/dts/nvidia/tegra210.dtsi | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/nvidia/tegra210.dtsi b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
index 6f8cdf012f0f12a16716e9d479c46b330bbb7dda..087f38256fd40f57c4685e907f9682eb49ee31db 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
@@ -253,7 +253,13 @@ vic@54340000 {
nvjpg@54380000 {
compatible = "nvidia,tegra210-nvjpg";
reg = <0x0 0x54380000 0x0 0x00040000>;
- status = "disabled";
+ clocks = <&tegra_car TEGRA210_CLK_NVJPG>;
+ clock-names = "nvjpg";
+ resets = <&tegra_car 195>;
+ reset-names = "nvjpg";
+
+ iommus = <&mc TEGRA_SWGROUP_NVJPG>;
+ power-domains = <&pd_nvjpg>;
};

dsib: dsi@54400000 {

--
2.49.0



Return-Path: <linux-kernel+bounces-675622-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5D7FF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:46:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id EC00B189B02D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:46:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AC6562857CF;
Fri, 6 Jun 2025 10:46:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b="v3U2l8dU"
Received: from smtp1.tecnico.ulisboa.pt (smtp1.tecnico.ulisboa.pt [193.136.128.21])
(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 82E04286885;
Fri, 6 Jun 2025 10:46:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.136.128.21
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206767; cv=none; b=NXYv4D27Aqnnji8W9BdcxCQ7OCeip3GPPqRVfTzxu83LWM7f7KleT6lyUfiPpxJ11Qzl5GZF7HnM9Qao1Jfw5KdXdoQxUR09OkF6Xdfcv1KyJk4kHT/I6xKGYoPI6DMh2gfa2AOv6tdzd91ZRefHDdH2H7Ni7rxu+FZAcVbTGY4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206767; c=relaxed/simple;
bh=uVhKmlFX6xxJiRtWYdWQLCViIsAC6XjpfsprqmIcIR8=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=mmQVS8uZ8cRDcSBOWp6Q65IDgzKypKEAF/DJo/uEgiBHyq/TuCGjT3dO7Wi1W/T7g/szRpXJQR6o6dBJYeYZsiJlAXcMz1iW2kCuDkpNXGdnou3J0TeUgncqkWJf/KdRjGQSAH/t+/rjNMwUYPN8ty5v5o+M822lzucYANetv8I=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt; spf=pass smtp.mailfrom=tecnico.ulisboa.pt; dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b=v3U2l8dU; arc=none smtp.client-ip=193.136.128.21
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tecnico.ulisboa.pt
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTP id 3168D6002C17;
Fri, 6 Jun 2025 11:45:57 +0100 (WEST)
X-Virus-Scanned: by amavis-2.13.0 (20230106) (Debian) at tecnico.ulisboa.pt
Received: from smtp1.tecnico.ulisboa.pt ([127.0.0.1])
by localhost (smtp1.tecnico.ulisboa.pt [127.0.0.1]) (amavis, port 10025)
with LMTP id MaIk7XNqnTIi; Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
Received: from mail1.tecnico.ulisboa.pt (mail1.ist.utl.pt [IPv6:2001:690:2100:1::b3dd:b9ac])
by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTPS id 4F3B26003C31;
Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tecnico.ulisboa.pt;
s=mail; t=1749206751;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=Lop7ASnFxNTnFxxr2Eh/Ar6Wd8pdtjHObOvjqPD826Q=;
b=v3U2l8dU8QZuyh3RP+DuUbLvxe4minLcnV80Cbg+9Nm9TUQAYFuOteiKga/sAtfyrZ3oLo
eoVwRYZgTknnODyaFM1mhKfyX7WZLVrERIL87FT5ZisQgmQQ23RN8/7CsPhfoBQVcVsjvX
iwkvgyYVqQZVWZvZhbKc266ISMlOIY0=
Received: from [192.168.1.151] (unknown [IPv6:2001:8a0:57db:f00:3ee2:38aa:e2c9:7dde])
(Authenticated sender: ist187313)
by mail1.tecnico.ulisboa.pt (Postfix) with ESMTPSA id 26BE9360088;
Fri, 6 Jun 2025 11:45:51 +0100 (WEST)
From: Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 11:45:34 +0100
Subject: [PATCH 1/3] drm/tegra: Add NVJPG driver
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-diogo-nvjpg-v1-1-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
References: <20250606-diogo-nvjpg-v1-0-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
In-Reply-To: <20250606-diogo-nvjpg-v1-0-5f2c36feeb39@xxxxxxxxxxxxxxxxxx>
To: Thierry Reding <thierry.reding@xxxxxxxxx>,
Mikko Perttunen <mperttunen@xxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>, Jonathan Hunter <jonathanh@xxxxxxxxxx>,
Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-tegra@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749206748; l=11983;
i=diogo.ivo@xxxxxxxxxxxxxxxxxx; s=20240529; h=from:subject:message-id;
bh=uVhKmlFX6xxJiRtWYdWQLCViIsAC6XjpfsprqmIcIR8=;
b=+5/sdjjIIBv+LL3RhQzFECYelndCtjCA1iNPFMzqWEi3FiXfJeUdtSNJCTVhQwhJ+7+D2Qi5Y
JIRunI72N7NBy3ib2YIfpR/VW8qoE7ACsSK07Lt1tZg2Hx5epX2o1v4
X-Developer-Key: i=diogo.ivo@xxxxxxxxxxxxxxxxxx; a=ed25519;
pk=BRGXhMh1q5KDlZ9y2B8SodFFY8FGupal+NMtJPwRpUQ=
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add support for booting and using NVJPG on Tegra210 to the Host1x
and TegraDRM drivers. This driver only supports the new TegraDRM uAPI.

Signed-off-by: Diogo Ivo <diogo.ivo@xxxxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/tegra/Makefile | 1 +
drivers/gpu/drm/tegra/drm.c | 2 +
drivers/gpu/drm/tegra/drm.h | 1 +
drivers/gpu/drm/tegra/nvjpg.c | 379 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 383 insertions(+)

diff --git a/drivers/gpu/drm/tegra/Makefile b/drivers/gpu/drm/tegra/Makefile
index 6fc4b504e7861df8802f3f0f5d6faf9eb167b27a..e399b40d64a1d2070b27c2219a36693a8e3edc61 100644
--- a/drivers/gpu/drm/tegra/Makefile
+++ b/drivers/gpu/drm/tegra/Makefile
@@ -25,6 +25,7 @@ tegra-drm-y := \
falcon.o \
vic.o \
nvdec.o \
+ nvjpg.o \
riscv.o

tegra-drm-y += trace.o
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 4596073fe28fa1beb6689da305775f4468714548..f44fb145920ae77dda82780a659a98c88ea25a5a 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -1383,6 +1383,7 @@ static const struct of_device_id host1x_drm_subdevs[] = {
{ .compatible = "nvidia,tegra210-sor1", },
{ .compatible = "nvidia,tegra210-vic", },
{ .compatible = "nvidia,tegra210-nvdec", },
+ { .compatible = "nvidia,tegra210-nvjpg", },
{ .compatible = "nvidia,tegra186-display", },
{ .compatible = "nvidia,tegra186-dc", },
{ .compatible = "nvidia,tegra186-sor", },
@@ -1421,6 +1422,7 @@ static struct platform_driver * const drivers[] = {
&tegra_gr3d_driver,
&tegra_vic_driver,
&tegra_nvdec_driver,
+ &tegra_nvjpg_driver,
};

static int __init host1x_drm_init(void)
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 0b65e69f3a8add906e48b471804ad45bb3241455..64c8577720245564c421b85057a02419e235a6b6 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -212,5 +212,6 @@ extern struct platform_driver tegra_gr2d_driver;
extern struct platform_driver tegra_gr3d_driver;
extern struct platform_driver tegra_vic_driver;
extern struct platform_driver tegra_nvdec_driver;
+extern struct platform_driver tegra_nvjpg_driver;

#endif /* HOST1X_DRM_H */
diff --git a/drivers/gpu/drm/tegra/nvjpg.c b/drivers/gpu/drm/tegra/nvjpg.c
new file mode 100644
index 0000000000000000000000000000000000000000..57aa74d339d9cea08746aa91b5c8d846962988ee
--- /dev/null
+++ b/drivers/gpu/drm/tegra/nvjpg.c
@@ -0,0 +1,379 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/dma-mapping.h>
+#include <linux/host1x.h>
+#include <linux/iommu.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/reset.h>
+
+#include "drm.h"
+#include "falcon.h"
+
+struct nvjpg_config {
+ const char *firmware;
+ unsigned int version;
+};
+
+struct nvjpg {
+ struct falcon falcon;
+
+ void __iomem *regs;
+ struct tegra_drm_client client;
+ struct device *dev;
+ struct clk *clk;
+ struct reset_control *rst;
+
+ /* Platform configuration */
+ const struct nvjpg_config *config;
+};
+
+static inline struct nvjpg *to_nvjpg(struct tegra_drm_client *client)
+{
+ return container_of(client, struct nvjpg, client);
+}
+
+static int nvjpg_init(struct host1x_client *client)
+{
+ struct tegra_drm_client *drm = host1x_to_drm_client(client);
+ struct drm_device *dev = dev_get_drvdata(client->host);
+ struct tegra_drm *tegra = dev->dev_private;
+ struct nvjpg *nvjpg = to_nvjpg(drm);
+ int err;
+
+ err = host1x_client_iommu_attach(client);
+ if (err < 0 && err != -ENODEV) {
+ dev_err(nvjpg->dev, "failed to attach to domain: %d\n", err);
+ return err;
+ }
+
+ err = tegra_drm_register_client(tegra, drm);
+ if (err < 0)
+ goto detach;
+
+ /*
+ * Inherit the DMA parameters (such as maximum segment size) from the
+ * parent host1x device.
+ */
+ client->dev->dma_parms = client->host->dma_parms;
+
+ return 0;
+
+detach:
+ host1x_client_iommu_detach(client);
+
+ return err;
+}
+
+static int nvjpg_exit(struct host1x_client *client)
+{
+ struct tegra_drm_client *drm = host1x_to_drm_client(client);
+ struct drm_device *dev = dev_get_drvdata(client->host);
+ struct tegra_drm *tegra = dev->dev_private;
+ struct nvjpg *nvjpg = to_nvjpg(drm);
+ int err;
+
+ /* avoid a dangling pointer just in case this disappears */
+ client->dev->dma_parms = NULL;
+
+ err = tegra_drm_unregister_client(tegra, drm);
+ if (err < 0)
+ return err;
+
+ pm_runtime_dont_use_autosuspend(client->dev);
+ pm_runtime_force_suspend(client->dev);
+
+ host1x_client_iommu_detach(client);
+
+ if (client->group) {
+ dma_unmap_single(nvjpg->dev, nvjpg->falcon.firmware.phys,
+ nvjpg->falcon.firmware.size, DMA_TO_DEVICE);
+ tegra_drm_free(tegra, nvjpg->falcon.firmware.size,
+ nvjpg->falcon.firmware.virt,
+ nvjpg->falcon.firmware.iova);
+ } else {
+ dma_free_coherent(nvjpg->dev, nvjpg->falcon.firmware.size,
+ nvjpg->falcon.firmware.virt,
+ nvjpg->falcon.firmware.iova);
+ }
+
+ return 0;
+}
+
+static const struct host1x_client_ops nvjpg_client_ops = {
+ .init = nvjpg_init,
+ .exit = nvjpg_exit,
+};
+
+static int nvjpg_load_falcon_firmware(struct nvjpg *nvjpg)
+{
+ struct host1x_client *client = &nvjpg->client.base;
+ struct tegra_drm *tegra = nvjpg->client.drm;
+ dma_addr_t iova;
+ size_t size;
+ void *virt;
+ int err;
+
+ if (nvjpg->falcon.firmware.virt)
+ return 0;
+
+ err = falcon_read_firmware(&nvjpg->falcon, nvjpg->config->firmware);
+ if (err < 0)
+ return err;
+
+ size = nvjpg->falcon.firmware.size;
+
+ if (!client->group) {
+ virt = dma_alloc_coherent(nvjpg->dev, size, &iova, GFP_KERNEL);
+
+ err = dma_mapping_error(nvjpg->dev, iova);
+ if (err < 0)
+ return err;
+ } else {
+ virt = tegra_drm_alloc(tegra, size, &iova);
+ if (IS_ERR(virt))
+ return PTR_ERR(virt);
+ }
+
+ nvjpg->falcon.firmware.virt = virt;
+ nvjpg->falcon.firmware.iova = iova;
+
+ err = falcon_load_firmware(&nvjpg->falcon);
+ if (err < 0)
+ goto cleanup;
+
+ /*
+ * In this case we have received an IOVA from the shared domain, so we
+ * need to make sure to get the physical address so that the DMA API
+ * knows what memory pages to flush the cache for.
+ */
+ if (client->group) {
+ dma_addr_t phys;
+
+ phys = dma_map_single(nvjpg->dev, virt, size, DMA_TO_DEVICE);
+
+ err = dma_mapping_error(nvjpg->dev, phys);
+ if (err < 0)
+ goto cleanup;
+
+ nvjpg->falcon.firmware.phys = phys;
+ }
+
+ return 0;
+
+cleanup:
+ if (!client->group)
+ dma_free_coherent(nvjpg->dev, size, virt, iova);
+ else
+ tegra_drm_free(tegra, size, virt, iova);
+
+ return err;
+}
+
+static __maybe_unused int nvjpg_runtime_resume(struct device *dev)
+{
+ struct nvjpg *nvjpg = dev_get_drvdata(dev);
+ int err;
+
+ err = clk_prepare_enable(nvjpg->clk);
+ if (err < 0)
+ return err;
+
+ usleep_range(20, 30);
+
+ if (nvjpg->rst) {
+ err = reset_control_acquire(nvjpg->rst);
+ if (err < 0) {
+ dev_err(dev, "failed to acquire reset: %d\n", err);
+ goto disable_clk;
+ }
+
+ err = reset_control_deassert(nvjpg->rst);
+ if (err < 0) {
+ dev_err(dev, "failed to deassert reset: %d\n", err);
+ goto release_reset;
+ }
+
+ usleep_range(20, 30);
+ }
+
+ err = nvjpg_load_falcon_firmware(nvjpg);
+ if (err < 0)
+ goto assert_reset;
+
+ err = falcon_boot(&nvjpg->falcon);
+ if (err < 0)
+ goto assert_reset;
+
+ return 0;
+
+assert_reset:
+ reset_control_assert(nvjpg->rst);
+release_reset:
+ reset_control_release(nvjpg->rst);
+disable_clk:
+ clk_disable_unprepare(nvjpg->clk);
+ return err;
+}
+
+static __maybe_unused int nvjpg_runtime_suspend(struct device *dev)
+{
+ struct nvjpg *nvjpg = dev_get_drvdata(dev);
+ int err;
+
+ if (nvjpg->rst) {
+ err = reset_control_assert(nvjpg->rst);
+ if (err < 0) {
+ dev_err(dev, "failed to assert reset: %d\n", err);
+ return err;
+ }
+
+ usleep_range(20, 30);
+ reset_control_release(nvjpg->rst);
+ }
+
+ clk_disable_unprepare(nvjpg->clk);
+
+ return 0;
+}
+
+static int nvjpg_can_use_memory_ctx(struct tegra_drm_client *client, bool *supported)
+{
+ *supported = false;
+
+ return 0;
+}
+
+static const struct tegra_drm_client_ops nvjpg_ops = {
+ .get_streamid_offset = NULL,
+ .can_use_memory_ctx = nvjpg_can_use_memory_ctx,
+};
+#define NVIDIA_TEGRA_210_NVJPG_FIRMWARE "nvidia/tegra210/nvjpg.bin"
+
+static const struct nvjpg_config nvjpg_t210_config = {
+ .firmware = NVIDIA_TEGRA_210_NVJPG_FIRMWARE,
+ .version = 0x21,
+};
+
+static const struct of_device_id tegra_nvjpg_of_match[] = {
+ { .compatible = "nvidia,tegra210-nvjpg", .data = &nvjpg_t210_config },
+ { },
+};
+MODULE_DEVICE_TABLE(of, tegra_nvjpg_of_match);
+
+static int nvjpg_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct nvjpg *nvjpg;
+ int err;
+
+ /* inherit DMA mask from host1x parent */
+ err = dma_coerce_mask_and_coherent(dev, *dev->parent->dma_mask);
+ if (err < 0) {
+ dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err);
+ return err;
+ }
+
+ nvjpg = devm_kzalloc(dev, sizeof(*nvjpg), GFP_KERNEL);
+ if (!nvjpg)
+ return -ENOMEM;
+
+ nvjpg->config = of_device_get_match_data(dev);
+
+ nvjpg->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
+ if (IS_ERR(nvjpg->regs))
+ return PTR_ERR(nvjpg->regs);
+
+ nvjpg->rst = devm_reset_control_get_exclusive_released(&pdev->dev, "nvjpg");
+ if (IS_ERR(nvjpg->rst)) {
+ err = PTR_ERR(nvjpg->rst);
+
+ if (err != -EBUSY || WARN_ON(!pdev->dev.pm_domain)) {
+ dev_err(&pdev->dev, "failed to get reset control: %d\n",
+ err);
+ return err;
+ }
+
+ /*
+ * At this point, the reset control is most likely being used
+ * by the generic power domain implementation. With any luck
+ * the power domain will have taken care of resetting the SOR
+ * and we don't have to do anything.
+ */
+ nvjpg->rst = NULL;
+ }
+
+ nvjpg->clk = devm_clk_get(dev, "nvjpg");
+ if (IS_ERR(nvjpg->clk)) {
+ dev_err(&pdev->dev, "failed to get clock\n");
+ return PTR_ERR(nvjpg->clk);
+ }
+
+ nvjpg->falcon.dev = dev;
+ nvjpg->falcon.regs = nvjpg->regs;
+
+ err = falcon_init(&nvjpg->falcon);
+ if (err < 0)
+ return err;
+
+ platform_set_drvdata(pdev, nvjpg);
+
+ INIT_LIST_HEAD(&nvjpg->client.base.list);
+ nvjpg->client.base.ops = &nvjpg_client_ops;
+ nvjpg->client.base.dev = dev;
+ nvjpg->client.base.class = HOST1X_CLASS_NVJPG;
+ nvjpg->dev = dev;
+
+ INIT_LIST_HEAD(&nvjpg->client.list);
+ nvjpg->client.version = nvjpg->config->version;
+ nvjpg->client.ops = &nvjpg_ops;
+
+ err = host1x_client_register(&nvjpg->client.base);
+ if (err < 0) {
+ dev_err(dev, "failed to register host1x client: %d\n", err);
+ goto exit_falcon;
+ }
+
+ pm_runtime_use_autosuspend(dev);
+ pm_runtime_set_autosuspend_delay(dev, 500);
+ devm_pm_runtime_enable(dev);
+
+ return 0;
+
+exit_falcon:
+ falcon_exit(&nvjpg->falcon);
+
+ return err;
+}
+
+static void nvjpg_remove(struct platform_device *pdev)
+{
+ struct nvjpg *nvjpg = platform_get_drvdata(pdev);
+
+ host1x_client_unregister(&nvjpg->client.base);
+ falcon_exit(&nvjpg->falcon);
+}
+
+static const struct dev_pm_ops nvjpg_pm_ops = {
+ SET_RUNTIME_PM_OPS(nvjpg_runtime_suspend, nvjpg_runtime_resume, NULL)
+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+ pm_runtime_force_resume)
+};
+
+struct platform_driver tegra_nvjpg_driver = {
+ .driver = {
+ .name = "tegra-nvjpg",
+ .of_match_table = tegra_nvjpg_of_match,
+ .pm = &nvjpg_pm_ops
+ },
+ .probe = nvjpg_probe,
+ .remove = nvjpg_remove,
+};
+
+#if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
+MODULE_FIRMWARE(NVIDIA_TEGRA_210_NVJPG_FIRMWARE);
+#endif

--
2.49.0



Return-Path: <linux-kernel+bounces-675623-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 89FB741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:47:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id B66EF189A37F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:47:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C00928750B;
Fri, 6 Jun 2025 10:46:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="zqPERQUg"
Received: from smtp-42ae.mail.infomaniak.ch (smtp-42ae.mail.infomaniak.ch [84.16.66.174])
(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 649D6214209
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:46:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.174
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206801; cv=none; b=lPn22UweGgzO2HMVapnW4m0YuCdXeh4zxz4zkjW5c87iW4O7XgOvXGrnTwYieuDqfOKxfm9Pr9qp1httyuD5gBGj20ceCvWcXmqObQJJnlFjNapYuK9U00yune2Z8Q6LBc75z0BYs1m0nROKZvJDRocYQP4JREfeG+Qn3O5pS0g=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206801; c=relaxed/simple;
bh=EdISCY8+Nwj/6Ck2qwx1KqleTaHrkAdcHuOQ931eBqc=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=BfNV517XKHV+LuVC122NmavhxJGAQ3SmvgAqdLix8kC173ziSGWTsUJIbeq6qO5HSLWSf/T7Ng5//bHSdPvZAaOAqjqIOBSVkA+SGT5JLE+/RoOgknEVWXQ/HNGCkZuX9z+jQ7ltdbR1L3fCN1g+DYZVd3Fkpd+zmSlCWAcEQp4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=zqPERQUg; arc=none smtp.client-ip=84.16.66.174
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net
Received: from smtp-3-0001.mail.infomaniak.ch (smtp-3-0001.mail.infomaniak.ch [10.4.36.108])
by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4bDJ0747jqz5rT;
Fri, 6 Jun 2025 12:46:31 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digikod.net;
s=20191114; t=1749206791;
bh=hiQyTj6n+Gg20Nh1xHG8uksvLeu5UW/Ze/TPfn76o9k=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=zqPERQUgAHkRj+EGCmB9c3YgKTMwsZbMGsK/qDMZwD9Lbj13miqcFlVMURYAAubK2
i3B1WOlx1T6ZOUgtjJ7iZXjsqnEa4LKxII8BScUkuboPqOuMTLNxP2K6Xw7639aa52
Jt8of9CfhDl4RPMREdx+2Zl5Z0PPL9Czm1Wrphfo=
Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4bDJ062Hb4zhsp;
Fri, 6 Jun 2025 12:46:30 +0200 (CEST)
Date: Fri, 6 Jun 2025 12:46:29 +0200
From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= <mic@xxxxxxxxxxx>
To: Song Liu <song@xxxxxxxxxx>
Cc: bpf@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx, kernel-team@xxxxxxxx,
andrii@xxxxxxxxxx, eddyz87@xxxxxxxxx, ast@xxxxxxxxxx, daniel@xxxxxxxxxxxxx,
martin.lau@xxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx, brauner@xxxxxxxxxx, jack@xxxxxxx,
kpsingh@xxxxxxxxxx, mattbobrowski@xxxxxxxxxx, amir73il@xxxxxxxxx, repnop@xxxxxxxxxx,
jlayton@xxxxxxxxxx, josef@xxxxxxxxxxxxxx, gnoack@xxxxxxxxxx, m@xxxxxxxxxx
Subject: Re: [PATCH v2 bpf-next 2/4] landlock: Use path_walk_parent()
Message-ID: <20250606.zo5aekae6Da6@xxxxxxxxxxx>
References: <20250603065920.3404510-1-song@xxxxxxxxxx>
<20250603065920.3404510-3-song@xxxxxxxxxx>
<20250603.Av6paek5saes@xxxxxxxxxxx>
<CAPhsuW6J_hDtXZm4MH_OAz=GCpRW0NMM1EXMrJ=nqsTdpf8vcg@xxxxxxxxxxxxxx>
<CAPhsuW7MtxryseFsHF2xqBFS2UWammJatjf8UxBhytgn_nA4=g@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAPhsuW7MtxryseFsHF2xqBFS2UWammJatjf8UxBhytgn_nA4=g@xxxxxxxxxxxxxx>
X-Infomaniak-Routing: alpha
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 09:47:36AM -0700, Song Liu wrote:
> On Wed, Jun 4, 2025 at 12:37â?¯PM Song Liu <song@xxxxxxxxxx> wrote:
> >
> > On Tue, Jun 3, 2025 at 6:46�AM Mickaël Salaün <mic@xxxxxxxxxxx> wrote:
> > >
> > > Landlock tests with hostfs fail:
> > >
> > > ok 126 layout3_fs.hostfs.tag_inode_file
> > > # RUN layout3_fs.hostfs.release_inodes ...
> > > # fs_test.c:5555:release_inodes:Expected EACCES (13) == test_open(TMP_DIR, O_RDONLY) (0)
> > >
> > > This specific test checks that an access to a (denied) mount point over
> > > an allowed directory is indeed denied.
>
> I just realized this only fails on hostfs. AFAICT, hostfs is only used
> by um. Do we really need this to behave the same on um+hostfs?

Yes, this would be a regression, and in fact it is not related to hostfs
and it would be a new security bug.

The issue is that the path_walk_parent() doesn't return the parent
dentry but the underlying mount point if any. When choose_mountpoint()
returns true, path_walk_parent() should continue to the following root
check and potentiall the dget_parent() call. We need to be careful with
the path_put() though.

This issue was only spotted by this hostfs test because this one adds a
rule which is tied to the inode of the mount which is in fact the same
inode of the mount point because the mount is a bind mount. I'll send a
new test that check the same thing but with tmpfs (for convenience, but
it would be the same for any filesystem).

>
> Thanks,
> Song
>
> >
> > I am having trouble understanding the test. It appears to me
> > the newly mounted tmpfs on /tmp is allowed, but accesses to
> > / and thus mount point /tmp is denied? What would the walk in
> > is_access_to_paths_allowed look like?

The test checks that a mount is not wrongly identified as the underlying
mount point.

> >
> > > It's not clear to me the origin of the issue, but it seems to be related
> > > to choose_mountpoint().
> > >
> > > You can run these tests with `check-linux.sh build kselftest` from
> > > https://github.com/landlock-lsm/landlock-test-tools
> >
> > How should I debug this test? printk doesn't seem to work.

The console log level is set to warn, so you can use pr_warn().

> >
> > Thanks,
> > Song


Return-Path: <linux-kernel+bounces-675624-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 355BE41E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:47:26 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 548881785DC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:47:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A67528750F;
Fri, 6 Jun 2025 10:47:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tPyoyjUi"
Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EC2C286885
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:47:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206831; cv=none; b=V2lSe7m6Rlj4cHDbFZqtfhG3wrPLBjpDC/TM1eSualohxIojAiFEFwgi62mouprzS6woRrs1LoC527aA1wylDIvCoI1UyVXLfGquuRIRrhmw+ElaK2syCp5WPHlDILDP4k/F49BXgRF6ofWfEqS44y5q59zOuVfG1NlyNdD08A8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206831; c=relaxed/simple;
bh=f+/j1GlnG7yRbwOXO1wHIG7cgcq9EW09L+j7P/rKe1k=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=GAn4MtvvN9QqaWQCm40dxu1EbdJHuCH7MWpncwjsQ9p6c/ZdpJx1JXW3l2xI/4iEUJ7Qo6GraWvxkT06ZS8JAAzbkNPMOSCAr3VJiJKTrHoIR5GMmaMrd1ewTCgASn1QeTxqY50E0m+bJJaxfJjPQTivP4Q/8FFmoZEzSjIDtKk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=tPyoyjUi; arc=none smtp.client-ip=209.85.208.169
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-32a6c0d613eso2000541fa.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:47:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749206827; x=1749811627; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:references:cc:to
:content-language:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=Sdh3DYrunzvdU87ptIswN2gqeFyihiWuxRVoLIp7jeA=;
b=tPyoyjUiWWXQlWbmAywAoEgb95uFXimp9DGWTF9bnPOfoetyO9LhY5eRf1B3l4NS42
p8QMipdHZ4eJ0sT9yloT19TE9BX6ywU2RNJLDrbVuryl5yDWtueOBrRxzT0qFhEwfE9H
q+Fmg7fhwjfLzJNL9DxAG1NzmB/KjlT4zQTEAR3SWQfbE0xA9flHNZ1B5U/XRJGCnetP
DFjo/ifQNB98y1ziAz/I2QvDGXZ5nxHRoN9RIC5ZEeLjZdktjIsorjgr9DihoDFGwt8p
MX14o1o8bD8LnpwLu6RulESjXrste7fGpUKPLX/EMEHn1/gcPm4vdXRUgxmISnpfWPak
h/eg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749206827; x=1749811627;
h=content-transfer-encoding:in-reply-to:from:references:cc:to
:content-language:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=Sdh3DYrunzvdU87ptIswN2gqeFyihiWuxRVoLIp7jeA=;
b=XiCVKB8HybY3Xe6kR2/nOdcQHfDrnP4p8e4GLl4iIH7ZSiyu6P5Aj5E47TaXH4mK4/
nT2Y1IcmdJJZcoqUwlDVi1p9H35s5ZlmwndMniaNQLIshiOOdUGbLaaNrhN3whT4rmNr
X21F2Q38VWEcorZRJsIeP2SAwTWIWeqWI2hq/wUGIlIoYF3RljkbH9kjUTDrr6MMOKmi
4nL1p6id/yj62Ss0Jkvc25r7ldcygO7LN07ai+M5ErlQpWYnDcsqhpBP9YguEnMNPRWx
yDQdguzQ4SvliO++2K92FX0f0oL/4FsQMd1Bl681GAWDjXK8c+RzvmTPWHFghclN0Xak
P6xg==
X-Gm-Message-State: AOJu0Yx4ge1LBWzK86ru1INomOBfbvBmFOVXrynlXtAdODyVinbCGJsL
m1/6Ukpyo94Z7nJ3TtysI4Ltl9BriY9WTVhjrBuXPwbnqWXKKzH9G3OQP1uG8wmX8DZ5tAeMAsF
Mc/5l
X-Gm-Gg: ASbGncuDWCnVJNP2h2Cr9IjeMb67zbr/dpv4p5TBL9ybiJWYn+GlqSvQxhqfXMRjt5d
gIU2MyII5UpctHoZMVbIZpHeouaDlYx21j+fJ8dCI05GPUyEz1V7cSepS8x2SB0Qrm/4wieXnGr
6wDKrZpmAOPRp1Y1dfJSkvlMIkpo1PXtnRswq8VlOOOVwrU1p1xxMs8HHSEi+mfrEnI68nS4UM6
rR3KFjRpC9I7dvAmXRPFkWBBI0bt5Q7QyOBLdhaPOe3j366lJgTxUgQSdMAtvWgCOhcPIEeZgO9
Ho/A92L5Mv/T7LT8tPXNS8UA3aJ88HVppEPrV76+vxcdo9Z/iYU8CeZPeN3vNg89q564JN9KdS9
Dg3Z8GLwjetBot5Hpxy2GURa/xGNBaSdybOLsuCuq
X-Google-Smtp-Source: AGHT+IGxjhoxsgVGEZoQ3YemtpUiJRV1bf+P3EhChyczWjkpXHPpDvcvXiPRpgWGAH6vjpJO+8TgQw==
X-Received: by 2002:ac2:4e0d:0:b0:553:2e82:162e with SMTP id 2adb3069b0e04-553685e5a0dmr156612e87.2.1749206827030;
Fri, 06 Jun 2025 03:47:07 -0700 (PDT)
Received: from [192.168.1.4] (88-112-131-206.elisa-laajakaista.fi. [88.112.131.206])
by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-32ae1b33b48sm1379641fa.30.2025.06.06.03.47.06
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 03:47:06 -0700 (PDT)
Message-ID: <2884f55c-6b80-406a-ba21-aaa26297b1bf@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:46:59 +0300
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v4 3/4] media: dt-bindings: Add qcom,msm8939-camss
Content-Language: ru-RU
To: vincent.knecht@xxxxxxxxxx, Robert Foss <rfoss@xxxxxxxxxx>,
Todor Tomov <todor.too@xxxxxxxxx>,
Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley
<conor+dt@xxxxxxxxxx>, Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx,
linux-arm-msm@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
=?UTF-8?Q?Andr=C3=A9_Apitzsch?= <git@xxxxxxxxxxx>,
phone-devel@xxxxxxxxxxxxxxx, ~postmarketos/upstreaming@xxxxxxxxxxx,
Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
References: <20250602-camss-8x39-vbif-v4-0-32c277d8f9bf@xxxxxxxxxx>
<20250602-camss-8x39-vbif-v4-3-32c277d8f9bf@xxxxxxxxxx>
From: Vladimir Zapolskiy <vladimir.zapolskiy@xxxxxxxxxx>
In-Reply-To: <20250602-camss-8x39-vbif-v4-3-32c277d8f9bf@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello Vincent.

On 6/2/25 20:27, Vincent Knecht via B4 Relay wrote:
> From: Vincent Knecht <vincent.knecht@xxxxxxxxxx>
>
> Add bindings for qcom,msm8939-camss in order to support the camera
> subsystem for MSM8939.
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> Signed-off-by: Vincent Knecht <vincent.knecht@xxxxxxxxxx>
> ---
> .../bindings/media/qcom,msm8939-camss.yaml | 254 +++++++++++++++++++++
> 1 file changed, 254 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/media/qcom,msm8939-camss.yaml b/Documentation/devicetree/bindings/media/qcom,msm8939-camss.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..59bf16888a8235495a2080e512ce179583bcd25d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/qcom,msm8939-camss.yaml
> @@ -0,0 +1,254 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/media/qcom,msm8939-camss.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm MSM8939 Camera Subsystem (CAMSS)
> +
> +maintainers:
> + - Vincent Knecht <vincent.knecht@xxxxxxxxxx>
> +
> +description:
> + The CAMSS IP is a CSI decoder and ISP present on Qualcomm platforms
> +
> +properties:
> + compatible:
> + const: qcom,msm8939-camss
> +
> + reg:
> + maxItems: 11
> +
> + reg-names:
> + items:
> + - const: csid0
> + - const: csid1
> + - const: csid2
> + - const: csiphy0
> + - const: csiphy0_clk_mux
> + - const: csiphy1
> + - const: csiphy1_clk_mux
> + - const: csi_clk_mux
> + - const: ispif
> + - const: vfe0
> + - const: vfe0_vbif

Please sort the list alphanumerically, accorting to the ASCII character set
the underscore symbol precedes lower case letters.

> +
> + clocks:
> + maxItems: 24
> +
> + clock-names:
> + items:
> + - const: ahb
> + - const: csi0
> + - const: csi0_ahb
> + - const: csi0_phy
> + - const: csi0_pix
> + - const: csi0_rdi
> + - const: csi1
> + - const: csi1_ahb
> + - const: csi1_phy
> + - const: csi1_pix
> + - const: csi1_rdi
> + - const: csi2
> + - const: csi2_ahb
> + - const: csi2_phy
> + - const: csi2_pix
> + - const: csi2_rdi
> + - const: csiphy0_timer
> + - const: csiphy1_timer
> + - const: csi_vfe0
> + - const: ispif_ahb
> + - const: top_ahb
> + - const: vfe0
> + - const: vfe_ahb
> + - const: vfe_axi

Same comment as above.

> +
> + interrupts:
> + maxItems: 7
> +
> + interrupt-names:
> + items:
> + - const: csid0
> + - const: csid1
> + - const: csid2
> + - const: csiphy0
> + - const: csiphy1
> + - const: ispif
> + - const: vfe0
> +
> + iommus:
> + maxItems: 1
> +
> + power-domains:
> + items:
> + - description: VFE GDSC - Video Front End, Global Distributed Switch
> + Controller.
> +
> + vdda-supply:
> + description:
> + Definition of the regulator used as analog power supply.

Please specify the wanted voltage level in the description, due to
the example below I would expect it's 2.8V.

> +
> + ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> +
> + description:
> + CSI input ports.
> +
> + patternProperties:
> + "^port@[0-1]$":
> + $ref: /schemas/graph.yaml#/$defs/port-base
> + unevaluatedProperties: false
> +
> + description:
> + Input port for receiving CSI data.
> +
> + properties:
> + endpoint:
> + $ref: video-interfaces.yaml#
> + unevaluatedProperties: false
> +
> + properties:
> + data-lanes:
> + minItems: 1
> + maxItems: 4
> +
> + bus-type:
> + enum:
> + - 4 # MEDIA_BUS_TYPE_CSI2_DPHY
> +
> + required:
> + - data-lanes
> +
> +required:
> + - compatible
> + - reg
> + - reg-names
> + - clocks
> + - clock-names
> + - interrupts
> + - interrupt-names
> + - iommus
> + - power-domains
> + - vdda-supply
> + - ports
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> + #include <dt-bindings/clock/qcom,gcc-msm8939.h>
> +
> + isp@1b08000 {
> + compatible = "qcom,msm8939-camss";
> +
> + reg = <0x01b08000 0x100>,
> + <0x01b08400 0x100>,
> + <0x01b08800 0x100>,
> + <0x01b0ac00 0x200>,
> + <0x01b00030 0x4>,
> + <0x01b0b000 0x200>,
> + <0x01b00038 0x4>,
> + <0x01b00020 0x10>,
> + <0x01b0a000 0x500>,
> + <0x01b10000 0x1000>,
> + <0x01b40000 0x200>;
> +
> + reg-names = "csid0",
> + "csid1",
> + "csid2",
> + "csiphy0",
> + "csiphy0_clk_mux",
> + "csiphy1",
> + "csiphy1_clk_mux",
> + "csi_clk_mux",
> + "ispif",
> + "vfe0",
> + "vfe0_vbif";
> +
> + clocks = <&gcc GCC_CAMSS_AHB_CLK>,
> + <&gcc GCC_CAMSS_CSI0_CLK>,
> + <&gcc GCC_CAMSS_CSI0_AHB_CLK>,
> + <&gcc GCC_CAMSS_CSI0PHY_CLK>,
> + <&gcc GCC_CAMSS_CSI0PIX_CLK>,
> + <&gcc GCC_CAMSS_CSI0RDI_CLK>,
> + <&gcc GCC_CAMSS_CSI1_CLK>,
> + <&gcc GCC_CAMSS_CSI1_AHB_CLK>,
> + <&gcc GCC_CAMSS_CSI1PHY_CLK>,
> + <&gcc GCC_CAMSS_CSI1PIX_CLK>,
> + <&gcc GCC_CAMSS_CSI1RDI_CLK>,
> + <&gcc GCC_CAMSS_CSI2_CLK>,
> + <&gcc GCC_CAMSS_CSI2_AHB_CLK>,
> + <&gcc GCC_CAMSS_CSI2PHY_CLK>,
> + <&gcc GCC_CAMSS_CSI2PIX_CLK>,
> + <&gcc GCC_CAMSS_CSI2RDI_CLK>,
> + <&gcc GCC_CAMSS_CSI0PHYTIMER_CLK>,
> + <&gcc GCC_CAMSS_CSI1PHYTIMER_CLK>,
> + <&gcc GCC_CAMSS_CSI_VFE0_CLK>,
> + <&gcc GCC_CAMSS_ISPIF_AHB_CLK>,
> + <&gcc GCC_CAMSS_TOP_AHB_CLK>,
> + <&gcc GCC_CAMSS_VFE0_CLK>,
> + <&gcc GCC_CAMSS_VFE_AHB_CLK>,
> + <&gcc GCC_CAMSS_VFE_AXI_CLK>;
> +
> + clock-names = "ahb",
> + "csi0",
> + "csi0_ahb",
> + "csi0_phy",
> + "csi0_pix",
> + "csi0_rdi",
> + "csi1",
> + "csi1_ahb",
> + "csi1_phy",
> + "csi1_pix",
> + "csi1_rdi",
> + "csi2",
> + "csi2_ahb",
> + "csi2_phy",
> + "csi2_pix",
> + "csi2_rdi",
> + "csiphy0_timer",
> + "csiphy1_timer",
> + "csi_vfe0",
> + "ispif_ahb",
> + "top_ahb",
> + "vfe0",
> + "vfe_ahb",
> + "vfe_axi";
> +
> + interrupts = <GIC_SPI 51 IRQ_TYPE_EDGE_RISING>,
> + <GIC_SPI 52 IRQ_TYPE_EDGE_RISING>,
> + <GIC_SPI 153 IRQ_TYPE_EDGE_RISING>,
> + <GIC_SPI 78 IRQ_TYPE_EDGE_RISING>,
> + <GIC_SPI 79 IRQ_TYPE_EDGE_RISING>,
> + <GIC_SPI 55 IRQ_TYPE_EDGE_RISING>,
> + <GIC_SPI 57 IRQ_TYPE_EDGE_RISING>;
> +
> + interrupt-names = "csid0",
> + "csid1",
> + "csid2",
> + "csiphy0",
> + "csiphy1",
> + "ispif",
> + "vfe0";
> +
> + iommus = <&apps_iommu 3>;
> +
> + power-domains = <&gcc VFE_GDSC>;
> +
> + vdda-supply = <&reg_2v8>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@1 {
> + reg = <1>;
> + csiphy1_ep: endpoint {

There should be an empty line between the end of the list of properties
and the beginning of the list of children device tree nodes.

> + clock-lanes = <1>;

Please remove 'clock-lanes' propoerty from here.

> + data-lanes = <0 2>;
> + remote-endpoint = <&sensor_ep>;
> + };
> + };
> + };
> + };
>

--
Best wishes,
Vladimir


Return-Path: <linux-kernel+bounces-675625-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CA7CD41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:48:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0D5997A3358
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:46:45 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 482C12874FE;
Fri, 6 Jun 2025 10:47:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="neHZTkBR"
Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131])
(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 95CA327FB35;
Fri, 6 Jun 2025 10:47:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749206873; cv=none; b=TEN0P7P86Yj8l3lI3GaTPcLFsDAcE+Fqzx8jlbgh0SictIGE4zXN4UWhu9yMPfz147gyDC85LqlxYKEw+OfUhvcMT0LlVQ6KCO575MGyCmZ4/nUhJEnIMsFWqO+wGTzMBprj1OsRMILY7LDlaYqeMTnHBuruXvFXvW4unB9XcvM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749206873; c=relaxed/simple;
bh=QskOF1fBwiApH4/AwXD144gfb0R5kxegs360iIkwX4A=;
h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=cs0EoqcDChiEeES+uQG2O2lYLn7hWAhQwE5KRMq9HqVYmlOtobqqbhfVaZAu4CdnCDLBjcc6+5rD/ZOTbbTC37xF8jkcZKHohP+fCR6dNNPEyLFqaeOafsCkObEpawFUEI9BeZG56X8mU2RnJp76mStxwY+leOLILKAec/mp5FU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=neHZTkBR; arc=none smtp.client-ip=205.220.168.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com
Received: from pps.filterd (m0279867.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565pR89006326;
Fri, 6 Jun 2025 10:47:47 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=
cc:content-transfer-encoding:content-type:date:from:message-id
:mime-version:subject:to; s=qcppdkim1; bh=hAPSsiUdvJ416pcpm4p/aT
AD3Uul2pKU2G/WCD7xAW4=; b=neHZTkBR04EjSx8zUJeogduVY9E1GMt4xf7fDx
b0IBRXIF/cfpRO7RoQKutkBh4Q/NeMuZVNDD5VMw6PYHyhCghNoQdfs4219bvTMt
ubXNhtwA9hYvQhDrmCOMkU4MhwHWhDbtrLKb6aeVl4PnRG1C1IMjDpV2YEE4Rh8w
wqPGyPRq0ERfaBDT89JPkkfalZ7FudRN219clT+W+z43UUeMEFRWyo0TJS5IBBVn
Cr5iuRUJKRXEYH2Zqz1XT2ngUSRIYqM3+lFmgWIu/5dBDvNdUM4uGUhHur7mxQaG
grQMnZUme6Yt3xFA11++0bWZ9Axfa06p0NxNyQEBpsjT4kOA==
Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8t4bud-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 10:47:46 +0000 (GMT)
Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231])
by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 556AlkAK001122
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 6 Jun 2025 10:47:46 GMT
Received: from hu-dmukhopa-hyd.qualcomm.com (10.80.80.8) by
nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1544.9; Fri, 6 Jun 2025 03:47:38 -0700
From: Debraj Mukhopadhyay <quic_dmukhopa@xxxxxxxxxxx>
To: Ulf Hansson <ulf.hansson@xxxxxxxxxx>,
Adrian Hunter
<adrian.hunter@xxxxxxxxx>
CC: <linux-mmc@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<linux-arm-msm@xxxxxxxxxxxxxxx>, <kernel@xxxxxxxxxxx>,
Eric Biggers
<ebiggers@xxxxxxxxxx>,
Neeraj Soni <quic_neersoni@xxxxxxxxxxx>,
"Debraj
Mukhopadhyay" <quic_dmukhopa@xxxxxxxxxxx>,
Ram Prakash Gupta
<quic_rampraka@xxxxxxxxxxx>,
Nitin Rawat <quic_nitirawa@xxxxxxxxxxx>,
"Sachin
Gupta" <quic_sachgupt@xxxxxxxxxxx>,
Bhaskar Valaboju
<quic_bhaskarv@xxxxxxxxxxx>,
Gaurav Kashyap <quic_gaurkash@xxxxxxxxxxx>,
Sarthak Garg <quic_sartgarg@xxxxxxxxxxx>,
Seshu Madhavi Puppala
<quic_spuppala@xxxxxxxxxxx>
Subject: [PATCH v2] mmc: Avoid reprogram all keys to Inline Crypto Engine for MMC runtime suspend resume
Date: Fri, 6 Jun 2025 16:17:14 +0530
Message-ID: <20250606104714.1501297-1-quic_dmukhopa@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To
nasanex01a.na.qualcomm.com (10.52.223.231)
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085
X-Proofpoint-ORIG-GUID: LrZwEgCPuoX7sMsO1t2kE6T5iZhrp6zt
X-Authority-Analysis: v=2.4 cv=EPcG00ZC c=1 sm=1 tr=0 ts=6842c752 cx=c_pps
a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17
a=GEpy-HfZoHoA:10 a=6IFa9wvqVegA:10 a=VwQbUJbxAAAA:8 a=COk6AnOGAAAA:8
a=1QBs8BvCmvQ6mH5QngwA:9 a=TjNXssC_j7lpFel5tvFf:22
X-Proofpoint-GUID: LrZwEgCPuoX7sMsO1t2kE6T5iZhrp6zt
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5NyBTYWx0ZWRfX/ryXZDAnRGlG
OjiKXRUYxye73XvmkJr3Ne9b5DaMrdDswdbF4fOr6goipqfAw2wG/Kf9U2/nx3JS+qwyGJyN5/8
U8qg0hzGLNIbY9SfKn5KxEQ+ySI+RM7loyrSDjTv4PgsFmRFzv5dY6McaBh6ZSOy/6+dKXJBOrn
enRtDZF8vNj/71Gacq6ElUDiWN1WCwJFzq0wvEU8loaQXJETHjrjeSCOgWHE257GHJQPmTjDNrB
lmy5in2ui9nxzsK70ft0rHOwJfceZ0I/mKo0xVHw1WLtKH3uWCtRDnxvgStDI7B1BUa/Bn8dygV
k12BkOanWeXpaFSntQ/5NPN+T9JNdvFYDMaluJwhH4Qgb4BDgo7nym/aWdsbvUlZsG7AfC7l8ey
pjmAwKwxsx8ZVNpZXOHOHzwYkG9pgCpzCGiZj9Uf5xRRBHfjwIBF4wclFzsB2WNGyR5iJQ3M
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
spamscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 phishscore=0
impostorscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 mlxscore=0
clxscore=1011 mlxlogscore=946 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060097
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Crypto reprogram all keys is called for each MMC runtime
suspend/resume in current upstream design. If this is implemented
as a non-interruptible call to TEE for security, the cpu core is
blocked for execution while this call executes although the crypto
engine already has the keys. For example, glitches in audio/video
streaming applications have been observed due to this. Add the flag
MMC_CAP2_DONT_REPROGRAM as part of host->caps2 to control reprogramming
keys to crypto engine for socs which dont require this feature.

Signed-off-by: Seshu Madhavi Puppala <quic_spuppala@xxxxxxxxxxx>
Co-developed-by: Ram Prakash Gupta <quic_rampraka@xxxxxxxxxxx>
Signed-off-by: Ram Prakash Gupta <quic_rampraka@xxxxxxxxxxx>
Co-developed-by: Sarthak Garg <quic_sartgarg@xxxxxxxxxxx>
Signed-off-by: Sarthak Garg <quic_sartgarg@xxxxxxxxxxx>
Signed-off-by: Debraj Mukhopadhyay <quic_dmukhopa@xxxxxxxxxxx>

---

Changes in v2:
- Renamed MMC_CAP2_DONT_REPROGRAM to MMC_CAP2_CRYPTO_NO_REPROG for
improved clarity.
- Defined MMC_CAP2_CRYPTO_NO_REPROG for MMC targets that do not support
a Crypto Engine.
- Restricted the usage of struct crypto_profile to MMC devices that
support a Crypto Engine.

Changes in v1:
- Addressed the comments from:
https://lore.kernel.org/lkml/20241006135530.17363-3-
quic_spuppala@xxxxxxxxxxx/T/#m69c9ab538bd9efd54515646952d0d7d1d7c17690
- Avoided reprogram of keys for Qualcomm SOCs only.
- Ensured reprogram of all keys on host controller reset.

---

drivers/mmc/core/crypto.c | 2 +-
drivers/mmc/host/sdhci-msm.c | 6 ++++++
include/linux/mmc/host.h | 5 +++++
3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/crypto.c b/drivers/mmc/core/crypto.c
index fec4fbf16a5b..d41672e2856e 100644
--- a/drivers/mmc/core/crypto.c
+++ b/drivers/mmc/core/crypto.c
@@ -15,7 +15,7 @@
void mmc_crypto_set_initial_state(struct mmc_host *host)
{
/* Reset might clear all keys, so reprogram all the keys. */
- if (host->caps2 & MMC_CAP2_CRYPTO)
+ if (host->caps2 & MMC_CAP2_CRYPTO && !(host->caps2 & MMC_CAP2_CRYPTO_NO_REPROG))
blk_crypto_reprogram_all_keys(&host->crypto_profile);
}

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 66c0d1ba2a33..ee6783555f2e 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1920,6 +1920,7 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host,
}

mmc->caps2 |= MMC_CAP2_CRYPTO;
+ mmc->caps2 |= MMC_CAP2_CRYPTO_NO_REPROG;
return 0;
}

@@ -2497,6 +2498,11 @@ static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host)
usleep_range(200, 210);
reset_control_put(reset);

+#ifdef CONFIG_MMC_CRYPTO
+ if (host->mmc->caps2 & MMC_CAP2_CRYPTO)
+ blk_crypto_reprogram_all_keys(&host->mmc->crypto_profile);
+#endif
+
return ret;
}

diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 68f09a955a90..af3b3720aa9c 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -459,6 +459,11 @@ struct mmc_host {
#define MMC_CAP2_CRYPTO 0
#endif
#define MMC_CAP2_ALT_GPT_TEGRA (1 << 28) /* Host with eMMC that has GPT entry at a non-standard location */
+#ifdef CONFIG_MMC_CRYPTO
+#define MMC_CAP2_CRYPTO_NO_REPROG (1 << 29) /* Host does not support inline crypto key reprogramming */
+#else
+#define MMC_CAP2_CRYPTO_NO_REPROG 0
+#endif

bool uhs2_sd_tran; /* UHS-II flag for SD_TRAN state */
bool uhs2_app_cmd; /* UHS-II flag for APP command */
--
2.34.1



Return-Path: <linux-kernel+bounces-675626-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 78D8141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:50:16 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8F15F17221E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:50:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AC35428750A;
Fri, 6 Jun 2025 10:50:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Torlej3I"
Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199])
(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 09AC62C3242;
Fri, 6 Jun 2025 10:50:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207005; cv=none; b=DD4bDpOW8zw5AGm683hlNZTdrPVgbhXOBzuBH1QwtmGfpL03FZh90PH/0vADWIgpiH9sVGQqo9JhAwszk6ZmLP9zCscs2tP9X6Fcc3QpFGuzcGf4ctA7lSy718naAKxjo8r7jFTQ8Oj6rYCw3PNNuMqQfHXV8nXXj3ucpEnkpiw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207005; c=relaxed/simple;
bh=oVChse1wLr1LatGOtuMGq5IMy2U8hxvfsamh2B8qz9E=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=egNAsMWaGt+tkRvNT6XBKbJEFYDd7xZNFiqgtPD6wqaySV4/2waL5zi8d2pXUdlyZ+vF80Cpn2KlNDBJMZstraismxvxZnrV83y3QHjdtQv357iDZScVxgIm9oIeDcXwL+iVEBBDGO8O5ze/8zFPtkL4qgSNnqkwZ4l4UnHJ/Io=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Torlej3I; arc=none smtp.client-ip=90.155.92.199
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version:
References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:
Content-Transfer-Encoding:Content-ID:Content-Description;
bh=RgB6+Le5gZuvkTyuy9hjeapQkiI3tD5aj0y4LFHCOn0=; b=Torlej3I0MsK1FluWphWjPqhsU
dYVV1Iq3HXQwbpZ4GJPpspOkLrHMdyGDEmocb19R4VBLitr0DShyV9gUU1KA0nO2o8qHQ4oj2+Mea
ZkYT8kN2mdJyfPOZoEcG1LqGibuuMfFVE8slw+g9N1tF9P4ndbI00fCWneAVBZjhgnSKacWOXwuVZ
dvHSKONQ7BrU9xHYFYpVaKe8XVMmWNFrs7Co/CWhtFD3jWbnSEaN8tJD6YfV8XfTLZbPZz8HGoADB
pz4Lo1m4tNt4yClsbpq3GMlZp8yEd2XAfRqjsD60qUBJfGi4UHjU6iCxBzPcPmt7PloO4J0n2f17N
9SpAdLhQ==;
Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net)
by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux))
id 1uNUdu-00000001GGo-2krp;
Fri, 06 Jun 2025 10:49:47 +0000
Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000)
id 8F36B3005AF; Fri, 6 Jun 2025 12:49:45 +0200 (CEST)
Date: Fri, 6 Jun 2025 12:49:45 +0200
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
To: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Cc: Sean Christopherson <seanjc@xxxxxxxxxx>,
"H. Peter Anvin" <hpa@xxxxxxxxx>, x86@xxxxxxxxxx, kys@xxxxxxxxxxxxx,
haiyangz@xxxxxxxxxxxxx, wei.liu@xxxxxxxxxx, decui@xxxxxxxxxxxxx,
tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, bp@xxxxxxxxx,
dave.hansen@xxxxxxxxxxxxxxx, pbonzini@xxxxxxxxxx, ardb@xxxxxxxxxx,
kees@xxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>,
gregkh@xxxxxxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx,
linux-efi@xxxxxxxxxxxxxxx, samitolvanen@xxxxxxxxxx,
ojeda@xxxxxxxxxx, xin@xxxxxxxxx
Subject: Re: [PATCH v2 00/13] objtool: Detect and warn about indirect calls
in __nocfi functions
Message-ID: <20250606104945.GY39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20250506073100.GG4198@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<20250506133234.GH4356@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<vukrlmb4kbpcol6rtest3tsw4y6obopbrwi5hcb5iwzogsopgt@sokysuzxvehi>
<20250528074452.GU39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<20250528163035.GH31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<20250528163557.GI31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<20250529093017.GJ31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<fp5amaygv37wxr6bglagljr325rsagllbabb62ow44kl3mznb6@gzk6nuukjgwv>
<eegs5wq4eoqpu5yqlzug7icptiwzusracrp3nlmjkxwfywzvez@jngbkb3xqj6o>
<4z4fhaqesjlevwiugiqpnxdths5qkkj7vd4q3wgdosu4p24ppl@nb6c2gybuwe5>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4z4fhaqesjlevwiugiqpnxdths5qkkj7vd4q3wgdosu4p24ppl@nb6c2gybuwe5>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 10:19:41AM -0700, Josh Poimboeuf wrote:

> diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h
> index d83236b96f22..e680afbf65b6 100644
> --- a/arch/x86/entry/calling.h
> +++ b/arch/x86/entry/calling.h
> @@ -99,7 +99,7 @@ For 32-bit we have the following conventions - kernel is built with
> .endif
> .endm
>
> -.macro CLEAR_REGS clear_bp=1
> +.macro CLEAR_REGS clear_callee=1
> /*
> * Sanitize registers of values that a speculation attack might
> * otherwise want to exploit. The lower registers are likely clobbered
> @@ -113,20 +113,19 @@ For 32-bit we have the following conventions - kernel is built with
> xorl %r9d, %r9d /* nospec r9 */
> xorl %r10d, %r10d /* nospec r10 */
> xorl %r11d, %r11d /* nospec r11 */
> + .if \clear_callee
> xorl %ebx, %ebx /* nospec rbx */
> - .if \clear_bp
> xorl %ebp, %ebp /* nospec rbp */
> - .endif
> xorl %r12d, %r12d /* nospec r12 */
> xorl %r13d, %r13d /* nospec r13 */
> xorl %r14d, %r14d /* nospec r14 */
> xorl %r15d, %r15d /* nospec r15 */
> -
> + .endif
> .endm
>
> -.macro PUSH_AND_CLEAR_REGS rdx=%rdx rcx=%rcx rax=%rax save_ret=0 clear_bp=1 unwind_hint=1
> +.macro PUSH_AND_CLEAR_REGS rdx=%rdx rcx=%rcx rax=%rax save_ret=0 clear_callee=1 unwind_hint=1
> PUSH_REGS rdx=\rdx, rcx=\rcx, rax=\rax, save_ret=\save_ret unwind_hint=\unwind_hint
> - CLEAR_REGS clear_bp=\clear_bp
> + CLEAR_REGS clear_callee=\clear_callee
> .endm
>
> .macro POP_REGS pop_rdi=1

Nice. So that leaves the callee-clobbered, extra caller-saved and return
registers cleared, and preserves the callee-saved regs.

> diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S
> index 29c5c32c16c3..5d1eef193b79 100644
> --- a/arch/x86/entry/entry_64_fred.S
> +++ b/arch/x86/entry/entry_64_fred.S
> @@ -112,11 +112,12 @@ SYM_FUNC_START(asm_fred_entry_from_kvm)
> push %rax /* Return RIP */
> push $0 /* Error code, 0 for IRQ/NMI */
>
> - PUSH_AND_CLEAR_REGS clear_bp=0 unwind_hint=0
> + PUSH_AND_CLEAR_REGS clear_callee=0 unwind_hint=0
> movq %rsp, %rdi /* %rdi -> pt_regs */
> call __fred_entry_from_kvm /* Call the C entry point */
> - POP_REGS
> - ERETS
> + addq $C_PTREGS_SIZE, %rsp
> +
> + ALTERNATIVE "mov %rbp, %rsp", __stringify(ERETS), X86_FEATURE_FRED

So... I was wondering.. do we actually ever need the ERETS? AFAICT this
will only ever 'inject' external interrupts, and those are not supposed
to change the exception frame, like ever. Only exceptions get to change
the exception frame, but those are explicitly excluded in fred_extint().

As such, it should always be correct to just do:

leave;
RET;

at this point, and call it a day, no? Just completely forget about all
this sillyness with alternatives and funky stack state.

Only problem seems to be that if we do this, then
has_modified_stack_frame() has a fit, because of the register state.

The first to complain is bx, the push %rbx modifies the CFI state to
track where on the stack its saved, and that's not what initial_func_cfi
has.

We can stomp on that with UNWIND_HINT_FUNC right before RET. It's all a
bit magical, but should work, right?

So keeping your CLEAR_REGS changes, I've ended up with the below:

---
diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S
index 29c5c32c16c3..8c03d04ea69d 100644
--- a/arch/x86/entry/entry_64_fred.S
+++ b/arch/x86/entry/entry_64_fred.S
@@ -62,8 +62,6 @@ SYM_FUNC_START(asm_fred_entry_from_kvm)
push %rbp
mov %rsp, %rbp

- UNWIND_HINT_SAVE
-
/*
* Both IRQ and NMI from VMX can be handled on current task stack
* because there is no need to protect from reentrancy and the call
@@ -112,19 +110,35 @@ SYM_FUNC_START(asm_fred_entry_from_kvm)
push %rax /* Return RIP */
push $0 /* Error code, 0 for IRQ/NMI */

- PUSH_AND_CLEAR_REGS clear_bp=0 unwind_hint=0
+ PUSH_AND_CLEAR_REGS clear_callee=0 unwind_hint=0
movq %rsp, %rdi /* %rdi -> pt_regs */
+
+ /*
+ * At this point: {rdi, rsi, rdx, rcx, r8, r9}, {r10, r11}, {rax, rdx}
+ * are clobbered, which corresponds to: arguments, extra caller-saved
+ * and return. All registers a C function is allowed to clobber.
+ *
+ * Notably, the callee-saved registers: {rbx, r12, r13, r14, r15}
+ * are untouched, with the exception of rbp, which carries the stack
+ * frame and will be restored before exit.
+ *
+ * Further calling another C function will not alter this state.
+ */
call __fred_entry_from_kvm /* Call the C entry point */
- POP_REGS
- ERETS
-1:
+
+1: /*
+ * Therefore, all that remains to be done at this point is restore the
+ * stack and frame pointer register.
+ */
+ leave
/*
- * Objtool doesn't understand what ERETS does, this hint tells it that
- * yes, we'll reach here and with what stack state. A save/restore pair
- * isn't strictly needed, but it's the simplest form.
+ * Objtool gets confused by the cfi register state; this doesn't match
+ * initial_func_cfi because of PUSH_REGS, where it tracks where those
+ * registers are on the stack.
+ *
+ * Forcefully make it forget this before returning.
*/
- UNWIND_HINT_RESTORE
- pop %rbp
+ UNWIND_HINT_FUNC
RET

SYM_FUNC_END(asm_fred_entry_from_kvm)


Return-Path: <linux-kernel+bounces-675627-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EA16141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:51:21 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 367B31791D8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:51:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3217928750A;
Fri, 6 Jun 2025 10:51:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fovZhgN+"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14])
(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 EA08C2853E5;
Fri, 6 Jun 2025 10:51:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207073; cv=none; b=B6sSJgi3tMDO8TT13xVHjyJPNIqzNGcyjC7epVRX32R2PYTNPIPBOsbfzDGD43k5p//B4+4CI4tEontthkkLAqy5YuKyGd9rmx++LvTDh1rLYJ/bSkLNjel3VCLBEoJs3mqAphikO+7X1RpNSYlr0Q8yYu8ssSevHgYSZQVA3dM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207073; c=relaxed/simple;
bh=CNPz/yyP5cutCEBAybS+Lck8HSInfMDQx2oYa9/K/kQ=;
h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:MIME-Version; b=CqXF6QKFS7GTIyOE3eAAKWLzkJ+KuLvZomcYQVbxzxQOv1yzsYbRtyYQ93qljSpt77IFit5uiy6TETwXQk2K87EKrOviq1YgL/oh4a0iUWyyuKi9d4HuM0YG2JnKXFZ1GZEHmo2hjVFJ5UlFm3ZI62Jtl13rleM/r9u5hQTF2dU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fovZhgN+; arc=none smtp.client-ip=198.175.65.14
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749207072; x=1780743072;
h=message-id:subject:from:to:cc:date:in-reply-to:
references:content-transfer-encoding:mime-version;
bh=CNPz/yyP5cutCEBAybS+Lck8HSInfMDQx2oYa9/K/kQ=;
b=fovZhgN+SYdxPpiNelxNhvuvZRVlQR2CAENUtQOPcNwScxcoIPShdt0D
QWnqxoJIC1lrZQAgIxAgz3FA2tAESRiE2Spghg3Rz/vyJ8uzzcUNr/74I
VzKu0kPZ5KaB0vwoiTiIGsxY1n6TJbbDEUnJboO7piJ46HW2Z1YfpcsZ5
Qq+a+BsN5NPLDpNBrhDVBE2neFXDoqq92PcAPL0MI0hWViQWhGTABqQeQ
jtn0M4c54GZAkSvtMpJwCYhHozRi2HPoYFCdM0aP6NmLc3Z+Q84ynipI+
pgTAHyRKm2c4bd+hs/+21FAZAwDcDidumKq1ro1QkwCUy0rxOZ412LiSb
w==;
X-CSE-ConnectionGUID: X5ZtwcWSTe+9kXUx3Tfk5Q==
X-CSE-MsgGUID: GrRRXGuPR0ONh6W2OW3ArA==
X-IronPort-AV: E=McAfee;i="6800,10657,11455"; a="55161791"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="55161791"
Received: from orviesa008.jf.intel.com ([10.64.159.148])
by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 03:51:11 -0700
X-CSE-ConnectionGUID: s0+9KUBOScK0UWBrMAYDuw==
X-CSE-MsgGUID: rk/F+LbGRu+OjUNpF+gkaA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="146768243"
Received: from linux.intel.com ([10.54.29.200])
by orviesa008.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 03:51:11 -0700
Received: from [10.245.245.46] (abityuts-desk.ger.corp.intel.com [10.245.245.46])
by linux.intel.com (Postfix) with ESMTP id DBA2220B5736;
Fri, 6 Jun 2025 03:51:06 -0700 (PDT)
Message-ID: <96158539a213de089c792ff8f88ed5abb71a60e0.camel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH v1 0/5] x86/smp: Restore the elimination of
mwait_play_dead_cpuid_hint()
From: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>
To: "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>, x86 Maintainers
<x86@xxxxxxxxxx>, Linux PM <linux-pm@xxxxxxxxxxxxxxx>
Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, Peter
Zijlstra <peterz@xxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Dave
Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "Gautham R. Shenoy"
<gautham.shenoy@xxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov
<bp@xxxxxxxxx>, Linux ACPI <linux-acpi@xxxxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 13:51:05 +0300
In-Reply-To: <2226957.irdbgypaU6@xxxxxxxxxxxxx>
References: <2226957.irdbgypaU6@xxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.56.2 (3.56.2-1.fc42)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, 2025-06-05 at 17:03 +0200, Rafael J. Wysocki wrote:
> Hi Everyone,
>=20
> The purpose of this series is to reapply the code changes from commit
> 96040f7273e2 ("x86/smp: Eliminate mwait_play_dead_cpuid_hint()") that
> has been reverted because of an issue introduced by it. This takes
> place in the last patch ([5/5]) and the previous patches make
> preparatory changes needed to avoid breaking systems in the field
> once again.

Hello,

thanks Rafael for the patches, and Peter/Dave for helping handling the
issue.

Tested-by: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>

I measured a Granite Rapids Xeon with v6.15 vanilla [setup 1], then
with v6.15 + revert of 96040f7273e2 + these 5 patches [setup 2].

I can see that in setup 2 the average idle package power is 54% lower
than in setup 1. This is simply because in setup 1 there is no CC6 /
PC6. And this is because every core's sibling is in CC1, which blocks
CC6 on every core.

=3D=3D Reference =3D=3D

1. Small article explaining then naming I use (CC1, CC6, PC6):
https://github.com/intel/pepc/blob/main/docs/misc-cstate-namespaces.md

=3D=3D Non-essential details, just for reference =3D=3D

The measurement could have been done in a simpler way, but since I have
developed tools and have a good setup to measure workloads with my open
source tools, I did the following.

Used stats-collect: https://github.com/intel/stats-collect/

# Boot the vanilla kernel on system under test (SUT) named 'gnr2' (this
# is the host name). Then run the following command on my system, that
# has root SSH access to 'gnr2' configured.

stats-collect start --stats all -H gnr2 --reportid gnr2-idle-nosmt-
v6.15-vanilla -o raw/gnr2-idle-nosmt-v6.15-vanilla -- sleep 600

# The above SSHed to gnr2, ran workload "sleep 600", and collected a
# bunch of statistics, which were saved to
# raw/gnr2-idle-nosmt-v6.15-vanilla on my host.

# Boot the "setup 2" kernel, which I referred to as "6.15-fixed". Run
# the following command.

stats-collect start --stats all -H gnr2 --reportid gnr2-idle-nosmt-
v6.15-fixed -o raw/gnr2-idle-nosmt-v6.15-fixed -- sleep 600

# Then generate an HTML diff between those.
stats-collect report raw/gnr2-idle-nosmt-v6.15-vanilla/ raw/gnr2-idle-
nosmt-v6.15-fixed/ -o diff

# Open "diff" with a browser (I have my HTTP server, so just copied it
# to ~/public_html). Find lots of stats, in my case
# turbostat,=C2=A0interrupts, IPMI.

In the diff, I checked turbostat's PkgPwr (CPU chip power in Watts) and
turbostat's CPU%c6 (CC6 residency, %).

HTH,
Artem.


Return-Path: <linux-kernel+bounces-675628-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 677C441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:54:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9309C177FE5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:54:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 88F35287510;
Fri, 6 Jun 2025 10:53:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i4h2MCx5"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9A222874F4;
Fri, 6 Jun 2025 10:53:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207233; cv=none; b=WpiogMgIno6foNvxU1qYJuWyjW8n93hrjO7xy1C5oeHR4ci0usTCI8+d+8gMeTdSMsiAumpGwybt16vr1JSVpThwD1Z2M516fp7tfuI+pjh2uZkfKtZmLLuWCkH9wOU7NrL40qk+YGzqIrL7S5TnFAMSiuqt7gPvmKs+s74cJf4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207233; c=relaxed/simple;
bh=738c3+vImT5W5NH3YikTKpwWO0oPCcaLLmdjIR93WMo=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=b8agGEnEjQf1zSIcDvKMkKenJpd5w1V9DrXgfAxZ1Od+OF1HAWvLhVJeOt6shea32LcHoQSaLxGH07x/SyK/dxw4YIpr47lK8lf4FIxbGpFRa6T1jTuXzWl3hOH4R4foy9jma3fUC1v/p/NM1kl/f6BXA3YMjkRa/nSUYL8rwlo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i4h2MCx5; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25459C4CEF3;
Fri, 6 Jun 2025 10:53:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749207233;
bh=738c3+vImT5W5NH3YikTKpwWO0oPCcaLLmdjIR93WMo=;
h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
b=i4h2MCx5NcLDNuVki3C8cfL8XtTye+jT/KKI6h/C+wfLkLbgvhXqmki1tw82IXgfQ
DptdH61mgBY5KH4ZtcOkHMKZqTrR6ByePYowFP6ErceG3oCwA/74eleY6vOiCHDBWV
xuSXNtnkptleo1lHFlhtdDXPkDXXCzLvhMwTKBQhYupdM5qqYtbWdCZzieE5MTIzhE
Vu5QgLVqcg6m5Y7PIpezhlyEQ4gcqCf9nmtm2OdO8i/c8jy91t3xUGIqKxFrGjnOws
JJRYwTxgf8PX9U7A1TClsuoPdolaGt8TWe6SBwb5d9pjmEAZ02KBmCMulDKEs6zQDz
8W7IuLLX/0gag==
Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-2e95ab2704fso1277569fac.3;
Fri, 06 Jun 2025 03:53:53 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCUtXzNG3r36eoTUs3eAn1zsmPGhaRYVbU0QF7yZR0dqBlKooGrxwAXU2f2B/Y/0quOfKb5LP/R2CMs=@vger.kernel.org, AJvYcCWR3BVUdQ7rJFnPvGL8rUU4mh18yhaVwR4ORcTcACnQxVdAC9AeaJ+vyeF+1mrMPqnu4+esAlWW5iD3q3I9@xxxxxxxxxxxxxxx, AJvYcCXZxTzydbag9Gb75DTU/ftYza+vpOC6iSN8uxhFgPGC1e+0kckdqJB61QLIbRxwcueMNAfBAWo3E6OI@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzEcXivXgtzJp/pE91h7J8wb7XKKgDnabGGhHPtj+gKlYweSdg8
DHUG+7wn0CTTZCDdaEkatr5KNRH/y8Am3aX1RNFGB00LEs1HowvCsp/j/p1ZVPkE8f63NGFNUMi
RpIdECDpVVtVgRlhWfve8uPO05rcQryI=
X-Google-Smtp-Source: AGHT+IGu2KnqIBuspqTcRC6/ewpwhRR9+2NqR71IcpBIzA+8G4EfS5Sv0RC7ugVJ5inNZjfMcaCUQP9Zhy4XnwAUdWs=
X-Received: by 2002:a05:6808:398c:b0:406:7af5:30f2 with SMTP id
5614622812f47-409051434ffmr1923577b6e.34.1749207232407; Fri, 06 Jun 2025
03:53:52 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <2226957.irdbgypaU6@xxxxxxxxxxxxx> <96158539a213de089c792ff8f88ed5abb71a60e0.camel@xxxxxxxxxxxxxxx>
In-Reply-To: <96158539a213de089c792ff8f88ed5abb71a60e0.camel@xxxxxxxxxxxxxxx>
From: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:53:41 +0200
X-Gmail-Original-Message-ID: <CAJZ5v0jxyBNnW+3yOSg4XU3eJs6Wtnn_OvQZG2S=vfoygftrug@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFsxhm_gi3yDGG5Bsx_UpVGMtRT1JztjzICf6p0rLLjHW6sIxNr14Bl8AZc
Message-ID: <CAJZ5v0jxyBNnW+3yOSg4XU3eJs6Wtnn_OvQZG2S=vfoygftrug@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v1 0/5] x86/smp: Restore the elimination of mwait_play_dead_cpuid_hint()
To: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>
Cc: "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>, x86 Maintainers <x86@xxxxxxxxxx>,
Linux PM <linux-pm@xxxxxxxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>,
Len Brown <lenb@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>,
Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>,
"Gautham R. Shenoy" <gautham.shenoy@xxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>,
Borislav Petkov <bp@xxxxxxxxx>, Linux ACPI <linux-acpi@xxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 12:51=E2=80=AFPM Artem Bityutskiy
<artem.bityutskiy@xxxxxxxxxxxxxxx> wrote:
>
> On Thu, 2025-06-05 at 17:03 +0200, Rafael J. Wysocki wrote:
> > Hi Everyone,
> >
> > The purpose of this series is to reapply the code changes from commit
> > 96040f7273e2 ("x86/smp: Eliminate mwait_play_dead_cpuid_hint()") that
> > has been reverted because of an issue introduced by it. This takes
> > place in the last patch ([5/5]) and the previous patches make
> > preparatory changes needed to avoid breaking systems in the field
> > once again.
>
> Hello,
>
> thanks Rafael for the patches, and Peter/Dave for helping handling the
> issue.
>
> Tested-by: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>
>
> I measured a Granite Rapids Xeon with v6.15 vanilla [setup 1], then
> with v6.15 + revert of 96040f7273e2 + these 5 patches [setup 2].
>
> I can see that in setup 2 the average idle package power is 54% lower
> than in setup 1. This is simply because in setup 1 there is no CC6 /
> PC6. And this is because every core's sibling is in CC1, which blocks
> CC6 on every core.
>
> =3D=3D Reference =3D=3D
>
> 1. Small article explaining then naming I use (CC1, CC6, PC6):
> https://github.com/intel/pepc/blob/main/docs/misc-cstate-namespaces.md
>
> =3D=3D Non-essential details, just for reference =3D=3D
>
> The measurement could have been done in a simpler way, but since I have
> developed tools and have a good setup to measure workloads with my open
> source tools, I did the following.
>
> Used stats-collect: https://github.com/intel/stats-collect/
>
> # Boot the vanilla kernel on system under test (SUT) named 'gnr2' (this
> # is the host name). Then run the following command on my system, that
> # has root SSH access to 'gnr2' configured.
>
> stats-collect start --stats all -H gnr2 --reportid gnr2-idle-nosmt-
> v6.15-vanilla -o raw/gnr2-idle-nosmt-v6.15-vanilla -- sleep 600
>
> # The above SSHed to gnr2, ran workload "sleep 600", and collected a
> # bunch of statistics, which were saved to
> # raw/gnr2-idle-nosmt-v6.15-vanilla on my host.
>
> # Boot the "setup 2" kernel, which I referred to as "6.15-fixed". Run
> # the following command.
>
> stats-collect start --stats all -H gnr2 --reportid gnr2-idle-nosmt-
> v6.15-fixed -o raw/gnr2-idle-nosmt-v6.15-fixed -- sleep 600
>
> # Then generate an HTML diff between those.
> stats-collect report raw/gnr2-idle-nosmt-v6.15-vanilla/ raw/gnr2-idle-
> nosmt-v6.15-fixed/ -o diff
>
> # Open "diff" with a browser (I have my HTTP server, so just copied it
> # to ~/public_html). Find lots of stats, in my case
> # turbostat, interrupts, IPMI.
>
> In the diff, I checked turbostat's PkgPwr (CPU chip power in Watts) and
> turbostat's CPU%c6 (CC6 residency, %).
>
> HTH,

Yes, it does, thanks a lot!


Return-Path: <linux-kernel+bounces-675629-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B9EE241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:54:26 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 74DDF3B1372
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:54:04 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AAE8B28750B;
Fri, 6 Jun 2025 10:54:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="RUk9OlUj";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="Kq531umt";
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="RUk9OlUj";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="Kq531umt"
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31BEF2874FD
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:54:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207260; cv=none; b=u4F5B74aMEY+RFjx8Z/GybnMA9HiCydcifEIyMpjKJ5GBy6/XDaIRE4T6aDCo77cFj9glt+uFeODu9uxY0sxUL5q3RcJ5HZ10LzafP9Ja7t1l3m5OL34+1Rxft30oXXV2WbZ1KP65zrS5WLOAXIfMsT11Omx4Z1n/cFDijqHne4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207260; c=relaxed/simple;
bh=yLMp0stnknfWTQ9MudqOyXhSE5L6h8zVutcH0wb97p8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=iz3GYIuofsdULkxcK67/kZvW97alTfI9UCYHiDWInyfkDOf2dbuzCkGvXs5p3tqjdJ5kb4C2drIECAcmL+4Q6zYlcnvHtsGB31PGrfckkZ9umysks0L4f4s5ISMck2YzPjTLbxMA82sSLripHRkx1DWNZhvTlTZdsOWJGosHw8I=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=RUk9OlUj; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=Kq531umt; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=RUk9OlUj; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=Kq531umt; arc=none smtp.client-ip=195.135.223.130
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz
Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by smtp-out1.suse.de (Postfix) with ESMTPS id 295253368A;
Fri, 6 Jun 2025 10:54:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749207256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=Ew054TM1gF94MAbHnxCooxRjNeN0J3AbhNTO/vAqYtY=;
b=RUk9OlUjGhBWX6JlHVAinvcmdfRjfzEs0gvYQnobgiLNSOwg0A1bA4tdt9sqddXseX3vMc
IuDzdSl9rrjPMpN/FFkOIAvByfjrxzaeO3zTwiO1d7Kdg+FRzHojxYpLdbNb9YpREbpPqF
sBBSTefAiNoecfIjoKkeR/nRP76QFcM=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749207256;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=Ew054TM1gF94MAbHnxCooxRjNeN0J3AbhNTO/vAqYtY=;
b=Kq531umtRfvG15Tgw9dKgXh391N5q5/XoVjdg9QK6q5jknYp4YF01Yu/aEUHnruwmdjL2T
r4l0vK71/NIKfODA==
Authentication-Results: smtp-out1.suse.de;
none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749207256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=Ew054TM1gF94MAbHnxCooxRjNeN0J3AbhNTO/vAqYtY=;
b=RUk9OlUjGhBWX6JlHVAinvcmdfRjfzEs0gvYQnobgiLNSOwg0A1bA4tdt9sqddXseX3vMc
IuDzdSl9rrjPMpN/FFkOIAvByfjrxzaeO3zTwiO1d7Kdg+FRzHojxYpLdbNb9YpREbpPqF
sBBSTefAiNoecfIjoKkeR/nRP76QFcM=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749207256;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=Ew054TM1gF94MAbHnxCooxRjNeN0J3AbhNTO/vAqYtY=;
b=Kq531umtRfvG15Tgw9dKgXh391N5q5/XoVjdg9QK6q5jknYp4YF01Yu/aEUHnruwmdjL2T
r4l0vK71/NIKfODA==
Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1ED5E1369F;
Fri, 6 Jun 2025 10:54:16 +0000 (UTC)
Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
by imap1.dmz-prg2.suse.org with ESMTPSA
id CsJ/B9jIQmh8OQAAD6G6ig
(envelope-from <jack@xxxxxxx>); Fri, 06 Jun 2025 10:54:16 +0000
Received: by quack3.suse.cz (Postfix, from userid 1000)
id D02D0A0951; Fri, 6 Jun 2025 12:54:15 +0200 (CEST)
Date: Fri, 6 Jun 2025 12:54:15 +0200
From: Jan Kara <jack@xxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>, Chi Zhiling <chizhiling@xxxxxxx>,
willy@xxxxxxxxxxxxx, josef@xxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Chi Zhiling <chizhiling@xxxxxxxxxx>
Subject: Re: [PATCH] readahead: fix return value of page_cache_next_miss()
when no hole is found
Message-ID: <i2zcz37av7oon464vj4jqvmyz53j46kpd6427xmpamukcqekro@hg566sdiruba>
References: <20250605054935.2323451-1-chizhiling@xxxxxxx>
<qbuhdfdvbyida5y7g34o4rf5s5ntx462ffy3wso3pb5f3t4pev@3hqnswkp7of6>
<20250605145152.9ae3edb99f29ef46b30096e4@xxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250605145152.9ae3edb99f29ef46b30096e4@xxxxxxxxxxxxxxxxxxxx>
X-Spam-Score: -3.80
X-Spamd-Result: default: False [-3.80 / 50.00];
BAYES_HAM(-3.00)[99.99%];
NEURAL_HAM_LONG(-1.00)[-1.000];
MID_RHS_NOT_FQDN(0.50)[];
NEURAL_HAM_SHORT(-0.20)[-1.000];
MIME_GOOD(-0.10)[text/plain];
RCVD_VIA_SMTP_AUTH(0.00)[];
ARC_NA(0.00)[];
MISSING_XM_UA(0.00)[];
RCPT_COUNT_SEVEN(0.00)[9];
MIME_TRACE(0.00)[0:+];
RCVD_COUNT_THREE(0.00)[3];
FREEMAIL_ENVRCPT(0.00)[163.com];
DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];
FROM_HAS_DN(0.00)[];
FREEMAIL_CC(0.00)[suse.cz,163.com,infradead.org,toxicpanda.com,vger.kernel.org,kvack.org,kylinos.cn];
TO_DN_SOME(0.00)[];
FROM_EQ_ENVFROM(0.00)[];
RCVD_TLS_LAST(0.00)[];
TO_MATCH_ENVRCPT_ALL(0.00)[];
FUZZY_BLOCKED(0.00)[rspamd.com];
DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,imap1.dmz-prg2.suse.org:helo,suse.com:email]
X-Spam-Level:
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu 05-06-25 14:51:52, Andrew Morton wrote:
> On Thu, 5 Jun 2025 10:22:23 +0200 Jan Kara <jack@xxxxxxx> wrote:
>
> > On Thu 05-06-25 13:49:35, Chi Zhiling wrote:
> > > From: Chi Zhiling <chizhiling@xxxxxxxxxx>
> > >
> > > max_scan in page_cache_next_miss always decreases to zero when no hole
> > > is found, causing the return value to be index + 0.
> > >
> > > Fix this by preserving the max_scan value throughout the loop.
> > >
> > > Fixes: 901a269ff3d5 ("filemap: fix page_cache_next_miss() when no hole found")
> > > Signed-off-by: Chi Zhiling <chizhiling@xxxxxxxxxx>
> >
> > Indeed. Thanks for catching this. Don't know how I missed that. Feel free
> > to add:
> >
> > Reviewed-by: Jan Kara <jack@xxxxxxx>
> >
>
> Thanks. It's a simple patch - do we expect it to have significant
> runtime effects?

I'm not sure if Chi Zhiling observed some practical effects. From what I
know and have seen in the past, wrong responses from page_cache_next_miss()
can lead to readahead window reduction and thus reduced read speeds.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR


Return-Path: <linux-kernel+bounces-675630-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9E7B541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:54:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id D83391784F8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:54:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DA02418641;
Fri, 6 Jun 2025 10:54:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="paXE95nz"
Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12olkn2022.outbound.protection.outlook.com [40.92.23.22])
(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 65F7428750B;
Fri, 6 Jun 2025 10:54:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.23.22
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207278; cv=fail; b=DCqXCwXWwwxNRnSjgq1EHk4+35gywfuazFq8yTpxOgSK3/Whz4dqrA/s4DYhQ0s2/sZOugvG8Rli34DYLx6NUClS4nFw7QyVM6ualc4n4ltcqFX+0Ap1TtqIBjdXitmbogKNU3fTjCe/9UdFE1Ta1//UxcrN5N3ebh1WHMZDAWM=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207278; c=relaxed/simple;
bh=MU8NYn/GpsZda5e5ecPGNZgeP3GaB45iwUZmhYvHc7A=;
h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To:
Content-Type:MIME-Version; b=guqcw/OKthQIFKN0SoegjehkSYnMD2rztoEFz7+1Vw91NMTXtkMaj/xdd4sfCfUMG4VWFgUQyWnz4pYj7X6Ml9JOqgRJDEeSJqMCd7rcRglhshEnhbNAPqySvEc1NDYLzFhS+QrwP2FdOeWmgZUq8ltPnNO3C/fhNV5Kh9HPVzY=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=paXE95nz; arc=fail smtp.client-ip=40.92.23.22
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=YUvhheWTGHL8dY6QXMcxaDwvR1R158mvR7p9PaY6hrg5seN68UqgdRUxEn/o0psIixJzrerTohgw8Hk/3mlAkYz+f+d+wytsj3TTJkKPMrqK01Iyf6GAIpeduMecYE3kcpcdLo4cLxST+6yV3CQO29imllLY6FGQ1R8X+hvJGs++/jCADqbe+uqEpEwXmMdGFWal27m9p/b1L55ZDXxeEFAiIRrEJkyONc9T7PAJVi//dpSLuNOojjRVy6RwsYLQnYxdiYMybdKNxezWW5MXAPoKjVOIpE5i2vATbvOSn0jDzmv1pkzveOiqJuYmXYr28lsGnJA3mjQCoC4EmDQ8sg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=PRLGs0voHx+1nwpknaC2ZTPXb7zfIeE9oZFGT+qyFa4=;
b=i7yEybwWbwCvWdmdUj/aZeto5Nq7C2ouGROtmFuXYg4As/UYfYtJ29FKxBzQD1MWMhZAJFwO9YcRjpME7CkT8uLtcgCEe69ggC6tsRght8vegF6PEhfSpfIuwa6j2rZHivZaPlksTaRL/8h27qssBAUj5W3OhVAr7B397hzinqNeV3Lux9Rt0GXn1CiiIVldc5nFn/qK6VrjRgkNgBAfYORayV9AwwcTkYw0JpylIB3Rq0vnzWjzKXFpbwFISH+eZTmNTcI1SRzTw7TrqRu/W8ostymyPZNvot+mnWIX2VJcqbzoemibIpIpSbXM/rnlPtFKcADIU/tePjdbQkgGGQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=PRLGs0voHx+1nwpknaC2ZTPXb7zfIeE9oZFGT+qyFa4=;
b=paXE95nz2FpJ0wO8qFlyd4G4xqnXnAlwkhsm18pcYU2LYZSwP8BOoEH5/sRT8l7+3dW0DQaJWMZPwxrIoE/+VlX6GojQgA+cRUOfyoqIZgP8Nb/DTW1an8UdGxXgX+n7DMWetYMM8reu3qAOsX8tdyErFCXg4yHYXazcxDTUzIwNl2Q8TrBYiKte4wiYM5fgdM44L+Ct+jN0e+rOShgVlAEE78oVZ/DddOTZmT8oQiDsfkOOsj2uFu/tRv/zWQmX3joiD1Yv2bsiGjhoqt50m11btNzH60+VwOR/WThwfp44JwuC9Io6Xutate9eHSvPQQZ8HQjZ3tMRaNiXijgJYA==
Received: from DS7PR19MB8883.namprd19.prod.outlook.com (2603:10b6:8:253::16)
by PH3PPFD994488F9.namprd19.prod.outlook.com (2603:10b6:518:1::c55) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8722.25; Fri, 6 Jun
2025 10:54:32 +0000
Received: from DS7PR19MB8883.namprd19.prod.outlook.com
([fe80::e0c2:5b31:534:4305]) by DS7PR19MB8883.namprd19.prod.outlook.com
([fe80::e0c2:5b31:534:4305%5]) with mapi id 15.20.8769.037; Fri, 6 Jun 2025
10:54:32 +0000
Message-ID:
<DS7PR19MB8883E074E64AC6FCAB1B1DE69D6EA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:54:21 +0400
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v3 2/5] dt-bindings: net: qca,ar803x: Add IPQ5018 Internal
GE PHY support
To: Rob Herring <robh@xxxxxxxxxx>
Cc: Andrew Lunn <andrew@xxxxxxx>, Heiner Kallweit <hkallweit1@xxxxxxxxx>,
Russell King <linux@xxxxxxxxxxxxxxx>, "David S. Miller"
<davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley
<conor+dt@xxxxxxxxxx>, Florian Fainelli <f.fainelli@xxxxxxxxx>,
Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>,
Michael Turquette <mturquette@xxxxxxxxxxxx>, Stephen Boyd
<sboyd@xxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
linux-clk@xxxxxxxxxxxxxxx
References: <20250602-ipq5018-ge-phy-v3-0-421337a031b2@xxxxxxxxxxx>
<20250602-ipq5018-ge-phy-v3-2-421337a031b2@xxxxxxxxxxx>
<20250605181453.GA2946252-robh@xxxxxxxxxx>
Content-Language: en-US
From: George Moussalem <george.moussalem@xxxxxxxxxxx>
In-Reply-To: <20250605181453.GA2946252-robh@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: DX0P273CA0087.AREP273.PROD.OUTLOOK.COM
(2603:1086:300:5d::9) To DS7PR19MB8883.namprd19.prod.outlook.com
(2603:10b6:8:253::16)
X-Microsoft-Original-Message-ID:
<a8e2be4a-fc8e-4994-8a1d-8c953a4e4719@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS7PR19MB8883:EE_|PH3PPFD994488F9:EE_
X-MS-Office365-Filtering-Correlation-Id: 30808b18-78aa-4f69-b629-08dda4e88423
X-MS-Exchange-SLBlob-MailProps:
znQPCv1HvwXa8TE59u1HHfDiiKEdRlKNQ9dU3DBoTaNCOe2vZI4l4hYoI3vFEnKhlcFJO9maSP4RtgKS0TakH6sQjOrhkqSooPfBlriR4unA1k2a17y4MzJiFO/YmM6a9xEedSfYjiUGc/zWUkvBE75lFuWWlXdXYlV/CZpWJgrGva/bNWzXBN9FQ8Lzl1QIzZTv/TDnNHNH3k6fDRr+XePF1yVoaEpdHYKy6Yj1Q3AN7sNQHlaMgYmjqXqXRZG6g73VDWx5P04CVB8iq81MyHzmJ0JHOf+dTkafDjMAx2ov+XisrcaGEKXw2SG7EumZeYJrwJMcz2mNKVZkbnQh/eLpglJtda3ZjpvznlbzjlWeYPRoWd/8sO/f1Z9uXf48O+LIAzl90FyqamWSbi1A+XkR3ck8O2txSao5DgdbYoaCqv/NvKdzVkWATXX0mg6CwhSM7sBGHNB/qssvfH3JUK2JS5iwzinYdHUR8zLHBq3lDqQN6m57Js/dkMQvz7cjbCI/pK98yaaJw0t0gMqmjFHRHFdb9C6vbFsxBE4NX69DJaYgv9GdSKU8xO3iEzF1TzA1KP7cPVf0foG4xcgd/R5xZHJVfpfIhCe6n5/IWv9Vh9j8n981JEozwNLY7YFWkoYtoWtgBgGmyRWAnHhrOrjSWOW1/xzArHPtYDin7NQoS9wwnvFd6l6RyOFqEeWAKC2dgWCYaQsySv6YdKPDp9EjhqHp3bO3Z/31pWUxrzpgTQGvdbQZM5J7XDt/0hn0s4hPyNUMl44=
X-Microsoft-Antispam:
BCL:0;ARA:14566002|6090799003|8060799009|7092599006|15080799009|19110799006|41001999006|5072599009|461199028|3412199025|440099028;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?Rk0yRkREU2lSYVhkTUZObHdUdTM0SUlKV3hBcE1xTFVGbERMeGk3Nmo1RFdT?=
=?utf-8?B?NVd4d2UzUlIzUXN1TGdObXY1dHp3eENWOEZyZjdpUVRNUTFaaEZIU05uSlVB?=
=?utf-8?B?YmhCRVNNclR5b2ZFWjE3dnFqSis1SG55NTYrTXl3ZWQ3Ym9VeTFiYWJvTk9J?=
=?utf-8?B?YXlIQWU1ZTd1L1FLNjByaXpNUjcvdmxRMHpSM1pSOFhEN0hhQjRydFBwMGpV?=
=?utf-8?B?Q0pMS2w4L0I5VG12SFAvVmpJOUxHQmhQS0YxVFVDbXBLd0RMeXVqYW54OStr?=
=?utf-8?B?TWdZd3B1bVpqcjh0SFV0ZkduTytWbzlIVTY2NHNUVjkzN1g2dE1nMzBjdjkw?=
=?utf-8?B?eHBYcWxPczFCamYrWDVGeVM5UEVKWEtaSFZ5a1VEM2ZLS0JrSjFzbjBTbVVm?=
=?utf-8?B?WWFXOU1MRlNLWURsQ0lERng0aUFtUWhDMS9qNUJRWUpZSHFTNHEwYW9sMlhB?=
=?utf-8?B?RVY0NTlKOFZJR3A4Zi9JQ3FOUXhYclRsODJocVZSeUo5dkcwbURDYTk0dHlR?=
=?utf-8?B?N00zMTh5dUV3ZUlOMTdTQk5OQ1VrMnZxRGlEQ2dTb3dwS0VPYUVueEZMdkpJ?=
=?utf-8?B?M0lJNjZ4NGJyS0ZXY005R3M0bTNMdkRSWmhMTzh4Rzl1OHZ1MHBJMmtURU5i?=
=?utf-8?B?c3NnY1RkbWxIb1dlMlp6TW1GZE5zalZRZVliUGZKMTBOcjNEdG1UbkZoQ3VY?=
=?utf-8?B?aTFqN0ExVkRjZWNteDY0ZG8rV0R3eGJ1UXNYM3l6QllkQ3UzTEhtdFpNalFz?=
=?utf-8?B?cjErRGJNcFR0cTlGQTBiVitBZU96NFd4K0NIeGJLcnJUQW1ncmVycmlWcTNW?=
=?utf-8?B?TnppUVNtaEVoandKWmlmSjJMdUpDWkp1eXI0bmJXTzlIRXNwNVRXNC9SQjRh?=
=?utf-8?B?YTVxb05zRVFzNHYxclBXcUw0UG43ai9VOTY3VG9GMHFvM1VQaEZNKzVQdTY3?=
=?utf-8?B?eEg3L1duL1IyY0M0RFZvMzVnb0p6MXJ1N1BzRzhyMjhxTGY0NzJZZUFZMG5q?=
=?utf-8?B?TDVwQTlERmJ5S3VueFRHdjBRMVI2b1AxVm5wdFl4eVN1K2lxZ1NBcjRUdkhv?=
=?utf-8?B?MCt2YUFiY2ltWUJCSFNkejRTN0pUT1NOdTU5MmNSNkFHVFg5eDN0bmwyeGNz?=
=?utf-8?B?V0ZzVHhhY2phNTlJVUdTNlQ4QXJUbE41c3poRjRzVmpidGZXZ2RNc3oxdWFW?=
=?utf-8?B?OGFzZ3psVmZuYTBETStWdDl4SXRzb1p3YmJiZEdDbTY3MzBUZGphdHlaQWJW?=
=?utf-8?B?NWZJa29jY0QxOEc5M0hBQmlZMVQwamt3dURpQ2lQTzdXQ3ZhTlErSVVLS3ZP?=
=?utf-8?B?L29UMzBmbWlvZW5Ra2hOdDRxY3NQU29KaXpmQ1hEWFVYYVJBRnVva25CZHNz?=
=?utf-8?B?bU1uMzlpL3pwNjF0dHNKYTNoSGpuVFZFVnpXck1GMnhva2JSalJCL1pucVc1?=
=?utf-8?B?eUFtSmIxdXVQWHVzcE83NVE3V3JZSkp5TVdMaXNDRElNMTJpUzJYVEFqYkNs?=
=?utf-8?B?bkdoTk1iamtqRzBkN3lqckNSZVhBWmg5cWhTUkNmUkRBV0MyWFZ2ZzRSN0Jl?=
=?utf-8?Q?h0ulutgubNkLb3U2yBG0iAEpI=3D?=
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?bzlKZ0JCaXphOXo4REk5d0hjcmdkWnhLaThOU2FlWElaZkVuWCtPOFpKazZ6?=
=?utf-8?B?OTBLdzUwdEhFb2pBL3hyMTljL0VIaTVkUWp2aVlWYVdKUDk3UTN6aThvTTNp?=
=?utf-8?B?eFBVcm55RGdzbFBCb0FZalp5RHZlVXRWR1BXY25zZExjTWhHMUNwVklOV3pZ?=
=?utf-8?B?TEcvL2FNanE2aVBVSzhoclhtUzNiZXBtTHJaVVZYWmpQNFFMYzlMYU1GR0Z2?=
=?utf-8?B?SVlnODNROTd3ZWtHaWMrZERMaTF2d1MrLzZ0MXVsYy8rU3hsMmdhMzVvM3Z6?=
=?utf-8?B?cStreGN5VDRJVEF4eEhsT3hvVStYVDFpdFBPcUFOOEt4ZlY4Y1lxcnk2UXhJ?=
=?utf-8?B?WVFJZ3lTb2pLMmJVZVgyMnNNTEZkOTVyeHRoMU4xS3U5cUVFVmdvMFZIWUR1?=
=?utf-8?B?MDBkWDNLdzNOdllmSnhxaVlnMjFFcTUrbG9DZmhJdlhQZERzclpaR002MUdQ?=
=?utf-8?B?TjFvQ1lROTFlZ25sa3JxY2tuSUtNWWJGMzdINGFzbGtWUUlETGk5bU9zNW1j?=
=?utf-8?B?VysxMXZRSVZHRFkzNWxZdmNzSzhpR3hjYnZ3cUtTY3ZZYWF0ZVhsWVJlU1JO?=
=?utf-8?B?ZXorSmk1S1BQK2dYclNGeFlQMEtWdWJQeG9mSENFeFkvZ2lBL2dCWUpCT1R2?=
=?utf-8?B?S1prK2hsUHlJcGdVWjltS3NTbTRLVkZmeWVlY1RZSGFENkJBaDlteVlXU1dK?=
=?utf-8?B?TTA4TkNlaFFyQjE0bWVueStHQkdDamZYNXgxcnFQZDlvRldGQUc0Nml2K3lr?=
=?utf-8?B?RTg1bFJKaHlzYzN1RGU0OGUxdG5vTUMxZE8xTDg0NThuc3licUF0QURGMG96?=
=?utf-8?B?dGdCSmxxdkF4VklmRkloZ3Z0U0txZkNSZWxxUE5QakxiNG1IaUpsbk1zQkE1?=
=?utf-8?B?RjBOdmQ1QWFvbVc2dGFGYkJjU2RFbTNLb3pvcmgraFFhSjd6SE51MzZyWHZ5?=
=?utf-8?B?VTl1U2haWjVWRzM3NnpwWWxlbmF3SGJyK05hQXE1WU5NT0ZUQjJkMUUzYk5l?=
=?utf-8?B?eEgvaGtNSW5EUTExZnNjVkwxSFlRNnFXSFA2d01GV3h0aHN3bzhaZitSMjRl?=
=?utf-8?B?RHUwaGlDbGtCbi9RcVpkZVZteEtvYTFzWlB4TUVkNjJqUUpRYThtUkc2Ky9T?=
=?utf-8?B?a3dVVFNqMFhoU2VjeUdneWc2NUQ2cmtJWEtXeStNNW51LzFZcHAyeS9yTFhl?=
=?utf-8?B?ODJzWU1OMlNCL0NFb0o4aXVQamt1NEtVUXFVdjh2b0VqWlR2WktocjY3RnJ6?=
=?utf-8?B?WGFqc0l2K2dkWmZEaDBzTm1ocy83bXg4Vlp4ck9DajRIbWFRVUhrTThWNFRE?=
=?utf-8?B?NVdVN3VzOUMwK3RPbGNxK1dEUmxsZld5ejUwR0dvYTdSbmo0K2lCVElNS1V3?=
=?utf-8?B?MC8rbnZXVFYwRWpZMFF1YndvZ1g0SUwwcEhVSjBvQkpzYTB6clJxTEZ3bTQ5?=
=?utf-8?B?Mjg1OGFRd1lYZ3ZQaXdpUG9NMEZVZEI3ZlcvVHdMNmNkNXFVbWVvTVNVVFlQ?=
=?utf-8?B?bEIwVnVMSm1XTkpJdGVEeFpERk9YMDVoTWZBNkZMSjZXRnQyZDlncmZoZGFM?=
=?utf-8?B?Y1ViNzZHSytCQWhnOWpiUzFnakNKaXJTMFFEaGNWSVZKWU51Umd4NThxYXdY?=
=?utf-8?B?ZjBoVEczZENlT0V0aE1VT1p1YWNWNWRyd2x3WjZpekRtV3phcW9jRDlZY2FV?=
=?utf-8?Q?M33nkWO8tC1WPFRub7o7?=
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 30808b18-78aa-4f69-b629-08dda4e88423
X-MS-Exchange-CrossTenant-AuthSource: DS7PR19MB8883.namprd19.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:54:32.3201
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg:
00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH3PPFD994488F9
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Rob,

On 6/5/25 22:14, Rob Herring wrote:
> On Mon, Jun 02, 2025 at 01:53:14PM +0400, George Moussalem wrote:
>> Document the IPQ5018 Internal Gigabit Ethernet PHY found in the IPQ5018
>> SoC. Its output pins provide an MDI interface to either an external
>> switch in a PHY to PHY link scenario or is directly attached to an RJ45
>> connector.
>>
>> The PHY supports 10/100/1000 mbps link modes, CDT, auto-negotiation and
>> 802.3az EEE.
>>
>> For operation, the LDO controller found in the IPQ5018 SoC for which
>> there is provision in the mdio-4019 driver.
>>
>> Two common archictures across IPQ5018 boards are:
>> 1. IPQ5018 PHY --> MDI --> RJ45 connector
>> 2. IPQ5018 PHY --> MDI --> External PHY
>> In a phy to phy architecture, the DAC needs to be configured to
>> accommodate for the short cable length. As such, add an optional boolean
>> property so the driver sets preset DAC register values accordingly.
>>
>> Signed-off-by: George Moussalem <george.moussalem@xxxxxxxxxxx>
>> ---
>> .../devicetree/bindings/net/qca,ar803x.yaml | 39 ++++++++++++++++++++++
>> 1 file changed, 39 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/net/qca,ar803x.yaml b/Documentation/devicetree/bindings/net/qca,ar803x.yaml
>> index 3acd09f0da863137f8a05e435a1fd28a536c2acd..fce167412896edbf49371129e3e7e87312eee051 100644
>> --- a/Documentation/devicetree/bindings/net/qca,ar803x.yaml
>> +++ b/Documentation/devicetree/bindings/net/qca,ar803x.yaml
>> @@ -16,8 +16,32 @@ description: |
>>
>> allOf:
>> - $ref: ethernet-phy.yaml#
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + enum:
>> + - ethernet-phy-id004d.d0c0
>> +
>> + then:
>> + properties:
>> + reg:
>> + const: 7 # This PHY is always at MDIO address 7 in the IPQ5018 SoC
>
> blank line

added newline

>
>> + resets:
>> + items:
>> + - description:
>> + GE PHY MISC reset which triggers a reset across MDC, DSP, RX, and TX lines.
>
> blank line

added newline
>
>> + qcom,dac-preset-short-cable:
>> + description:
>> + Set if this phy is connected to another phy to adjust the values for
>> + MDAC and EDAC to adjust amplitude, bias current settings, and error
>> + detection and correction algorithm to accommodate for short cable length.
>> + If not set, it is assumed the MDI output pins of this PHY are directly
>> + connected to an RJ45 connector and default DAC values will be used.
>> + type: boolean
>>
>> properties:
>> +
>
> Drop

removed

>
> But this schema is broken. There's no way for it to be applied to a node
> because there is no compatible defined in this schema nor a 'select'.
> You can introduce an error and see (e.g. 'qcom,dac-preset-short-cable =
> "foo";'). Really, any phy using these properties should have a specific
> compatible defined here.

added PHY ID as compatible in v4 which I'll send out once the merge
window reopens.

Under 'properties' node:
compatible:
enum:
- ethernet-phy-id004d.d0c0

Q: do I need to add the PHY IDs of all PHYs that the qca803x driver
covers or will this one suffice?

>
>> qca,clk-out-frequency:
>> description: Clock output frequency in Hertz.
>> $ref: /schemas/types.yaml#/definitions/uint32
>> @@ -132,3 +156,18 @@ examples:
>> };
>> };
>> };
>> + - |
>> + #include <dt-bindings/reset/qcom,gcc-ipq5018.h>
>> +
>> + mdio {
>> + #address-cells = <1>;
>> + #size-cells = <0>;
>> +
>> + /* add alias to set qcom,dac-preset-short-cable on boards that need it */
>> + ge_phy: ethernet-phy@7 {
>> + compatible = "ethernet-phy-id004d.d0c0";
>> + reg = <7>;
>> +
>> + resets = <&gcc GCC_GEPHY_MISC_ARES>;
>> + };
>> + };
>>
>> --
>> 2.49.0
>>
>

Best regards,
George



Return-Path: <linux-kernel+bounces-675631-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C25DF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:56:40 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 1DA321895B77
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:56:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E89B1287500;
Fri, 6 Jun 2025 10:56:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Mc66iQmz";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="RivRvI3W"
Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32])
(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 D2CA618641
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:56:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207392; cv=fail; b=LWSBWdYWatZHGpVY9gdmCuncqpFsARllYrDWmGJnMEgjm7ut0g1UBDXvpysLJ1hIG+DhCaXkA/nx5vHzq9ugQiT/iUmWZA4fefQUbX9Yw6njbmEj5G0MxEaUKG6dPNEFJzMh/BONgm4DTTKaRyZFBwYGEVhITOf0cOiRhwIwCUU=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207392; c=relaxed/simple;
bh=E/RoQsjsYEfU4yair/UB3wCJP96Vxo08TlvxpCIO66Q=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=jOiLPChPlAceUspbp/Iek+g+/7JRC9zd4U55uNXXzcDwRyyK6vni4mc/6mmqAWM4S00DRrSc6zU5lqzOMwr78n07CYSpIepwf1gGbujKsCzUj4ddAC4PgiBsp0h91bCNr0wE2Maa4Q49ZL8Z39rUT3XxvE4wi6/QIRPGoMqWM0o=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Mc66iQmz; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=RivRvI3W; arc=fail smtp.client-ip=205.220.165.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246629.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NBZu011359;
Fri, 6 Jun 2025 10:56:11 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=qmsuIrP6RmfAvhFlnk
T2Jxf53v/4ss/tcndX5+eerGw=; b=Mc66iQmzOUiFrIzBxQshFmknOhltCC3sMb
dx1uUdfRl+A6jdaQGkT17F781NwZIXCUDbb8FEJYtQAlJA+wjPUDifykRoUBqhjW
FgPDjFfzAYOZnVfNaIHj5iABvwiv0Kob1q96lYrBIyvjADubnU75f7z4wrCgHxmX
F3FNNgYKDZJYvEf/rJUQt1x+NisP4Sm5Z4qf1p/KRcgNuzqShKXTtF6QcZSPlOd3
iHmk4RagIzLkkdITWrgEEwpgnEh7EUOw8dE35bdQ9pLpzyXE11awLQfGweo9YWoJ
nYrDRUjPQVGTHssa7qLUEzDDMBjwGNjOtK7yfGNti7vGaNep1WQw==
Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gwhfmqa-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:56:10 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55691Xiu016444;
Fri, 6 Jun 2025 10:56:10 GMT
Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11on2047.outbound.protection.outlook.com [40.107.236.47])
by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7d5p3r-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 10:56:10 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=LSpieTB15s60NYDtWQHPTjtRdndWjuSZkbH99l9fDDbVeNUtraKL6usrzzVc3mguagk5Z5kzxhG1v8aZ+U9A8sEva4A/Def2deHoClZyf53vQGhzA66pSpsJy25qUMMbvFblXHgP1Tq7UEK3GWPR+wHX8g8LdZdqIacVXn8Z1m+Anhfwlaqc+RXYsau0BKbD1rP+jKe2Wp2dKJhkgy8Z3fO9nAaD1+uj84Q3jYTGKsW/IFYmXuUGab6mqYWHGWlKF91B4df8x8MYWqSjiaVAKzg1oF/pDNlUqsDbU+1hXli++FPYc5xCMev11e+9fbSYVmcR0dkYi1tMdsubXlhdCg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=qmsuIrP6RmfAvhFlnkT2Jxf53v/4ss/tcndX5+eerGw=;
b=pNpyKXXrS67V4bYJT9q0LhPaH/n8D6I7rM9HEfaBBUGcS0RmMcFjBxZBxF6BoR7eQE4fSoFjGG8I8v02fSNFkzwnE9ikA/CEmm73wakNs2QObOsdzcj2tI2OZb42HEQTr7jypyUW8KOwnOs4vUf5EnN9G+EiOhxV4yl3+uXU8M3n8kih+g6SYxsSyCJUe6A/TJfMOR1hAhaMua31gAvtk+j3friaFtNWKQGLNt8Mgn3uDh2Qdua/2y5+35ItoNS+HgZLxAqBOLW4+wF4pvfgvqZxXOpCEL9zSFfNOvQzO2aT/RUqlFXxhylFEVetezKZUp1aGPuWjLu5uEI60DkbyA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=qmsuIrP6RmfAvhFlnkT2Jxf53v/4ss/tcndX5+eerGw=;
b=RivRvI3WKBcTi9RSXUU/oeyzahf5BQV+uRH/Aumidc9IwSBGkxNoHD1UEcXyjXSGowBwEJ1ALEjb8vP9WgBssdk3YeHwe61WiCpC80GKhYcdWLmTggbZnMw4rWOi7MFOP1GqKL/KpwKmjp6pPqP03VFaPaW+XyAExevPq7CIZ5o=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by MN6PR10MB8095.namprd10.prod.outlook.com (2603:10b6:208:4ef::13) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 10:56:07 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
10:56:07 +0000
Date: Fri, 6 Jun 2025 11:56:04 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Dev Jain <dev.jain@xxxxxxx>
Cc: akpm@xxxxxxxxxxxxxxxxxxxx, david@xxxxxxxxxx, catalin.marinas@xxxxxxx,
will@xxxxxxxxxx, Liam.Howlett@xxxxxxxxxx, vbabka@xxxxxxx,
rppt@xxxxxxxxxx, surenb@xxxxxxxxxx, mhocko@xxxxxxxx,
linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
suzuki.poulose@xxxxxxx, steven.price@xxxxxxx, gshan@xxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/3] arm64: pageattr: Use walk_page_range_novma() to
change memory permissions
Message-ID: <d2ace2dc-0d1e-491c-b574-b1fcc65f9a88@lucifer.local>
References: <20250530090407.19237-1-dev.jain@xxxxxxx>
<20250530090407.19237-3-dev.jain@xxxxxxx>
<f528506e-b04d-4c80-93c3-93ba4ca385bd@lucifer.local>
<f6b203cc-de3e-45ac-b2e3-b2d9f8ae0c31@xxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <f6b203cc-de3e-45ac-b2e3-b2d9f8ae0c31@xxxxxxx>
X-ClientProxiedBy: LO4P123CA0655.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:316::9) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|MN6PR10MB8095:EE_
X-MS-Office365-Filtering-Correlation-Id: 6b911bcf-12e3-42fc-15c3-08dda4e8bd74
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?zlF2TN/aF2nhWsuwETJiugLU/KYG9BCcBKUMtQTcUUqU7RUaeuPwANx3dYhi?=
=?us-ascii?Q?B+NePvkGv1noe6ymQl0Amq8e+CT7RIw8FMhOyFnArqUEj9ETp1SdqMOeQ/eC?=
=?us-ascii?Q?T9+siO+5/VINTC0Ea0IVrWG1YfzWWlSTAMjI+HUnmVOHGx6mge/RV6QQboPe?=
=?us-ascii?Q?1CwhwHQiWjYH7zquw3TihBwwgNXHIgr3SRJdIsEPfOn5gDsJTeohPa0TAYcz?=
=?us-ascii?Q?sZ9giSD3+zEUEPmiGsm2a1Bu8fyVJx74pwEedOrYAE/KRaIOsYKz/TCcLh38?=
=?us-ascii?Q?MVnqLXozcdOxtuB/B8JBxN6No4mfBv0paXyoSvzK+ULPqSl07NFlzcZDb+G6?=
=?us-ascii?Q?2KSfHp1jeP7RYzAy7rGTckXfZ9TbnXgP2BDxb46z+sI4tUiz4ljuT9RX6xav?=
=?us-ascii?Q?/lF7z347cS/vNXO9njSEpZgwPZ313apSWETrO9BAr/7wtoe9a+L1CFQaBsX0?=
=?us-ascii?Q?eslEl8at7RzOv9jrdbj9jAhLK19u3E2XAQ9fkL9wtmb+ORGPaA+OQElxsQr5?=
=?us-ascii?Q?gM8RH6z3v3DK5jiJ9sutqE0KlxSaD0PZjMAfuu8lArmHZcjixfZswFmpVSJx?=
=?us-ascii?Q?Brpg0NwyvNek9RfdsO4a2IM8G8ROOn839qIvEFnpcGLDktZS1EBLofI/KBr5?=
=?us-ascii?Q?QcDZSqURl3QlOhU0ijBpr93Xynh1DPYJYul3+QDFCjyJCQgNVtC0E89JexwJ?=
=?us-ascii?Q?o4FSFm5+ZP8QUIXh1dDtSHsf1bjPc9zuEYyvXqug5LLiIwQO3JgR4sLUfjPM?=
=?us-ascii?Q?mnTWKAZNR6cnm+9MNl11QlbzNbEe+PNODlaJ43ZAaHWPLufW+39Fi4ToM7Ph?=
=?us-ascii?Q?wF4eRgI4EvwdEILfHbpF1awIlZc7Xel5KOFzU/s3ZMIiARYMDgvMNUfPLhms?=
=?us-ascii?Q?gmJlQMz4XD4MNB8jNwzR0Y3Y8FtvgQHe8BE+Q/lf/Ob3wvJiPf4HW4QK/ePu?=
=?us-ascii?Q?D7gybrSiCEZVm+3Y8q9TZLy7mWbt1XR+oQpQq7+kPiNgLYfhJHi+y70tpqf6?=
=?us-ascii?Q?wJYt+D/m25AMo74/2Gvtv7T49ZrfzE7dCI/EPg7NGHcEkOFiCl6ygujr78sA?=
=?us-ascii?Q?cTOKinmPQerowepz862nnPhqmZc85+CRPYewzrdrv657okkL+NyUR1fxBB/y?=
=?us-ascii?Q?vA4R6eBlX49wF0oGGRkscsVyRakEjhN1NrdlyX6bQ5vnDSNJs2MYflNNopg4?=
=?us-ascii?Q?aiCyFuX4n9kqDf3q1E/igPTBHeRmqsyHYFFDzYfDTddpX5IABDw02jqcII/A?=
=?us-ascii?Q?8H7oDX1ntST/KxPUXGO1yV95qtIL7wGGFjEB0QT+YaXt4TQ8ihJoveKxL0OO?=
=?us-ascii?Q?0CXrrcpcSj02jIuTIvt4y7i8ncCqiLjdjqG/FIzWwB73Tv6S5nHTrn7Euqau?=
=?us-ascii?Q?uNrYaVT4hDk1ezZ0NnZFTMQktlxkmdkySmcz/Z524q8MkAeMwWXf8qaEjF/F?=
=?us-ascii?Q?CZbKgY3zD0c=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?6IU4+pYjxf4Zup12sadC/3jLrv2ecLf4kvybGbYiHICUVjdv3X2xAXo0yGuP?=
=?us-ascii?Q?wnZRTyU5L4/yC6xf3/aBNHlRIRALE0oVac1gowC9Igienb8jycwhocpl2oqO?=
=?us-ascii?Q?qJkmiCf29J+vqzqjI773YquXxF2qnekV8YwufdzjkwIpqW53YrBn/phpgazW?=
=?us-ascii?Q?yD4N6TsQr4XiLPH8uPD8DmC9wUVm38T92YQ8oDhLjacnmIxYvji70aqPbzyr?=
=?us-ascii?Q?efwlLwv7m1dkIe74Wa1On9DRK/ME/r4Sb5K0izTkPL76BGgZC06bt6iuI8J0?=
=?us-ascii?Q?0mG55TXOCkKCdiImpBw23xBv6jFkebsjO1BCi1aPawfsnJUQ9NTqgtAMtFIX?=
=?us-ascii?Q?ZApIzTRbMJ3OoK0KbhQDqLRxSucX91ma7x+Dxa+H4tQa/bT1p4noSeUmTV9A?=
=?us-ascii?Q?fTnYzfoNSS6lPZWt2gqSgYJQmnlA9qlbfgJ1lIqMtKHFFkGFen4yTOtIebDd?=
=?us-ascii?Q?voDAqZlgG4UaL6GomfplHhm1+jOx3DAt5nopWnlwEAbI1vzCf0vO/V/0/yTS?=
=?us-ascii?Q?njZFQ+5gpZx4CLYRCcL22j+rGKVZHbREQJUJEiql/DbyarwedbWFoga94kX8?=
=?us-ascii?Q?14CXCxHZCGbhtGjJkoFLUvThOqeE9P/kOheTDFnMOrQAIriyZY4WgDjNcn5A?=
=?us-ascii?Q?n9j7m0kAdF1IjSHca3rxAm/zWIi1fCDeyEIHW0uyyEO1DKFJJL0gkLFnJslr?=
=?us-ascii?Q?fz5N70NqnSDpqkVpigYeXeg+R2UeSwM3hRh4u9gTZuvRRhUe12jn6ninUwJe?=
=?us-ascii?Q?qJb/aaZ8yOotu2F10wEa8Lo8a4FwgYjADDAtxA37QXgDd4//Hh8Zf9/feWAU?=
=?us-ascii?Q?SaUF6w36G5B1IjICd3IgqmLaMDm250a1kv0th6LOUMctf7UyrKArAQHNiPE+?=
=?us-ascii?Q?hILRvPSQUWrp5ruqwMO2fFVg1ngycvLxC+Zo6dPZBl6NHtUNQixewPygbVjr?=
=?us-ascii?Q?ysYeBEaZy4KbO02yy2yxLc1Mzf+Y+HTQ6GJzoZJMO8XkCKOjvEu9yl2f10WZ?=
=?us-ascii?Q?X/13Pw7s4LbJZWYpqTDGGdJ9uCo7+xvOyfzDUwm0UAPN34hw/cZo2HiT/UXb?=
=?us-ascii?Q?4OEtjyVV4reUIGxQS4zOxuLzeHaMvu23FzHIGdSaw5QCxPhIOmsqiltca4Zj?=
=?us-ascii?Q?6+YtZnOe7gGvNTu9n56cM3Pnlhi9qD5TWZMeoCbCwHoRAAksz9LOcRhIic5O?=
=?us-ascii?Q?H0ahB9EJu46R5g7RXtMcvtnKwrk1cd6c3L4VaF7r/ohqilE2NiZbBfu94Uux?=
=?us-ascii?Q?/3ENw79bpCj5ZEiEEYHAvsqmnTs5oVklyjxwPPPysEXegdAQJUT1MTG5I+2W?=
=?us-ascii?Q?4t9GYJ3ihcfJCWj8fpJhCt0s5LMDEzXzON+UIdsMDl6TwxSI+QCo60vcglXv?=
=?us-ascii?Q?XBCmPKO0rw3BqRmRPNwTgoGgOSdc9PEzl63RKbC4ubg5JrJVDTZ+9z2HwvKF?=
=?us-ascii?Q?Fm+OJRoHpnwXsPiLdH8ChEzDuBElRUZR0uAHOVpoAu0lvW642KUc0zUj9dcY?=
=?us-ascii?Q?CRqORzclyAyyrZ19e8bQXesGyZBqRVtXc+W/J3fsoZ8MLnP7uhqksH9IHKBz?=
=?us-ascii?Q?02+M0bgVK1x/6rGZmBMrzgnYKjYkV6XVi31xFOYXeQbh0tM7fwmgm8N2KXjd?=
=?us-ascii?Q?pw=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
2eVDOwMxJGo9fS6BrFoR2+g6J7mxE3gDVh8RfTo9yW/gMKOANu8PDR37U1Q74UzZkAJb14jY3+ZZCkfizi9AbAVXMtXlMMs09r9gEJqgaJJnX+lUgnEpyRUxhMGlRI8yTCXNv8RQWscKCzBX7YnHqU+cONN4gRvHnkqdb4hoqU6lfg3q+gOwXpxqQ2aaeppGlAQQVNNhn3Cra6jwdx5oQ+yTeWkP0x7FMxs8kVI5flJLwnpCRb87gHy/XwCgcmgCNMt0BQy071v0LTx3/ufvppBK0jTsVKqnDUF6FLxeLFBU2bYwh04WkLsfgBGByNDWIFmvlqMOxjZs7RdLC73Yi9UfhraQ+mLnGe22a+0pW/9jZI8w7Ql/Hz9ZPOLl93jBPnmTs8PuZfCt2TUW8SxBii/JRoXl4LYLp6/9N+jo4wPwZXE4HVCOI7QD174xQV0QKoHaXD6tdyJE0oXb8bCm9UBG8WWHBL2V9wilbEYD0EG81llrTR1bh1uXauO6F7Rdhr9M2afh/tu8OuRq/h8DkYoTYp24KYQqOZ8C8yM+HJ8H/Zex1Uw4iYNVOEJBl1inIzkvN0gxOGR++4LbqpUgEB1xDQWw24IAK89o9R11bZ0=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 6b911bcf-12e3-42fc-15c3-08dda4e8bd74
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 10:56:07.5151
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: GHVUyRH+08oDKKWlIkmNYd6PSSBLKy4khNP042R5PDTy6Fv/nytUhS8lkLZMD/6LIrVtJUmPosz8v4QOiC7XY/hnhYcIDwUWLq6av7lcPLg=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB8095
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 adultscore=0
bulkscore=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060098
X-Authority-Analysis: v=2.4 cv=Wu0rMcfv c=1 sm=1 tr=0 ts=6842c94a cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=7CQSdrXTAAAA:8 a=FvvDUNBv4RxSsuqumHYA:9 a=CjuIK1q_8ugA:10 a=a-qgeE7W1pNrGK8U0ZQC:22
X-Proofpoint-GUID: oHSTE-6UlscSrLX3MRrVi5JVI-SK_vR2
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5OCBTYWx0ZWRfX0RsaX8qup/MU bNguavw/QvU0Gmusp0XSo0s5dqpT9d+CTIaqGS+W3f9m0mYSEkCmwTkrz99MBQkN8kw25Xxx7iw 0qddmBNn9hOLeBAcbZ2ROaSK281fMDaRkkNf6W/aA4nCi3AiBM8yuarUYkkhzbyxprvYwLzu0/3
8M3t2FMvCwyu6ZCUCtEi489dYw8X/nTq04R8rM+cKmtYTWyC8AcQytaP8OOZqltfYQp/ZISIuzg Z/DSWMh3uMLjlx9T5FLGt6osaSptsl/wtoV5u+zBmeuX4z2Kkwg87KCafngGms2l+/GoLlJVrmv DsxqqaSYJRyIUIv9Km4TIxCnerP/FgUy6L9nRhPrxNnm5cfO1aICExIGSlG0Tuk1Q8n5hbWlxNy
Gu4nKo8360GIFcJQTdAL3FCgqszSjEyXoL2t/XYnHzK3EVwMI/cTleOXm+P+cn7dJ+qTTDKn
X-Proofpoint-ORIG-GUID: oHSTE-6UlscSrLX3MRrVi5JVI-SK_vR2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 04:09:51PM +0530, Dev Jain wrote:
>
> On 06/06/25 3:19 pm, Lorenzo Stoakes wrote:
> > On Fri, May 30, 2025 at 02:34:06PM +0530, Dev Jain wrote:
> > > Move away from apply_to_page_range(), which does not honour leaf mappings,
> > > to walk_page_range_novma(). The callbacks emit a warning and return EINVAL
> > > if a partial range is detected.
> > Hm a follow up question here - why not just improve apply_to_page_range() to
> > honour leaf mappings?
> >
> > What does honouring leaf mappings actually mean? You mean handling huge pages?
>
> Sorry, I always confuse between block, page and leaf mappings :) I mean to say
> block mappings, yes, huge pages.

Sometimes I think we like to give different names to things just to make life
confusing ;)

>
> >
> > Would it be all that difficult to implement?
>
> That is how I did it initially. But I think we get into the same problem
> which you are describing w.r.t extending walk_page_range_novma - currently we
> return EINVAL in case we encounter a block mapping in apply_to_page_range,
> basically asserting that the callers always operate on page mappings. Removing this
> assertion and generalizing apply_to_page_range kind of sounds the same as
> removing the locking assertion and generalizing walk_page_range_novma...

(Again keep in mind walk_page_range_novma no longer exists :)

Yeah it's problematic I guess in that you have a pte_fn_t and would have to get
into gross stuff like pretending a PMD entry is a PTE entry etc.

Ugh god why do we do this to ourselves.

>
> >
> > It seems like you're pushing a bunch of the 'applying' logic over from there to
> > a walker that isn't maybe best suited to it and having to introduce an iffy new
> > form of locking...
>
> IMHO I think it is the reverse. Commit aee16b3cee2746880e40945a9b5bff4f309cfbc4
> introduces apply_to_page_range, and commit e6473092bd9116583ce9ab8cf1b6570e1aa6fc83
> introduces pagewalk. The commit messages say that the former is meant to be used
> on page mappings, while the latter is generic. The latter implies that the former
> was actually never meant to exist...

What a mess.

Maybe the least-worst solution is to just add a new
walk_kernel_page_table_range_unlocked() function without an assert and in the
comment heavily underline that _you must have made sure this is safe_.

This needs revisting in general, I find the use of init_mm.mmap_lock pretty
gross.

>
> >
> > Can we go vice-versa? :)
> >
> > Also obviously walk_page_range_novma() doesn't exist any more :P
> > walk_kernel_page_table_range() is the preferred solution.
> >
> > > Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
> > > ---
> > > arch/arm64/mm/pageattr.c | 69 +++++++++++++++++++++++++++++++++++++---
> > > 1 file changed, 64 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
> > > index 39fd1f7ff02a..a5c829c64969 100644
> > > --- a/arch/arm64/mm/pageattr.c
> > > +++ b/arch/arm64/mm/pageattr.c
> > > @@ -8,6 +8,7 @@
> > > #include <linux/mem_encrypt.h>
> > > #include <linux/sched.h>
> > > #include <linux/vmalloc.h>
> > > +#include <linux/pagewalk.h>
> > >
> > > #include <asm/cacheflush.h>
> > > #include <asm/pgtable-prot.h>
> > > @@ -20,6 +21,67 @@ struct page_change_data {
> > > pgprot_t clear_mask;
> > > };
> > >
> > > +static pteval_t set_pageattr_masks(unsigned long val, struct mm_walk *walk)
> > > +{
> > > + struct page_change_data *masks = walk->private;
> > > + unsigned long new_val = val;
> > > +
> > > + new_val &= ~(pgprot_val(masks->clear_mask));
> > > + new_val |= (pgprot_val(masks->set_mask));
> > > +
> > > + return new_val;
> > > +}
> > > +
> > > +static int pageattr_pud_entry(pud_t *pud, unsigned long addr,
> > > + unsigned long next, struct mm_walk *walk)
> > > +{
> > > + pud_t val = pudp_get(pud);
> > > +
> > > + if (pud_leaf(val)) {
> > > + if (WARN_ON_ONCE((next - addr) != PUD_SIZE))
> > > + return -EINVAL;
> > > + val = __pud(set_pageattr_masks(pud_val(val), walk));
> > > + set_pud(pud, val);
> > > + walk->action = ACTION_CONTINUE;
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static int pageattr_pmd_entry(pmd_t *pmd, unsigned long addr,
> > > + unsigned long next, struct mm_walk *walk)
> > > +{
> > > + pmd_t val = pmdp_get(pmd);
> > > +
> > > + if (pmd_leaf(val)) {
> > > + if (WARN_ON_ONCE((next - addr) != PMD_SIZE))
> > > + return -EINVAL;
> > > + val = __pmd(set_pageattr_masks(pmd_val(val), walk));
> > > + set_pmd(pmd, val);
> > > + walk->action = ACTION_CONTINUE;
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static int pageattr_pte_entry(pte_t *pte, unsigned long addr,
> > > + unsigned long next, struct mm_walk *walk)
> > > +{
> > > + pte_t val = ptep_get(pte);
> > > +
> > > + val = __pte(set_pageattr_masks(pte_val(val), walk));
> > > + set_pte(pte, val);
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static const struct mm_walk_ops pageattr_ops = {
> > > + .pud_entry = pageattr_pud_entry,
> > > + .pmd_entry = pageattr_pmd_entry,
> > > + .pte_entry = pageattr_pte_entry,
> > > + .walk_lock = PGWALK_NOLOCK,
> > > +};
> > > +
> > > bool rodata_full __ro_after_init = IS_ENABLED(CONFIG_RODATA_FULL_DEFAULT_ENABLED);
> > >
> > > bool can_set_direct_map(void)
> > > @@ -49,9 +111,6 @@ static int change_page_range(pte_t *ptep, unsigned long addr, void *data)
> > > return 0;
> > > }
> > >
> > > -/*
> > > - * This function assumes that the range is mapped with PAGE_SIZE pages.
> > > - */
> > > static int __change_memory_common(unsigned long start, unsigned long size,
> > > pgprot_t set_mask, pgprot_t clear_mask)
> > > {
> > > @@ -61,8 +120,8 @@ static int __change_memory_common(unsigned long start, unsigned long size,
> > > data.set_mask = set_mask;
> > > data.clear_mask = clear_mask;
> > >
> > > - ret = apply_to_page_range(&init_mm, start, size, change_page_range,
> > > - &data);
> > > + ret = walk_page_range_novma(&init_mm, start, start + size,
> > > + &pageattr_ops, NULL, &data);
> > >
> > > /*
> > > * If the memory is being made valid without changing any other bits
> > > --
> > > 2.30.2
> > >


Return-Path: <linux-kernel+bounces-675632-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DB05041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:58:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id A409C7A3B8D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:56:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 11CD528750C;
Fri, 6 Jun 2025 10:58:01 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B328A267B94;
Fri, 6 Jun 2025 10:57:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207480; cv=none; b=c/RTBTKIN9olwUhsnwiL4U8e5xhut8msOVoKvIOc1q0gSz2wM4Uh01rYx0u4mCmE1nvHTobu8zyfiSbyq++nHrsI9JAQzRhluqRHZlAZSzC+1W1SMifG2rm957mSFTb/OkU4IsS2URnr5vy2ZI6AUc6wkADc3KPY+WLYml5ZnwU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207480; c=relaxed/simple;
bh=/crt+0HDA4eUQeNppbtNcTLgzSoLMMU7FFyBkBuev/U=;
h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZGSEK01EIq3igbSype6l3PwA2kLoybAHA+oaeKX3kdL45xTvt8+IK5nI5m2rdxlCHsPmDMunQ7JiJ3oC5HOQMOfZpLdMwTQUcmiyzPJp9+q8PYUgWsSZ86umo4MSfk1J55okN+3kOLa/mdSNf9mdTYlLk4QkE3ijnoIP8CXhdyk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EB7D9153B;
Fri, 6 Jun 2025 03:57:39 -0700 (PDT)
Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5F1333F59E;
Fri, 6 Jun 2025 03:57:56 -0700 (PDT)
From: Yeoreum Yun <yeoreum.yun@xxxxxxx>
To: sudeep.holla@xxxxxxx,
peterhuewe@xxxxxx,
jarkko@xxxxxxxxxx,
jgg@xxxxxxxx,
stuart.yoder@xxxxxxx
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
linux-integrity@xxxxxxxxxxxxxxx,
Yeoreum Yun <yeoreum.yun@xxxxxxx>
Subject: [PATCH 0/2] fix failure of integration between tpm_crb_ffa with ima
Date: Fri, 6 Jun 2025 11:57:52 +0100
Message-Id: <20250606105754.1202649-1-yeoreum.yun@xxxxxxx>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

To integrate tpm_event_log with ima subsystem,
tpm_crb and tpm_crb_ffa driver should be built as built-in
(ARM_FFA_TRANSPORT=y && CONFIG_TCG_CRB=y && CONFIG_TCG_CRB_FFA=y).

However, this could make failure for ima_init() gets tpm chip when
each initcall function deployed like:

0000000000000888 l .initcall6.init>-------0000000000000000 crb_acpi_driver_init
000000000000088c l .initcall6.init>-------0000000000000000 tpm_crb_ffa_driver_init
0000000000000a9c l .initcall6.init>-------0000000000000000 ffa_init

If crb_api_driver_init() is called first, probing tpm device using CRB over
FFA method is deferred since tpm_crb_ffa_driver_init() or
ffa_init() doesn't called yet -- this means the secure partition isn't
probed yet.

and deferred probe of the tpm device will be probed by system workqueue
in proper time after deferred_probe_initcall() registers the work.
However, ima_init() could be called first if they're deployed like:

000000000000012c l .initcall7.init>-------0000000000000000 init_ima
000000000000016c l .initcall7.init>-------0000000000000000 deferred_probe_initcall7

In this situation, ima_init() failed to find tpm device and it failed to
generate boot_aggregate with PCR values.

That's why kernel prints log this situation though tpm device exists:
[ 3.080786] ima: No TPM chip found, activating TPM-bypass!

To resolve this,
Patch #1, change ffa_init()'s init level to rootfs_initcall so that
ffa_device generate before any ffa_driver is loaded.

Patch #2, call ffa_register() at tpm_crb_ffa_init() when
it's built as built-in. so that when tpm device is probed,
tpm_crb_ffa secure partition in probed state with related ffa_driver.

---

Yeoreum Yun (2):
driver/firmware/arm_ffa: change ffa_init's initlevel
driver/tpm/tpm_crb_ffa: maunally register tpm_crb_ffa driver when it's
built-in

drivers/char/tpm/tpm_crb_ffa.c | 22 +++++++++++++++++-----
drivers/firmware/arm_ffa/driver.c | 2 +-
2 files changed, 18 insertions(+), 6 deletions(-)

--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}



Return-Path: <linux-kernel+bounces-675633-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 37CB741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:58:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 7BEC3189D131
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:58:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id F38C12882A9;
Fri, 6 Jun 2025 10:58:01 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 123E027FB35;
Fri, 6 Jun 2025 10:57:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207481; cv=none; b=oNxluDzidvc6u5vGOfHwM7T5HkEB34HAiMX9ut6bV3LVS8cmIr8YSA5Lh2oRUQvbq7oaEcilBOIFAhmH+Z78bremNxIhaux/FzfkRKEi0uxbCJis8jci6KH/qu0figER70IxP/OWZF88XtGkqSACSfaCo4YBL6fcLZB8lyYrtZg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207481; c=relaxed/simple;
bh=XFETnRwJszuY33IPOx4LdCSnsksBJu52kllSSQvTpnE=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=TKR/fM1Ft44f4LjyDOMfK7+21Au0UEIDjVgY7xV4SGdQAEWwCU7jjtlsMGiG53p1RBr8IRvNslc2yoDC2QTZK+HnQJx0SW1Ug87ExJtc+1YxqT2U6w2FZaJ/Ktsyru3xZPeeQX+tKHrG8fY7HxziNTj/dyo4bkioKmqFQyzGFWM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 95ADC1595;
Fri, 6 Jun 2025 03:57:41 -0700 (PDT)
Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0ADA23F59E;
Fri, 6 Jun 2025 03:57:57 -0700 (PDT)
From: Yeoreum Yun <yeoreum.yun@xxxxxxx>
To: sudeep.holla@xxxxxxx,
peterhuewe@xxxxxx,
jarkko@xxxxxxxxxx,
jgg@xxxxxxxx,
stuart.yoder@xxxxxxx
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
linux-integrity@xxxxxxxxxxxxxxx,
Yeoreum Yun <yeoreum.yun@xxxxxxx>
Subject: [PATCH 1/2] firmware: arm_ffa: Change initcall level of ffa_init() to rootfs_initcall
Date: Fri, 6 Jun 2025 11:57:53 +0100
Message-Id: <20250606105754.1202649-2-yeoreum.yun@xxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606105754.1202649-1-yeoreum.yun@xxxxxxx>
References: <20250606105754.1202649-1-yeoreum.yun@xxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The Linux IMA (Integrity Measurement Architecture) subsystem used for secure
boot, file integrity, or remote attestation cannot be a loadable module
for few reasons listed below:

o Boot-Time Integrity: IMAâ??s main role is to measure and appraise files
before they are used. This includes measuring critical system files during
early boot (e.g., init, init scripts, login binaries). If IMA were a module,
it would be loaded too late to cover those.

o TPM Dependency: IMA integrates tightly with the TPM to record measurements
into PCRs. The TPM must be initialized early (ideally before init_ima()),
which aligns with IMA being built-in.

o Security Model: IMA is part of a Trusted Computing Base (TCB). Making it a
module would weaken the security model, as a potentially compromised system
could delay or tamper with its initialization.

IMA must be built-in to ensure it starts measuring from the earliest possible
point in boot which inturn implies TPM must be initialised and ready to use
before IMA.

To enable integration of tpm_event_log with the IMA subsystem, the TPM drivers
(tpm_crb and tpm_crb_ffa) also needs to be built-in. However with FF-A driver
also being initialised at device initcall level, it can lead to an
initialization order issue where:
- crb_acpi_driver_init() may run before tpm_crb_ffa_driver()_init and ffa_init()
- As a result, probing the TPM device via CRB over FFA is deferred
- ima_init() (called as a late initcall) runs before deferred probe completes,
IMA fails to find the TPM and logs the below error:

| ima: No TPM chip found, activating TPM-bypass!

Eventually it fails to generate boot_aggregate with PCR values.

Because of the above stated dependency, the ffa driver needs to initialised
before tpm_crb_ffa module to ensure IMA finds the TPM successfully when
present.

Signed-off-by: Yeoreum Yun <yeoreum.yun@xxxxxxx>
---
drivers/firmware/arm_ffa/driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index fe55613a8ea9..1a690b8186df 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -2058,7 +2058,7 @@ static int __init ffa_init(void)
kfree(drv_info);
return ret;
}
-module_init(ffa_init);
+rootfs_initcall(ffa_init);

static void __exit ffa_exit(void)
{
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}



Return-Path: <linux-kernel+bounces-675634-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2DD5341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:58:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 25FEC3B1D0E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:58:07 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E95A92882CE;
Fri, 6 Jun 2025 10:58:03 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C15762882A2;
Fri, 6 Jun 2025 10:58:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207483; cv=none; b=aMO6JFfdu2s1fFpA7Z2t2d2gnH/ZIAQQ+S2HNQ3ciUS5CwPbT2NkP36GGnwQ5mnVKFzfQzctEH+fcb0wyMsUklSFe2KyHI6OHOvtz4DMJrG8+COBcu/WniLYw0lK73A/WDAccxbyUHa/asUWNH3oxLbYAAf0cG5lHDL3EkWZ4K0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207483; c=relaxed/simple;
bh=LdC86cJWlp6U1sDvJ8jk50YwXi2SHmaCJx6IuM9Udl8=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=dFJV0O024QEK2IY82PCMg4gXpWMNQp/uvncAMiB1UVEbRsL2/cmD2pQSgjGL/MwcTQbkStZgDrro2LiCf0ZVQblb0mOT++4n/gY0TqaqkUrirveJonkErVP9pI7oscz8/trlnvqp4x1TYzLXvG03esrX31aQ1PQj+8jCTL5KLas=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 40E4A1BD0;
Fri, 6 Jun 2025 03:57:43 -0700 (PDT)
Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AA4313F59E;
Fri, 6 Jun 2025 03:57:59 -0700 (PDT)
From: Yeoreum Yun <yeoreum.yun@xxxxxxx>
To: sudeep.holla@xxxxxxx,
peterhuewe@xxxxxx,
jarkko@xxxxxxxxxx,
jgg@xxxxxxxx,
stuart.yoder@xxxxxxx
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
linux-integrity@xxxxxxxxxxxxxxx,
Yeoreum Yun <yeoreum.yun@xxxxxxx>
Subject: [PATCH 2/2] tpm: tpm_crb_ffa: maunally register tpm_crb_ffa driver when it's built-in
Date: Fri, 6 Jun 2025 11:57:54 +0100
Message-Id: <20250606105754.1202649-3-yeoreum.yun@xxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606105754.1202649-1-yeoreum.yun@xxxxxxx>
References: <20250606105754.1202649-1-yeoreum.yun@xxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

To integrate tpm_event_log with IMA subsystem,
tpm_crb and tpm_crb_ffa driver should be built as built-in
(CONFIG_TCG_CRB=y && CONFIG_TCG_CRB_FFA=y).

However, this could make failure for ima_init() gets tpm chip when
each initcall function deployed like:

0000000000000888 l .initcall6.init 0000000000000000 crb_acpi_driver_init
000000000000088c l .initcall6.init 0000000000000000 tpm_crb_ffa_driver_init

If crb_api_driver_init() is called first, probing tpm device using CRB over
FFA method is deferred since tpm_crb_ffa_driver_init() isn't called yet.

Deferred probe of the tpm device will be probed by system workqueue
in proper time after deferred_probe_initcall() registers the work.
However, ima_init() could be called first if they're deployed like:

000000000000012c l .initcall7.init 0000000000000000 init_ima
000000000000016c l .initcall7.init 0000000000000000 deferred_probe_initcall7

In this situation, ima_init() failed to find tpm device and it failed to
generate boot_aggregate with PCR values.

That's why kernel prints log this situation though tpm device exists:
[ 3.080786] ima: No TPM chip found, activating TPM-bypass!

To resolve this, call ffa_register() in tpm_crb_ffa_init() when it was
built with built-in so that ima can generate boot_aggregate log with
PCR values properly.

Signed-off-by: Yeoreum Yun <yeoreum.yun@xxxxxxx>
---
drivers/char/tpm/tpm_crb_ffa.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/char/tpm/tpm_crb_ffa.c b/drivers/char/tpm/tpm_crb_ffa.c
index 4ead61f01299..2ef29b66fa5d 100644
--- a/drivers/char/tpm/tpm_crb_ffa.c
+++ b/drivers/char/tpm/tpm_crb_ffa.c
@@ -115,6 +115,7 @@ struct tpm_crb_ffa {
};

static struct tpm_crb_ffa *tpm_crb_ffa;
+static struct ffa_driver tpm_crb_ffa_driver;

static int tpm_crb_ffa_to_linux_errno(int errno)
{
@@ -168,13 +169,22 @@ static int tpm_crb_ffa_to_linux_errno(int errno)
*/
int tpm_crb_ffa_init(void)
{
- if (!tpm_crb_ffa)
- return -ENOENT;
+ int ret = 0;

- if (IS_ERR_VALUE(tpm_crb_ffa))
- return -ENODEV;
+ if (IS_MODULE(CONFIG_TCG_ARM_CRB_FFA)) {
+ if (!tpm_crb_ffa)
+ ret = -ENOENT;

- return 0;
+ if (IS_ERR_VALUE(tpm_crb_ffa))
+ ret = -ENODEV;
+
+ return ret;
+ }
+
+ ret = ffa_register(&tpm_crb_ffa_driver);
+ BUG_ON(!ret && !tpm_crb_ffa);
+
+ return ret;
}
EXPORT_SYMBOL_GPL(tpm_crb_ffa_init);

@@ -369,7 +379,9 @@ static struct ffa_driver tpm_crb_ffa_driver = {
.id_table = tpm_crb_ffa_device_id,
};

+#ifdef MODULE
module_ffa_driver(tpm_crb_ffa_driver);
+#endif

MODULE_AUTHOR("Arm");
MODULE_DESCRIPTION("TPM CRB FFA driver");
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}



Return-Path: <linux-kernel+bounces-675635-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F27C641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:58:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 508D716A823
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:58:47 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 160232882A2;
Fri, 6 Jun 2025 10:58:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="B5L6he+B"
Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131])
(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 7D89920F09A;
Fri, 6 Jun 2025 10:58:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207517; cv=none; b=IpIiVfTkFaR6zOliDjta1T9SBxoReVf4DC/83k9p7alekYJBuPE9QZbh/RPhK3woiYPkiy7B9QVkJw7mnHv5S7IoERZa3gx2tFwVZ/aL8XHTJVLovRlMfwPQIsML17E9o4JAeGUmHNfNvG/LLfIiYyWEa0jEMVHVU32cZZJmDvk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207517; c=relaxed/simple;
bh=6rTR5qhArzs7JaDLfBWlMMihigZBq70sto6kq9gME/c=;
h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Kt99+BcupHk1PHnJ1FBvB8v8o1pV1IVcwjmf0U1XFH2eYIWtL+pOYqWrPJofCWKZxMuK8b0Vu2OYuVlkcfvPeQbIQSSrw4FwQADZPoOM4g2uHFvamhCik6AmB92zZzaGPxh+rCqUq8e5HuMgGmkqJkx3bMo6ZJ5g99fEItiXAlY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=B5L6he+B; arc=none smtp.client-ip=205.220.180.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com
Received: from pps.filterd (m0279869.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5568GdVH024322;
Fri, 6 Jun 2025 10:58:28 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=
cc:content-transfer-encoding:content-type:date:from:message-id
:mime-version:subject:to; s=qcppdkim1; bh=HvybIUrky2Ylqll0vNupJS
dh61ID7HsNEIdYFcNeiq4=; b=B5L6he+BeOoLW5y9rcyEE5HH711++oMMCPI6hB
Wgy2nYxU2RWeg9waBw9qDr4j5+CBZY8j8OcRQJQ1iYia0FKmaDsz/Xu+1I/RAg2N
OZKYS0UZWpmTLegdMd/mG+Hx1K0SU6LaF39s0lFxGVVOADPfz1N1Bj7iI34Tbc/P
20VAWZnHuUv4irKYySiiEevRVEdcWjlACerURJCvctS2KgVL9LZ1SC9n4eV38qyP
gZVYU8jxiaoLOjOPfL0X/IM5XwWBgTRL4Le6NVW7cAl4dedbaxoALgw5w5oFNMCT
lA5VKdN/PCmOurvD/AS691cSN1xHcYACMtPo4fJcoydqomtg==
Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47202whyrw-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 10:58:27 +0000 (GMT)
Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197])
by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 556AwRip007922
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 6 Jun 2025 10:58:27 GMT
Received: from hu-utiwari-hyd.qualcomm.com (10.80.80.8) by
nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1544.9; Fri, 6 Jun 2025 03:58:24 -0700
From: <quic_utiwari@xxxxxxxxxxx>
To: Thara Gopinath <thara.gopinath@xxxxxxxxx>,
Herbert Xu
<herbert@xxxxxxxxxxxxxxxxxxx>,
"David S . Miller" <davem@xxxxxxxxxxxxx>
CC: <linux-crypto@xxxxxxxxxxxxxxx>, <linux-arm-msm@xxxxxxxxxxxxxxx>,
<linux-kernel@xxxxxxxxxxxxxxx>, <bartosz.golaszewski@xxxxxxxxxx>,
<quic_neersoni@xxxxxxxxxxx>
Subject: [PATCH] crypto: qce - Add suspend and resume support
Date: Fri, 6 Jun 2025 16:28:08 +0530
Message-ID: <20250606105808.2119280-1-quic_utiwari@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To
nalasex01b.na.qualcomm.com (10.47.209.197)
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085
X-Proofpoint-ORIG-GUID: bj5entsUtkRlWHvNPkWVOt36YaJ06O_2
X-Proofpoint-GUID: bj5entsUtkRlWHvNPkWVOt36YaJ06O_2
X-Authority-Analysis: v=2.4 cv=Y/D4sgeN c=1 sm=1 tr=0 ts=6842c9d3 cx=c_pps
a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17
a=GEpy-HfZoHoA:10 a=6IFa9wvqVegA:10 a=COk6AnOGAAAA:8 a=HUDAnx6uG5BSWO10QkMA:9
a=TjNXssC_j7lpFel5tvFf:22
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5NyBTYWx0ZWRfX0/ebGCBvKFMV
8eZWP5WWwuFL9O9xIHEcJwT2+jehTdvOEPoUTXqrThpYVAtR1tb5TBuI4Y3Jn8cTqhJrQ8R99he
WeKZf8eY16ykJuTYKPflCzn1smeZ8Mqla30raHnCeSEuapyOsMRHVGpm7v/Or1ZuPgNxE2kddhw
4UF4l0yYwQc9r8v0qeNTaY3mjlkdaXzfPkolVX8KWpu3GHWqFnJF9amnMRqkoSuCMyUhL4uoKpf
ZJ1TeDPUiHp9Q81/Bx7aU/FhPggeIBOx8BnDpVPfmi7BD2Ay6vbNEXls1XHmFcMuqG7naG3C/XR
GYuyRCdbxtiJ7Sk9SNRIXWwyXM8+VWjxxWnO1bkO2ZweDvkB6a/oB5Z2IVyqxEASDNAvi4ARX5u
tfXCZMrCwXzpcQpxDjdO7s3paepn+6cKp5WvU1cfde5irQoR9pqdfdPSK6vuC53+zjzN/0Y6
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
clxscore=1011 priorityscore=1501 spamscore=0 adultscore=0 impostorscore=0
lowpriorityscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0
bulkscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060097
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Udit Tiwari <quic_utiwari@xxxxxxxxxxx>

Add basic suspend and resume callbacks to the QCE platform driver to
manage interconnect bandwidth during system sleep and wake-up cycles.

Signed-off-by: Udit Tiwari <quic_utiwari@xxxxxxxxxxx>
---
drivers/crypto/qce/core.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index e95e84486d9a..2566bdad5d4a 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -249,6 +249,21 @@ static int qce_crypto_probe(struct platform_device *pdev)
return devm_qce_register_algs(qce);
}

+static int qce_crypto_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct qce_device *qce = platform_get_drvdata(pdev);
+
+ return icc_set_bw(qce->mem_path, 0, 0);
+}
+
+static int qce_crypto_resume(struct platform_device *pdev)
+{
+ struct qce_device *qce = platform_get_drvdata(pdev);
+
+ return icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH,
+ QCE_DEFAULT_MEM_BANDWIDTH);
+}
+
static const struct of_device_id qce_crypto_of_match[] = {
{ .compatible = "qcom,crypto-v5.1", },
{ .compatible = "qcom,crypto-v5.4", },
@@ -259,6 +274,8 @@ MODULE_DEVICE_TABLE(of, qce_crypto_of_match);

static struct platform_driver qce_crypto_driver = {
.probe = qce_crypto_probe,
+ .suspend = qce_crypto_suspend,
+ .resume = qce_crypto_resume,
.driver = {
.name = KBUILD_MODNAME,
.of_match_table = qce_crypto_of_match,
--
2.34.1



Return-Path: <linux-kernel+bounces-675636-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 10B7241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 06:59:06 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 001123B1EAD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:58:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9595F2882BE;
Fri, 6 Jun 2025 10:58:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="EOamfUq9"
Received: from casper.infradead.org (casper.infradead.org [90.155.50.34])
(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 CF6BD28640E;
Fri, 6 Jun 2025 10:58:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207518; cv=none; b=mUXPZV43Tpc9T6gbyf5Z6dqrqkM5FWNpl5nG7xl976fBkpO8Hm9fPYVbgf00c4zrOZ/aiJpIxcv64hX/L+4sZ8WQPV7O5Xc970J+Dp65ueLDt5/Jo9moX8bYPaoO+RaXPU6BqnOsyu0kgO5+4j9Njxii8Hxuz7XtkTkTRUJbugw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207518; c=relaxed/simple;
bh=LYpVHHosFbX5ljXejQMh7Q1YT6ct86HAqT1qXS08S78=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=MefTjg1SJ8MW5PPTlSpBF2T2WCe0kIoVqkJPlrbsagXiL0r2z8k50aKAqQ3nu3qerEPMoYeYdTmpeHvngzX0YqBq0G5QPaxZ4xrRcp9E67ZkQtgdsrCLWENMQKtSLTeOvif32Kb6+w14mO4SjI8pMSUmZZ9c54XDDHDm/kvqA2A=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=EOamfUq9; arc=none smtp.client-ip=90.155.50.34
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version:
References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:
Content-Transfer-Encoding:Content-ID:Content-Description;
bh=YD1+ylMFInat6Pc9lNPvkwSZIdRwUAoj193DVNJsNXA=; b=EOamfUq93/o1xotEiiOyrAW2p5
f5lmd9I1XUSjS79mosCme2DghBN/0yfRzLltug8SaofXP0vr3tOBS5N1ozQDuoLEwABZtUSCab/02
vL++vfiB4kMlcZzmRSc0ofhiVHzpP0xT06C0HtMkArCzvirb3oCxsIRmyXvENL5GAe8VdFjLRR4Gn
AAzaatqE6ayWF9jAVz3h5IbKTUWQhrksEYvO7hdswRiSUMh9WqrmMWDy6eDYn6ctoewETo0vweR5E
bE4SvLcUe8yvFK7NbeiAn55t0KRco4LFTsP2qk1eQ3lf6ISxUBckZMtSMssUUWG4nvR4g8Z8eHDAt
oejtMraQ==;
Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net)
by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux))
id 1uNUmN-00000005F39-1T5y;
Fri, 06 Jun 2025 10:58:31 +0000
Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000)
id 951CE3005AF; Fri, 6 Jun 2025 12:58:30 +0200 (CEST)
Date: Fri, 6 Jun 2025 12:58:30 +0200
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
To: Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>,
Boqun Feng <boqun.feng@xxxxxxxxx>, Waiman Long <longman@xxxxxxxxxx>,
Kees Cook <kees@xxxxxxxxxx>,
Joel Granados <joel.granados@xxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
Konstantin Khorenko <khorenko@xxxxxxxxxxxxx>,
Denis Lunev <den@xxxxxxxxxxxxx>,
Aleksandr Mikhalitsyn <aleksandr.mikhalitsyn@xxxxxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx,
kernel@xxxxxxxxxx
Subject: Re: [PATCH] locking: detect spin_lock_irq() call with disabled
interrupts
Message-ID: <20250606105830.GZ39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20250606095741.46775-1-ptikhomirov@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606095741.46775-1-ptikhomirov@xxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 05:57:23PM +0800, Pavel Tikhomirov wrote:
> This is intended to easily detect irq spinlock self-deadlocks like:
>
> spin_lock_irq(A);
> spin_lock_irq(B);
> spin_unlock_irq(B);
> IRQ {
> spin_lock(A); <- deadlocks
> spin_unlock(A);
> }
> spin_unlock_irq(A);
>
> Recently we saw this kind of deadlock on our partner's node:
>
> PID: 408 TASK: ffff8eee0870ca00 CPU: 36 COMMAND: "kworker/36:1H"
> #0 [fffffe3861831e60] crash_nmi_callback at ffffffff97269e31
> #1 [fffffe3861831e68] nmi_handle at ffffffff972300bb
> #2 [fffffe3861831eb0] default_do_nmi at ffffffff97e9e000
> #3 [fffffe3861831ed0] exc_nmi at ffffffff97e9e211
> #4 [fffffe3861831ef0] end_repeat_nmi at ffffffff98001639
> [exception RIP: native_queued_spin_lock_slowpath+638]
> RIP: ffffffff97eb31ae RSP: ffffb1c8cd2a4d40 RFLAGS: 00000046
> RAX: 0000000000000000 RBX: ffff8f2dffb34780 RCX: 0000000000940000
> RDX: 000000000000002a RSI: 0000000000ac0000 RDI: ffff8eaed4eb81c0
> RBP: ffff8eaed4eb81c0 R8: 0000000000000000 R9: ffff8f2dffaf3438
> R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> R13: 0000000000000024 R14: 0000000000000000 R15: ffffd1c8bfb24b80
> ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
> --- <NMI exception stack> ---
> #5 [ffffb1c8cd2a4d40] native_queued_spin_lock_slowpath at ffffffff97eb31ae
> #6 [ffffb1c8cd2a4d60] _raw_spin_lock_irqsave at ffffffff97eb2730
> #7 [ffffb1c8cd2a4d70] __wake_up at ffffffff9737c02d
> #8 [ffffb1c8cd2a4da0] sbitmap_queue_wake_up at ffffffff9786c74d
> #9 [ffffb1c8cd2a4dc8] sbitmap_queue_clear at ffffffff9786cc97
> --- <IRQ stack> ---
> [exception RIP: _raw_spin_unlock_irq+20]
> RIP: ffffffff97eb2e84 RSP: ffffb1c8cd90fd18 RFLAGS: 00000283
> RAX: 0000000000000001 RBX: ffff8eafb68efb40 RCX: 0000000000000001
> RDX: 0000000000000008 RSI: 0000000000000061 RDI: ffff8eafb06c3c70
> RBP: ffff8eee7af43000 R8: ffff8eaed4eb81c8 R9: ffff8eaed4eb81c8
> R10: 0000000000000008 R11: 0000000000000008 R12: 0000000000000000
> R13: ffff8eafb06c3bd0 R14: ffff8eafb06c3bc0 R15: ffff8eaed4eb81c0
> ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
>
> Luckily it was already fixed in mainstream by:
> commit b313a8c83551 ("block: Fix lockdep warning in blk_mq_mark_tag_wait")
>
> Currently if we are unlucky we may miss such a deadlock on our testing
> system as it is racy and it depends on the specific interrupt handler
> appearing at the right place and at the right time. So this patch tries
> to detect the problem despite the absence of the interrupt.
>
> If we see spin_lock_irq under interrupts already disabled we can assume
> that it has paired spin_unlock_irq which would reenable interrupts where
> they should not be reenabled. So we report a warning for it.
>
> Same thing on spin_unlock_irq even if we were lucky and there was no
> deadlock let's report if interrupts were enabled.
>
> Let's make this functionality catch one problem and then be disabled, to
> prevent from spamming kernel log with warnings. Also let's add sysctl
> kernel.debug_spin_lock_irq_with_disabled_interrupts to reenable it if
> needed. Also let's add a by default enabled configuration option
> DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT, in case we will
> need this on boot.
>
> Yes Lockdep can detect that, if it sees both the interrupt stack and the
> regular stack where we can get into interrupt with spinlock held. But
> with this approach we can detect the problem even without ever getting
> into interrupt stack. And also this functionality seems to be more
> lightweight then Lockdep as it does not need to maintain lock dependency
> graph.

So why do we need DEBUG_SPINLOCK code, that's injected into every single
callsite, if lockdep can already detect this?




Return-Path: <linux-kernel+bounces-675637-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DB09641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:00:00 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 074F83B1DBE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:59:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CECDF2882A2;
Fri, 6 Jun 2025 10:59:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y7HvIGO6"
Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61C4220F09A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:59:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207589; cv=none; b=vFBnGy40KvLzvPXx0NElCxBHMxq2pGmO8Y9nGEJ/glvoMbKipLQsjbPfPQexnqYBBs5F1ZxFdtve9VDorLEBJHii58AybVJ/JhqXlPsdeOoWbEPesYxPoNhaR4dqfgYHcGnp9pG7bVhcQ+jEbiuYK5pmX1qUQOV04BoF63Zyhdw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207589; c=relaxed/simple;
bh=eNvJDVx2RVD1ON1QjqqCkfACmTkFJYvAfRFH/oO/c8w=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=CKxm7S9z5CnH/1wijqI2KVsKRTyTwHmhfWKX1C87QVzHd7YkvTkIWZx9XnckPTXmibEE3BOnRMjqmHKEaohrumJwvvyC4xmGyC2zOmYpeLa+59IWQHfC0P0/prWankQIEZDjN9USvFDJOBeQHefgskeRU9NJ/D3xTXgqHE9h+1I=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=y7HvIGO6; arc=none smtp.client-ip=209.85.167.44
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-55342f0a688so247102e87.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:59:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749207584; x=1749812384; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:references:cc:to
:content-language:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=gvqW3AWqkK+q0nQJutHUZ9u8mAXK0/731ZCrAoRGHHE=;
b=y7HvIGO6Qgb8Jd6cOhGPeEheZl0oTWJsquM7T8v1Pt4XRmNmpQzdBIKhcEGqV3RoRb
JzFKHSYxau83ee0ZkqjtQbQVm2lMOV5CH0r9qb0RaiakGI5CZvlGJANB/fgoswf5hPB6
VeHtydAr20LUS7q5LSYkezfHF2DCpH5h/5TglbOrd/BV0sTKZOk+1dpWjR2alnTmL039
idYPqOFYnwox9Nm7YaToTgDOwTTz5xf2gZo39GIL+oloHCNX0RrUsnx81FT5t5N5RCx0
2MfW2bBWTz0yNH4i5h9KIeYaxrq7qOczOk5bcXd+pd/roKChu/bG3NPMKw34oDIeWur5
3bIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749207584; x=1749812384;
h=content-transfer-encoding:in-reply-to:from:references:cc:to
:content-language:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=gvqW3AWqkK+q0nQJutHUZ9u8mAXK0/731ZCrAoRGHHE=;
b=Iny33T7AiAM2hpAulUMYLhPqTxtkVYq7N0CD/SQPcTDK0Z7wSV+BN9t8fSbXKRs+qo
onscYwqm6Dv+SbsqwWua8KMEbas6UvZcesF9ECC1QLLFS+p7NRB3NsuHzSokLK1yOTTA
EagFa24bnrmAOPagq11K5Csbo6yc7qKYCgZYpiAxs/wq67AHHdEmHuIX6uSy7ucCIJ4t
KnifQ9nPjXwbVeO+GF+mP+tAl0jKXv7zr6a5hg8yuO95VmzFvjfAy1NImzNAEAzAuZso
IORMXMy9VOuVmCf74kyjTGWA5rvCPgzmbwU5XqZVw5shlkfmWJUBnUbdYLejx4HaXcHP
ZC4Q==
X-Gm-Message-State: AOJu0YxahCynnhT9GS+mbFYnbNZaawC27J2jTzsfdqI5HMCeQs4p96bk
p7u4AIYPGoIrULMcblbHbs2szNMWjz5PmpGw9li6N6+VPhgsOcXRuL0NRmd1zSJmONo=
X-Gm-Gg: ASbGncv1NB719md0qAup39sJXJadeTtNvA4gbyY5zW3uv+B7ZSZ1oL3tl1k9vKyNTS6
fquRLnJs89RLMbWdlfQPxd8qkbuD3wF2ykQ7xBQkvgCJW4zHBYCfn7D4Dr0s2TmuIE0c8zll7+f
5QvXK2DBPKbxca1+PDSw7XHLw2aDCXO3vnYjGWLcFcHZ0vI4/KPy07SL2urzyNFluDjDbBU9odk
98OsPhl/KRgVQvrqz5RfbPXyxuGMC5J5rirHQookAE9PcqdkuKYouziIf35NjAgn2zEdgX2BuSp
HwU8wzG1+F5vOv+GKA8s1EotsTbQktSCSWL1fRsamjYKniCJgbjUzHEPV13PC1JYRLWvI4qUiiX
FCfCKyj4tcZfcpvriqtOIJGy0vFTBUOa5Z4DZ9omd
X-Google-Smtp-Source: AGHT+IF6VGZzfzzaonioCVFuOZMDtflg4UEsDYktUq+bINrW6ckDf4AUU0LdM6+SSpNaHgJWBn5jVg==
X-Received: by 2002:a05:6512:401e:b0:54d:6dd3:614e with SMTP id 2adb3069b0e04-55366bd41d7mr243196e87.1.1749207584314;
Fri, 06 Jun 2025 03:59:44 -0700 (PDT)
Received: from [192.168.1.4] (88-112-131-206.elisa-laajakaista.fi. [88.112.131.206])
by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55367731877sm151482e87.223.2025.06.06.03.59.42
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 03:59:42 -0700 (PDT)
Message-ID: <877a72fa-cdae-4a66-9991-5ea86ef76aac@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:59:41 +0300
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v4 2/4] media: qcom: camss: Add support for MSM8939
Content-Language: ru-RU
To: vincent.knecht@xxxxxxxxxx, Robert Foss <rfoss@xxxxxxxxxx>,
Todor Tomov <todor.too@xxxxxxxxx>,
Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley
<conor+dt@xxxxxxxxxx>, Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx,
linux-arm-msm@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
=?UTF-8?Q?Andr=C3=A9_Apitzsch?= <git@xxxxxxxxxxx>,
phone-devel@xxxxxxxxxxxxxxx, ~postmarketos/upstreaming@xxxxxxxxxxx
References: <20250602-camss-8x39-vbif-v4-0-32c277d8f9bf@xxxxxxxxxx>
<20250602-camss-8x39-vbif-v4-2-32c277d8f9bf@xxxxxxxxxx>
From: Vladimir Zapolskiy <vladimir.zapolskiy@xxxxxxxxxx>
In-Reply-To: <20250602-camss-8x39-vbif-v4-2-32c277d8f9bf@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello Vincent.

On 6/2/25 20:27, Vincent Knecht via B4 Relay wrote:
> From: Vincent Knecht <vincent.knecht@xxxxxxxxxx>
>
> The camera subsystem for the MSM8939 is the same as MSM8916 except with
> 3 CSID instead of 2, and some higher clock rates.
>
> As a quirk, this SoC needs writing values to 2 VFE VBIF registers
> (see downstream msm8939-camera.dtsi vbif-{regs,settings} properties).
> This fixes black stripes across sensor and garbage in CSID TPG outputs.
>
> Add support for the MSM8939 camera subsystem.
>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
> Signed-off-by: Vincent Knecht <vincent.knecht@xxxxxxxxxx>

There was a preceding and partially reviewed changeset published on
linux-media [1] before v1 of the MSM8939 platform support in CAMSS,
due to a merge conflict this platform changeset should be rebased IMHO.

[1] https://lore.kernel.org/all/20250513142353.2572563-4-vladimir.zapolskiy@xxxxxxxxxx/

--
Best wishes,
Vladimir


Return-Path: <linux-kernel+bounces-675638-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B93B941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:00:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0071E16F2E5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:00:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DBCC7287516;
Fri, 6 Jun 2025 11:00:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vaSPDhVh"
Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6583120F09A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:59:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207600; cv=none; b=FDOQySYu/P/KzncVpuDRR2Oe5+4ISYg2zjy7a/SsaS+tL+Y6ZMRMFmvKipruH6tTRI6+z/8gLp4FNm5Vb8jcJwVhyTFLR+TzImzSGmVHT12TlsOZoXHxw7ujZZDQJn94CDaV2C56/+ytRZly7eoqQ3V0pSVYXqVEMlZ/UHR34xk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207600; c=relaxed/simple;
bh=Ij6p51RBSpIfTcDNnVZuFN0QIs5BBfAMlgmDV1oy1ao=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=JHkUD1nRAspr0xZnUNc7eN9DeutMBDTDSYQqcQQP+7N7S09OX/R+O2wlX8orC79StdABkB/PBeGoAMTKg6ZQZ4t59Pz439vpWSvxW+UVHuYebmWI7q0YnYPOtHgla6t++E9IBXoFaAKHvj0ovmK03VSpOs3k4gVXHkcQwqnhQnk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=vaSPDhVh; arc=none smtp.client-ip=209.85.208.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com
Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-601a67c6e61so9715a12.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 03:59:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749207597; x=1749812397; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=Ij6p51RBSpIfTcDNnVZuFN0QIs5BBfAMlgmDV1oy1ao=;
b=vaSPDhVhvjxvG1nQm1xYmlK/3OnsTO+bhCVqzT6XjcDS+Tpz2RI4D1q5Zzy84uzzZw
twls2e8OE6QVoq5BNWZ6e/C3isira+CyyF39szH+gH0IO5bd58B4BfRpgROJR2Rjs9CY
KcUIrEDuiq1V1m5xgC8j4axAUED6Bgq1Q5XrBmRaVErKKL2ZC8CFGD4tMi+vuPU44LtA
h0cVjlsYmqkzeIc1eYa/KFy7OFQgsdjgm4zWaJ42WSrk021epJn89Id0dqz1+VK7kvjm
7ucJ/bk1wpFQRrGpYB7h4c58U0qmHUhHRWIJyjJFbRjyE6iMUko2aXUkS3bfK7qbfofR
rwZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749207597; x=1749812397;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=Ij6p51RBSpIfTcDNnVZuFN0QIs5BBfAMlgmDV1oy1ao=;
b=GtuegggFG69pdodwxOb238ubZEoJwvqU8XRWPKIO4FE9BguboP2mcpW/0bC472LXRC
jdPcEhEITjd0Gt7npBpl0zYe+73mr4S3qcp1dFqirfRFEujDOXkgwjwaIoV17TyDcdSX
z/IVga148nUCgKqAZG992XMEJ1zQCCEl/3hiUguP3YrdFJvfp8x5Rxs41VAxbaPtwC62
9BbF5OnrUya2+fgi6QDO7UVTdRm/527cOfTTZ+4Dh7+pPZ9S0HKNzyJmkIGrVV2jvS1h
a8SCEVf5vPfBv5wD/5FGXhfsYc/KEOYNVYvt0DR4BNMLyWpMQqmn9ygg6IsovqHEUJD8
5rsA==
X-Forwarded-Encrypted: i=1; AJvYcCXi2/xPZFD+6h0inku4ZfyAtNk8PkI27Mc2uvQj345gZP0qstCx16gTvxw0Ix5FMcjtpmUuAdWDnyIACD8=@vger.kernel.org
X-Gm-Message-State: AOJu0Yy6DJFqJWIVTQASWe5uJO2LEC0it573UqRsOWdCwX9uBJrEfoMq
2fuq3VFx1+CMuPqKae57Wv2Dx50ZWsYxjDUeW9oeBp/0rqZobao1NtM8FdtCGzX/U6CXaxSFNS+
V76UHz5ic+TUxj+FwGWKoA0trM6kWHC69tMOqIzBs
X-Gm-Gg: ASbGncuFkZx4E5MNndOTREOMPzNeZMsf00GTr/YROqr8UKOVon+9NctH/2XKXC7E0WQ
fLBji+aM0tFtaGl3h6IcB08DNjGQN1dowPD0lsxzqfRpB8OyGLlc8tUVVK6rF8KwwNoyq+3mtft
6lHRDgN7X4kXTLjqXTjMRc9v4FyEt4b2vvFnwm1Q8JNlYUcxtsx5TArDfYvd4l0ze8Tdle3xyId
Xb1e9yC
X-Google-Smtp-Source: AGHT+IHxO2eadHOlfPVxuGh+iyeVA+X2FQXWYvnzf8QlbhCwgU3Fgf6hl8bb87wyCATPpiU1tP4xwP8RO2klSRm0ODw=
X-Received: by 2002:aa7:d98f:0:b0:601:7b94:b80e with SMTP id
4fb4d7f45d1cf-607793d441bmr49798a12.3.1749207596298; Fri, 06 Jun 2025
03:59:56 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250604141958.111300-1-lorenzo.stoakes@xxxxxxxxxx>
<CAG48ez3hvPbfc2dapQQu9TKrjdi5mhZ4tAWi+m0tNZeEtSZBrQ@xxxxxxxxxxxxxx> <af6d28d0-d646-45d5-832c-66add20ea388@xxxxxxxxxx>
In-Reply-To: <af6d28d0-d646-45d5-832c-66add20ea388@xxxxxxxxxx>
From: Jann Horn <jannh@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:59:20 +0200
X-Gm-Features: AX0GCFuSeBKSZUd4LEoLg2wIZ296FSomM3Hd1AfilUwfRktV5EvXRfsEyT3g3G0
Message-ID: <CAG48ez3-QiaT1hSFz64xiucR4azQsrcj+6rQrLoz+d0zd-BUuQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v2] mm/pagewalk: split walk_page_range_novma() into
kernel/user parts
To: David Hildenbrand <david@xxxxxxxxxx>
Cc: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
Barry Song <baohua@xxxxxxxxxx>, "Liam R . Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Michal Hocko <mhocko@xxxxxxxx>, Muchun Song <muchun.song@xxxxxxxxx>,
Oscar Salvador <osalvador@xxxxxxx>, Huacai Chen <chenhuacai@xxxxxxxxxx>,
WANG Xuerui <kernel@xxxxxxxxxx>, Jonas Bonn <jonas@xxxxxxxxxxxx>,
Stefan Kristiansson <stefan.kristiansson@xxxxxxxxxxxxx>, Stafford Horne <shorne@xxxxxxxxx>,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>,
Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Alexandre Ghiti <alex@xxxxxxxx>, loongarch@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-openrisc@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 5, 2025 at 10:23=E2=80=AFPM David Hildenbrand <david@xxxxxxxxxx=
> wrote:
> On 05.06.25 21:19, Jann Horn wrote:
> > On Wed, Jun 4, 2025 at 4:21=E2=80=AFPM Lorenzo Stoakes
> > <lorenzo.stoakes@xxxxxxxxxx> wrote:
> >> The walk_page_range_novma() function is rather confusing - it supports=
two
> >> modes, one used often, the other used only for debugging.
> >>
> >> The first mode is the common case of traversal of kernel page tables, =
which
> >> is what nearly all callers use this for.
> >>
> >> Secondly it provides an unusual debugging interface that allows for th=
e
> >> traversal of page tables in a userland range of memory even for that m=
emory
> >> which is not described by a VMA.
> >>
> >> It is far from certain that such page tables should even exist, but pe=
rhaps
> >> this is precisely why it is useful as a debugging mechanism.
> >>
> >> As a result, this is utilised by ptdump only. Historically, things wer=
e
> >> reversed - ptdump was the only user, and other parts of the kernel evo=
lved
> >> to use the kernel page table walking here.
> >
> > Just for the record, copy-pasting my comment on v1 that was
> > accidentally sent off-list:
> > ```
> > Sort of a tangential comment: I wonder if it would make sense to give
> > ptdump a different page table walker that uses roughly the same safety
> > contract as gup_fast() - turn off IRQs and then walk the page tables
> > locklessly. We'd need basically no locking and no special cases
> > (regarding userspace mappings at least), at the cost of having to
> > write the walker code such that we periodically restart the walk from
> > scratch and not being able to inspect referenced pages. (That might
> > also be nicer for debugging, since it wouldn't block on locks...)
> > ```
>
> I assume we don't have to dump more than pte values etc? So
> pte_special() and friends are not relevant to get it right.
>
> GUP-fast depend on CONFIG_HAVE_GUP_FAST, not sure if that would be a
> concern for now.

Ah, good point, that's annoying... maaaybe we should just gate this
entire feature on CONFIG_HAVE_GUP_FAST to make sure the userspace
mappings are designed to be walkable in this way? It's in debugfs,
which _theoretically_
(https://docs.kernel.org/filesystems/debugfs.html) means there are no
stability guarantees, and I think it is normally used on architectures
that define CONFIG_HAVE_GUP_FAST...


Return-Path: <linux-kernel+bounces-675639-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8E9A341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:01:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2B89C3A3934
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:01:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FFAE286401;
Fri, 6 Jun 2025 11:01:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mguw66Xl"
Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 464162B9BC;
Fri, 6 Jun 2025 11:01:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207693; cv=none; b=H5qYuU2JVCAdXGAzTEI/r6w9T9+qHtQQO+T1K1qphdtatuIkn1fDrwKdkFkgbiUoB/KEjLaAI+6uTESCCTDKZ23ac2rN049S1I/IVr7qHth+pMceiIie6v4Vo3pWCMzxFewrvj46Ov8TyiGFLxhz35M1rkdXEzYvAMAB4DhwAUg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207693; c=relaxed/simple;
bh=xT5xCkZ1JFFONaYP0IT32OFGyChvPSzHHY99QK6deuA=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OeeUP28aK92SeakHYgqeRMdcvshC4d0DuR3ArS1CiaZNodMfgAraCMwaWPo/kkBT1Il0+YBWijZARjb82No4w3hysOE+0FcyFtkjQGh6SVMDzkHMcS2klhuTI4zKUHI8+IqQwt6v5E+FrqPeb8VGWFfAdi9cgcW98ukhnQwbdGk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Mguw66Xl; arc=none smtp.client-ip=209.85.214.170
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-235f9ea8d08so13239515ad.1;
Fri, 06 Jun 2025 04:01:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749207690; x=1749812490; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=UDajbAe57kbFd3lsA+awvfcHj7NkUKCVzc3fJfrdtwM=;
b=Mguw66Xl1nByGQFsakpywgxn9pOYoxEp2R+WuBTCKhrR1dW5ZBVeJeEFCthtWjc9WN
d7DxT2fn3coYj3IXMChH8JKX33dPiKkPzoC4cJs54MtyBG2ELFkNDdicIthWGyK/FK6Y
bTRfNyZjbC+IjPtVNpL/aHY/+5GHv03FYni6H4idlVATX1ltkkTIhZJuc5TVa+r543RK
aC+GBQEH3fTMCtO1Xphq5IOfba8v2/p20i3fxRotty4izsdZTSLLZAm/2dkHuwI7hzeN
xcqdl8yWEagtXDks+20dq3vUMY8eoRf0WPX7az7d3dyTDvlgHdl3XTlmMF9vWyXxHa3R
TbtQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749207690; x=1749812490;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=UDajbAe57kbFd3lsA+awvfcHj7NkUKCVzc3fJfrdtwM=;
b=Q3pCZd6RJn+QNsazPTkiCzZ0vENod2zlf0oXQJeY0xTpVjtlQRjx33apDUIbtOh857
P/Vj4Fuq3KIjlnGwoNwCmvC1SG86uGIYIOC8n4TvpPLdpEwTCgCvckzjGtQHX0cCH6DO
GFK82LbXf7DJhkq1wDkd5rrVnki0LA0Mg1HgBoQ0wob1/yXEFB3tkxGAtXD+9k1Spm4K
J8ZcNq/ZiwHUzfrn8sdNTkOdvB1oIC8RrtxQBq9dHZYQpuMvYoaQhppwDTMIpiDJhj2i
ffZPV2oQa8cRXiXbQdoHEjLKW2wfWPUz2sRXxS1fC62eJCZLLS4Ftyd1Uh1ksD/xbQTM
qqyQ==
X-Forwarded-Encrypted: i=1; AJvYcCX1aEE/b/s50WWNisY63jpy4MlQgPSDzpX6SmNnt0Afvjo2Wj/SLLUudwl3TY4b5R76uNZg5LJwhDUGKaM=@vger.kernel.org
X-Gm-Message-State: AOJu0Yw8gycjU5OdXRvYY/XK0cPXZo036fj+hQDuGttxCG5mTpCQjoBO
WjHLZCayPoli63UZX+ozDsDhyKquOq85/TFoONwwCyy11ODUlDpGlg8E
X-Gm-Gg: ASbGncsC6xGVbG3cDhIbj7lPTwyXnmgqlrntLHJKYnpL4rr1oPBtNwnwJUyFmn/tXw3
gbSU1LFk8qoLtn8gSiJgsgOuyrA4lNH86ySpDRxf8oM4oLBwMiWcKbHQzSB36qmye0Qgy4/TC6J
42M4SmO7/+TKTbhSBHpxITTApUbs/VxaF7viby2n4qPVOFB2fwo0q27sZwgTiN/BsjWhJP0y1df
KsKmmwnpz3yFaWV5FgUwOgqYXZmleuKymQmVypqk2DNdh+gh3qOQVa68MlH3kXTdwth6Ur/6GN6
vwFDIxHCNFqD5j77lc4Q9zSgM1zA+CxGmUUX1afR3zzRM/uFdBcYZEvv1Uq930i2tGoQCA==
X-Google-Smtp-Source: AGHT+IEuQ5XKtuQPYr1CK/mvEDG3WWgyFUsrOC+Ax+xUPhXLsT1tDc1xNFSLcRAlbvPTptb4pA5B5g==
X-Received: by 2002:a17:902:da4b:b0:234:a66d:cce5 with SMTP id d9443c01a7336-23601ed6398mr45797085ad.46.1749207690331;
Fri, 06 Jun 2025 04:01:30 -0700 (PDT)
Received: from victorshih.. ([2402:7500:477:464b:b7fc:d546:e798:4fbc])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-23603406aa9sm10095565ad.188.2025.06.06.04.01.26
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:01:29 -0700 (PDT)
From: Victor Shih <victorshihgli@xxxxxxxxx>
To: ulf.hansson@xxxxxxxxxx,
adrian.hunter@xxxxxxxxx
Cc: linux-mmc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
benchuanggli@xxxxxxxxx,
ben.chuang@xxxxxxxxxxxxxxxxxxx,
HL.Liu@xxxxxxxxxxxxxxxxxxx,
Greg.tu@xxxxxxxxxxxxxxxxxxx,
Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
Subject: [PATCH V3 0/3] Adjust some error messages for SD UHS-II initialization process
Date: Fri, 6 Jun 2025 19:01:18 +0800
Message-ID: <20250606110121.96314-1-victorshihgli@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>

Summary
=======
It is normal that errors will occur when using non-UHS-II card to enter
the UHS-II card initialization process. We should not be producing error
messages and register dumps. Therefore, switch the error messages to debug
mode and register dumps to dynamic debug mode.

Patch structure
===============
patch#1: for core
patch#2-#3: for sdhci

Changes in v3 (June. 06, 2025)
* Rebase on latest mmc/next.
* Patch#2: Separate the helper function in V2 patch#2 into V3 patch#2.

----------------- original cover letter from v2 -----------------
Summary
=======
It is normal that errors will occur when using non-UHS-II card to enter
the UHS-II card initialization process. We should not be producing error
messages and register dumps. Therefore, switch the error messages to debug
mode and register dumps to dynamic debug mode.

Patch structure
===============
patch#1: for core
patch#2: for sdhci

Changes in v2 (May. 23, 2025)
* Rebase on latest mmc/next.
* Patch#1: Drop the use of DBG macro and use pr_debug() instead.
* Patch#2: Drop the use of DBG macro in some function
and use pr_debug() instead.

----------------- original cover letter from v1 -----------------
Summary
=======
It is normal that errors will occur when using non-UHS-II card to enter
the UHS-II card initialization process. We should not be producing error
messages and register dumps. Therefore, switch the error messages to debug
mode and register dumps to dynamic debug mode.

Patch structure
===============
patch#1: for core
patch#2: for sdhci

Changes in v1 (May. 16, 2025)
* Rebase on latest mmc/next.
* Patch#1: Adjust some error messages for SD UHS-II cards.
* Patch#2: Adjust some error messages and register dump for SD UHS-II card

Victor Shih (3):
mmc: core: Adjust some error messages for SD UHS-II cards
mmc: sdhci: Add a helper function for dump register in dynamic debug
mode
mmc: sdhci-uhs2: Adjust some error messages and register dump for SD
UHS-II card

drivers/mmc/core/sd_uhs2.c | 4 ++--
drivers/mmc/host/sdhci-uhs2.c | 20 ++++++++++----------
drivers/mmc/host/sdhci.h | 16 ++++++++++++++++
3 files changed, 28 insertions(+), 12 deletions(-)

--
2.43.0



Return-Path: <linux-kernel+bounces-675640-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CE99D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:02:00 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 236B23AD82D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:01:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B05C32882AC;
Fri, 6 Jun 2025 11:01:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SWm0teif"
Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86C8D2874FA;
Fri, 6 Jun 2025 11:01:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207697; cv=none; b=c7CySq59S5maeQSVmT0hknvp5yAviQ5JHQ0cHoHxrCvsEk/yfWpaCs+THSrlgypqMFCDyHx9P8jT0+7jWv1r9wnJtSlsSYsDkQWbTGROdt4WBoSE4f9xuf4TR79Sm1nvGEepwqtBLbBz2COJI9imEMDbcnCnj/hu1BEhI2f2CdY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207697; c=relaxed/simple;
bh=wtVaYsNiDStfS5WGdGavVgrVpCSRq0G8BYhQB1jRh4E=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=ESdu0WVIs0J3JxWHxm5IxNxlC6fRLwy94K2NslcPS+Q9lusa6llRgbNs3msfu6or5LJQpjytOdNCZX+cXCQCpO3rETPGrud/S/NosjGRGfpnOpANLuWEbOWJs1IAMOrCwk1sozNK2gETYPVY1OWSeLnn75b32trjbDLszGTT0Bs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SWm0teif; arc=none smtp.client-ip=209.85.214.175
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2345c60507bso14177495ad.0;
Fri, 06 Jun 2025 04:01:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749207695; x=1749812495; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=FdNwp9She6Bw0OnAmilNUKwZ/IFh0LJcOPeTVLWMY00=;
b=SWm0teif5kfPfiJ/+VV+nbWf7rZSrBlb8CtWmvQffkQ/5JIUqcdUDm1MKX9sFJUVkO
023YN6mAekEEAQdgsw+qoDqdDtGn5ige66Ktm323hGq5iT3r3g8eJS2ptUK0HuLed/75
mOXlfbLUy2Xa8aYwPsH6/UN9tjMw7SO7epnjtzEtbCpo+JhcheEYUZxZUIrbcromeitn
GlBgbpfUrLoH5WU38U2y+sUTeTD9zYwjBH18mOghV8eBX7AbEsFZFGUo+gQP9Xzo7htx
O7wtlYWMse2utE9SDQeiIv5NtGHIdI7LeAud2kJKhquk9RXb9InFNYiFazXaup+oIWwF
coFQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749207695; x=1749812495;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=FdNwp9She6Bw0OnAmilNUKwZ/IFh0LJcOPeTVLWMY00=;
b=TMxsJWwxfUQAJCilKP9h29URcmLZUEC9Y7dTMavSdJbKYp1HofYBExbrhf6NU2POyq
HPpJdlXIT4B1ugc/BAY71dNT/RqMg5Ppeg+/7OTV5WALOEpzaSvXkFHYUO6ek7c+Jvkr
e9q1I3cTjDFpgI8pCD7wI7gUMtxvKFFa/PQmspfZMpJ+FxQSO65vRxb6BCmDUsHphT1b
kciSIcdcj6InHUpM+94RmiJ2hiyq3nkl+IzSYzszWnZmib4zVdTi57bKizjiYS5wv6mt
KSnO9HD3inJELbPOtDRISPheJexO/pYXkh+FekaBNREYc4oyfrZxzYW0c9DTcqGKO0Q6
GNGw==
X-Forwarded-Encrypted: i=1; AJvYcCXam+9OzjQ+HNDU0nlfWuz77Ojs4eF7jkfpmjZ1PR5haqZ38QxAM4proBDGPR9iwT9W6O6yChhMATh+j4k=@vger.kernel.org
X-Gm-Message-State: AOJu0Yx9GegErYIGoQJ2RzyajFF8nzGFY9Jdr3ygLhzoNsOBXHIcd0wd
xm+VvkTTjzEyddiPQ/8WXEoNSfMzt1hFqnX+u2qxYzL2F5YoB9/eidzx
X-Gm-Gg: ASbGncspi2ksZzT83BE+ouGIxoie3yh+gvi2tMr4kP4SuhKaTQteL2yEDjKPrmK1Bx2
1OJbXCsiZbKTYQIJ25CwVTgRiJQq17eI26DxOTE87Comr++JL/KAo1/yeSYfLnEJ6hZIxnusM4U
FBaS1SRyIAmYL2mC22DDrXE/8HkhCNrdk4Xri+oDkj2nJbE/n/O0njSoQpgAde2j+YP+6Mb4mPS
2X5QDrEz//2vZBAOY7TzKrGXgxbjyI+rSNVLRgjcNSJkPXWPDD/KPy3uHgHrRVabHPP6Sb39ynP
kTjmDdIfajEAPzbBAn4UQiY2wY7I3yt8+rUV3MifjRwRv/D2cnIPuXozenk=
X-Google-Smtp-Source: AGHT+IH7IVs99gQj/i4GTnZdOMV0vK5KnUZifwyIB+LbN+eYfmSwFI3jY/mHycYlDB+MrahI/y0h2w==
X-Received: by 2002:a17:902:ce0f:b0:235:880:cf8a with SMTP id d9443c01a7336-23601d04110mr48586745ad.15.1749207694597;
Fri, 06 Jun 2025 04:01:34 -0700 (PDT)
Received: from victorshih.. ([2402:7500:477:464b:b7fc:d546:e798:4fbc])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-23603406aa9sm10095565ad.188.2025.06.06.04.01.30
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:01:33 -0700 (PDT)
From: Victor Shih <victorshihgli@xxxxxxxxx>
To: ulf.hansson@xxxxxxxxxx,
adrian.hunter@xxxxxxxxx
Cc: linux-mmc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
benchuanggli@xxxxxxxxx,
ben.chuang@xxxxxxxxxxxxxxxxxxx,
HL.Liu@xxxxxxxxxxxxxxxxxxx,
Greg.tu@xxxxxxxxxxxxxxxxxxx,
Victor Shih <victorshihgli@xxxxxxxxx>,
Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
Subject: [PATCH V3 1/3] mmc: core: Adjust some error messages for SD UHS-II cards
Date: Fri, 6 Jun 2025 19:01:19 +0800
Message-ID: <20250606110121.96314-2-victorshihgli@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606110121.96314-1-victorshihgli@xxxxxxxxx>
References: <20250606110121.96314-1-victorshihgli@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>

Adjust some error messages to debug mode to avoid causing
misunderstanding it is an error.

Signed-off-by: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
drivers/mmc/core/sd_uhs2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/sd_uhs2.c b/drivers/mmc/core/sd_uhs2.c
index 1c31d0dfa961..de17d1611290 100644
--- a/drivers/mmc/core/sd_uhs2.c
+++ b/drivers/mmc/core/sd_uhs2.c
@@ -91,8 +91,8 @@ static int sd_uhs2_phy_init(struct mmc_host *host)

err = host->ops->uhs2_control(host, UHS2_PHY_INIT);
if (err) {
- pr_err("%s: failed to initial phy for UHS-II!\n",
- mmc_hostname(host));
+ pr_debug("%s: failed to initial phy for UHS-II!\n",
+ mmc_hostname(host));
}

return err;
--
2.43.0



Return-Path: <linux-kernel+bounces-675641-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1E53141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:02:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 664A21899A55
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:02:20 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 972C727FB3D;
Fri, 6 Jun 2025 11:01:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HsDNoJLw"
Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 876932882C2;
Fri, 6 Jun 2025 11:01:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207700; cv=none; b=AUHyUzpxR/ZDTBAGuP6AtGAYKsu+i5DECNifXywVhLqC13mlQPMfVTNOSJMMNqOCRkuWh5mdAiz2QE0NZFJxQtlMyMHjsmshONd+EbDUkjx15Gf3jUyymX6RX/BFqu5pBx33EuoyPUbsLW6flfuUmiZJYsFrbsyeyGDvSp6ndxo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207700; c=relaxed/simple;
bh=KHL+vq1ykP4Zr71+2wspAda7WJt5Gxkzpx2CSZ9kO9I=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=qohQzrYznpKB87cwS/xNOsjylNa9v6yjvsUZL3UVH3nyRnP/umX1pK9x8Pk2iMRw/G1fR1/AYtrVdgAl9lGqtek/uHHCOGbsESd9QHuGYgvJnp3Np2PLc8UUikw662EQ0vlCzrclOMvc+eYkoXQt6d9OirB3dXa90adGyWZ3BlE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HsDNoJLw; arc=none smtp.client-ip=209.85.215.181
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-b2c41acd479so1204044a12.2;
Fri, 06 Jun 2025 04:01:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749207699; x=1749812499; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=ZWmLMoecq6/e0cg6wm8bQxLR4skzTvI3htWCIwVFePU=;
b=HsDNoJLww2ivpKAAa+btsAnHF9UjnL7riqYVvUJ0iPQF+6wsI55nZ0/I7BgWmKfzeM
0r3K731cs8nOQvunheSQi09FrAfRzNSzxeAtvv/clkHbsFXBzlR/tQsSAS9+NZNdsIVK
CUfNV6n0ttiMwh5yO+jMjEhM4frruNVBMWJnc3OJI5RljMfCsYMXtVBfwroPeEBACF11
539S/0J4Ov4cpcCbIq57kO//5RxiEB9a9xFO8s4k4wNCrkFyRIipnQ9Dh+Jq+e4ccsZo
wMohAK3uBvYo7vYG4TuCc+4oS42BsNkGGdDIw55uNq3mHYjAdGrEXnxvi5iEA5XRM/Pf
b0sQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749207699; x=1749812499;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ZWmLMoecq6/e0cg6wm8bQxLR4skzTvI3htWCIwVFePU=;
b=BVgVZ3hX7nAKLwpvd2nlOrFlmKVO6U/66C46oi9GRmxCUQRCYhI27xXOXAFckq7PSV
VOBn9cuWnBzTw1VX58YArBsp3X5XBDGnIFDuuDxuZ8aaPMcTnCB7QCphVJRMEowhhlaA
T7RhxLbku5IghTzGvRlp8wLIgQNA3soHhf8PJuUjaJ+3gTwegVkncypMI2vAhFffqbCY
hwOQ36VzmKOsJJ4LK+20r4of9EUe4sxEaH+/p+/D+gP7kkx8Mozj/j6SUhHulXaXZkC2
9LYLI54ABCGFP2Reqy2YQH3/y+TpkeI0OZ6Zq3N+9G5BQQP2RJES4u9M1pyAmVURFG33
B2VQ==
X-Forwarded-Encrypted: i=1; AJvYcCWvDOMdknXSkaFNmn5JfBXH50Gbxb4pwnnpbxt6h18gfrZo9bbT52yXMF0cIa90vY9RokOKqPNgcqkvHGw=@vger.kernel.org
X-Gm-Message-State: AOJu0YxIV6VNg08p0pcXr0f6FUUBd5QMssIWFvuPekIC8r/60VfPShlY
O/YJa5j6aaImM8rd8UsAE55Hop9JpZt3+0i10cwuQoD/Ahz4GeuLn6Rt
X-Gm-Gg: ASbGncuCIM822lX1jFT8bq+eZuVIPvWFfIJuad9yxHEwuOdG1JBPpymCHAtYYhn3TGd
FlqlJoB+8asQNHo1ylmGD+ujbTyFWFPYMNoh/Te8cX0gXJczFRSA5ncum6h6vNxJtEL4V1VrVjH
GQiNdgAgMQfxflB0Ae2g0nKDj4Icz5qF+O8sTy+oZNKmvcpvcGk0W4tdYsByYnOdiwOJDoKx3Ip
frTRgaR/um4yTgUuz3u9ERKfZfRIpXEbVqD4BnH5vHsmVzR92TLqrU3z85RUF6miKbTTEmJhW8e
XVahSopyekLwBv7CsGgn9n5SkkXMk/e2v2dWitLrklVpIhOJ6optb/DCMT4=
X-Google-Smtp-Source: AGHT+IFAUQhEkDlOyYk2aG68k7uex0e+ILlWBeTf0nUkHdxjc8cUiLrqvftQtwJvjxdf49NnYncSHw==
X-Received: by 2002:a17:90b:53c4:b0:313:1a8c:c2d3 with SMTP id 98e67ed59e1d1-3134767ec1emr3814127a91.22.1749207698474;
Fri, 06 Jun 2025 04:01:38 -0700 (PDT)
Received: from victorshih.. ([2402:7500:477:464b:b7fc:d546:e798:4fbc])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-23603406aa9sm10095565ad.188.2025.06.06.04.01.34
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:01:38 -0700 (PDT)
From: Victor Shih <victorshihgli@xxxxxxxxx>
To: ulf.hansson@xxxxxxxxxx,
adrian.hunter@xxxxxxxxx
Cc: linux-mmc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
benchuanggli@xxxxxxxxx,
ben.chuang@xxxxxxxxxxxxxxxxxxx,
HL.Liu@xxxxxxxxxxxxxxxxxxx,
Greg.tu@xxxxxxxxxxxxxxxxxxx,
Victor Shih <victorshihgli@xxxxxxxxx>,
Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
Subject: [PATCH V3 2/3] mmc: sdhci: Add a helper function for dump register in dynamic debug mode
Date: Fri, 6 Jun 2025 19:01:20 +0800
Message-ID: <20250606110121.96314-3-victorshihgli@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606110121.96314-1-victorshihgli@xxxxxxxxx>
References: <20250606110121.96314-1-victorshihgli@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>

Add a helper function for dump register in dynamic debug mode.

Signed-off-by: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
drivers/mmc/host/sdhci.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index f9d65dd0f2b2..70ada1857a4c 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -900,4 +900,20 @@ void sdhci_switch_external_dma(struct sdhci_host *host, bool en);
void sdhci_set_data_timeout_irq(struct sdhci_host *host, bool enable);
void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd);

+#if defined(CONFIG_DYNAMIC_DEBUG) || \
+ (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
+#define SDHCI_DBG_ANYWAY 0
+#elif defined(DEBUG)
+#define SDHCI_DBG_ANYWAY 1
+#else
+#define SDHCI_DBG_ANYWAY 0
+#endif
+
+#define sdhci_dbg_dumpregs(host, fmt) \
+do { \
+ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
+ if (DYNAMIC_DEBUG_BRANCH(descriptor) || SDHCI_DBG_ANYWAY) \
+ sdhci_dumpregs(host); \
+} while (0)
+
#endif /* __SDHCI_HW_H */
--
2.43.0



Return-Path: <linux-kernel+bounces-675642-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D240F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:02:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 8AA72189A9D5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:02:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 954DE288508;
Fri, 6 Jun 2025 11:01:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MBt4lY79"
Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FF5E28688A;
Fri, 6 Jun 2025 11:01:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207705; cv=none; b=T3aey5k9fOJKXD5Cq1LlFfGISSlql3ZBhvKsWYFEMMogXvq2N70rK1uxsc5CKfHvEo3FtEP1MUj0a+ZrAH2PKOfAqcaW428DTT4GEdG2jdT8iCZBQs+r4q9DL/V51jNqRb19sIrB11QeYthZIf35iEYwYP7FnPvwocnmKpchssw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207705; c=relaxed/simple;
bh=rlyKOSjopnnYv5rZ9EMYIXC37icsOlBrqPJsm9ycYS0=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=jkWitpMWulO56+Igx9ncgGZkc5nGNDib4LYE/A6Ohz7XPHNH34USGQ+EXwcS5W9B7S/wpz/GSSSDMXsMEEpxA9X4BxNB1SwnV67A+53oWCbQf+mDgD2oqZSVKGtF4Y9zD/riYfktxDjORsihW9iBO2/1YaiPZt+k9UW1tCVZmtQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MBt4lY79; arc=none smtp.client-ip=209.85.215.176
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-b2c41acd479so1204083a12.2;
Fri, 06 Jun 2025 04:01:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749207702; x=1749812502; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=BPhR9yX4mSs2h2RIwQ6dpRH1kL3oB4FnAXKq6tC6nJc=;
b=MBt4lY79FONx0yOcHFyRldG5J9uqNQvDGiYDF2mzBq/eajtZ9ipSCEshd9dsPCvatS
70u+DGhfj0NglY2ZY8BE4jNLweNbMg6Ri18+nMt0bzTXispxRCcNRo0UL09F3n4DczJm
gtztog+cGZsJVO0Kbgdm2AGWF8PidtEYwerpD4Vu6RGypaHTeVxTEICPmOfC4zQrjOvz
wIkfbNV7j+s8Wgzgk/ij1ub9ajDThQmjEOmht304KngtyRhJ5mbNFyrGoAt3d5iuzhPb
B9cLfRdgtyCShxsXZGEHuY//XPYU5BW4rYf7yyzBL9HDt5dTc1ouLRB39RzX4DWLUvUG
SBuQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749207702; x=1749812502;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=BPhR9yX4mSs2h2RIwQ6dpRH1kL3oB4FnAXKq6tC6nJc=;
b=NS6qs+Ck4MoPhnYkBKup6zJvsWUA8ij50VIbHZTQVZuVHO9qnV+SEnBPUpD9psU/nn
mYEcpExXTfTZj5ZuKDJ6HXwYWwIy00ugPwHmx1GbxfyGze2iu1oLVCOAJI5Ps2cRqVfL
mwmXsNi2J/QxOyYru2QvwSHXOudoijGfm+dFbp+xopdRSeyoNw3DQNbuEg8ZeHf9enmN
MQ4yYBRZRQYN3hl4Pzt4IAtSmRPvxLln9IJewZFs2CG+ugNg0KLHk7j2KImqZF9CL8nS
m5lR76bBCvAom0Wwl14Uie6GniA27cmSahaZ1TxFiPHqIA3/8LmyG/3fdvq3UN1kCb2w
GmDw==
X-Forwarded-Encrypted: i=1; AJvYcCUmawDoPj1TKocvMDZ9Ae5pOHmTIOtyJAbEZjF63wuSMYlTbgHse8KSn2tvTclHI/qcUW5R1c8FTqKvWrA=@vger.kernel.org
X-Gm-Message-State: AOJu0YyyQdg9OprWqyxJ403FS6aTLFB4BCKAQzSl9fjNRuRUzzCRjyRT
qM8ZmusSHg0QEWRbldjg1atR6ph64qD+MTF6Z87qo0C6Tuc3k3L+gGN9
X-Gm-Gg: ASbGnct7muaypLgvoi6cd27gGFgFVATVuvgnNshsTzbUQWhHgl16WkdVUxLaVVHLo9+
K8k1U+SvDhk5t0DD4NleOcOxsY6zfi+KoaFz7J6oq6F0F7R8gj6TsMFcWyUkEHpNXfG/GYeq1xe
PrsgJl8V4By+zNR1xvshym/29FsfAZNGQVGPcZ5vbKB6RzwlPx/PkeMVZ2VQXGznDx2QHBvsg6x
03dfW5JSu2y1oIqjvsnt+I9bm26cugsx2dVt+vV7hXhMeLnzDrK2JFkL9ql+Rsxb9/BoMIu9GM7
fAcJhnAfhmiM2qmYFNTzke9BpvfTCEcv9YoQOsC651SR+sHdtxye+sYBNWA=
X-Google-Smtp-Source: AGHT+IGXb/wYozRMBi61TbjaFbU/cASFsQ/CJ7ePhkkDeM21EM8iCfMvcIs9pazkFUy5Rr77tzVAPA==
X-Received: by 2002:a17:90b:3e4b:b0:311:e731:523a with SMTP id 98e67ed59e1d1-313472e628dmr4656133a91.11.1749207702384;
Fri, 06 Jun 2025 04:01:42 -0700 (PDT)
Received: from victorshih.. ([2402:7500:477:464b:b7fc:d546:e798:4fbc])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-23603406aa9sm10095565ad.188.2025.06.06.04.01.38
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:01:41 -0700 (PDT)
From: Victor Shih <victorshihgli@xxxxxxxxx>
To: ulf.hansson@xxxxxxxxxx,
adrian.hunter@xxxxxxxxx
Cc: linux-mmc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
benchuanggli@xxxxxxxxx,
ben.chuang@xxxxxxxxxxxxxxxxxxx,
HL.Liu@xxxxxxxxxxxxxxxxxxx,
Greg.tu@xxxxxxxxxxxxxxxxxxx,
Victor Shih <victorshihgli@xxxxxxxxx>,
Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
Subject: [PATCH V3 3/3] mmc: sdhci-uhs2: Adjust some error messages and register dump for SD UHS-II card
Date: Fri, 6 Jun 2025 19:01:21 +0800
Message-ID: <20250606110121.96314-4-victorshihgli@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606110121.96314-1-victorshihgli@xxxxxxxxx>
References: <20250606110121.96314-1-victorshihgli@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>

Adjust some error messages to debug mode and register dump to dynamic
debug mode to avoid causing misunderstanding it is an error.

Signed-off-by: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
drivers/mmc/host/sdhci-uhs2.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
index c53b64d50c0d..0efeb9d0c376 100644
--- a/drivers/mmc/host/sdhci-uhs2.c
+++ b/drivers/mmc/host/sdhci-uhs2.c
@@ -99,8 +99,8 @@ void sdhci_uhs2_reset(struct sdhci_host *host, u16 mask)
/* hw clears the bit when it's done */
if (read_poll_timeout_atomic(sdhci_readw, val, !(val & mask), 10,
UHS2_RESET_TIMEOUT_100MS, true, host, SDHCI_UHS2_SW_RESET)) {
- pr_warn("%s: %s: Reset 0x%x never completed. %s: clean reset bit.\n", __func__,
- mmc_hostname(host->mmc), (int)mask, mmc_hostname(host->mmc));
+ pr_debug("%s: %s: Reset 0x%x never completed. %s: clean reset bit.\n", __func__,
+ mmc_hostname(host->mmc), (int)mask, mmc_hostname(host->mmc));
sdhci_writeb(host, 0, SDHCI_UHS2_SW_RESET);
return;
}
@@ -335,8 +335,8 @@ static int sdhci_uhs2_interface_detect(struct sdhci_host *host)
if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_IF_DETECT),
100, UHS2_INTERFACE_DETECT_TIMEOUT_100MS, true,
host, SDHCI_PRESENT_STATE)) {
- pr_warn("%s: not detect UHS2 interface in 100ms.\n", mmc_hostname(host->mmc));
- sdhci_dumpregs(host);
+ pr_debug("%s: not detect UHS2 interface in 100ms.\n", mmc_hostname(host->mmc));
+ sdhci_dbg_dumpregs(host, "UHS2 interface detect timeout in 100ms");
return -EIO;
}

@@ -345,8 +345,8 @@ static int sdhci_uhs2_interface_detect(struct sdhci_host *host)

if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_LANE_SYNC),
100, UHS2_LANE_SYNC_TIMEOUT_150MS, true, host, SDHCI_PRESENT_STATE)) {
- pr_warn("%s: UHS2 Lane sync fail in 150ms.\n", mmc_hostname(host->mmc));
- sdhci_dumpregs(host);
+ pr_debug("%s: UHS2 Lane sync fail in 150ms.\n", mmc_hostname(host->mmc));
+ sdhci_dbg_dumpregs(host, "UHS2 Lane sync fail in 150ms");
return -EIO;
}

@@ -417,12 +417,12 @@ static int sdhci_uhs2_do_detect_init(struct mmc_host *mmc)
host->ops->uhs2_pre_detect_init(host);

if (sdhci_uhs2_interface_detect(host)) {
- pr_warn("%s: cannot detect UHS2 interface.\n", mmc_hostname(host->mmc));
+ pr_debug("%s: cannot detect UHS2 interface.\n", mmc_hostname(host->mmc));
return -EIO;
}

if (sdhci_uhs2_init(host)) {
- pr_warn("%s: UHS2 init fail.\n", mmc_hostname(host->mmc));
+ pr_debug("%s: UHS2 init fail.\n", mmc_hostname(host->mmc));
return -EIO;
}

@@ -504,8 +504,8 @@ static int sdhci_uhs2_check_dormant(struct sdhci_host *host)
if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_IN_DORMANT_STATE),
100, UHS2_CHECK_DORMANT_TIMEOUT_100MS, true, host,
SDHCI_PRESENT_STATE)) {
- pr_warn("%s: UHS2 IN_DORMANT fail in 100ms.\n", mmc_hostname(host->mmc));
- sdhci_dumpregs(host);
+ pr_debug("%s: UHS2 IN_DORMANT fail in 100ms.\n", mmc_hostname(host->mmc));
+ sdhci_dbg_dumpregs(host, "UHS2 IN_DORMANT fail in 100ms");
return -EIO;
}
return 0;
--
2.43.0



Return-Path: <linux-kernel+bounces-675643-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 723F441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:02:33 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B07FC174941
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:02:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A373B2882AD;
Fri, 6 Jun 2025 11:02:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hX5LorD3"
Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131])
(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 4DE1B2B9BC;
Fri, 6 Jun 2025 11:02:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207724; cv=none; b=EBxyQsp10xbWUtzVjOpS3bdAOQ+JbHaK9EurHmWAS5LelPjew08KV1rS2emojjrszk8K8CjUe9KaklxwNlN5lATmxuk2pY9rawTGGcVzPOZ4lJCmva8YleX8kw3wWN8oP2e7nvkQPPmoByi6BZbkq5gGd6yr83kA2zfQLjRQW5k=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207724; c=relaxed/simple;
bh=YpgnP6JbmKs2rKnVN3UqcY6nJzxZ4SEBx7H14pjtQvo=;
h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From:
In-Reply-To:Content-Type; b=LmHSGq7Pi4C325AxRdRDHqEMajKveGdw/vtD2S+exHbjQvQpoZz6KbVHHHjdZhzV24H60jaSIiLm5o4laxHHbwG8xo18YR6vzAUa9KBHquMgQk6/d2xLhZie5wg+5If7PJQZfbl9ik1Uf8u03CuewcYup9NL5vuVEhYp7fla1Dw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=hX5LorD3; arc=none smtp.client-ip=205.220.180.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com
Received: from pps.filterd (m0279868.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556A2aRL023713;
Fri, 6 Jun 2025 11:01:54 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=
cc:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=qcppdkim1; bh=
vPiIm5S0zqHtmPDjmG/ipeNnAUuQkXK6aAseCulYbsI=; b=hX5LorD3XiGiLL5p
+Lm6DLWtgUWJcIRyzIXvrUPXmbNwcxfvIDSMtGWgqKyeh11+6+OrePXO1LFclUBg
jC43w+rRcTZZXoyQsyuqLBjSBE7BL5LEnUAEGOs42Q6dgDIcE55Lpz+e8J7+1ey8
k4FG7JdAo3qp42uXUS/f3gBAXz1djNyb7YYVcH/+hbviNzmauudDDXfWL+YBfE39
dM/WcVXCX3fgr1aS2ggU/trfPf68YxsxUOuUz7Jd5b0hBH9twzdHOCWKQ/vOf6UP
h2ELIjMDWnDKVYudPjBBINWgb/iaBd3cKeD9h0miHkSf87XC1AKs2zN7c+A5hQuN
lc2DVQ==
Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 472mn06kyj-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 11:01:54 +0000 (GMT)
Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231])
by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 556B1rrY025619
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 6 Jun 2025 11:01:53 GMT
Received: from [10.50.32.91] (10.80.80.8) by nasanex01a.na.qualcomm.com
(10.52.223.231) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 6 Jun 2025
04:01:49 -0700
Message-ID: <e434dae3-f0ec-e9cf-fc02-3ea79a0f5d7b@xxxxxxxxxxx>
Date: Fri, 6 Jun 2025 16:31:46 +0530
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Subject: Re: [PATCH] media: venus: Fix MSM8998 frequency table
Content-Language: en-US
To: Konrad Dybcio <konradybcio@xxxxxxxxxx>,
Dikshita Agarwal
<quic_dikshita@xxxxxxxxxxx>,
Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Stanimir Varbanov
<stanimir.k.varbanov@xxxxxxxxx>,
Marc Gonzalez <mgonzalez@xxxxxxxxxx>,
Pierre-Hugues Husson <phhusson@xxxxxxxxxx>,
Hans Verkuil <hverkuil@xxxxxxxxx>
CC: Marijn Suijten <marijn.suijten@xxxxxxxxxxxxxx>,
<linux-media@xxxxxxxxxxxxxxx>, <linux-arm-msm@xxxxxxxxxxxxxxx>,
<linux-kernel@xxxxxxxxxxxxxxx>,
Konrad Dybcio
<konrad.dybcio@xxxxxxxxxxxxxxxx>
References: <20250531-topic-venus_98_tbl-v1-1-68e5523a39dc@xxxxxxxxxxxxxxxx>
From: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>
In-Reply-To: <20250531-topic-venus_98_tbl-v1-1-68e5523a39dc@xxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To
nasanex01a.na.qualcomm.com (10.52.223.231)
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085
X-Proofpoint-ORIG-GUID: JsMq2vLL8LnJ7Wl0taToxv2O0ldqSiwQ
X-Proofpoint-GUID: JsMq2vLL8LnJ7Wl0taToxv2O0ldqSiwQ
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDA5NyBTYWx0ZWRfX+UjueyEy6W+Y
6rPYQz+zjyXWrLPDCNCmDQPa8jaZCurGiwx1G09qX9VDp4Ruoh1iZyrME6DNt8zF87ua8peZ9xU
kr8NwIWGmgkzSn19n9A/KmPpvzPYrtYZFovbf6fRnEYrRwjuY2a/Tsh/lu1J/3VM6QS91KsC2Bx
TZ39/K6Hcvq/d5IYHjB33sGrPr+mYuz69cuADcujIqbYGyhM3WfwJqhfW8ca07JOY92N4uMnGWN
V7PCRZcF1AzkQDM5cqKfq0khiHP2RwyNZmrP7A/H1IIQv5gCD2t6OgfCcEX7WjBcq8J0t1CTwDn
jser0w/goMZ++uyKkXTwOxvhY7wwaNITJZ6tu2tzTI8vCj0y1MYrzwD3qnBvfu6mbjhrV+znmUa
N3NEvWQ9P7TtpJWNK7sS7FG0Vi/dBZgGpVEQ9voUgE9xb1+vAf2oiYpKzim66il6b02En14Z
X-Authority-Analysis: v=2.4 cv=Y8/4sgeN c=1 sm=1 tr=0 ts=6842caa2 cx=c_pps
a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17
a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=EUspDBNiAAAA:8
a=COk6AnOGAAAA:8 a=HQS51YnNDeexhmgAX-4A:9 a=QEXdDO2ut3YA:10
a=TjNXssC_j7lpFel5tvFf:22
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
mlxscore=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 phishscore=0
clxscore=1015 impostorscore=0 bulkscore=0 suspectscore=0 priorityscore=1501
malwarescore=0 adultscore=0 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060097
X-Spam-Status: No, score=-5.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
NICE_REPLY_A,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 5/31/2025 5:52 PM, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>
> Fill in the correct data for the production SKU.
>
> Fixes: 193b3dac29a4 ("media: venus: add msm8998 support")
> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
> ---
> drivers/media/platform/qcom/venus/core.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index d305d74bb152d21133c4dfa23805b17274426a5c..2bb514c322692475ed58198e17f906f894d81cf4 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -709,11 +709,11 @@ static const struct venus_resources msm8996_res = {
> };
>
> static const struct freq_tbl msm8998_freq_table[] = {
> - { 1944000, 465000000 }, /* 4k UHD @ 60 (decode only) */
> - { 972000, 465000000 }, /* 4k UHD @ 30 */
> - { 489600, 360000000 }, /* 1080p @ 60 */
> - { 244800, 186000000 }, /* 1080p @ 30 */
> - { 108000, 100000000 }, /* 720p @ 30 */
> + { 1728000, 533000000 }, /* 4k UHD @ 60 (decode only) */
> + { 1036800, 444000000 }, /* 2k @ 120 */
> + { 829440, 355200000 }, /* 4k @ 44 */
> + { 489600, 269330000 },/* 4k @ 30 */
> + { 108000, 200000000 }, /* 1080p @ 60 */
> };
>
> static const struct reg_val msm8998_reg_preset[] = {
>
> ---
> base-commit: 2a628f951ed54c30a232230b5b58349d2a8dbb11
> change-id: 20250531-topic-venus_98_tbl-5765675a4ce5
>
> Best regards,

Reviewed-by: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>


Return-Path: <linux-kernel+bounces-675644-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8B2BB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:02:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 5CDC9189D512
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:03:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 042AC286D61;
Fri, 6 Jun 2025 11:02:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=vayavyalabs.com header.i=@vayavyalabs.com header.b="bgLhgynR"
Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C883B17E4
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:02:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.170
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207767; cv=none; b=Vff/UQkH0Xn3J11rKhJgVrtdpOu1S0dXdELYdzVLpKSdUV3PhhTyPuANPjSJ3xIZTwi5Dd/pjwVUGKU047JXcA2hrqv+faC74KoAcTcRobC8mcWJ0O2fPBBPYRD5vJyUPwOx8NwDUcaSFgA3vLUmeHYu7S6Aed39Lq8ez7rGuJM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207767; c=relaxed/simple;
bh=sozKJ1pwU9KulGgyEdYs/zM27kuoxVEnTkT5+Zsz6DA=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=Dw0X7qT1yRjQq/Uoh5swV9oWjDi4B0y8iImAQqGwJrNaFTd1CGEFPlXm6YXjtYi9BCI4I4dgCjOGAdJybFmdV9qT/rhsteTSeKBWHmcCKA62uKoms0dHdU2VV8QAaomixrjVn08+IokKG14bSaxwMbt+NJZ+BrsafRFYGqhTddo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=vayavyalabs.com; spf=pass smtp.mailfrom=vayavyalabs.com; dkim=pass (1024-bit key) header.d=vayavyalabs.com header.i=@vayavyalabs.com header.b=bgLhgynR; arc=none smtp.client-ip=209.85.219.170
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=vayavyalabs.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vayavyalabs.com
Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-e7387d4a336so1911676276.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:02:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=vayavyalabs.com; s=google; t=1749207763; x=1749812563; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=ahRtYL+8yDFcivQALpBf2mOu61lf53lXLD7NaXvC65s=;
b=bgLhgynRYJXCbIemWLbGKSD0JM+LwkgiES6QeIwuoM8N659Q4sWIZMPLOsMlaA/9/U
enBFcl0aFNzt31BPfVMt01cuNZdThraBCOfVipYOruONQ4fryUetYvet/H7ZrPoMPbiU
diMeAPTrxOpTW6g5xLXp64KAfB2+iiy2/+IPM=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749207763; x=1749812563;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ahRtYL+8yDFcivQALpBf2mOu61lf53lXLD7NaXvC65s=;
b=Ii2u9oh5LLcVV+b6soF3kqDh7QNVwab0dPb6RHPpJm2xZehxrjg6tCYnRVpjVy1SSP
2/33GJi+tUw3Xz467ZIfhSYdXliH4wa/zRwhLCO6g2SwjC++f9g+JjfWk6B9Ly+1eZ0z
Vkg7LeH+Gkz8mrtz5h8YDIGNUoDapcRx8fuVso/b/cQ2GV/jcz6a+jZ/J6YDig/2fwOw
VDhQx9bB1tJVk8mI66RtKz/yGcnFXBPhuCYKU5crNq8tk8NXzyyoOS4YITxKfElbblPJ
r+8dZDLFU4RivF5HQzlLgiliWUL8ejANVodPKUfPA5ZC0hZLTcdbVIRqT8hILU2ufqFm
MxlA==
X-Forwarded-Encrypted: i=1; AJvYcCWyT8s9VdOG1wbkYDvt8AoOTKeYJNPbkSVk+ve2iKX4qLCp0X0icW+E7IdyRmKojAMRW/5LnROkF7tfZZ8=@vger.kernel.org
X-Gm-Message-State: AOJu0YxARwRyLMCEm/DDtH+ciotNxc9Tpzv0aHjk2+QsNuzNckdXd9i7
Lufvp8YoPMpUCTVO42O5BFCDsXLXjHfwHuXA6zoyscyMFvRbOvRMdPLNBwQdr8bNBiX6M/qBzZC
R6P41pqHtPmwN2XMys2793I+akG1KN/762mUp7dQTyw==
X-Gm-Gg: ASbGncu7HykxWUPVPTq9eDwfPQHw1hgYP5LWshWAfwcBKPx3185vP3s11wQ38X4Ksps
SKaE/voJ39qlm1FRvq0AdsAP68Qhy+vrxiHqyOKLumhfd4tqPmoUH+EFE3AkuapY1Aj5+02+Rfv
VCvxXDo7nQwnHjRd0QCv9EsGdNJ+7OBrX75g==
X-Google-Smtp-Source: AGHT+IGPzGcL995Ml8WGyM8F6pt8IT4FINGEryh/hRSPtX851l83sDh2GRSHk3nE//BpH0WioFvDwKZiue7AzRpCHR4=
X-Received: by 2002:a05:6902:18c7:b0:e7d:ca03:4474 with SMTP id
3f1490d57ef6-e81a21c56b0mr4251268276.36.1749207763644; Fri, 06 Jun 2025
04:02:43 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250602053231.403143-1-pavitrakumarm@xxxxxxxxxxxxxxx>
<20250602053231.403143-2-pavitrakumarm@xxxxxxxxxxxxxxx> <fae97f84-bdb9-42de-b292-92d2b262f16a@xxxxxxxxxx>
<CALxtO0mpQtqPB0h_Wff2dLGo=Mxk02JJQkK4rn+=TuScNdSfxQ@xxxxxxxxxxxxxx>
<3570be5b-cb20-4259-9a9b-959098b902d0@xxxxxxxxxx> <CALxtO0mH=GwhQxQBsmMQYd+qgAue9WxXN1XWo9BncVJvJk6d8A@xxxxxxxxxxxxxx>
<cd6e92af-1304-4078-9ed7-de1cb53c66da@xxxxxxxxxx>
In-Reply-To: <cd6e92af-1304-4078-9ed7-de1cb53c66da@xxxxxxxxxx>
From: Pavitrakumar Managutte <pavitrakumarm@xxxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 16:32:32 +0530
X-Gm-Features: AX0GCFsCPqpKREAd4CvP0DqZO_E5hMC88EBV6qNiDOowkNyZIs0O6qWj-K7X0KI
Message-ID: <CALxtO0mVMTWqidSv7LQSQd-rA_TmJy_0xgBSd=mP27kg=AXQRg@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 1/6] dt-bindings: crypto: Document support for SPAcc
To: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
Cc: linux-crypto@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, herbert@xxxxxxxxxxxxxxxxxxx, robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx, Ruud.Derwig@xxxxxxxxxxxx,
manjunath.hadli@xxxxxxxxxxxxxxx, adityak@xxxxxxxxxxxxxxx,
Bhoomika Kadabi <bhoomikak@xxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Krzysztof,
Appreciate your inputs and feedback. My comments are embedded below.

Warm regards,
PK

On Wed, Jun 4, 2025 at 7:37=E2=80=AFPM Krzysztof Kozlowski <krzk@xxxxxxxxxx=
> wrote:
>
> On 04/06/2025 14:20, Pavitrakumar Managutte wrote:
> >>
> >>>>> +
> >>>>> + snps,vspacc-id:
> >>>>> + $ref: /schemas/types.yaml#/definitions/uint32
> >>>>> + description: |
> >>>>> + Virtual SPAcc instance identifier.
> >>>>> + The SPAcc hardware supports multiple virtual instances (dete=
rmined by
> >>>>> + ELP_SPACC_CONFIG_VSPACC_CNT parameter), and this ID is used =
to identify
> >>>>> + which virtual instance this node represents.
> >>>>
> >>>> No, IDs are not accepted.
> >>>
> >>> PK: This represents the specific virtual SPAcc that is being used in
> >>> the current configuration. It is used to index into the register bank=
s
> >>> and the context memories of the virtual SPAcc that is being used. The
> >>> SPAcc IP can be configured as dedicated virtual SPAccs in
> >>> heterogeneous environments.
> >>
> >> OK. Why registers are not narrowed to only this instance? It feels lik=
e
> >> you provide here full register space for multiple devices and then
> >> select the bank with above ID.
> >
> > PK: No, we cant narrow the registers to only this instance since its
> > is just a single SPAcc with multiple virtual SPAcc instances. The same
> > set of registers(aka register banks) and context memories are
> > repeated, but sit at different offset addresses (i*4000 +
> > register-offsets). The crypto hardware engine inside is shared by all
> > the virtual SPAccs. This is very much for a heterogeneous computing
> > scenario.
>
> Then maybe you have one crypto engine? You ask us to guess all of this,
> also because you do not upstream the DTS for real product. Any
> mentioning of "virtual" already raises concerns...

PK: Yes this is a single crypto engine, maybe I should have detailed
that in the cover letter. I will fix that. And what I have pushed in
the patch is my complete DTS. It might need updating depending on the
vendor use case, which we are committed to support and maintain here.

>
> Best regards,
> Krzysztof


Return-Path: <linux-kernel+bounces-675645-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 13D2041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:05:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id E2EFE3A4771
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:04:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A26612857CB;
Fri, 6 Jun 2025 11:05:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="rBWUJdTO";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="FlQzq94u"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 D4EFC17E4
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:05:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207911; cv=fail; b=Mc7e7Hr5z+NaLwXdsnsDiPdHK4i8tL6oCa3QolCXQRNLF1Dodw/bhj8E2U+QVXbxDcuGIkd3RpDidAv9gdVTOeJ3oWpffQ+U38bOtfS6fPgWn7Ikq/jJ1HLiNddAQgoLWokradqOsgUs+bBVv0loAeJY6Qcfe+iSlrjJBYX2CUk=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207911; c=relaxed/simple;
bh=eVGQ6sjCTkwi91ChrYELA4ArxJkBdwdilbDAaTJ7Q7o=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=t4mH8QS7IlIpBNIea11epCtDizjYWN4hn4dmzvPuIbffTqnypNlqJ+qDm3qNlB5QH3xoB7/UMDsuO6/WWKYWUsqmuWpygLUbqRRql5sGGVkXNPr8imMQ/doodUKq743YnG60X1tyBDjDYp0YrWoT7FPEUOsBi6jPoZW/nvZdCtI=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=rBWUJdTO; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=FlQzq94u; arc=fail smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246631.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565OMxu000307;
Fri, 6 Jun 2025 11:04:56 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=eVGQ6sjCTkwi91ChrY
ELA4ArxJkBdwdilbDAaTJ7Q7o=; b=rBWUJdTOPLRF+/irW2PCI9vX6OppsSA3OT
oeS3gnX+mz63RuejRaTRqERGrgrgl3JxiEQ+66u8Pv223Wlm1SvqO/jIrLgOCPI3
eUvUjHS05d755lYDW18m0l+VvkaXbyVddCQIFIO89xuuiKWwED1hbqbY/j1JkVI5
acZvs//iS7FJlhrII+lntO6yozWj/pioRjJTm8EG9Bzn6RKH3Mnx5rICmzsSCrsS
+0KAHWt4b00IcrA/Hgh1iURfPzaqt8+yzHJc3PyILn2/2p1dtmK+Txlwe2/S9p1j
VJ4GIuvuxZFLiNLdZMnB9/W1yxzrWc7WKcjTUAXB0uNBySx9siNQ==
Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8dytxa-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 11:04:56 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5569vhPP034987;
Fri, 6 Jun 2025 11:04:55 GMT
Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10on2053.outbound.protection.outlook.com [40.107.93.53])
by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7ddr29-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 11:04:55 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=loiEqeMzNrr+ClHtLZ5PlGd/DMuehG5JLc9xtTbvOkQRppKxTVvpF/u2duRHbb6YgjOduRZRJMSlMXr50+wIarY5Kywvp+INKLLnmN55J1d7JGuIsB61vdpGVBpkw9Jp+fVd1TYRF5EdFp+NrdWXB4lnpJ1v//0eN6xBQm0MyKdNWTY8x3Py5kXJLbYyDkfftSz/qna5zoBZzb+pJkQK71CeOoKqe8Klt+FPly/I+5fNgNjH+qo6azie877oiE924EFlCoVW7RaOGNFEcUQMGPwf6pWmcZlN77xQ/FmIIF24m+esFKV7/eY6E38Z6v+0sCIpqwVisMgKgyptEy35pg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=eVGQ6sjCTkwi91ChrYELA4ArxJkBdwdilbDAaTJ7Q7o=;
b=bnPT5+2dvfEbLB9MzF3o0Ss8BsySR/lMtA8urzVK6HQtvt6z1uDrapeozbWoN7ofAEn0n6gpji6NtpzAmbRf+fQt92xXK8p4c7I4cADdPJ8GwsbimDxjp3opPUj6YJHe05iyU0n6smVaKXzA2SnOEt14bF4UKbfXRUbO65o/05ccuEyg5CtFyvhYblvvmgrlo2NXW3ocqE4Ysf3pAlH+fv95pjnr08rlOd6OxXQM96LFWRGvI9/y9iE88LUWEGGm5Zjh07rdeYB2xn/1sZyd7yHiAcCa9kyT2to52RwIOEQaqdNqvP55Z0uvdIgHFqO4refK4Wr5ST1m4BQEHIQTWg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=eVGQ6sjCTkwi91ChrYELA4ArxJkBdwdilbDAaTJ7Q7o=;
b=FlQzq94uIyKHXi1ErDYW/YtMF2JP8oydWJSQItHqgGA+BS19ipHreNDVLw+I424zIGHDH7HSXfxF+9/yjXY17XvQuIbuhU6+ratGqUBqtWAUtWfsOSvQzptlHAMxixJiAK7Ydzn8BimbDthPh4CzF0CG1AlHAixMsRHSEe9mU1U=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by CYYPR10MB7570.namprd10.prod.outlook.com (2603:10b6:930:c0::5) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.41; Fri, 6 Jun
2025 11:04:52 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
11:04:52 +0000
Date: Fri, 6 Jun 2025 12:04:50 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: David Hildenbrand <david@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>,
John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
Message-ID: <1a7513cf-4a0a-4e58-b20d-31c1370b760f@lucifer.local>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
<50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
<e5fa4a36-2af8-48e9-811e-680881c06b86@xxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <e5fa4a36-2af8-48e9-811e-680881c06b86@xxxxxxxxxx>
X-ClientProxiedBy: LO4P265CA0226.GBRP265.PROD.OUTLOOK.COM
(2603:10a6:600:315::7) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|CYYPR10MB7570:EE_
X-MS-Office365-Filtering-Correlation-Id: 40f99689-6ced-4110-453f-08dda4e9f684
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|7416014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?M8F2rOtg9pRWyW0jJaidMARQLfYhi+dGAuiRtNjT8KHlcJAjrLRoeth8c+I+?=
=?us-ascii?Q?+92NaOZOmvXdnpQHaUB7rRxJ6fwnkaPKOJR4041G0fVlr4aOfLqHM34BY76/?=
=?us-ascii?Q?8v3YjM3b1TF1Wx4c2tjw9+52o2B7GVczK42MVn+xeXpJj/KROOfEER93w+49?=
=?us-ascii?Q?tKU1NY0+TO9M6PAdH6ctkjI2zce6vIlJGYWIC2q0hEU4HEsKWCU1vW+e+Bov?=
=?us-ascii?Q?nRiJtCuqsrlcvAZ0kSZZrfR/fmWttZpSccMEpy7klEYANWAgOaGQPSRnEOHR?=
=?us-ascii?Q?kCYKWIdB4e/uY9tgYzdqP/GkpC9uurWv1UyA5fX21DzfqvQK+RthOgK97x67?=
=?us-ascii?Q?nn9kvEEl+n53/FFlSTwxAoUWZ0P/NAa8kPnAJa9mFgrIG33fFckJugtqBStB?=
=?us-ascii?Q?bPPsJhDieh51kYPs5Jfb/cfqu0mhQNio+eqqZZSBnT8mMmVanHm+qmeDQNf+?=
=?us-ascii?Q?3HI55YdWIRWr8ffxt1cjd7Vwi02K0kcd1LeTOA+a9qoeD6dcWs4NQvV0rDIt?=
=?us-ascii?Q?UZlCEUrQVa2SFTr+6IuKsZqVW8fvHwaSZKmL5f/838PFkbf8BLNKSgWCd47T?=
=?us-ascii?Q?06CkI4rvzPSswkOaU4OfNX9AzRkQsfR3pZPWkPwiTY4VNrdyowBxZlGWy6fJ?=
=?us-ascii?Q?VrVc2iuCi6qePRTuK72VW++Ew2ziLSg4qENhGEm/vSzBGG1BxaGsqi9tSMf5?=
=?us-ascii?Q?lC9fN0fZRPaUGTjg4qAqYdM8avGY3Ikzif5NKucTWGctJl5gzdB4NwpBBQeo?=
=?us-ascii?Q?lWR3NiD/9c9PndPxpVdAEbNx5WsJftHdyNxkw+xlbBHon7KmDQQbtOVqduzM?=
=?us-ascii?Q?2kwcl+txbwBDmjXZ4KtAAf4U+WaHp2mq1sQAfrKkdnacZT7iO+3MCUTlakNV?=
=?us-ascii?Q?edBe7ZoKPFXJYasvxMxdVi/nMXChb2qn68ygGF5YdBoo1AZKO6qDWgoohTgB?=
=?us-ascii?Q?nXPIt0r9koqxXO9uQSkDpnqIrQWXS8nuEMb3mACevgfGvrORITsNsxg+3tO1?=
=?us-ascii?Q?42tbs/HiumrEOTRCVfhGIPa1qe9D2ik7//xaYeN8z1quJGmEIpa6xog6TqLt?=
=?us-ascii?Q?HNe1DKYpY7vBjdmvX+q7y6Lyl73KARFFFsYFcpLaMFwH+ulWjTlZ89iTaLWm?=
=?us-ascii?Q?FxKTbe860Zs87Ei0t3zJzgOOtYMUi5Zd8X0dVUkQs2psmCE2DI1vwl2SqO8M?=
=?us-ascii?Q?Q60jHepffhc2uuEgBjRya/iXdlCiWVRjGly47jx7PnN0Jm62vL5yGTlqJ5OC?=
=?us-ascii?Q?zpMvTAB8TIVBJhW2zX483+KJSQ3bwM+fWUMf36EAbqKINmhnDVtrUGB9e8kw?=
=?us-ascii?Q?fxd/i4dGKHFLvKpX6hh+/okx9H449TYNfA7ty9XEkSP8vM2oS480nLWc02+G?=
=?us-ascii?Q?z/v3HaDQxPVHAWqS4vY3vjQLlIDzMS/dgP57fSNIcmSpxo7WDR142CvE0goL?=
=?us-ascii?Q?rxZzX8QswhE=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(7416014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?jCUvrmT32v+1XYoC0jB61FAQbLdvlRThQ6Jx+dmXDJUERWi5cgAFPKXDcxzU?=
=?us-ascii?Q?SJx1Mkz3V560ezc4bqpJkCusYuMB98v56og6g6j38qE67V7NpB+dcfaV1x+X?=
=?us-ascii?Q?CVJyWk8JoIolVosPvEtmqR2w3f9uX+Rkl8Nthx0QFxjFytIOVuwzUcQox00R?=
=?us-ascii?Q?XBXMe2YVbgNYottCHQj0Xm8y2JEMq0QxwPVdjzb537b0dZTgY5xVSQTPJjFL?=
=?us-ascii?Q?LnzOj1MOZMvHFiUeb+mNSu5gtOqlE80F0jmEaExZhQGvwf/DhWkhFuVHWc3Y?=
=?us-ascii?Q?fc3ASuG0V1t2TMt1SzT86JPlWVKFTQl5KprUojgBkYv8N2ZdQmv3d4SfjudA?=
=?us-ascii?Q?ijnxmq4R4yR3zuDWqotj2U6ibYcGh6bSOHODnF7+4VCjmcucWQFwKOcq8EUj?=
=?us-ascii?Q?OJiuGqXRSZ5dJx0TB/FyO4ThqCZsAjTy2tlA836pPVaPkGvz3BkIDVDDHpIA?=
=?us-ascii?Q?5nwBRP3DEMsICD4EWPzEr7FEjSBlt60dKu/iKyBbnQo9kBEjIyNTKGIQFS51?=
=?us-ascii?Q?FilUWRjgMOovC0A8t0FnRGo3ECOEKJyp17klCtgSCR1h6hNPgc1fUP9V9ZUS?=
=?us-ascii?Q?ugHRhqlYWEkkh3IhrnLkO9h4gZvLCjbYBHQrgibJ9A5poqnUv3zGH9CrfbSH?=
=?us-ascii?Q?tJSmJ2lK/OgOc489Oko2We+2rGkHeejIjNVJFhTUEmlo6wLRWhytA/reIBb7?=
=?us-ascii?Q?nsm8ShjKnLOpq5jjQQ4ZkRLu3gKB0H8erZ5g6um/wrAGAcjKOeQ0J2MDBwaa?=
=?us-ascii?Q?QZ1GLoX9cpfD0mh4E8BHDb7J21IM8jg3RF+AMirPMJ1oYBhwr1XkJwBa1sKt?=
=?us-ascii?Q?AvginRS9yxiY9NCU99Uh2O/UCp4mwrpBMlVvAVZ2c2nvrUK5/bKFzLl8BT1P?=
=?us-ascii?Q?4C735yjEPL7iI8myrBm91GGDS6DvjXVkymvXbj5cyTKFPAEWNmHcKXk/tQyQ?=
=?us-ascii?Q?XMGKqEjnsNMLoLE5YbDfDkZG73TDOTsNp+opqq43ZkzGXYfH8kEH5r1ex38u?=
=?us-ascii?Q?Tit0cCVGwcK6mxaTe5GeDd/1/6xZWL3HxqWIT7/R4vDAC95jqtMIKLVNwO2H?=
=?us-ascii?Q?cqNxhAckJw2xI7E4+3RYF/eLmX/yeInNZpMqIzBiQEHmfJHUNpTdF5Jtf4d/?=
=?us-ascii?Q?eBSNshOZ2+4IGD08J2M7Aov4kq+adggUpMH+SGA5pAEotgpPSjITvb0KksRn?=
=?us-ascii?Q?6RPQpjjoYEFCWFXhQXwtMgD+PBxLzNCcCD1IJSrKxaIsAiWakmkhNIMnqPKe?=
=?us-ascii?Q?oKLzkrTYen47nEt47zw2g2WxwEQhH2FCJaroc3/9jBZOFWYC+8Q0SPKu7NTC?=
=?us-ascii?Q?SuQq0Z5UxSogKeugrXy3L8Fm5OhcTTQS8jHKnuFBcMHVpKHy165pyO1klvCW?=
=?us-ascii?Q?Zr+lDyt+0oyEJBt9C6/gW/CsP72+k805dxptBBwkHLNdB2PUgW2gYPvGLOYP?=
=?us-ascii?Q?5Ra8WxxxqwzL8fyDcmRcQ27R3V9hVyIP5h1RtC8ZBFBkLAQC0MEhdWTasA8P?=
=?us-ascii?Q?bcvjDOOEUSvvIIsqfyouCe112gqJuXN8NuRm60qQiOuHSBJ/bI7FqCPUdvrS?=
=?us-ascii?Q?FtvGwpYrXrptgOxybdZSmYKOGsy2UbFkOi81ULfZK1zLulgzlVB0KkxDhgie?=
=?us-ascii?Q?Pg=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
o06h8QpBoaT5HCWIjUClsEK4szdTrUXASl34VmDml0rs/mzpNVVHR9Vns9QvGwFpP/0TBvGJsMP0hSPvLC54yHtw3a+pwy7TYFOgvVMjaUvKoioEEa4c6uCgqaCm0uB+sOhzCM5G0pUJIjQ8ipWogjgHAtwW1oBWXYOAPqkzOWZPqJ7RM67rVfGO+/HxYGwyCdc6rAi4Z3npt5HmmEC/raqN0fY7EmHAbYS84jtxYHGnWrDwNqReybkmg8fPrJs1rdB63BDJGWJXsmhrQ7toMjwT23QimGd1gJDnveJPL1sODVpbvzIF3GB0P2a8EyC2mtE0flF6HVliMn372qguNtzyuu4MK+TgPB+G0kl1hnJTxI3P4dLU2jrsj9UsesN1lOrxHC8h4cB9IEUjdvao/LDalaGKzbKXOLPyxWrOHz/jqafolf0eqB/vposuSpDnX3D1kdt9LLtvyY2g5opLbURxU1phbxP1prEH0bBOc/YHrTY8gOGP8bHs1Wx3IhVr6+TMiNQEwbM4yqfDp4Rmo0YqPD+6OqgwxXvaGsw2DkfPfrSXNtekEqqnrp6CWrZ1h9xBg8ZbmmKfhLVk7UVYfYma4CFpTilGAHs1rFiUiHA=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 40f99689-6ced-4110-453f-08dda4e9f684
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 11:04:52.7650
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: LTeTkF6l9EdHWtYB0/2bSEZ9z/oRw/K9KXIfAs88YG4/75shvI7HmCnyWOOmkv3hva6BStzs1T++n+dkSQ3T6YEfrSB03bh2249kahjFsh4=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR10MB7570
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=569
bulkscore=0 spamscore=0 suspectscore=0 malwarescore=0 mlxscore=0
adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
engine=8.12.0-2505160000 definitions=main-2506060100
X-Authority-Analysis: v=2.4 cv=Va/3PEp9 c=1 sm=1 tr=0 ts=6842cb58 b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=MSJSkyAJlKp7O0UAvdIA:9 a=CjuIK1q_8ugA:10
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEwMCBTYWx0ZWRfXzMRJefRxxyfh N/blydEhIXH4vKvHqIHpU/kxcg8RDrn5g6uqDjoO50wii2OPfJep4v9y9SGQmDsvlcAGFimDQBN syvYq2mziMcl2LLRzixWKpnoCQDjpeNKJiyOlU4X2GGWtp/H7OL9pL1venUquhHuBacxmJgpyxj
2bzsnr0uzl2KjsEU+gMl+Wagvbw7brZdF/EL/yj/Lw/i+j7q63FJ3PKqz0ilxagRT3MoqRCn9tA 7ya1Co9iPpSAL9N1SxiOTWAM4ityc2tQoth+Zfb3HfGtrF3VaDARMEz6BcH2U9dh8BvPnZ2If99 7UUA9rjieHSGaK4fW7rT6z19pBK7h4RAakOAl/6qoWrTdqeYc6zx7LX1TDlZWjYggRlF03Jwn9/
4Z/C9t4A0acDI/XZ+Ygu0528f4N+MJtKmRHq5ILSgxaql3fntp15ZzMSxnf8bShYE4s6eTmo
X-Proofpoint-ORIG-GUID: gSpujZKzEcmNoKXCcflr2yJFmXE-0oS9
X-Proofpoint-GUID: gSpujZKzEcmNoKXCcflr2yJFmXE-0oS9
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 12:28:28PM +0200, David Hildenbrand wrote:
> On 06.06.25 12:19, Lorenzo Stoakes wrote:
> > On Fri, Jun 06, 2025 at 12:13:27PM +0200, Michal Hocko wrote:
> > > On Fri 06-06-25 11:01:18, David Hildenbrand wrote:
> > > > On 06.06.25 10:31, Michal Hocko wrote:
> > > [...]
> > > > > Turning them into VM_WARN_ON
> > > > > should be reasonably safe as they are not enabled in production
> > > > > environment anyway so we cannot really rely on those. Having them in
> > > > > WARN form would be still useful for debugging and those that really need
> > > > > a crash dump while debugging can achieve the same result.
> > > >
> > > > One question is if we should be VM_WARN_ON vs. VM_WARN_ON_ONCE ...
> > >
> > > *WARN_ONCE ha a very limited use from code paths which are generally
> > > shared by many callers. You just see one and then nothing. Some time ago
> > > we have discussed an option to have _ONCE per call trace but I haven't
> > > see any follow up.
> > >
> > > Anyway starting without _ONCE seems like safer option because we are not
> > > losing potentially useful debugging information. Afterall this is
> > > debugging only thing. But no strong position on my side.
> > >
> > > > VM_BUG_ON is essentially a "once" thing so far, but then, we don't continue
> > > > ... so probably most should be _ONCE.
> > > >
> > > > >
> > > > > So while I agree that many of them could be dropped or made more clear
> > > > > those could be dealt with after a mass move. An advantage of this would
> > > > > be that we can drop VM_BUG_ON* and stop new instances from being added.
> > > >
> > > > As a first step we could probably just #define them to go to the
> > > > VM_WARN_ON_* variants and see what happens.
> > >
> > > You meand VM_BUG_ON expand to VM_WARN_ON by default?
> >
> > Sorry to interject in the conversation, but to boldly throw my two English pence
> > into the mix:
> >
> > As the "king of churn" (TM) you'll not be surprised to hear that I'm in favour
> > of us just doing a big patch and convert all VM_BUG_ON() -> VM_WARN_ON_ONCE()
> > and remove VM_BUG_ON*().
> >
> > Pull the band-aid off... I think better than a #define if this indeed what you
> > meant David.
> >
> > But of course, you'd expect me to have this opinion ;)
>
> See my reply to Michal regarding keeping VM_BUG_ON() until we actually
> decided what the right cleanup is.

Sure, but to me the concept of VM_BUG_ON() is surely fundamentally broken - if
BUG_ON() means 'stop everything we're going to corrupt' then it makes no sense
to add a '...but only if CONFIG_DEBUG_VM is set' in there.

So to me the only assessment needed is 'do we want to warn on this or not?'.

And as you say, really WARN_ON_ONCE() seems appropriate, because nearly always
we will get flooded with useless information.

I think this being debug code gives us a lot of leeway here.

After the big change, we can always revisit individual cases and see if the
warning is valid at all.

>
> I don't have a very strong opinion on any of this ... as long as VM_BUG_ON()
> goes away one way or the other.

Am happy to come up with the churn-meister version of this patch and take the
heat :P

>
> --
> Cheers,
>
> David / dhildenb
>

Cheers, Lorenzo


Return-Path: <linux-kernel+bounces-675646-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6A0D741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:05:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id A491916D079
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:05:42 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C8C428750A;
Fri, 6 Jun 2025 11:05:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D0XLWXkv"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 539C217E4;
Fri, 6 Jun 2025 11:05:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749207933; cv=none; b=Px6L+jbpRTPeY+c8+Xa2ehHbkh0TdPeTMPT4vacPhXRdOj+OccheNfcOwUZx9G2t4FfG0mrxMG9ha1FSPddxzkoybGxNXrgEMLTYMvunTVfGnBbMgX7WH3KW37s65Gh8A9ikwpoE5ob9vwPyLMSTPIKOy3GzlDxy01N4WpeJ+HA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749207933; c=relaxed/simple;
bh=hZBSXY9Vfts7VOCEcp7eKY+x8Ag3TrY9gexhqvO72E4=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=L2h0bbqbJlGyeYKKZZLU62xfXnyNGN5d/22U9UpWmuXdPdwqEtMyN1DY+QsPgkXexR+KF8qwObbDCp+iusQZ/vYK+flFXm8mvJtgODN9MQHyWyVS3C5bCHx7dIQke0M1BsQ7An7v6TGxjGsSeyCuox2JLwG97M5cktXUewGPqpA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D0XLWXkv; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPS id B2A2BC4CEEB;
Fri, 6 Jun 2025 11:05:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749207932;
bh=hZBSXY9Vfts7VOCEcp7eKY+x8Ag3TrY9gexhqvO72E4=;
h=From:Date:Subject:To:Cc:Reply-To:From;
b=D0XLWXkv5j8Ur8ZWqDST4zOCU0ME19lj286d89dSz2jrO6PtapqMJ7MF8IR52wMGB
PzMEM7btO1gvNqTOhdNJvf+VaVXUwikHnn5Q2HDTMsjmS2AU236MyFTCgrMz0owxxI
QmwnuK0xYXqbrnMRHSNhdRWqjagddIKqhOyiXE8Bq7xzcedw9z4YqdhvAARrrVMjz5
ioXWICmHiuci89rmImYvv80nmzrFRr7c5ylUCBYuGg/+8ZWdoXxjHwbqEWyVoiS0Nj
iw361LGk2oITDR+P1L00SCfNHP5t70JVikd15dS7U4zB8cVkqAJsipzqZpvjrXDfoI
MnlJ7Y4Cfwxhg==
Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1])
by smtp.lore.kernel.org (Postfix) with ESMTP id A1CAAC61CE8;
Fri, 6 Jun 2025 11:05:32 +0000 (UTC)
From: Max Shevchenko via B4 Relay <devnull+wctrl.proton.me@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 14:03:51 +0300
Subject: [PATCH] ARM: dts: qcom: msm8960: use macros for interrupts
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-msm8960-irq-macros-v1-1-03e573ba26d6@xxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIABbLQmgC/x3MOQqAQAxA0atIagOj4rhcRSyGGDXFuCQggnh3B
8tX/P+AsQob9NkDypeY7FtCkWdAa9gWRpmSoXRl7byrMFpsO+9Q9MQYSHdDP4U5NFVNTAQpPJR
nuf/pML7vB7fCB+pkAAAA
X-Change-ID: 20250603-msm8960-irq-macros-6dafa735cecc
To: Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-arm-msm@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Rudraksha Gupta <guptarud@xxxxxxxxx>,
Max Shevchenko <wctrl@xxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749207931; l=1869;
i=wctrl@xxxxxxxxx; s=20250603; h=from:subject:message-id;
bh=l1evEWFE+2Uf0Gr0r6+BEZUpSHC16rDD8Dp6L4gRpfc=;
b=iXp2CCnLaRMORs4EWNbaiKAzYZqjClpnHL9udO16ISe6xbWYOTjTHMcvkK0RQ7eu2tV5lZumC
AxH6g0l/f/sCI9FB0bbAtIGTHQDFnd44Kpt1E8qadSy7WMFfoM73DdJ
X-Developer-Key: i=wctrl@xxxxxxxxx; a=ed25519;
pk=JXUx3mL/OrnRvbK57HXgugBjEBKq4QgDKJqp7BALm74=
X-Endpoint-Received: by B4 Relay for wctrl@xxxxxxxxx/20250603 with
auth_id=421
X-Original-From: Max Shevchenko <wctrl@xxxxxxxxx>
Reply-To: wctrl@xxxxxxxxx
X-Spam-Status: No, score=-2.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HK_RANDOM_REPLYTO,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Max Shevchenko <wctrl@xxxxxxxxx>

Replace the raw values with macros. No changes to the output

Tested-by: Rudraksha Gupta <guptarud@xxxxxxxxx>
Signed-off-by: Max Shevchenko <wctrl@xxxxxxxxx>
---
Replace the raw values with macros. No changes to the output
---
arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
index 865fe7cc39511d7cb9ec5c4b12100404f77e2989..13572d0b1d5572cc5b9c3a136a6ea6267b8625da 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
@@ -18,7 +18,7 @@ / {
cpus {
#address-cells = <1>;
#size-cells = <0>;
- interrupts = <GIC_PPI 14 0x304>;
+ interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;

cpu@0 {
compatible = "qcom,krait";
@@ -54,7 +54,7 @@ memory@80000000 {

cpu-pmu {
compatible = "qcom,krait-pmu";
- interrupts = <GIC_PPI 10 0x304>;
+ interrupts = <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
qcom,no-pc-write;
};

@@ -107,9 +107,9 @@ intc: interrupt-controller@2000000 {
timer@200a000 {
compatible = "qcom,kpss-wdt-msm8960", "qcom,kpss-timer",
"qcom,msm-timer";
- interrupts = <GIC_PPI 1 0x301>,
- <GIC_PPI 2 0x301>,
- <GIC_PPI 3 0x301>;
+ interrupts = <GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_EDGE_RISING)>,
+ <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_EDGE_RISING)>,
+ <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_EDGE_RISING)>;
reg = <0x0200a000 0x100>;
clock-frequency = <27000000>;
cpu-offset = <0x80000>;

---
base-commit: 0ff41df1cb268fc69e703a08a57ee14ae967d0ca
change-id: 20250603-msm8960-irq-macros-6dafa735cecc

Best regards,
--
Max Shevchenko <wctrl@xxxxxxxxx>




Return-Path: <linux-kernel+bounces-675647-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CE6BF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:08:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 2FF26189B720
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:08:56 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A10EC28688A;
Fri, 6 Jun 2025 11:08:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dcO26ECX"
Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 258AC2045AD
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:08:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208114; cv=none; b=rsnLKnZGlxVuLY2DicwRKcLXIGc2rjAtGXea1d/ZaXkVlxvQ447CGQaLdu9CL6wSYiX48f6fg41LRci1QfoSp5+30ymUxvCSIr+OryAGHbdjaPgOdTy8Evnn/2nkR2tqyW/861hDRIeHZ9uRWUnCdAABa9h7jI5z2mh2W9Ha5tA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208114; c=relaxed/simple;
bh=Y4anki7ievT51LDNzPcc4VRYYKJbQ92qMIXRtrgKf3A=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=d+5rrUi/V2m9vnHPMH4SHFuRlvAc73FUURckn8PgcrQqClFKI8nlXzvPD8Hr74IE009PcchuxGiM4Bpt1hoHddy27ksTPGg61UeTfZiLApoXAiXjlQzpiAJtTaFp9pQVy6mLDzhX0cY8+YvdCEpgzwt1irtPmj50DyUB2hE/0AY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dcO26ECX; arc=none smtp.client-ip=209.85.208.53
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com
Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-601a67c6e61so9793a12.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:08:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749208111; x=1749812911; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=S4QshsNtFlBM5Nr7CIE3i+/CEVwa1E3Te+i573d46rQ=;
b=dcO26ECXCpZNt4viTv5JfnMWYrKTqdyN4jCCmVOn9amJXHqFjgPsNyCvRLwBgrInj9
FoLET5s0zQ8Fj+GKTlMJb+ilDWiVFjt3CLiC4dkRqHc+MRqLXL+fLGsQ6YIm7FSmnJna
Ud219K+iYm+ftp5phB35TIoTeYwyw9PHdVRJY/AcFqDDOc7wQSkvOSd7iR3x6nfr5HD8
i5ndNZapqTLj4dqmWErHokCoLeG7TISKLI7wIexoiO210Jcheu7L05MfGhjHpfSB6UZP
bGHRo43I6yFBZ84wW8RvXRs1MWA+WB275z+ekq6bKmJRltbuYVnFhCUudJB7QX2OtXmz
GOHQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749208111; x=1749812911;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=S4QshsNtFlBM5Nr7CIE3i+/CEVwa1E3Te+i573d46rQ=;
b=N3ebW9ejNF/wFni5a0qDyLqOYN0rAwT4DKawQPNV4f/bzXaR7OxcBa9xy/5UC+JYSt
22RA3Vd4lR6NLqvidDROU4PEZbYvS6BbjiO41zLWGZet6m1w41x8lxEmGo2gkqd7eSyq
4Gjqz0YOBegc5CLfQxdJByN0b1fGo1SxtymeSStIgAoE3fUbbFjDKgsa4ssERHyiFNQ8
FMdxw+WXAFKCagL2Ol1ujsOy7zDMoX9ycgPTyXNhPXM1gpdMSD8Ahv0gGijdB9ZiPycr
3mVHKoLoSaCaHsXwLsfWF19F6aVbRSTZvCzhHKV2QAiJpyxh+HxrforLRhJ01UxOA/Js
X6aw==
X-Forwarded-Encrypted: i=1; AJvYcCWzjCwJwgA4knd7Vgi/nnf0HsPRHcOAh8tcW3m3B3j2pZvtbpI+Pv/Eg7LgoUzU0muP84H6qNrYGnx6/P8=@vger.kernel.org
X-Gm-Message-State: AOJu0YwUGI3sTUnGF+ncx6iGmSIlWZ9t1G10FPMN+OZsEwQBComfWH58
jbUG6/1R8romv49m+eGrOe0zducOjEA2Skd9eYplYQpZYhi0YP99EhyNqHVUnRjjy3spI824Lh6
uMEzXps5I1EQAKg84t+mA7Hcv96ZqSO1xQS7k086p
X-Gm-Gg: ASbGnct77FHTDEGHtCSlaSieGiABo05zoy8bt0+vUc8B/DJTvW34GHrOSeBqbTbWNa2
Rx2D+zcW4TWPD2rbcKkupuOEv0jvD4GRpjAn/v+2P+rOvJcUJD2rJCD7jG/TfxLN3Q4DUJrcxXe
4cu97nLDJfZwtavwVJuKzvWISKVoiYltYy9WQOHqogdFzE2u/pyNK6ZW7fzcBmETUxL06aTg==
X-Google-Smtp-Source: AGHT+IFzJK1PmF+ubahnyn3+Q756t7KJvt+rp8ZMsFN3/mcorsJT8TiEEZKFL71ZKG4v26uGjEh+iNVgLntRQ/Zd8tY=
X-Received: by 2002:a05:6402:344:b0:607:2070:3a4 with SMTP id
4fb4d7f45d1cf-60773ec8ca6mr84433a12.2.1749208110975; Fri, 06 Jun 2025
04:08:30 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250530104439.64841-1-21cnbao@xxxxxxxxx> <CAG48ez11zi-1jicHUZtLhyoNPGGVB+ROeAJCUw48bsjk4bbEkA@xxxxxxxxxxxxxx>
<0fb74598-1fee-428e-987b-c52276bfb975@xxxxxxxxxxxxx> <c6dbfb68-413a-4a98-8d21-8c3f4b324618@lucifer.local>
<3cb53060-9769-43f4-996d-355189df107d@xxxxxxxxxxxxx> <c813c03a-5d95-43a6-9415-0ceb845eb62c@lucifer.local>
In-Reply-To: <c813c03a-5d95-43a6-9415-0ceb845eb62c@lucifer.local>
From: Jann Horn <jannh@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:07:54 +0200
X-Gm-Features: AX0GCFv6lixFuiId659KjPXOkzqXx1PP1aVQxHcGUT1KxI_F8oqFZhplOl6k-ZI
Message-ID: <CAG48ez2NUHKKj0mgxuHaPHx5XLZeEN4DCFcbtO8iaqTqs9-hOg@xxxxxxxxxxxxxx>
Subject: Re: [PATCH RFC v2] mm: use per_vma lock for MADV_DONTNEED
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>, Barry Song <21cnbao@xxxxxxxxx>,
akpm@xxxxxxxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Barry Song <v-songbaohua@xxxxxxxx>, "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Lokesh Gidra <lokeshgidra@xxxxxxxxxx>,
Tangquan Zheng <zhengtangquan@xxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, Jun 4, 2025 at 7:50=E2=80=AFPM Lorenzo Stoakes
<lorenzo.stoakes@xxxxxxxxxx> wrote:
> On Wed, Jun 04, 2025 at 02:02:12PM +0800, Qi Zheng wrote:
> > Hi Lorenzo,
> >
> > On 6/3/25 5:54 PM, Lorenzo Stoakes wrote:
> > > On Tue, Jun 03, 2025 at 03:24:28PM +0800, Qi Zheng wrote:
> > > > Hi Jann,
> > > >
> > > > On 5/30/25 10:06 PM, Jann Horn wrote:
> > > > > One important quirk of this is that it can, from what I can see, =
cause
> > > > > freeing of page tables (through pt_reclaim) without holding the m=
map
> > > > > lock at all:
> > > > >
> > > > > do_madvise [behavior=3DMADV_DONTNEED]
> > > > > madvise_lock
> > > > > lock_vma_under_rcu
> > > > > madvise_do_behavior
> > > > > madvise_single_locked_vma
> > > > > madvise_vma_behavior
> > > > > madvise_dontneed_free
> > > > > madvise_dontneed_single_vma
> > > > > zap_page_range_single_batched [.reclaim_pt =3D true=
]
> > > > > unmap_single_vma
> > > > > unmap_page_range
> > > > > zap_p4d_range
> > > > > zap_pud_range
> > > > > zap_pmd_range
> > > > > zap_pte_range
> > > > > try_get_and_clear_pmd
> > > > > free_pte
> > > > >
> > > > > This clashes with the assumption in walk_page_range_novma() that
> > > > > holding the mmap lock in write mode is sufficient to prevent
> > > > > concurrent page table freeing, so it can probably lead to page ta=
ble
> > > > > UAF through the ptdump interface (see ptdump_walk_pgd()).
> > > >
> > > > Maybe not? The PTE page is freed via RCU in zap_pte_range(), so in =
the
> > > > following case:
> > > >
> > > > cpu 0 cpu 1
> > > >
> > > > ptdump_walk_pgd
> > > > --> walk_pte_range
> > > > --> pte_offset_map (hold RCU read lock)
> > > > zap_pte_range
> > > > --> free_pte (via RCU)
> > > > walk_pte_range_inner
> > > > --> ptdump_pte_entry (the PTE page is not freed at this ti=
me)
> > > >
> > > > IIUC, there is no UAF issue here?
> > > >
> > > > If I missed anything please let me know.
>
> Seems to me that we don't need the VMA locks then unless I'm missing
> something? :) Jann?

Aah, right, this is one of those paths that use RCU to protect
read-only PTE-level page table access that can tolerate seeing stale
data. Sorry about the confusion.

> Would this RCU-lock-acquired-by-pte_offset_map also save us from the
> munmap() downgraded read lock scenario also? Or is the problem there
> intermediate page table teardown I guess?

(I see Qi Zheng already clarified this part.)


Return-Path: <linux-kernel+bounces-675648-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 74F3141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:09:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C54C3ADEF9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:08:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E490286D56;
Fri, 6 Jun 2025 11:09:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="P875yah8";
dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="P875yah8"
Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011018.outbound.protection.outlook.com [40.107.130.18])
(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 2176C2045AD
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:09:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.130.18
ARC-Seal:i=3; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208146; cv=fail; b=PxrWKP3bwV3roMNF2aSh1qRqyZ+iHsdCIJ7WwYtRYSE4TA/ECzNDQr8+LT9Ej4KdQaWYYUqEOFY8wVczZs5N6ml36PyFK8VF6xsUaMQ2Esmt+UCrP+/wAMBwqq7Fyrt9hJPCiwVa8yLGX8skuW1D8HK1hEHJlkpDQjkT2WRsIzY=
ARC-Message-Signature:i=3; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208146; c=relaxed/simple;
bh=POqkcvFfI9cYtWK/V9FhWnnxPYoz4RpPBx2hB3CmzoQ=;
h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To:
Content-Type:MIME-Version; b=FeTv1AjSSv5DqG3BjvIGxm4ksjwbI93PIuo2qImNiPcSzO5kggU7fgU5iv2OEpujlCZoZ2D9jdNk7PzQhUBe3LWf6DCl6i6r8qzSk5BH95cJuYlDIiaW0syCWIBEL8adnkWHJ0QNKa6umWS8WShpuBDe+Tc/Y83yLA3tMBvM4zY=
ARC-Authentication-Results:i=3; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=P875yah8; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=P875yah8; arc=fail smtp.client-ip=40.107.130.18
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass;
b=RretKA24+htvGxTXQ+8O9UZGheOKUOIMiye9DHYevYRWftuAI7biCQnwnnjZJX+CFycdPVdGmpepG8q4gEUHaqNzoL9aEPZMJIjbt8euY8pYwiFXMPC/Qxrd9+7aC7KJAM3ZS9Tc1diykzWYYOpzYAucUE4hKGt5+wFmI2gARvnHQGJTWRrNu4ZsKHgAFD2mqGiGU19pt+9Tz8Klk4quLrNJBBuPo0tN9uNXEh4JqjrJTJ5xEG0Igo2i0SOe8EAOw54g47fpP9Li5lKsho60zOUSM3Rbaor/gfKyeP8NbAWnGI2utNsaaHBaT8pisbEPBpKd0mV7j2yqcT4NkOkorQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=anwSU70I5sZHHSEdYyScDb/+deGA5K7JxsW4H73Zlq0=;
b=NySmcCVv3SvGujSlxu1OiZzAvl70OoXR5/NynoKo6noTVoKeCFw+8Cf2A9NmPGIHEG29trpE2wEB+zOWFfCb9cnc22RA0jYDgYG0ngXCBBcgmF7PAuCczOKRkseSfLfHKpBTVgbnELhtVs07GEO+iuiksFER8KIDXvySQQ+Op8mzIlgT/XM0mOe+HTvXZghj6IaKzYcdbY6nuRWt8vydMbJxfZsFxw2yk1hmwcPi3CbssuT+7nVo9OKvAPPMGc/N81F1UQRKzKgDiye9fCRkdQiyKyJtq3qPmdUnJ2R1QerzrexsnfZW/JQeexcTugba/RclurkZ3ZVPEJTY0Krcng==
ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is
4.158.2.129) smtp.rcpttodomain=oracle.com smtp.mailfrom=arm.com; dmarc=pass
(p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass
(signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1
spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com]
dmarc=[1,1,header.from=arm.com])
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=anwSU70I5sZHHSEdYyScDb/+deGA5K7JxsW4H73Zlq0=;
b=P875yah8FCxLPPUaRQER4FAkFoqf4uSPuTOdtOXzBhqQaHUV2BKT8H26GbliSm9G1J02/KxAaLyGX9RwIydlY9UHsHCb5UqmXhRMDZymUiQHI9JL8q/AytB3zsUtP8aU1eWRsOIPqnF6Ok+ha+E4j+MC3ZqbLxUJYsF824ctLTY=
Received: from AS4P250CA0025.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5e3::15)
by AS2PR08MB8361.eurprd08.prod.outlook.com (2603:10a6:20b:544::8) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.20; Fri, 6 Jun
2025 11:08:58 +0000
Received: from AM4PEPF00025F95.EURPRD83.prod.outlook.com
(2603:10a6:20b:5e3:cafe::3c) by AS4P250CA0025.outlook.office365.com
(2603:10a6:20b:5e3::15) with Microsoft SMTP Server (version=TLS1_3,
cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.23 via Frontend Transport; Fri,
6 Jun 2025 11:08:58 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129)
smtp.mailfrom=arm.com; dkim=pass (signature was verified)
header.d=arm.com;dmarc=pass action=none header.from=arm.com;
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates
4.158.2.129 as permitted sender) receiver=protection.outlook.com;
client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C
Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by
AM4PEPF00025F95.mail.protection.outlook.com (10.167.16.4) with Microsoft SMTP
Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8835.2 via
Frontend Transport; Fri, 6 Jun 2025 11:08:57 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=eCUEfbH94hIhOpahy/soRviCmgbeVfdL4SFI7al/uvcHWozEaajeqiGJhRB8dNmf518eK+ezbnMF7BSYwQcDg0hURuHDlMyFq7NsNVBin3ev6+qGo6dGJoALZC6eYdLVAkieWEjATWxHVUC+j3Q0T8YblODLmiyxCx4bhESmbdGVME2ktO5XBaIJsQkIRYf3uPQg/JdG6ASJFwgunU9MZHWetPO0dJwYVsPEzyj2oJE/1o2tOZ+5Vi/YwONhsq2OlNcSI5gl1UnqgfHD4ptgXEpLDlCmOTL7EgD+L+pX/ZmwEQgurUymMCB5jCyAEHe3Cz1e/4B38wlIUo3U6dBbpA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=anwSU70I5sZHHSEdYyScDb/+deGA5K7JxsW4H73Zlq0=;
b=nD1TEzuQUsz+Z8oR3oBarzbRozn5/SF76feUrQ2xf9BcTwdr8S+PSvxQGVni96sSw5rlUWb2yx2dWUsyYZaeT23Tph0G6jAGGw/211j9xvuExkHzQnt3D2q7tYBa81CgSvfgNuspJBoJmrHOfN+a5Ar0C5wCsVs0HK9YNOL+iShikzS+bKAnKUJ825ZLvxYBTTw37VRVon/Jto3eXMwn9P8dljvAHzi/fVp73lY3tC9SLgQBFqHVbqrSMw4+ex/wmKf8g4KfKh9xVIjVzi6yfIKE+natMJJpjOZjI7y5zWZSRDSVpYbEODfyBrZ7F0q7rZbK9d1fwrHR1j6sDz8kPQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass
header.d=arm.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=anwSU70I5sZHHSEdYyScDb/+deGA5K7JxsW4H73Zlq0=;
b=P875yah8FCxLPPUaRQER4FAkFoqf4uSPuTOdtOXzBhqQaHUV2BKT8H26GbliSm9G1J02/KxAaLyGX9RwIydlY9UHsHCb5UqmXhRMDZymUiQHI9JL8q/AytB3zsUtP8aU1eWRsOIPqnF6Ok+ha+E4j+MC3ZqbLxUJYsF824ctLTY=
Authentication-Results-Original: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=arm.com;
Received: from AM9PR08MB7120.eurprd08.prod.outlook.com (2603:10a6:20b:3dc::22)
by PR3PR08MB5818.eurprd08.prod.outlook.com (2603:10a6:102:8b::16) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 11:08:24 +0000
Received: from AM9PR08MB7120.eurprd08.prod.outlook.com
([fe80::2933:29aa:2693:d12e]) by AM9PR08MB7120.eurprd08.prod.outlook.com
([fe80::2933:29aa:2693:d12e%2]) with mapi id 15.20.8813.018; Fri, 6 Jun 2025
11:08:24 +0000
Message-ID: <a6d9c651-6743-4002-8a0b-fdad617ced56@xxxxxxx>
Date: Fri, 6 Jun 2025 16:38:18 +0530
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 2/3] arm64: pageattr: Use walk_page_range_novma() to
change memory permissions
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: akpm@xxxxxxxxxxxxxxxxxxxx, david@xxxxxxxxxx, catalin.marinas@xxxxxxx,
will@xxxxxxxxxx, Liam.Howlett@xxxxxxxxxx, vbabka@xxxxxxx, rppt@xxxxxxxxxx,
surenb@xxxxxxxxxx, mhocko@xxxxxxxx, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, suzuki.poulose@xxxxxxx, steven.price@xxxxxxx,
gshan@xxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>, Ryan Roberts <ryan.roberts@xxxxxxx>
References: <20250530090407.19237-1-dev.jain@xxxxxxx>
<20250530090407.19237-3-dev.jain@xxxxxxx>
<f528506e-b04d-4c80-93c3-93ba4ca385bd@lucifer.local>
<f6b203cc-de3e-45ac-b2e3-b2d9f8ae0c31@xxxxxxx>
<d2ace2dc-0d1e-491c-b574-b1fcc65f9a88@lucifer.local>
Content-Language: en-US
From: Dev Jain <dev.jain@xxxxxxx>
In-Reply-To: <d2ace2dc-0d1e-491c-b574-b1fcc65f9a88@lucifer.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: MA0PR01CA0063.INDPRD01.PROD.OUTLOOK.COM
(2603:1096:a01:ac::17) To AM9PR08MB7120.eurprd08.prod.outlook.com
(2603:10a6:20b:3dc::22)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-TrafficTypeDiagnostic:
AM9PR08MB7120:EE_|PR3PR08MB5818:EE_|AM4PEPF00025F95:EE_|AS2PR08MB8361:EE_
X-MS-Office365-Filtering-Correlation-Id: 46376c03-8cdc-474f-349a-08dda4ea88aa
x-checkrecipientrouted: true
NoDisclaimer: true
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam-Untrusted:
BCL:0;ARA:13230040|1800799024|7416014|366016|376014;
X-Microsoft-Antispam-Message-Info-Original:
=?utf-8?B?eG9MQzJ5VjNZNmxNWTdROTRkYTVWZmw3N3ArR2hIb1pocTQzeE5seHJYazNu?=
=?utf-8?B?ZmpWc1BaS2liZVBuNDk0MjBXSlJCQUl5SkEwVWpFemJ0b2Z2ZG1JT1phWnMy?=
=?utf-8?B?THhrbTN6THJOMUNvWTlucUNXOWZaVTVKaWlQU2xvNnFDMUZ3Sm1DVnpMWFRy?=
=?utf-8?B?aFBibjZoSC9sOVZJOWlZWkQ3eTYzaXVXb2ZEVnVmZzM2bWFmY0E3UFUya09j?=
=?utf-8?B?aW0xQi8wR0pNT0hFc09hbFNSWVZCdmFUMWgvdlR0Q2xzWjBySk5ia3RjZ2pV?=
=?utf-8?B?b1RyYlkyZEtVWklIYUp3Y1lhaEZQd09VdFZSRGhzUStkdGlsYk1hd0JWUXM1?=
=?utf-8?B?eXRER0srT2JGMXcwLzNvTkNPaTR6aFVWR29ZdmxxSFJDZVJDalBKbTFmcHNV?=
=?utf-8?B?ODJiMzUvKzZ0RVluY0drckVLSnBwUVJkVUdRQlhGdTA4TDFVZmgrNDhPWGJi?=
=?utf-8?B?RkVWRnpSSnhyT3puRkJSS3c5K0I2eVQ4WDV6NjhYZlVUdXlDbmNMWU5NcDcx?=
=?utf-8?B?YW1KcUVsVWxnYUdxWEZ6eWxZWjJ4SGU5cDQwUUZpWUloczNFcG04UnhtSEhP?=
=?utf-8?B?S3VWdFFSd1RYM1luMi9hV291UCtMSWpJWmp2MHZUY2ZtbmdiZlkvRGcvL1Nw?=
=?utf-8?B?OVl1dXBzNlNUSisvMUFPZUZUR2g1anNFYkhHUkZBZVErSkN1TDZVQVpnRWNT?=
=?utf-8?B?dnZLVTJ1bXZlVExwSWlsbUdhZE9tb0s3VGJJMDRsa1IvUnc0QTcvOXp0SlNI?=
=?utf-8?B?YnRJWEYrZ2hUQ2g3c2RXNnl4cFpVM1daTW00R2NSMndkbVdDeW9Ya2FxRktv?=
=?utf-8?B?NXo2VmhTQVNuTm1sWm1Dd2R3bzdTS0VlOVNWV096OG5aVmZMN21DanRjd0lv?=
=?utf-8?B?dU01aUNLR0pubVZDM2R0K0FkQXBPUDZxQU84S0FRdDNRTDhJSUdaTEV6Vkps?=
=?utf-8?B?cFFtdERIL0tSb1VzcXRhWURER0NyeEh5NGF6TjNXenQwdWwrb0YrcmZCcDA1?=
=?utf-8?B?Z0owMnkzbDltSWQ3L2tvaDhMWEhxWnNlYTZoaWFYbmhEcWxyREt2Y3J6NVg0?=
=?utf-8?B?OHNta2VIQ1hRMzRTZWhQYUpnV05lYlVvUVUyWk9yZzhwNER3VDhBalUxaUxL?=
=?utf-8?B?Wml4RWh3RjV6Uis3Y0JWQTZuQ0lFNkN0Zml3aG53Nm42T3IwTk8zOE5YdnFD?=
=?utf-8?B?Ly9wTkMyWXhkYnQwdklSZ3hyNWQrSDJHalRUd3dXOWpIUEFpMFZmblU4NDVn?=
=?utf-8?B?TnRiR2VKdjhWUXBsMlRZdEFXSjJUaktPVmZ1SnpBUk9heUhXWjE0bGVTTUFw?=
=?utf-8?B?amtZYStyeWxsWk9wb2gyQzRUZHpiNU5hajBYYytNRFBkSU1kNjFleU0zRmhx?=
=?utf-8?B?REk1dSt6SDBEOXZBZmVwVHpicW5hT1VzOWNwMmlPWTdraWtJcjZ1UTNYcEo2?=
=?utf-8?B?QS90QU9yQUcyLy9jQkFaQ2p6NjNtT3loTDFEK1JGR0ozeTRXWjk1THNtTjE1?=
=?utf-8?B?QWl3dGVwVUNNS0hyVzJ2ano0V21nN21vb1hzalNRL29NMU4wb081a2tFWlJO?=
=?utf-8?B?cXE5NkJNVjB4V05zL21ROVBidFpORkNjWGQwUU92dW1EalVkSGMwek1lMThn?=
=?utf-8?B?RE5HRWdtQVZ3NzVhblZTdkhOM3R0czBFLzd0bnVFQ0p2SGNYQ2Zaa2VrUHhv?=
=?utf-8?B?Y0tJeWg0Q3luRGJUcGpiMndyaEREMk1TankycXVZZXRDMWJhdkh5SWxQODZP?=
=?utf-8?B?dnJQR201cmY2S2xPZDY4Y2tlWWFKNzYreGlBM3dJMXFmL0QraGgyYTdZVnlx?=
=?utf-8?B?WlNsR29ZT0VJaDNwNmJRZ0RtVmN4QTQxTDBkN1RONzAvVzcxUnU0S2pzUXdx?=
=?utf-8?B?U3BGN1Y0Mm5teXllTENtaVJ2aGd1L0dLdFZDUjR5eGJFeUxHTFVmNjFWeGZG?=
=?utf-8?Q?OpNfUrLqqhs=3D?=
X-Forefront-Antispam-Report-Untrusted:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR08MB7120.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(366016)(376014);DIR:OUT;SFP:1101;
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5818
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
AM4PEPF00025F95.EURPRD83.prod.outlook.com
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id-Prvs:
87334a4c-ea07-4179-6da4-08dda4ea74c4
X-Microsoft-Antispam:
BCL:0;ARA:13230040|376014|7416014|14060799003|35042699022|82310400026|1800799024|36860700013;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?dFV5aFpBVFcwMGFpNlIxSHNWK04wTVUzZklHTXkwUmRNZHFRNm9VSENzdUlP?=
=?utf-8?B?MVJiMHlrdEd5YmQ5bCtQRjlPMHJQMUxNeW1EalR1QjVWbU9ybS9iYk5GeElH?=
=?utf-8?B?VUx1WXE4M3JXYVgrMlpZSVg0WFIxTENLYTZRc0wvOFFoUmtLRGVsMHdKcWxO?=
=?utf-8?B?K1ZwM0FKSTd0UktuSFVKcW1DVXZXVnVYOUNwZm5tTXlUNC94YjBFcTJRaXBL?=
=?utf-8?B?S2ZMTTNibVpyNWwxKzFycW52THNZcVl0KzBkdWZZWWhPd01aQWw0SEVmcWVL?=
=?utf-8?B?MHVCZ1Zwc1ZabmZCYXNUWmsvWUtJZ2RDZENjSUExN1ZtY2F6NktDZW81a0Jx?=
=?utf-8?B?WWhOcGVsZkJTS0dpMjJXek1ZQ3E1Z0k0RjFXdU9xNnhmM3dBRnAyKzhTYlJF?=
=?utf-8?B?TCtjN0ZKZ0NkcnU3WTlXdXN6bjB6T1I3UlhJVG9qV0ZVWUppT0YwcTFnZU5I?=
=?utf-8?B?YmZRa2d1ZnAwLzBReXpWSDNQNmtUKzhmWktwZkdMMHRFVnl5cFBnM2I0Z05y?=
=?utf-8?B?c1ppZHJybEllTEpVZG5WTWVqWnYwWFNSNCt3VjdKMkhidm92THBQeFpWWnRy?=
=?utf-8?B?QU1sYlJvY3I4Yzh0c0diZmRHWGozS1NsNVZLTGc5cWd4N1E3Y3hWZTRzUWlR?=
=?utf-8?B?b3FJcnI2ajJMalBQZlRXTDdwZStjdzBkQ2RZajUvSkV4Nk8yckpEREdjN0t1?=
=?utf-8?B?WEpSN3JiQVhCYW9odFhlKzhoR1JqbVVvL3dRNUVLYWVyVzR6WWFXVXZIdDh2?=
=?utf-8?B?UTNUQXNabUorV1pKRDhwSlhUQk1UbGZUbExzd3VxNm9rbkxsZXM4UlRYWUNG?=
=?utf-8?B?Q1lNaDk1Y0h3YVV5WitONEdXNUwvQ05tcC9DVTV3MHNxTjRESHowendQUjZW?=
=?utf-8?B?YWFCR21nbUZUdGswS05jdSs3TXROZHdlcHJ4c2w3R3p3MklnOUo4eEhFZFpr?=
=?utf-8?B?KzQzdkl2M25NWGRCU2c4dUlKeEsvQ04wNElkbjNHRnlYengxZnJoN0tKYnNo?=
=?utf-8?B?Nm55cVJjendiMk5oNnRkNWhKb1Z6eFBIVlh6MW1xMTBaZHlQMGJPQ3JtdUZW?=
=?utf-8?B?Ym1hUzExRHNSVXpvOFBOMDZpNDZ4clpLUVBBY3RVVlcrckVxT3NDZGZwaVRM?=
=?utf-8?B?TUZBUFp2N0VVdHNydlNyWFlhZmVoY1IvRmRGc2JOOW5hMkkwTTNsNmwrTC82?=
=?utf-8?B?Mm43Y2dEUnJXZ0tydkREZWpUMGYzQnZuRy9MQkwrNHdZYkJUaTVqdnIyZWdN?=
=?utf-8?B?RXFoZEdLSUtlNk9QOU1XUUgxZnBEMmNMM1M5bGhVUDN2UGNncGlWREY3eDZw?=
=?utf-8?B?VUNJT2FkMFdxS2FHSXRuT3FiNmRUekEyNFN1WDNQSyswalQycFdmUG85SFJl?=
=?utf-8?B?K1JwdDNLTGR1bHlGcnJhSFVhb1dZSlVmMm9QbzhaUG5vOUVTaW5yMGxxdmZG?=
=?utf-8?B?Vk90SUI1cDhwWFg4UkJGY2tLZTNsczAyQzZSNWtoWTdBTS9yeHI1QXY5b3N1?=
=?utf-8?B?QXZvTlVWZlNtNENLbGU1eEFwMkVpbUplbGw4SHFSOXJzS2dZR3Q1OFJiR3VP?=
=?utf-8?B?TG5CS0VGOHdhbHBMOHIwOHc5VmRnUVBPMGl2Vlczc0xnL3lpTEN1blBOR0p4?=
=?utf-8?B?a1ZJTWtQeGs5MlJ2UDF2MjBJQWUxTUs4Q3FlUzBvSTVXMmhubFhDak13MHUx?=
=?utf-8?B?SU1PdXN2dDVCYjl1RU1LRzRqcXpoSGRjdTBCYjNycUlxaFBQY05XM1BoU2tW?=
=?utf-8?B?YUcwYU0ranV4QSs0SEw0MkpTb05NNVczamhzZnJMR0p1RHd3M1ZWVXJEYURt?=
=?utf-8?B?aUx4M2NzOTY1T1VxaThvWUJOb09aTGlyUTJVQU1TVWFoMlNTanFnUW1DV2l5?=
=?utf-8?B?SWQ1ZEJpM09haGo5NDc5bjY4NnBLd2xyczVMNDJ5THhad0liYmwxV2R2NkJW?=
=?utf-8?B?MjVqREF6SzBNb3k4a0hkMlNIQjV4anF3MmJDUWUwUC9oMVVxVFhDb2F6SVNh?=
=?utf-8?B?a1cyL1FMZ0ZEMWZFcE5KZVk1SDBpam1BRHRWK0hiSjdTRHBOQWdkTk5KbnhM?=
=?utf-8?Q?gl2bRp?=
X-Forefront-Antispam-Report:
CIP:4.158.2.129;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:outbound-uk1.az.dlp.m.darktrace.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(14060799003)(35042699022)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 11:08:57.7710
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 46376c03-8cdc-474f-349a-08dda4ea88aa
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[4.158.2.129];Helo=[outbound-uk1.az.dlp.m.darktrace.com]
X-MS-Exchange-CrossTenant-AuthSource:
AM4PEPF00025F95.EURPRD83.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8361
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 06/06/25 4:26 pm, Lorenzo Stoakes wrote:
> On Fri, Jun 06, 2025 at 04:09:51PM +0530, Dev Jain wrote:
>> On 06/06/25 3:19 pm, Lorenzo Stoakes wrote:
>>> On Fri, May 30, 2025 at 02:34:06PM +0530, Dev Jain wrote:
>>>> Move away from apply_to_page_range(), which does not honour leaf mappings,
>>>> to walk_page_range_novma(). The callbacks emit a warning and return EINVAL
>>>> if a partial range is detected.
>>> Hm a follow up question here - why not just improve apply_to_page_range() to
>>> honour leaf mappings?
>>>
>>> What does honouring leaf mappings actually mean? You mean handling huge pages?
>> Sorry, I always confuse between block, page and leaf mappings :) I mean to say
>> block mappings, yes, huge pages.
> Sometimes I think we like to give different names to things just to make life
> confusing ;)
>
>>> Would it be all that difficult to implement?
>> That is how I did it initially. But I think we get into the same problem
>> which you are describing w.r.t extending walk_page_range_novma - currently we
>> return EINVAL in case we encounter a block mapping in apply_to_page_range,
>> basically asserting that the callers always operate on page mappings. Removing this
>> assertion and generalizing apply_to_page_range kind of sounds the same as
>> removing the locking assertion and generalizing walk_page_range_novma...
> (Again keep in mind walk_page_range_novma no longer exists :)

Ya I mean the pagewalk API.

>
> Yeah it's problematic I guess in that you have a pte_fn_t and would have to get
> into gross stuff like pretending a PMD entry is a PTE entry etc.

Yes, since the pagewalk API has level callbacks it makes life easier.

>
> Ugh god why do we do this to ourselves.

I know right :)

>
>>> It seems like you're pushing a bunch of the 'applying' logic over from there to
>>> a walker that isn't maybe best suited to it and having to introduce an iffy new
>>> form of locking...
>> IMHO I think it is the reverse. Commit aee16b3cee2746880e40945a9b5bff4f309cfbc4
>> introduces apply_to_page_range, and commit e6473092bd9116583ce9ab8cf1b6570e1aa6fc83
>> introduces pagewalk. The commit messages say that the former is meant to be used
>> on page mappings, while the latter is generic. The latter implies that the former
>> was actually never meant to exist...
> What a mess.
>
> Maybe the least-worst solution is to just add a new
> walk_kernel_page_table_range_unlocked() function without an assert and in the
> comment heavily underline that _you must have made sure this is safe_.
>
> This needs revisting in general, I find the use of init_mm.mmap_lock pretty
> gross.

There you said it! I have been reading kernel mapping code for some time and
the entire point of using the init_mm.mmap_lock has been mutual exclusion,
completely throwing out of the window what the mmap_lock actually means.
For example, we take init_mm write lock for ptdump_walk_pgd(), which does
not sound right to me since the only thing ptdump actually does is walk
the pagetables, yet we take the most restrictive lock.

>>> Can we go vice-versa? :)
>>>
>>> Also obviously walk_page_range_novma() doesn't exist any more :P
>>> walk_kernel_page_table_range() is the preferred solution.
>>>
>>>> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
>>>> ---
>>>> arch/arm64/mm/pageattr.c | 69 +++++++++++++++++++++++++++++++++++++---
>>>> 1 file changed, 64 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
>>>> index 39fd1f7ff02a..a5c829c64969 100644
>>>> --- a/arch/arm64/mm/pageattr.c
>>>> +++ b/arch/arm64/mm/pageattr.c
>>>> @@ -8,6 +8,7 @@
>>>> #include <linux/mem_encrypt.h>
>>>> #include <linux/sched.h>
>>>> #include <linux/vmalloc.h>
>>>> +#include <linux/pagewalk.h>
>>>>
>>>> #include <asm/cacheflush.h>
>>>> #include <asm/pgtable-prot.h>
>>>> @@ -20,6 +21,67 @@ struct page_change_data {
>>>> pgprot_t clear_mask;
>>>> };
>>>>
>>>> +static pteval_t set_pageattr_masks(unsigned long val, struct mm_walk *walk)
>>>> +{
>>>> + struct page_change_data *masks = walk->private;
>>>> + unsigned long new_val = val;
>>>> +
>>>> + new_val &= ~(pgprot_val(masks->clear_mask));
>>>> + new_val |= (pgprot_val(masks->set_mask));
>>>> +
>>>> + return new_val;
>>>> +}
>>>> +
>>>> +static int pageattr_pud_entry(pud_t *pud, unsigned long addr,
>>>> + unsigned long next, struct mm_walk *walk)
>>>> +{
>>>> + pud_t val = pudp_get(pud);
>>>> +
>>>> + if (pud_leaf(val)) {
>>>> + if (WARN_ON_ONCE((next - addr) != PUD_SIZE))
>>>> + return -EINVAL;
>>>> + val = __pud(set_pageattr_masks(pud_val(val), walk));
>>>> + set_pud(pud, val);
>>>> + walk->action = ACTION_CONTINUE;
>>>> + }
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static int pageattr_pmd_entry(pmd_t *pmd, unsigned long addr,
>>>> + unsigned long next, struct mm_walk *walk)
>>>> +{
>>>> + pmd_t val = pmdp_get(pmd);
>>>> +
>>>> + if (pmd_leaf(val)) {
>>>> + if (WARN_ON_ONCE((next - addr) != PMD_SIZE))
>>>> + return -EINVAL;
>>>> + val = __pmd(set_pageattr_masks(pmd_val(val), walk));
>>>> + set_pmd(pmd, val);
>>>> + walk->action = ACTION_CONTINUE;
>>>> + }
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static int pageattr_pte_entry(pte_t *pte, unsigned long addr,
>>>> + unsigned long next, struct mm_walk *walk)
>>>> +{
>>>> + pte_t val = ptep_get(pte);
>>>> +
>>>> + val = __pte(set_pageattr_masks(pte_val(val), walk));
>>>> + set_pte(pte, val);
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static const struct mm_walk_ops pageattr_ops = {
>>>> + .pud_entry = pageattr_pud_entry,
>>>> + .pmd_entry = pageattr_pmd_entry,
>>>> + .pte_entry = pageattr_pte_entry,
>>>> + .walk_lock = PGWALK_NOLOCK,
>>>> +};
>>>> +
>>>> bool rodata_full __ro_after_init = IS_ENABLED(CONFIG_RODATA_FULL_DEFAULT_ENABLED);
>>>>
>>>> bool can_set_direct_map(void)
>>>> @@ -49,9 +111,6 @@ static int change_page_range(pte_t *ptep, unsigned long addr, void *data)
>>>> return 0;
>>>> }
>>>>
>>>> -/*
>>>> - * This function assumes that the range is mapped with PAGE_SIZE pages.
>>>> - */
>>>> static int __change_memory_common(unsigned long start, unsigned long size,
>>>> pgprot_t set_mask, pgprot_t clear_mask)
>>>> {
>>>> @@ -61,8 +120,8 @@ static int __change_memory_common(unsigned long start, unsigned long size,
>>>> data.set_mask = set_mask;
>>>> data.clear_mask = clear_mask;
>>>>
>>>> - ret = apply_to_page_range(&init_mm, start, size, change_page_range,
>>>> - &data);
>>>> + ret = walk_page_range_novma(&init_mm, start, start + size,
>>>> + &pageattr_ops, NULL, &data);
>>>>
>>>> /*
>>>> * If the memory is being made valid without changing any other bits
>>>> --
>>>> 2.30.2
>>>>


Return-Path: <linux-kernel+bounces-675649-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 542BF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:09:37 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 187DC3AF206
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:09:15 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 059E62857D8;
Fri, 6 Jun 2025 11:09:31 +0000 (UTC)
Received: from mail-il1-f205.google.com (mail-il1-f205.google.com [209.85.166.205])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7C2328688A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:09:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.205
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208170; cv=none; b=FPqjGmvc4olTu30rUeoD10pafO+bPplH4ucuxjeM6XI2KtLG32vUvFVp/ur4HFzIqIjm3QN3mOhedgg9WEzZe9yNS0VsL0+kxtTmU/53eoTS4guLa5gnLggR9M8IgOjcz4sahQaXELi13aYqNZV3w1tZ8DcOS9BigdUNAp9djmk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208170; c=relaxed/simple;
bh=p/bkGarg4KXztCMnjwy96xAusB9tDMq2/7J7YaUFGEE=;
h=MIME-Version:Date:Message-ID:Subject:From:To:Content-Type; b=fFY9lGWZLZrnv1iqixyDLTfsImIrngBnFXowGTI1duTwp4ngc3SPW+DEMguDFmqIrptdy2z/Ovm3DoqLkj2LjVqVqaiNclcG4sL1DYNqnTi1kospuaLbQD3UMf3ZQMwVRGxX1IDiCKCwMSVk4o7dxQl5YC3nNF+YcWaiG5288OA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.205
Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com
Received: by mail-il1-f205.google.com with SMTP id e9e14a558f8ab-3ddc147611fso40726575ab.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:09:28 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749208168; x=1749812968;
h=to:from:subject:message-id:date:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=Iw0ZO3KmiZE4nTPMikItfY4XJlMSOikx5Gd9PeZeqRs=;
b=roVh5t4rLjlIhYd9ZCFNxEU+APPjcwIymM7HwCqNeVzgHxoLKD1Q57yc1b8uLOL0YF
1ZI+EP3HfM+ZU+kvWEoAyc4Pp44LPwHmMvyalXR6o9h6FxFtu0DD5/pcLYQcOTjaXTLE
Pd9TUf6aPeGEk0HloSeChrEec45y9Q1XSLHibQ9cr1GEPQc6Vg7/5eJpx1cFNJ1t7VwJ
9RcvLAqRYqiB8KUX4yGNd9j9pgWvcwfQ8aE/+4HWPYMP1nAfqws/OymJTK+Kl5EpGGN0
B992ng2OY4GzgxdiHwRv9hAnZv8EGVOxmdD3EHyAjNeyQ27+chKT0ohnJBUh6SNWp4DR
MIPw==
X-Forwarded-Encrypted: i=1; AJvYcCX7JYyJVtLVTPvXDwvssQu+yCkNzlAvPSrXRH2WtoqTkrAoDN1U1HqoAuTDdJVt+MFeI2ykcTwMsBrcU4U=@vger.kernel.org
X-Gm-Message-State: AOJu0YzBE1Dq30D+h3Ij1Y2wOqNjy5NqRzPZUxuQ5v4YYC/NjQ0D25OT
XCizldqUgJRTMOMgYxY/Jze+JbuH116Fi3KAR5dNoC50lLZgvxXWS6rhWQDbyG9z/IZj+4K9IQn
FDbMZBMq0dw5GoF8rUqZSAuHnVKMqPvJKcuCxIeYuKCNKAcAWJK3AcMgQPYU=
X-Google-Smtp-Source: AGHT+IGXGbV+tKbHXfAk9NQ4CZ9jPqMUgDVrsFfSHpSN5QMsDRnOHS375bSle+lbQ1fYQ5J69vMvdF6Tyk013J2dWzShKKSACMlI
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Received: by 2002:a92:cd84:0:b0:3dc:8a5f:7cd1 with SMTP id
e9e14a558f8ab-3ddce407fd6mr34713295ab.3.1749208167899; Fri, 06 Jun 2025
04:09:27 -0700 (PDT)
Date: Fri, 06 Jun 2025 04:09:27 -0700
X-Google-Appengine-App-Id: s~syzkaller
X-Google-Appengine-App-Id-Alias: syzkaller
Message-ID: <6842cc67.a00a0220.29ac89.003b.GAE@xxxxxxxxxx>
Subject: [syzbot] [mm?] WARNING in vma_modify
From: syzbot <syzbot+d16409ea9ecc16ed261a@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: Liam.Howlett@xxxxxxxxxx, akpm@xxxxxxxxxxxxxxxxxxxx,
brad.spengler@xxxxxxxxxxxxxx, jannh@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, lorenzo.stoakes@xxxxxxxxxx, pfalcato@xxxxxxx,
syzkaller-bugs@xxxxxxxxxxxxxxxx, vbabka@xxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-0.5 required=5.0 tests=FROM_LOCAL_HEX,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no
version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello,

syzbot found the following issue on:

HEAD commit: cd2e103d57e5 Merge tag 'hardening-v6.16-rc1-fix1-take2' of..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=107c7970580000
kernel config: https://syzkaller.appspot.com/x/.config?x=6acfdd5e5c8ef3d0
dashboard link: https://syzkaller.appspot.com/bug?extid=d16409ea9ecc16ed261a
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10d3f00c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13c781d4580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4f3c020d1cfe/disk-cd2e103d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f67c698d4603/vmlinux-cd2e103d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4a3974b951f8/bzImage-cd2e103d.xz

The issue was bisected to:

commit 47b16d0462a460000b8f05dfb1292377ac48f3ca
Author: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Date: Sat Feb 22 16:19:52 2025 +0000

mm: abort vma_modify() on merge out of memory failure

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15b5580c580000
final oops: https://syzkaller.appspot.com/x/report.txt?x=17b5580c580000
console output: https://syzkaller.appspot.com/x/log.txt?x=13b5580c580000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d16409ea9ecc16ed261a@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 47b16d0462a4 ("mm: abort vma_modify() on merge out of memory failure")

7f83ee71a000-7f83ee71ffff: ffff8880117713c0
7f83ee720000-7fff07f51fff: 0000000000000000
7fff07f52000-7fff07f72fff: ffff88801182e500
7fff07f73000-ffffffffffffffff: 0000000000000000
------------[ cut here ]------------
WARNING: CPU: 1 PID: 5825 at mm/vma.c:808 vma_merge_existing_range mm/vma.c:808 [inline]
WARNING: CPU: 1 PID: 5825 at mm/vma.c:808 vma_modify+0x1540/0x1970 mm/vma.c:1604
Modules linked in:
CPU: 1 UID: 0 PID: 5825 Comm: syz-executor396 Not tainted 6.15.0-syzkaller-10820-gcd2e103d57e5 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
RIP: 0010:vma_merge_existing_range mm/vma.c:808 [inline]
RIP: 0010:vma_modify+0x1540/0x1970 mm/vma.c:1604
Code: 0b 90 e9 9a ed ff ff e8 4e 56 ab ff 90 0f 0b 90 e9 a3 ec ff ff e8 40 56 ab ff 4c 89 f7 48 c7 c6 20 8c 96 8b e8 f1 05 f3 ff 90 <0f> 0b 90 e9 4c ed ff ff e8 23 56 ab ff e9 4f ee ff ff e8 19 56 ab
RSP: 0018:ffffc90003797b38 EFLAGS: 00010286
RAX: ffffffff8b5d28cd RBX: ffff8880246ea780 RCX: ffff88802c93bc00
RDX: 0000000000000000 RSI: ffffffffffffffff RDI: ffffffffffffffff
RBP: 0000200000000000 R08: ffffc900037976a7 R09: 1ffff920006f2ed4
R10: dffffc0000000000 R11: fffff520006f2ed5 R12: 0000200000000000
R13: ffffc90003797c60 R14: ffffc90003797c40 R15: 1ffff920006f2f8c
FS: 0000555582b74380(0000) GS:ffff888125d5f000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055c124e6b168 CR3: 000000007547b000 CR4: 0000000000350ef0
Call Trace:
<TASK>
vma_modify_flags+0x1e8/0x230 mm/vma.c:1645
mlock_fixup+0x22a/0x360 mm/mlock.c:483
apply_mlockall_flags+0x2f0/0x3c0 mm/mlock.c:736
__ia32_sys_munlockall+0x10a/0x220 mm/mlock.c:782
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f83ee6a76a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff07f72138 EFLAGS: 00000246 ORIG_RAX: 0000000000000098
RAX: ffffffffffffffda RBX: 00007fff07f72150 RCX: 00007f83ee6a76a9
RDX: 00007f83ee6a68e0 RSI: 00007fff07f72150 RDI: 00007fff07f72150
RBP: 0000000000000001 R08: 00007fff07f71ed7 R09: 00000000000000a0
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup


Return-Path: <linux-kernel+bounces-675650-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1323B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:11:47 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0D3EF16D77C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:11:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4630028750F;
Fri, 6 Jun 2025 11:11:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=stwcx.xyz header.i=@stwcx.xyz header.b="MUt5qEbb";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Py0JWDlp"
Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153])
(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 39AD6748D;
Fri, 6 Jun 2025 11:11:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208297; cv=none; b=h1ez5b/Mlz7Kqhx9kmL/LOEkBQGK4KXjDUJDcYEGAeMZpC8QQEtBqEM6Ur1bVWk5VF0cX4lLukzAC4pNEWsozD/E0bTMMx8JBDC7Xg/p7E4tlfnekeLSevHLX5XxzObYANUHGfEdjP6qmPSfym9Gs9vhqhlmS3fNzppnSRnqOa8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208297; c=relaxed/simple;
bh=1vgCFAQkENB6Seo2nZE1CTgN18AgUmdUKx/43g0JYuc=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LY0KLEZVcQOO+zll6HbuTreNskUy/OFhWr5L5ro0r80E1lSTAk/TZU1yoC9GBAVGC+FkTgAihShBxk1AisXQbv1/D2jcD2PFhqlaeGjhyKr5uRRaNY1Qxx0njPrgMcfLupNMg5hXtIyfYDFP11QvdIrZ97DhFOVxxbaNjana7mc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stwcx.xyz; spf=pass smtp.mailfrom=stwcx.xyz; dkim=pass (2048-bit key) header.d=stwcx.xyz header.i=@stwcx.xyz header.b=MUt5qEbb; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Py0JWDlp; arc=none smtp.client-ip=103.168.172.153
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stwcx.xyz
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=stwcx.xyz
Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41])
by mailfhigh.phl.internal (Postfix) with ESMTP id 2079B11400CE;
Fri, 6 Jun 2025 07:11:33 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
by phl-compute-01.internal (MEProxy); Fri, 06 Jun 2025 07:11:33 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stwcx.xyz; h=cc
:cc:content-transfer-encoding:content-type:date:date:from:from
:in-reply-to:message-id:mime-version:reply-to:subject:subject:to
:to; s=fm3; t=1749208293; x=1749294693; bh=MqZdJuGN+ob7h1DLTZpfz
ebCnXfIj5B9RhXeV6LE7bw=; b=MUt5qEbbe/D180ktxeYtbUO03mwcMMrHN1EHT
7g6ONS2KHMn6dQqkLGfkoBp/Msg2wgSlCebO97W1pzyPJqAlIZOE4tUKjLxSQk1z
/un0K/8ydsKmf50Lk2LtGcX3RvbMJ+rWUY0T9tCGCtX73fEy/Y/0i7pSnGEMEg/4
dmWPvsCcUuWLVViaKtmh+Movv6Phn7HhNiDpHUBvemPYhfm6LuUygkMKdoyi6l0R
FSblBtg3kQYshd4azAHN3MnYKQMDaT/qYIUqctooTDV3Qq6sAdkuD/SRiZAg+Aj7
9Pul5hk30f26lrYoAL2pxANo3hzl+dVGCppGf6QDES2jFDEQg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:date:date:feedback-id:feedback-id:from:from
:in-reply-to:message-id:mime-version:reply-to:subject:subject:to
:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
1749208293; x=1749294693; bh=MqZdJuGN+ob7h1DLTZpfzebCnXfIj5B9RhX
eV6LE7bw=; b=Py0JWDlpR8yV9FKy/0XlLbYj3BuKqRcGtuyVKHSKekDBEd4qacw
VlV4OTDDg+TP7jyFUgVhmszcX0tU7+JTiz+AiCP2RJWiXGuFRMpugULmAdyYQQyj
GQQy6hZWH3lQN9uXZQ6KCcPNMxSxp3jk9ZsOG9CtsuvQAYummOzNb2ZB2CD2Tyw7
ZzMEiiZjz8wq3pVzpLp+ZgyGULC68FBWX+vPo3H700ZV2ylZ6gG/LnaSkTQ/2wc0
fv0S1cDH04bOWXFI1m5L+02u+Bx/KHkXrOmG90RelPF8S6Gw7xzQkE5MMhB0VFj1
kvd9bBdF30bhRT9cTqPFIgdIRrj8taQZ16A==
X-ME-Sender: <xms:48xCaJZI7lDSrzoIeSSTKyxB6BRFWze6fIEUuNm0Y1lFftqeq9Xrjg>
<xme:48xCaAbI6dB5GvEaaT3Zr8N633n5WY1ndbRC0swQYfr2zwcF_HeGK9f4iuotmPuMa
NdsUoAc4XO3mu8a6Wc>
X-ME-Received: <xmr:48xCaL_mJ47EASejCxDRyUXoK4mJc_ZfW8n_AWrEo38q_5BGPeFqgFuYX4c>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdduucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnegfrhhlucfvnfffucdlfeehmdenucfjughrpefhvfevufffkffo
ggfgsedtkeertdertddtnecuhfhrohhmpefrrghtrhhitghkucghihhllhhirghmshcuoe
hprghtrhhitghksehsthiftgigrdighiiiqeenucggtffrrghtthgvrhhnpedttdevtdeg
fefggeeuheekgfevkefgteehhedvtdekkeefiedutdfhtdffgffhhfenucffohhmrghinh
epghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm
rghilhhfrhhomhepphgrthhrihgtkhesshhtfigtgidrgiihiidpnhgspghrtghpthhtoh
epuddupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjkhestghouggvtghonhhs
thhruhgtthdrtghomhdrrghupdhrtghpthhtohepmhgrthhtsegtohguvggtohhnshhtrh
hutghtrdgtohhmrdgruhdprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhn
vghtpdhrtghpthhtohepvgguuhhmrgiivghtsehgohhoghhlvgdrtghomhdprhgtphhtth
hopehkuhgsrgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepphgrsggvnhhisehrvggu
hhgrthdrtghomhdprhgtphhtthhopehhohhrmhhssehkvghrnhgvlhdrohhrghdprhgtph
htthhopehkuhhnihihuhesrghmrgiiohhnrdgtohhmpdhrtghpthhtohepphgrthhrihgt
khesshhtfigtgidrgiihii
X-ME-Proxy: <xmx:5MxCaHpFRP8iUhvU2xgWyuFW81GqfSFh_dz5bdCN9_joM4MPmq66ZQ>
<xmx:5MxCaEr1OBvIl7hl0FQC7EjPN8TLn-nTPTV8DTtw9r38XUplgVVo3w>
<xmx:5MxCaNSIv5AAB6qZJy6P0YD60HKOf71rhq_WMOEGVbZRBy5a56eQEg>
<xmx:5MxCaMpLiST6EXj65c8y3FIlhQp7j2_94itPrLDxdV8NXYVDDTHgJg>
<xmx:5cxCaCDuV2ymvA9CSQr_icCx1UQ5nFOBANOxb_CqZfUAQ7vqATSNL2b9>
Feedback-ID: i68a1478a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 07:11:31 -0400 (EDT)
From: Patrick Williams <patrick@xxxxxxxxx>
To: Jeremy Kerr <jk@xxxxxxxxxxxxxxxxxxxx>,
Matt Johnston <matt@xxxxxxxxxxxxxxxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>,
Paolo Abeni <pabeni@xxxxxxxxxx>,
Simon Horman <horms@xxxxxxxxxx>,
Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
Cc: Patrick Williams <patrick@xxxxxxxxx>,
netdev@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] net: mctp: fix infinite data from mctp_dump_addrinfo
Date: Fri, 6 Jun 2025 07:11:16 -0400
Message-ID: <20250606111117.3892625-1-patrick@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FROM_SUSPICIOUS_NTLD,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Some mctp configurations result in the userspace application
`mctp addr show`, which triggers an `mctp_dump_addrinfo`, to
be given infinite data. This was introduced by commit 2d20773aec14.

In `mctp_dump_addrinfo`, when the userspace buffer doesn't hold
enough space for all of the addresses, the function keeps the current
index in the netlink_callback so that it can resume on subsequent
calls. There are two indexes held: interface and address. When a
all the addresses for an interface has been sent, the code reset
the address to zero and relies on `for_each_netdev_dump` for
incrementing the index. However, `for_each_netdev_dump` (which is
using `xa_for_each_start`) does not set the index for the last
entry[1]. This can lead to the subsequent userspace request re-sending
the entire last interface.

Fix this by explicitly setting the index to ULONG_MAX[2] when all of
the interfaces and addresses have been successfully sent. This will
cause subsequent userspace request to be past the last interface in the
next `for_each_netdev_dump` call.

The previous failure could be aggravated by on a system using
aspeed-bmc-facebook-harma.dts by running:
```
mctp addr add 8 dev mctpi2c1
mctp addr show
```

[1]: https://github.com/torvalds/linux/blob/e271ed52b344ac02d4581286961d0c40acc54c03/lib/xarray.c#L2261
[2]: https://github.com/torvalds/linux/blob/e271ed52b344ac02d4581286961d0c40acc54c03/include/linux/xarray.h#L481

Fixes: 2d20773aec14 ("mctp: no longer rely on net->dev_index_head[]")
Signed-off-by: Patrick Williams <patrick@xxxxxxxxx>
---
net/mctp/device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/mctp/device.c b/net/mctp/device.c
index 4d404edd7446..a865445234af 100644
--- a/net/mctp/device.c
+++ b/net/mctp/device.c
@@ -140,9 +140,11 @@ static int mctp_dump_addrinfo(struct sk_buff *skb, struct netlink_callback *cb)
rc = mctp_dump_dev_addrinfo(mdev, skb, cb);
mctp_dev_put(mdev);
if (rc < 0)
- break;
+ goto out;
mcb->a_idx = 0;
}
+ mcb->ifindex = ULONG_MAX;
+out:
rcu_read_unlock();

return skb->len;
--
2.49.0



Return-Path: <linux-kernel+bounces-675651-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CE0DF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:17:33 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id E4BD4179E24
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:17:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A6CC2874ED;
Fri, 6 Jun 2025 11:17:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="RgxR09BG"
Received: from smtp-42a9.mail.infomaniak.ch (smtp-42a9.mail.infomaniak.ch [84.16.66.169])
(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 2915119D880
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:17:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.169
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208646; cv=none; b=N8PH7uen6XJFeKwhUMeLyb4kgWf2/82OuoHHR17smk3noB7hbdx2Cf5BqjUeMeu17c5kDz+MnhuPUY2XdX4ddO/imP5InjffsD2gjyKmYy/nkpgmPahnmZTTGxolpyWoSJy2RCAF4qcccSHbnNYJh4p11sdYHKlCJCtNNMYP9AI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208646; c=relaxed/simple;
bh=HjIlCtToBX0793ETmjSGkQ3kuPJXvm4Zz5or687MsQc=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=oxPDB+Sv4+GhKx/2WFaZcVNhgDzOm70K+YGdiG5N+HGUFVkgjf7L0QsfU0qa0XGdnduuLT3XZ6ElpEQB89EllJ/hrgVFfI+JaRV5I5gfnNy0zAffiqeYiOgTgq9/njJu46xmlxVWAGLuVFkNVPmXwpmaE1b19ZH/jCEr6fVeCUM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=RgxR09BG; arc=none smtp.client-ip=84.16.66.169
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net
Received: from smtp-4-0000.mail.infomaniak.ch (smtp-4-0000.mail.infomaniak.ch [10.7.10.107])
by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4bDJXH3y9mz9Kx;
Fri, 6 Jun 2025 13:10:55 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digikod.net;
s=20191114; t=1749208255;
bh=GOulkok+KExfCKo8WPt2m9yynYFekTZ9q95jHQcC2jw=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=RgxR09BGQ3TSIRLg9SVZJ0OuHx5aAwd4k1EnNLr/ue6nMG8BGy54CtP4S9PsaJj4R
JWYTALIIv4FOMs0uOannuNbx8vZDFHs0o8c//quSYFHV7LKlMeV0g4ipq46jKbTGkV
Iq8SrXlPaN5CPev7ZJn6tJrIC4U7JEKYETNxFLp4=
Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4bDJXG4l6LzPSt;
Fri, 6 Jun 2025 13:10:54 +0200 (CEST)
Date: Fri, 6 Jun 2025 13:10:54 +0200
From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= <mic@xxxxxxxxxxx>
To: Song Liu <song@xxxxxxxxxx>
Cc: bpf@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx, kernel-team@xxxxxxxx,
andrii@xxxxxxxxxx, eddyz87@xxxxxxxxx, ast@xxxxxxxxxx, daniel@xxxxxxxxxxxxx,
martin.lau@xxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx, brauner@xxxxxxxxxx, jack@xxxxxxx,
kpsingh@xxxxxxxxxx, mattbobrowski@xxxxxxxxxx, amir73il@xxxxxxxxx, repnop@xxxxxxxxxx,
jlayton@xxxxxxxxxx, josef@xxxxxxxxxxxxxx, gnoack@xxxxxxxxxx, m@xxxxxxxxxx
Subject: Re: [PATCH v2 bpf-next 1/4] namei: Introduce new helper function
path_walk_parent()
Message-ID: <20250606.ayaib4feaGae@xxxxxxxxxxx>
References: <20250603065920.3404510-1-song@xxxxxxxxxx>
<20250603065920.3404510-2-song@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20250603065920.3404510-2-song@xxxxxxxxxx>
X-Infomaniak-Routing: alpha
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Mon, Jun 02, 2025 at 11:59:17PM -0700, Song Liu wrote:
> This helper walks an input path to its parent. Logic are added to handle
> walking across mount tree.
>
> This will be used by landlock, and BPF LSM.
>
> Signed-off-by: Song Liu <song@xxxxxxxxxx>
> ---
> fs/namei.c | 52 +++++++++++++++++++++++++++++++++++++++++++
> include/linux/namei.h | 2 ++
> 2 files changed, 54 insertions(+)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 4bb889fc980b..7d5bf2bb604f 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1424,6 +1424,58 @@ static bool choose_mountpoint(struct mount *m, const struct path *root,
> return found;
> }
>
> +/**
> + * path_walk_parent - Walk to the parent of path
> + * @path: input and output path.
> + * @root: root of the path walk, do not go beyond this root. If @root is
> + * zero'ed, walk all the way to real root.
> + *
> + * Given a path, find the parent path. Replace @path with the parent path.
> + * If we were already at the real root or a disconnected root, @path is
> + * not changed.
> + *
> + * The logic of path_walk_parent() is similar to follow_dotdot(), except
> + * that path_walk_parent() will continue walking for !path_connected case.
> + * This effectively means we are walking from disconnectedbind mount to the
> + * original mount point. If this behavior is not desired, the caller can
> + * add a check like:
> + *
> + * if (path_walk_parent(&path) && !path_connected(path.mnt, path.dentry)
> + * // continue walking
> + * else
> + * // stop walking
> + *
> + * Returns:
> + * true - if @path is updated to its parent.
> + * false - if @path is already the root (real root or @root).
> + */
> +bool path_walk_parent(struct path *path, const struct path *root)
> +{
> + struct dentry *parent;
> +
> + if (path_equal(path, root))
> + return false;
> +
> + if (unlikely(path->dentry == path->mnt->mnt_root)) {
> + struct path p;
> +
> + if (!choose_mountpoint(real_mount(path->mnt), root, &p))
> + return false;
> + path_put(path);
> + *path = p;
> + return true;

It should not return here but continue with the following checks until
the potential dget_parent() call.

I sent a test to check this issue:
https://lore.kernel.org/r/20250606110811.211297-1-mic@xxxxxxxxxxx


> + }
> +
> + if (unlikely(IS_ROOT(path->dentry)))
> + return false;
> +
> + parent = dget_parent(path->dentry);
> + dput(path->dentry);
> + path->dentry = parent;
> + return true;
> +}
> +EXPORT_SYMBOL_GPL(path_walk_parent);
> +
> /*
> * Perform an automount
> * - return -EISDIR to tell follow_managed() to stop and return the path we
> diff --git a/include/linux/namei.h b/include/linux/namei.h
> index 5d085428e471..cba5373ecf86 100644
> --- a/include/linux/namei.h
> +++ b/include/linux/namei.h
> @@ -85,6 +85,8 @@ extern int follow_down_one(struct path *);
> extern int follow_down(struct path *path, unsigned int flags);
> extern int follow_up(struct path *);
>
> +bool path_walk_parent(struct path *path, const struct path *root);
> +
> extern struct dentry *lock_rename(struct dentry *, struct dentry *);
> extern struct dentry *lock_rename_child(struct dentry *, struct dentry *);
> extern void unlock_rename(struct dentry *, struct dentry *);
> --
> 2.47.1
>
>


Return-Path: <linux-kernel+bounces-675652-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C5DBE41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:18:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 69F3E1899591
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:18:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ADC282882C0;
Fri, 6 Jun 2025 11:18:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="GKuliRjh"
Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7412207A18
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:17:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208682; cv=none; b=cz3pLooGRajQJlg4gzigbuLeu831sUdG4jaDI+BJ08S2+TCuiV3go7Z/kHi/cP7jQ5n+oa5PF7fjnQ1hPLEkln0gPGyf2IfSPRQ/zdOb11VpyOk9BspviMfYZqG7tkqkqqVYm2KQCXNUkGlTBogvBBmsNBXtQCxwYXeuWONVDU8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208682; c=relaxed/simple;
bh=xqceFklevNKHrB4ZeBPwo3lRayjsO/IEtbJhI2UtAgA=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nPH/DqZyHDKg/HFbxahGzIFQbFHF6Eck8+LAlzfdq83U/fBukkQnvzWH49h1t+ovm94Nrfa4AIVjLi2JN3df4hi1Rqhp7Pd6oIw7o/pa9rolQtO96LAdLQj/zxd4NELFPMaT3DS7DTKSv5SeWhyCTu6+J5aZDuIuGu7lr1bOy6Q=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=GKuliRjh; arc=none smtp.client-ip=209.85.218.43
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev
Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-ade326e366dso20982266b.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:17:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=tuxon.dev; s=google; t=1749208677; x=1749813477; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=Do+QkiJD6NZpQLNVX8MWxR+5B4FmjG9ealql6MxkGsQ=;
b=GKuliRjh/3XQYYGRR4O1FIoUa7x4jjtwAglDorwOy/82DyRUFU+vIAL+r/bcUtL7Fn
o3xuR1836fE3oss3v/3J1qAJZon4UHZCazi0vfZtRo2C5iYX55uDuV0+2zOX8Y41rKlQ
iU7C9VKz1HxQJo3Evfec/iRDbs7RUOkjBr5e9U4+dSgvL2awhD5MIFDcXwIByUshzBVb
NrozqBNUi7igNkxzizL3+wOW+uQWlasOeDNG1O6LyaKUUXZoX2DK8+qCMn7CYPFYP6Jt
+2U1rIW7Srsjd2HxJmLwzuy+Uzf3//hne1ChpqDtlgXfUryqDp+lFO8Vf756/eM3xKCE
ffzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749208677; x=1749813477;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=Do+QkiJD6NZpQLNVX8MWxR+5B4FmjG9ealql6MxkGsQ=;
b=AmGRMl591L61ma3wHHdQSdcFmd0q+/9aCc5XlmA5AnuLu0Bun2PZGkAGCVzTufT+qM
GhxGS21PVPQuTm6YIQAYsGWe/mkPa8aj7FuSUVu7BoWM0ogbM0fgpfxVrYzWiTqTTB5m
7j1i1BLgO1nneD0zudcymjBY5GZT6wo0FK3X9mLKx6apAHQ1skzBf57H7VjXTfhUFfqV
0ctgQkHS/TiAPbTpW6Sh21hgMZhLzRZsJC095qhSFbownXXqoaEJrR8vMoQuZryUlcxz
bG8QpsXQ0dPUn2JwwZBOUEkgsZaVIGokl3mRFYDLvWuNo2pEszHC0tE86yhhgmuoNefQ
AJlg==
X-Forwarded-Encrypted: i=1; AJvYcCXsNBPvBLKIQy8DroXL7nyWC1La6SykxgMy+Pi/IT0YVWm8g2JshpjUDid0XWGiKV/dPRbqdAHJKO2lx+A=@vger.kernel.org
X-Gm-Message-State: AOJu0Yz8C1D/ts52lkPP27aKLpvh5FQ/zRGIXuVaG1YBVXvtyOuCCPO9
BjW7tYuSSbZqRJzd4+9j8WmUoyXjk2lRAFrmj5Y7pZqGclvlR8wYkdb7yGaiY1+zNSY=
X-Gm-Gg: ASbGncsbt8ZfDftCgF+Bf6Jf3TDGHg2bmmuhb03ZsnCXRRoYCi8wc+nnOiVvYjYjW0M
T/JuoRTI23Pj0etfufiSWMK18sR3AUY4rqrJLKwnZ/wkxyrXnfWNhlKVIizCWww4rqqIETHP2di
A6NSkmk2q+HPcKrApINPmqTy2O9caOJ7BNVbwnytdLnPXSTEzZrC8las49eKsy1rYrFZCfbtG3i
eTXNcxFegq2EDUVPLTnaGEnv3a5L8z10JGijzseqQBLyz9owzgSk36NL8ZSdFli2EjzvmIzVu0N
FAZk42Yg6mRYJvJs5FL20VKoIaJaG8aiO9aBqzKGCuOzwp0sN1JVWs+90zArCpC+SN/SO/L1VV5
zxrS096ECST0tzi9D
X-Google-Smtp-Source: AGHT+IHWDvzZ+cK5XGmhp46aq4fLVkiHMu9QfV5rZevpbF7hqhSG/HrvSR909QCTjWOMJuFnjrtBHw==
X-Received: by 2002:a17:906:c14f:b0:ad5:55db:e40d with SMTP id a640c23a62f3a-ade1a978c16mr236485566b.34.1749208677061;
Fri, 06 Jun 2025 04:17:57 -0700 (PDT)
Received: from claudiu-X670E-Pro-RS.. ([82.78.167.126])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc7b566sm98704566b.164.2025.06.06.04.17.55
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:17:56 -0700 (PDT)
From: Claudiu <claudiu.beznea@xxxxxxxxx>
X-Google-Original-From: Claudiu <claudiu.beznea.uj@xxxxxxxxxxxxxx>
To: gregkh@xxxxxxxxxxxxxxxxxxx,
rafael@xxxxxxxxxx,
dakr@xxxxxxxxxx,
len.brown@xxxxxxxxx,
pavel@xxxxxxxxxx,
ulf.hansson@xxxxxxxxxx,
jic23@xxxxxxxxxx,
daniel.lezcano@xxxxxxxxxx,
dmitry.torokhov@xxxxxxxxx
Cc: claudiu.beznea@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
linux-pm@xxxxxxxxxxxxxxx,
bhelgaas@xxxxxxxxxx,
geert@xxxxxxxxxxxxxx,
linux-iio@xxxxxxxxxxxxxxx,
linux-renesas-soc@xxxxxxxxxxxxxxx,
fabrizio.castro.jz@xxxxxxxxxxx,
Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
Subject: [PATCH v3 0/2] PM: domains: add devm_pm_domain_attach()
Date: Fri, 6 Jun 2025 14:17:47 +0300
Message-ID: <20250606111749.3142348-1-claudiu.beznea.uj@xxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>

Hi,

As a result of discussion at [1], series adds the devm_pm_domain_attach()
and uses it in platform bus probe.

Please provide your feedback.

Thank you,
Claudiu

[1] https://lore.kernel.org/all/20250215130849.227812-1-claudiu.beznea.uj@xxxxxxxxxxxxxx

Changes in v3:
- dropped the detach_power_off argument of devm_pm_domain_attach()
- use a single cleanup function
- fixed build warning

Changes in v2:
- add devm_pm_domain_attach()
- drop the devres grup open/close approach and use the newly added
devm_pm_domain_attach()

Claudiu Beznea (2):
PM: domains: Add devres variant for dev_pm_domain_attach()
driver core: platform: Use devm_pm_domain_attach()

drivers/base/platform.c | 8 ++----
drivers/base/power/common.c | 50 +++++++++++++++++++++++++++++++++++++
include/linux/pm_domain.h | 6 +++++
3 files changed, 58 insertions(+), 6 deletions(-)

--
2.43.0



Return-Path: <linux-kernel+bounces-675653-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D474741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:18:26 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 94EEE189BB0D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:18:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E2196288508;
Fri, 6 Jun 2025 11:18:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="ZFUs0uXl"
Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 483FE2882AF
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:18:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208684; cv=none; b=X4/OpPGOOCwa6AhgmM179O0rD/d49n/6kvmUv3WLKWWZ6pG7zJPw/UIBL4uzdRpExKQpzH903u29qHGzKQz/xjXuUSoHNLPkBkrUXWpZFg+Mhafi6ipw7t6CTOO8CrZtP4eOhsSkvSQZO8Y4RYq3Pa2DGFJAMRN6h6UkaD4uNq0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208684; c=relaxed/simple;
bh=uRPwSngvxa5YmiEZyOy6L4x+QQSwB1jVFtkOLYxQM9Y=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=i4pT5+edcxqVG9o5YthKPCB4UJqEviWb5ZCMw7FRwkO5PxN+EnOhEEd1PBye6gtSLhmeghMIEPDWWQHG/JEXURN8CspIjlnLGZh9o7HGDSnOR27+y+oMj2vCGpBmA7cg6Teafv1If+JmROj4WWh9E7IhWonTTc5ANUxBhb4xEnA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=ZFUs0uXl; arc=none smtp.client-ip=209.85.218.44
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev
Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-ad51ba0af48so589404666b.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:18:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=tuxon.dev; s=google; t=1749208680; x=1749813480; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=5DPDo39+4uWiuTs/5TrsHwfdO+Ybs2XhzP0BRvioGpc=;
b=ZFUs0uXligE5kIFoSIBF3oqhHcZVTIMSAl9M2ZmSrLuQHvztcz5FAF0rEaskinQaI+
YhxYRW9OnY0tDCVHpHcIt7mlYH/pq9CFT9BOlOvz7AHsYVoXeTBpJS2oQfUsGRXWYyG6
b8M+FG+IWLhF/hwUAk50Y+ZXv+9HVqY2/hNY/CkHQE9BNkrGy8nW1rSpzxt0ZZAq6tQR
PFdlYvYoGhZBKrX8Ae5ErMneueeLRg3NozGxVGnf4QJXVhElZfmsF+UPM9Toyb4amw21
xDXYeIBzuzL7ZHzecoNP6vmzaLuN1SWHs2hEqJIi2kKYgtKtwR99Uk7pVlpFR3jcE9AJ
jORw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749208680; x=1749813480;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=5DPDo39+4uWiuTs/5TrsHwfdO+Ybs2XhzP0BRvioGpc=;
b=xABEhKlWdO6dDEVMF+MDsl21rzRS01x40NbHi1F302QoO5RJVSSAR81xbBeQo5ZBrF
kfPsPKzrqV4L1Dh6FkQoX0RTP9vjNGEGesG3jIUi+1GxCxNu94745y0REVzjpLhFuRuz
tDGHfDaHy/gPbDeH5fdUirK+QeEFrRT2zk6Rc+i/x/AdCJPyF3nx9cQG6E+7FF9a/PaM
LlVr9NWteJ/6eI3RsghBfNvFDQ7eQWjvBggtNOG+ozWx4UvIowMwIPSpCOsIPULV7FzT
HnNimQXKk1EyViHI3PHDRuuKllT39ZpM4shbgeWQEWNof7fgvPDtMJNdw0uI2PKxwDA/
GZsw==
X-Forwarded-Encrypted: i=1; AJvYcCUfRBF0MnsQsbUx0ImqNHIc9DuHYvHEjzmbopWdkhShpDsEJK8jm6+pquk9I85pd9BUBJ8MEtWzz5CXNw4=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzbo7yVWyUcH4saQpC3Dsc10jeSbVISk/8IjbLOydqF+tEov8wM
9HqgURd9ZH9kZSvwbD5tB/QzLUP5n5OqyqVSpLN5QZdHKNllxxPkEFp39wpq0USfx90=
X-Gm-Gg: ASbGncsbLkyWpEcJcacObuJ4YFnPW3EhLKS0mfAknO7I16inch6nIdKhl1YZosTrVsA
YSIiEC8pZFrUgFKDHbeSVjpAWAFjHhACTlBBOr2YMH76BAoMdDUU6Ss5uysWuEtZeDkPJeZITdG
mHN4qkdPRUUxLxSgvI/Wxup5rREyPVq1WIK4slYyT8sRum+VE2MNzzz9cOxea3UW9ZTFbJSKSz/
wBc88y7C8ePkbb8+WyEYO4XiZIHmszfko3Dy1Z8X01lI26Cuy1x2KoMbHIkBYGvWSpUxRxstSqf
C+/EtEAUhjHqI7pIcr8qcTprZVJ5PedzlrsywJIylkce2LaiwGItgL97EhjFkQOG2a+qGRfM2nn
7IqgE3w==
X-Google-Smtp-Source: AGHT+IHEl1tPJoKtHBu3HfHQ16gw36K9TO7lnz3CJzribBe1iqtYzLhJA23YP6zOaAWmytoJBYRbqg==
X-Received: by 2002:a17:907:3f9f:b0:ad5:6622:114e with SMTP id a640c23a62f3a-ade079048b4mr586268866b.30.1749208680261;
Fri, 06 Jun 2025 04:18:00 -0700 (PDT)
Received: from claudiu-X670E-Pro-RS.. ([82.78.167.126])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc7b566sm98704566b.164.2025.06.06.04.17.58
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:17:59 -0700 (PDT)
From: Claudiu <claudiu.beznea@xxxxxxxxx>
X-Google-Original-From: Claudiu <claudiu.beznea.uj@xxxxxxxxxxxxxx>
To: gregkh@xxxxxxxxxxxxxxxxxxx,
rafael@xxxxxxxxxx,
dakr@xxxxxxxxxx,
len.brown@xxxxxxxxx,
pavel@xxxxxxxxxx,
ulf.hansson@xxxxxxxxxx,
jic23@xxxxxxxxxx,
daniel.lezcano@xxxxxxxxxx,
dmitry.torokhov@xxxxxxxxx
Cc: claudiu.beznea@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
linux-pm@xxxxxxxxxxxxxxx,
bhelgaas@xxxxxxxxxx,
geert@xxxxxxxxxxxxxx,
linux-iio@xxxxxxxxxxxxxxx,
linux-renesas-soc@xxxxxxxxxxxxxxx,
fabrizio.castro.jz@xxxxxxxxxxx,
Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
Subject: [PATCH v3 2/2] driver core: platform: Use devm_pm_domain_attach()
Date: Fri, 6 Jun 2025 14:17:49 +0300
Message-ID: <20250606111749.3142348-3-claudiu.beznea.uj@xxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606111749.3142348-1-claudiu.beznea.uj@xxxxxxxxxxxxxx>
References: <20250606111749.3142348-1-claudiu.beznea.uj@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>

On the Renesas RZ/G3S (and other Renesas SoCs, e.g., RZ/G2{L, LC, UL}),
clocks are managed through PM domains. These PM domains, registered on
behalf of the clock controller driver, are configured with
GENPD_FLAG_PM_CLK. In most of the Renesas drivers used by RZ SoCs, the
clocks are enabled/disabled using runtime PM APIs. The power domains may
also have power_on/power_off support implemented. After the device PM
domain is powered off any CPU accesses to these domains leads to system
aborts.

During probe, devices are attached to the PM domain controlling their
clocks and power. Similarly, during removal, devices are detached from the
PM domain.

The detachment call stack is as follows:

device_driver_detach() ->
device_release_driver_internal() ->
__device_release_driver() ->
device_remove() ->
platform_remove() ->
dev_pm_domain_detach()

During driver unbind, after the device is detached from its PM domain,
the device_unbind_cleanup() function is called, which subsequently invokes
devres_release_all(). This function handles devres resource cleanup.

If runtime PM is enabled in driver probe via devm_pm_runtime_enable(), the
cleanup process triggers the action or reset function for disabling runtime
PM. This function is pm_runtime_disable_action(), which leads to the
following call stack of interest when called:

pm_runtime_disable_action() ->
pm_runtime_dont_use_autosuspend() ->
__pm_runtime_use_autosuspend() ->
update_autosuspend() ->
rpm_idle()

The rpm_idle() function attempts to resume the device at runtime. However,
at the point it is called, the device is no longer part of a PM domain
(which manages clocks and power states). If the driver implements its own
runtime PM APIs for specific functionalities - such as the rzg2l_adc
driver - while also relying on the power domain subsystem for power
management, rpm_idle() will invoke the driver's runtime PM API. However,
since the device is no longer part of a PM domain at this point, the PM
domain's runtime PM APIs will not be called. This leads to system aborts on
Renesas SoCs.

Another identified case is when a subsystem performs various cleanups
using device_unbind_cleanup(), calling driver-specific APIs in the process.
A known example is the thermal subsystem, which may call driver-specific
APIs to disable the thermal device. The relevant call stack in this case
is:

device_driver_detach() ->
device_release_driver_internal() ->
device_unbind_cleanup() ->
devres_release_all() ->
devm_thermal_of_zone_release() ->
thermal_zone_device_disable() ->
thermal_zone_device_set_mode() ->
struct thermal_zone_device_ops::change_mode()

At the moment the driver-specific change_mode() API is called, the device
is no longer part of its PM domain. Accessing its registers without proper
power management leads to system aborts.

Use devm_pm_domain_attach(). This ensures that driver-specific devm actions
or reset functions are executed in sequence with PM domain attach
action or reset and the driver will not end up runtime resuming the device
when it is not anymore managed by it's PM domain.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
---

Changes in v3:
- adjusted the call to devm_pm_domain_attach() as it now gets
2 parameters

Changes in v2:
- dropped the devres group open/close approach and use
devm_pm_domain_attach()
- adjusted patch description to reflect the new approach

drivers/base/platform.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 075ec1d1b73a..c39d21fc1793 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1396,15 +1396,12 @@ static int platform_probe(struct device *_dev)
if (ret < 0)
return ret;

- ret = dev_pm_domain_attach(_dev, true);
+ ret = devm_pm_domain_attach(_dev, true);
if (ret)
goto out;

- if (drv->probe) {
+ if (drv->probe)
ret = drv->probe(dev);
- if (ret)
- dev_pm_domain_detach(_dev, true);
- }

out:
if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
@@ -1422,7 +1419,6 @@ static void platform_remove(struct device *_dev)

if (drv->remove)
drv->remove(dev);
- dev_pm_domain_detach(_dev, true);
}

static void platform_shutdown(struct device *_dev)
--
2.43.0



Return-Path: <linux-kernel+bounces-675654-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0BE3741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:18:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C1AC918997A3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:18:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4912428851D;
Fri, 6 Jun 2025 11:18:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="DBKCcI3b"
Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AE24286D5B
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:18:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208685; cv=none; b=pBkeULyRVM8srhJH6uIk+RWZUBQe5vjiW4IEJHF6qug4zU+ZN0+iJaPx53GO8aTb3xLny7194IFiZi6kiIoetUvQl8lV+DYj4wt55gr0Z/p1tvEizL0y9MGMYZ9jY6ldyZ2WRD4jodRE361Ec4TrOGsvq3G1kCr5hxJYWVfvFR0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208685; c=relaxed/simple;
bh=2Zf9PqQ/xdsUa49ohUw4b0FzbCTktzpyC6txhBl+f2M=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=YaDDHyrzCHNxESzpZv6tcEOYCGrOTLBBfcjKmiy0yN6InGi4aB4ExG/15wxhixt3Cb+j+noBffbAM4UZy/dC29S3GgbCzHrJiTzjRWPYXZHAkuYMpewUMt6ARnx9cpr5b+EAMf2hDBpRbNB0H0yvg+F/OwvZ9WAt45Tm5aOVgFM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=DBKCcI3b; arc=none smtp.client-ip=209.85.208.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev
Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-601f278369bso3965751a12.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:18:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=tuxon.dev; s=google; t=1749208679; x=1749813479; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=K9UeLBEeNgVFZxNvwdqTWlF8knLYtgrdcWBf2xtn+Ko=;
b=DBKCcI3bfOOqblSO59w3vot2T5GnEqknF0Su7dLvhZMIBNr8p9BZ95rbGQbs3j4WpD
qbCqEYY4hLdbAhb3jWAM/2NyRD+25CDi5k5tBlusNs7gxbHSWTpwAc18MRXAolRyD/x9
KHxaM76gTLUXbwsQtU4VVHC9Bbe1B05dEhSP0wcTErxGdzmOdauyErGGZNi/yIENpjcr
GS5mcAYz5FliR/9cUX2FdYs6igndNfZ2S4ql5b9CBk2K4gfygovFfhGcqB8fFbjJwjBu
FKDBTtlIxndAzYjsRtVlNuF7Sit+Yo82+6a4us7WK2tZKW+ZsAnHZwe0U5HmIM7NYLlN
dvkg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749208679; x=1749813479;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=K9UeLBEeNgVFZxNvwdqTWlF8knLYtgrdcWBf2xtn+Ko=;
b=ZjEorTLqctYVJdS+3VVpehc01GTofFH7L75/dg0DKT8giBTwEUiIhPFd/9Xk78L2YV
NdXJU5YZ2DlV1alm+eXsIyKZie2NFJbB0LkK3NOJn2kG5AqJg7ACoVTV8hc9OKoPYf/a
y5IAqSba9w4WXG4TBxkT2NiOxjFyyDhKeBM10q9Gw72L2rWAsD7poO1UqQhXcNZ3jTuN
j60DzNi4LKTg1zjD7mw/0fLDCJ9u5Rw33G3EnWGMoME42Udim/kc2CujFiUJjTwlGafE
InW7cppwvui6e7Bgf2j/yUB5VMSSP5cnwqVh5JMAkre0/AUSuFBq2nLMGHkwPTOEBdyA
X9WQ==
X-Forwarded-Encrypted: i=1; AJvYcCWeIbN3wukOSbftPkFfaB4aaPB5EC1IAZewGRTRomm9AYEAHvv7mcJPuymQp0ooJZ3iIuf5JWHxlZT3Wd8=@vger.kernel.org
X-Gm-Message-State: AOJu0Yxgxzx0PSynYrUvOpmmNZilx0VCnmP0A6rVVlCorbpad3jk6Gjc
R9CI/vN0kn1B5Jk2Y5eTsRftxc0j/dk1zIbYJmbefireqhqo2VGZ1FOFpEuJCIj6W0g=
X-Gm-Gg: ASbGnctA84QVRqBfXsKUby5uM+8gpbb/nx1ExbWU1VzLsuUvWWXwvs+oGnrJp/d5Y9W
Timq+pphXPSwc9RrQp3WP2I5dAw+naLWbSkfHRMZ4r/jLXYE8vzfsm3+n6v7ulyUKpTV5p0C2cd
0ZA4ZYXTeSeP+s53fI88LLyKxfXRULyYqgEme/DwKWiSmlG0bjlpkWdbKkFutnMd9m+xi+I1a5R
nYBceli4lgtJ9p2BjXRYPs7PCCem5tEFjShILGeW8yv1+jfnmUBHZKQ9yr7op2NlcLkSa/4xdlA
QqIY76XF/TjwmqASOtatwNZOOyyLpiYSjnwH4QfvpSWZwunxu2maWevt8xoCg4zP5BiG6ObPZVa
hzrliXw==
X-Google-Smtp-Source: AGHT+IG4VTq1mx5DeffErAs95tbKPfwNXjlN3PvJEQqp28QpBbWUEU9bT6nIWpBgMvdagmloO4L2qg==
X-Received: by 2002:a17:907:d24:b0:adb:41b1:feca with SMTP id a640c23a62f3a-ade1ab99b91mr213537666b.61.1749208678682;
Fri, 06 Jun 2025 04:17:58 -0700 (PDT)
Received: from claudiu-X670E-Pro-RS.. ([82.78.167.126])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc7b566sm98704566b.164.2025.06.06.04.17.57
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:17:58 -0700 (PDT)
From: Claudiu <claudiu.beznea@xxxxxxxxx>
X-Google-Original-From: Claudiu <claudiu.beznea.uj@xxxxxxxxxxxxxx>
To: gregkh@xxxxxxxxxxxxxxxxxxx,
rafael@xxxxxxxxxx,
dakr@xxxxxxxxxx,
len.brown@xxxxxxxxx,
pavel@xxxxxxxxxx,
ulf.hansson@xxxxxxxxxx,
jic23@xxxxxxxxxx,
daniel.lezcano@xxxxxxxxxx,
dmitry.torokhov@xxxxxxxxx
Cc: claudiu.beznea@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
linux-pm@xxxxxxxxxxxxxxx,
bhelgaas@xxxxxxxxxx,
geert@xxxxxxxxxxxxxx,
linux-iio@xxxxxxxxxxxxxxx,
linux-renesas-soc@xxxxxxxxxxxxxxx,
fabrizio.castro.jz@xxxxxxxxxxx,
Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
Subject: [PATCH v3 1/2] PM: domains: Add devres variant for dev_pm_domain_attach()
Date: Fri, 6 Jun 2025 14:17:48 +0300
Message-ID: <20250606111749.3142348-2-claudiu.beznea.uj@xxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606111749.3142348-1-claudiu.beznea.uj@xxxxxxxxxxxxxx>
References: <20250606111749.3142348-1-claudiu.beznea.uj@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>

The dev_pm_domain_attach() function is typically used in bus code alongside
dev_pm_domain_detach(), often following patterns like:

static int bus_probe(struct device *_dev)
{
struct bus_driver *drv = to_bus_driver(dev->driver);
struct bus_device *dev = to_bus_device(_dev);
int ret;

// ...

ret = dev_pm_domain_attach(_dev, true);
if (ret)
return ret;

if (drv->probe)
ret = drv->probe(dev);

// ...
}

static void bus_remove(struct device *_dev)
{
struct bus_driver *drv = to_bus_driver(dev->driver);
struct bus_device *dev = to_bus_device(_dev);

if (drv->remove)
drv->remove(dev);
dev_pm_domain_detach(_dev);
}

When the driver's probe function uses devres-managed resources that depend
on the power domain state, those resources are released later during
device_unbind_cleanup().

Releasing devres-managed resources that depend on the power domain state
after detaching the device from its PM domain can cause failures.

For example, if the driver uses devm_pm_runtime_enable() in its probe
function, and the device's clocks are managed by the PM domain, then
during removal the runtime PM is disabled in device_unbind_cleanup() after
the clocks have been removed from the PM domain. It may happen that the
devm_pm_runtime_enable() action causes the device to be runtime-resumed.
If the driver specific runtime PM APIs access registers directly, this
will lead to accessing device registers without clocks being enabled.
Similar issues may occur with other devres actions that access device
registers.

Add devm_pm_domain_attach(). When replacing the dev_pm_domain_attach() and
dev_pm_domain_detach() in bus probe and bus remove, it ensures that the
device is detached from its PM domain in device_unbind_cleanup(), only
after all driver's devres-managed resources have been release.

For flexibility, the implemented devm_pm_domain_attach() has 2 state
arguments, one for the domain state on attach, one for the domain state on
detach.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
---

Changes in v3:
- dropped devm_pm_domain_detach_off(), devm_pm_domain_detach_on()
and use a single function devm_pm_domain_detach()

Changes in v2:
- none; this patch is new

drivers/base/power/common.c | 50 +++++++++++++++++++++++++++++++++++++
include/linux/pm_domain.h | 6 +++++
2 files changed, 56 insertions(+)

diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index 781968a128ff..82ea20b343f5 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -115,6 +115,56 @@ int dev_pm_domain_attach(struct device *dev, bool power_on)
}
EXPORT_SYMBOL_GPL(dev_pm_domain_attach);

+/**
+ * devm_pm_domain_detach - devres action for devm_pm_domain_attach() to
+ * detach a device from its domain.
+ * @dev: device to detach.
+ * @res: indicate if the device should be powered off
+ *
+ * This function reverse the actions from devm_pm_domain_attach().
+ * It will be invoked during the remove phase from drivers implicitly.
+ */
+static void devm_pm_domain_detach(struct device *dev, void *res)
+{
+ bool *power_off = res;
+
+ dev_pm_domain_detach(dev, *power_off);
+}
+
+/**
+ * devm_pm_domain_attach - devres-enabled version of dev_pm_domain_attach()
+ * @dev: Device to attach.
+ * @power_on: Use to indicate whether we should power on the device
+ * when attaching.
+ *
+ * NOTE: this will also handle calling dev_pm_domain_detach() for
+ * you during remove phase.
+ *
+ * Returns 0 on successfully attached PM domain, or a negative error code in
+ * case of a failure.
+ */
+int devm_pm_domain_attach(struct device *dev, bool power_on)
+{
+ bool *power_off;
+ int ret;
+
+ power_off = devres_alloc(devm_pm_domain_detach, sizeof(*power_off), GFP_KERNEL);
+ if (!power_off)
+ return -ENOMEM;
+
+ ret = dev_pm_domain_attach(dev, power_on);
+ if (ret) {
+ devres_free(power_off);
+ return ret;
+ }
+
+ *power_off = power_on;
+ devres_add(dev, power_off);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(devm_pm_domain_attach);
+
/**
* dev_pm_domain_attach_by_id - Associate a device with one of its PM domains.
* @dev: The device used to lookup the PM domain.
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 0b18160901a2..f78b6b4dd734 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -509,6 +509,7 @@ struct device *dev_pm_domain_attach_by_name(struct device *dev,
int dev_pm_domain_attach_list(struct device *dev,
const struct dev_pm_domain_attach_data *data,
struct dev_pm_domain_list **list);
+int devm_pm_domain_attach(struct device *dev, bool power_on);
int devm_pm_domain_attach_list(struct device *dev,
const struct dev_pm_domain_attach_data *data,
struct dev_pm_domain_list **list);
@@ -539,6 +540,11 @@ static inline int dev_pm_domain_attach_list(struct device *dev,
return 0;
}

+static inline int devm_pm_domain_attach(struct device *dev, bool power_on)
+{
+ return 0;
+}
+
static inline int devm_pm_domain_attach_list(struct device *dev,
const struct dev_pm_domain_attach_data *data,
struct dev_pm_domain_list **list)
--
2.43.0



Return-Path: <linux-kernel+bounces-675655-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A1C7141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:20:12 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 8A699188D194
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:20:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BA56528750F;
Fri, 6 Jun 2025 11:20:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="u0CDmtcy"
Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82F7E19D880
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:20:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208805; cv=none; b=OfsVp8wT5h8oYOhrjvhXlXJaCwxfc7FpWv0pixiOJc5dFz6tYF1Qf+hF6dCuHiBjIRY3wprLjLIXk0mraMBwD/h+hfrf3xITCGo8YskP7h9eeXpNfw68VtZnaiXNHjsPg93JqNN98JZLg0pxCCkuk2eRHS18onoLXUcxcHy2f00=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208805; c=relaxed/simple;
bh=USdClpSVqld8qSLsJmF5UBqX++/lI09ziLNHsV+mc0s=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=naUxyhanSdvWih4Oc8k5P0xIfi3bWzYXMDClqdh0WVzag20b/KXySw6LFcmCLZT0ZXLTATybLF51TIrpiXjcmwbN5GWEP07DllWHxWNeuoWleInSDbVka4BiYENu5IRREQe7Rk+kxfCf8kvDqvbfqjxF73FfoT8Zk3rIncOmFFI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=u0CDmtcy; arc=none smtp.client-ip=209.85.128.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org
Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-442f9043f56so10948855e9.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:20:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1749208799; x=1749813599; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=MuQ7ElMFujECmYhgfOt92ztzf79cPNjqJC1YxZVfkjk=;
b=u0CDmtcyJQO2+isOBmvt98vI8uIspiM4cTPZwGOvfWsegbf32lu/gjt16nz6BGq2ko
mLk0oG3tn79OfjdaA0ts9QSuhYPsR/T7APcj4Mk7mxNDUv5zSuKuPagRDb9Ku9oo2waF
afEJ1qOGZnjwo9cw86cz8hA+MB7X+vUr+jNXPa7aij4WIRswv2FTnY0CiMIRyw8JSpic
6TMvKIdmN5PFqwNqdvX8K6A3n7RO2QVxzkYpw1ys2LlOJzA9bDcY3Z9gUtZO1RfZn/mD
0iy4vzXKCi58AHhghJO9UsxhmfRWoFzd7jn7SBU3KFp6n/eaNw9ApwvVh2AfQOWnl68L
198Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749208799; x=1749813599;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=MuQ7ElMFujECmYhgfOt92ztzf79cPNjqJC1YxZVfkjk=;
b=OwvLhau4KOi54LQAui5Huv1LPC3RcSxo5sB3e0iQ/gkbgNcwVH431wS7kZf/EzZnD3
xxwZfaBJKoqN9F8BLGupUd0YPXAGbdszvSLJ8uMVKpoVU4j+i/AAAGdplTHzqydAbvMX
eV/nwEKERzvM2M0gjMte+F2Uc8JuIqygVd0LHUo8Vffs0xFuJizh9wqLQQBUCFl+ar4z
zV6oaG3UCLMQB4hhKOjey3+JfyDV3dH5CamSzFpAGugqjIMokyg8IzeD8XSkoVNkHUwg
tKRRn1T+xkMbJf1DEBZ89WiBTM/Eq8p09T2vwLwNuw++DrmpDiSCo3vw4FAjHdGubabF
SxIw==
X-Forwarded-Encrypted: i=1; AJvYcCUgVqDP+bhGcL1CmC2GDKnSyMslODtx6aXsOPqBpu2kCS/PUulvaWF+jGyZ0YwUXVt6rXuigPkU1f6VKtA=@vger.kernel.org
X-Gm-Message-State: AOJu0YxODMpRjK2KdqDZTxMwq0DAdyNbFRPAfEcW+I9UnuwewXk85RKS
GKuEF5W77hVhwey4GI6vcjTdZhDEZykivybJQuGobQ8QZRQpZ9/GYZu/i5b4ka9pcVQ=
X-Gm-Gg: ASbGncs3WxK/rqzsHwFuJ1Expkq1PNocyq2KmGR6Ls8UUEgDdtAs0s1snlm3ZqZ1LTw
eRTNMf18riznDMl5Xq++KsTmWIp3+Dj9MzVEXdYUbDNpBfrdrK5YG773fHjc7RzBi9SBAwQEW5R
LnEnrgLQmXgabLxl+RRfpzsUkcR6J8CLHyboxVyj+taEYb90TxaWX19uFyzqV31FqEoKARmlqg8
SQMX4LIlR4YI9lF5wrJicWFoakEvGO8QdaT3TN6Wjsdiw25t0NL26vQ40A4W/9ga83tnRVudbMM
ofeV8fMQJXKf93YQ0E9r57TOJ4LYmMHK0tj+6k71WBdKCEbFIaDoDTmezyIwkES60IIA5w==
X-Google-Smtp-Source: AGHT+IH2MrdFxFyb1RgZrJq3QgVItnUJDGd7Nbi2wT4HljZC4pDIqfq4GTUxdydboY7ZnYyQOl6GGg==
X-Received: by 2002:a05:600c:3e10:b0:450:d204:34ca with SMTP id 5b1f17b1804b1-452013bb9a4mr33700405e9.18.1749208799424;
Fri, 06 Jun 2025 04:19:59 -0700 (PDT)
Received: from localhost ([2a02:8071:6401:180:da11:6260:39d6:12c])
by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-4526e056138sm18262385e9.5.2025.06.06.04.19.58
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:19:58 -0700 (PDT)
Date: Fri, 6 Jun 2025 13:19:53 +0200
From: Johannes Weiner <hannes@xxxxxxxxxxx>
To: Wupeng Ma <mawupeng1@xxxxxxxxxx>
Cc: akpm@xxxxxxxxxxxxxxxxxxxx, vbabka@xxxxxxx, surenb@xxxxxxxxxx,
jackmanb@xxxxxxxxxx, ziy@xxxxxxxxxx, wangkefeng.wang@xxxxxxxxxx,
linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [RFC PATCH] mm: Drain PCP during direct reclaim
Message-ID: <20250606111953.GB1118@xxxxxxxxxxx>
References: <20250606065930.3535912-1-mawupeng1@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606065930.3535912-1-mawupeng1@xxxxxxxxxx>
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 02:59:30PM +0800, Wupeng Ma wrote:
> Memory retained in Per-CPU Pages (PCP) caches can prevent hugepage
> allocations from succeeding despite sufficient free system memory. This
> occurs because:
> 1. Hugepage allocations don't actively trigger PCP draining
> 2. Direct reclaim path fails to trigger drain_all_pages() when:
> a) All zone pages are free/hugetlb (!did_some_progress)
> b) Compaction skips due to costly order watermarks (COMPACT_SKIPPED)

This doesn't sound quite right. Direct reclaim skips when compaction
is suitable. Compaction says COMPACT_SKIPPED when it *isn't* suitable.

So if direct reclaim didn't drain, presumably compaction ran but
returned COMPLETE or PARTIAL_SKIPPED because the freelist checks in
__compact_finished() never succeed due to the pcp?

> @@ -4137,28 +4137,22 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order,
> {
> struct page *page = NULL;
> unsigned long pflags;
> - bool drained = false;
>
> psi_memstall_enter(&pflags);
> *did_some_progress = __perform_reclaim(gfp_mask, order, ac);
> - if (unlikely(!(*did_some_progress)))
> - goto out;
> -
> -retry:
> - page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac);
> + if (likely(*did_some_progress))
> + page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac);
>
> /*
> * If an allocation failed after direct reclaim, it could be because
> * pages are pinned on the per-cpu lists or in high alloc reserves.
> * Shrink them and try again
> */
> - if (!page && !drained) {
> + if (!page) {
> unreserve_highatomic_pageblock(ac, false);
> drain_all_pages(NULL);
> - drained = true;
> - goto retry;
> + page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac);

This seems like the wrong place to fix the issue.

Kcompactd has a drain_all_pages() call. Move that to compact_zone(),
so that it also applies to the try_to_compact_pages() path?


Return-Path: <linux-kernel+bounces-675656-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B328341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:20:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 2CB9B1890069
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:21:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 329452882C1;
Fri, 6 Jun 2025 11:20:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fMroN5Hd"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EDF32882A6;
Fri, 6 Jun 2025 11:20:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208845; cv=none; b=L2O1kI4nzBn8hHLaQM8Ir6iHnNHg9pn7Fg0548DNtLOqsfuO+tIX2drVAr9YR0gQhF7LlXXHODA5550YudM9xx6B454qRMW2vLz1XY4qwO8Dx2UlMazJO6n4zsDskRbToAP5BRWiH0k662y6oQutk5/6PejgvUvdhR7BWBlm0vk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208845; c=relaxed/simple;
bh=ti9oOmqvMGZUuTjapj1Ojl85o/P6e6+srSzCZvIrPug=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=Qy7JRyCLWPSiiXJfc+ee/wbyZX+d09yGnaGtqroma8n9rAUP4ne/Ds2QTxcM5007rMiPiQzu/Tl2vVtPjhuSi5sS/bRG5IxXCosikYW1mLcaBZssPQAgZyC2G77dMwCqGETkgfy8GwmYIrivP3zeQAczL8xAwa3ghf6tSsi6yoc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fMroN5Hd; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6215C4CEEE;
Fri, 6 Jun 2025 11:20:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749208843;
bh=ti9oOmqvMGZUuTjapj1Ojl85o/P6e6+srSzCZvIrPug=;
h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
b=fMroN5Hdeoj2fXFeiuFwDDjk29HJ9r8Y7fJlr2wZfQAoznnCRxu5oOIm1CHqdGdOp
FKVj028MKePTDNPvPOdDct0TvUwm568Qn1Y7mLUhHgtdMPECFSLdHbjgz02Lyht6mT
QB0db8ECRW70WsDiQFxoUhEeZwaEvo2uGHWJlL7/OWN6on2aLwaopBOnyBk5aQ9tMy
f81dczgn4CJ3onCGWovbuVpjdO996Fa2ANMyAaxaxvKJpZz5gSwPfxpzPp0tfNBy/T
chQz4FEfkjt/rHtJRfpsMaxi4e9+FpWcVw8dNLfwr2mtI2m8Q/Bd14jKDs356yVBeQ
VqXVlo0jTX6kw==
Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5533c562608so1936637e87.3;
Fri, 06 Jun 2025 04:20:43 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCU2qzND37PXL78bSalAej4hSnJKFApTZn98EWaT8R87EDJt3zWeM5gpEkLSC0qCTSKcXjFExwksQAie6E+v@xxxxxxxxxxxxxxx, AJvYcCVHeCQ3DZru0fUGHlwkLaDzVma7Jv4HxpGNSie1WN2qQlELvE5wJvMBksFue8XoQVX9r+skFOBDXUhmjEU=@vger.kernel.org, AJvYcCWxqUhrLSfq20KP8LCu4Rvrud9ZSDt3YaxHl8QBmZyGwovQMGB6QJbUzHa/AxlxrF2eGf40BEJpOElslMizJw==@vger.kernel.org
X-Gm-Message-State: AOJu0Yyb2bOSzh4TsNKPHBIbf445LI72zf85jxYDLrpVHmy7Zyu66qaQ
5lO0KQUnr7S/T2lSXUI2mIv/Aq23wSvXVEJVpzMCERWkuabfVT6AZqszA9ibxSLQ4lDcJh1AHsG
NpKzTAaBdDkOw28JFY4ZTqVd/KUc7CwM=
X-Google-Smtp-Source: AGHT+IGotelMifHvfI0kxQU1GKWrH79dTAXyh8hKDUGCX9NIBElz/uLWQ5uFvZmiHGQprCmA6Xpe6plpyrH+73inxxE=
X-Received: by 2002:a05:6512:234e:b0:553:3621:efee with SMTP id
2adb3069b0e04-55366c433e2mr755126e87.50.1749208842441; Fri, 06 Jun 2025
04:20:42 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <cover.1748335606.git.legion@xxxxxxxxxx> <ecf0ebdda5bcf82464ed1cebbf50afdcd8b5b23a.1748335606.git.legion@xxxxxxxxxx>
<CAK7LNARkhc40UfrmmqsqmqkCn60=7zHc=pDFGR4o=k2p7CsABA@xxxxxxxxxxxxxx>
<aD1bozP0l67f_wbs@xxxxxxxxxxx> <CAK7LNAQmQtvB4PfmH4MkRM123wySON6cF6TG79fi0WER1sz4Gw@xxxxxxxxxxxxxx>
<aD2vSnZhofEPilcL@xxxxxxxxxxx> <CAK7LNATfUzCXmCb5kKOJOKOw=CJvk7viGgYtrGLwbSAkq7VtyA@xxxxxxxxxxxxxx>
<aEAtUc6OTyvu-ThM@xxxxxxxxxxx> <CAK7LNAQhnA50EyccG2hVqnNHjfFk-JC6zYTkqzUR4Pibg2mzWA@xxxxxxxxxxxxxx>
In-Reply-To: <CAK7LNAQhnA50EyccG2hVqnNHjfFk-JC6zYTkqzUR4Pibg2mzWA@xxxxxxxxxxxxxx>
From: Masahiro Yamada <masahiroy@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 20:20:06 +0900
X-Gmail-Original-Message-ID: <CAK7LNATY+11zvrpfGnnxFENKyXjKC2qfmt3-i5tjVjHs9wiZKg@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFu68IzIGUZHtnHJayFYfspqR6O5akw101n6HxgF3TEX6o0MmWVsTfedvHs
Message-ID: <CAK7LNATY+11zvrpfGnnxFENKyXjKC2qfmt3-i5tjVjHs9wiZKg@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 3/6] modpost: Make mod_device_table aliases more unique
To: Alexey Gladkov <legion@xxxxxxxxxx>
Cc: Petr Pavlu <petr.pavlu@xxxxxxxx>, Luis Chamberlain <mcgrof@xxxxxxxxxx>,
Sami Tolvanen <samitolvanen@xxxxxxxxxx>, Daniel Gomez <da.gomez@xxxxxxxxxxx>,
Nathan Chancellor <nathan@xxxxxxxxxx>, Nicolas Schier <nicolas.schier@xxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, linux-modules@xxxxxxxxxxxxxxx,
linux-kbuild@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 2:10=E2=80=AFPM Masahiro Yamada <masahiroy@xxxxxxxxx=
g> wrote:
>
> On Wed, Jun 4, 2025 at 8:26=E2=80=AFPM Alexey Gladkov <legion@xxxxxxxxxx>=
wrote:
> >
> > On Tue, Jun 03, 2025 at 01:18:25AM +0900, Masahiro Yamada wrote:
> > > > > > Before these patches this was not a problem as non-unique chara=
cters are
> > > > > > in separate object files when the module is compiled separately=
.
> > > > > >
> > > > > > But when the modules are compiled into the kernel, there is a s=
ymbol
> > > > > > conflict when linking vmlinuz. We have modules that export mult=
iple device
> > > > > > tables from different object files.
> > > > >
> > > > > This is because the __mod_device_table__* symbols are global, but
> > > > > I suspect they do not need to be.
> > > > >
> > > > > Let's test this
> > > > > https://lore.kernel.org/lkml/20250602105539.392362-1-masahiroy@ke=
rnel.org/T/#u
> > > >
> > > > I tested this patch with the config:
> > > >
> > > > make allmodconfig
> > > > make mod2yesconfig
> > > >
> > > > and it works.
> > >
> > > Good.
> > > Then, __COUNTER__ is unnecessary.
> >
> > I didn't immediately notice. The patch you suggested works, but these
> > symbols remain in System.map and it seems in vmlinuz.
> >
>
> Ah, yes, if your patch set is applied.
>
> Currently, MODULE_DEVICE_TABLE() is no-op in vmlinux.
>
> This makes me realize that your v3 4/6
> increased the vmlinux image, as MODULE_DEVICE_TABLE()
> is kept for modpost.


With your patch set, __mod_device_table_* will be
included in vmlinux.

My patch changes them from global to local ('D' is changed to 'd'),
but there is no difference in the fact that v3 4/6 will grow
the symbol table in vmlinux.




(1) Your patch set

$ arm-linux-gnueabihf-nm vmlinux | grep __mod_device | head -n 10
c0527678 D __mod_device_table__164__kmod_clk_scmi__scmi__scmi_id_table
c053f458 D __mod_device_table__164__kmod_reset_scmi__scmi__scmi_id_table
c05421bc D __mod_device_table__164__kmod_reset_uniphier_glue__of__uniphier_=
glue_reset_match
c05334ac D __mod_device_table__164__kmod_scmi_pm_domain__scmi__scmi_id_tabl=
e
c054cbd0 D __mod_device_table__164__kmod_twl4030_power__of__twl4030_power_o=
f_match
c0548e8c D __mod_device_table__165__kmod_omap3_rom_rng__of__omap_rom_rng_ma=
tch
c05124a0 D __mod_device_table__165__kmod_simple_pm_bus__of__simple_pm_bus_o=
f_match
c05559ac D __mod_device_table__165__kmod_timer_ti_dm__of__omap_timer_match
c0528a68 D __mod_device_table__166__kmod_adpll__of__ti_adpll_match
c0520a68 D __mod_device_table__166__kmod_gpio_en7523__of__airoha_gpio_of_ma=
tch

(2) Your patch set + my one (extern -> static)

$ arm-linux-gnueabihf-nm vmlinux | grep __mod_device | head -n 10
c0527678 d __mod_device_table__164__kmod_clk_scmi__scmi__scmi_id_table
c053f458 d __mod_device_table__164__kmod_reset_scmi__scmi__scmi_id_table
c05421bc d __mod_device_table__164__kmod_reset_uniphier_glue__of__uniphier_=
glue_reset_match
c05334ac d __mod_device_table__164__kmod_scmi_pm_domain__scmi__scmi_id_tabl=
e
c054cbd0 d __mod_device_table__164__kmod_twl4030_power__of__twl4030_power_o=
f_match
c0548e8c d __mod_device_table__165__kmod_omap3_rom_rng__of__omap_rom_rng_ma=
tch
c05124a0 d __mod_device_table__165__kmod_simple_pm_bus__of__simple_pm_bus_o=
f_match
c05559ac d __mod_device_table__165__kmod_timer_ti_dm__of__omap_timer_match
c0528a68 d __mod_device_table__166__kmod_adpll__of__ti_adpll_match
c0520a68 d __mod_device_table__166__kmod_gpio_en7523__of__airoha_gpio_of_ma=
tch












--=20
Best Regards
Masahiro Yamada


Return-Path: <linux-kernel+bounces-675657-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0F03241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:21:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C456C188FF09
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:21:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EF322882C3;
Fri, 6 Jun 2025 11:21:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="K4XSxYRD"
Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2051.outbound.protection.outlook.com [40.107.223.51])
(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 714FC286D5B;
Fri, 6 Jun 2025 11:21:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.51
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749208864; cv=fail; b=MF7IGbZ1EfczyvLMKhSMNDV8hucwGFnDHC+xdAC7qlSi4z75ZjR2mjqFMD7gkXEioF7ypHoeylE+8duGjFptKmdhtWkiIhi1JwV5xTvEasU2rTN5bUFFO2XLto6omSQwpf654/t/YBDKLD4Nwq7kUUCQ5wdngNWrC1MYgkwDzOA=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749208864; c=relaxed/simple;
bh=aYJg6svoNVn5VCbrkI6OjaE1F8iZj3UtM/gB83tGq9I=;
h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To:
Content-Type:MIME-Version; b=fTLhebWqGdjuU2voCagEsWj0O3T4APLOYQTHCuSA95X4KW6NNCKSlvAu1XxIsKczSVqcVQD9AU5mzu7+2Fix24xkbiicPPE2uq1nnGAx95Mjmxajv5JQC7KwsEL7znpNm46YquEiVy0pL4Xp0L1Ld5TfFFpjCDk/zovIweTIK9g=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=K4XSxYRD; arc=fail smtp.client-ip=40.107.223.51
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=OMH3eJ3eDrXRSOEt35moK28RiMam/psoBhTYmmKxhP+TavkOHoRGjd3WEwas7srOtNh3yXP0JLXi+pDkONnkxXMCV2ygPsjgpP01Yf1XyFSywT8JIL8Z6vgwtyX4sqY9kGeiswUTt+Gb/pre+xtH04NrRSL07tkfXb0LtGMSplbvAxydhlBeAUyBAkhqT/SKP8Pnci8kqkECFM54TMYTv8IDYe+W9IoaMS+U0Pmz8sPAJo/8I10HMSXDZdU4fwEGCVzbYVf6SLarVY+ChBVCJUNo0T/wXdi+wpqf5IxYqMQJ/emqgMZ7/Xqlro64ot43zdEpGm30pg7vAhjWMGO0tA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=7ebMxtEElMePjAJIxLtoSH0aUNAIqzDaSD0SbSVcXdE=;
b=BdG3y/syRrSGKPeMKvOQ8WoOziaKuQULQBta3gl139SUDJ9iRAGL0jvbtqqik04YKQdM+J3jJ2mND/D5tvdD9xDJv3CdCTsibWX6Z81hAfzwcUbZxwI02cYGb5vxU7qOeXMs/m47ymf9qy76yVnBqoV4x71x8/4/DcnBelht4nuBIIEcN+XPyg8QSbcYzFTs4arxL+5Fkpw9QL5sPDGRTENHGGMk/KevEix3EEQr62et1YQiFBkXSiOyvQQ+VxE8vYQwmQKyoaoNIUeM6rQnTPejjZW5ibI6nOqjMixul7FTIi5pobfOcsVE+/geGJC4kk/m5XrHA+rA1jWKyZH1rQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass
header.d=amd.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=7ebMxtEElMePjAJIxLtoSH0aUNAIqzDaSD0SbSVcXdE=;
b=K4XSxYRDVLMuBgcg7wC2eKGtzutChLyyfrRvFx/FxvpUp79WC4dBROQN2lXylwNEgtWNBGdokdXdMhj+wgLCjcb7qHnWfCVr8Kpx2TA116I+JBz4m40JrJiZWSOVeSC4IvRwgDhLxaudlgnxVRzGwXrGOGy6qBovaOTam4DUOBg=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=amd.com;
Received: from PH7PR12MB5685.namprd12.prod.outlook.com (2603:10b6:510:13c::22)
by PH8PR12MB7448.namprd12.prod.outlook.com (2603:10b6:510:214::11) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.38; Fri, 6 Jun
2025 11:20:59 +0000
Received: from PH7PR12MB5685.namprd12.prod.outlook.com
([fe80::46fb:96f2:7667:7ca5]) by PH7PR12MB5685.namprd12.prod.outlook.com
([fe80::46fb:96f2:7667:7ca5%7]) with mapi id 15.20.8722.031; Fri, 6 Jun 2025
11:20:58 +0000
Message-ID: <a766fbf4-6cda-43a5-a1c7-61a3838f93f9@xxxxxxx>
Date: Fri, 6 Jun 2025 13:20:48 +0200
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v4 0/4] Implement dmabuf direct I/O via copy_file_range
To: wangtao <tao.wangtao@xxxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>
Cc: "sumit.semwal@xxxxxxxxxx" <sumit.semwal@xxxxxxxxxx>,
"kraxel@xxxxxxxxxx" <kraxel@xxxxxxxxxx>,
"vivek.kasireddy@xxxxxxxxx" <vivek.kasireddy@xxxxxxxxx>,
"viro@xxxxxxxxxxxxxxxxxx" <viro@xxxxxxxxxxxxxxxxxx>,
"brauner@xxxxxxxxxx" <brauner@xxxxxxxxxx>,
"hughd@xxxxxxxxxx" <hughd@xxxxxxxxxx>,
"akpm@xxxxxxxxxxxxxxxxxxxx" <akpm@xxxxxxxxxxxxxxxxxxxx>,
"amir73il@xxxxxxxxx" <amir73il@xxxxxxxxx>,
"benjamin.gaignard@xxxxxxxxxxxxx" <benjamin.gaignard@xxxxxxxxxxxxx>,
"Brian.Starkey@xxxxxxx" <Brian.Starkey@xxxxxxx>,
"jstultz@xxxxxxxxxx" <jstultz@xxxxxxxxxx>,
"tjmercier@xxxxxxxxxx" <tjmercier@xxxxxxxxxx>, "jack@xxxxxxx"
<jack@xxxxxxx>, "baolin.wang@xxxxxxxxxxxxxxxxx"
<baolin.wang@xxxxxxxxxxxxxxxxx>,
"linux-media@xxxxxxxxxxxxxxx" <linux-media@xxxxxxxxxxxxxxx>,
"dri-devel@xxxxxxxxxxxxxxxxxxxxx" <dri-devel@xxxxxxxxxxxxxxxxxxxxx>,
"linaro-mm-sig@xxxxxxxxxxxxxxxx" <linaro-mm-sig@xxxxxxxxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,
"linux-fsdevel@xxxxxxxxxxxxxxx" <linux-fsdevel@xxxxxxxxxxxxxxx>,
"linux-mm@xxxxxxxxx" <linux-mm@xxxxxxxxx>,
"wangbintian(BintianWang)" <bintian.wang@xxxxxxxxx>,
yipengxiang <yipengxiang@xxxxxxxxx>, liulu 00013167 <liulu.liu@xxxxxxxxx>,
hanfeng 00012985 <feng.han@xxxxxxxxx>
References: <20250603095245.17478-1-tao.wangtao@xxxxxxxxx>
<aD7x_b0hVyvZDUsl@xxxxxxxxxxxxx>
<09c8fb7c-a337-4813-9f44-3a538c4ee8b1@xxxxxxx>
<aD72alIxu718uri4@xxxxxxxxxxxxx> <5d36abace6bf492aadd847f0fabc38be@xxxxxxxxx>
Content-Language: en-US
From: =?UTF-8?Q?Christian_K=C3=B6nig?= <christian.koenig@xxxxxxx>
In-Reply-To: <5d36abace6bf492aadd847f0fabc38be@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: MN2PR12CA0025.namprd12.prod.outlook.com
(2603:10b6:208:a8::38) To PH7PR12MB5685.namprd12.prod.outlook.com
(2603:10b6:510:13c::22)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PH7PR12MB5685:EE_|PH8PR12MB7448:EE_
X-MS-Office365-Filtering-Correlation-Id: 908e8520-cca5-4e3d-5de1-08dda4ec3640
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|376014|7416014|1800799024|366016|7053199007;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?SHp4Y3ZEL1VnNlQrenJsZ0M4M0w2UU81NkNSODFZRVhEMnJrOU4ramlKQ3h4?=
=?utf-8?B?bU9QRmlzUC9BOU9JNGlPK3B4Y0IrSXZKYnRwbWNMdmlqTC94eTJVOTNyRDNJ?=
=?utf-8?B?MEVnTEhoWXA5NVZ6MGJYcjM1RXRtQjdLcjJvclduWmJZS1NjRndFM1NLL0E2?=
=?utf-8?B?M0hFRVFuMG91aDdPcUZuTFpGVUc1ZmFHbWpNS1RMQkc0alhWcGVUaSt4bkRJ?=
=?utf-8?B?eVZ0eUw0TTdVRStPcVBocG40eTlOS1dEVmk1cmJub3hJdWRVdEc3ZTF3dmFT?=
=?utf-8?B?cHZ0d0hTZEQ0WGc5bWc2T1l5d1lmVWtNVEpwY2NzYUhKTE53RzlaUlRXYm5n?=
=?utf-8?B?OWRwZzBoZUpaWnFmV3pJNkVuS2xqNWExbDRGSGY0VFB6WGU3U3VyUy9YYXZK?=
=?utf-8?B?Ry9WaGpnWEhDaGNiS29ZZTdkZEdzUDVBeSt1ZjlhYllybzEzNEVzQTArTFJv?=
=?utf-8?B?RTJzZVhEV0xLWVVWN2wvQStISUU1VThJaTFyU3RER3M5WGh0aElSdml5cEsx?=
=?utf-8?B?cllaZk5aZjN6SytQekpjQzZseXVVT1hTSzlCQjRxdkJXa1BOUlNRcVdxSmw3?=
=?utf-8?B?Z0xYcDdqOCt6TGI4dnZQeW42Mm93Ylc0Nis0WDZvazZhWk5CcXprVXRGRVVM?=
=?utf-8?B?SGgxbmtnUHlFdmJZdisybjVLckpVcjVCcXRIWTRoM1drRGdOSVUwakpvd2VJ?=
=?utf-8?B?UEhxSHBqTks3MkY3Q2E0NUNPdXNiUVVsTDRhR0sxTkVkS2ZOaDRNOVcxYjVH?=
=?utf-8?B?clRxWG9NK1hBZlFXNDY1QWtMRDdwUEEwMGpqSGFDUWhScGxCU1JMSndVbW5R?=
=?utf-8?B?Mk9BN2JtandkT05CTjZ2b2hiazgvc1U0VkJzSC9xc24zYjJ0VHlwWWZvZmpv?=
=?utf-8?B?Yk1ud3Y3eUl3SjZnYnZudzhkeHVsQmNXUm45QXZVdzQ3dktYaWF4ZGoyVzR4?=
=?utf-8?B?Nk1kVFF0YmtHamdGNlFtRXRVbmZuZEtEZ01tYmF1RFhMdFJBdTQ3a00zYVZP?=
=?utf-8?B?aHRvVnNrSHZsWHpHSTMwQTNjSUZacTJPMURER2RHVnBRZU9rYVF0ZGJEalY4?=
=?utf-8?B?NW1SNTJFSG1FZDAvN0xqUXNSZEpCWGg2NjlxUU5pZldwTHNGY2YyR1hMSHVY?=
=?utf-8?B?cFJnOFBPRjNCckpiRnlBamFxNlJReEFTa25jQ0JLRmMyK1RQLzVENHdHLzBo?=
=?utf-8?B?Ti9PUGY3eEJEaDJuZTJLUE5OaWZuend5aTBVWGxvQ3ZQMW9zWDkzVlNWNGVp?=
=?utf-8?B?THlzSDlmM2poQ29XV1lpN3o3QlJPbjc4L3BhQ3NidHZRRmVjMGhuQWljSUky?=
=?utf-8?B?OFJYK1BkblZ0MmFWZStvVEhjR3MwZWlzUUl6OWV4Vy8rWG53UHZlQ0Y0Tlk1?=
=?utf-8?B?YVJCVmFBT3pBMmI2R0RnNWE4blQ1cWFaVnExM3ZyYzBJZGEwN2JtSW1KbTda?=
=?utf-8?B?Q1BMbTRtbURXak5BaUkwWmMvb2lpYWhUVUpYaHVSUGtZMm1lUzZNeTZ6Z05G?=
=?utf-8?B?MUp6UWEvbWZwT1IwYUoveWQxMk1Qb093dWM0cnJ4Y1lQVVNuTnNBaTZ4b3E4?=
=?utf-8?B?ZVFya0VSYUc2MVhLNXZtaXM1UzZRcTB3NjU0WWRIVUxRc01VNXRLb2xkVzZH?=
=?utf-8?B?YnJWOHl6OTMxY01obTU3QlVndVhoeUtOcGt0bGFZYlh1WGFTQmVIbEo1dkdG?=
=?utf-8?B?Ty9SWkdsQ21FcjgyREtvUzFvdkF2aXNPb1cwWVE4RmFTdkw5aVYwdmcwWlEy?=
=?utf-8?B?ZGV5YjlVZHdaenhERm5xZEFpR0tmVFZXQndhWlBoMGZtUWw5VE5PcGRCUThG?=
=?utf-8?B?NHVkNFVoS3p1eWZ5S1NreWZrRE1LNENWMGZ1SE92cGplODRvNFRQK3Q1VTZN?=
=?utf-8?B?dUw3Y3JhQ3FGTERJVmkrRG5kYkxFWkdDVHlBeVZ4ZTRGNXpxYXRXMHpqbkpM?=
=?utf-8?Q?+HZbZsyQfJs=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB5685.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016)(7053199007);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?S1V6anIyRUlaeGFuYWFYVHVRVU1zOEF3cmN0VVltbGU5RFQ1OHRsYUxYb0da?=
=?utf-8?B?dDBJbll4QUQ2TGxYWnFTclh6ZFlMUW9oY0gwL2JjQkF4NHpwYnNxRE9QNVZC?=
=?utf-8?B?Ti8vbk1vbHBBckE3ZlpTYk9RTzBFdDZkVjVBQTNxYmkwaEFwT3NDenRyWC9F?=
=?utf-8?B?TFl4VnhTL1htWDRUbXRMTFVRUXIwMnFnaVdMYklvK1FCc041RVBqVmNmdEdU?=
=?utf-8?B?a2M3NEpKUTdsZ1BGNDBzbWZVdm94bUR1bXd6bGhvck85K05VeWRBamxuRnVW?=
=?utf-8?B?SHFiR3lNbkZZNjJwK1Z5NVdMRi9tUlF1eTZ4bzlhbVEzelVqQnpNY2J0Tm41?=
=?utf-8?B?WTM0YTFQT3ZhbWpDSFdFd0MyZkRCRGt1MnJEclFXd3JRYXdPMFdiUlZOZGcz?=
=?utf-8?B?d2NYNndWUXBOMm4yNG5OYmN3VnNsVzZzQXRib01OeEp5R0twMVNtTlZzOHNY?=
=?utf-8?B?VjVycncxSUU2OXJkUnY1cW1ZTSt4NHl6ZVkxYUJXN2l3UkF2M0pSUVV6MnVq?=
=?utf-8?B?NXVhQW41RS8wZmFoMGsvcGErdHZrQUJkN254UnhsUklxUFdvejVYckhYYmJU?=
=?utf-8?B?bTlBZW9BcHpaOWdTUURXSjQyZExaSFBaSUNiUms3bkkybU9qQTZZemV4WktV?=
=?utf-8?B?dDI1SEVoNUd2RFpKdGFjaVFqVGdrcDlUU1AxQk1lNXVVc0h4YXhmUGZramcr?=
=?utf-8?B?Nll2TjB5U3pqMzhHVXJweEJ2aXEwLzN2dFh5MlRRN21IK211K3ZCdDVaNnl3?=
=?utf-8?B?dUV2Tkd1ajVjeFdVa0ZaOE5TRFJUNlNET3YzZmIyWVFrVlZ5blA1RzV6UzNX?=
=?utf-8?B?ZHNKbU5jTWVRWUhSbWtuL21qOUlrRml3ZFZ4eFlrNzdJRUZBTVNmeWVCWVJu?=
=?utf-8?B?WnFEUTJSSmNsN3FPd1habnlEYTBGZDBpa1d3QmYvL1FSVDIzR3FzSDNKZjlY?=
=?utf-8?B?STFpM2ZjS3IzVzc5eDFubUFHajEzNVhMRXU0QWVCYzMzRFI0SjBGSTBpNnRT?=
=?utf-8?B?YWhzcThvZGdadWFRMHhVQUR2ZVptc2s5VFFPajJEczUzUE50WFV5NWlIQUkz?=
=?utf-8?B?YkJkbWlxeUNSc3lyMGVVSHZQUFZDajkwQm1lUjZmdERsVC9wd2dDalM1eDQ5?=
=?utf-8?B?dXExeU5kNFlDTlZVa1BPaXRrSGE2MmNHTmRDVmVzRkNWZ0NueCtUVDJhWUVH?=
=?utf-8?B?ZVArNVRpRHQxQXNiUnZuR2w2WkRMTkM4OXRubUtkM1ZFY1hWSzVHakYvR0FJ?=
=?utf-8?B?clVGLzlQems3LzhoTFUxRVVwTHBNMnY4SnFCK3hhbE5VODJ3Z1Z2V0FFUmNv?=
=?utf-8?B?bFp3aDJ1NGxGelhPN0hQY3kvOVQ4LzFUSTU5aDlDbUxFREhjcFY3NEJtNnpB?=
=?utf-8?B?ZnY1Qzd5MENXbXVoU2IybTNOVlNjTWZNRTd0ZW9xbG5SUTF2Yy9ibFgzczFC?=
=?utf-8?B?b094aW9uTFRaRXArWE9UYWlML0tSeDBjenE3Y3ZMRCtRNXpEZnI3LzFNZWw2?=
=?utf-8?B?eTNOYjhhNFo2M29OU0Y0ZUpmRExSWS9vOHFuelhQaE9jbllhWG5Zc0NiU1NY?=
=?utf-8?B?NWg3YWJoVnVCQmhZOGZDS0ljMzRqK1M5Z3B6L0pMWFJVUjBxWEhaUG9vRmtB?=
=?utf-8?B?eUt2R1YrYWlodTEyaEkwTUVkeU9ESHZlRlpRa2taaWUwZE55WENCZlBMZHA0?=
=?utf-8?B?OEFFaE5WMEt3djJqTlBOWjdhVG82MnlXOTE0RkhOV0htWjhaY2hubWN3NlV0?=
=?utf-8?B?cTlxaDBGenRKeWV6K2VmSkhvWDFtVWZpWHlpRkc2TE5KY3hCSktBYm9VYXNW?=
=?utf-8?B?djVXR0FCVmZuQ25yYWE3RWJmMXo4OHF2bXYzSGFiUWJaeWYxbkczQ2l4dUQ5?=
=?utf-8?B?ZkFTeWtxKzFFV05OMmlSaW5HNVZMNnIwVWZxRDQ3RHZQeWZEeUdQVWM2MVd3?=
=?utf-8?B?cFdmVWhXZkZuZFZqTGlXVGN1bDdiNWFlTk80SzZ4MGRtTWtjMXE1VnNsZjQz?=
=?utf-8?B?MnIzR1dmVlRZbHd1dlF6Vi9rOUc2ZnVFbkxUU0FON042ZDRjSEgxeG9scGRS?=
=?utf-8?B?Ly95eEUvOElTRHp5VEoxQ0FhQUV3STEzdmxpd2hIbFZJRTh3eW1Rc3RZcDF6?=
=?utf-8?Q?nN1yBgiveWxeuznWSu+tvR0lG?=
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 908e8520-cca5-4e3d-5de1-08dda4ec3640
X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB5685.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 11:20:58.7828
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: QNQHQA2MPreVu/8FZ7eCTbIh0Fm5x5i1XTDgeCC+XoZlSyKtgA/s1PYnGKL57Uj0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7448
X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 11:52, wangtao wrote:
>
>
>> -----Original Message-----
>> From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
>> Sent: Tuesday, June 3, 2025 9:20 PM
>> To: Christian König <christian.koenig@xxxxxxx>
>> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>; wangtao
>> <tao.wangtao@xxxxxxxxx>; sumit.semwal@xxxxxxxxxx; kraxel@xxxxxxxxxx;
>> vivek.kasireddy@xxxxxxxxx; viro@xxxxxxxxxxxxxxxxxx; brauner@xxxxxxxxxx;
>> hughd@xxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; amir73il@xxxxxxxxx;
>> benjamin.gaignard@xxxxxxxxxxxxx; Brian.Starkey@xxxxxxx;
>> jstultz@xxxxxxxxxx; tjmercier@xxxxxxxxxx; jack@xxxxxxx;
>> baolin.wang@xxxxxxxxxxxxxxxxx; linux-media@xxxxxxxxxxxxxxx; dri-
>> devel@xxxxxxxxxxxxxxxxxxxxx; linaro-mm-sig@xxxxxxxxxxxxxxxx; linux-
>> kernel@xxxxxxxxxxxxxxx; linux-fsdevel@xxxxxxxxxxxxxxx; linux-
>> mm@xxxxxxxxx; wangbintian(BintianWang) <bintian.wang@xxxxxxxxx>;
>> yipengxiang <yipengxiang@xxxxxxxxx>; liulu 00013167
>> <liulu.liu@xxxxxxxxx>; hanfeng 00012985 <feng.han@xxxxxxxxx>
>> Subject: Re: [PATCH v4 0/4] Implement dmabuf direct I/O via
>> copy_file_range
>>
>> On Tue, Jun 03, 2025 at 03:14:20PM +0200, Christian König wrote:
>>> On 6/3/25 15:00, Christoph Hellwig wrote:
>>>> This is a really weird interface. No one has yet to explain why
>>>> dmabuf is so special that we can't support direct I/O to it when we
>>>> can support it to otherwise exotic mappings like PCI P2P ones.
>>>
>>> With udmabuf you can do direct I/O, it's just inefficient to walk the
>>> page tables for it when you already have an array of all the folios.
>>
>> Does it matter compared to the I/O in this case?
>>
>> Either way there has been talk (in case of networking implementations) that
>> use a dmabuf as a first class container for lower level I/O.
>> I'd much rather do that than adding odd side interfaces. I.e. have a version
>> of splice that doesn't bother with the pipe, but instead just uses in-kernel
>> direct I/O on one side and dmabuf-provided folios on the other.
> If the VFS layer recognizes dmabuf type and acquires its sg_table
> and folios, zero-copy could also be achieved. I initially thought
> dmabuf acts as a driver and shouldn't be handled by VFS, so I made
> dmabuf implement copy_file_range callbacks to support direct I/O
> zero-copy. I'm open to both approaches. What's the preference of
> VFS experts?

That would probably be illegal. Using the sg_table in the DMA-buf implementation turned out to be a mistake.

The question Christoph raised was rather why is your CPU so slow that walking the page tables has a significant overhead compared to the actual I/O?

Regards,
Christian.

>
> Regards,
> Wangtao.
>



Return-Path: <linux-kernel+bounces-675658-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E5DCA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:25:15 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0B20C178B75
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:25:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AFDC42882BF;
Fri, 6 Jun 2025 11:25:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GBOq9Gbt"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D411E8C11;
Fri, 6 Jun 2025 11:25:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749209105; cv=none; b=ZT8GfXhloKMe6MpGGAyKDzXXhoMWhAU0hD1tWaXPW3htiuNLgu7Q5HQIzvo1bGAzXljnPJUvCLR4wHpQW8HYo1WpmztlQW4ZKtlVYWlMFh3Efmx9CKSbkc7Lq/JgUhsYaOB3OQWcrh96OwIZMLQjjdes0UIYwP4tEWRpiOjl7Ak=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749209105; c=relaxed/simple;
bh=b9A6mvNSH9qd1dMs/0QFGaA3tDqXDEXHAC5Srjbvhqg=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=mh+Hf6vLgL+rWgUjf9t6gJU9c56B0j5x30UuYZKuMGQso6yhAwP3Zop2yCQnF6qIGvcph5qOdu04RdRcIrozRkwn52aD4VF53WI4Re2JmEo0zc0lNGgrWqKDYyTYwkW3YxRaNv2iT4coIQepb1MhiM42OfWuEjdIsAbEZ53Sj8M=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GBOq9Gbt; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB8A2C4CEEB;
Fri, 6 Jun 2025 11:25:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749209105;
bh=b9A6mvNSH9qd1dMs/0QFGaA3tDqXDEXHAC5Srjbvhqg=;
h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
b=GBOq9Gbty+YRge0+oyQXT9e8be0ixsVL+G2uurF6IRGmervupzVL5PaCc+PBjNeqA
z0xCvjBysfJG5xODf9y8cpkjPAFsh3sxlS/kV+enTn+h1lml/QDM3+5P2b5LSqrtYi
YbBKPsxLEaanXI3/Zh4Yejq/VTuh/ixDCZoHF3jes4oO4ydrBE2DepHix8bPA5cngv
6rBzC2eJ/k5JipcJU9h9Z4tPvSaTpnVZip3d+p/Xn+mYc9ndmXKM9Plh7x7xNsNSBj
puPRpgac8JMdwPDp3kGvUCbBGWLBr59rN/Ou4Zmjtps6/ZZCRuCGvoirfBv5oEiw5C
EJHuM7aI4s8Kw==
Message-ID: <e08b2f76-17b1-4411-a428-b2f0f8a7d7fd@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:25:00 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v3 1/6] dt-bindings: crypto: Document support for SPAcc
To: Pavitrakumar Managutte <pavitrakumarm@xxxxxxxxxxxxxxx>
Cc: linux-crypto@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, herbert@xxxxxxxxxxxxxxxxxxx, robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx, Ruud.Derwig@xxxxxxxxxxxx,
manjunath.hadli@xxxxxxxxxxxxxxx, adityak@xxxxxxxxxxxxxxx,
Bhoomika Kadabi <bhoomikak@xxxxxxxxxxxxxxx>
References: <20250602053231.403143-1-pavitrakumarm@xxxxxxxxxxxxxxx>
<20250602053231.403143-2-pavitrakumarm@xxxxxxxxxxxxxxx>
<fae97f84-bdb9-42de-b292-92d2b262f16a@xxxxxxxxxx>
<CALxtO0mpQtqPB0h_Wff2dLGo=Mxk02JJQkK4rn+=TuScNdSfxQ@xxxxxxxxxxxxxx>
<3570be5b-cb20-4259-9a9b-959098b902d0@xxxxxxxxxx>
<CALxtO0mH=GwhQxQBsmMQYd+qgAue9WxXN1XWo9BncVJvJk6d8A@xxxxxxxxxxxxxx>
<cd6e92af-1304-4078-9ed7-de1cb53c66da@xxxxxxxxxx>
<CALxtO0mVMTWqidSv7LQSQd-rA_TmJy_0xgBSd=mP27kg=AXQRg@xxxxxxxxxxxxxx>
From: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=krzk@xxxxxxxxxx; keydata=
xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79
cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu
JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH
gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE
J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj
NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS
BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU
vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM
Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD
TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg
S296bG93c2tpIDxrcnprQGtlcm5lbC5vcmc+wsGVBBMBCgA/AhsDBgsJCAcDAgYVCAIJCgsE
FgIDAQIeAQIXgBYhBJvQfg4MUfjVlne3VBuTQ307QWKbBQJoF1BKBQkWlnSaAAoJEBuTQ307
QWKbHukP/3t4tRp/bvDnxJfmNdNVn0gv9ep3L39IntPalBFwRKytqeQkzAju0whYWg+R/rwp
+r2I1Fzwt7+PTjsnMFlh1AZxGDmP5MFkzVsMnfX1lGiXhYSOMP97XL6R1QSXxaWOpGNCDaUl
ajorB0lJDcC0q3xAdwzRConxYVhlgmTrRiD8oLlSCD5baEAt5Zw17UTNDnDGmZQKR0fqLpWy
786Lm5OScb7DjEgcA2PRm17st4UQ1kF0rQHokVaotxRM74PPDB8bCsunlghJl1DRK9s1aSuN
hL1Pv9VD8b4dFNvCo7b4hfAANPU67W40AaaGZ3UAfmw+1MYyo4QuAZGKzaP2ukbdCD/DYnqi
tJy88XqWtyb4UQWKNoQqGKzlYXdKsldYqrLHGoMvj1UN9XcRtXHST/IaLn72o7j7/h/Ac5EL
8lSUVIG4TYn59NyxxAXa07Wi6zjVL1U11fTnFmE29ALYQEXKBI3KUO1A3p4sQWzU7uRmbuxn
naUmm8RbpMcOfa9JjlXCLmQ5IP7Rr5tYZUCkZz08LIfF8UMXwH7OOEX87Y++EkAB+pzKZNNd
hwoXulTAgjSy+OiaLtuCys9VdXLZ3Zy314azaCU3BoWgaMV0eAW/+gprWMXQM1lrlzvwlD/k
whyy9wGf0AEPpLssLVt9VVxNjo6BIkt6d1pMg6mHsUEVzsFNBFVDXDQBEADNkrQYSREUL4D3
Gws46JEoZ9HEQOKtkrwjrzlw/tCmqVzERRPvz2Xg8n7+HRCrgqnodIYoUh5WsU84N03KlLue
MNsWLJBvBaubYN4JuJIdRr4dS4oyF1/fQAQPHh8Thpiz0SAZFx6iWKB7Qrz3OrGCjTPcW6ei
OMheesVS5hxietSmlin+SilmIAPZHx7n242u6kdHOh+/SyLImKn/dh9RzatVpUKbv34eP1wA
GldWsRxbf3WP9pFNObSzI/Bo3kA89Xx2rO2roC+Gq4LeHvo7ptzcLcrqaHUAcZ3CgFG88CnA
6z6lBZn0WyewEcPOPdcUB2Q7D/NiUY+HDiV99rAYPJztjeTrBSTnHeSBPb+qn5ZZGQwIdUW9
YegxWKvXXHTwB5eMzo/RB6vffwqcnHDoe0q7VgzRRZJwpi6aMIXLfeWZ5Wrwaw2zldFuO4Dt
91pFzBSOIpeMtfgb/Pfe/a1WJ/GgaIRIBE+NUqckM+3zJHGmVPqJP/h2Iwv6nw8U+7Yyl6gU
BLHFTg2hYnLFJI4Xjg+AX1hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/
JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu
4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB
YpsFAmgXUF8FCRaWWyoACgkQG5NDfTtBYptO0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v
qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5
RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg
Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2
H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB
dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT
AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu
jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2
zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw
XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A=
In-Reply-To: <CALxtO0mVMTWqidSv7LQSQd-rA_TmJy_0xgBSd=mP27kg=AXQRg@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 13:02, Pavitrakumar Managutte wrote:
> Hi Krzysztof,
> Appreciate your inputs and feedback. My comments are embedded below.
>
> Warm regards,
> PK
>
> On Wed, Jun 4, 2025 at 7:37â?¯PM Krzysztof Kozlowski <krzk@xxxxxxxxxx> wrote:
>>
>> On 04/06/2025 14:20, Pavitrakumar Managutte wrote:
>>>>
>>>>>>> +
>>>>>>> + snps,vspacc-id:
>>>>>>> + $ref: /schemas/types.yaml#/definitions/uint32
>>>>>>> + description: |
>>>>>>> + Virtual SPAcc instance identifier.
>>>>>>> + The SPAcc hardware supports multiple virtual instances (determined by
>>>>>>> + ELP_SPACC_CONFIG_VSPACC_CNT parameter), and this ID is used to identify
>>>>>>> + which virtual instance this node represents.
>>>>>>
>>>>>> No, IDs are not accepted.
>>>>>
>>>>> PK: This represents the specific virtual SPAcc that is being used in
>>>>> the current configuration. It is used to index into the register banks
>>>>> and the context memories of the virtual SPAcc that is being used. The
>>>>> SPAcc IP can be configured as dedicated virtual SPAccs in
>>>>> heterogeneous environments.
>>>>
>>>> OK. Why registers are not narrowed to only this instance? It feels like
>>>> you provide here full register space for multiple devices and then
>>>> select the bank with above ID.
>>>
>>> PK: No, we cant narrow the registers to only this instance since its
>>> is just a single SPAcc with multiple virtual SPAcc instances. The same
>>> set of registers(aka register banks) and context memories are
>>> repeated, but sit at different offset addresses (i*4000 +
>>> register-offsets). The crypto hardware engine inside is shared by all
>>> the virtual SPAccs. This is very much for a heterogeneous computing
>>> scenario.
>>
>> Then maybe you have one crypto engine? You ask us to guess all of this,
>> also because you do not upstream the DTS for real product. Any
>> mentioning of "virtual" already raises concerns...
>
> PK: Yes this is a single crypto engine, maybe I should have detailed
> that in the cover letter. I will fix that. And what I have pushed in

So one node, thus no need for this entire virtual device split.

> the patch is my complete DTS. It might need updating depending on the

If this is complete, then obviously "snps,vspacc-id" is not necessary.


Best regards,
Krzysztof


Return-Path: <linux-kernel+bounces-675659-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A425241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:30:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 2E9171899E9B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:30:21 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E10FF2882C0;
Fri, 6 Jun 2025 11:29:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C6ej6Vz1"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22E848C11;
Fri, 6 Jun 2025 11:29:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749209397; cv=none; b=s7/r4iViL8RZ6ZGsTP3jVsREky++2H54/Jub7OyLVlpPMpRWYB+Lld5/6Zly2kCERmxuDedGsnaYa52ofg/k0jspgJqh5MWFjwBDfBbf5gi6mWZUa8pOp4XqFOaJnp8eipghVZkdtJPCvw5kyBPFbTFQ3xLPpRyav6G32wUetdA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749209397; c=relaxed/simple;
bh=cBiavoyhnUOaPt1BwOXLTc0hTIQzKDyHJgcKWt47iAI=;
h=Content-Type:MIME-Version:Subject:From:Message-Id:Date:References:
In-Reply-To:To:Cc; b=jb0MOgsb/beu6UhFZUtJ+X7vK5OlISl1peTQGdZrJ+1/bdXf9Cx2Sv+anxgKb/q92DWDyrY2gc9aKn1uFEVIEmoEvAIcjycskfiEbb1J9uBVXy8TIWp64is3dUz748K+NnhplBpXIOHkxvit07n9aKq77r5O8OvVjL4TPGc45pU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C6ej6Vz1; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF128C4CEEB;
Fri, 6 Jun 2025 11:29:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749209396;
bh=cBiavoyhnUOaPt1BwOXLTc0hTIQzKDyHJgcKWt47iAI=;
h=Subject:From:Date:References:In-Reply-To:To:Cc:From;
b=C6ej6Vz1Jl288yUxrmCCiJ/I4RwBIdmmi4qoQYnYFtWa2tKbKZnA4W07ZSLOR/MFv
UPhpJ36O/A/x3CoW6RENq24rPDYdrTT3svNQGYnOnOaBNOfig+pvSoZk6jonX9cgbF
94T/6UDaq7IeVkQ9/xlnwar5F1BSSvubfsr6VlQI78P5wiFP+zGYGcJwRUF3U8B1Um
RDzCTri4NZsNz5CZ1Oxb3siT2493Fox6+QJQYfj2cajcs2k4P3GxjvbGwVeZuNLkmM
akEj0qbPUZKjQR0e7HhTE8qGkT+hVJbEoxPoqbzt/MiB5hOXrUFmV24hsm1se88oeW
PcRLAitpCl/kQ==
Received: from [10.30.226.235] (localhost [IPv6:::1])
by aws-us-west-2-korg-oddjob-rhel9-1.codeaurora.org (Postfix) with ESMTP id ADD853805D8E;
Fri, 6 Jun 2025 11:30:29 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: Re: [PATCH v2] net: enetc: fix the netc-lib driver build dependency
From: patchwork-bot+netdevbpf@xxxxxxxxxx
Message-Id:
<174920942850.3814198.2791344535997265319.git-patchwork-notify@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 11:30:28 +0000
References: <20250605060836.4087745-1-wei.fang@xxxxxxx>
In-Reply-To: <20250605060836.4087745-1-wei.fang@xxxxxxx>
To: Wei Fang <wei.fang@xxxxxxx>
Cc: claudiu.manoil@xxxxxxx, vladimir.oltean@xxxxxxx, xiaoning.wang@xxxxxxx,
andrew+netdev@xxxxxxx, davem@xxxxxxxxxxxxx, edumazet@xxxxxxxxxx,
kuba@xxxxxxxxxx, pabeni@xxxxxxxxxx, netdev@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, imx@xxxxxxxxxxxxxxx, arnd@xxxxxxxxxx
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@xxxxxxxxxxxxx>:

On Thu, 5 Jun 2025 14:08:36 +0800 you wrote:
> The kernel robot reported the following errors when the netc-lib driver
> was compiled as a loadable module and the enetc-core driver was built-in.
>
> ld.lld: error: undefined symbol: ntmp_init_cbdr
> referenced by enetc_cbdr.c:88 (drivers/net/ethernet/freescale/enetc/enetc_cbdr.c:88)
> ld.lld: error: undefined symbol: ntmp_free_cbdr
> referenced by enetc_cbdr.c:96 (drivers/net/ethernet/freescale/enetc/enetc_cbdr.c:96)
>
> [...]

Here is the summary with links:
- [v2] net: enetc: fix the netc-lib driver build dependency
https://git.kernel.org/netdev/net/c/82cbd06f327f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




Return-Path: <linux-kernel+bounces-675660-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3913A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:30:43 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5D81D175A48
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:30:44 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E79902882C0;
Fri, 6 Jun 2025 11:30:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JR5M25zy"
Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C44F31E412A;
Fri, 6 Jun 2025 11:30:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749209435; cv=none; b=albAn1a0UhjbCqNkNk3s7CF1hpTqLZaNgAFNOrTNPn4lZDvHv60PV/aUP6Omu++qHf8YjkcrOhnQVtTaRsFR8nAJbFEI6w0EWy04jUJ3Oyj6aUTuNaNYQmGrKmfbbmV+qGxFFrZO2D8qHbnOtMzjDqFzOn4l28Op+w4oixlw/HY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749209435; c=relaxed/simple;
bh=jmFalxl+IjOuauT3NekbWCs/KPsAGvLXHGBFChS7x1o=;
h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=CMljesR0tsSw/NuMM08PMGZV0zVlXCDFgVt/1lL40KRMpw3bPv9OLlk0Q72AiAiaoMKgdq5efjjac18u0htWdjhLQaKcfjMJa84x+LNjoeLyFJqPct+x6yUehVcfNYzMOYMjGdSSPccv2uVeprwLBIZ/2yUTU13iBnBGRa095tI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JR5M25zy; arc=none smtp.client-ip=209.85.210.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-7481adb0b90so75071b3a.1;
Fri, 06 Jun 2025 04:30:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749209433; x=1749814233; darn=vger.kernel.org;
h=content-transfer-encoding:subject:from:to:content-language
:user-agent:mime-version:date:message-id:from:to:cc:subject:date
:message-id:reply-to;
bh=kMRMKtR8HGzEv7gbQn+3NSkzgRpxdmG10HTMD5pS2Rg=;
b=JR5M25zy67pM+lxKmulkzmTY7x7UGOhB/KfV0MyfZDAlXtEUwbxdSjS1rr5BgPKW5g
Nkgtr7eYVOnTlUtVUzUfx3YF/JnxK15LQa6sKU2LvcyYwuSWPH8UClydaHkL0tMXBdat
HITSwe52Zc9UatXShexgLpP8lTyHNNL6j6kKIX4Sn5dIY9vlvrcMK1UtgpQQ871mmGfh
+S2/Q0XswabWLe/W8fcaCtukqwwGP8h2JqhK5SZhbpu7hG3/HNy1Di/p0mGjIUYXSbUq
M2TVDGmDrG4aufAqON3Xop4LEsHDY2GrehlqTSr3Jo6QhLHPaYgBztxJIGRj0S7PLFUN
i1yg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749209433; x=1749814233;
h=content-transfer-encoding:subject:from:to:content-language
:user-agent:mime-version:date:message-id:x-gm-message-state:from:to
:cc:subject:date:message-id:reply-to;
bh=kMRMKtR8HGzEv7gbQn+3NSkzgRpxdmG10HTMD5pS2Rg=;
b=cOOM5Uthd8SnUxazDBtm/kDUP5Uw/wLzCfGGI7N/6naOPye3zk5IVjDQ2peGeRslbd
Uv4zD1DqwQzCfTxHBeAOxmXHsXga48Rq7BRS/JGnG+Z2cK73mNMagVNjHde9P29zWM5U
xHWl9DqPdVndU4bI21O07vfjMJ3T112UOcEGj1f4ZDWnSLaCWHJ4YRvIWJdzDC/OQ69q
UxlVAWLDTnYk12oZKjEkq8QXRcdu2YAQaVBuL3ZVHrZHd1GUs1v3QSub2S4v7UJBZ3IV
NVlLoFXd8sAdWTTNDjgg/3MUfKva9YfusM3c8idQQKI79NAQKK5qJ0KUi284QLGdyQs8
88rQ==
X-Forwarded-Encrypted: i=1; AJvYcCUDFY9AyfQazRqVTgbryAew+LKv5yvgd1tADEztJ41snzru+BkYjYEEkw4WgKPZHqHvz1SjANFIz9HY1eg=@vger.kernel.org, AJvYcCXiBKPpRllnn8SP0lf0av3HBOA2Vw9xWDWn3ERB/F0K70yeRNn4XEkR0rTmUl7P2xF0eXzvWXuxYTy3@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YwBA9HSuybm+v6Yg93Kg+MCoPVjQhLmIHq8V/gUd6urMzTQexuk
gKwhxS4GwAVLExsE4FNMm6lrv3k2SJGaHVmX+EpXakKbQ8cMJrNL6NU+mHMvmPI=
X-Gm-Gg: ASbGncupKtZJKduHYjxxfFoYAhJG29k3J27WJFbxiuo7iZN8q+AaDXwvyDDncgDpkGu
pGjA2O4RHjpoRDSbetuoMgXSFjdrBk5C3101AlE3D1sbv3N5qJgK4UJBMMP2m+7h6UcDJX3QhaV
Pl0phbZnQAaRkZyVN3liqzqRKRhvYDZtWDD+Ac5ZoI8DSkpRpqM0NNaE4zbFeIk2sb6xQxro9cH
vCv//tf/ih1XYLmrdp/zAePqwVQP2YBcToUwQh9zO9parQQVfzfu5ARl6pF8b3ctI/V0wvYGcDO
Jg5AhTMaPmhNp8WC+ndJ75rnAqfE0Hx6nOImxb/h+jl8/eQkUONcGuT45V6Z3Z2S1YHUivuftDN
QDVKDTmNUTgdTzF3L
X-Google-Smtp-Source: AGHT+IEe775tc9IgVBaDFigw7nF+8klI4feYgHHUK8AIhyENn/tQSWUCLbyTAiy60D9ylimH2aEWmQ==
X-Received: by 2002:a05:6a00:4646:b0:725:f462:2ebb with SMTP id d2e1a72fcca58-7482d17eee6mr953176b3a.0.1749209432927;
Fri, 06 Jun 2025 04:30:32 -0700 (PDT)
Received: from ?IPV6:2406:7400:56:b5f1:3fae:6c04:a3e1:b0f3? ([2406:7400:56:b5f1:3fae:6c04:a3e1:b0f3])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482fc43a1esm720591b3a.38.2025.06.06.04.30.31
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:30:32 -0700 (PDT)
Message-ID: <6430992c-d50b-4cfd-bcb9-d7d376c53444@xxxxxxxxx>
Date: Fri, 6 Jun 2025 17:00:29 +0530
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: johan@xxxxxxxxxx, linux-usb@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, lestoppe@xxxxxxxxx
From: Amit <lestoppe@xxxxxxxxx>
Subject: [BUG] usb-serial-simple: device conflict with Owon VDS1022I
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi,

    PATCH 6.1 082/167 adds serial support for OWON HDS200 through the
simple usb serial driver (). This causes issues with Owon VDS1022. The
VID and PID is the same for both devices so the the Linux kernel loads
the serial driver, preventing the associated software from working.

    My current work around for this is to blacklist usb_serial_simple.
Given that this driver change was recent and still under testing, could
we find a solution for this that doesn't involve such hacks at my end.

    I  was able to root cause this issue only because the USB device
and  software was working correctly before. A new user would just assume
that the device is not Linux compatible.

    I've filed a bugzilla report here :
https://bugzilla.kernel.org/show_bug.cgi?id=220193

    This is the software : https://github.com/florentbr/OWON-VDS1022

regards,

Amit



Return-Path: <linux-kernel+bounces-675661-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5358541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:31:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id D0549189A048
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:31:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D53B02874F9;
Fri, 6 Jun 2025 11:31:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="P/F46xx0";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="HTO5c23F"
Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32])
(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 BC0D520330
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:31:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749209477; cv=fail; b=ZDEVl7oewhblT8A63oojqoGq359sYExAFrQWWQCFslDiYv8BeAs9Y+u9i72bctccQvO6/RGRkgLcSQpCOmALDBIsPvNY5Earqtfq9HMe/UkycLuKkcP4dMzoeL86P0bR1l9GMSyV2XlYYsT+qEwWml0zTyp/XGG5uj/fQlluwVY=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749209477; c=relaxed/simple;
bh=Tah12cOkZAyq6+kzY2NoOPY5IxqcjRfL/zqOYvrR5iU=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=oL0jdqwqCvlLgNDbrs/hFSMW1M4vwFbATizNZkASsuXig0SpCGpPhC7G+zuPYXIox0xdyqka9rMHBlEq7xZSQm8xEKRIgtNCPTrLQ6eEUTzWvo56bqj/YP5yCfGp4KAW/r4JMOi48eBHDJiNZ9bolvhYRFKnPKPdLvD7qPqDwAo=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=P/F46xx0; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=HTO5c23F; arc=fail smtp.client-ip=205.220.165.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246627.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MkAL032120;
Fri, 6 Jun 2025 11:30:51 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=
corp-2025-04-25; bh=4UKP9VEvd6VufNPloCe9remfsAlw0e6WgnixysXks9I=; b=
P/F46xx0bCOO15suoX1xOpXBeI6OfEGYXVrabNPgLzvqqWbvREeTYEaDAW7lVbsZ
LOpFD3d7V0VJ8piYt9l3WHBThiUft6XR7R3nVjsbWFOeVwCNsJ/DRRtHXz3vEyVj
BHMrEuZXZAsNzqiuOzgnw7IYdIawv9gNtvpgC2uz/2er60IB2zNQ4NyYXnaQcYhv
gCaEk9AaMJOW+jzMD6m4HxmbnwXA8nH9kaHs9kxXGpuDGM3Wt441P2zrDMR8wtu0
2MbutHEmcY09Ghopo7710XaN/AQ65awyA907PcoUF54/ylUMQHQv2iD/Moe3VsTX
8+lOMIAjH62Uek+j9oF0sQ==
Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8cyucv-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 11:30:50 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5569E86u000561;
Fri, 6 Jun 2025 11:30:49 GMT
Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11on2046.outbound.protection.outlook.com [40.107.236.46])
by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7ddyvd-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 11:30:48 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=DraVTxodNgV3U3U5Xkz7MIHh6a2oNo0AVdV1Mye6kYDkVjbLaDMfO5vlV/OVKnkEM4GuJZV3BzZ44o+V6YMHrNB78B3qVVCTFPNmert/IF5h7mCBP33n5F5tv3evmb4xa7VO5edS/iKjn4YOvQ+BJCJnB8aWPcb4q8Cf9WEcppmrtN7DoIO5J44lXeudVr2JAYBc3ucT61QSZfji8w6H8t7tCAi/Shl0aKRiGlE3Bkg8nctIGk7w0XRQ4QF2SyVve1MDDN7TjICUO3IOGQxCu/2GxKeMSakfOvumnJPa8Hnavt+2uJmPgjLYVdZEcJfDqzS5VeLZ/9MgshNJKCzgZA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=4UKP9VEvd6VufNPloCe9remfsAlw0e6WgnixysXks9I=;
b=ACfyzE7zWpdPyT0v6yJXOmQpZRJmy68LYUQ7pY/Q+kt8xBNZ3yeVhSdoOuFkFZlfoP8e4A/M4IEheOJ/o5EkCsYtNpx4zXaYtR6WfLYAU0ogyuj7wAVmI43gooyDI9HHOzLk33R/Gv+BaT20mDL4QIhBadsSJcRANGrCoMya8u5PXNUxCfWQKaHA3e6nDFKrf62LuzQ2B2hL60vv3ZsZMrZRz6wyRutWxjmuDLijJBikMa1GMwrBQazSYIrvnT1AFBNHGGGwhMbN/YMoeRvZx2hwSaj9xcJIUTst3rvUDbsxafwX+LtthrE8mwObizmFurLkxxBDF8NygDth7wBdjw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=4UKP9VEvd6VufNPloCe9remfsAlw0e6WgnixysXks9I=;
b=HTO5c23F5K5DDgdQ+dAGQhk6qTzytG5OdzqkjYMR/DKQMi+mgiWN405V6sMNuEyjLyVYEHvVBO4IvPi19JytcFtWQmjKi6CnG2r+9a0gbvjvKPGKEiegXv2W17nm5qV2gJYMUg/xAACbVCbZV61TzrGBrFEi2KT+QE5GvIC5Sq0=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 11:30:46 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
11:30:46 +0000
Date: Fri, 6 Jun 2025 12:30:42 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Oscar Salvador <osalvador@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v5 00/10]
Message-ID: <c4a96aa2-10ae-4dc1-abd8-be91f7e8b583@lucifer.local>
References: <20250605142305.244465-1-osalvador@xxxxxxx>
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250605142305.244465-1-osalvador@xxxxxxx>
X-ClientProxiedBy: LNXP265CA0024.GBRP265.PROD.OUTLOOK.COM
(2603:10a6:600:5e::36) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|CY8PR10MB6777:EE_
X-MS-Office365-Filtering-Correlation-Id: f61e5254-8c36-4934-f8d0-08dda4ed93e6
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?TW1PUlBWOVpLTS9UYUFab0tSUmhCOUhyTGFlT1hodVhKdmJWRFNqR0QwTWQ0?=
=?utf-8?B?amVTNVREZm5XcDhLNldmS1RKdlYrK21Vdm1ZOEpDZDJHcFhOMHJKbDBuYm5k?=
=?utf-8?B?WTJ6UjBaYWRoc2tQTTZtdUtpQVFicERLejBlZDE3dm1heC9Ob1diK3M2czZs?=
=?utf-8?B?VEovc0ZSU3BSeEFaRGIvYklWWVdKZ09Gb1F6OTQ2bEg1UkNqdTl2MnVJQkN1?=
=?utf-8?B?cW9XdmltTElBK3E2WXQ4Qms2MHJCellUc0ZxekgxOXZsYUxtemczcUY0MjBL?=
=?utf-8?B?SXAyaDVyQkFjTTNyckNjaXJJZGV1OFlLVTFWR1lydU9nK29qQnB3L21DY3FQ?=
=?utf-8?B?UEZNV21NZGUrK1VJb2QvSlhmYWdVdHBLQzBPSHE0VHprOG45YW5WdXA5dzRG?=
=?utf-8?B?YTZoUjF2MFZWTVVJR0Y0QWxKcVRDNXpKZmk4TzBKaFlmUHQ0YitBYlRBMXZG?=
=?utf-8?B?eTJ4MXNORFhpMWxEeVpQaEhpcm1ybTVlYVFDbThjdG5GZzcyYzhWeldRVGNr?=
=?utf-8?B?OElJTWZZZFpBSGRWQUk5aUZ5Zkh0RTk4SytPQmN1Q3p3TDY0eGtIT3AwYjRE?=
=?utf-8?B?YlI4NzhjeThiWC8zOFRiMysvanAraW14QkZ5VDV2VkdQa2RITEJ3amt4WTk2?=
=?utf-8?B?T3pnOE5VU3RtbHByM0E1V053c0JlYzZRT2U2UElJSkJzcnZ6WTUzeXJjZHZT?=
=?utf-8?B?YXpaYXdLM0pZWUJrU0ZONjhta1FlVHRXZHZsQTN0ZnhBSzhwamFNOURwaVRj?=
=?utf-8?B?RmVRV1lzMlhicFpzTjJDYkl6bDJXNTJ4Zlg0TXdlbzQwejY1TzFSMHhNaGRH?=
=?utf-8?B?M0pNMVF0V1VDY3pZT1l2OUNHTUEyUFV4WmJJZE5wa3gwUHNtYTlLTTZNYTdF?=
=?utf-8?B?cGljdVJsU2tKSFBHR2dhMVoxbS9pbko5a0RzSTZuVmRONmowdUtxOFhXeHVv?=
=?utf-8?B?Z0xvek53Mm9CNUVXYXp5NlNNZXhOa3NoZXYxM1UrNGlzV0l4WTZuUlBVR2w5?=
=?utf-8?B?V1BNcjFDWnp1cVozZ3MyMEl4QXo2aU9HSjlHd3RDaW5lS1J0UU42dnRTQk1x?=
=?utf-8?B?SGprbHQ0UkVkMFBzRThmSS9Qa1pmOVdKd1E0OVRUU1pxR3hWYUlCNFVhR3Vz?=
=?utf-8?B?c2lrb09JTi91VVlHdmhYVWZUVURRb3Z4c3ZrUGt6c0NNcTFmbVFweXArNXZj?=
=?utf-8?B?T0dYbDBNa1ZnQ3U1NUI2TzdFd3N5dC9LTWYxL0h1L2R0RXdSek05cG9Mbitr?=
=?utf-8?B?RWdFSW0zOHFVRm55SEp3OXUxQTNkVWd1cjJqdFB0RnRZbS9EVU05bUhNZmx1?=
=?utf-8?B?VitVNTg5b0RwdC82YXZ1TFBrUmpFUG1mUXNsemNsV2hPTlFEUHlsMUVBdnZz?=
=?utf-8?B?Wmd5dytrTnhwVEZKK21RbGlxeXNlN2JybHdjU09ob21kSTMyc2tPNVBvcWtx?=
=?utf-8?B?ZlArTUR2b3prdTQ2SGVINWFoKzFMdVExNDl6eWd0UlF3RituQUphOU9CRUFW?=
=?utf-8?B?WHg4bnF6ajdGM2FVOU00ZHdvTzJkSGFZeTlNNUo1NzlqVUlUdFdkZUtxTG9y?=
=?utf-8?B?WGxGcUJUSktsMlV4VjYwczBValpaWFF5cGl2eEdSeEpoNit0VllpU1FtY0hJ?=
=?utf-8?B?UUdMUWhhcjNOVVd4UDQvV1dPU2hrRWlLL2psV2w1N1VJVDgrRkdzeVlDK2VJ?=
=?utf-8?B?NEJSMDNqYXdWbGd5TVVXT2wzY29FMG1uaXFDQUF2dENER0NjUlRwcE0zMVJn?=
=?utf-8?B?S2ZLaEFLdDZ2N3d3VlordUZUV3lNbkV1OEpyaVBzczBhcUF4SjRkQ3ZPRnRQ?=
=?utf-8?B?ZFRJMmhKSnljU3d1QUdua2dOdWtxazlwRjE1aHpSOGNuQ0VyblFkZTYxbEpF?=
=?utf-8?B?QmN4MXRsdDhQcTd3L2lpMnNoS1c2QXNJK0FLNVhlL21YbHN2R3VRTVZHUlYw?=
=?utf-8?Q?uyhZUqBHWfo=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?WmVES3c0UmZxa3ZoOEtTeFBpVmdWd1M2aGRsUno2b1JTYU5HTjA2SFFNcVE2?=
=?utf-8?B?eFlKOW1HaXBrYVRySDBUcFJudHo4SzN5cFRQdDBwZS9rLzUwdExCRUNiK2t6?=
=?utf-8?B?Nm9sZGl1a08weFhYUkZHLytIYkwwblFaanlXb2tSSkVUaHJhQmxWMlpJSnN3?=
=?utf-8?B?eDcwMjVERnRYSDR1Q1VRMVhnbjB0QzhOYW5pd0piMkpJN1kvZ2cydXpvRzM1?=
=?utf-8?B?dzdLajZac3ZwN3VGTXNBU0RsRlgxVWtjRGFobnRBQ1Nac1p0dHh3Y1M5UFA4?=
=?utf-8?B?a0U2ODBYdzMxdjRRZDEwbXZpYnUvTlhSUUtZUG5ubnhBWHVZVEdqM2xkWlox?=
=?utf-8?B?QUhHRjBuYVh6OVZRWGdLNHE2dlNWZ0h1NXVYTlcyUmJFdm03OFJQZDdhTXN0?=
=?utf-8?B?K1oyL1NsekdrQXVOWjh1N2pnaVFIdVJBYklFMjcvL3hlRVB2dGhEbmIzWmZW?=
=?utf-8?B?TWVNT3owa3hmQUxpYitJMTJDaGk2NTRXYXp6ZW50UVNRR1VYN3FvaHdPQmc2?=
=?utf-8?B?bStVSzVCUjJPcUxsellrZW5YK3g4TFhCTzVsd0NTL0ZBUEk0aXpSRzZlSzlT?=
=?utf-8?B?Q1E4Ti9PamZkRzM3eFVVOHRoOFdTa2FaZEZIcEx5a3ZkbFllQlA4QU1uUVJw?=
=?utf-8?B?WUNJQU9iYW1Rc1c1ek8wemR5S3pPbFU4OVJXMU1hKzZiSW1MaU5vWThBeldB?=
=?utf-8?B?T25ZaTBkNjBwMWZaemdscHRXeUFyelN2czVRR0JvMjU4TFhLa3NHUGQwNUxk?=
=?utf-8?B?a1NZTlF5TWJTODFmKzFUNVZYZi9WSXpPNDdnUS9IMFlvSHdSQ3BWNFVxUDho?=
=?utf-8?B?d2JDZVNoS01vaWNxTE1xTVlxSFZnUnk5YlQrOHhVUGJucktQWnVUZ2UzT0FX?=
=?utf-8?B?UUlGY2tVUEpKNERuelVFdnd6dEFyNjU1c2RvN29VZ2x3aDFjY0VzdzdzOEZD?=
=?utf-8?B?Ukp0bmVwWm9oazRrT1dmTGxHbU90ZW53cVF6anpDZ21hYTFTZS85K2hTSkph?=
=?utf-8?B?WWk0UXJFK2xYVG1FK1R0b0V1cE5uM1JqQmF1YWxHZ3pvTmg2cjJFbjVpdW15?=
=?utf-8?B?VG4vdFJpNHFDK3ZLb2dnOXptTVFaNUpLd0liTzhpVXM3cmlpZHhXazNEcG5N?=
=?utf-8?B?d0dGS0RLdU1odExMYXlBL2V6NjM2cVpYUXZPK2ZBb2RpZ2VmMVdiZFlualA4?=
=?utf-8?B?bDV1SmFPaGoweVBlY2ZQd3h6ZVluMFB5UGswMzdGbm4yeHhSQXNPcFVuc0JH?=
=?utf-8?B?TFY3enlUbjMzZGhTRmlmc2xrVjh5dFZUSkhZVS9ObUUvSzJHYnROQldCNDRH?=
=?utf-8?B?eWtsb2tTUkNaL0hlT2p4VUVmS1FmdkFoUzZVelJycHZqVE94RWdudVA5VUdz?=
=?utf-8?B?LzhjMW9kdW1NR3BDa08rSU8wU0JVTmpOcHN0S0lsWmJmeXhidG82QUIxZ0pT?=
=?utf-8?B?eEZBVFBDei9OelZaeFR0cmVmbjgrc092NnJlUktDSUxsQm82anpma25WWk9M?=
=?utf-8?B?U1FaMHhzUXljbTkyRGlqb2swTmJtZjU2K01PUVZsQ0dBZ3BRaWd6ZlJGYnJp?=
=?utf-8?B?S3B6TjRiKzl1aEZsY29mRzZTcFhYNUNpYjRUejFxZkRmOTVGajVUeVBkMEhU?=
=?utf-8?B?SWd2ekFmZmltaWhaMU9IZXNHeWRVNkxxb3FyZFV0ZnFKOGdOaStNVGhyaWZt?=
=?utf-8?B?cnhZWDV5OHZjc1NyNmptZlFaWEgvbnJ4bXYxRkVzbnBJcU5nT3hMeS93QWt2?=
=?utf-8?B?ZHZNa1p5YVhXYVZLZE5pZFRyWE5aOXAwd2ZOSzZrbXg2VzB2d1ZpVTd5Mkw5?=
=?utf-8?B?MUxGc1VKbGNGTktuWSsreVVmQ3hIU0pyNldXSTNNclkxc0Irb25zVldLK2hG?=
=?utf-8?B?WTFVZjZRaUJJVUV6RFFuUEFoVFBHMXphQ1N2a1lMT2FFZjhqaS9JUmF1UDJl?=
=?utf-8?B?Wmd0b2xncGRySFRPamZlS3lpSUJ4dEd3UlEvdTV5THZMc0xvUDBNK014d2xh?=
=?utf-8?B?ZWhBcnNwb0Z5YVN1YUZvMnNtVFBJT01XcmlEK2hGZjNzTnB0Q2lDVUx3MkJO?=
=?utf-8?B?Y0J0VHZnTmpRaFNoaW1EL3pCS0dYNy9nNGJnYWU2VVhqNzJHcE4va21YYzdZ?=
=?utf-8?B?ZUFvRGttQWFzdDRjN1hUcVN1Z0YwS0VFaEdtRm5WWTdtSDBqVzdpdHN2WjE1?=
=?utf-8?B?U3c9PQ==?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
xeqcusLxVEAmVuJRQqxMBvqUJTwHP49Abjj3UupSGJwTdKpBQkd3VOnMMl1upehvL6Zd4G+3Bu31fB35hhyiKZxuWHF2J7h4ZZIKbdmAXsAwNfruwiHK3Rrz+73H/QbnRHquxm2ese6jvsAkSOeKSWbQ3b5vZov+QmBLxUijqzI+UF+Sw/mNw46j6bimTdtMOfk/+cMgvUknpMd1Y6fdnHEfYbjYLhTCC+7ana+2nJA5vyD/yRaAUn+G9ErtSp9OLc32P3jtjEFKUjiia26aNaiAa7mxR5fJJXCFb6NMF6hvIum+tOXqmDf/9Fbd2HBKuuZNTWxIT+8HfBo7Fe4MHtMkqqgCAPtAh8PHwDo0DVQFB+kCOI/rrezfUsonVPwbaIkD7ez6QbQrVoqyjK90fequDfe3ZwUJatpoFyvZVwnwsjKpEi9l0er8pY4jf0mvUG+Xdub0B24yvwgq11IgFK8DdzBE0HMnmf65df4Ax7GrG5bncKbYJ08NhiybfdEQUU91pLcq2q2tJwW6WxWnSKF0LZrGSBkWyVl+Sw1hcrFCAn8ydfvVs59qdFOGEsQBip8lbQi3vxsKVPk+wxi0DJkZOFyxKiYJ6SF6CqtJgKc=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: f61e5254-8c36-4934-f8d0-08dda4ed93e6
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 11:30:46.7278
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: sJ/FweE5xlhu9jWROIZcP+gst40MYZMXRy4h/EPfKIl3+b8uDKz+E4j5B7TuTVeoDpE6lqni5vWKNefEiY3BXqLLlGTAp1oLe2koSnSW1QU=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 malwarescore=0
phishscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060104
X-Proofpoint-GUID: 2E1h8_C6ZgTKbWnXjlLU569zwgoGLfV1
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEwMyBTYWx0ZWRfX8Tdv739N+kZD 1Zu5R9Y/Z80mbRfdUwf/URCYwuN956jD9EAKkR5vQQCyy9XbGpqi3Tmje86GatELA7wmtMuTS5X G+9Ya3yJiSFr0Mc6RwmLsdKi1x9qegJXMiYt2GCfM0+dhfnQS3dAv8DYRtk6B+ms2ZGo5/bJVYx
5ienzLHn9La/E9FvFUbR1ICXIl5UCOjZwBucqinKcPDkKacAwDAJ0TdIsbiTwDlsfcGQUP2hGaL iv+9CMVEqusnKRaMn1poY++u0L+Mxah6Vf6z11RFtSHkheAt+D8slTFb31ca3vjWfRILTcdlliA 92zGBZFTTqZ36ruqA8mThi/Hk0r5b9qS86fO4zfMvax49lCBOx8XeQOvycG7ECdzUr1fA0z0a0k
yO62lfo4WAQC7oC+NLl4QE05U6FSK0THab2HwbpTCs3LAHd7FSjhrBejnnV50V2yit71kAEu
X-Authority-Analysis: v=2.4 cv=KaTSsRYD c=1 sm=1 tr=0 ts=6842d16a b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=_aJ2he0yhPmxFmETX2AA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 cc=ntf awl=host:13206
X-Proofpoint-ORIG-GUID: 2E1h8_C6ZgTKbWnXjlLU569zwgoGLfV1
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Oscar,

I don't have time to dig into what's broken here, but this series is breaking
the mm-new build.

NODE_REMOVED_LAST_MEMORY for instance doesn't seem to be defined, but there's a
bunch more errors.

Are you expecting stuff to land from other trees that isn't merged in Andrew's
tree yet? Maybe from slab tree?

We probably need to be careful with series that have dependencies like that
during the merge window, maybe RFC or wait until after merge window in that
case, or maybe add a note saying 'please don't merge to mm-new until after the
merge window' or something.

Thanks, Lorenzo

mm/slub.c: In function â??slab_mem_going_online_callbackâ??:
mm/slub.c:6168:23: error: invalid use of undefined type â??struct node_notifyâ??
6168 | int nid = narg->nid;
| ^~
mm/mempolicy.c: In function â??wi_node_notifierâ??:
mm/mempolicy.c:3792:22: error: invalid use of undefined type â??struct node_notifyâ??
3792 | int nid = arg->nid;
| ^~
mm/slub.c: In function â??slab_memory_callbackâ??:
mm/slub.c:6220:14: error: â??NODE_ADDING_FIRST_MEMORYâ?? undeclared (first use in this function)
6220 | case NODE_ADDING_FIRST_MEMORY:
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/slub.c:6220:14: note: each undeclared identifier is reported only once for each function it appears in
kernel/cgroup/cpuset.c: In function â??cpuset_init_smpâ??:
kernel/cgroup/cpuset.c:4054:9: error: implicit declaration of function â??hotplug_node_notifierâ??; did you mean â??hotplug_memory_notifierâ??? [-Wimplicit-function-declaration]
4054 | hotplug_node_notifier(cpuset_track_online_nodes, CPUSET_CALLBACK_PRI);
| ^~~~~~~~~~~~~~~~~~~~~
| hotplug_memory_notifier
mm/mempolicy.c:3798:14: error: â??NODE_ADDED_FIRST_MEMORYâ?? undeclared (first use in this function)
3798 | case NODE_ADDED_FIRST_MEMORY:
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/mempolicy.c:3798:14: note: each undeclared identifier is reported only once for each function it appears in
mm/slub.c:6223:14: error: â??NODE_REMOVING_LAST_MEMORYâ?? undeclared (first use in this function)
6223 | case NODE_REMOVING_LAST_MEMORY:
| ^~~~~~~~~~~~~~~~~~~~~~~~~
mm/slub.c: In function â??kmem_cache_initâ??:
mm/slub.c:6300:9: error: implicit declaration of function â??hotplug_node_notifierâ??; did you mean â??hotplug_memory_notifierâ??? [-Wimplicit-function-declaration]
6300 | hotplug_node_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
| ^~~~~~~~~~~~~~~~~~~~~
| hotplug_memory_notifier
make[4]: *** [scripts/Makefile.build:203: kernel/cgroup/cpuset.o] Error 1
make[3]: *** [scripts/Makefile.build:461: kernel/cgroup] Error 2
make[2]: *** [scripts/Makefile.build:461: kernel] Error 2
make[2]: *** Waiting for unfinished jobs....
mm/mempolicy.c:3804:14: error: â??NODE_REMOVED_LAST_MEMORYâ?? undeclared (first use in this function)
3804 | case NODE_REMOVED_LAST_MEMORY:
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/mempolicy.c: In function â??add_weighted_interleave_groupâ??:
mm/mempolicy.c:3843:9: error: implicit declaration of function â??hotplug_node_notifierâ??; did you mean â??hotplug_memory_notifierâ??? [-Wimplicit-function-declaration]
3843 | hotplug_node_notifier(wi_node_notifier, DEFAULT_CALLBACK_PRI);
| ^~~~~~~~~~~~~~~~~~~~~
| hotplug_memory_notifier





On Thu, Jun 05, 2025 at 04:22:51PM +0200, Oscar Salvador wrote:
> v4 -> v5:
> - Split out conversion for different consumers (per David)
> - Renamed node-notifier actions (per David)
> - Added new Documentation for new node-notifier and updated
> the memory-notifier one to reflect the changes
> - Make sure we do not trigger anything when !CONFIG_NUMA (per David)
>
> v3 -> v4:
> - Fix typos pointed out by Alok Tiwari
> - Further cleanups suggested by Vlastimil
> - Add RBs-by from Vlastimil
>
> v2 -> v3:
> - Add Suggested-by (David)
> - Replace last N_NORMAL_MEMORY mention in slub (David)
> - Replace the notifier for autoweitght-mempolicy
> - Fix build on !CONFIG_MEMORY_HOTPLUG
>
> v1 -> v2:
> - Remove status_change_nid_normal and the code that
> deals with it (David & Vlastimil)
> - Remove slab_mem_offline_callback (David & Vlastimil)
> - Change the order of canceling the notifiers
> in {online,offline}_pages (Vlastimil)
> - Fix up a couple of whitespaces (Jonathan Cameron)
> - Add RBs-by
>
> Memory notifier is a tool that allow consumers to get notified whenever
> memory gets onlined or offlined in the system.
> Currently, there are 10 consumers of that, but 5 out of those 10 consumers
> are only interested in getting notifications when a numa node changes its
> memory state.
> That means going from memoryless to memory-aware of vice versa.
>
> Which means that for every {online,offline}_pages operation they get
> notified even though the numa node might not have changed its state.
> This is suboptimal, and we want to decouple numa node state changes from
> memory state changes.
>
> While we are doing this, remove status_change_nid_normal, as the only
> current user (slub) does not really need it.
> This allows us to further simplify and clean up the code.
>
> The first patch gets rid of status_change_nid_normal in slub.
> The second patch implements a numa node notifier that does just that, and have
> those consumers register in there, so they get notified only when they are
> interested.
>
> The third patch replaces 'status_change_nid{_normal}' fields within
> memory_notify with a 'nid', as that is only what we need for memory
> notifer and update the only user of it (page_ext).
>
> Consumers that are only interested in numa node states change are:
>
> - memory-tier
> - slub
> - cpuset
> - hmat
> - cxl
> - autoweight-mempolicy
>
> Oscar Salvador (10):
> mm,slub: Do not special case N_NORMAL nodes for slab_nodes
> mm,memory_hotplug: Remove status_change_nid_normal and update
> documentation
> mm,memory_hotplug: Implement numa node notifier
> mm,slub: Use node-notifier instead of memory-notifier
> mm,memory-tiers: Use node-notifier instead of memory-notifier
> drivers,cxl: Use node-notifier instead of memory-notifier
> drivers,hmat: Use node-notifier instead of memory-notifier
> kernel,cpuset: Use node-notifier instead of memory-notifier
> mm,mempolicy: Use node-notifier instead of memory-notifier
> mm,memory_hotplug: Rename status_change_nid parameter in memory_notify
>
> Documentation/core-api/memory-hotplug.rst | 78 ++++++--
> .../zh_CN/core-api/memory-hotplug.rst | 3 -
> drivers/acpi/numa/hmat.c | 8 +-
> drivers/base/node.c | 21 +++
> drivers/cxl/core/region.c | 16 +-
> drivers/cxl/cxl.h | 4 +-
> include/linux/memory.h | 3 +-
> include/linux/node.h | 42 +++++
> kernel/cgroup/cpuset.c | 2 +-
> mm/memory-tiers.c | 14 +-
> mm/memory_hotplug.c | 167 ++++++++----------
> mm/mempolicy.c | 10 +-
> mm/page_ext.c | 12 +-
> mm/slub.c | 45 +----
> 14 files changed, 240 insertions(+), 185 deletions(-)
>
> --
> 2.49.0
>
>
>


Return-Path: <linux-kernel+bounces-675662-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 165D841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:33:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 442EC189A0D0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:33:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D8BB81E412A;
Fri, 6 Jun 2025 11:33:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="AvRMOeek"
Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131])
(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 B2A8820330
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:33:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749209588; cv=none; b=m+ZiFMgtdZto+LZpH66xyWb0V25SXGyHLrdEB9GbEsbJ4YbZ+VgqM9VWew0t9/G4SeKxbpsKbQxAfPK1QSl8bhmADh5cKz/PJ9j0lAh9ywPdOpDy2pBTY7/A3fykvj7y69MbZuomDkX2/wrvlYqOXFoVofIOHRu6UsKbBYmf5Ic=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749209588; c=relaxed/simple;
bh=rjq1RfB16uNwsEaeeDKPTE1D7mp2xB4/K2KeD5ubBp0=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=DkyScBCtbAqpxypNYnXbZQBADuJKXjxpqeVI4mPqsi89SjNzo1SGwfLkYFOXyQtbJcQsb77BxVqj7JoRSpEzckWnG8ACtv1qwsdUhcqDMhMvCCEqD01+lX9cLwy8tjEdTckot6lJbCl445htTVytPVki1lPriWjO+5/ym9pb+Zc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=AvRMOeek; arc=none smtp.client-ip=205.220.168.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com
Received: from pps.filterd (m0279864.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5569sHtI006499
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:33:06 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=
cc:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=qcppdkim1; bh=
hBsVUSV4bS/Pj8To1O6ismeXm6A04KaflnyzIZ+5dok=; b=AvRMOeek5EwJU2YB
0fyP/4clx+tIreBlfo30vhV6WzpoZEFXv0O5iVcSwLbb78v+srVl0kMSKf1kGmY5
zvXTpd/B0JpsKkLWBcuq+Ah2ZxATf4rVEunFlzhjHHgBDW91jTUS7wY1KSNcjAMq
5FloY9SaMTjP5qiomrJIuXu2w0RiFdHGXd+UASM6TtntCY20EWrL5VaUmUDERLDf
oHHbDlhZuPDulg+ljh9dHBx4Cq4XZepbv0+qAnQ7jUYFm7ywrun+pAzm+z1RAvmI
gxyWfYPFS71srhJlh7iIbYWO+EbQ06TLejh54jKqGJCiU0aTt34QwFpaZEAnw2o+
y30SYA==
Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8nvddq-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 11:33:05 +0000 (GMT)
Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7d094e04aa4so44714485a.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:33:05 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749209584; x=1749814384;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=hBsVUSV4bS/Pj8To1O6ismeXm6A04KaflnyzIZ+5dok=;
b=RGJ2XzXfeVDc50wfnZAtAL3COhmr6+K6OxUB8HMpDoBQqmHE9iGesi98EO/qKEhI9w
ykObBKd8EXN5HFHpotwJYLJcjSEYzkZcjwfDVva5RBqGVQJkklRbu3nSPD6WCAnOY6fY
d6Ko5z9nMETmnAs14CXw09fbyNqqV4GT6vsnT+vv00K/DyztpVTtHRuCpY8HwfkjvFh4
3etqoqORNx/pEEpBs/wMBM0+GZcrj+NL2Ye7WRCDliGab4oSjg0mBBkVnA9HlnAl7vNp
2IexeWJ2F9YviW8Tbr3Eigt4WhvaOCzrGvgqNdCwkItRgIdzdLnw0+vMtyIbXL4XGPgk
G7Ow==
X-Forwarded-Encrypted: i=1; AJvYcCXBi/VjwiCDDyWqu9Z3DtesK/Umi2h686CWzEpt00ehmQScleSrh30fGrM+PJOdOL1WnP9eqPgKdsK8qxo=@vger.kernel.org
X-Gm-Message-State: AOJu0YwHJ2N3as9wqqY5xvXcLNG4KS961jqT/GUqohKPq8ubWj6yIHwI
hiIQ4f010L4swKpOggB+Bj/EwYNYVcz2OPdxFiyFLN8vL+8jJoTkauu7VUOYfCvuyCAhJ/1sj5l
pO2HIxwGjMlxw1DY+dfMOcOYAqqNU9BUSUlq1zYq/GGEOgspgy1/MBI52eNK4iIJhW1M=
X-Gm-Gg: ASbGncuW9RSOZcSp9k9e0z1KkYKRPGqtrzYc7DKgvGeRk01T79asMAzUcf2W8S/0Nw4
memw8D57xLMaaThNOPEaqhXcNv4XaYklMDtIrsMp0dxboimwFa6tK7SkKdx2ZDR+z3ZguHQBBTA
f9+7DScaqY/ORuvGw6cGCmKankH1/DkbBv/a2oDzIXqzAj4pyU74VKAIYIyCaTtNg3hKY+GwT5f
hyNljOdns5DKeAbM4AzpeNM+ddXT13Jol3u96nUzF0+vuf4fKwPZYCtTQv4vJOpm0MxSWzcklx5
mRKV2LJHSlvyxCm3hKu+O4jMLlU+lYnQ2aXR8m3GeaSPOUCP8N572RBp3VW1U5D/bg==
X-Received: by 2002:a05:620a:410e:b0:7c0:add8:1736 with SMTP id af79cd13be357-7d33df1fe47mr93551585a.13.1749209584475;
Fri, 06 Jun 2025 04:33:04 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IFkuxkZEdiQyqedab+Vm7k2HP8tSudyEGg5/Rxa0+D0cherRON5LyZpShuOvPOo20kuyO7SzA==
X-Received: by 2002:a05:620a:410e:b0:7c0:add8:1736 with SMTP id af79cd13be357-7d33df1fe47mr93549685a.13.1749209584031;
Fri, 06 Jun 2025 04:33:04 -0700 (PDT)
Received: from [192.168.65.90] (078088045245.garwolin.vectranet.pl. [78.88.45.245])
by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-607783de2bcsm873720a12.68.2025.06.06.04.33.02
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:33:03 -0700 (PDT)
Message-ID: <05534fa7-9479-4fe0-85bd-0dca5541f739@xxxxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:33:01 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] ARM: dts: qcom: msm8960: use macros for interrupts
To: wctrl@xxxxxxxxx, Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-arm-msm@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Rudraksha Gupta <guptarud@xxxxxxxxx>
References: <20250606-msm8960-irq-macros-v1-1-03e573ba26d6@xxxxxxxxx>
Content-Language: en-US
From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
In-Reply-To: <20250606-msm8960-irq-macros-v1-1-03e573ba26d6@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Proofpoint-GUID: X9z2UlCqVK5CXQPA9tRI9IIvlS6K8K4U
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEwNCBTYWx0ZWRfX3G6/b7SF0yFu
ojMZj9sgeZ54Dgwf/vUtEA6avYRefh8JnJjSQAdyiqO6oPKY8ijyy2rGrnrTgQ123oHJgzO+zog
xgvEK82fkXpIqcTofFFQ62UW5jDcFEFos5zq9wtVisRtHPxdXvDR6+93rt603OdCJ83ex3hTsUu
ai6Lu8vycY11XscljyiTalt2v+gaqZDDw9ewe7CbZjx0XEzKyeTJNg39bgqQpznKMnvcQ7wlfrp
zSBmIWukOVJi2mff+zG++D8peMqahibBm7bQQyNSKAzAGflzaZJW39Z98/vP+0C9LcSARt/Is3p
gDg1oCM/WA5QyC4hhD4hG+ROILZg7X7zWvsnYnVh9AIiJXFr+TwAdnL85OaHCL9RVNNG7an0yEq
hpdetG6lGEoK1jHFFTK5vmDNTc1vbZmelgwnP6FHuC+fQB38TARvAxB3holC9rAjWGLxELll
X-Proofpoint-ORIG-GUID: X9z2UlCqVK5CXQPA9tRI9IIvlS6K8K4U
X-Authority-Analysis: v=2.4 cv=UphjN/wB c=1 sm=1 tr=0 ts=6842d1f1 cx=c_pps
a=qKBjSQ1v91RyAK45QCPf5w==:117 a=FpWmc02/iXfjRdCD7H54yg==:17
a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8
a=MzN8uu8svZ0T6_zCNRoA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22
a=lZGKyyPKw46fRox7ShMU:22
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
priorityscore=1501 spamscore=0 impostorscore=0 lowpriorityscore=0
phishscore=0 mlxlogscore=685 clxscore=1015 malwarescore=0 adultscore=0
bulkscore=0 mlxscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a
authcc= route=outbound adjust=0 reason=mlx scancount=1
engine=8.19.0-2505280000 definitions=main-2506060104
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 1:03 PM, Max Shevchenko via B4 Relay wrote:
> From: Max Shevchenko <wctrl@xxxxxxxxx>
>
> Replace the raw values with macros. No changes to the output
>
> Tested-by: Rudraksha Gupta <guptarud@xxxxxxxxx>
> Signed-off-by: Max Shevchenko <wctrl@xxxxxxxxx>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>

Konrad


Return-Path: <linux-kernel+bounces-675663-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 929CD41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:40:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B349B17621B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:40:45 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C7BC2882C3;
Fri, 6 Jun 2025 11:40:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yr0VC8AM"
Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 017B52874F9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:40:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210038; cv=none; b=niHMrel7hvSQ2o+WGGkWjduUf601m8jLt5Ki2aruhUt9MKbRxrFOVFtFL7/CbvU4UucZ4WggR/32vwOD4ZLl5+rgW/ao81nBofNhMH2QZ5Y4k1FOnyrMe/rVoQTVBEU0wnwv0q7uolhUaDrw0XqCKVufY1Ds0HshlKFlbaAx5M0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210038; c=relaxed/simple;
bh=9JAv+lsJK+UUVnLtRy4m0/3CjekfbABM/4Za5oCwU68=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=DG1QOB+T3KqUY3D+f89ymuU86JnvvBTrwRXxNGIj0o0keZD6BVLu8BaSZ4ia6FUVbI/EpxDJ6+g3sFwXw4EQL3NabhOOzsEkBN8z6g0GMkEDyWAokkiC3/r2OkLCkaWnYzgzDLdA3RckpCndPtuV9xuV+fHlPkgDslnjxgl8S5U=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=yr0VC8AM; arc=none smtp.client-ip=209.85.161.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-6062e41916dso989344eaf.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:40:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749210035; x=1749814835; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=QqaoojFiVes+ZO0jsy6RpLFdw7INbC2+V4FCCgGkvIo=;
b=yr0VC8AMvDwf8IRxleciWqBpy1Ral0XCYQg58dJXQ0ug/2+YZQI+X8DusDEaAJfCcW
aVdX5zhOVs2BBb5iuvoDJkAh7sSXX2O6mBwTFYo4BG2hmcGmoBR96eOS0BOwj2hvu/79
mcYGz0ZLPsA9dZJz0v+lYsXTb4bE/S7yTvoALA6OI1ar1CS2xSKusIJuCCmsWQTZozkm
wDOw23dVL0DkV3FugZkVBMwLMbtO9+C5cnmqWh9RgODog6tw0BtI+cGXKj/3MIk8qxyi
xolLvI691stmJweFvhGxsv40HRmz9hCB4hRHeeN0KBGsHWbpCSOHK1UBg4f7yhtgwpvt
OvGg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210035; x=1749814835;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=QqaoojFiVes+ZO0jsy6RpLFdw7INbC2+V4FCCgGkvIo=;
b=H8wrvcSo+XY/EQnuF0osq+vFlWJjtgApk5BT0+7MNzVWlZnBq0UpBgGFQ+sgMKocwU
8jFd0PRrC0Bi7hclj5BpQ4dbjwTUNCGn3VEatZ7KSkmCIC4HVT32P/wlD74yMyJ329A1
3a1/4pcykDakc8x0qeZjlMZHUNGA/649v1CFUKA4U/8aMWTKd21XPlPVdtcG2kRm2El5
4Dcg+NoqMR3Vf2xv5GD+ezGiP1o6cxHCNVNlanxxclp0LW+qFUrn53mNCfFknd9ePBSw
sMAAlUO1DDeg21GfcA0vgKGsS2oX5jMmg85fUHO9QOoLADjT0eeN9en4qnQ/LqLP0v1N
OlwA==
X-Forwarded-Encrypted: i=1; AJvYcCXQAmy1up1urklR3hfscyyiYS5zFetNTT4r8UCUgwu+LmsAM2kYqhbkWtpUjvOM8btmMMEGKV65ivwkQ6k=@vger.kernel.org
X-Gm-Message-State: AOJu0YzwDTaTLpmGLynTAJ6AG52tsJp8y0Fn6ZY3B28XLBjNO1xtA6nk
/bBnJca8GMPzaq1Ilyq/fFD/0qYDbyaqjbV95sIzLznrsuzZE4W1CqB2ACfAUMr5yGMzpSGI6FX
U4oXRSCO35t5i97Z4vu9gsoSMbOaS1swPYo42E5gCiQ==
X-Gm-Gg: ASbGnctz1jlanKMVOvyaEDBXkg20jxCd0NM0f3YOMRHPvc+1p5c7cBrJ8k6tfVrISkd
tZpSX0Dr0Y56x8aGrdy6W6ekdSasnvqPk8hu/N8m7OfFKgCvO5Av0Q7xpQmZ90S8g8pcdfRys63
urvJYXRYQPuJ+7TdwkOgsSjzjXviXsE+1WcA==
X-Google-Smtp-Source: AGHT+IGPaAGn9iQyMBJtFjG6VFBrTrEjl1SqdtOd+jkmmGGT5jvCC0aGOFstBgHykg8Ve8H76UnHvFuNqDfGC3ioIYM=
X-Received: by 2002:a05:6820:2112:b0:60b:b134:a1 with SMTP id
006d021491bc7-60f3cf2e2c5mr1700381eaf.6.1749210034900; Fri, 06 Jun 2025
04:40:34 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250523-b4-gs101_max77759_fg-v4-0-b49904e35a34@xxxxxxxxxxxx> <20250523-b4-gs101_max77759_fg-v4-2-b49904e35a34@xxxxxxxxxxxx>
In-Reply-To: <20250523-b4-gs101_max77759_fg-v4-2-b49904e35a34@xxxxxxxxxxxx>
From: Peter Griffin <peter.griffin@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:40:23 +0100
X-Gm-Features: AX0GCFuEetRBi0jDLFg0Uft93KobL6YT9ud-De2FOwUUfLokKDe78RZcyXziMWE
Message-ID: <CADrjBPqOMOyHP=aQ1+fg2X58NWRp-=MJBRZfpbEhQsTzaZ9LHw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v4 2/5] power: supply: add support for max77759 fuel gauge
To: t.antoine@xxxxxxxxxxxx
Cc: Sebastian Reichel <sre@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Dimitri Fedrau <dima.fedrau@xxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>,
Will Deacon <will@xxxxxxxxxx>, =?UTF-8?Q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>,
Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Alim Akhtar <alim.akhtar@xxxxxxxxxxx>,
linux-pm@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-samsung-soc@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Thomas,

Thanks for your patch and working to get fuel gauge functional on
Pixel 6! I've tried to do quite an in-depth review comparing with the
downstream driver.

On Fri, 23 May 2025 at 13:52, Thomas Antoine via B4 Relay
<devnull+t.antoine.uclouvain.be@xxxxxxxxxx> wrote:
>
> From: Thomas Antoine <t.antoine@xxxxxxxxxxxx>
>
> The interface of the Maxim MAX77759 fuel gauge has a lot of common with t=
he
> Maxim MAX1720x. A major difference is the lack of non-volatile memory
> slave address. No slave is available at address 0xb of the i2c bus, which
> is coherent with the following driver from google: line 5836 disables
> non-volatile memory for m5 gauge.
>
> Link: https://android.googlesource.com/kernel/google-modules/bms/+/1a68c3=
6bef474573cc8629cc1d121eb6a81ab68c/max1720x_battery.c
>
> Other differences include the lack of V_BATT register to read the battery
> level. The voltage must instead be read from V_CELL, the lowest voltage o=
f
> all cells. The mask to identify the chip is different. The computation of
> the charge must also be changed to take into account TASKPERIOD, which
> can add a factor 2 to the result.
>
> Add support for the MAX77759 by taking into account all of those
> differences based on chip type.
>
> Do not advertise temp probes using the non-volatile memory as those are
> not available.
>
> The regmap was proposed by Andr=C3=A9 Draszik in
>
> Link: https://lore.kernel.org/all/d1bade77b5281c1de6b2ddcb4dbbd033e455a11=
6.camel@xxxxxxxxxx/

I think it would be worth noting in the commit message this is basic
initial support for the M5 gauge in MAX77759, and things like loading
& saving the m5 model aren't implemented yet.

That's important as some values such as the REPSOC register value used
for POWER_SUPPLY_PROP_CAPACITY show the result after all processing
including ModelGauge mixing etc, so these values won't be as accurate
as downstream.

>
> Signed-off-by: Thomas Antoine <t.antoine@xxxxxxxxxxxx>
> ---
> drivers/power/supply/max1720x_battery.c | 265 ++++++++++++++++++++++++++=
++----
> 1 file changed, 238 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/power/supply/max1720x_battery.c b/drivers/power/supp=
ly/max1720x_battery.c
> index 68b5314ecf3a234f906ec8fe400e586855b69cd9..c9ad452ada9d0a2a51f37d04f=
d8c3260be522405 100644
> --- a/drivers/power/supply/max1720x_battery.c
> +++ b/drivers/power/supply/max1720x_battery.c
> @@ -37,6 +37,7 @@
> #define MAX172XX_REPCAP 0x05 /* Average capaci=
ty */
> #define MAX172XX_REPSOC 0x06 /* Percentage of =
charge */
> #define MAX172XX_TEMP 0x08 /* Temperature */
> +#define MAX172XX_VCELL 0x09 /* Lowest cell voltage */
> #define MAX172XX_CURRENT 0x0A /* Actual current */
> #define MAX172XX_AVG_CURRENT 0x0B /* Average current */
> #define MAX172XX_FULL_CAP 0x10 /* Calculated full capaci=
ty */
> @@ -54,15 +55,28 @@
> #define MAX172XX_BATT 0xDA /* Battery voltage */
> #define MAX172XX_ATAVCAP 0xDF
>
> +#define MAX77759_DEV_NAME_TYPE_MASK GENMASK(15, 9)
> +#define MAX77759_DEV_NAME_TYPE_MAX77759 0x31
> +#define MAX77759_TASKPERIOD 0x3C
> +#define MAX77759_TASKPERIOD_175MS 0x1680
> +#define MAX77759_TASKPERIOD_351MS 0x2D00
> +
> static const char *const max1720x_manufacturer =3D "Maxim Integrated";
> static const char *const max17201_model =3D "MAX17201";
> static const char *const max17205_model =3D "MAX17205";
> +static const char *const max77759_model =3D "MAX77759";
> +
> +enum chip_id {
> + MAX1720X_ID,
> + MAX77759_ID,
> +};
>
> struct max1720x_device_info {
> struct regmap *regmap;
> struct regmap *regmap_nv;
> struct i2c_client *ancillary;
> int rsense;
> + enum chip_id id;
> };
>
> /*
> @@ -271,6 +285,80 @@ static const enum power_supply_property max1720x_bat=
tery_props[] =3D {
> POWER_SUPPLY_PROP_MANUFACTURER,
> };
>
> +/*
> + * Registers 0x80 up to 0xaf which contain the model for the fuel gauge
> + * algorithm (stored in nvmem for the max1720x) are locked. They can
> + * be unlocked by writing 0x59 to 0x62 and 0xc4 to 0x63. They should be
> + * enabled in the regmap if the driver is extended to manage the model.
> + */
> +static const struct regmap_range max77759_registers[] =3D {
> + regmap_reg_range(0x00, 0x4f),
> + regmap_reg_range(0xb0, 0xbf),
> + regmap_reg_range(0xd0, 0xd0),
> + regmap_reg_range(0xdc, 0xdf),
> + regmap_reg_range(0xfb, 0xfb),
> + regmap_reg_range(0xff, 0xff),
> +};
> +
> +static const struct regmap_range max77759_ro_registers[] =3D {
> + regmap_reg_range(0x3d, 0x3d),
> + regmap_reg_range(0xfb, 0xfb),
> + regmap_reg_range(0xff, 0xff),
> +};
> +
> +static const struct regmap_access_table max77759_write_table =3D {
> + .no_ranges =3D max77759_ro_registers,
> + .n_no_ranges =3D ARRAY_SIZE(max77759_ro_registers),
> +};
> +
> +static const struct regmap_access_table max77759_rd_table =3D {
> + .yes_ranges =3D max77759_registers,
> + .n_yes_ranges =3D ARRAY_SIZE(max77759_registers),
> +};
> +
> +static const struct regmap_config max77759_regmap_cfg =3D {
> + .reg_bits =3D 8,
> + .val_bits =3D 16,
> + .max_register =3D 0xff,
> + .wr_table =3D &max77759_write_table,
> + .rd_table =3D &max77759_rd_table,
> + .val_format_endian =3D REGMAP_ENDIAN_LITTLE,
> + .cache_type =3D REGCACHE_NONE,
> +};
> +
> +static const enum power_supply_property max77759_battery_props[] =3D {
> + POWER_SUPPLY_PROP_PRESENT,

I checked the register values match downstream - this looks correct

> + POWER_SUPPLY_PROP_CAPACITY,

I checked the register offset matchs downstream. The value reported
varies a bit versus downstream. As mentioned above that is likely due
to the REPSOC register reporting after mixing with the m5 model which
is not loaded currently. Also the application specific values and cell
characterization information used by the model isn't configured
currently (see link below in _TEMP property below for the initial fuel
gauge params used by downstream.

> + POWER_SUPPLY_PROP_VOLTAGE_NOW,

I checked the register offset matchs downstream. Values reported look sensi=
ble.

> + POWER_SUPPLY_PROP_CHARGE_FULL,

Downstream has a slightly different implementation than upstream for
this property. See here
https://android.googlesource.com/kernel/google-modules/bms/+/1a68c36bef4745=
73cc8629cc1d121eb6a81ab68c/max1720x_battery.c#2244

> + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,

I checked the register offset value is correct. However this is
reporting 3000000 and downstream reports 4524000. I checked and it's
just converting the register reset value of DESIGNCAP which is 0xbb8.

This is listed as a "application specific" value, so it maybe we just
need to write the correct initial value to DESIGNCAP (see TEMP section
below)


> + POWER_SUPPLY_PROP_CHARGE_AVG,

This property isn't reported downstream. The value is changing and not
just the reset value. I noticed REPSOC is an output of the ModelGauge
algorithm so it is likely not to be completely accurate.

> + POWER_SUPPLY_PROP_TEMP,

I checked the register offset value is correct. However the
temperature is always being reported as the register reset value of
220. This is for obvious reasons quite an important one to report
correctly.

I started debugging this a bit, and it is caused by an incorrectly
configured CONFIG (0x1D) register. In particular the TEX[8] bit is 1
on reset in this register which means temperature measurements are
written from the host AP. When this bit is set to 0, measurements on
the AIN pin are converted to a temperature value and stored in the
Temperature register (I then saw values of 360 and the value
changing).

See here for the bits in that CONFIG register
https://android.googlesource.com/kernel/google-modules/bms/+/1a68c36bef4745=
73cc8629cc1d121eb6a81ab68c/max_m5_reg.h#403

In downstream all these initial register settings are taken from DT
here https://android.googlesource.com/kernel/google-modules/raviole-device=
/+/refs/heads/android14-gs-pixel-6.1/arch/arm64/boot/dts/google/gs101-fake-=
battery-data.dtsi#27

For temperature when TEX=3D0, TGAIN, TOFF and TCURVE registers should
also be configured to adjust the temperature measurement.

I think it would likely be worth initialising all the fuel gauge
registers referenced in maxim,fg-params as that includes some of the
application specific values for DESIGNCAP, also some of the cell
characterization information, and hopefully we will get more accurate
values from the fuel gauge generally.

> + POWER_SUPPLY_PROP_CURRENT_NOW,

I checked the register offset matches downstream. Values reported look
reasonable.

> + POWER_SUPPLY_PROP_CURRENT_AVG,

I checked the register offset matches downstream. Values reported look
reasonable.

> + POWER_SUPPLY_PROP_MODEL_NAME,

This property isn't reported downstream.

> + POWER_SUPPLY_PROP_MANUFACTURER,
> +};
> +
> +
> +struct chip_data {
> + bool has_nvmem;
> + const struct regmap_config *regmap_cfg;
> + enum chip_id id;
> +};
> +
> +static const struct chip_data max1720x_data =3D {
> + .has_nvmem =3D true,
> + .regmap_cfg =3D &max1720x_regmap_cfg,
> + .id =3D MAX1720X_ID,
> +};
> +
> +static const struct chip_data max77759_data =3D {
> + .has_nvmem =3D false,
> + .regmap_cfg =3D &max77759_regmap_cfg,
> + .id =3D MAX77759_ID,
> +};
> +
> /* Convert regs value to power_supply units */
>
> static int max172xx_time_to_ps(unsigned int reg)
> @@ -288,12 +376,41 @@ static int max172xx_voltage_to_ps(unsigned int reg)
> return reg * 1250; /* in uV */
> }
>
> +static int max172xx_cell_voltage_to_ps(unsigned int reg)
> +{
> + return reg * 625 / 8; /* in uV */
> +}
> +
> static int max172xx_capacity_to_ps(unsigned int reg,
> struct max1720x_device_info *info)
> {
> return reg * (500000 / info->rsense); /* in uAh */
> }
>
> +static int max77759_capacity_lsb(struct max1720x_device_info *info,
> + unsigned int *lsb)
> +{
> + unsigned int reg_task_period;
> + int ret;
> +
> + ret =3D regmap_read(info->regmap, MAX77759_TASKPERIOD, &reg_task_=
period);
> + if (ret < 0)
> + return ret;
> +
> + switch (reg_task_period) {
> + case MAX77759_TASKPERIOD_175MS:
> + *lsb =3D 1;
> + break;
> + case MAX77759_TASKPERIOD_351MS:
> + *lsb =3D 2;
> + break;
> + default:
> + return -ENODEV;
> + }
> +
> + return 0;
> +}
> +
> /*
> * Current and temperature is signed values, so unsigned regs
> * value must be converted to signed type
> @@ -390,16 +507,36 @@ static int max1720x_battery_get_property(struct pow=
er_supply *psy,
> val->intval =3D max172xx_percent_to_ps(reg_val);
> break;
> case POWER_SUPPLY_PROP_VOLTAGE_NOW:
> - ret =3D regmap_read(info->regmap, MAX172XX_BATT, &reg_val=
);
> - val->intval =3D max172xx_voltage_to_ps(reg_val);
> + if (info->id =3D=3D MAX1720X_ID) {
> + ret =3D regmap_read(info->regmap, MAX172XX_BATT, =
&reg_val);
> + val->intval =3D max172xx_voltage_to_ps(reg_val);

I think MAX1720X using MAX172XX_BATT register is likely a bug as the
downstream driver uses MAX172XX_VCELL for that variant see here
https://android.googlesource.com/kernel/google-modules/bms/+/1a68c36bef4745=
73cc8629cc1d121eb6a81ab68c/max1720x.h#304

Having said that, if we do need to cope with differing register
offsets for the different fuel gauge variants it would be nicer to
abstract them in a way similar to the downstream driver. See here
https://android.googlesource.com/kernel/google-modules/bms/+/1a68c36bef4745=
73cc8629cc1d121eb6a81ab68c/max_m5.c#1235.
I think that would be more scalable in supporting multiple variants in
one driver. Otherwise we will have an explosion of if(id=3D=3Dblah) else
if (id=3D=3Dblah) in the driver.

kind regards,

Peter


Return-Path: <linux-kernel+bounces-675664-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6F97E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:41:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id E7F86189C5D4
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:41:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id F27CE2882CF;
Fri, 6 Jun 2025 11:41:14 +0000 (UTC)
Received: from mail-ua1-f42.google.com (mail-ua1-f42.google.com [209.85.222.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59A8D286D6B;
Fri, 6 Jun 2025 11:41:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210074; cv=none; b=NAtwB6FqVBb3kTgO8J48OOxdAme4ql3zkgVCrAzXNURvnKMzwu4RZUIBzt5vXGSDTlGt2CgJ3aMTBzX1pVIETFor/n1HPljEn9LiZFuotoImYmEEaPXdKOHLTvLdPVVkv4k/7QM5Ja+2Q2y9ED8kX8cvWt0nBqlMBvv5DWm5WpY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210074; c=relaxed/simple;
bh=SajjnsOGNyMztboKpGndMTSP/bW3Rxv8XBK0A9GDHnw=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=qpJvsGkz69Db7ACIPytnMxD4T/GapxQT33ImViLidbQwFX7k06wBE2Yw6vEDNnAWh7SXqoLXMxPuHmih9ufT6YH1Yqzr66pMxe4S5ajwkPMRGsUy7xWvo+ViJN5uOhzpAQGvFzAhRP6ylFrvJksv5XAA9+JHhYQgRXPgmSJsE+I=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.222.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ua1-f42.google.com with SMTP id a1e0cc1a2514c-87dfde2aea2so616077241.2;
Fri, 06 Jun 2025 04:41:11 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210070; x=1749814870;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=obGKc6TF0CZlt+kXLitZOmRI1163thyelu1UFpSgtqg=;
b=rSF9a/wsjQA2UeEj1DHQzK3qgod3xE3uqlH5Gr5rjBI2/OAfDjPLAC0foZQovjUb1N
9qyP0VVKuUVO6MFy9iPqRAZSM+O1bmBtOR3zy1Lj8N4hP59E2hseAs096G+7/zIDWdd1
jIii4HlbSs7e7Fmo9Pw1uOccKv/hXATYI85czndLOF3zBHMy+egetaoelPEK8jVKCCsW
j7NTM5pX/STZoxzsVIGQMWTdd/49UZ43v2CqAXX0YzRD3G1zBK4MO0fINiF1AZgF2V1i
sDn/QE6DZ4lFplIylCHsxIW/jBTFPyL4dfhqQ+hFaMhzi0ew4PieRfEe5/u1SidLifgQ
E36Q==
X-Forwarded-Encrypted: i=1; AJvYcCUBvK9ET81DzTMiv5NFb6oZy007D06qvgsqFV32g+v/XY9aQlsff8zahIgYA6rWSTj6mn3vHbTiTyVO@xxxxxxxxxxxxxxx, AJvYcCVhAZSI0QUEMHbbQJc5ipXn2dqhroea4BQ2df+ZpYW8lM4vX19GppODfskeg/raZMOTMMOdsAuvqEtBHj87@xxxxxxxxxxxxxxx, AJvYcCVtMR5wnuNnzAS3h2FOJRJ1nOJKsocSQYCMQLiLCJ0FzZgn0eYuyT5ew+8Gv2p1sFsIq+GprjB2nWKai6xrVSv9sr0=@vger.kernel.org, AJvYcCXbWVcW+4VLbq9n/wG2DPIwxwI9zepApw1CgAVrgQfmDXltQMMJ5I7aJTXJOOmHE6w5hxCt/jtMfwEn@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Ywbf7iI8R8GvjUsGeH/Zn8bXv6fKjkF7nZ+3XwYcoeSvyPBCQcE
OjUEZc5c1/lbumcAsSZqA3/1c4kVZx3Id3pbu6lcwM6Gcm4K5ym2SriSFEAZpwzL
X-Gm-Gg: ASbGncuTJMO6vE1MrGEfK/qoKaVxm8Gjp5rtx0TUC74LF1xcuUTiCsRGr8czdVk4tQd
3IO+l1yT4W6N56EodteIHGLZl/B029JSGI8eQFj9i738m7YpeN6ZQ36EDDXVL15Grts2jEciXcE
8U5OJbytyE5AdWa/t40tFomf4wbRCz2UODF/nXFG6ddHa/eL05lCwFhROhtAs2f1ifFjWEKawm7
EW9e0WlydZNceS+cIB+Zfxrf8jU28mYLmzDwKtEkeyMOc1T14mCLe0FpH3WwA7cVe8uWT4dOMUT
590aCU9uUSnb/NQ+yyxzyfliyKprl8YTV126cZiHCJQyFZRFi8sDZgVMA52c9z5BX58W5UXiR0F
B+/ijaQwm7XTjK3emNTwpyvMO
X-Google-Smtp-Source: AGHT+IFlIQPwHFmHHjYg7X+61jA4Kyb4tWg2rvYm+lb+X0kWxGTV3VeJcvFqL9PmCLA/MI5zIAlyyQ==
X-Received: by 2002:a05:6122:7d0:b0:520:4996:7d2a with SMTP id 71dfb90a1353d-530e48ca509mr2498592e0c.10.1749210069770;
Fri, 06 Jun 2025 04:41:09 -0700 (PDT)
Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com. [209.85.217.44])
by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-87ebd219ed2sm973201241.25.2025.06.06.04.41.08
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:41:09 -0700 (PDT)
Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-4e2b5ffb932so704362137.0;
Fri, 06 Jun 2025 04:41:08 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCV1IeGwejkPQ+Iuf4CgqMGc0beXfGnSVXM/PLKeqizVdJfy/VgUDcJJktSarVF4W0aNhPs258ZwLztu@xxxxxxxxxxxxxxx, AJvYcCVubHymYATcAQP0sMZTjAx5yP61q9EUPPjOUwgH/4eQs4W1ANtbVkhGlbeLmKaZiUIG/PyX+P+gQSb7@xxxxxxxxxxxxxxx, AJvYcCWpDrAvA30H13NAOS1jEJP6LDBvPQeMd89v8yYwgU4kwr6A8juk2Svf44mGh+VVOr/kckQzck0REpLQ4EMf@xxxxxxxxxxxxxxx, AJvYcCXKNcdGMZgTqZ+zjZd8cFe9fDLeJw7dTTf5Ya5FDG1wRc4BOlSzobfMRrm5LaZIas9eGp7OfCIYhdA8Ouards2ziMU=@vger.kernel.org
X-Received: by 2002:a05:6102:f13:b0:4e2:c6e4:ab1e with SMTP id
ada2fe7eead31-4e7729357e3mr2299629137.7.1749210068682; Fri, 06 Jun 2025
04:41:08 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250528133440.168133-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250528133440.168133-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:40:57 +0200
X-Gmail-Original-Message-ID: <CAMuHMdXwGvGQt3qHTzYLgnPqzYFn3NNHWDUaG+JuE53sHu_gPw@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFuOPwKiL4pHcUMej3ah7pjMpYntaCkNCAJjJjAydth4VrFVLuDiDujv2gg
Message-ID: <CAMuHMdXwGvGQt3qHTzYLgnPqzYFn3NNHWDUaG+JuE53sHu_gPw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] dt-bindings: usb: renesas,usbhs: Add RZ/V2N SoC support
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Magnus Damm <magnus.damm@xxxxxxxxx>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>, linux-usb@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-renesas-soc@xxxxxxxxxxxxxxx, Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, 28 May 2025 at 15:34, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Document the Renesas USBHS controller found on the Renesas RZ/V2N
> (R9A09G056) SoC. The USBHS block on RZ/V2N is functionally identical to
> the one on the RZ/G2L family, so no driver changes are needed. The
> existing "renesas,rzg2l-usbhs" fallback compatible will continue to be
> used for handling this IP.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675665-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F1AD841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:42:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5EC633B07A6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:42:05 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6329B2882CD;
Fri, 6 Jun 2025 11:42:19 +0000 (UTC)
Received: from outboundhk.mxmail.xiaomi.com (outboundhk.mxmail.xiaomi.com [207.226.244.123])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3AF8F20330;
Fri, 6 Jun 2025 11:42:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.226.244.123
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210139; cv=none; b=CLBH+iip1i8L6IbrywS0x/XYVbjq9BUXy4iXPylWrF6cSddWG5GNjsV5G4jehi+DC0NyBR6tqnT73YY9gfnyC8oXIekjZ0AB8GcZG6IDXlDoozasb46mjpx/Pw/0nzzAOLpINzbEcvNKAOioeJgRHn0nnNFb1+nJt4ULKqTax/s=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210139; c=relaxed/simple;
bh=8PsZDoTyvn/Y6iWD1ngXKZWPsOgm5ADCIiIzcV+/LDc=;
h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=YFdFE0T5gAEjOZ2kuUTQlk/G5OWsKwZ6E95pDd5kXiantwpX6DKCKFQvuqxUEQma6ME/2qo186vRfWoTPfswyWBQvQLBWq7497dDbDaroFXHNG8R2BXhtBO+kVbivs3qoejNitmLZBAPLfRu93M/qQgJBbzLHarxUxYypqOTDRY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=xiaomi.com; spf=pass smtp.mailfrom=xiaomi.com; arc=none smtp.client-ip=207.226.244.123
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=xiaomi.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xiaomi.com
X-CSE-ConnectionGUID: o7kRqhfWR66MAqt/vaJ5Qg==
X-CSE-MsgGUID: b0V1uM+gR6GKt69zGmHXsg==
X-IronPort-AV: E=Sophos;i="6.16,215,1744041600";
d="scan'208";a="142379736"
From: Xandy.Xiong <xiongliang@xxxxxxxxxx>
To: Andrew Lunn <andrew+netdev@xxxxxxx>, "David S. Miller"
<davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski
<kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, Maxime Coquelin
<mcoquelin.stm32@xxxxxxxxx>, Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>
CC: "Russell King (Oracle)" <rmk+kernel@xxxxxxxxxxxxxxx>, Furong Xu
<0x1207@xxxxxxxxx>, <netdev@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<xiongliang@xxxxxxxxxx>
Subject: [PATCH] net: stmmac: add support for platform specific config.
Date: Fri, 6 Jun 2025 19:41:55 +0800
Message-ID: <20250606114155.3517-1-xiongliang@xxxxxxxxxx>
X-Mailer: git-send-email 2.25.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: BJ-MBX03.mioffice.cn (10.237.8.123) To bj-mbx09.mioffice.cn
(10.237.8.129)
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This patch adds support for platform-specific init config in the
stmmac driver. As SMMU remap, must after dma descriptor setup,
and same mac link caps must init before phy init. To support these feature,
a new function pointer 'fix_mac_config' is added to the
plat_stmmacenet_data structure.
And call the function pointer 'fix_mac_config' in the __stmmac_open().

Signed-off-by: Xandy.Xiong <xiongliang@xxxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++
include/linux/stmmac.h | 1 +
2 files changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 085c09039af4..8d629a3c2237 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4041,6 +4041,10 @@ static int __stmmac_open(struct net_device *dev,
if (ret < 0)
return ret;

+ /* Same mac config must before phy init and after stmmac_setup_dma_desc */
+ if (priv->plat->fix_mac_config)
+ priv->plat->fix_mac_config(dev, priv->plat->bsp_priv);
+
if ((!priv->hw->xpcs ||
xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73)) {
ret = stmmac_init_phy(dev);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 26ddf95d23f9..0a6021e5b932 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -239,6 +239,7 @@ struct plat_stmmacenet_data {
phy_interface_t interface, int speed);
void (*fix_mac_speed)(void *priv, int speed, unsigned int mode);
int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
+ int (*fix_mac_config)(struct net_device *ndev, void *priv);
int (*serdes_powerup)(struct net_device *ndev, void *priv);
void (*serdes_powerdown)(struct net_device *ndev, void *priv);
int (*mac_finish)(struct net_device *ndev,
--
2.25.1



Return-Path: <linux-kernel+bounces-675666-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A9EF941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:43:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5B0573B0657
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:43:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 954EC2882DC;
Fri, 6 Jun 2025 11:43:46 +0000 (UTC)
Received: from mail-m49197.qiye.163.com (mail-m49197.qiye.163.com [45.254.49.197])
(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 7F3FD20330;
Fri, 6 Jun 2025 11:43:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.49.197
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210226; cv=none; b=qMHhcsVapKcoJJp13p9LSvNi/uWWNLIUrEAIFxYfzMf7vMbuO+ueq5tT0FlrBQDkRcPx7Imsr8aGvzmuzwKBLR131/tw/cyr7Uvh50FgQ2rzxVkPmQGzlKq+m28cK1+sZkofVe4svENzd+XlSBYKiYaiva2gM/DF39jkYYTjU8Q=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210226; c=relaxed/simple;
bh=/Af4YCmRpDYeBf586N1KH8WQtJcvshKud41TMzf13FQ=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=mvp2rEaLIUzhA3n4vwthPGO/sXlZg3jbvE4PKAn6oQPYLow4jjGMHf42IIHD6Q2FATWaGhM77QQ6cKwypT49whOm3uSous/W+8Vx0adE9kiItloqfS+Sy73r2HvcumOSf0i4IJvIx40f8yQQHidlYoux+lXzTtbsxcmGNGSlarc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=whut.edu.cn; spf=pass smtp.mailfrom=whut.edu.cn; arc=none smtp.client-ip=45.254.49.197
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=whut.edu.cn
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=whut.edu.cn
Received: from localhost (gy-adaptive-ssl-proxy-2-entmail-virt205.gy.ntes [27.17.176.245])
by smtp.qiye.163.com (Hmail) with ESMTP id 17c6f2803;
Fri, 6 Jun 2025 19:43:38 +0800 (GMT+08:00)
Date: Fri, 6 Jun 2025 19:43:38 +0800
From: Ze Huang <huangze@xxxxxxxxxxx>
To: Yixun Lan <dlan@xxxxxxxxxx>, Ze Huang <huangze@xxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx>,
Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>,
Palmer Dabbelt <palmer@xxxxxxxxxxx>,
Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Alexandre Ghiti <alex@xxxxxxxx>,
linux-usb@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx, spacemit@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v4 3/4] usb: dwc3: add generic driver to support
flattened DT
Message-ID: <aELUajmfzmb7w3W9@jean.localdomain>
References: <20250526-b4-k1-dwc3-v3-v4-0-63e4e525e5cb@xxxxxxxxxxx>
<20250526-b4-k1-dwc3-v3-v4-3-63e4e525e5cb@xxxxxxxxxxx>
<20250605213443.17a7aa26b@xxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250605213443.17a7aa26b@xxxxxxxxxxxxxxxxx>
X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly
tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlDSkkfVkoeTU4ZH0xDGEweQ1YeHw5VEwETFhoSFy
QUDg9ZV1kYEgtZQVlJTFVKTFVKTE1VSU9OWVdZFhoPEhUdFFlBWU9LSFVKS0lIQkhCVUpLS1VKQk
tLWQY+
X-HM-Tid: 0a97450dc07b03a1kunmea2195ced05ae
X-HM-MType: 10
X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Ogg6Phw5ODE1SBgyIwoTFiMq
CjcaCkpVSlVKTE9CSUpLSUpCTUlPVTMWGhIXVRMOGhUcAR47DBMOD1UeHw5VGBVFWVdZEgtZQVlJ
TFVKTFVKTE1VSU9OWVdZCAFZQUpCTE83Bg++
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 01:34:27PM +0000, Yixun Lan wrote:
> Hi Ze,
>
> On 22:40 Mon 26 May , Ze Huang wrote:
> > To support flattened dwc3 dt model and drop the glue layer, introduce the
> > `dwc3-generic` driver. This enables direct binding of the DWC3 core driver
> > and offers an alternative to the existing glue driver `dwc3-of-simple`.
> >
> > Signed-off-by: Ze Huang <huangze@xxxxxxxxxxx>
> > ---
...
> > + ret = reset_control_deassert(dwc3->resets);
> > + if (ret) {
> > + dev_err(dev, "failed to deassert reset\n");
> > + goto reset_assert;
> > + }
> > +
> > + ret = clk_bulk_get_all(dwc3->dev, &dwc3->clks);
> can you check if able to use devres api for reset/clock here?
> (functions start devm_ prefix)
>

OK, will do


Return-Path: <linux-kernel+bounces-675667-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5E0E241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:44:28 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 802C0176164
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:44:29 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D4462882CD;
Fri, 6 Jun 2025 11:44:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gOsGJCPn"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 EF84A20330
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:44:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210261; cv=none; b=SfQx0JLHTt4HVCLER0ltcQTWsoGCiXwpihoUXH1QaonXg/pqP+rzqt2MAsMqB4f7py+/imREKfOrX2tjr5bfT/y4SEO8zQ0n+Rcz6rwPqDAShS42shGJmRdVQV32gIx1/PPufIspZ31ORGXLy5VIaZnWFP4xhESZh4it3VBOZgs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210261; c=relaxed/simple;
bh=nVGg1kZqsFDkItjZ0WGg/TiLrVmiTG9ltMYHttHXNEw=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=bbqxdIf9qrgSpPY1BGZjRV6rHni/tuY0PnahLynEZQ/Kv3gIKLk8+rPA9JWqcuiIaVMhSxNDTBHdhRbhb8pO473QZp2q3ihMOng4xWHX2XNeUcLH3b+1c8R36oNmUQns797kt+H6aFeo4D/zMaB7H5OKNn/+GPJYr6REimRQyAc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gOsGJCPn; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210257;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=zelhpDixa89Wl/4nvIXRYdUrWpyIXYaO3oQleH1j9lE=;
b=gOsGJCPnkfyvcUGIDyvCoZ6N6GBQ67R9UQD4qtrk3Zgt/I0vcu1MKSvcwy+/iP3NoQFOuB
BNJHmkTSRzgkZkodBz2bCfWK14aWPhn8fsfmVbQ4SbcE8tb9Q3kdGJFHdGFZDLGibLM7cs
XU0M0zqQJa36Pl/ztE71JazgxMKh+L8=
Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com
[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-235-RGFf4eSaPCyWr9dSPyxPqw-1; Fri, 06 Jun 2025 07:44:16 -0400
X-MC-Unique: RGFf4eSaPCyWr9dSPyxPqw-1
X-Mimecast-MFC-AGG-ID: RGFf4eSaPCyWr9dSPyxPqw_1749210255
Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-450db029f2aso10012855e9.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:44:15 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210255; x=1749815055;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=zelhpDixa89Wl/4nvIXRYdUrWpyIXYaO3oQleH1j9lE=;
b=SePlaQxCX8yRaBCioAtZhATkQWQcazUK+NguaHR52WvFiaVHpnjqoSBiK0HoUrd6Nu
lcx7Q5ikhvyoOXqAXwJR1VnGXVEDdOp9sRMJUT4+oftMHtKm1TMbm6/uTOxxJxCfpQsz
B714ezFLXejdB0UAZhoQqbAO/coihosU0fIO4FQXKmhAdQMAef8BTPegOX9Y52PKsIXP
UNKMZUtNM9U5i/i3t1Z0LFvkw2vXC9aPaxElFDvJI7tipHrnGL76dhwRRdMKjaiMyVzC
sfPOx64P68cgfd21EqwAHt5pn38pIEemgfHoTQmjeErajh1RyqNrkV/XjeyjxPuttI+K
7dIA==
X-Forwarded-Encrypted: i=1; AJvYcCWjSnm4lmuSS7FMERZI184kFBwpglqQgqu1vi1EtMxylP+b/THMNs5Q7nOL2kIBubtryNhMmGmbrQDEsKA=@vger.kernel.org
X-Gm-Message-State: AOJu0YzFGRw3sXXUUOtKilT0PKIZbHFmeeuIAbeE52jDeeZtXH1s4PbL
cSP9Exet3/Ze+nkXW3OD2fJDKEUN3k09IzBXCtHtgwCYeItYz/p7RONXOGj8YezSvWx4RjrjAct
3v621QlNasFXrWAS+jfBAoN2KqA91n0+IpQOMS95DQWrEDYB0qtc0uqJegz0FIVRGsA==
X-Gm-Gg: ASbGncsBBHsghrb5cSOOzuqmydDl6YkQ6WT4Ppi9b5sHeYr9e0QR4NR2w/EkYsq6TEI
y0eoFjhkCc2hv6lFqqEMyRBmBye2UyIXEzMjDl2f/vbYUUwmOZKgSvOYrrDNjUgBzk9k2gk5YHL
JgqDqIGLsYaUY6x/t8fKgxLcJfD2TgadXDOoxp6EXtPq9zY+yz4Q4FJ1BU8no2LWl/FGsyGLNzx
k7FukKUnApNvi3n+/HifADvsuOYb6yO5j5KTw/iLnP8IA/GP5U7Tl1h2DgC7D6r55W3mIAksLhL
Uu3EecJ3XGsOzwIMwPDIa3BS8XuGzUUriEF6DEUVCskgQOrHyNwLP+R//ViqUyP+9jhuaEhaZ6h
wdXXANeyQcV9wF6rGONvvA58Gj+7IlMA9gOfHPvM0kA==
X-Received: by 2002:a05:600c:8b8b:b0:450:d00d:588b with SMTP id 5b1f17b1804b1-45201414a42mr34849325e9.9.1749210254887;
Fri, 06 Jun 2025 04:44:14 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IH3dRH0G6UjohJo+eKi5EKaynQQeqsxHWVR0GdsCweg3VD3myB7xWyGGMX4gcfDaIN3Ly9wEA==
X-Received: by 2002:a05:600c:8b8b:b0:450:d00d:588b with SMTP id 5b1f17b1804b1-45201414a42mr34849125e9.9.1749210254417;
Fri, 06 Jun 2025 04:44:14 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-452730c747dsm18638905e9.31.2025.06.06.04.44.12
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:44:13 -0700 (PDT)
Message-ID: <fe31e754-159d-49fd-aac7-64af5e313884@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:44:12 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>, Vlastimil Babka
<vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>,
John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
<50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
<e5fa4a36-2af8-48e9-811e-680881c06b86@xxxxxxxxxx>
<1a7513cf-4a0a-4e58-b20d-31c1370b760f@lucifer.local>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <1a7513cf-4a0a-4e58-b20d-31c1370b760f@lucifer.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 13:04, Lorenzo Stoakes wrote:
> On Fri, Jun 06, 2025 at 12:28:28PM +0200, David Hildenbrand wrote:
>> On 06.06.25 12:19, Lorenzo Stoakes wrote:
>>> On Fri, Jun 06, 2025 at 12:13:27PM +0200, Michal Hocko wrote:
>>>> On Fri 06-06-25 11:01:18, David Hildenbrand wrote:
>>>>> On 06.06.25 10:31, Michal Hocko wrote:
>>>> [...]
>>>>>> Turning them into VM_WARN_ON
>>>>>> should be reasonably safe as they are not enabled in production
>>>>>> environment anyway so we cannot really rely on those. Having them in
>>>>>> WARN form would be still useful for debugging and those that really need
>>>>>> a crash dump while debugging can achieve the same result.
>>>>>
>>>>> One question is if we should be VM_WARN_ON vs. VM_WARN_ON_ONCE ...
>>>>
>>>> *WARN_ONCE ha a very limited use from code paths which are generally
>>>> shared by many callers. You just see one and then nothing. Some time ago
>>>> we have discussed an option to have _ONCE per call trace but I haven't
>>>> see any follow up.
>>>>
>>>> Anyway starting without _ONCE seems like safer option because we are not
>>>> losing potentially useful debugging information. Afterall this is
>>>> debugging only thing. But no strong position on my side.
>>>>
>>>>> VM_BUG_ON is essentially a "once" thing so far, but then, we don't continue
>>>>> ... so probably most should be _ONCE.
>>>>>
>>>>>>
>>>>>> So while I agree that many of them could be dropped or made more clear
>>>>>> those could be dealt with after a mass move. An advantage of this would
>>>>>> be that we can drop VM_BUG_ON* and stop new instances from being added.
>>>>>
>>>>> As a first step we could probably just #define them to go to the
>>>>> VM_WARN_ON_* variants and see what happens.
>>>>
>>>> You meand VM_BUG_ON expand to VM_WARN_ON by default?
>>>
>>> Sorry to interject in the conversation, but to boldly throw my two English pence
>>> into the mix:
>>>
>>> As the "king of churn" (TM) you'll not be surprised to hear that I'm in favour
>>> of us just doing a big patch and convert all VM_BUG_ON() -> VM_WARN_ON_ONCE()
>>> and remove VM_BUG_ON*().
>>>
>>> Pull the band-aid off... I think better than a #define if this indeed what you
>>> meant David.
>>>
>>> But of course, you'd expect me to have this opinion ;)
>>
>> See my reply to Michal regarding keeping VM_BUG_ON() until we actually
>> decided what the right cleanup is.
>
> Sure, but to me the concept of VM_BUG_ON() is surely fundamentally broken - if
> BUG_ON() means 'stop everything we're going to corrupt' then it makes no sense
> to add a '...but only if CONFIG_DEBUG_VM is set' in there.
>
> So to me the only assessment needed is 'do we want to warn on this or not?'.

Well, when done carefully, it would be when reworking a VM_BUG_ON:

(a) Should this really only be checked with DEBUG_VM or should this
actually be a WARN_ON_ONCE() + recovery
(b) Does this check even still make sense in current code, or were we
just extra careful initially.
(c) Do we even understand why it is checked or should we add a comment.
(d) Should we use one of the _PAGE / _FOLIO / _VMA etc. variants instead
or even add new ones.

One could argue that the same is true for any other VM_WARN_ON ... but
my point from the beginning was that if we're already touching them, why
not spend some extra time and do it properly ..

... but yeah, 600 instances are a bit much.

:)

But yeah, VM_BUG_ON is easier to replace than BUG_ON, because ... not
even Fedora is running with CONFIG_DEBUG_VM anymore, so these checks are
mostly only there in actual debug kernels.

So agreed, let's move forward with a simple conversion.

>
> And as you say, really WARN_ON_ONCE() seems appropriate, because nearly always
> we will get flooded with useless information.
>
> I think this being debug code gives us a lot of leeway here.
>
> After the big change, we can always revisit individual cases and see if the
> warning is valid at all.
>
>>
>> I don't have a very strong opinion on any of this ... as long as VM_BUG_ON()
>> goes away one way or the other.
>
> Am happy to come up with the churn-meister version of this patch and take the
> heat :P

I assume with "this patch" you mean "a patch that gets rid of VM_BUG_ON
completely", because I want this patch here (that started the
discussion) to go in first.

Fascinating how you are always looking for work :P

Thanks!

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675668-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A3DB441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:45:39 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4E7363B097E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:45:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E2BB2874F1;
Fri, 6 Jun 2025 11:45:32 +0000 (UTC)
Received: from mail-vk1-f177.google.com (mail-vk1-f177.google.com [209.85.221.177])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30DE31E47B3;
Fri, 6 Jun 2025 11:45:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.177
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210332; cv=none; b=pfPN7YihBRI+n6QwUBRTwej/IGo4GEUDpCzrWFfgaKO2yHF4KqlnsgVe+Uvl2EzmTq0dx6zAFJGvBJykmjpe3ygjqqqaTZiZQu0LodrF/k7jKKDuImo4LLdp2Wn0jK6WmfZq6YmPk5n/mKo6VS6f9IRndQcYqyOupIetule/ZQQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210332; c=relaxed/simple;
bh=pBBtJFnYmIG50xs6IyBYD32IyjLEgxGwTo8+5EbdyKQ=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=FrE41LRdAA+9b0Buz+BevMAWj0vwag8U7NnwFIK1euakPxrBFDrTzuBa+NT7ZWSwtINXxqhkGbqxCCYjlomjh1WXHcvrEm1fUxGrhhwaadSF/OmAE4IIxaLqj4EtTrKEfUdVx2yGBPA0Ce6Xp/06I+6xBP9r16dzOlj8Lmtee2M=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.177
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vk1-f177.google.com with SMTP id 71dfb90a1353d-52413efd0d3so682787e0c.2;
Fri, 06 Jun 2025 04:45:29 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210328; x=1749815128;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=k/AA2thBkYBRTSrmKbacqRtsRcQ9H4ZTCKUlsZiT20c=;
b=wI2aHHRLk98Xa+l065EX1/VFYQN5bLXu7wuftG34p4DiknreiDk18rm+dqDCZh0lKO
kr2XoQmZtGEAwVktdurJlt8gpcWp/czQBfstuI5qHvyy2vdtYZwM4xXB5Hgfnul80iBv
sZHUmacceIEEaFEWufQv5szakCY+zei6PjR8SxNG8iOHVAD4HHD3Wl62NRy5d50V/0qR
Y5s4RWjn/v9GC7K4Qd7NINWkLjcDv9iReBK9MUBTe8FwuXWzuHgxqHoiJf77Q84+XaB+
MT15+tVIlyRmrNO5NtQ9D54AFk2fftzdajZId/ZcarztAJhvDtWIsdcQPI8WFKyk8oxz
amiQ==
X-Forwarded-Encrypted: i=1; AJvYcCWSTa5rKMTDZaCkg8RlRiBlwLe/9ysFhXvTRJu8RWgEljGbm4kC4CTKICy1u+XPbx8EVfTf5lAv1TN88qtjF+3zOy8=@vger.kernel.org, AJvYcCWw4TW7fya5LDXvFl6zswg0UGw3iwYcKVcZzG/8NAhU24xGiH1wQs1Q7o/NnFR6VPT5J3G2Us5oHht3ZHtc@xxxxxxxxxxxxxxx, AJvYcCX3IAPFNxLn1FcPohm7nHFouxN/E3gg0P3eQTR2m2FdOlEjS/X+2sZR/O/GATW0/UPTbMVqxcEONo0U@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YyRo41MVVsYeSDZDFAKziATQ/oZcx2CcB9NiEXg8GxJ/75mX9Kl
iJLODlDHK9pe9DunsmuMHxg0SxwzVp+2zYfSPjAL8W6QOKd8VSSQgrWpNNtV6Lud
X-Gm-Gg: ASbGnctRbv9axXurtSS6eNSzTpYzJvcd7Jybf8ZSSfEHKooBxE/0dVe37nKjPOYYtb2
/4t57t71UybjDqyP+Ffv9uA88rjlc6QAIuPu8AA6GbFI/43s+URp+iScJ3oU7bOGO2bo303vZzx
WWs8t2s29upMZfHCxqVGL8EhSyT0EIS4joiJjWFmRy9c8mVMVbZq+C0bxyiXfF5f0YxShQ1qUYe
REtEKqoUCIhK/E1f6+qxq6Tnx5O6pPK43VY7sm/oM9nEVjexq7NR43wACZgTuodgB33TEUyL8V0
cddkeCOB75h9osvaI2+h96wpkmeokpWDACBMs1tL15UyMSalR1ZmVz7hrwFvudfN7KKN94S5TyW
JYxDhDmtItTKydA==
X-Google-Smtp-Source: AGHT+IH71oNIxZ+UBxKRrJzzaHrRgTJrTF9CvkgGAT71mGaGsN/hNJFpUYlqcho7DryKfzfnuQf0Xw==
X-Received: by 2002:a05:6122:3c8c:b0:530:5f5a:1362 with SMTP id 71dfb90a1353d-530e48ca52bmr2299372e0c.10.1749210327664;
Fri, 06 Jun 2025 04:45:27 -0700 (PDT)
Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com. [209.85.217.52])
by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-530e6427aefsm932909e0c.42.2025.06.06.04.45.27
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:45:27 -0700 (PDT)
Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-4e6312895d0so542901137.3;
Fri, 06 Jun 2025 04:45:27 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCVBoL6/YVOMtAi+agx8St4gQ41xX9TOhyJipKGhgrw7E9Od7U2LNIuCD3EjvIHCApjLchMrgdXcKBAOGFFu5ZuEXUs=@vger.kernel.org, AJvYcCWqJ7O0qPB1Dm87APSmB12+r6BTNTLLVAviaWW6QElwp0yrSnBuxDf77SkosP2OC1g8Ucsn4k9fvGlR@xxxxxxxxxxxxxxx, AJvYcCXL2osFaUMfXt0opJujsWWnVBoUKZRmELG+K3G7Z2M7y+HOO9rr55Wlh63NHLo5lk9fLDLvmUbhB5VQTO2g@xxxxxxxxxxxxxxx
X-Received: by 2002:a05:6102:8082:b0:4e4:5e11:6848 with SMTP id
ada2fe7eead31-4e772a02124mr2374263137.23.1749210326790; Fri, 06 Jun 2025
04:45:26 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250528133031.167647-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250528133031.167647-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:45:15 +0200
X-Gmail-Original-Message-ID: <CAMuHMdW6SSTV-O5ejf5zWH+ZP--g2R8OYLoBSrYU3b0dKqVGWw@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFvscKZ744xaTrPRPezQ-0dPxGY5ctzKoeJh9okkP8uwXsx7PAhDIZbjQrE
Message-ID: <CAMuHMdW6SSTV-O5ejf5zWH+ZP--g2R8OYLoBSrYU3b0dKqVGWw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] dt-bindings: reset: renesas,rzv2h-usb2phy: Document
RZ/V2N SoC support
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Geert Uytterhoeven <geert+renesas@xxxxxxxxx>, Magnus Damm <magnus.damm@xxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>, linux-renesas-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, 28 May 2025 at 15:30, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Document support for the USB2PHY reset controller found on the Renesas
> RZ/V2N (R9A09G056) SoC. The reset controller IP is functionally identical
> to that on the RZ/V2H(P) SoC, so no driver changes are needed. The existing
> `renesas,r9a09g057-usb2phy-reset` compatible will be used as a fallback
> for the RZ/V2N SoC.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

LGTM (I don't have the User's Manual Additional Document for RZ/V2N)
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675669-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E034441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:46:19 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 7261C189402E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:46:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A8F8228642C;
Fri, 6 Jun 2025 11:46:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CfRhVmI6"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 525B11E47B3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:46:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210370; cv=none; b=aWVIgesQVXFohx+o/d3yzbwouVOXhG3wNsKVksfj9yGTeI5VkRluw9Qh5Q1ApRZFQeVdUvHFCTLbH/ZdpUmSKvN75/wLBCqvtJSzSri71IHrJqYExmVCDsp4wuprAog3V1RswNqSLkXMLYxbikd3R3E7+Ih+9bMDATGAC3nykPQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210370; c=relaxed/simple;
bh=J2AWAFUoypdSGO9A68K8w+antOoUBt3RUAaiuzgC+Ik=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=RZ/x0NR0et6gMp3P1cz2HqivxEmnp1ZCB00GnsH9jqtl0Xynx0H+NWXWLDyLXjCL61f6obE7HQDYu1q6WnCCIlnPgiA2X6icii/+jZ8Shv2KLV/BWSTMS6pFb22yETPvboyyLfWnnjFsJqzsqOe9He3k31dy9Uk36aDT2kUFcDM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CfRhVmI6; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210368;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=qwnxzLGuikn5a2Uu1FwM95+rWoyE1NoRjTg6LUKAAow=;
b=CfRhVmI6iXD5YacCWICjtsatA4GKinjha2Epk1cadXQK9wPwAsPslVYhznR/Y2G1iyaSgE
DP6O4uNanAGNMeF9wtw0Rx4Cs3bCb2LstfneKmCXBpu95qZY0Z2Op5L2WVMBaI0em+H1ps
IPzLJwJg+rJesgW+qGcIslyffjTLOQo=
Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com
[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-605-c3SeHRu7Mbqaq_V5GieGYA-1; Fri, 06 Jun 2025 07:46:07 -0400
X-MC-Unique: c3SeHRu7Mbqaq_V5GieGYA-1
X-Mimecast-MFC-AGG-ID: c3SeHRu7Mbqaq_V5GieGYA_1749210366
Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-441c122fa56so10148515e9.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:46:06 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210366; x=1749815166;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=qwnxzLGuikn5a2Uu1FwM95+rWoyE1NoRjTg6LUKAAow=;
b=PcwJ3PzRoF/I1vJxV4jXE2UacbhqsGEBfwat4cr8wXgtYOHbZnkSQsjOzwQ26lEmmS
dj02EeExcIUwApwCIxH0pvPB4qgUAuJ9iBCanfBToCAGhX+BzhoaDyJv4zrEUUD85lql
7EeKbF/i5F3D9ff+I9akXudRZh3abNsWsUJRNcOM9BElQEHCZvtZxIP2+JI1cQAu9iQv
b2rjdcAXCQbNdSYY9yXZXc2QLGPSeESWD+7vEJ0H6WbbRvehGdOPJum8NOqOkkyiLEVf
zrVYB+jLWMY9nejJt1Zrm3VuOXVL7PQcTGsZzGfztttdopZEHrslmyd8Tc8C75Nmwm2J
cGAA==
X-Forwarded-Encrypted: i=1; AJvYcCXynh+zdgS1mJVu+fAI9hHOgrsrdgJ30ZBMiUjCsf3A+v1sb6mzAl3FCnfAtEII9hdQVfNRy2a+/GQ3lzQ=@vger.kernel.org
X-Gm-Message-State: AOJu0YzUlDeyWrcLO4fheNVVKCz7Os2W4RBYwf7+bX9X2yTfeMpt+TC2
IpWcNhJYz4y1BWC/lXPF//XuiznwllAUBla5+pw54M+/G+3koQh1NhCNqBnOC8Zcy/bpl/DYWjB
pXe+4t1/gcB+GegaNGtJBDkj/RgYVeYIvMvJQgjSWaSfpLICMYnTPDGOz2lVYexl6bg==
X-Gm-Gg: ASbGncuU7L/8coTptdegNTXNN5xSk6mYXEbz1Divq/R7S51oPrTBZBKUD6/hvP48y1J
r6ghIWGZ1lCrEgXLHVrUj8EP/plrlopvzF9t/w1x6eE6RN7HRMtaS9cR5DwccGXBCrD8zM4EU8h
ZmypBU4HYsGgtvjowPRwaVRv4EPoKxo36+Oi5OGpNpOc7zjegDuJMooR7ZHPr3+x7KnsHExTXHq
ZzxXOtZ6pi5IPEo5g8o+9wLs2aTTaJeHTLq8rwGFI7TUEuYc5gXhXnylgY78SZMVdJXEJNVnlql
wTBBCIGyCwS9m9KDqcVevzc7IfBKEu+DsaONdo71C3cv3rU2lKFsJNzdVm3eMvWRnfdqXwqMJfR
pLrvM/T6Z9QeFOKPt9w59rcUm+S5iJfJg5e+iBkDNNg==
X-Received: by 2002:a05:600c:83cf:b0:450:6b55:cf91 with SMTP id 5b1f17b1804b1-452013372ddmr32778095e9.6.1749210365910;
Fri, 06 Jun 2025 04:46:05 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHjzcs090F8tav40sXaS+Cr9WkEYuBvjbJtxtLvRqkf4lrviPP8mct4QF7+XzINTtttI0W7xg==
X-Received: by 2002:a05:600c:83cf:b0:450:6b55:cf91 with SMTP id 5b1f17b1804b1-452013372ddmr32777945e9.6.1749210365514;
Fri, 06 Jun 2025 04:46:05 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4521375bca3sm21271175e9.39.2025.06.06.04.46.03
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:46:05 -0700 (PDT)
Message-ID: <1ef7699b-d094-4ade-966f-d17f4d9a3613@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:46:03 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 00/10]
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
Oscar Salvador <osalvador@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<c4a96aa2-10ae-4dc1-abd8-be91f7e8b583@lucifer.local>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <c4a96aa2-10ae-4dc1-abd8-be91f7e8b583@lucifer.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 13:30, Lorenzo Stoakes wrote:
> Hi Oscar,
>
> I don't have time to dig into what's broken here, but this series is breaking
> the mm-new build.
>
> NODE_REMOVED_LAST_MEMORY for instance doesn't seem to be defined, but there's a
> bunch more errors.
>
> Are you expecting stuff to land from other trees that isn't merged in Andrew's
> tree yet? Maybe from slab tree?

(David replying)

no, this is standalone, and probably just an error in the patches.

IIUC, the build bots reported this this night as reply to patch #4.

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675670-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5162A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:47:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B2993B08A8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:46:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 568562882DE;
Fri, 6 Jun 2025 11:46:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ot5vmcOD"
Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFA4D2066CE;
Fri, 6 Jun 2025 11:46:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210409; cv=none; b=N/RUe1gtAj+VEWGJU8tTUJfUNvoJyibxhqiSk8SkYXDZ4rtCM674rCpDYLngUJWWKbhoEoJdhixsrOvz/5UlMXHYwIro9Br3x5+tgETiGqfI/cswVra4gHbWSFb8ikpLeX9bQzuhOC7owP8Yq+l8KSu4nh9E+MVKpjgk85SrsA4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210409; c=relaxed/simple;
bh=eOfExiUf+XekW5+oov9reWaBdBNfu1G6CdVlIAY38RI=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=R386TCf0PLSSbvCH7VUh+3qGKBqP4iF6b4YKm8IKWCTdZyLH3/wLGe6KyvK4LsFo4YeBjlchJmJpL0nal8QeBC8UH/iZQuiAP6Vxced0XLWAi1cTF1bmQN90wbLaSXbVyW2iHOnZyc+8ie7N1jZal2TOi86iPXgWCDr9S13Kre8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ot5vmcOD; arc=none smtp.client-ip=209.85.221.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3a507e88b0aso1859703f8f.1;
Fri, 06 Jun 2025 04:46:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749210406; x=1749815206; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=PjAcWe70JY96dBY0oozKYeEaxt/7BhJ8i+mA680ELKA=;
b=Ot5vmcODDWYetl1x0FYs149KgvExH17+jGoVbgHag5eceOf5L96bRvEwXu6W7OOZnJ
aBOO1URuoXSMs37c87BopxfKV5dFkT8q29nlfFBVZ/ejtHH27NpoNrsPmi4NAnfK20DA
srA01qF/1VUbfHFw5iC6W/jK5zfoF8OpJ9D8bM5nFpms9yHVac/6Jb1T5pnlVkMeWAsI
2y2x+DP7+6KIjY+98kYUjdL6VRv5jTlldrL2S0kIHzMAgrvHCZipehviXikMF/apC+BW
5J8J9NdxqjTcqNXtw4oNIt0u7F3n+BGbtOG7y/TdpI0TTquDvgdnF2d29EMnm9gSEgwb
1iPg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210406; x=1749815206;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=PjAcWe70JY96dBY0oozKYeEaxt/7BhJ8i+mA680ELKA=;
b=AP4t6WFb/iSTjv2UF4PdtDdR/Xk76OMynNwGkNm7zev0BsP90IqQNg3BIqUp6CpXJd
BN2NhETPzo4oIrCXWMQkwucZRXRY1gz6rgOzvlY71IXQyVHlfTQ4Etml5x/OFGjoFgPy
gr789tXHOYOgrLhfklofstYtjhs62BZn7g9INJaG0hrLzLrqqJeBlLvX54EdIn7bZqcp
gTCn/YzwppUZZ3v4YCLU1fBmdOVt08aX32rfTTbuwqMjNzhGmdvP5O9eApS3L68dg4gY
Zw1nznaiEKxcZW76VmeEu88pMoPulNa/pFQVNRgwxU6F5LxUvfK1LVciH7jHFAKr9k2G
B4OA==
X-Forwarded-Encrypted: i=1; AJvYcCVkSe6jAQ1MWE43FhbKjMwLJaOxCo9fGeFGlL3epYN0V7HRfn+fpkTg2HMeROyRKesRhKKB8RR9E1xU@xxxxxxxxxxxxxxx, AJvYcCXLmBqrnFFxQrvBTKrH2qMTjgOhLlF9kxwyOlOSKUcfgZT0z0RMsAIe8S5DmyRK6VK4YgTQ5nRxpxo13GF1@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yw9dddzB9EMkIHWwxZBz3ucIBZB+VsJsbiZQRktcn50SMHx6a9L
bQWo3WuRafuaaZ69mwJjRBhlc7GK5KaXvFD/T2GqUuw2SIMmEcymRHtd
X-Gm-Gg: ASbGnctmC/DRDnLHX6xZqMSZ2VI9zkoM6XOkOqGH58fwCSDPQ0/KDO4Zu5Lgfe5GdTk
NcTcha5aQscAUUrTcPztAjOBallHQH8PvT767zWHIpfrBA0QUyYPDqaKSBRO7Xb1TOqiuOmWkpr
zxVf8DrbKIkEClm2IlJprtHcHMGdRa3Zt3fbg3N+Ah5t8H76gHKZq0Ljj0/aGh3jncN+C8zi1pq
3wPUhtaEcC6W/vWLAPz6OGkRBNhaCshnyTUghT0LsFyKqkmAFVFVTKqVKJ7WpQA1eeskpet3/e8
VQY1iHgNYqA3bUyRhPe9PJQCMukiwv+/A9uEyrHszzw4qWTSwFfLk+KUGGfLIp/Qu+Kstft5azZ
XGw==
X-Google-Smtp-Source: AGHT+IEh6fjC39UFkQxSRQZMudiWztOA2853bVG1ipDO9BfHLRZsNiFrRvJ/D0vBh0AbPo0EXQmGBA==
X-Received: by 2002:a05:6000:2c10:b0:3a5:2875:f985 with SMTP id ffacd0b85a97d-3a531cb60a6mr2563628f8f.59.1749210405982;
Fri, 06 Jun 2025 04:46:45 -0700 (PDT)
Received: from eichest-laptop.lan ([2a02:168:af72:0:4223:e58c:4c9a:459b])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a532464e7fsm1630480f8f.96.2025.06.06.04.46.45
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:46:45 -0700 (PDT)
From: Stefan Eichenberger <eichest@xxxxxxxxx>
To: jagan@xxxxxxxxxxxxxxxxxxxx,
neil.armstrong@xxxxxxxxxx,
quic_jesszhan@xxxxxxxxxxx,
airlied@xxxxxxxxx,
simona@xxxxxxxx,
maarten.lankhorst@xxxxxxxxxxxxxxx,
mripard@xxxxxxxxxx,
tzimmermann@xxxxxxx,
robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 0/2] Add Winstar wf40eswaa6mnn0 panel support
Date: Fri, 6 Jun 2025 13:45:49 +0200
Message-ID: <20250606114644.105371-1-eichest@xxxxxxxxx>
X-Mailer: git-send-email 2.48.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This patch series adds support for the Winstar wf40eswaa6mnn0 panel. The
datasheet including the init sequence was taken from here:
https://www.winstar.com.tw/d/308/WF40ESWAA6MNN0.pdf

Stefan Eichenberger (2):
drm/panel: st7701: Add Winstar wf40eswaa6mnn0 panel support
dt-bindings: display: st7701: Add Winstar wf40eswaa6mnn0 panel

.../display/panel/sitronix,st7701.yaml | 1 +
drivers/gpu/drm/panel/panel-sitronix-st7701.c | 124 ++++++++++++++++++
2 files changed, 125 insertions(+)

--
2.48.1



Return-Path: <linux-kernel+bounces-675671-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DB55D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:47:38 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2787C3AC6D7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:46:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 82B7128852D;
Fri, 6 Jun 2025 11:46:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N8ohUU59"
Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93FEA286D73;
Fri, 6 Jun 2025 11:46:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210411; cv=none; b=Z40QyzqaNpVEbHWjt4UAqBum2nDB7lJmC+k2DWMn+TAdiRlI5vm/pUyo/f1Hw0obWhFzMXMdliPobOUkpwULKGtijv8+yi1BibKvY9sYHLPApfikuQS4GZcZUw5DhQ0k0wSVYFmVUXK11o6ijiih0Fldq5eerTuKtmHyMO2QWQ0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210411; c=relaxed/simple;
bh=rhvB4ui4y4FdYkobMOH1152Yq6fOix2H5DMS41sL9aw=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=lX5gzv7VAo3D2HO4qj/QQM2hnBFWEsJ6uL+5+2iXMnOpbuCgqmTFnlBNcT2Z5inpV781jRhrVQkx17fVsfVfXnvt8Yr53GvinIjcFXho4UfTO36bY/L2z+JlPh6XwWJtQczfxl/WWO0LU1BqQqGQODyDImZnjXPQiHxU4eqdSVM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N8ohUU59; arc=none smtp.client-ip=209.85.128.51
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43ea40a6e98so25888495e9.1;
Fri, 06 Jun 2025 04:46:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749210408; x=1749815208; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=3MgYf6F6fSeBu27ICRv37PYa/jAKP+hUr2B7udbzNrM=;
b=N8ohUU59dYtCPHxoNdxx+v8+3vEuZ6hYamKhGwqO6Lq8KeMwRFFdhQXsUOqEuq58sK
P9ujKLNENO+VXUh64x58WuODvd0NVlKvUw+PpvChQblnWAw/UV/5eK5G3qz3UCjiNctb
Cn/CwdhDxvpfEhx8yWhLV0javdBxOwMgERl3bkpkn1P2nge3I+RBjMtrcatCaxhthqe3
NQTbAxaih8iO8M2Q3Vc/1wWPjgZJ/JjdiwglwBWqD80oZWtQ3lkjEn7GdvAEv5Sil3gM
6Gg2ycQWE4wsPogx/nGAE+7GBRLv7+Cbh6ZlNQ4LHKhglvSiNzWiH55M3+nIemNljpie
CvJA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210408; x=1749815208;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=3MgYf6F6fSeBu27ICRv37PYa/jAKP+hUr2B7udbzNrM=;
b=KCWmIpyb6xCqR60+iCEsEPS1cK6nAow0u/l5OeR1tnvq1a4Vt8JE10AEEpP98tIxI4
otDahLbdqj+BqHPMkkjCcjiOlcbyUkZHYsbMLLEwzQ5c5GY2VI/cNq2Zy4oUWyEvsoSR
zyDAAWjjUpI75KM7NjI4P4ceaFQyHeC6aEcNgkp6oeNM0IgfHZYRIdCeanHdYdftngUL
Kzh3gS+oHj6nTLxbX9ts/95KTotLij+uAiR0loNtuVz30mDWZ8KiauszBpHZHyewScsa
v+Xio47mtZ0lIAU08QofQ52rwgqKQBvWChtg5DDOSbZzwUobCSuXyub0cUgQQB7+0BDk
o9Bw==
X-Forwarded-Encrypted: i=1; AJvYcCU7gc1bDHrJcxe3HZUnCM0FK1YJ9CFEOOT29Jd/XqVSGtAWQcbZMQLdNCTJIV0qyw5F4ijdfMQvOD1k+WMW@xxxxxxxxxxxxxxx, AJvYcCUiOP8ZLNdyK5HxsIlpmBv7ak9iA8u9pwdGUHbnnaclwr9kWu9+gbjSXfou/09x3giXZTNC7ghw1xk4@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YyuYj57griC+BY5I3AhC+hEdSasTE+puHEH73Kx/lKh46cRPtBr
f8+xhNTnN/wSGzacrfIvTUu5LAXaaMH7bvojCbUx1/gUw3B3nUsTut3d
X-Gm-Gg: ASbGnct6Z0AnmhJQj5sPJ7OuseNWFI+ILgBkD2Z2X31zBNItaqljmrLla+vkXyNhxiU
IQtfQ8bt6atUF/pyKbL50RI2krYrjAB6a+ffR39EPDdibfZNOx/lJJjEgOSFZAOhnKyRyDdOYlj
Vvybvvep2ZcOVr17IhI8Z+zhq3Mr649sbR4mRnzsX7I2mo4t1vQzf6Bww6Cak/EgJiC2ix+7iuG
JHAYG9fQo3DGuofXxpGp8NueqBH5kK613+TbN6e8OrrOPu7CEkNGUICQDgzYmieLh4xHdcowT5H
+QqyIux9afj5dpc3em7jWMiT0KuH12ltL0isiqbOuS6xzbSF43fsEofoTeMsx7wojBs=
X-Google-Smtp-Source: AGHT+IGJaCJqb8KgeLF+rp7LU0psHMN4qsWCIeq3F4/Z7k4HlVzv4f/iLX3p/I7NH5Akoj/6fgTWEQ==
X-Received: by 2002:a5d:6a90:0:b0:3a4:e667:9242 with SMTP id ffacd0b85a97d-3a53188da6bmr2153482f8f.3.1749210407660;
Fri, 06 Jun 2025 04:46:47 -0700 (PDT)
Received: from eichest-laptop.lan ([2a02:168:af72:0:4223:e58c:4c9a:459b])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a532464e7fsm1630480f8f.96.2025.06.06.04.46.46
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:46:46 -0700 (PDT)
From: Stefan Eichenberger <eichest@xxxxxxxxx>
To: jagan@xxxxxxxxxxxxxxxxxxxx,
neil.armstrong@xxxxxxxxxx,
quic_jesszhan@xxxxxxxxxxx,
airlied@xxxxxxxxx,
simona@xxxxxxxx,
maarten.lankhorst@xxxxxxxxxxxxxxx,
mripard@xxxxxxxxxx,
tzimmermann@xxxxxxx,
robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 1/2] drm/panel: st7701: Add Winstar wf40eswaa6mnn0 panel support
Date: Fri, 6 Jun 2025 13:45:50 +0200
Message-ID: <20250606114644.105371-2-eichest@xxxxxxxxx>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <20250606114644.105371-1-eichest@xxxxxxxxx>
References: <20250606114644.105371-1-eichest@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The Winstar wf40eswaa6mnn0 panel is a square 4.0" TFT LCD with a
resolution of 480x480 pixels.

This panel is driven by the Sitronix ST7701 controller and uses a MIPI
DSI interface. The settings are based on the panel's datasheet and the
init sequence provided by Winstar.

It was tested on a Verdin iMX8MP from Toradex with a Carrier Board
providing a MIPI DSI interface.

Signed-off-by: Stefan Eichenberger <eichest@xxxxxxxxx>
---
drivers/gpu/drm/panel/panel-sitronix-st7701.c | 124 ++++++++++++++++++
1 file changed, 124 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index 1f72ef7ca74c9..cf42281393dd9 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -520,6 +520,28 @@ static void rg28xx_gip_sequence(struct st7701 *st7701)
st7701_switch_cmd_bkx(st7701, false, 0);
}

+static void wf40eswaa6mnn0_gip_sequence(struct st7701 *st7701)
+{
+ ST7701_WRITE(st7701, 0xE0, 0x00, 0x28, 0x02);
+ ST7701_WRITE(st7701, 0xE1, 0x08, 0xA0, 0x00, 0x00, 0x07, 0xA0, 0x00,
+ 0x00, 0x00, 0x44, 0x44);
+ ST7701_WRITE(st7701, 0xE2, 0x11, 0x11, 0x44, 0x44, 0xED, 0xA0, 0x00,
+ 0x00, 0xEC, 0xA0, 0x00, 0x00);
+ ST7701_WRITE(st7701, 0xE3, 0x00, 0x00, 0x11, 0x11);
+ ST7701_WRITE(st7701, 0xE4, 0x44, 0x44);
+ ST7701_WRITE(st7701, 0xE5, 0x0A, 0xE9, 0xD8, 0xA0, 0x0C, 0xEB, 0xD8,
+ 0xA0, 0x0E, 0xED, 0xD8, 0xA0, 0x10, 0xEF, 0xD8, 0xA0);
+ ST7701_WRITE(st7701, 0xE6, 0x00, 0x00, 0x11, 0x11);
+ ST7701_WRITE(st7701, 0xE7, 0x44, 0x44);
+ ST7701_WRITE(st7701, 0xE8, 0x09, 0xE8, 0xD8, 0xA0, 0x0B, 0xEA, 0xD8,
+ 0xA0, 0x0D, 0xEC, 0xD8, 0xA0, 0x0F, 0xEE, 0xD8, 0xA0);
+ ST7701_WRITE(st7701, 0xEB, 0x00, 0x00, 0xE4, 0xE4, 0x88, 0x00, 0x40);
+ ST7701_WRITE(st7701, 0xEC, 0x3C, 0x00);
+ ST7701_WRITE(st7701, 0xED, 0xAB, 0x89, 0x76, 0x54, 0x02, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x45, 0x67, 0x98, 0xBA);
+ ST7701_WRITE(st7701, MIPI_DCS_SET_ADDRESS_MODE, 0);
+}
+
static int st7701_prepare(struct drm_panel *panel)
{
struct st7701 *st7701 = panel_to_st7701(panel);
@@ -1135,6 +1157,107 @@ static const struct st7701_panel_desc rg28xx_desc = {
.gip_sequence = rg28xx_gip_sequence,
};

+static const struct drm_display_mode wf40eswaa6mnn0_mode = {
+ .clock = 18306,
+
+ .hdisplay = 480,
+ .hsync_start = 480 + 2,
+ .hsync_end = 480 + 2 + 45,
+ .htotal = 480 + 2 + 45 + 13,
+
+ .vdisplay = 480,
+ .vsync_start = 480 + 2,
+ .vsync_end = 480 + 2 + 70,
+ .vtotal = 480 + 2 + 70 + 13,
+
+ .width_mm = 72,
+ .height_mm = 70,
+
+ .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+
+ .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
+};
+
+static const struct st7701_panel_desc wf40eswaa6mnn0_desc = {
+ .mode = &wf40eswaa6mnn0_mode,
+ .lanes = 2,
+ .format = MIPI_DSI_FMT_RGB888,
+ .panel_sleep_delay = 0,
+
+ .pv_gamma = {
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC0_MASK, 0x1),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC4_MASK, 0x08),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC8_MASK, 0x10),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC16_MASK, 0x0c),
+
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC24_MASK, 0x10),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC52_MASK, 0x08),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC80_MASK, 0x10),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC108_MASK, 0x0c),
+
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC147_MASK, 0x08),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC175_MASK, 0x22),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC203_MASK, 0x04),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC231_MASK, 0x14),
+
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC239_MASK, 0x12),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC247_MASK, 0xb3),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC251_MASK, 0x3a),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC255_MASK, 0x1f)
+ },
+ .nv_gamma = {
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC4_MASK, 0x13),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC4_MASK, 0x19),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC8_MASK, 0x1f),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC16_MASK, 0x0f),
+
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC24_MASK, 0x14),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC52_MASK, 0x07),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC80_MASK, 0x07),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC108_MASK, 0x08),
+
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC147_MASK, 0x07),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC175_MASK, 0x22),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC203_MASK, 0x02),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC231_MASK, 0xf),
+
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC239_MASK, 0x0f),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC247_MASK, 0xa3),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC251_MASK, 0x29),
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+ CFIELD_PREP(ST7701_CMD2_BK0_GAMCTRL_VC255_MASK, 0x0d)
+ },
+ .nlinv = 3,
+ .vop_uv = 4737500,
+ .vcom_uv = 662500,
+ .vgh_mv = 15000,
+ .vgl_mv = -10170,
+ .avdd_mv = 6600,
+ .avcl_mv = -4600,
+ .gamma_op_bias = OP_BIAS_MIDDLE,
+ .input_op_bias = OP_BIAS_MIDDLE,
+ .output_op_bias = OP_BIAS_MIN,
+ .t2d_ns = 1600,
+ .t3d_ns = 10400,
+ .eot_en = true,
+ .gip_sequence = wf40eswaa6mnn0_gip_sequence,
+};
+
static void st7701_cleanup(void *data)
{
struct st7701 *st7701 = (struct st7701 *)data;
@@ -1265,6 +1388,7 @@ static const struct of_device_id st7701_dsi_of_match[] = {
{ .compatible = "densitron,dmt028vghmcmi-1a", .data = &dmt028vghmcmi_1a_desc },
{ .compatible = "elida,kd50t048a", .data = &kd50t048a_desc },
{ .compatible = "techstar,ts8550b", .data = &ts8550b_desc },
+ { .compatible = "winstar,wf40eswaa6mnn0", .data = &wf40eswaa6mnn0_desc },
{ }
};
MODULE_DEVICE_TABLE(of, st7701_dsi_of_match);
--
2.48.1



Return-Path: <linux-kernel+bounces-675672-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1A83C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:47:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 884EC3B0C75
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:46:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FFFA288C01;
Fri, 6 Jun 2025 11:46:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="icsImklL"
Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0A3528850A;
Fri, 6 Jun 2025 11:46:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210412; cv=none; b=V4WWM95p3Lfy6T7s/E24ekY5QttS4O/owC85E3NeURerSTAgx+o8wMyjyBiXVcBYvlF0rxWj+ooOmTYpHUcWhulrBF578aWpfC7vNZ/Xayr66ZnZe64qwJskpizkKwIoREHrZvDTjYNhVVIhLQwebzm+byjYH2OBj60SF7aGQy0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210412; c=relaxed/simple;
bh=r9w2VcCjqCXDI/4xPjTNUSd+DNqUIaS8kE3Bk3poM6s=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=Rv/TJJqFvYk6Ipt/qm+GI59p07bz4ju1Gs4GjEhdQHVSXnBt1XdTiGh+8FTYS7UUCXqMb5oBWa5wZEgXK8CDP69NNM+Lvp0CrQNMIHLL4M1p0tYDCX8TV+zWQCrLFOC5O0wiL9mAZdMfmtUKjgsjayxDpG0P16oo8udD2qnE0Yw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=icsImklL; arc=none smtp.client-ip=209.85.221.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3a3758b122cso1298066f8f.1;
Fri, 06 Jun 2025 04:46:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749210409; x=1749815209; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=Iq7te4M6ksKrUogTjln81xegJnlcm6VPFCDyWm1hQ3Q=;
b=icsImklLSfTYV16EbB0jGCgykKsPmJjUzrZH4EQd1PyPZZ6ViAsRnzI0/HZGQlYmE+
w6Cud3jC+YNY9sumPGxO2iyXWFdC54Vp9+Ijf6JbtPmzRShCi7IPa1M1EBKKBd1OD1bL
XLmZwYExLv2Q2hykPDdw8lkeMw/zzuwOevGCk9bADWhg4JgI0mgfNCaB4L5Dxxntsepe
bdUIuDmwsufizJZmplkCYSl1o6Py66yBNFTuOn+/uokz444VKtaHx48c8LAcDW+UiM8d
etLu4yXm8CUYnjnnOk9jYa+id9z+WH3duQeVbnjl1y6ctjJG+dBbOLcBEWl09p0Gy5r8
7r7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210409; x=1749815209;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=Iq7te4M6ksKrUogTjln81xegJnlcm6VPFCDyWm1hQ3Q=;
b=NBLhz4BIRmVBeUz6sUqYn7TLy3yWIV3CaZClrk9f2krKZ/dgvtVKwmFNG+1hFjNfGs
GBNdnlXAUFnFFYmHaR5h7lnv2gwQGzWCS20sIN/zfSHMz6s0XBLZQClR0oLDrgJLPwp9
UJSet9sa/Bgwj3W2YKRtpOYzDY+V/knmYjT5tKKjvChnXKWjGldz01xfq548xUz4giqq
KvGPkX519Isy7BH0XBwzb/QgUZtXJYdoWyAYc7Bns33ygn9VTogo3J8glgW46N3V+zcX
bJyHil95GOUf+rr9VVe7R0+94LWsAG0sgj0PXS8AxYOouFl7wd2TvEr1yl2bclSCd0mr
YlZg==
X-Forwarded-Encrypted: i=1; AJvYcCUcQoL+cLrsBuDytc2hDU2Z1qOlGdtF1S4DhezD719nssfDausibYZhQHgxXwqnWQa2KtN+wbbT4edc1HSf@xxxxxxxxxxxxxxx, AJvYcCW3Ejd5723Gatpfz19rq5LKSRJWGLcu4sWVILoKy3iZoDRiw/uRagXze5J0yjZXlioLqbGlJkxvsjtW@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzHe083xwUoEmVRyBFkm91Qm56byMYcdUdcNDeblgBGrqdyxduP
WeAnqC3w/AKNnZtb4jv6AeswcTkgIa4932hbWg2eDjY1l0Kih3mxHPRs
X-Gm-Gg: ASbGncugWn8x9TWj8TdCzp5VBdjzzkuV7XogAFkunR4KwPY0LRyLGXWEymjp97zpUG3
y/2BiZUo2OHFD1mjR9IJb16St89zbU4MHPW1NX/UP/AHVitJlfFetHNxTzQhjb0fOUcvDDUOE/e
5kp4wy4UPjLH9COxWMpu5sP3Cjhsswm+eJnukB27LfNT2j4IJo9PiGpM4vYnMtFKDpuNZs4UmKW
BoETdIMtqh1Jivc1CEPqntCF77eRO3FmukvmDmzt/R+lUQk0F81CT4C/zqTd+ZBg78Em85wCNAy
cCWA5k1OHWGgzBiERnDV/9dzRbVLwJ3kUSbqWKb8F3ghNVuS9vojazh4
X-Google-Smtp-Source: AGHT+IHIwxY+2Gv+A3gO0jvWkNwzl5joDzwEBMVaga7g/Sim5ajXaO+xhytKcBVI7iEzcoAbo/MoDA==
X-Received: by 2002:a05:6000:2088:b0:3a5:2cb5:63fa with SMTP id ffacd0b85a97d-3a5319b4c74mr2219624f8f.2.1749210408898;
Fri, 06 Jun 2025 04:46:48 -0700 (PDT)
Received: from eichest-laptop.lan ([2a02:168:af72:0:4223:e58c:4c9a:459b])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a532464e7fsm1630480f8f.96.2025.06.06.04.46.47
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:46:48 -0700 (PDT)
From: Stefan Eichenberger <eichest@xxxxxxxxx>
To: jagan@xxxxxxxxxxxxxxxxxxxx,
neil.armstrong@xxxxxxxxxx,
quic_jesszhan@xxxxxxxxxxx,
airlied@xxxxxxxxx,
simona@xxxxxxxx,
maarten.lankhorst@xxxxxxxxxxxxxxx,
mripard@xxxxxxxxxx,
tzimmermann@xxxxxxx,
robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 2/2] dt-bindings: display: st7701: Add Winstar wf40eswaa6mnn0 panel
Date: Fri, 6 Jun 2025 13:45:51 +0200
Message-ID: <20250606114644.105371-3-eichest@xxxxxxxxx>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <20250606114644.105371-1-eichest@xxxxxxxxx>
References: <20250606114644.105371-1-eichest@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The Winstar wf40eswaa6mnn0 panel is a square 4.0" TFT LCD with a
resolution of 480x480 pixels.

Signed-off-by: Stefan Eichenberger <eichest@xxxxxxxxx>
---
.../devicetree/bindings/display/panel/sitronix,st7701.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml b/Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml
index b07f3eca669bf..1e434240ea3f6 100644
--- a/Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml
+++ b/Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml
@@ -29,6 +29,7 @@ properties:
- densitron,dmt028vghmcmi-1a
- elida,kd50t048a
- techstar,ts8550b
+ - winstar,wf40eswaa6mnn0
- const: sitronix,st7701

reg:
--
2.48.1



Return-Path: <linux-kernel+bounces-675673-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2E01441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:49:15 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 66B1E7A43EB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:47:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 80CDE287507;
Fri, 6 Jun 2025 11:49:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VpfbzX+x"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 0E41F1E25ED
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:49:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210545; cv=none; b=Xxps6UQjFY+fSsUSfSmMx91vnGFI6jDBFyCEHxb2cxDDI2Y0GQpqQzWWSi6Y/Uwm2yceh2hw0fahb+2Fya4QST5j2GmH7kh3kTCpZ80w7vmhJXLOBAcUxJayV3UwrwdW45A7tElI7WsFqvIvVLFwT4R/EZEeRGzB3EF+32kMfFw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210545; c=relaxed/simple;
bh=QSgOuHX+lE3ODZsvtKyyXyB68B5X60hsY4EiVrM8vYE=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=CE+CcgaeLppTMo402iP3YyaT5GsCIBXi/B//oRtf+Oy1LetZWkXCclme+23yl/beyjjcIrwD/I/l6451W7ThINJNggW5NiNUVFUDeImqEQbZDoNLeUmJXMpsKMH0B7N5yDM6C5ZPq4mmQ6k+o1dkBghB4zOmh5bPWdwSvmjnXBQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VpfbzX+x; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210542;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=68I4Y0TtXFxCNK2N6e3UcQSOeAu/7hc1LBplwDcwTcE=;
b=VpfbzX+xj690SHvo5t/4ZxizXucWqboSSRtEA7Puf45VPWbj/fGIDvdh4wtcaPGtZJw4Ck
bz1yMqdkZlMfR0C0sOaBTOfyH6++3XdRY+s0bCmLWnmEP+oARUeXNOOt6fQ0VnSR/jBnGu
33LD9pzbybQx2YsV5FNwdD3VdIi22y8=
Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com
[209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-550-1_HFG19fMci0tdrRIEwZ7w-1; Fri, 06 Jun 2025 07:48:59 -0400
X-MC-Unique: 1_HFG19fMci0tdrRIEwZ7w-1
X-Mimecast-MFC-AGG-ID: 1_HFG19fMci0tdrRIEwZ7w_1749210538
Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-450eaae2934so17072385e9.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:48:59 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210538; x=1749815338;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=68I4Y0TtXFxCNK2N6e3UcQSOeAu/7hc1LBplwDcwTcE=;
b=qtsnxVDMLhkfr5V/JpPk20hUgqwMgcESHSHY6B4/aKC2xZyf0ZlE5IuRXu44kE/HcV
ea8VwTGnG3wUpdudaSn8JlDag6+xSkc3Yg9xCGlV8ZWb5GYW8WYX7U6A1FmIecqWBkpx
YNMNVjiyX5JG6DMsF7EO0zr0b3eP461Xv3NFr9Tlnums5DhevIE+qg8BcCMdmTeZxibb
ncy/7yOTc92YGb0xBXws/QOHTw90wzCDMxUSAbDnt/X68yIXV6/dyX4itMWoge7C6AYO
CrWdC7RfBxtowA+ougko4TEC+lriGglVzA144CPwv3ynz3NyH5yKbt8Z0U2SU4o0bo1j
HZHw==
X-Forwarded-Encrypted: i=1; AJvYcCVT1X+H5u2CMmOUQqFXUNll4jhGyatBOVMLFiqLu7IciAhiwvKxIdSrny/VawTjaqAzMnUUjWbpVof+H6g=@vger.kernel.org
X-Gm-Message-State: AOJu0YyCM0yMMjvjjjvTxw2sbWnjI9PZQN9n4824YlUoQR1Am9Wa2zZE
5e8X1g5nIzSss+culGofL077D+fYXlx+YdYaS/vaXe2POFQarwiJ1HjQiYRtsjT00h7aF5xHkoj
AE8Ctrbs5gRkW0Z8VNImWNuDARR35zw1tsTgwH7RvSDLMG9LyKOPzh7Zswangqq34bA==
X-Gm-Gg: ASbGncuA+zIWYw4fMR0tZoX1s2cc93pCnLzpdJXBoQRwclwxPw4ZhC0m8b30JKz70Sn
4JY/G5FvRfiNgK2GEvCdPNu2XsDzHKNEwDqjk8M4jM2bPf3JdYJDYtK6uSfQbnbF3FEOmVjcYds
CJhKzRplBiJ/MnGarYkTyOP7iNoYtppsA84MOHpGSNYAY893c0QQlcAp4LdGcpdkAcYSnxhS1Qb
ZDu3HW0R4G+y4aKr02S12IFVoyA/Of8iGTseR6MlxjxEep0QwYJ++ihBsTfmz1ex5nnWq03ii3f
H6ETRhc3h19qbsy8y4HKNt00C89ohYDt0/B5NemGrciPySbMMFcybnBghTInRDSm6zIGthytXM+
c91DZ5wDd1Qhb43iyGfpws1IvRqEULiw=
X-Received: by 2002:a05:600c:c491:b0:442:f8e7:25ef with SMTP id 5b1f17b1804b1-45201458425mr27983495e9.11.1749210538465;
Fri, 06 Jun 2025 04:48:58 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IFrdtAx79g1V5j+TxA2nNneOf5lDgPUH5YR6LNlzqQQIXuJ4KSCbPsPVZoiFWxBNVvQB+bDmA==
X-Received: by 2002:a05:600c:c491:b0:442:f8e7:25ef with SMTP id 5b1f17b1804b1-45201458425mr27983285e9.11.1749210538017;
Fri, 06 Jun 2025 04:48:58 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53229de70sm1615032f8f.5.2025.06.06.04.48.57
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:48:57 -0700 (PDT)
Message-ID: <70f3fd39-6b78-4b2c-a09f-ec1e7a2c34db@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:48:56 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 10/10] mm,memory_hotplug: Rename status_change_nid
parameter in memory_notify
To: Oscar Salvador <osalvador@xxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<20250605142305.244465-11-osalvador@xxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250605142305.244465-11-osalvador@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

> struct notifier_block;
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 0550f3061fc4..bccbc02ed122 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1186,7 +1186,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages,
>
> mem_arg.start_pfn = pfn;
> mem_arg.nr_pages = nr_pages;
> - mem_arg.status_change_nid = node_arg.nid;
> + mem_arg.nid = node_arg.nid;
> cancel_mem_notifier_on_err = true;
> ret = memory_notify(MEM_GOING_ONLINE, &mem_arg);
> ret = notifier_to_errno(ret);
> @@ -1987,7 +1987,7 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages,
>
> mem_arg.start_pfn = start_pfn;
> mem_arg.nr_pages = nr_pages;
> - mem_arg.status_change_nid = node_arg.nid;
> + mem_arg.nid = node_arg.nid;
> cancel_mem_notifier_on_err = true;
> ret = memory_notify(MEM_GOING_OFFLINE, &mem_arg);
> ret = notifier_to_errno(ret);

Okay, now I realize we should just remove the nid completely, because

> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index c351fdfe9e9a..477e6f24b7ab 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -378,16 +378,6 @@ static int __meminit online_page_ext(unsigned long start_pfn,
> start = SECTION_ALIGN_DOWN(start_pfn);
> end = SECTION_ALIGN_UP(start_pfn + nr_pages);
>
> - if (nid == NUMA_NO_NODE) {
> - /*
> - * In this case, "nid" already exists and contains valid memory.
> - * "start_pfn" passed to us is a pfn which is an arg for
> - * online__pages(), and start_pfn should exist.
> - */
> - nid = pfn_to_nid(start_pfn);
> - VM_BUG_ON(!node_online(nid));
> - }
> -
> for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION)
> fail = init_section_page_ext(pfn, nid);
> if (!fail)
> @@ -436,7 +426,7 @@ static int __meminit page_ext_callback(struct notifier_block *self,
> switch (action) {
> case MEM_GOING_ONLINE:
> ret = online_page_ext(mn->start_pfn,
> - mn->nr_pages, mn->status_change_nid);
> + mn->nr_pages, mn->nid);

Nowadays we call move_pfn_range_to_zone() before MEM_GOING_ONLINE.

So we can simply do the

nid = pfn_to_nid(start_pfn);

unconditionally above.

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675674-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4636741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:50:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id AA5187A2E0E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:49:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 43DEE2882B6;
Fri, 6 Jun 2025 11:50:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KZ//8IYN"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 061111E25ED
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210625; cv=none; b=JeudADcrWd13eJFubFHkLIU5e8ZJFws1p4mDcOcfPqfKZz0H3iKvxU6XYKhTsyBn+K9TwwqfDv7mlVg1bdq0amQAw7p6dZEteQbAFL/lfd3Rx6JA3fIJupsxpedbomPEv6jwO55Xj0osI+GX2p+eABzu76SMjgPT9J9LqIE1w/k=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210625; c=relaxed/simple;
bh=XY8CgEm+gfYiIn55Z9BrkbO2R0Hv7ngcaj+noUQ/ZaY=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=WGTBPl9R8TksBHx0zLITedMgLYDFUZXa9X3WsOMGXmR+AkEzQh7//+yIl5PPQcJVs/4SCpAYmi1qzyabY9V8GvfgxT6ITEJuW7lg5EFsjNlx7gwmEsFNdeVKxe0QdmBZGhwOJgsoVfCa0yus1ufELa8Jub09omce3d5Ktx/eJQw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KZ//8IYN; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210622;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=pAESjvW/CQELSi4D5e2qzw/1nEgJ9ev8dcIeNCsprbU=;
b=KZ//8IYNUOIQLCrOdPHDiR6gZdGntafqiEyCHQo5OnNV/m5q9dJ0Rkb+Lk8mntp8mGyPS1
qmU5LHoZbqx3p7iwU/5d/eqn/pXayR53BPVH/OreSMYL/x5mJNIVwBhNPnR0FGSAwTSA3Q
yMVj71I9TczUISsFpNo4vMulTJl5OXU=
Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-176-_VADKSl_NMWy0wzWPgeDUg-1; Fri,
06 Jun 2025 07:50:19 -0400
X-MC-Unique: _VADKSl_NMWy0wzWPgeDUg-1
X-Mimecast-MFC-AGG-ID: _VADKSl_NMWy0wzWPgeDUg_1749210618
Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A2272195604F;
Fri, 6 Jun 2025 11:50:18 +0000 (UTC)
Received: from fedora.redhat.com (unknown [10.44.33.72])
by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4EA8419560B2;
Fri, 6 Jun 2025 11:50:14 +0000 (UTC)
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>
To: jasowang@xxxxxxxxxx
Cc: Yongji Xie <xieyongji@xxxxxxxxxxxxx>,
Cindy Lu <lulu@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
=?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>,
Stefano Garzarella <sgarzare@xxxxxxxxxx>,
Stefan Hajnoczi <stefanha@xxxxxxxxxx>,
Maxime Coquelin <mcoqueli@xxxxxxxxxx>,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>,
virtualization@xxxxxxxxxxxxxxx,
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>,
Laurent Vivier <lvivier@xxxxxxxxxx>
Subject: [RFC 0/6] Add multiple address spaces support to VDUSE
Date: Fri, 6 Jun 2025 13:50:06 +0200
Message-ID: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

When used by vhost-vDPA bus driver for VM, the control virtqueue
should be shadowed via userspace VMM (QEMU) instead of being assigned
directly to Guest. This is because QEMU needs to know the device state
in order to start and stop device correctly (e.g for Live Migration).

This requies to isolate the memory mapping for control virtqueue
presented by vhost-vDPA to prevent guest from accessing it directly.

This patches introduces the multiple address spaces support for VDUSE
device. This idea is to identify a specific address space via an
dedicated identifier - ASID.

The VDUSE device needs to report the number of virtqueue groups and the
association with each virtqueue, and also the number of address space
supported. Then, the vDPA driver can modify the ASID assigned to each
VQ group to isolate the memory AS. This is already done for vdpa_sim and
nvidia mlx5 devices.

This helps to isolate the environments for the virtqueues that will not
be assigned directly. E.g in the case of virtio-net, the control
virtqueue will not be assigned directly to guest.

This is an RFC has only been tested with vhost_vdpa, so it deserves more
testing with virtio_vdpa. And it still has some TODOs pending. Sending
to gather early feedback.

Also, to be able to test this patch, the user needs to manually revert
56e71885b034 ("vduse: Temporarily fail if control queue feature requested").

Eugenio Pérez (6):
vduse: add v1 API definition
vduse: add vq group support
vduse: add vq group asid support
vduse: send update_iotlb_v2 message
vduse: reset group asid in reset
vduse: bump version number

drivers/vdpa/vdpa_user/vduse_dev.c | 307 ++++++++++++++++++++++-------
include/uapi/linux/vduse.h | 64 +++++-
2 files changed, 298 insertions(+), 73 deletions(-)

--
2.49.0



Return-Path: <linux-kernel+bounces-675675-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1180A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:50:43 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4FDA31687FD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:44 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EE92128851C;
Fri, 6 Jun 2025 11:50:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Wh3iZs6x"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 C9DC928850C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210629; cv=none; b=ML5wLa1NLn34/zc69HWXMKmoPSsZEJxrjHTSo6YoFsRXoYAjD0rc5BLPg2GLdQ2mX5YonJXHg3YsqkENdvyZSgiQ01L0ZRUL6FDMNRpSBSa5NhXYT72dhc3uBY7z7XsrmLzOTvvcUi0bT5yz1uPqZhuaB0UEAxhmV87OTWzil4s=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210629; c=relaxed/simple;
bh=SyMEBMqoEegjVXM0Ur3SwKjQpuKBaC3i+d9aIcIqW2E=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=WpuW7AbLNx+xPRJ7oqzlVqrlMWtFkzGHuDN55jUAq3Nu9/l8guZ/w2syORa4JhX/p/BBc09OE6oR0VGP9fITVoRg3d/z9vuDcSeMlQ7c3KSWpdBfkXG5uyuCn8DJUbpofJmRq3NtFCWOCoMY2BlfjGDbfI3Zn52LK98aSKwqv4M=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Wh3iZs6x; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210627;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=vp49S0VL4Jqz0gpimx8bGKhznGhVA0Kv/wGqwICbM2I=;
b=Wh3iZs6xnTB+r5aDObmceeYQ7N8tHF4yIziILNcnn+GG1eQGfdGuw0aG84MnO+arh/0SuC
289Keg0O7XqBEGRLA0kUoCD2CXMOMfOXlf/146qqXVvg4MsgAUUeN5cGDpcRC7/hUTZ07K
DIpLklmaeVA5wZEzALA9ntdfFC2PGDY=
Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-458-uKZZJwjONfurVKoo1DdWMw-1; Fri,
06 Jun 2025 07:50:24 -0400
X-MC-Unique: uKZZJwjONfurVKoo1DdWMw-1
X-Mimecast-MFC-AGG-ID: uKZZJwjONfurVKoo1DdWMw_1749210623
Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 80F1019560B4;
Fri, 6 Jun 2025 11:50:23 +0000 (UTC)
Received: from fedora.redhat.com (unknown [10.44.33.72])
by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 981FA19560B2;
Fri, 6 Jun 2025 11:50:18 +0000 (UTC)
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>
To: jasowang@xxxxxxxxxx
Cc: Yongji Xie <xieyongji@xxxxxxxxxxxxx>,
Cindy Lu <lulu@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
=?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>,
Stefano Garzarella <sgarzare@xxxxxxxxxx>,
Stefan Hajnoczi <stefanha@xxxxxxxxxx>,
Maxime Coquelin <mcoqueli@xxxxxxxxxx>,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>,
virtualization@xxxxxxxxxxxxxxx,
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>,
Laurent Vivier <lvivier@xxxxxxxxxx>
Subject: [RFC 1/6] vduse: add v1 API definition
Date: Fri, 6 Jun 2025 13:50:07 +0200
Message-ID: <20250606115012.1331551-2-eperezma@xxxxxxxxxx>
In-Reply-To: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
References: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This allows to define all functions checking the API version set by the
userland device.

Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
---
include/uapi/linux/vduse.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h
index 68a627d04afa..9a56d0416bfe 100644
--- a/include/uapi/linux/vduse.h
+++ b/include/uapi/linux/vduse.h
@@ -10,6 +10,10 @@

#define VDUSE_API_VERSION 0

+/* VQ groups and ASID support */
+
+#define VDUSE_API_VERSION_1 1
+
/*
* Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION).
* This is used for future extension.
--
2.49.0



Return-Path: <linux-kernel+bounces-675676-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E515E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:50:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id AD6F93A1E05
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C7A71288508;
Fri, 6 Jun 2025 11:50:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i6uoQw/Z"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 4F97A2882C2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210637; cv=none; b=aE0938p+SLLtiV1Hdr1Wb5FzKx4lf4LUlDApgd+Syz7OtnOil0htppDG1iNkgEazPipgaxCl+5QsX2PRXbGRZqnIKFX4hmeWMY+GM5l6aVS/mNo7Il9BBOzQLDO7lOQ5MalDiHF30n/12mHvWik6GjcjKhg1Byz3URecnMjCIvM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210637; c=relaxed/simple;
bh=UgsieFu3Kz0njZbZT/Zg810et6OCXfsW1n4LV9dgZgY=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=WcRO5Kr9mWjesOucKNSCKwbbOCmCJecfygOO2lS7ZyhvbK1p1m5D+xi+Nq5U0hH74P0WF4uAVT/7/ma9CshwZp5K7L1AugvpH3b9hv80GAV/mEL6YuH0vlvfncQv/3C3QAS9CcGlVya7jS0sUDL3W/n1ZyoqPV108gLNydJ4kJE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=i6uoQw/Z; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210634;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=NZUnE9Fp7JTLv3YsV0naKvxGFvbyveDrK723yBnXOgQ=;
b=i6uoQw/ZzVbOplaEtATgXAbXfXgobX9wbwe864CbPsSo9wyhVS711CvphK/b6BT/28hHPY
RdToYRnlAcxIP/rUT7mIywIUIVq3rIykIxbVq5KMlJd36WNv+z4AzafTPLuxIe+N+Ax65e
tft6v6bgiICibQw62ryt3GF0O7Cfigs=
Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-g9yncyHAMdO1cDyUatHMvg-1; Fri,
06 Jun 2025 07:50:29 -0400
X-MC-Unique: g9yncyHAMdO1cDyUatHMvg-1
X-Mimecast-MFC-AGG-ID: g9yncyHAMdO1cDyUatHMvg_1749210628
Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ED08A195608B;
Fri, 6 Jun 2025 11:50:27 +0000 (UTC)
Received: from fedora.redhat.com (unknown [10.44.33.72])
by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0B5AC19560B2;
Fri, 6 Jun 2025 11:50:23 +0000 (UTC)
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>
To: jasowang@xxxxxxxxxx
Cc: Yongji Xie <xieyongji@xxxxxxxxxxxxx>,
Cindy Lu <lulu@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
=?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>,
Stefano Garzarella <sgarzare@xxxxxxxxxx>,
Stefan Hajnoczi <stefanha@xxxxxxxxxx>,
Maxime Coquelin <mcoqueli@xxxxxxxxxx>,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>,
virtualization@xxxxxxxxxxxxxxx,
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>,
Laurent Vivier <lvivier@xxxxxxxxxx>
Subject: [RFC 2/6] vduse: add vq group support
Date: Fri, 6 Jun 2025 13:50:08 +0200
Message-ID: <20250606115012.1331551-3-eperezma@xxxxxxxxxx>
In-Reply-To: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
References: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The virtqueue group is the minimal set of virtqueues that must share an
address space. And the address space identifier could only be attached
to a specific virtqueue group. The virtqueue is attached to a
virtqueue group for all the life of the device.

During vDPA device allocation, the VDUSE device needs to report the
number of virtqueue groups supported. At this moment only vhost_vdpa is
able to do it.

This helps to isolate the environments for the virtqueue that will not
be assigned directly. E.g in the case of virtio-net, the control
virtqueue will not be assigned directly to guest.

As we need to back the vq groups with a struct device for the file
operations, let's keep this number as low as possible at the moment: 2.
We can back one VQ group with the vduse device and the other one with
the vdpa device.

Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 44 +++++++++++++++++++++++++++++-
include/uapi/linux/vduse.h | 17 +++++++++++-
2 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 6a9a37351310..6fa687bc4912 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -46,6 +46,11 @@
#define VDUSE_IOVA_SIZE (VDUSE_MAX_BOUNCE_SIZE + 128 * 1024 * 1024)
#define VDUSE_MSG_DEFAULT_TIMEOUT 30

+/*
+ * Let's make it 2 for simplicity.
+ */
+#define VDUSE_MAX_VQ_GROUPS 2
+
#define IRQ_UNBOUND -1

struct vduse_virtqueue {
@@ -114,6 +119,7 @@ struct vduse_dev {
u8 status;
u32 vq_num;
u32 vq_align;
+ u32 ngroups;
struct vduse_umem *umem;
struct mutex mem_lock;
unsigned int bounce_size;
@@ -592,6 +598,25 @@ static int vduse_vdpa_set_vq_state(struct vdpa_device *vdpa, u16 idx,
return 0;
}

+static u32 vduse_get_vq_group(struct vdpa_device *vdpa, u16 idx)
+{
+ struct vduse_dev *dev = vdpa_to_vduse(vdpa);
+ struct vduse_dev_msg msg = { 0 };
+ int ret;
+
+ if (dev->api_version < VDUSE_API_VERSION_1)
+ return 0;
+
+ msg.req.type = VDUSE_GET_VQ_GROUP;
+ msg.req.vq_group.index = idx;
+
+ ret = vduse_dev_msg_sync(dev, &msg);
+ if (ret)
+ return ret;
+
+ return msg.resp.vq_group.num;
+}
+
static int vduse_vdpa_get_vq_state(struct vdpa_device *vdpa, u16 idx,
struct vdpa_vq_state *state)
{
@@ -789,6 +814,7 @@ static const struct vdpa_config_ops vduse_vdpa_config_ops = {
.set_vq_cb = vduse_vdpa_set_vq_cb,
.set_vq_num = vduse_vdpa_set_vq_num,
.get_vq_size = vduse_vdpa_get_vq_size,
+ .get_vq_group = vduse_get_vq_group,
.set_vq_ready = vduse_vdpa_set_vq_ready,
.get_vq_ready = vduse_vdpa_get_vq_ready,
.set_vq_state = vduse_vdpa_set_vq_state,
@@ -1850,6 +1876,16 @@ static int vduse_create_dev(struct vduse_dev_config *config,
dev->device_features = config->features;
dev->device_id = config->device_id;
dev->vendor_id = config->vendor_id;
+ if (dev->api_version >= 1) {
+ if (config->ngroups > VDUSE_MAX_VQ_GROUPS) {
+ pr_err("Not creating a VDUSE device with %u vq groups. Max: %u",
+ config->ngroups, VDUSE_MAX_VQ_GROUPS);
+ goto err_ngroups;
+ }
+ dev->ngroups = config->ngroups ?: 1;
+ } else {
+ dev->ngroups = 1;
+ }
dev->name = kstrdup(config->name, GFP_KERNEL);
if (!dev->name)
goto err_str;
@@ -1885,6 +1921,7 @@ static int vduse_create_dev(struct vduse_dev_config *config,
idr_remove(&vduse_idr, dev->minor);
err_idr:
kfree(dev->name);
+err_ngroups:
err_str:
vduse_dev_destroy(dev);
err:
@@ -2003,13 +2040,18 @@ static struct vduse_mgmt_dev *vduse_mgmt;
static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name)
{
struct vduse_vdpa *vdev;
+ __u32 ngroups = 1;
int ret;

if (dev->vdev)
return -EEXIST;

+ if (vdev->dev->api_version >= VDUSE_API_VERSION_1)
+ ngroups = vdev->dev->ngroups;
+
vdev = vdpa_alloc_device(struct vduse_vdpa, vdpa, dev->dev,
- &vduse_vdpa_config_ops, 1, 1, name, true);
+ &vduse_vdpa_config_ops, ngroups, 1, name,
+ true);
if (IS_ERR(vdev))
return PTR_ERR(vdev);

diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h
index 9a56d0416bfe..a779bcddac58 100644
--- a/include/uapi/linux/vduse.h
+++ b/include/uapi/linux/vduse.h
@@ -45,7 +45,8 @@ struct vduse_dev_config {
__u64 features;
__u32 vq_num;
__u32 vq_align;
- __u32 reserved[13];
+ __u32 ngroups; /* if VDUSE_API_VERSION >= 1 */
+ __u32 reserved[12];
__u32 config_size;
__u8 config[];
};
@@ -160,6 +161,16 @@ struct vduse_vq_state_packed {
__u16 last_used_idx;
};

+/**
+ * struct vduse_vq_group - virtqueue group
+ * @num: Index of the virtqueue group
+ * @num: Group
+ */
+struct vduse_vq_group {
+ __u32 index;
+ __u32 num;
+};
+
/**
* struct vduse_vq_info - information of a virtqueue
* @index: virtqueue index
@@ -182,6 +193,7 @@ struct vduse_vq_info {
union {
struct vduse_vq_state_split split;
struct vduse_vq_state_packed packed;
+ struct vduse_vq_group group;
};
__u8 ready;
};
@@ -274,6 +286,7 @@ enum vduse_req_type {
VDUSE_GET_VQ_STATE,
VDUSE_SET_STATUS,
VDUSE_UPDATE_IOTLB,
+ VDUSE_GET_VQ_GROUP,
};

/**
@@ -328,6 +341,7 @@ struct vduse_dev_request {
struct vduse_vq_state vq_state;
struct vduse_dev_status s;
struct vduse_iova_range iova;
+ struct vduse_vq_group vq_group; /* Only if vduse api version >= 1 */
__u32 padding[32];
};
};
@@ -350,6 +364,7 @@ struct vduse_dev_response {
__u32 reserved[4];
union {
struct vduse_vq_state vq_state;
+ struct vduse_vq_group vq_group; /* Only if vduse api version >= 1 */
__u32 padding[32];
};
};
--
2.49.0



Return-Path: <linux-kernel+bounces-675677-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 84C6141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:51:06 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4F1A73A7F28
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:44 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DF5C288514;
Fri, 6 Jun 2025 11:50:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PU+EfHpr"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 A8E1C2882CD
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210639; cv=none; b=mbBq+vsHLToyV9I//7itQ70Ik86n6hWfwOpSwBNRht1EIwICMJxX6dGG4vgiXVpGcHRJTpInnNtBknMM0kHFc24ghIi13OyqtcC1LeIVkPr3zaZ3ibA9nk20YkkH2qaIiEvhPaXfto797Pw92HULSdh6Om1Y7AakUOR68QkOY9U=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210639; c=relaxed/simple;
bh=JjnV/cMKZ21bR+kkecYTjDSU7m/Vn38S16UYMsTJD2E=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=SgxjXeUe8SWI2UkM49RrIz3RRCEwCzgBF3kpjcPq7+GG7/F4jDC9uPZLLqUD40tJ3K8GT7M1Ql8lRyvhOJARTAkjYdmQ6JON7cAmTr8FH9okyUF9QK++lGWgehMMXen/7hOJ6SB27+tLib02vLYG5uB+GPa4vT/lIGIHk+/yueY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PU+EfHpr; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210636;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=jKyGoqk8vynqsNeQjiRI+TmiQQKqLOuQiBp+LnnxBGc=;
b=PU+EfHprpMMvio+TF53MV2XjYwN4wN/+FiFFcZU5tDQfvf7wttuO4djaOQ62+UTmCN2+DT
JHL7vX/0KhpnQ58JBUWAO6mA4x39LJ6JxPiOqCx373wtll5vOn6w9dY4HZAszWCRW643pF
3txsUVjh6SWcxOl/I8kFRDokEt0ouOw=
Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-70eA9zMkO6yJunHjYlTCow-1; Fri,
06 Jun 2025 07:50:33 -0400
X-MC-Unique: 70eA9zMkO6yJunHjYlTCow-1
X-Mimecast-MFC-AGG-ID: 70eA9zMkO6yJunHjYlTCow_1749210632
Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8890B1956046;
Fri, 6 Jun 2025 11:50:32 +0000 (UTC)
Received: from fedora.redhat.com (unknown [10.44.33.72])
by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7768719560B2;
Fri, 6 Jun 2025 11:50:28 +0000 (UTC)
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>
To: jasowang@xxxxxxxxxx
Cc: Yongji Xie <xieyongji@xxxxxxxxxxxxx>,
Cindy Lu <lulu@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
=?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>,
Stefano Garzarella <sgarzare@xxxxxxxxxx>,
Stefan Hajnoczi <stefanha@xxxxxxxxxx>,
Maxime Coquelin <mcoqueli@xxxxxxxxxx>,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>,
virtualization@xxxxxxxxxxxxxxx,
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>,
Laurent Vivier <lvivier@xxxxxxxxxx>
Subject: [RFC 3/6] vduse: add vq group asid support
Date: Fri, 6 Jun 2025 13:50:09 +0200
Message-ID: <20250606115012.1331551-4-eperezma@xxxxxxxxxx>
In-Reply-To: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
References: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Make one IOTLB domain per address space, and allow the driver to assign
each ASID to a vq group. Each address space via an dedicated identifier
(ASID).

During vDPA device allocation, the VDUSE device needs to report the
number of address spaces supported. Then the vdpa driver is able to
configure them. At this moment only vhost_vdpa is able to do it.

This helps to isolate the environments for the virtqueue that will not
be assigned directly. E.g in the case of virtio-net, the control
virtqueue will not be assigned directly to guest.

TODO: Ideally, umem should not be duplicated. But it is hard or
impossible to refactor everything around one single umem. So should we
continue with device specifying umem per vq group?

Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 250 +++++++++++++++++++++--------
include/uapi/linux/vduse.h | 38 ++++-
2 files changed, 216 insertions(+), 72 deletions(-)

diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 6fa687bc4912..d51e4f26fe72 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -51,6 +51,11 @@
*/
#define VDUSE_MAX_VQ_GROUPS 2

+/*
+ * Let's make it 2 for simplicity.
+ */
+#define VDUSE_MAX_ASID 2
+
#define IRQ_UNBOUND -1

struct vduse_virtqueue {
@@ -92,7 +97,7 @@ struct vduse_dev {
struct vduse_vdpa *vdev;
struct device *dev;
struct vduse_virtqueue **vqs;
- struct vduse_iova_domain *domain;
+ struct vduse_iova_domain *domain[VDUSE_MAX_ASID];
char *name;
struct mutex lock;
spinlock_t msg_lock;
@@ -120,7 +125,8 @@ struct vduse_dev {
u32 vq_num;
u32 vq_align;
u32 ngroups;
- struct vduse_umem *umem;
+ u32 nas;
+ struct vduse_umem *umem[VDUSE_MAX_ASID];
struct mutex mem_lock;
unsigned int bounce_size;
struct mutex domain_lock;
@@ -436,11 +442,14 @@ static __poll_t vduse_dev_poll(struct file *file, poll_table *wait)
static void vduse_dev_reset(struct vduse_dev *dev)
{
int i;
- struct vduse_iova_domain *domain = dev->domain;

/* The coherent mappings are handled in vduse_dev_free_coherent() */
- if (domain && domain->bounce_map)
- vduse_domain_reset_bounce_map(domain);
+ for (i = 0; i < dev->nas; i++) {
+ struct vduse_iova_domain *domain = dev->domain[i];
+
+ if (domain && domain->bounce_map)
+ vduse_domain_reset_bounce_map(domain);
+ }

down_write(&dev->rwsem);

@@ -617,6 +626,23 @@ static u32 vduse_get_vq_group(struct vdpa_device *vdpa, u16 idx)
return msg.resp.vq_group.num;
}

+static int vduse_set_group_asid(struct vdpa_device *vdpa, unsigned int group,
+ unsigned int asid)
+{
+ struct vduse_dev *dev = vdpa_to_vduse(vdpa);
+ struct vduse_dev_msg msg = { 0 };
+
+ if (dev->api_version < VDUSE_API_VERSION_1 ||
+ group >= dev->ngroups || asid >= dev->nas)
+ return -EINVAL;
+
+ msg.req.type = VDUSE_SET_VQ_GROUP_ASID;
+ msg.req.vq_group_asid.group = group;
+ msg.req.vq_group_asid.asid = asid;
+
+ return vduse_dev_msg_sync(dev, &msg);
+}
+
static int vduse_vdpa_get_vq_state(struct vdpa_device *vdpa, u16 idx,
struct vdpa_vq_state *state)
{
@@ -788,13 +814,13 @@ static int vduse_vdpa_set_map(struct vdpa_device *vdpa,
struct vduse_dev *dev = vdpa_to_vduse(vdpa);
int ret;

- ret = vduse_domain_set_map(dev->domain, iotlb);
+ ret = vduse_domain_set_map(dev->domain[asid], iotlb);
if (ret)
return ret;

ret = vduse_dev_update_iotlb(dev, 0ULL, ULLONG_MAX);
if (ret) {
- vduse_domain_clear_map(dev->domain, iotlb);
+ vduse_domain_clear_map(dev->domain[asid], iotlb);
return ret;
}

@@ -837,6 +863,7 @@ static const struct vdpa_config_ops vduse_vdpa_config_ops = {
.get_vq_affinity = vduse_vdpa_get_vq_affinity,
.reset = vduse_vdpa_reset,
.set_map = vduse_vdpa_set_map,
+ .set_group_asid = vduse_set_group_asid,
.free = vduse_vdpa_free,
};

@@ -845,9 +872,12 @@ static void vduse_dev_sync_single_for_device(struct device *dev,
enum dma_data_direction dir)
{
struct vduse_dev *vdev = dev_to_vduse(dev);
- struct vduse_iova_domain *domain = vdev->domain;

- vduse_domain_sync_single_for_device(domain, dma_addr, size, dir);
+ for (int i = 0; i < vdev->nas; i++) {
+ struct vduse_iova_domain *domain = vdev->domain[i];
+
+ vduse_domain_sync_single_for_device(domain, dma_addr, size, dir);
+ }
}

static void vduse_dev_sync_single_for_cpu(struct device *dev,
@@ -855,9 +885,12 @@ static void vduse_dev_sync_single_for_cpu(struct device *dev,
enum dma_data_direction dir)
{
struct vduse_dev *vdev = dev_to_vduse(dev);
- struct vduse_iova_domain *domain = vdev->domain;

- vduse_domain_sync_single_for_cpu(domain, dma_addr, size, dir);
+ for (int i = 0; i < vdev->nas; i++) {
+ struct vduse_iova_domain *domain = vdev->domain[i];
+
+ vduse_domain_sync_single_for_cpu(domain, dma_addr, size, dir);
+ }
}

static dma_addr_t vduse_dev_map_page(struct device *dev, struct page *page,
@@ -866,7 +899,7 @@ static dma_addr_t vduse_dev_map_page(struct device *dev, struct page *page,
unsigned long attrs)
{
struct vduse_dev *vdev = dev_to_vduse(dev);
- struct vduse_iova_domain *domain = vdev->domain;
+ struct vduse_iova_domain *domain = vdev->domain[0];

return vduse_domain_map_page(domain, page, offset, size, dir, attrs);
}
@@ -876,7 +909,7 @@ static void vduse_dev_unmap_page(struct device *dev, dma_addr_t dma_addr,
unsigned long attrs)
{
struct vduse_dev *vdev = dev_to_vduse(dev);
- struct vduse_iova_domain *domain = vdev->domain;
+ struct vduse_iova_domain *domain = vdev->domain[0];

return vduse_domain_unmap_page(domain, dma_addr, size, dir, attrs);
}
@@ -886,7 +919,7 @@ static void *vduse_dev_alloc_coherent(struct device *dev, size_t size,
unsigned long attrs)
{
struct vduse_dev *vdev = dev_to_vduse(dev);
- struct vduse_iova_domain *domain = vdev->domain;
+ struct vduse_iova_domain *domain = vdev->domain[0];
unsigned long iova;
void *addr;

@@ -906,17 +939,25 @@ static void vduse_dev_free_coherent(struct device *dev, size_t size,
unsigned long attrs)
{
struct vduse_dev *vdev = dev_to_vduse(dev);
- struct vduse_iova_domain *domain = vdev->domain;
+ struct vduse_iova_domain *domain = vdev->domain[0];

vduse_domain_free_coherent(domain, size, vaddr, dma_addr, attrs);
}

+/* TODO check if this is correct */
static size_t vduse_dev_max_mapping_size(struct device *dev)
{
struct vduse_dev *vdev = dev_to_vduse(dev);
- struct vduse_iova_domain *domain = vdev->domain;
+ size_t max_mapping_size = 0;
+
+ for (int i = 0; i < vdev->nas; i++) {
+ struct vduse_iova_domain *domain = vdev->domain[i];

- return domain->bounce_size;
+ if (domain->bounce_size > max_mapping_size)
+ max_mapping_size = domain->bounce_size;
+ }
+
+ return max_mapping_size;
}

static const struct dma_map_ops vduse_dev_dma_ops = {
@@ -1054,31 +1095,32 @@ static int vduse_dev_queue_irq_work(struct vduse_dev *dev,
return ret;
}

-static int vduse_dev_dereg_umem(struct vduse_dev *dev,
+static int vduse_dev_dereg_umem(struct vduse_dev *dev, u32 asid,
u64 iova, u64 size)
{
int ret;

mutex_lock(&dev->mem_lock);
ret = -ENOENT;
- if (!dev->umem)
+ if (!dev->umem[asid])
goto unlock;

ret = -EINVAL;
- if (!dev->domain)
+ if (!dev->domain[asid])
goto unlock;

- if (dev->umem->iova != iova || size != dev->domain->bounce_size)
+ if (dev->umem[asid]->iova != iova ||
+ size != dev->domain[asid]->bounce_size)
goto unlock;

- vduse_domain_remove_user_bounce_pages(dev->domain);
- unpin_user_pages_dirty_lock(dev->umem->pages,
- dev->umem->npages, true);
- atomic64_sub(dev->umem->npages, &dev->umem->mm->pinned_vm);
- mmdrop(dev->umem->mm);
- vfree(dev->umem->pages);
- kfree(dev->umem);
- dev->umem = NULL;
+ vduse_domain_remove_user_bounce_pages(dev->domain[asid]);
+ unpin_user_pages_dirty_lock(dev->umem[asid]->pages,
+ dev->umem[asid]->npages, true);
+ atomic64_sub(dev->umem[asid]->npages, &dev->umem[asid]->mm->pinned_vm);
+ mmdrop(dev->umem[asid]->mm);
+ vfree(dev->umem[asid]->pages);
+ kfree(dev->umem[asid]);
+ dev->umem[asid] = NULL;
ret = 0;
unlock:
mutex_unlock(&dev->mem_lock);
@@ -1086,7 +1128,7 @@ static int vduse_dev_dereg_umem(struct vduse_dev *dev,
}

static int vduse_dev_reg_umem(struct vduse_dev *dev,
- u64 iova, u64 uaddr, u64 size)
+ u32 asid, u64 iova, u64 uaddr, u64 size)
{
struct page **page_list = NULL;
struct vduse_umem *umem = NULL;
@@ -1094,14 +1136,14 @@ static int vduse_dev_reg_umem(struct vduse_dev *dev,
unsigned long npages, lock_limit;
int ret;

- if (!dev->domain || !dev->domain->bounce_map ||
- size != dev->domain->bounce_size ||
+ if (!dev->domain[asid] || !dev->domain[asid]->bounce_map ||
+ size != dev->domain[asid]->bounce_size ||
iova != 0 || uaddr & ~PAGE_MASK)
return -EINVAL;

mutex_lock(&dev->mem_lock);
ret = -EEXIST;
- if (dev->umem)
+ if (dev->umem[asid])
goto unlock;

ret = -ENOMEM;
@@ -1125,7 +1167,7 @@ static int vduse_dev_reg_umem(struct vduse_dev *dev,
goto out;
}

- ret = vduse_domain_add_user_bounce_pages(dev->domain,
+ ret = vduse_domain_add_user_bounce_pages(dev->domain[asid],
page_list, pinned);
if (ret)
goto out;
@@ -1138,7 +1180,7 @@ static int vduse_dev_reg_umem(struct vduse_dev *dev,
umem->mm = current->mm;
mmgrab(current->mm);

- dev->umem = umem;
+ dev->umem[asid] = umem;
out:
if (ret && pinned > 0)
unpin_user_pages(page_list, pinned);
@@ -1181,26 +1223,42 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,

switch (cmd) {
case VDUSE_IOTLB_GET_FD: {
- struct vduse_iotlb_entry entry;
+ struct vduse_iotlb_entry_v2 entry = {};
+ struct vduse_iotlb_entry entry_old;
struct vhost_iotlb_map *map;
struct vdpa_map_file *map_file;
struct file *f = NULL;

ret = -EFAULT;
- if (copy_from_user(&entry, argp, sizeof(entry)))
- break;
+ if (dev->api_version >= VDUSE_API_VERSION_1) {
+ if (copy_from_user(&entry, argp, sizeof(entry)))
+ break;
+ } else {
+ if (copy_from_user(&entry_old, argp,
+ sizeof(entry_old)))
+ break;
+
+ entry.offset = entry_old.offset;
+ entry.start = entry_old.start;
+ entry.last = entry_old.last;
+ entry.perm = entry_old.perm;
+ }

ret = -EINVAL;
if (entry.start > entry.last)
break;

+ if (entry.asid >= dev->nas)
+ break;
+
mutex_lock(&dev->domain_lock);
- if (!dev->domain) {
+ /* TODO accessing an array with idx from userspace, mitigations? */
+ if (!dev->domain[entry.asid]) {
mutex_unlock(&dev->domain_lock);
break;
}
- spin_lock(&dev->domain->iotlb_lock);
- map = vhost_iotlb_itree_first(dev->domain->iotlb,
+ spin_lock(&dev->domain[entry.asid]->iotlb_lock);
+ map = vhost_iotlb_itree_first(dev->domain[entry.asid]->iotlb,
entry.start, entry.last);
if (map) {
map_file = (struct vdpa_map_file *)map->opaque;
@@ -1210,7 +1268,7 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
entry.last = map->last;
entry.perm = map->perm;
}
- spin_unlock(&dev->domain->iotlb_lock);
+ spin_unlock(&dev->domain[entry.asid]->iotlb_lock);
mutex_unlock(&dev->domain_lock);
ret = -EINVAL;
if (!f)
@@ -1360,12 +1418,18 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
break;

ret = -EINVAL;
+ /* TODO: Using asid from userspace, need to mitigate? */
if (!is_mem_zero((const char *)umem.reserved,
- sizeof(umem.reserved)))
+ sizeof(umem.reserved)) ||
+ !is_mem_zero((const char *)umem.reserved2,
+ sizeof(umem.reserved2)) ||
+ (dev->api_version < VDUSE_API_VERSION_1 &&
+ umem.asid != 0) ||
+ umem.asid >= dev->nas)
break;

mutex_lock(&dev->domain_lock);
- ret = vduse_dev_reg_umem(dev, umem.iova,
+ ret = vduse_dev_reg_umem(dev, umem.asid, umem.iova,
umem.uaddr, umem.size);
mutex_unlock(&dev->domain_lock);
break;
@@ -1378,15 +1442,23 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
break;

ret = -EINVAL;
+ /* TODO: Using asid from userspace, need to mitigate? */
if (!is_mem_zero((const char *)umem.reserved,
- sizeof(umem.reserved)))
+ sizeof(umem.reserved)) ||
+ !is_mem_zero((const char *)umem.reserved2,
+ sizeof(umem.reserved2)) ||
+ (dev->api_version < VDUSE_API_VERSION_1 &&
+ umem.asid != 0) ||
+ umem.asid >= dev->nas)
break;
+
mutex_lock(&dev->domain_lock);
- ret = vduse_dev_dereg_umem(dev, umem.iova,
+ ret = vduse_dev_dereg_umem(dev, umem.asid, umem.iova,
umem.size);
mutex_unlock(&dev->domain_lock);
break;
}
+ /* TODO can we merge this with GET_FD? */
case VDUSE_IOTLB_GET_INFO: {
struct vduse_iova_info info;
struct vhost_iotlb_map *map;
@@ -1399,27 +1471,32 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
if (info.start > info.last)
break;

+ if (info.asid >= dev->nas)
+ break;
+
if (!is_mem_zero((const char *)info.reserved,
sizeof(info.reserved)))
break;

mutex_lock(&dev->domain_lock);
- if (!dev->domain) {
+ /* TODO asid comes from userspace. mitigations? */
+ if (!dev->domain[info.asid]) {
mutex_unlock(&dev->domain_lock);
break;
}
- spin_lock(&dev->domain->iotlb_lock);
- map = vhost_iotlb_itree_first(dev->domain->iotlb,
+ spin_lock(&dev->domain[info.asid]->iotlb_lock);
+ map = vhost_iotlb_itree_first(dev->domain[info.asid]->iotlb,
info.start, info.last);
if (map) {
info.start = map->start;
info.last = map->last;
info.capability = 0;
- if (dev->domain->bounce_map && map->start == 0 &&
- map->last == dev->domain->bounce_size - 1)
+ if (dev->domain[info.asid]->bounce_map &&
+ map->start == 0 &&
+ map->last == dev->domain[info.asid]->bounce_size - 1)
info.capability |= VDUSE_IOVA_CAP_UMEM;
}
- spin_unlock(&dev->domain->iotlb_lock);
+ spin_unlock(&dev->domain[info.asid]->iotlb_lock);
mutex_unlock(&dev->domain_lock);
if (!map)
break;
@@ -1444,8 +1521,13 @@ static int vduse_dev_release(struct inode *inode, struct file *file)
struct vduse_dev *dev = file->private_data;

mutex_lock(&dev->domain_lock);
- if (dev->domain)
- vduse_dev_dereg_umem(dev, 0, dev->domain->bounce_size);
+ for (int i = 0; i < dev->nas; i++) {
+ if (dev->domain[i]) {
+ vduse_dev_dereg_umem(dev, i, 0,
+ dev->domain[i]->bounce_size);
+ dev->domain[i] = NULL;
+ }
+ }
mutex_unlock(&dev->domain_lock);
spin_lock(&dev->msg_lock);
/* Make sure the inflight messages can processed after reconncection */
@@ -1715,8 +1797,10 @@ static int vduse_destroy_dev(char *name)
idr_remove(&vduse_idr, dev->minor);
kvfree(dev->config);
vduse_dev_deinit_vqs(dev);
- if (dev->domain)
- vduse_domain_destroy(dev->domain);
+ for (int i = 0; i < dev->nas; i++) {
+ if (dev->domain[i])
+ vduse_domain_destroy(dev->domain[i]);
+ }
kfree(dev->name);
vduse_dev_destroy(dev);
module_put(THIS_MODULE);
@@ -1824,7 +1908,7 @@ static ssize_t bounce_size_store(struct device *device,

ret = -EPERM;
mutex_lock(&dev->domain_lock);
- if (dev->domain)
+ if (dev->domain[0] && dev->domain[1])
goto unlock;

ret = kstrtouint(buf, 10, &bounce_size);
@@ -1882,9 +1966,18 @@ static int vduse_create_dev(struct vduse_dev_config *config,
config->ngroups, VDUSE_MAX_VQ_GROUPS);
goto err_ngroups;
}
+
+ if (config->nas > VDUSE_MAX_ASID) {
+ pr_err("Not creating a VDUSE device with %u asid. Max: %u",
+ config->nas, VDUSE_MAX_ASID);
+ goto err_nas;
+ }
+
dev->ngroups = config->ngroups ?: 1;
+ dev->nas = config->nas ?: 1;
} else {
dev->ngroups = 1;
+ dev->nas = 1;
}
dev->name = kstrdup(config->name, GFP_KERNEL);
if (!dev->name)
@@ -1923,6 +2016,7 @@ static int vduse_create_dev(struct vduse_dev_config *config,
kfree(dev->name);
err_ngroups:
err_str:
+err_nas:
vduse_dev_destroy(dev);
err:
return ret;
@@ -2015,7 +2109,6 @@ static int vduse_open(struct inode *inode, struct file *file)
if (!control)
return -ENOMEM;

- control->api_version = VDUSE_API_VERSION;
file->private_data = control;

return 0;
@@ -2040,17 +2133,15 @@ static struct vduse_mgmt_dev *vduse_mgmt;
static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name)
{
struct vduse_vdpa *vdev;
- __u32 ngroups = 1;
+ __u32 ngroups = dev->ngroups;
int ret;

if (dev->vdev)
return -EEXIST;

- if (vdev->dev->api_version >= VDUSE_API_VERSION_1)
- ngroups = vdev->dev->ngroups;
-
+ /* TODO do we need to store ngroups and nas? vdpa device already store it for us */
vdev = vdpa_alloc_device(struct vduse_vdpa, vdpa, dev->dev,
- &vduse_vdpa_config_ops, ngroups, 1, name,
+ &vduse_vdpa_config_ops, ngroups, dev->nas, name,
true);
if (IS_ERR(vdev))
return PTR_ERR(vdev);
@@ -2088,11 +2179,23 @@ static int vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
return ret;

mutex_lock(&dev->domain_lock);
- if (!dev->domain)
- dev->domain = vduse_domain_create(VDUSE_IOVA_SIZE - 1,
- dev->bounce_size);
+ ret = 0;
+
+ /* TODO we could delay the creation of the domain */
+ for (int i = 0; i < dev->nas; ++i) {
+ if (!dev->domain[i])
+ dev->domain[i] = vduse_domain_create(VDUSE_IOVA_SIZE - 1,
+ dev->bounce_size);
+ if (!dev->domain[i]) {
+ ret = -ENOMEM;
+ for (int j = 0; j < i; ++j)
+ vduse_domain_destroy(dev->domain[j]);
+ goto err_domain;
+ }
+ }
+
mutex_unlock(&dev->domain_lock);
- if (!dev->domain) {
+ if (ret == -ENOMEM) {
put_device(&dev->vdev->vdpa.dev);
return -ENOMEM;
}
@@ -2101,13 +2204,22 @@ static int vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
if (ret) {
put_device(&dev->vdev->vdpa.dev);
mutex_lock(&dev->domain_lock);
- vduse_domain_destroy(dev->domain);
- dev->domain = NULL;
+ for (int i = 0; i < dev->nas; i++) {
+ if (dev->domain[i]) {
+ vduse_domain_destroy(dev->domain[i]);
+ dev->domain[i] = NULL;
+ }
+ }
mutex_unlock(&dev->domain_lock);
return ret;
}

return 0;
+
+err_domain:
+ /* TODO do I need to call put_device? */
+ mutex_unlock(&dev->domain_lock);
+ return ret;
}

static void vdpa_dev_del(struct vdpa_mgmt_dev *mdev, struct vdpa_device *dev)
diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h
index a779bcddac58..3a17a0b4e938 100644
--- a/include/uapi/linux/vduse.h
+++ b/include/uapi/linux/vduse.h
@@ -46,7 +46,8 @@ struct vduse_dev_config {
__u32 vq_num;
__u32 vq_align;
__u32 ngroups; /* if VDUSE_API_VERSION >= 1 */
- __u32 reserved[12];
+ __u32 nas; /* if VDUSE_API_VERSION >= 1 */
+ __u32 reserved[11];
__u32 config_size;
__u8 config[];
};
@@ -81,6 +82,17 @@ struct vduse_iotlb_entry {
__u8 perm;
};

+struct vduse_iotlb_entry_v2 {
+ __u64 offset;
+ __u64 start;
+ __u64 last;
+ __u32 asid;
+#define VDUSE_ACCESS_RO 0x1
+#define VDUSE_ACCESS_WO 0x2
+#define VDUSE_ACCESS_RW 0x3
+ __u8 perm;
+};
+
/*
* Find the first IOVA region that overlaps with the range [start, last]
* and return the corresponding file descriptor. Return -EINVAL means the
@@ -171,6 +183,16 @@ struct vduse_vq_group {
__u32 num;
};

+/**
+ * struct vduse_vq_group - virtqueue group
+ @ @group: Index of the virtqueue group
+ * @asid: Address space ID of the group
+ */
+struct vduse_vq_group_asid {
+ __u32 group;
+ __u32 asid;
+};
+
/**
* struct vduse_vq_info - information of a virtqueue
* @index: virtqueue index
@@ -231,7 +253,9 @@ struct vduse_vq_eventfd {
* @uaddr: start address of userspace memory, it must be aligned to page size
* @iova: start of the IOVA region
* @size: size of the IOVA region
+ * @asid: Address space ID of the IOVA region
* @reserved: for future use, needs to be initialized to zero
+ * @reserved2: for future use, needs to be initialized to zero
*
* Structure used by VDUSE_IOTLB_REG_UMEM and VDUSE_IOTLB_DEREG_UMEM
* ioctls to register/de-register userspace memory for IOVA regions
@@ -240,7 +264,9 @@ struct vduse_iova_umem {
__u64 uaddr;
__u64 iova;
__u64 size;
- __u64 reserved[3];
+ __u32 asid;
+ __u32 reserved[1];
+ __u64 reserved2[2];
};

/* Register userspace memory for IOVA regions */
@@ -264,7 +290,8 @@ struct vduse_iova_info {
__u64 last;
#define VDUSE_IOVA_CAP_UMEM (1 << 0)
__u64 capability;
- __u64 reserved[3];
+ __u64 asid; /* Only if device API version >= 1 */
+ __u64 reserved[2];
};

/*
@@ -287,6 +314,7 @@ enum vduse_req_type {
VDUSE_SET_STATUS,
VDUSE_UPDATE_IOTLB,
VDUSE_GET_VQ_GROUP,
+ VDUSE_SET_VQ_GROUP_ASID,
};

/**
@@ -342,6 +370,8 @@ struct vduse_dev_request {
struct vduse_dev_status s;
struct vduse_iova_range iova;
struct vduse_vq_group vq_group; /* Only if vduse api version >= 1 */
+ /* Only if vduse api version >= 1 */
+ struct vduse_vq_group_asid vq_group_asid;
__u32 padding[32];
};
};
@@ -365,6 +395,8 @@ struct vduse_dev_response {
union {
struct vduse_vq_state vq_state;
struct vduse_vq_group vq_group; /* Only if vduse api version >= 1 */
+ /* Only if vduse api version >= 1 */
+ struct vduse_vq_group_asid vq_group_asid;
__u32 padding[32];
};
};
--
2.49.0



Return-Path: <linux-kernel+bounces-675678-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DE7F741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:51:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 483D27A4A51
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:49:57 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B974288C1D;
Fri, 6 Jun 2025 11:50:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gq0GpwSs"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 02D83288C0C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210643; cv=none; b=KLWokj9py66DAyVr1nO2D/fSGOr2b2KutxJ7bWPykWXkfCltMqVch/ei+vpaiAC8DKittqbCDNQWKdh912fdXKexMOoHKTenpR8Nsr3ufhX71smBJM1uPKmXNh6DoFz3ckmDQlWWzhzfjgN+hP+tH366Y5aDvQFeDHq+ud+w1DA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210643; c=relaxed/simple;
bh=89wxZ3oO4ZH6cCK6mN0JW+yXN+Rr112wSDrBDCPMLAo=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=pqnghTORDRIhLBeSEWuv0NzLQq3nE8xcrKTtFAeI0U4hvGFlBEualC4B22rCIUIAis/8qcBzukv/uwD6EYoDxCaihQGUFWgGups4/euKMj1Jr15xJqxpszH5gyVNxQ5FFJdAclXTDnI+Ee8kAgbOGnG53WNgU+uOsAD2eTedD5c=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gq0GpwSs; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210641;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=iretUVp3t9mkYjP8n+n5q4o6QbDi952+SZy4PuCS9O8=;
b=gq0GpwSs0q3CnYywnp1WrT2bbxjMscAbJ4S6EJJyX8LhIjNUuxlFJ4P7DZFL/RA4sNvcmW
xxBanp3lI1yxYmRVrONCNdLEQHRbwQpz/xrzg9O04X1YwvZe4g67w0Moez0SCYPZCfK2Kh
vq4M1/TVrDyxpeQbptE/WSq0ORUQwRg=
Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-544-UV_7ViRdPh6HGemABi3etQ-1; Fri,
06 Jun 2025 07:50:38 -0400
X-MC-Unique: UV_7ViRdPh6HGemABi3etQ-1
X-Mimecast-MFC-AGG-ID: UV_7ViRdPh6HGemABi3etQ_1749210637
Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DD9E5195608E;
Fri, 6 Jun 2025 11:50:36 +0000 (UTC)
Received: from fedora.redhat.com (unknown [10.44.33.72])
by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DA36C195E74A;
Fri, 6 Jun 2025 11:50:32 +0000 (UTC)
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>
To: jasowang@xxxxxxxxxx
Cc: Yongji Xie <xieyongji@xxxxxxxxxxxxx>,
Cindy Lu <lulu@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
=?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>,
Stefano Garzarella <sgarzare@xxxxxxxxxx>,
Stefan Hajnoczi <stefanha@xxxxxxxxxx>,
Maxime Coquelin <mcoqueli@xxxxxxxxxx>,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>,
virtualization@xxxxxxxxxxxxxxx,
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>,
Laurent Vivier <lvivier@xxxxxxxxxx>
Subject: [RFC 4/6] vduse: send update_iotlb_v2 message
Date: Fri, 6 Jun 2025 13:50:10 +0200
Message-ID: <20250606115012.1331551-5-eperezma@xxxxxxxxxx>
In-Reply-To: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
References: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This new version reports the translation ASID. Needed so the device can
support it.

Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 14 ++++++++++----
include/uapi/linux/vduse.h | 7 +++++++
2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index d51e4f26fe72..151c6d133e76 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -317,7 +317,7 @@ static int vduse_dev_set_status(struct vduse_dev *dev, u8 status)
return vduse_dev_msg_sync(dev, &msg);
}

-static int vduse_dev_update_iotlb(struct vduse_dev *dev,
+static int vduse_dev_update_iotlb(struct vduse_dev *dev, u32 asid,
u64 start, u64 last)
{
struct vduse_dev_msg msg = { 0 };
@@ -326,8 +326,14 @@ static int vduse_dev_update_iotlb(struct vduse_dev *dev,
return -EINVAL;

msg.req.type = VDUSE_UPDATE_IOTLB;
- msg.req.iova.start = start;
- msg.req.iova.last = last;
+ if (dev->api_version < VDUSE_API_VERSION_1) {
+ msg.req.iova.start = start;
+ msg.req.iova.last = last;
+ } else {
+ msg.req.iova_v2.start = start;
+ msg.req.iova_v2.last = last;
+ msg.req.iova_v2.asid = asid;
+ }

return vduse_dev_msg_sync(dev, &msg);
}
@@ -818,7 +824,7 @@ static int vduse_vdpa_set_map(struct vdpa_device *vdpa,
if (ret)
return ret;

- ret = vduse_dev_update_iotlb(dev, 0ULL, ULLONG_MAX);
+ ret = vduse_dev_update_iotlb(dev, asid, 0ULL, ULLONG_MAX);
if (ret) {
vduse_domain_clear_map(dev->domain[asid], iotlb);
return ret;
diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h
index 3a17a0b4e938..a7c979591b2e 100644
--- a/include/uapi/linux/vduse.h
+++ b/include/uapi/linux/vduse.h
@@ -349,6 +349,12 @@ struct vduse_iova_range {
__u64 last;
};

+struct vduse_iova_range_v2 {
+ __u64 start;
+ __u64 last;
+ __u32 asid;
+};
+
/**
* struct vduse_dev_request - control request
* @type: request type
@@ -369,6 +375,7 @@ struct vduse_dev_request {
struct vduse_vq_state vq_state;
struct vduse_dev_status s;
struct vduse_iova_range iova;
+ struct vduse_iova_range_v2 iova_v2;
struct vduse_vq_group vq_group; /* Only if vduse api version >= 1 */
/* Only if vduse api version >= 1 */
struct vduse_vq_group_asid vq_group_asid;
--
2.49.0



Return-Path: <linux-kernel+bounces-675679-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D6CF641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:51:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id BCC3317A042
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B6174288C32;
Fri, 6 Jun 2025 11:50:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bjcbq0BS"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 77D4D288525
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210648; cv=none; b=UkBkodnGcIHE7g/8AVBaEUGYTQFqS6i2Jq4MhfT9vrZLKkVm/gpGi1hpGlTFK6kXit+wo6EXcR5YjPURI4cvDAyOk738crqZebSu6z3/TeLsXd4p387jBie3TH3k1M6Vik49mI9ERqzYhk6/CBRi0NpW9UVGxzNFpxkxjVleSmk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210648; c=relaxed/simple;
bh=rnfH/LG4SOFZzUgJOleYnhArYVI1bRk/qn39vRK7QZw=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=rrH9D84cnqlBGrY9UOe7RfVESv/mHc9G7WCHIg23GAXIhk6dFhkV9hjbDRBMjs8tvjyid1nzRlN/TbRBqhfdfJBLcTUu4+rmkiDd49XTujRu2HferZT5lzMpujTonV66QheIg/okRGdbKGtAeegz/iSVdCr/yq3NXV1sAK2BaUQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Bjcbq0BS; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210644;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=WqxHAv8IthusYfEbserIn/Muun9xU0nuRy3hl8B74K8=;
b=Bjcbq0BSt44u5XYbHaWsoONDdl4f8HFlFle2yueVY8qpWa0zbfh1H+S8aNkFgmPNhksOaT
rH3pxuMxzmGrM6qsn5wxmKN0h1VKIWL8/McRxsFeOKSFolSRsVAn9zlc0hyXm4PVYRr24f
t2rzK1hoPoFmXBA6uW7a76iuu+VjZbA=
Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-_pxwGeO9Pl6BItm5ke8y2Q-1; Fri,
06 Jun 2025 07:50:43 -0400
X-MC-Unique: _pxwGeO9Pl6BItm5ke8y2Q-1
X-Mimecast-MFC-AGG-ID: _pxwGeO9Pl6BItm5ke8y2Q_1749210642
Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C85371956086;
Fri, 6 Jun 2025 11:50:41 +0000 (UTC)
Received: from fedora.redhat.com (unknown [10.44.33.72])
by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E363B19560B2;
Fri, 6 Jun 2025 11:50:37 +0000 (UTC)
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>
To: jasowang@xxxxxxxxxx
Cc: Yongji Xie <xieyongji@xxxxxxxxxxxxx>,
Cindy Lu <lulu@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
=?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>,
Stefano Garzarella <sgarzare@xxxxxxxxxx>,
Stefan Hajnoczi <stefanha@xxxxxxxxxx>,
Maxime Coquelin <mcoqueli@xxxxxxxxxx>,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>,
virtualization@xxxxxxxxxxxxxxx,
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>,
Laurent Vivier <lvivier@xxxxxxxxxx>
Subject: [RFC 5/6] vduse: reset group asid in reset
Date: Fri, 6 Jun 2025 13:50:11 +0200
Message-ID: <20250606115012.1331551-6-eperezma@xxxxxxxxxx>
In-Reply-To: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
References: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Is the expected behavior with vdpa_sim and mlx.

Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 151c6d133e76..5f0032df43b8 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -445,6 +445,9 @@ static __poll_t vduse_dev_poll(struct file *file, poll_table *wait)
return mask;
}

+static int vduse_set_group_asid(struct vdpa_device *vdpa, unsigned int group,
+ unsigned int asid);
+
static void vduse_dev_reset(struct vduse_dev *dev)
{
int i;
@@ -457,6 +460,9 @@ static void vduse_dev_reset(struct vduse_dev *dev)
vduse_domain_reset_bounce_map(domain);
}

+ for (i = 0; i < dev->ngroups; i++)
+ vduse_set_group_asid(&dev->vdev->vdpa, i, 0);
+
down_write(&dev->rwsem);

dev->status = 0;
--
2.49.0



Return-Path: <linux-kernel+bounces-675680-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EB99241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:51:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0983B3A8FDD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F5FA288C93;
Fri, 6 Jun 2025 11:50:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Eayl0aW7"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 67B1A288525
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210652; cv=none; b=OBCEt9w9WatgPby4UeYRsm3A+1udoyKXF+1JY3+NY7aM3a8oQ02x4IhUAm6beNH2NdWxAW9nlraTxCfaPpS2l0DPRIEm/HsfrSZE0nu9psSa/I1ei0lMJPnSPFK7BXUhq+Th7KjxmD53+Q3tHCruyavu4sWsATGvEEStDsmjNow=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210652; c=relaxed/simple;
bh=0jY8Ix2Pgzh4AnL8c2nW59L0ilTMJI8ols79dNPFWFs=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=eGVzCWfHlcpOY7qlA5pwN29tMG3vqEoJHRmLIQ5tG0DyjqtBSIKufThbzafyPI+R5FsCrAFzjsMYiRlpOV2f5POMXkX/mhP6DzrF6XAN8pJpDvocd6kbcSXxSqJ6nYVKv9sI1XTao1YhJeypLoTi28YZOMCopRFl9exUzqSUHHM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Eayl0aW7; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210650;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=47KURE2uwvmeWrjGi3t/o6J482tK7X78iwNAEhTsM28=;
b=Eayl0aW7NSER+Q+oZDwBwqTkbqLaHO200EKwFKs0zZoeWArrp8vpX7Jzw0Ku7tTYG5n9fF
kJnPgOnRaISBYor+WkfeNrhDZC1NK8OgFCyhs2Gz9AYFCaoCuawp421B8H80/gD9rqrRpN
39PvwS5mzBt9TcCKumfYyh9y3OxhSgc=
Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com
(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-102-tUGiYcpJNWaGjGguxhJ0HQ-1; Fri,
06 Jun 2025 07:50:47 -0400
X-MC-Unique: tUGiYcpJNWaGjGguxhJ0HQ-1
X-Mimecast-MFC-AGG-ID: tUGiYcpJNWaGjGguxhJ0HQ_1749210646
Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4A7E818009B3;
Fri, 6 Jun 2025 11:50:46 +0000 (UTC)
Received: from fedora.redhat.com (unknown [10.44.33.72])
by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 51CFE19560B2;
Fri, 6 Jun 2025 11:50:42 +0000 (UTC)
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>
To: jasowang@xxxxxxxxxx
Cc: Yongji Xie <xieyongji@xxxxxxxxxxxxx>,
Cindy Lu <lulu@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx,
=?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@xxxxxxxxxx>,
Stefano Garzarella <sgarzare@xxxxxxxxxx>,
Stefan Hajnoczi <stefanha@xxxxxxxxxx>,
Maxime Coquelin <mcoqueli@xxxxxxxxxx>,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>,
virtualization@xxxxxxxxxxxxxxx,
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>,
Laurent Vivier <lvivier@xxxxxxxxxx>
Subject: [RFC 6/6] vduse: bump version number
Date: Fri, 6 Jun 2025 13:50:12 +0200
Message-ID: <20250606115012.1331551-7-eperezma@xxxxxxxxxx>
In-Reply-To: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
References: <20250606115012.1331551-1-eperezma@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

So VDUSE devices can use the new features

Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 5f0032df43b8..aa2d25caa933 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -2054,7 +2054,7 @@ static long vduse_ioctl(struct file *file, unsigned int cmd,
break;

ret = -EINVAL;
- if (api_version > VDUSE_API_VERSION)
+ if (api_version > VDUSE_API_VERSION_1)
break;

ret = 0;
@@ -2121,6 +2121,7 @@ static int vduse_open(struct inode *inode, struct file *file)
if (!control)
return -ENOMEM;

+ control->api_version = VDUSE_API_VERSION_1;
file->private_data = control;

return 0;
--
2.49.0



Return-Path: <linux-kernel+bounces-675681-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B352E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:51:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id D20AF189C666
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:52:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BD7DC288510;
Fri, 6 Jun 2025 11:51:03 +0000 (UTC)
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 953A828850C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210663; cv=none; b=MzygOOI/rKqLc5gRfw4LXb+bAa44+S028gbfKdyp3BNyzd1VdgpAJKCenzJFlhYEiJfowVz3dH8BPE6rMSHtphTOZ8zYP3siB0QHyL0HEw2UkJ3Wn3/htcC3R7V034gg6cpwfvxirroLN8Lvq+11kQYMxtRGyc0mA/AmqlLLv6Q=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210663; c=relaxed/simple;
bh=rSVdPCfJzYH2kr5oMn102aWmnIZp5De7oGIaNPdkOeE=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=KvmM4enYjvMpQijHGYUCFC/U+ym2+7EoBjx3ybeB6g/Pk/RyLH6DPKt7MJbbEMhv2H8AnAdffmxqAtHPRsf+VhMdur1yy3u8WYyzo/884EotiAVeFcTiLqjK/8lSYJmXMeRWN3rbFSFXPBFighhuYmomLZVjQ42U2LS3RttJD5s=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com
[209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-336--TLjSp-wNbOiWaOODJHs_w-1; Fri, 06 Jun 2025 07:50:59 -0400
X-MC-Unique: -TLjSp-wNbOiWaOODJHs_w-1
X-Mimecast-MFC-AGG-ID: -TLjSp-wNbOiWaOODJHs_w_1749210658
Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3a50816cc58so829340f8f.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:50:59 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210658; x=1749815458;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=pYJGRqckhRe+BwZpb5JLIznIuBTO3J/tHjbtBqCbLRk=;
b=JSl1hda2l3kS87p0zg32aaGQPgrN08DI5gLJqOdIbiBZEVNgrFSWxAxrRCjZPly0lV
z1rJjV7rRKtIAbSad9v5hGP0/kIw5uCyswhG2LjldVhcErgBqAVggM2wqlQu127zqLfH
UWalg2cujc5Vz435qFOmvvLyLt/D9sKnZFoTwp1ecUOhEeZl26z35p/YZQ+cOB/HzUNV
bfTCa6+pBehOOpxSr/8M3BXcXraZfEcI9V/9sJBW1tyQQNM7TheKSfoEPWvV6oM83Uxg
MdO1nyRZhWuUQqvBFwunLOJJjS2gTkWFgVzwunNy1KoIMf4JybE5aO7XSgr53xxVELDu
Rdrw==
X-Forwarded-Encrypted: i=1; AJvYcCUZau8huKUtXIoIdC7fE5NVFODBsKF1UiJW8lM1Cgz/51fOAolm42tNUQUnazSxfOnsbU0KrmOwAvDfb3I=@vger.kernel.org
X-Gm-Message-State: AOJu0YyFeitJPwceXssb/fCYb6CAuM1eM1ok1eq/q5DJMCu2qx602qz+
CYQbh2o2KlZorTup7Nl4MaeLAStNKCEmgrQYpnK1rqEnx/IQz6I5N5FfLmzehRa0Vw67YJ0L9Oy
/qZmOxBHMd0jTtYKZa65Cev1nBBYwnbk8LGwH3KAuJK9xyqD8YAoZQ7eWWVdncaf8Rg==
X-Gm-Gg: ASbGncs41n2JwDs/6+uaXCcQGog6o4KD5SSHb+vsVhWbs4BgqUeqiRRZKpQ83hBkoYK
fhk4V5jQW0PZw5Y7E+yo8YfbnR3QOHoJsIQz7u7C6hVCa6ok7LQcCW1E178OIUtRACIQSPh0Uwc
oN2D8YjSelGvEA3lcVc7X8Z/2ceBxY4oqUUxwfl9TAhgCF40nZn22lEQslw1+5X1/r2DQr7Qru1
4v+4ePamhTWGVqJ0jAljKt94bMswH9rieCOSKghP7OVDcduqPymq0O/WihHNWUHzHnTfKIGZnXm
HHLiazl1qYQ6xI6eQAl503n2EsGglumXhTNWx8AsFme48IxJITtrZs+z1775thyIaNY5AXGRkMR
/EbBhpViN0s5XSg76y6RVsGG5bYgIkGo=
X-Received: by 2002:a05:6000:40ca:b0:3a4:dbdf:7154 with SMTP id ffacd0b85a97d-3a531cf497cmr2521464f8f.54.1749210657965;
Fri, 06 Jun 2025 04:50:57 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IGxlRZuyjqfxkJT9RqmeW3tRY0Za5IaocilDs8flVHqJyxHY7fHsk9RsbeeS7gy+19xAXOSBw==
X-Received: by 2002:a05:6000:40ca:b0:3a4:dbdf:7154 with SMTP id ffacd0b85a97d-3a531cf497cmr2521437f8f.54.1749210657548;
Fri, 06 Jun 2025 04:50:57 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53229df09sm1665363f8f.6.2025.06.06.04.50.56
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:50:57 -0700 (PDT)
Message-ID: <16459fe6-e449-4fa6-8e63-1ed71cce627b@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:50:56 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 05/10] mm,memory-tiers: Use node-notifier instead of
memory-notifier
To: Oscar Salvador <osalvador@xxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<20250605142305.244465-6-osalvador@xxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250605142305.244465-6-osalvador@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 05.06.25 16:22, Oscar Salvador wrote:
> memory-tier is only concerned when a numa node changes its memory state,
> because it then needs to re-create the demotion list.
> So stop using the memory notifier and use the new numa node notifer
> instead.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>
> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> mm/memory-tiers.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
> index fc14fe53e9b7..67f06e6264a1 100644
> --- a/mm/memory-tiers.c
> +++ b/mm/memory-tiers.c
> @@ -872,25 +872,25 @@ static int __meminit memtier_hotplug_callback(struct notifier_block *self,
> unsigned long action, void *_arg)
> {
> struct memory_tier *memtier;
> - struct memory_notify *arg = _arg;
> + struct node_notify *narg = _arg;
>
> /*
> * Only update the node migration order when a node is
> * changing status, like online->offline.
> */
> - if (arg->status_change_nid < 0)
> + if (narg->nid < 0)
> return notifier_from_errno(0);

Ehm, why are we ever calling a node notifier with nid < 0 ?

We shouldn't do that.

Can be adding first / removing last from something that ... is not a
valid node? :)

Maybe it's already do that way, in that case just drop this check here.

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675682-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4F34B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:52:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6FA1817A169
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:52:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BCD8288513;
Fri, 6 Jun 2025 11:51:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dffrT20r"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 A740A28850C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210691; cv=none; b=XJiA5yjbbmkwsLgGH1MhgK/6D3ycEzyKf31z9tgxVYKLvLnqqb3lfYNxZZjtXUjv/kx9lGbOoq4P3P2M+KW9rXOIOb/XZtDNQZTPfk46nbkfjbz26E9KopAWpZFeGD19igFmcGeBKq+dR83u5Xw3SfhsTTfYoocpc6CBrSNPyM8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210691; c=relaxed/simple;
bh=zbnH3pInG6RT5w6ACeygENQ7RmnTomfZEB2GDkjzMQM=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=ALu25bdTbB7M5sR4xaN5Mn6lRjNnusftp8YnX110Rs1X1AntdZpKK5ElClOLRp0zGUfMXj6R7OrpOhsB2pUGYAK9gCa1NZgQnD4UxYwyT5DO5BrVoiZ52snMMhW1Kg0+ZqwBLlLNaRKouoB/xPNIENQk6nSeU3EUYR7Dp7fC04U=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dffrT20r; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210688;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=HBNIv4v4CDaVQ8ZIjf4kNfpcVgMGwx5JzlOzvqm3Fu4=;
b=dffrT20rXXhOo6nYwTtFAFgxWjrDN9YFHlEdu+TY63rozhJQ963jjHycitsoIj6b3iLC5c
l6N5u3Z6fSmP1ozCvHALquUtUOkOzOjgAbqEUyRPVofXWLdSHAGzAUQlatgLLLIIcSwdq8
M/fIACdQKrPtc4Ikl/tX24N4JQUDtwY=
Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com
[209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-302-nqDrCHUZM-m0W3A234Zb3w-1; Fri, 06 Jun 2025 07:51:27 -0400
X-MC-Unique: nqDrCHUZM-m0W3A234Zb3w-1
X-Mimecast-MFC-AGG-ID: nqDrCHUZM-m0W3A234Zb3w_1749210687
Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4517abcba41so11529195e9.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:51:27 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210686; x=1749815486;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=HBNIv4v4CDaVQ8ZIjf4kNfpcVgMGwx5JzlOzvqm3Fu4=;
b=wVY1Nx6tkIT/BhfIWN65rFvsB6txLNL9LLjfAip6KfKpT0kajz8qCZd7tZmmokITOZ
IWETkpvkHoqkUDm+mxoCmZVlEYOmCxEvohO4jAGsPzpMwsUTjUNbPZtoaVSzQsFVjD85
aKr6HOthAadQxhnRGZLQB2FhxMWgzDS1aextsKWBcQ7aNniOd/b467bhOyajGIeJtbmZ
52vNj58rvmKHnFT9+9kZ8vwQ2k10kpltvglzIoowem1nAa8MKMRZZMfilmIFOsaJ/HqX
OWNcdG/FzkjKEFrZyYRNYdT5ydoHjjNC1mL0fC9/0Ee7AE3YVOrS0O5BFgmKiWNHYzzx
oj0Q==
X-Forwarded-Encrypted: i=1; AJvYcCW5CmHPoeQMhk7+ojqcEtw8jI1MYbqvzk2kxJLC2hHlRq1PS7J2oM/DVMAG5hcpKJsYhIsF6kpsMGpct3U=@vger.kernel.org
X-Gm-Message-State: AOJu0YyLM9kJee+aSbRuOwexLBZrGCBq+HtpTuy9149EgXZ34wyQXhEx
0jUGUeLdLDSd3FLuKlQ1J4V39/kfPR5JbnInvSzf10/Ei7qWK5DAyvtJTe1Q1XIeYuzX8qLEDua
onwqenESS2bPrVhj/dJHBWyyIDqs6D8JNAj0TVtroVi40GNhPgMDXGB8XtyZAoBdtiA==
X-Gm-Gg: ASbGncsbZLK8D1n9ujSKE1Wvn6IHzvT/P+8GghZ0kgaA7zNtC72HdvPx3rrdFv6YnF2
SIvdU/cH+nhx2YZYbfllw0pYiSbdNDcBsEdfzavGK4AcyEoFsvIinIhCW1nzuZLULKgat92Xhys
luOmru5iwrhR7i02mWFjeQv7cq9HbBm7Qhx9U3837IFrqM1qZwtxAEugUx1MPtP+TuhKEDCbwkm
q0aVOlTli9y+q/xA2zDUzNbJPrr344HNuWLFTOC0TynZ6GBZitlP83C+e3Zl9ytg98uyuZ6cGo/
Qcembk2JsvHgAW6kd6R5mGrYh/SejFsSRSxJxZhhOCxAlnj+6mJ/HxWv7R2zPHZz5MpJJQgwDr4
EQPUZW4LVDLrYldq8+xChVZIoLFxIQlE=
X-Received: by 2002:a05:600c:5396:b0:441:b3eb:570a with SMTP id 5b1f17b1804b1-452013681efmr36330185e9.2.1749210686523;
Fri, 06 Jun 2025 04:51:26 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IElH7bwO57ALfHi1SkLqsprEBH0fmkDmJSbPoYUAVfRjcV047e6NdMnUnc45QEilr6SuOtg9w==
X-Received: by 2002:a05:600c:5396:b0:441:b3eb:570a with SMTP id 5b1f17b1804b1-452013681efmr36329955e9.2.1749210686142;
Fri, 06 Jun 2025 04:51:26 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243664fsm1672259f8f.65.2025.06.06.04.51.25
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:51:25 -0700 (PDT)
Message-ID: <3a6f0f37-f4a9-46c0-bc3f-5c6dbf4a765d@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:51:24 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 06/10] drivers,cxl: Use node-notifier instead of
memory-notifier
To: Oscar Salvador <osalvador@xxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<20250605142305.244465-7-osalvador@xxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250605142305.244465-7-osalvador@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 05.06.25 16:22, Oscar Salvador wrote:
> memory-tier is only concerned when a numa node changes its memory state,
> specifically when a numa node with memory comes into play for the first
> time, because it needs to get its performance attributes to build a proper
> demotion chain.
> So stop using the memory notifier and use the new numa node notifer
> instead.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>
> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> drivers/cxl/core/region.c | 16 ++++++++--------
> drivers/cxl/cxl.h | 4 ++--
> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index c3f4dc244df7..a8477a3e175c 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2432,12 +2432,12 @@ static int cxl_region_perf_attrs_callback(struct notifier_block *nb,
> unsigned long action, void *arg)
> {
> struct cxl_region *cxlr = container_of(nb, struct cxl_region,
> - memory_notifier);
> - struct memory_notify *mnb = arg;
> - int nid = mnb->status_change_nid;
> + node_notifier);
> + struct node_notify *mnb = arg;
> + int nid = mnb->nid;
> int region_nid;
>
> - if (nid == NUMA_NO_NODE || action != MEM_ONLINE)
> + if (nid == NUMA_NO_NODE || action != NODE_ADDED_FIRST_MEMORY)


Dito, one would expect "nid == NUMA_NO_NODE" to never even happen here.

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675683-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AAC0141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:52:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id B288F3B16F3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BCDD28852D;
Fri, 6 Jun 2025 11:51:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NJfmA3EW"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 CCE9C287507
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210702; cv=none; b=ZSUo1EKKXT5bBO+J9Q7bfas3TBErvXU35k+B/hfHDUlW2v+82kn+9CwaiMKDq+LQZoqhktZNpUo+BEopxngXzNbsvxRsp4gN9lkLB+QDTubov/MzRUWbuhjUfAGmUSdq55abtAWI0XUGcw1pVXGW3DPQ4y6mRZdOP7hgfsBMSUQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210702; c=relaxed/simple;
bh=d+1peOpzhF896/8kkhDB2QAnaqXIePKAVigDiqRx/AE=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=Txund6JXwmDc3AYU8Nc1z4/MZK5uzZwBfNkdLpUJDGJE6k0V0eQauCeh32IhHOy+5ok1fS8/10PIpRrUKd1sWYycT0UUkn1DMsNaOj3PamScb7+vydkHaOsaBb44sC5uNLha5keOAor7rtbRukZ43y9Bo3MI8UohLW5YLPrF9P8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NJfmA3EW; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210700;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=YuDqZfBW806rEHMVFjcdFO+ADelk/lfDf5CqIzU3/HY=;
b=NJfmA3EW0YNU9UoURU/FXYGPxA4GQVDfpWaAa6u72RyAuHuJW1kVAMVa5j8SAAmvJ1PiEo
/RW7o7BpuCJxIJQueOghSpQWkKLe1YbUUw2IEpA3/m94uOG43P1+9HleRZWGehxyLj7nbs
LY6dgdz+8Ma1ga87vxsr7nJKHgB2LDw=
Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com
[209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-557-RtdFvd2BNkqaPlpE0QRteg-1; Fri, 06 Jun 2025 07:51:39 -0400
X-MC-Unique: RtdFvd2BNkqaPlpE0QRteg-1
X-Mimecast-MFC-AGG-ID: RtdFvd2BNkqaPlpE0QRteg_1749210698
Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-441c122fa56so10173585e9.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:51:38 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210698; x=1749815498;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=YuDqZfBW806rEHMVFjcdFO+ADelk/lfDf5CqIzU3/HY=;
b=gxC9D9WE/XbMRIwY0nOL3fPMTnNwhyHu78hpMT7O6S5jE4kP15ZkJNJBDDIapx2LSF
vsaYrEiPiLqKyP8Rx0z1YELOUPszV9rQzStFC/m0QLMC/qWbznfDElKWGKRGcKJEuHES
N0uW5fHqSPNWANw2uWWplabbMR3m1L73o2usH3opSDrRAOpW4Ug5VmKQaQsX0Lrpl8wa
Dp/RUUQXBQvJjSo6uGDU3obn03hlxni7eSab0J5EJCXE/mYCkCs5qoiSr8wL/CEuKo/E
O9el2oDRgfJNRZP2Bo5NtUgMy+bnYAF2Md2RdecX6H3m3XhKjWQuU9W3XVmqgxPJ9i4y
YvlA==
X-Forwarded-Encrypted: i=1; AJvYcCU2Xk0gNlRtBU3mWceHVUOAUqREuVvwebHW+Cq0iav5M0BCuveYxi+i0phWlykzEuQq00PMuVc5tEzZdEA=@vger.kernel.org
X-Gm-Message-State: AOJu0YyHK+hm7LYFPvGV3Af5KfQq7yHpUEGNmsgMod/IsndWw5fz5eUH
w5ZWuBRJHNbnjheHHCQPyu2NQOuGLZrP3h9c9sHu/KGvDroS3mRh6sHSSyCWAdcAaYt9aa6+2kW
sbEJPxozvQim4jUw8YUdJEsmiMOt9Qvh56arJG1BecKsT/KB37thPTwDNNk9qjuTPyA==
X-Gm-Gg: ASbGncssnb95luWUcVstpheWTQ66K6VH9OkBP8krsmtjHo/X72npf5Q3W9oLgorEYTs
VcgPcrZQ0HFvHtBnWLmkubs2uoM6HWcyjj8xDe6fYZvMwunIspDQymJIDWVcODKqUnujm7hpdfv
9VWdSSpc7G9l/ZrSOC2qNjwQnsNAqBTUp8VVfJVYGnUihK21ZSt9LWDie12WtxHoJ2/pq8tiPUt
PP0592D/1VquY8IBU3IxfFGpfVzOVGX2i7cShS903ATR0F9yMeDMtb5NBgXVEz7EZLksmnJwA9o
aY9niaIVXdF2UcxkGrgem9gqZ4e75FcyyZDeXP5QesIJIVYf1UwINHORT+9eurLYpb5pdAo430n
IB4Y3c7KmaEw9Rs83nkULON1Wrr+cwds=
X-Received: by 2002:a05:600c:1e09:b0:442:e9eb:cb9e with SMTP id 5b1f17b1804b1-452013d1ac1mr31336575e9.26.1749210697803;
Fri, 06 Jun 2025 04:51:37 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IFTutIf5S/5ExePoSx/Td85W93qsFuXMvMZErKLOVTEWcRei1bg1QE+/+NPv+XEexChA/X33g==
X-Received: by 2002:a05:600c:1e09:b0:442:e9eb:cb9e with SMTP id 5b1f17b1804b1-452013d1ac1mr31336315e9.26.1749210697345;
Fri, 06 Jun 2025 04:51:37 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-451f8311ae6sm30797975e9.2.2025.06.06.04.51.35
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:51:36 -0700 (PDT)
Message-ID: <3051c206-9a1c-47b9-a5c4-18010abf070a@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:51:35 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 07/10] drivers,hmat: Use node-notifier instead of
memory-notifier
To: Oscar Salvador <osalvador@xxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<20250605142305.244465-8-osalvador@xxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250605142305.244465-8-osalvador@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 05.06.25 16:22, Oscar Salvador wrote:
> hmat driver is only concerned when a numa node changes its memory state,
> specifically when a numa node with memory comes into play for the first
> time, because it will register the memory_targets belonging to that numa
> node.
> So stop using the memory notifier and use the new numa node notifer
> instead.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>
> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> drivers/acpi/numa/hmat.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
> index 9d9052258e92..fe626e969fdc 100644
> --- a/drivers/acpi/numa/hmat.c
> +++ b/drivers/acpi/numa/hmat.c
> @@ -962,10 +962,10 @@ static int hmat_callback(struct notifier_block *self,
> unsigned long action, void *arg)
> {
> struct memory_target *target;
> - struct memory_notify *mnb = arg;
> - int pxm, nid = mnb->status_change_nid;
> + struct node_notify *nb = arg;
> + int pxm, nid = nb->nid;
>
> - if (nid == NUMA_NO_NODE || action != MEM_ONLINE)
> + if (nid == NUMA_NO_NODE || action != NODE_ADDED_FIRST_MEMORY)

Same comment :)

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675684-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 89A8C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:53:03 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 0540C189C987
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:53:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BCD58288503;
Fri, 6 Jun 2025 11:52:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="al+zkC5X"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 6C9052874E1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:52:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210771; cv=none; b=K9kD2qN3SOI64Af0m4FtJ3EpmBbzECCTIsxiZphCOpcd9pvWmhp4o4/hHLYCFQTfxtpec1T09zvEgmZvzfq/ozVmE7bp/5/bH+J/Hg8qL7Q1+6fYQDTCtBJ3ymNWGKB55FswN52WMokocjf2fRjohKOftRuaGGnhJt2GABMavWA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210771; c=relaxed/simple;
bh=NMi3bOMFzSpf51wIBgElg5vr2yGTA7xWJIt8f+igTtY=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=MjFgBJWVUv1BUjap2m1y5douFAQ+TcsgK9VQ+6y9WHiOyKuaeY/aG+5tKYLxhKNyS2h56+qX7HJRpso8Gcjrsu9yz7LBvvTR57eqK1xx0gGfHm3BIr0EO0atns/BPg0zg3Fma7UDh9QwuhRfIfjb7hw3i+q4MD6xwFy7Gyk9qsI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=al+zkC5X; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210769;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=z+FEbX3L9HmrbUYpED1MkPniL68fqNN+10/AKObI0A4=;
b=al+zkC5XnDfL1ZU6sHKVqI8u7GVNWNZsHXGl3sma/YR3qZUlBMmXYb7zS3Wn6PAFJXzuV7
7oWW9RcykuZeuTftzzRyzdxZwXmqXTZwMxgipOHz1EmZSh0AxO79cb1vMQszlFmodMO79p
tLCacHQ7oKUAti+qfqDoh0UeQHWIAMc=
Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com
[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-576-gizkj0TCO0e5MMhS8DyuZQ-1; Fri, 06 Jun 2025 07:52:48 -0400
X-MC-Unique: gizkj0TCO0e5MMhS8DyuZQ-1
X-Mimecast-MFC-AGG-ID: gizkj0TCO0e5MMhS8DyuZQ_1749210767
Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-450d9f96f61so14335725e9.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:52:47 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210767; x=1749815567;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=z+FEbX3L9HmrbUYpED1MkPniL68fqNN+10/AKObI0A4=;
b=xGzD9JLC2RebagHHabTSiEaNzoLMZsewfCfsLfWcG/xmXSvbVpSLR8W9M1McelHK/e
4/PL9UefGrEkxukaZbV1HM7pde38mkIsbdpnrMzZJtGi5WDa6IXo/gDODt3xlOnx58Hj
a8nQBEbuHvSbjphTo4yeqnP0EFO566X80cA55FZdzV1U3RBKvWXXiGcGnBjHB0v6JRzG
7gpLTQodoKD3SIjm9L4jhkp4QbR5VEXhkkBVgDds6lT7f6HE3GgM13HQsISAM5vGCeIX
NCVC/6GDbpxxeWy1Lmend/3Jp8Ua/2ZV8i3g7vmL4zgisOPgp7xgtZSHyDSnBJ21HXEJ
Z1uA==
X-Forwarded-Encrypted: i=1; AJvYcCX0PERK2jP8zwxgGF9QB7m7zYsDVtnRUVL5DWkG/C4W6qgm3u6gR4Q50Fjvnrx0IQ18ktkXbnwetEbhQjw=@vger.kernel.org
X-Gm-Message-State: AOJu0Yw2BgvevkOCEJ0lHY1g4xZ3tWMa2/VTHW5YoVKv+JuZ+dCqbAKA
UMU4mczM3dpLdRpmRzYx7/cwSEMWItM4WdGBBz7SZ4ed0AoEMCyq/ZC1fFQ7fPKmn/nk6PLYOub
BYMMJ0riKQtz0mAs/5C+36yLGs5rRuDBT+UdiMjzO/9dPvt4ZWX7EiHi3daqRm9ZmKA==
X-Gm-Gg: ASbGncvV9lTpPsWiV36u3bm03lWReKRsH5R0j1lSLijtb0JiO9iz9oafn7hcBEZg1Ea
oN9DWjG5r5ixtnDwY7TvwLcTe9ISJBQtnTL6R7Mxr5uIhKNaz8vBMKqumIv6gXxsrhcUoM6nTbj
ptk2KJqx0c3VJT7V6LICcbfeFP3DIOn/9//wp1hoK1lbSwTruiHwhax07hQKS8DiF99vpNcGXwk
X/YBzWEvYcWkdCzv6y4iarCMPKa3bXbv55omVe8vxLvKnCEi3XlFgEG1w5aDGYAH1s/sS2wN7To
F2H4iKe6ScqvsdelO5Fk6La0X4/uy4jVhYqqQfS6tpp4tCQEEYlzR+cwYmwbnMjMJ3kr4YGGXZd
5aBcAULX0Rx2NifK/nnVMBsuRTNmhbuc=
X-Received: by 2002:a05:600c:4e0a:b0:450:d614:cb with SMTP id 5b1f17b1804b1-4520143085emr30492575e9.33.1749210766853;
Fri, 06 Jun 2025 04:52:46 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IGebp748ZUJlgbYSDwhtX4XrCnpmqEcIzPAJIqqCkpY9vlhyhbH+iXq1p9Qo3rMj0g75gatzg==
X-Received: by 2002:a05:600c:4e0a:b0:450:d614:cb with SMTP id 5b1f17b1804b1-4520143085emr30492375e9.33.1749210766490;
Fri, 06 Jun 2025 04:52:46 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243664fsm1675690f8f.65.2025.06.06.04.52.45
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:52:46 -0700 (PDT)
Message-ID: <7375c9c2-42f4-4c90-ba16-a365857d91d0@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:52:45 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 08/10] kernel,cpuset: Use node-notifier instead of
memory-notifier
To: Oscar Salvador <osalvador@xxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<20250605142305.244465-9-osalvador@xxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250605142305.244465-9-osalvador@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 05.06.25 16:22, Oscar Salvador wrote:
> cpuset is only concerned when a numa node changes its memory state,
> as it needs to know the current numa nodes with memory to keep
> an updated mems_allowed mask.
> So stop using the memory notifier and use the new numa node notifer
> instead.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>
> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> kernel/cgroup/cpuset.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 83639a12883d..66c84024f217 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -4013,7 +4013,7 @@ void __init cpuset_init_smp(void)
> cpumask_copy(top_cpuset.effective_cpus, cpu_active_mask);
> top_cpuset.effective_mems = node_states[N_MEMORY];
>
> - hotplug_memory_notifier(cpuset_track_online_nodes, CPUSET_CALLBACK_PRI);
> + hotplug_node_notifier(cpuset_track_online_nodes, CPUSET_CALLBACK_PRI);

Interestingly, cpuset_track_online_nodes() is only concerned about
"after node_states[N_MEMORY] change", so maybe we could filter out more
events .. maybe.

Acked-by: David Hildenbrand <david@xxxxxxxxxx>

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675685-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1864D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:54:29 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5EB13171F60
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:54:30 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C1D72882A7;
Fri, 6 Jun 2025 11:54:23 +0000 (UTC)
Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72])
(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 4F0812066CE
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:54:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210863; cv=none; b=SreMUCJDH120QXCELOgWDzrr9YnKKwQmRY9oxKGob6Zp6IlB7yNj+zeMhYBvAFY6UuAC/4hZmD/Nd4xj7p6CoEOYMZPzqtmBfotrGbkQpfbYviOsQ6NvOZCKstg0y61zMt4jG+vkCNAoUqc27689DkAKoeNDY7UTRMRjIbeCU+4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210863; c=relaxed/simple;
bh=ChtDO3u8d8l/AZ1USO96CeBoGpsIpmVf0sP47OUi4xw=;
h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=LSQLGCz4kfEYe3SvyaWl+ug9C/5Ge7m55b9xYahv/JL7vn+zwJseuutP4FA4JUmNkRkDRenVXk2jMR1qNUKxz2k6qu8XlfPj/DtNRuY5myB0Lf+ZeNUTwZRAbVtmctasVHzAqP4nN5tg22OypbKqlH1G42PfRIm3AIFfQfJAIDU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp
Received: from www262.sakura.ne.jp (localhost [127.0.0.1])
by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 556AwOM2029303;
Fri, 6 Jun 2025 19:58:24 +0900 (JST)
(envelope-from penguin-kernel@xxxxxxxxxxxxxxxxxxx)
Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33])
(authenticated bits=0)
by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 556AwNja029300
(version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO);
Fri, 6 Jun 2025 19:58:24 +0900 (JST)
(envelope-from penguin-kernel@xxxxxxxxxxxxxxxxxxx)
Message-ID: <5eb6db5b-a133-4084-9f67-cc971911ca01@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 19:58:21 +0900
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>
From: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Subject: [GIT PULL] tomoyo update for v6.16-rc1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Anti-Virus-Server: fsav301.rs.sakura.ne.jp
X-Virus-Status: clean
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The following changes since commit e9ddb37834eb93b9840ac9aa93a36d70f27c3e32:

tomoyo: update mailing lists (2025-05-05 22:55:53 +0900)

are available in the Git repository at:

git://git.code.sf.net/p/tomoyo/tomoyo.git tags/tomoyo-pr-20250606

for you to fetch changes up to e9ddb37834eb93b9840ac9aa93a36d70f27c3e32:

tomoyo: update mailing lists (2025-05-05 22:55:53 +0900)

----------------------------------------------------------------
Update mailing list address.

Tetsuo Handa (1):
tomoyo: update mailing lists

MAINTAINERS | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)


Return-Path: <linux-kernel+bounces-675686-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F27AC41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:56:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2CA7E170266
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:56:20 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D4AF92882AC;
Fri, 6 Jun 2025 11:56:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="WhJRf80Q"
Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 266DB2066CE
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:56:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210972; cv=none; b=NVk9n06sxzrnsPph/lmbgvqswhlOQc9bD7c9i749VrOqxr8mt1hNX9QesLoN7BqiK7dqwy1y9tT8r//Ir5HSdEVbSCfaqZrkPvAwjbu7dj1wJWWKJayx/sgjFJMrzR22xe+lf8SRVgjJ/kAViuW0VYy9ukIXVMlPQdeliRfN0tw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210972; c=relaxed/simple;
bh=97gi24Zn3+1lmmSWNJJxlpQ5WFMV529j2o7D4xQxhWs=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=m2ULLKRbIxepKvb04Z+IqEmVgSQe/jRIWgYc9hNHRYy9wuMSBD3isBxtcq+XmQljhvKVczTe3GHWfecTSd1wsWfFqN+TM1UA33ER8eOZTA1x2zmBl4tU3ajnr+Dt9ltzxsHiGMc8OzrfhRP1TCieEzsU9LlkFX05JgDu6aFE+KQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=WhJRf80Q; arc=none smtp.client-ip=209.85.128.44
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com
Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-451d3f72391so26424015e9.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:56:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=suse.com; s=google; t=1749210967; x=1749815767; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=Hzp2EzU3gEy1DigZCn3AIvJRWQwen9LjZvTJe0DHtqE=;
b=WhJRf80QtcNcgacONGVVyQ+KvqEKQeSASgM79MONiMEGAsg276ZYJX9XHA25dlncUu
oaXKEes1pmr/wLRbaJ1sYr2eOovWYosWbZPMDMqjC3IF4RBOqRHzTb/CeZ9QlL57CqSI
iR3rm4bxnDkD1yH3BlgkE8V8zUKt/ni/bV/+jKq903u6nlX69TuyUO8TQ9U8hc2klWMI
S1hhT5LHvDAqgvyNeVSVXMMDb12TLyxFCEHHGt3OPshEa9sfBgU9lzdSNscqPD8s/s/O
SgGhMNSdXumbHqlbOByYQL1yfwzS+RSaCUEircbBAkyd13GjNbfjJYjp00R7A/wFRvDE
sQBg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210967; x=1749815767;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=Hzp2EzU3gEy1DigZCn3AIvJRWQwen9LjZvTJe0DHtqE=;
b=F4x2RpjNnr7eKhy3TJ8lAi+h3CKTM7dtKPwSylli5XkbrIcOBU7O7pdG0J+v0xp8zu
XQOpFJNRz238Qv0uy70AfxIkjmL4Xd3h+fmZum1gb8wy9iMV2BV6mKLl4C7pT8xaPliK
S0iShz3GB58WCsYWwIBVXrLkJVB45eDFm4Bi5oY2IggBb/an+iNRXrN5KZdnLfALPUV/
Pq/6oJ5WBcf/fvIyoPN7Hf2TroCA4HCe75/nV79sqAzD5/wWpiU2Bd+CuQRhJcniATZJ
CVddUuijWwF2SMo1m4mRsS43eyQnKgPex20hOxDTYkYxdHmsnbpEmTvo3/jJ0Rnw5Evp
rYpg==
X-Forwarded-Encrypted: i=1; AJvYcCWhkLt+JV6u/OpvQJloOAzn1dV2jGVFZcJjT/kxraGHIFFCNf2ERxr/hbqUCnxfB4OlC1AGu4ufoOA+e1I=@vger.kernel.org
X-Gm-Message-State: AOJu0YzHBfxbXB+J9Yr3E1QLl9v6vFafzryMqZEgRRkhYfvFjyz+MvvC
TLouB8B/rnuPkmIkpAme6u8bieW9LweExNRT8sbHurc5phaodhM3wPiWPoRlpSYdsNuqI/KDoxy
Bp2zk
X-Gm-Gg: ASbGncsW+Cm9I2jqvy/y1z78SW7M9oRBnclAwm+tA3DKaOeRcklahxC8D3k4nrueXts
23thQEwa0xljYsGJivuiLNqU7S1vlCahiDdgKjZKxG2lwYXuUulqsjJr7dAPgGyKRIWcoBV8gSK
H2zgo9Zw+diWMfWY/l0igcsJ/Pm8liDS6FqJp7SIpbcFCqxKw5k6h68sXcv0XPuEO9NuLgg6h1s
y3nKEeYFmsyDDlnJriNI5ONCh61DDNtVlzQMeUVY4rIdxx0HfPesyGcIRwP7sLB2Q/TyUPpUcNK
EbrfHqWsBLrGSmXkEeSGJWH5VZuKni2Hh+f2E6YrUD3DLHAWrD+2qZND7BPr2zNL
X-Google-Smtp-Source: AGHT+IHmoBwJARYFAtkilUp66ubm3Hag5fYQtpJOq/ChI1R63I9vNBKNTT4cU516skYBOn5oOv2jxw==
X-Received: by 2002:a05:6000:2dc7:b0:3a3:71cb:f0bd with SMTP id ffacd0b85a97d-3a53188de8bmr2618588f8f.23.1749210967198;
Fri, 06 Jun 2025 04:56:07 -0700 (PDT)
Received: from localhost (109-81-91-107.rct.o2.cz. [109.81.91.107])
by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a5323a8c79sm1648209f8f.27.2025.06.06.04.56.06
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 04:56:06 -0700 (PDT)
Date: Fri, 6 Jun 2025 13:56:05 +0200
From: Michal Hocko <mhocko@xxxxxxxx>
To: David Hildenbrand <david@xxxxxxxxxx>
Cc: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Jason Gunthorpe <jgg@xxxxxxxx>, John Hubbard <jhubbard@xxxxxxxxxx>,
Peter Xu <peterx@xxxxxxxxxx>
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
Message-ID: <aELXVYKyampfvul0@tiehlicka>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
<50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
<e5fa4a36-2af8-48e9-811e-680881c06b86@xxxxxxxxxx>
<1a7513cf-4a0a-4e58-b20d-31c1370b760f@lucifer.local>
<fe31e754-159d-49fd-aac7-64af5e313884@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <fe31e754-159d-49fd-aac7-64af5e313884@xxxxxxxxxx>
X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri 06-06-25 13:44:12, David Hildenbrand wrote:
> On 06.06.25 13:04, Lorenzo Stoakes wrote:
> > On Fri, Jun 06, 2025 at 12:28:28PM +0200, David Hildenbrand wrote:
> > > On 06.06.25 12:19, Lorenzo Stoakes wrote:
> > > > On Fri, Jun 06, 2025 at 12:13:27PM +0200, Michal Hocko wrote:
> > > > > On Fri 06-06-25 11:01:18, David Hildenbrand wrote:
> > > > > > On 06.06.25 10:31, Michal Hocko wrote:
> > > > > [...]
> > > > > > > Turning them into VM_WARN_ON
> > > > > > > should be reasonably safe as they are not enabled in production
> > > > > > > environment anyway so we cannot really rely on those. Having them in
> > > > > > > WARN form would be still useful for debugging and those that really need
> > > > > > > a crash dump while debugging can achieve the same result.
> > > > > >
> > > > > > One question is if we should be VM_WARN_ON vs. VM_WARN_ON_ONCE ...
> > > > >
> > > > > *WARN_ONCE ha a very limited use from code paths which are generally
> > > > > shared by many callers. You just see one and then nothing. Some time ago
> > > > > we have discussed an option to have _ONCE per call trace but I haven't
> > > > > see any follow up.
> > > > >
> > > > > Anyway starting without _ONCE seems like safer option because we are not
> > > > > losing potentially useful debugging information. Afterall this is
> > > > > debugging only thing. But no strong position on my side.
> > > > >
> > > > > > VM_BUG_ON is essentially a "once" thing so far, but then, we don't continue
> > > > > > ... so probably most should be _ONCE.
> > > > > >
> > > > > > >
> > > > > > > So while I agree that many of them could be dropped or made more clear
> > > > > > > those could be dealt with after a mass move. An advantage of this would
> > > > > > > be that we can drop VM_BUG_ON* and stop new instances from being added.
> > > > > >
> > > > > > As a first step we could probably just #define them to go to the
> > > > > > VM_WARN_ON_* variants and see what happens.
> > > > >
> > > > > You meand VM_BUG_ON expand to VM_WARN_ON by default?
> > > >
> > > > Sorry to interject in the conversation, but to boldly throw my two English pence
> > > > into the mix:
> > > >
> > > > As the "king of churn" (TM) you'll not be surprised to hear that I'm in favour
> > > > of us just doing a big patch and convert all VM_BUG_ON() -> VM_WARN_ON_ONCE()
> > > > and remove VM_BUG_ON*().
> > > >
> > > > Pull the band-aid off... I think better than a #define if this indeed what you
> > > > meant David.
> > > >
> > > > But of course, you'd expect me to have this opinion ;)
> > >
> > > See my reply to Michal regarding keeping VM_BUG_ON() until we actually
> > > decided what the right cleanup is.
> >
> > Sure, but to me the concept of VM_BUG_ON() is surely fundamentally broken - if
> > BUG_ON() means 'stop everything we're going to corrupt' then it makes no sense
> > to add a '...but only if CONFIG_DEBUG_VM is set' in there.
> >
> > So to me the only assessment needed is 'do we want to warn on this or not?'.
>
> Well, when done carefully, it would be when reworking a VM_BUG_ON:
>
> (a) Should this really only be checked with DEBUG_VM or should this
> actually be a WARN_ON_ONCE() + recovery
> (b) Does this check even still make sense in current code, or were we
> just extra careful initially.
> (c) Do we even understand why it is checked or should we add a comment.
> (d) Should we use one of the _PAGE / _FOLIO / _VMA etc. variants instead
> or even add new ones.

This is surelly a very responsible approach and I salute to that. But
then the reality hits...

> One could argue that the same is true for any other VM_WARN_ON ... but my
> point from the beginning was that if we're already touching them, why not
> spend some extra time and do it properly ..
>
> ... but yeah, 600 instances are a bit much.

... exactly this. And I believe that the same could be achieved post
factum while having the ugly VM_BUG on gone.

> So agreed, let's move forward with a simple conversion.

Good call IMHO.

[...]
> > Am happy to come up with the churn-meister version of this patch and take the
> > heat :P
>
> I assume with "this patch" you mean "a patch that gets rid of VM_BUG_ON
> completely", because I want this patch here (that started the discussion) to
> go in first.

Yes this makes sense.

> Fascinating how you are always looking for work :P

Thanks to both of you!
--
Michal Hocko
SUSE Labs


Return-Path: <linux-kernel+bounces-675687-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C909041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:56:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1324C171CCC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:56:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B58792882B6;
Fri, 6 Jun 2025 11:56:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fEYiXl2l"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 4BEC12066CE
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:56:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749210981; cv=none; b=EgzkSMgfyW/RZr9BKyzBKHjUyR8ZaF8uaIHWWVPInDm7NERaSyRdp35LQgKEK/Tl2jnZsIMD4o4cIX/lmbz7FAnm1N8q+VaxF3Dpsuo0yZBRLeVketNeEZQXdS4IFynnLZ95R04Sgkg5uzigucJQJknQzPcEgadfwjbGIIYhM60=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749210981; c=relaxed/simple;
bh=0u1y4/eFFJ3O0SjLhhxAK1pWG7i/G53qUJV7Hgw4o2A=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=DXJCjgIuUGnG7FXJCK1/AZ5BBtCsrLKSsBOdxBWIuO2j8T2j1SaLldGhYskLIgA2a/umYwBdFVdz5hk45AxDvhFowS2MCJ0uH1O2F9pfuuj4G6gHBj4xAYXGKwNkGi5m6hOVSkZBzXlGSQJwpTjjWIt5A/AEBEieJerKmKKzJcw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fEYiXl2l; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749210979;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=v/9NNy4TMyU9eeIJpLVXjlAQECKJ+eaM7O94WJTzoyU=;
b=fEYiXl2lvPgtPc/I+NHMHzEbv+k0Mfak+EUTliOINzbUQNgJlywGf+gPIaxPlmLbAnvEQN
6ZPOaTvWgWbdk4zdxNfMnJGm1Rux6lGmOgKcJAJHAh5CZ10sY3cGnExW1f6bGI4IMGz2bV
NzoEd33Mrtz8g66wj9eU0WJ+wlpoNQQ=
Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com
[209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-180-7Pgxbzq2Ohuir0zE4FyorQ-1; Fri, 06 Jun 2025 07:56:18 -0400
X-MC-Unique: 7Pgxbzq2Ohuir0zE4FyorQ-1
X-Mimecast-MFC-AGG-ID: 7Pgxbzq2Ohuir0zE4FyorQ_1749210977
Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3a4f6ba526eso1282024f8f.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 04:56:18 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749210977; x=1749815777;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=v/9NNy4TMyU9eeIJpLVXjlAQECKJ+eaM7O94WJTzoyU=;
b=lct0haUJhhRmoP3LJx119XoN/a074pNbztwH/C/kJ13WFmRhDvUDEf7vzwcDt7y7mv
GtDNEFdxg/3n1B9yJ2vZZUvxiq/9EIBnr98llwV5fgpXpUgBKHrtNnV90LdgFvDpt97l
RV6lyA4Rf6Zk25mW9stf/OpLrL1l3CvnKeVp3TDcNOlDFDIPUO4KioDTA02m6xD1VRbi
dhiy2ZV5CTp1uLMAAjw2PK0+6aysiltGVALtgeTI5OPTpajw8DwD8I0mmym34+ohEPaG
KbxkQlp3riieOyZvzzJlaP2Gf7IYj1zmY6Nuk/8D82L+5+mesoAqC1Ts0xX7oTl5NS4D
5MRg==
X-Forwarded-Encrypted: i=1; AJvYcCW94yk9HymPKC9piv+TJf5zbT1GKNu4XWRMDs2EWZTTYfozJyV5/nIBodWsCQd4YzYAVlvnc3RqddS5OdM=@vger.kernel.org
X-Gm-Message-State: AOJu0YxMWzPIxd8E0J6S6DcyamLsFYnXDTY3IImmPab+m6SBMhg83ryr
/AFxBDPuBUp3Vo8/+ySLKTbmTUvCUQT+f7FsJZ10Nwb2tO8DKbs/yZd7Diy+QUKyd/D2j4jgrVI
7ltToflv+puGOMCy+vYNE94CrVSwE82a5MC+DEJ+TdAvxdFlSoNdbp8MPUT1BB9yPkA==
X-Gm-Gg: ASbGncvE9aZSm2vmdU4JjY+HHhowge+qr2wL0Pd8dwLTJWCTUYkMsqqhpATV28312r8
//2dUbCtxSvm5uqbi+sHdvuHZBVxVDUE1Orov6JgTJ/VjbIxxXExDSkkFXZrCI9U/7VIvH+LLFe
Ba+HnPpAACucHH402eaC0FZp0rLFzyq9YalZhgA7qHiHWsmrdtf8zUJizyIzUpKTrwZKv3gLvXy
wEE8xGDNUrYz+UW0UK7QFXRtYpL6uPwkUesq9RjtOKiHXGOeOhKMpXAq/wvuoe3euhXvWykh8pm
K/Li/QbM+5ByyCoceeJEoJQm8qBPxOu40LhxopbwClFWZe8Hr0mgLfSXyDBFm+w/8X3m3T8YL/f
CnFDfRjGugdCH5WB0sMtF+ds9dd4e4kU=
X-Received: by 2002:a05:6000:4284:b0:3a4:d8f8:fba7 with SMTP id ffacd0b85a97d-3a5318822a4mr2440246f8f.2.1749210977101;
Fri, 06 Jun 2025 04:56:17 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IH81pzwafZsjxj1UMHZCDZeA5pir+zKKSl7ua6ZL1jSF8b76n0i40RaUs/z/QtsMw38UkmCOA==
X-Received: by 2002:a05:6000:4284:b0:3a4:d8f8:fba7 with SMTP id ffacd0b85a97d-3a5318822a4mr2440224f8f.2.1749210976743;
Fri, 06 Jun 2025 04:56:16 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5323a8acasm1641373f8f.26.2025.06.06.04.56.15
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:56:16 -0700 (PDT)
Message-ID: <0ca963af-8dc9-4cb4-9142-04497c359b81@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:56:15 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 04/10] mm,slub: Use node-notifier instead of
memory-notifier
To: Oscar Salvador <osalvador@xxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<20250605142305.244465-5-osalvador@xxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250605142305.244465-5-osalvador@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 05.06.25 16:22, Oscar Salvador wrote:
> slub is only concerned when a numa node changes its memory state,
> so stop using the memory notifier and use the new numa node notifer
> instead.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>
> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> mm/slub.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index f92b43d36adc..b8b5b81bfd1a 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -6164,8 +6164,8 @@ static int slab_mem_going_online_callback(void *arg)
> {
> struct kmem_cache_node *n;
> struct kmem_cache *s;
> - struct memory_notify *marg = arg;
> - int nid = marg->status_change_nid;
> + struct node_notify *narg = arg;
> + int nid = narg->nid;
> int ret = 0;
>
> /*
> @@ -6217,15 +6217,12 @@ static int slab_memory_callback(struct notifier_block *self,
> int ret = 0;
>
> switch (action) {
> - case MEM_GOING_ONLINE:
> + case NODE_ADDING_FIRST_MEMORY:
> ret = slab_mem_going_online_callback(arg);

In slab_mem_going_online_callback we will cast arg to "struct
memory_notify", no?

Probably needs to get fixed.

... and probably best to pass marg directly.

> break;
> - case MEM_GOING_OFFLINE:
> + case NODE_REMOVING_LAST_MEMORY:
> ret = slab_mem_going_offline_callback(arg);

slab_mem_going_offline_callback() doesn't even look at arg, so likely we
can drop that parameter?


--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675688-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4C11D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:57:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 824E617A1E6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:57:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 00DAD2882DD;
Fri, 6 Jun 2025 11:57:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="dMmpMXM0";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="guoFBF++"
Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155])
(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 611F42066CE;
Fri, 6 Jun 2025 11:57:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211041; cv=none; b=jtJm9g8zAnw/DV5CFOe3Ce759iEGq6yQmbAddCvaKxGp8P8x0loQzOPk6LebPkipubU7nglfmpsg4ItOJ2AJCwoot3YazsHPk0I5bagwn5nbSP6vuMdbG9qpaHK9kg5oe6Bpmo2RR+gHZekKQrcUaCFqX+SOPBJiAB+tteixmwI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211041; c=relaxed/simple;
bh=6SnHxI2JKl16yipLOTOGGoMllM4FJTxy50H3Uci/G/8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=TifDW1Unw2vjlVs1LbGPNDkhupLNPaz4o0qFZSreI+KgRido4w7BPJueAckNSSM18tI9dhGwVXd1eSaLq/hYCtm0HeK2CD6kJMMYcI0eloqjoYNYk3LQY1qMai2xfvIKo093cfqdgUxmbHsYoEITAiifESxiWmlUqjwjh1gouZM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=dMmpMXM0; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=guoFBF++; arc=none smtp.client-ip=202.12.124.155
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44])
by mailfhigh.stl.internal (Postfix) with ESMTP id EC89625400D9;
Fri, 6 Jun 2025 07:57:15 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-04.internal (MEProxy); Fri, 06 Jun 2025 07:57:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749211035;
x=1749297435; bh=mIkTtxOr8QfFxj+OIKJs+Ps3eXERA25AWZDUc/dDVSI=; b=
dMmpMXM09sda4f+A88mkTcZshfigGOcQr775NG/5QoYApY59G4Rtl6pzoVRJruqI
g+xW3zfX2FH3q5UDXPRjFqmEuuMyucFf02sBX0SIQpYwyFB3Hm236gDDTFPi4xTw
156sQyeW1wKJ/qjpuXNdEJdsekcsE9hWQnFBGnuGOALVkh7Twr7HYudHfRa4wI54
vzcT60sm6qCYSc2l2Ahvclgmvf8lMmgbm9pfyezq1ukaHZahpiMFfAw6aU5vgJlQ
x6jN9aoRdcr3wihGWenQ6f7gcO7J4ZiSWebe92FgxOtQxwbxKfaeJrrJc6zUZhkz
CRRK8PaO4ZXQVeo8BoD40Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749211035; x=
1749297435; bh=mIkTtxOr8QfFxj+OIKJs+Ps3eXERA25AWZDUc/dDVSI=; b=g
uoFBF++VmBaBPn8MJrbH/aB18M3Dn6mDjltdMrSbi/NbVY51mT4Y4m9BuN+5HBc4
c+PFpVATuseNLrtFT6zsAvQQUnhgGQ5hQ81nFe4wMGaVD6ISDtz8cJjjxFlkbmjx
Qjk1+cPwNKRxh77dm3C0gpCQMiU9aZURW80b/Rssa9PGBQkGtgq22YS++qARJb2D
4+tzyjOaKQxqn8RnQXMvYSrKzokVsckuY4JoKXIQ1INxwPfwF1/FnkZA1P0+mEnO
ubwzKwgHYx2K/7hpI/I/8cn7CLgLkUJIqSScLMkuItAviIR6a9uBCo+wlmrZHYvc
q7eln88d/E/fRWBaBc68Q==
X-ME-Sender: <xms:m9dCaOJ2aqejU-h8SlCb0CsFtZuLq5R6gUh-_kkpMVX8cdZpNLzDdw>
<xme:m9dCaGLGccsI9NephMHwzKPfQQ70z5ZAMV8XU65V20fL8YceJRAIHeHfEL0gwjxTH
e52JtvLTS-4zOFVHnY>
X-ME-Received: <xmr:m9dCaOvbZa0pmKDeFCFsXTxrXeO8zTT6ALTJsU-02JehiPFIECNxpufl0ZOSctX9_Ue75eq7BKs9AOYarTG02c31VwIojJAoxA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdehucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeevteeg
tddvvdfhtdekgefhfeefheetheekkeegfeejudeiudeuleegtdehkeekteenucevlhhush
htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehnihhklhgrshdrshho
uggvrhhluhhnugesrhgrghhnrghtvggthhdrshgvpdhnsggprhgtphhtthhopeelpdhmoh
guvgepshhmthhpohhuthdprhgtphhtthhopehtohhmihdrvhgrlhhkvghinhgvnhdorhgv
nhgvshgrshesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepmhgthhgvhh
grsgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehl
ihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvh
hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghs
qdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkh
gvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgthhgvhhgr
sgdohhhurgifvghisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlrghurhgvnhhtrd
hpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepjhgr
tghophhordhmohhnughisehiuggvrghsohhnsghorghrugdrtghomh
X-ME-Proxy: <xmx:m9dCaDYxeyPUglb6vz8EPEjZwAXolLfhoDerNSBvFF7ox5c0rYSBJA>
<xmx:m9dCaFY8tjc73AXMFhRnWstejThMa4PD2U7Lsz2JQdSvorWUuKP6gw>
<xmx:m9dCaPCQ-yZm3GBmJsM1rKyMg4ePJGEjK_OgIft3nj_rXs5Z7InM1w>
<xmx:m9dCaLbnMc12IKfrEzV_WB3kjP2BR7yBTQcr1yREu0Cb8qnQGDhd6A>
<xmx:m9dCaGgbiG9iQxQ-1w9NMPxi3l--Q7f2-61lA3NR8fniFn-0XEkhjSjK>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 07:57:15 -0400 (EDT)
Date: Fri, 6 Jun 2025 13:57:12 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 01/15] media: rcar-csi2: Use the pad version of
v4l2_get_link_freq()
Message-ID: <20250606115712.GA2756718@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-1-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-1-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your work.

On 2025-05-30 16:50:30 +0300, Tomi Valkeinen wrote:
> Use the new version of v4l2_get_link_freq() which supports media_pad as
> a parameter.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> ---
> drivers/media/platform/renesas/rcar-csi2.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index 9979de4f6ef1..ddbdde23c122 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -954,6 +954,7 @@ static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps)
> static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
> unsigned int lanes)
> {
> + struct media_pad *remote_pad;
> struct v4l2_subdev *source;
> s64 freq;
> u64 mbps;
> @@ -962,8 +963,9 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
> return -ENODEV;
>
> source = priv->remote;
> + remote_pad = &source->entity.pads[priv->remote_pad];
>
> - freq = v4l2_get_link_freq(source->ctrl_handler, bpp, 2 * lanes);
> + freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
> if (freq < 0) {
> int ret = (int)freq;
>
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675689-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E32C741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:58:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D257178C99
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:58:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 665002882DD;
Fri, 6 Jun 2025 11:58:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="MMw7BfyR";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="K3+TCF/3"
Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155])
(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 88D0C2874F5;
Fri, 6 Jun 2025 11:58:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211127; cv=none; b=A7mSivEmsORm/u9zFsxAMqyYaDyiRPVNwJZh+RSG8Gip1Gq/OgInHiRiPUVZlkXIhI/l2VNl2sVBL2iH1SNs4Zq4uZrCEmaQKpeDCkHg3LL/8GnhedT3xnF1ktP+uUoO3UT6jO+QIDZof3dpSdQur4OvpiNTdd0cCbVQ5ouhKK0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211127; c=relaxed/simple;
bh=Z1dpV55199JgVLJKDh9KRdgp3ZzvqYnyGpUneFrV/4A=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=KrWehDpmmk5A8I7UO2pQRzAAYMCHsuRyMCZ7KwmTPqkb1hqJaWZKMBoZRNK/57aPv9Q0h0KGqaRg9efgXjn3LTQCVxqGdETGXbzOtBqpXs/1fujQ8+CIAoVvwhaJi/foO8mFuw0Qs3BYQCo64q5qnIUGtOYMc4zme92Ns6qugIs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=MMw7BfyR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=K3+TCF/3; arc=none smtp.client-ip=202.12.124.155
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44])
by mailfhigh.stl.internal (Postfix) with ESMTP id 4C6DB25400F8;
Fri, 6 Jun 2025 07:58:44 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-04.internal (MEProxy); Fri, 06 Jun 2025 07:58:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749211124;
x=1749297524; bh=Ywkaob1+268n6S7xuxwr0QBKYG0NurisG9wGzUWJyDY=; b=
MMw7BfyRlYQCfH74yMPbHG/bxHaY8mhbfpPITyQ9X/E0hDo0G5Ua00UGgIigmMIm
ODU503IWobpQ23PtHBoFOqnafp55AVa+Vg17zMNGHMKTZiG3pa1nCVB/hOkVn1Cz
F8pwStuOUH3tFMXrMIzDbgQSveP/OaPTNJNJHR6SiOHcNIx6MBvVyNz4O0cV7anL
pBxVXv4cm4Prkgh7L4cGCEj4WKI4IyOpn87zjfr/z+XdeoNfEydk9kcpoA5S2WhB
2TqETcauo912fbg7Cf97fci0hGh1weQpTiqcMAF5372vuJSyJf00Pqtx8AN7Iz0y
eVs0ng15jjZE63b+8vVANw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749211124; x=
1749297524; bh=Ywkaob1+268n6S7xuxwr0QBKYG0NurisG9wGzUWJyDY=; b=K
3+TCF/3x2gS2dz/6+2XtoaC3Y5vZVErMJVhVFH5k+WXWiDja/SQJ2uLkKDRiKIvh
az1qw4tWYV/hdIvWJCLbDbfMrojSluqtt6AR0F7jWSPfzI+FnCCI0oEq3q7oqGel
+YA9PtWCBC3R2/xwn1x30OSdi+gDkLsYUiU3TB5HeRyk+zePTA9m70QGsYTKnVZX
uptgEhlzlWq2FOQtUEBiMq6FfQVQzLyfbvd+R43UrV40HrM1KwJBSFB1buh1bPAF
/AvoK4LYp+JhD//GUyZc2rUrPMii+i94YXaJC8ZcO3W1KV9IFkWe19A+4l59Pvqy
J+ai1Cxihx3RtVTW9YoHA==
X-ME-Sender: <xms:9NdCaAUavr_xZZ9WJvdU5H0FSLD-5Ut2py8NLbMCGCq2e5nG3qaThQ>
<xme:9NdCaEmu4wky7TYf3FpsqgdJG4Duxjnjuxbn2DcF4EIRGf7Wl8EmJ59cmDAeO3--Z
4xaTC14tXOCs6Y45e0>
X-ME-Received: <xmr:9NdCaEYjM7XjtQ38fBeNw997EMYYsrT4_rn_xn3Ijk49e41B03Z6JdU0-0J5fdlnuJWVOxFAHJwoLeN0fFr_3WE2vFhkFFX2rw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdehucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeevteeg
tddvvdfhtdekgefhfeefheetheekkeegfeejudeiudeuleegtdehkeekteenucevlhhush
htvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehnihhklhgrshdrshho
uggvrhhluhhnugesrhgrghhnrghtvggthhdrshgvpdhnsggprhgtphhtthhopeelpdhmoh
guvgepshhmthhpohhuthdprhgtphhtthhopehtohhmihdrvhgrlhhkvghinhgvnhdorhgv
nhgvshgrshesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepmhgthhgvhh
grsgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehl
ihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvh
hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghs
qdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkh
gvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgthhgvhhgr
sgdohhhurgifvghisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlrghurhgvnhhtrd
hpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepjhgr
tghophhordhmohhnughisehiuggvrghsohhnsghorghrugdrtghomh
X-ME-Proxy: <xmx:9NdCaPVU4pXkcx6sh1d3yKcrDY7yBK2KeI9SC-oW7a0V8li_hpPSeA>
<xmx:9NdCaKkO0i3crsgUioz3ImeWpE6GVRrDrTMiGtOExDr9q9REqDQgkA>
<xmx:9NdCaEewTs62_9rZSoWTqXJwPa5aiPcg0612-2LsCARqK80tQsdXJw>
<xmx:9NdCaMFp8g85Sjr3rVm6DZhE2eSQZEgyVa0b0ovP-V23wMdO7MLJ8g>
<xmx:9NdCaG_IGTZrLx4WzxjQRGzPjGyY15a8dsotTclj-z4AepNRosu6uvRo>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 07:58:43 -0400 (EDT)
Date: Fri, 6 Jun 2025 13:58:42 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 02/15] media: rcar-isp: Improve
ISPPROCMODE_DT_PROC_MODE_VC
Message-ID: <20250606115842.GA2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-2-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-2-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your patch.

On 2025-05-30 16:50:31 +0300, Tomi Valkeinen wrote:
> Instead of having four macros for ISPPROCMODE_DT_PROC_MODE_VC[0123](pm),
> have just one ISPPROCMODE_DT_PROC_MODE_VCn(vc, pm).
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> ---
> drivers/media/platform/renesas/rcar-isp/csisp.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-isp/csisp.c b/drivers/media/platform/renesas/rcar-isp/csisp.c
> index 1eb29a0b774a..8fb2cc3b5650 100644
> --- a/drivers/media/platform/renesas/rcar-isp/csisp.c
> +++ b/drivers/media/platform/renesas/rcar-isp/csisp.c
> @@ -28,10 +28,7 @@
> #define ISPSTART_STOP 0x0000
>
> #define ISPPROCMODE_DT_REG(n) (0x1100 + (0x4 * (n)))
> -#define ISPPROCMODE_DT_PROC_MODE_VC3(pm) (((pm) & 0x3f) << 24)
> -#define ISPPROCMODE_DT_PROC_MODE_VC2(pm) (((pm) & 0x3f) << 16)
> -#define ISPPROCMODE_DT_PROC_MODE_VC1(pm) (((pm) & 0x3f) << 8)
> -#define ISPPROCMODE_DT_PROC_MODE_VC0(pm) ((pm) & 0x3f)
> +#define ISPPROCMODE_DT_PROC_MODE_VCn(vc, pm) (((pm) & 0x3f) << (8 * (vc)))
>
> #define ISPCS_FILTER_ID_CH_REG(n) (0x3000 + (0x0100 * (n)))
>
> @@ -263,10 +260,10 @@ static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state)
>
> /* Setup processing method. */
> risp_write_cs(isp, ISPPROCMODE_DT_REG(format->datatype),
> - ISPPROCMODE_DT_PROC_MODE_VC3(format->procmode) |
> - ISPPROCMODE_DT_PROC_MODE_VC2(format->procmode) |
> - ISPPROCMODE_DT_PROC_MODE_VC1(format->procmode) |
> - ISPPROCMODE_DT_PROC_MODE_VC0(format->procmode));
> + ISPPROCMODE_DT_PROC_MODE_VCn(3, format->procmode) |
> + ISPPROCMODE_DT_PROC_MODE_VCn(2, format->procmode) |
> + ISPPROCMODE_DT_PROC_MODE_VCn(1, format->procmode) |
> + ISPPROCMODE_DT_PROC_MODE_VCn(0, format->procmode));
>
> /* Start ISP. */
> risp_write_cs(isp, ISPSTART_REG, ISPSTART_START);
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675690-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8501B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:59:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 7FFDF189B723
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:59:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 61A652882DD;
Fri, 6 Jun 2025 11:59:06 +0000 (UTC)
Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D0362882A7;
Fri, 6 Jun 2025 11:59:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211145; cv=none; b=VOpYlkwC88Nldbd57X0f4FtLP/S+bmmOyVZvCxXmMCtvr0N9bA95Kzqae0HGiEnkh8owEuVUsDbosDFw1Z/ZWtFdV2HliVHl67rA0tiqawqKEp20PJJ2ObIwTCyi6koIX6RE6qk0X6p95nGq81pf8P9nmRzBPVcge4K5dI7kHlk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211145; c=relaxed/simple;
bh=VNzFnnjmlBp/RMn3jvFeMwHEGzosLKTGr8Q2T984OKw=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=Jz8sqLm+IFc7XnOiaIQiTCYgktqtq3/gwY6JxV0nCKSM0cDLyJZ7oJprHtfXRYQqW8SHgfChtuIep8qsMzVzpVEAb1dW0Sj6nD7ZNLx1qHgLpjTbdes/uUhTVCk2DhwRdUyiRvaKbnYudYGWn9kqoTN2Ns/HMlQ5p9S1BJw4TYE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vk1-f172.google.com with SMTP id 71dfb90a1353d-530cd3d0f8bso711464e0c.1;
Fri, 06 Jun 2025 04:59:04 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749211142; x=1749815942;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=GkkIyvqOfr9ngi6miRPVbPTmpqHilBK6eOIDZuISEqs=;
b=Y5zJfvsGnJ/t51ugHoiqwJstdFq7FXclwXxF3CT76aR/kLIREOlZNLpCbHCTqSkTOe
rYH0KCsKcd28voDnG5Q9JARcsehM91VVFSXvQCyf1dMEl5+zhWGjzZA3bZE0hVdu/sdl
dSIkGs5fqpF4/I0LuAedIeMrEV6icWB2vkYrer6dHQ9kSIjD7TXpE+Ta9AjizNfOnk1V
0mV1pQ1wyQKoyzMZDCMPa7GfAc83UW1QGM2fhU81hbpTBOI6D1lRlvucHt2bDu4oF58V
UZZXQBn9GLxlO4GP+JiJL2xqmA0luZpQ/Y8AxV9on1TrBvwrGitM2KEhopdsJF1ZjFLz
Zg7A==
X-Forwarded-Encrypted: i=1; AJvYcCV+y4DGFK6XyWVXupckYa5px+uj3DfsaDRZAVeocKD3/nepWnQY0VZqkmg8cpCGqA4M+ynskD4sTZAsZFMw@xxxxxxxxxxxxxxx, AJvYcCWi15lDB6QKRkwUtzvmBobqed0HEKPFU99fmlZpMqfSj6wulvLG7NLNd+IxwBYIpuV1FGlDF2QcWjAj@xxxxxxxxxxxxxxx, AJvYcCWvLhvO5cakVrs1212OrGipU1nFK6rZs0mQtHK7Zy9tka2PBp+Bfs3fW/aRfoH1c5/AK8V3vPZ/wzC41T6Qdwk5s/8=@vger.kernel.org
X-Gm-Message-State: AOJu0Ywi2oe7yFsRCQCkUzqmp6MmX9mRiyJbvVo2lqLO28GGPIHHTwia
rC134+Q8CrkeLMnFOUsQrAFe5Lg8IOb87ZxUt2e+bxMTHo6v6sJ6oxPUZTbWW3uj
X-Gm-Gg: ASbGncvMt3TDE12eFZ4dbjNq67BPaDNb5b+BTKIANnXzDkrGdDdOSOASVJm2Xc4j7xn
37TN97rdlmGBS7qxW+fsyk6M0HUSh+WlLmp0UOcyarPJng/83casaAtFd00ddQ1r57kn6S5kEnY
klaJijjqxLDaPT+jPozQ3nOYZSDYuZxSl4ENk+cvOxHQerQnKKcx0cVrnliyHmiiLav2kuxSLpt
aXqE8og17AS1AKlITE0zRdf9Q06FtyZaCGCZyM2/BlMqbe8N9rugOs10QQiv/QaRT50VVS7AEIo
4vGiWr89vOcZ5GxS7T8F3vEpXgLoQQXM6bGKG8Dy3/Gr5hH/BWwXMBH2wd8Ox3UQfTqydSAYyVv
7gQSQH00uMlo7KQ==
X-Google-Smtp-Source: AGHT+IE1sIhNlyo4aUhjctzlL5t/v6W/0ioCcOUUcZ+0FNgWuKuK1NBY3FRpGW7t3iwEuekCDhyEGg==
X-Received: by 2002:a05:6122:640c:10b0:526:1ddc:6354 with SMTP id 71dfb90a1353d-530e45c78eamr1858178e0c.0.1749211142224;
Fri, 06 Jun 2025 04:59:02 -0700 (PDT)
Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com. [209.85.217.51])
by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-530e62f42b8sm970467e0c.19.2025.06.06.04.59.00
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 04:59:01 -0700 (PDT)
Received: by mail-vs1-f51.google.com with SMTP id ada2fe7eead31-4e770bb7b45so274150137.0;
Fri, 06 Jun 2025 04:59:00 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCUfh+1ROspvczqPnGryP1qyVAgYvUYFyF4pIZIa2SSGUoiLamiuoalRD30MZ8U+yPze7hrYMqQ8uoyx@xxxxxxxxxxxxxxx, AJvYcCV4FTIKcC2IBqdyTUq3mRssQu4h7ejlmqVsMWHDbGM5FHQUQDfftGvCrV3IIE3nSHbszh/MGI7f2OqOhEhNz0rTwC4=@vger.kernel.org, AJvYcCW30TvWqdbkM7dRWx5a8Yidnscts6UY/eV1BR/3EMHA9DR7TkXpGnVDThYqlswTf2IviMYsYmaWhLe4tRro@xxxxxxxxxxxxxxx
X-Received: by 2002:a05:6102:440e:b0:4df:84d5:543e with SMTP id
ada2fe7eead31-4e772928b20mr2281122137.7.1749211140760; Fri, 06 Jun 2025
04:59:00 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250528133858.168582-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250528133858.168582-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 13:58:48 +0200
X-Gmail-Original-Message-ID: <CAMuHMdXMEzPYfDvefSzSx9hZGY=4eyRY2MHHnr5JBHV3ujFdrg@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFsl-TsxaSk2EijYe-2lJ04s7VyuySx5VPceo-nG7KhS3hWpW4y_WadxEEM
Message-ID: <CAMuHMdXMEzPYfDvefSzSx9hZGY=4eyRY2MHHnr5JBHV3ujFdrg@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] dt-bindings: phy: renesas,usb2-phy: Document RZ/V2N SoC support
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Vinod Koul <vkoul@xxxxxxxxxx>, Kishon Vijay Abraham I <kishon@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Geert Uytterhoeven <geert+renesas@xxxxxxxxx>, Magnus Damm <magnus.damm@xxxxxxxxx>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>, linux-phy@xxxxxxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-renesas-soc@xxxxxxxxxxxxxxx, Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Prabhakar,

On Wed, 28 May 2025 at 15:39, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Document support for the USB2.0 phy found on the Renesas RZ/V2N
> (R9A09G056) SoC. The USB2.0 phy is functionally identical to that on the
> RZ/V2H(P) SoC, so no driver changes are needed. The existing
> `renesas,usb2-phy-r9a09g057` compatible will be used as a fallback
> for the RZ/V2N SoC.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Thanks for your patch!

There seems to be some minor differences related to VBSTA interrupt
handling, but the documentation is far from clear in making clear what
that actually means, or is used for...

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675691-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D3D8241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 07:59:49 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id C96343B1787
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:59:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 80EB028850C;
Fri, 6 Jun 2025 11:59:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DUbkvwqP"
Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CC762874FA;
Fri, 6 Jun 2025 11:59:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211179; cv=none; b=HDhQ7sNB4BYrqsrNiuhIaZCZRABsmcogTylB2P26hY0WTgn1nF5KvjS0moklGnzCj4RqIpA9OEothlJoi2j6jnNhY8jatt1Az4SMpfe0JaPYj3bDJo27rsZqGiNutYefj70hUDH3cmE8+r2K4iLW9F3dPuwmom3h+p4NSGj623w=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211179; c=relaxed/simple;
bh=fLyP1nJgU2iKVNH8e+jPqTnC6CYKC0rB5Q0uu/GtYng=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=RIkAC5nMW1/bCGyM8IqKasPCipEjUQ9D+7nDYAdY0+UMweWZU2Vmp+oCLhgUBSTh6qDNTc/oz0RiuLdzbFGCXA7Uyb4bKWMFelj5P7vSm5XVzZIhqms+JwdqzxlImcIKF9tmwB6ZGqxPPGAGQmaYcLwSvs3hUUNI1uIfBtYV+Gs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DUbkvwqP; arc=none smtp.client-ip=209.85.208.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-32a61af11ffso21451481fa.1;
Fri, 06 Jun 2025 04:59:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749211176; x=1749815976; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=7RBKB3/9EuqkeSqFD8CRon1Zsx+X5s6ybMaqEFvORUg=;
b=DUbkvwqPoAd2yKYqVb/Wnsr7MPFB04HpOePGZ3CRkL7OLVXULU7CCbx9nIT0t1MG2R
mOABZBAqSHoZOt/Q9308/123W04+2Msgzpe8j6n2eq/RE4AzrKgW+0CjPOWa9V7fRr2g
7uPuLnPiYwBy9D+XKzIWsyBvAQhtbqlSyOOkIU+JTsPKjX2Nj9cBg6HjWaepgIyt8h9F
n7qeluF2TKhJUPFhDvAjz50CZGjZp6sKz/a0hLxRBhbgrMuzbGQxdaCXRzKoB7e0KoGp
BclMrp/BZSmfmgkKegw2+9wWv2ohF9yHMfnnAO/fDV6avPMWSt6J9dLa3eW3BtpXjf8z
Pm/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749211176; x=1749815976;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=7RBKB3/9EuqkeSqFD8CRon1Zsx+X5s6ybMaqEFvORUg=;
b=WROxm7KjDsWTNdAZjXdXj0gVyx5zeyg3lQirA2Qqbh7WWq+Kq+ymy3JeDwsQfFqGRQ
jjkdr2Mo0+2BQTxsXhBHWoUGXffv3LJ0oSOnXtdd0SRK98cSiRyOaAnupCBolhRH0EQY
7HVeFl/M9BBj+tjdQ+vN7bxfkYxHDYGO5B2pHOYNWOfudLHC77tR1l+uXnhop0mZGQ+7
D7c7wGhg8FJjiaWOqnC8XlBUHlv7eaDUkp28/kZW77vqGa8SbDObv8FmwmIrZb6xG1So
foSTWBXnM728RXV2yNA4asYllfT+ihwBoCYVVF4WHBJsRfrSaijDC3wnfUgl6+SdJeHK
xJtA==
X-Forwarded-Encrypted: i=1; AJvYcCUvGIPkmGecfJyYiblaepOyZmFpZh24PlNJektOjuzcmqJ7Mn0TqECbyy3N7eUTruoP3gM19K0Kkg/QXA4=@vger.kernel.org, AJvYcCVlK/C3Sd+L8ApGZ7ctOizD9KcQI5g0WLosCz7yezBerfg2IFK2ML1Vuhaisb5eet5gRe/sbPjT5inlWLV1@xxxxxxxxxxxxxxx, AJvYcCWsNhWXgiSYKhX23OfpcOypk86UsyqxB/Rc0AXQyKczb+WXaNq72d2KRkXNbkIOJ2bg+2pbN6OyPdF++0TT@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YwQgVAwbjrxGweLDpY7Luc8jGOd+npKA2JIsp76T7I6/RIHGERW
SRmp9rAhrPHmlwf4klShL5udpW13CgKR86cadxF29LASSdVRdjlQ6Y9UA8/dc0oIAnb7jRlPKhX
oV7uA4RjKA3pjJY2MyWzOwJgMzwYDHF4=
X-Gm-Gg: ASbGncsuTEguhf1xbLLRNsgyQK3U3P6Vag2oSe1wZ3NA4Og98Tb8brk5uaLND7Jf1Y5
Ct1OQpwVlhD0lm+vojVtG1fk3Ek3Y0GGBKlL3T1WAFJVznIZisq7hMDm4nVHjXgsHBQLoxrndJA
iO9HbmI7F4rP+KO+C8HhB5hYmnQzN9NQ==
X-Google-Smtp-Source: AGHT+IEyOHac18JRsxQCDC33nCW0intiyA9mvI/PE8BZZlcm+WphqtwKX7kfZnMd/x1fvrki/mIzxhujOWzkyQ0xq1o=
X-Received: by 2002:a2e:be0e:0:b0:326:cf84:63c4 with SMTP id
38308e7fff4ca-32ae0021b08mr9121671fa.1.1749211175876; Fri, 06 Jun 2025
04:59:35 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250531-topic-venus_98_tbl-v1-1-68e5523a39dc@xxxxxxxxxxxxxxxx> <btmzhyullmggev43b3syp3anxlm6o5mpz2mthaskuyl7kfx5gw@w5gesyaaytkh>
In-Reply-To: <btmzhyullmggev43b3syp3anxlm6o5mpz2mthaskuyl7kfx5gw@w5gesyaaytkh>
From: Arnaud Vrac <rawoul@xxxxxxxxx>
Date: Fri, 6 Jun 2025 13:59:23 +0200
X-Gm-Features: AX0GCFsrvG8NbZd4C_wPfiA0MO9Yh-Z4gplq5hfZ8xBg7i6J3bFVaxj1uRtBKGs
Message-ID: <CAN5H-g7WLsowjW6CMee5T=W4Lmia9mLWGgX17-mOMjtBo2SwvQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] media: venus: Fix MSM8998 frequency table
To: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Cc: Konrad Dybcio <konradybcio@xxxxxxxxxx>, Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>,
Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>, "Bryan O'Donoghue" <bryan.odonoghue@xxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, Stanimir Varbanov <stanimir.k.varbanov@xxxxxxxxx>,
Marc Gonzalez <mgonzalez@xxxxxxxxxx>, Pierre-Hugues Husson <phhusson@xxxxxxxxxx>,
Hans Verkuil <hverkuil@xxxxxxxxx>, Marijn Suijten <marijn.suijten@xxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Le dim. 1 juin 2025 =C3=A0 09:46, Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxxxxxxxx> a =C3=A9crit :
>
> On Sat, May 31, 2025 at 02:22:00PM +0200, Konrad Dybcio wrote:
> > From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
> >
> > Fill in the correct data for the production SKU.
> >
> > Fixes: 193b3dac29a4 ("media: venus: add msm8998 support")
> > Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
> > ---
> > drivers/media/platform/qcom/venus/core.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
>
> Verified against msm-4.4

Hello,

The current values are based on
https://git.codelinaro.org/clo/la/kernel/msm-4.4/-/blob/caf_migration/kerne=
l.lnx.4.4.r38-rel/arch/arm/boot/dts/qcom/msm8998-vidc.dtsi
which we've been using in production for many years.

-Arnaud


Return-Path: <linux-kernel+bounces-675692-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 966F141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:02:20 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id DBBA0189D108
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:02:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 675222882D3;
Fri, 6 Jun 2025 12:02:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="eqFQyPfQ";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="e+XB/RZV"
Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144])
(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 806BE1E25ED;
Fri, 6 Jun 2025 12:02:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211329; cv=none; b=N0dl3ceEzzpDBuwfsMBHLME/8GNT0ZhmDUZKUNRaJ8ZgqCQCbOHlCh3l4UPz6zCmW3WwaUUz5cA2Dbg91qaWdBDw0eQv9wr6b9RLcBJSXrvwYJK9zGWh4qY2XHzSDLeAyDl2hJWDwnQbpFCVocgk1WiT5geoSyDajGbyqoXK+mQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211329; c=relaxed/simple;
bh=lehcra6IGALpqmalurFJkLUkRed2UEtrzqdw0mPZm84=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=DQ9GcF5XGr82SyZxSU3BGw+uAYXrJfE2kAYIbb3n/ZEmTswbcKX2ZtRqGFwc1oqNy20RkL0oXFJbY6khI2UGPpgLggOBDdUAkaMaauYRqtA1siHGtC7SOShciynAuYcREqFAsbI3PrAolNYM5pzQJvCFv4OEeYd+6X+HJYl9sok=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=eqFQyPfQ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=e+XB/RZV; arc=none smtp.client-ip=103.168.172.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50])
by mailfout.phl.internal (Postfix) with ESMTP id 8D983138034B;
Fri, 6 Jun 2025 08:02:06 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
by phl-compute-10.internal (MEProxy); Fri, 06 Jun 2025 08:02:06 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749211326;
x=1749297726; bh=Obfl9LVjZme1N6jc3cwqyAP+xIrat0n5RtphV2HZsYo=; b=
eqFQyPfQ/2uz2Hf90IC7OpGPKwzj2va86tcIwI74xuggpcGj0V1DTWPziBGqrOOl
jmIVqUh0tHevUARLzv6NGTuQ043gBlNO39iJ9+BGflLkeMqrdinEJF1cAH1JrVFE
gG+l8c+yU7lTxvjkh3aWMJMdTN+tesP58yZC+i6nP7zz17IysYaUBdoxiIJs/nMX
i6jRolK/n1ZFvXau8ayW+yYFiD7eNeAxirSglx+9LTlCUWxdXNTQkil38kVKWmpG
fl90Ciy/+2aEhg9BJNTPTb5xU6EXHlnqJt5uVKpEj9AfkmSOR43ThRZ9HyGbckM5
XeSK2t7uLdRe3Jvl7b5X8g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749211326; x=
1749297726; bh=Obfl9LVjZme1N6jc3cwqyAP+xIrat0n5RtphV2HZsYo=; b=e
+XB/RZVVF5um3WjDqG+JtiNfzuEiG5U7WYHRXrg7LCaAPG8jMy7dt4KdHTjJIuIT
W0JO5Zo2dhXHtpBql0BUsIgQWa6WDYsLbjU+M8bkMelzKQB8IVADMdFuYIWFMQxe
hjFmXmZWdE5SSI0p7Tbcgu9Hwaet0NWVkZnkdveqW0shywnKqUKxkGADi6XIa69x
tCXwdTgWA773qwNhynSBpnA1FRHWy+oUrZ/ooK6KKkOpn/R+sUCSmMXYf3B3Nrk1
ijrXxwrNZ8BGc4oKG8ErGYW69/mQeUzhHbsK9WqTxJBV1vBVsyAerq2txzk6hFOS
82r4nfCiyFB9R0GhOo0gQ==
X-ME-Sender: <xms:vthCaG79hNryUfREJyuP0Dwf47hMh9OxsqNNHK0QSXYQHRqirXU6_A>
<xme:vthCaP7XrtNJbzZBjAch0FStDLfrd_EMhIXIwraY4zwVa8HrvCl9ElPkfBJ1bU8ys
i65wZ2i05H6kRY8pUw>
X-ME-Received: <xmr:vthCaFeDCJE3rVQTtWvFp9PWls1Eg3VNz_KL7Nx71oWu5a648oq9OXxNJsO66IdG8ZYZz4pwARr6T34ftYex7Do6TfSaLDM-yQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdeiucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeevteeg
tddvvdfhtdekgefhfeefheetheekkeegfeejudeiudeuleegtdehkeekteenucevlhhush
htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehnihhklhgrshdrshho
uggvrhhluhhnugesrhgrghhnrghtvggthhdrshgvpdhnsggprhgtphhtthhopeelpdhmoh
guvgepshhmthhpohhuthdprhgtphhtthhopehtohhmihdrvhgrlhhkvghinhgvnhdorhgv
nhgvshgrshesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepmhgthhgvhh
grsgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehl
ihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvh
hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghs
qdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkh
gvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgthhgvhhgr
sgdohhhurgifvghisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlrghurhgvnhhtrd
hpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepjhgr
tghophhordhmohhnughisehiuggvrghsohhnsghorghrugdrtghomh
X-ME-Proxy: <xmx:vthCaDKCtzFjbKXjC3thKaN-8KY038v7xA66A-3tWHnd-ieicRkuWA>
<xmx:vthCaKIfd6jP1gRXqGjWMqnFzEby_UHoAcU_yK5jNTtGi9eYfwQ-bg>
<xmx:vthCaEygYudWqvWGx_N_kRHEYco4K_pv_Ul4lghc4vBWlWkl7tqD1A>
<xmx:vthCaOIZsEHL9CI8J-k_H6K6jLuubDIn2O3lnDmc950b-UwOXwC9ww>
<xmx:vthCaIQBknF3LjVfWfs5ad4Z32s5y7Xwblc3kH41SNxCeuyncEJoG6hP>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:02:05 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:02:04 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 06/15] media: rcar-csi2: Simplify rcsi2_calc_mbps()
Message-ID: <20250606120204.GB2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-6-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-6-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your patch.

On 2025-05-30 16:50:35 +0300, Tomi Valkeinen wrote:
> Instead of taking the bpp and the number of lanes as parameters to
> rcsi2_calc_mbps(), change the function to get those parameters inside
> the function. This centralizes the code a bit and makes it easier to add
> streams support.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> ---
> drivers/media/platform/renesas/rcar-csi2.c | 45 ++++++++++++++++--------------
> 1 file changed, 24 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index 8aca35096408..90973f3cba38 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -998,13 +998,18 @@ static int rcsi2_get_active_lanes(struct rcar_csi2 *priv,
> return 0;
> }
>
> -static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
> - unsigned int lanes)
> +static int rcsi2_calc_mbps(struct rcar_csi2 *priv,
> + struct v4l2_subdev_state *state)
> {
> + const struct rcar_csi2_format *format;
> + struct v4l2_mbus_framefmt *fmt;
> struct media_pad *remote_pad;
> struct v4l2_subdev *source;
> + unsigned int lanes;
> + unsigned int bpp;
> s64 freq;
> u64 mbps;
> + int ret;
>
> if (!priv->remote)
> return -ENODEV;
> @@ -1012,6 +1017,20 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
> source = priv->remote;
> remote_pad = &source->entity.pads[priv->remote_pad];
>
> + ret = rcsi2_get_active_lanes(priv, &lanes);
> + if (ret)
> + return ret;
> +
> + fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK);
> + if (!fmt)
> + return -EINVAL;
> +
> + format = rcsi2_code_to_fmt(fmt->code);
> + if (!format)
> + return -EINVAL;
> +
> + bpp = format->bpp;
> +
> freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
> if (freq < 0) {
> int ret = (int)freq;
> @@ -1092,7 +1111,7 @@ static int rcsi2_start_receiver_gen3(struct rcar_csi2 *priv,
> phycnt = PHYCNT_ENABLECLK;
> phycnt |= (1 << lanes) - 1;
>
> - mbps = rcsi2_calc_mbps(priv, format->bpp, lanes);
> + mbps = rcsi2_calc_mbps(priv, state);
> if (mbps < 0)
> return mbps;
>
> @@ -1300,23 +1319,15 @@ static int rcsi2_c_phy_setting_v4h(struct rcar_csi2 *priv, int msps)
> static int rcsi2_start_receiver_v4h(struct rcar_csi2 *priv,
> struct v4l2_subdev_state *state)
> {
> - const struct rcar_csi2_format *format;
> - const struct v4l2_mbus_framefmt *fmt;
> unsigned int lanes;
> int msps;
> int ret;
>
> - /* Use the format on the sink pad to compute the receiver config. */
> - fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK);
> - format = rcsi2_code_to_fmt(fmt->code);
> - if (!format)
> - return -EINVAL;
> -
> ret = rcsi2_get_active_lanes(priv, &lanes);
> if (ret)
> return ret;
>
> - msps = rcsi2_calc_mbps(priv, format->bpp, lanes);
> + msps = rcsi2_calc_mbps(priv, state);
> if (msps < 0)
> return msps;
>
> @@ -1494,23 +1505,15 @@ static int rcsi2_init_common_v4m(struct rcar_csi2 *priv, unsigned int mbps)
> static int rcsi2_start_receiver_v4m(struct rcar_csi2 *priv,
> struct v4l2_subdev_state *state)
> {
> - const struct rcar_csi2_format *format;
> - const struct v4l2_mbus_framefmt *fmt;
> unsigned int lanes;
> int mbps;
> int ret;
>
> - /* Calculate parameters */
> - fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK);
> - format = rcsi2_code_to_fmt(fmt->code);
> - if (!format)
> - return -EINVAL;
> -
> ret = rcsi2_get_active_lanes(priv, &lanes);
> if (ret)
> return ret;
>
> - mbps = rcsi2_calc_mbps(priv, format->bpp, lanes);
> + mbps = rcsi2_calc_mbps(priv, state);
> if (mbps < 0)
> return mbps;
>
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675693-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0460041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:03:29 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9BBDE3AF13A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:03:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 340D42882BC;
Fri, 6 Jun 2025 12:03:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SeNM+vw6"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68F932AD0D;
Fri, 6 Jun 2025 12:03:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211401; cv=none; b=uC1nhaE0ino8Bo+yNVX6HWuOaAgl0snungOlMgn6yL5f70/nz/uuDeMCbi7TFg+ana6HvCWGm5CUUVWeveq75I/bokzHaSOZ4UdCdlqYE4DVUo+QdU3vGVcL/zBlX2ZTGpIqekgSK3OoomdlFH38IA41G9EMjzjrsdukxCkupYY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211401; c=relaxed/simple;
bh=6oz9cLgBpq1+bwaTR5/JwtLIYahXmjDOpJo1Ih+IxD4=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=j48qAd5dumekbKi3PNIiZadCZj9ycyUryleQTRBiKRDPNjuK69cJUvtWJWEvF4d4lo/0gfj1uPb0Ixdyhp1IpX5AQ7Ue3OVVofSZVdJMqiMhwC1RazwKvZO+SqdPiwyP4SbtbWk77IVhRXwLLo7/4qtBCDdw5avbtrUd5q5lfvk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SeNM+vw6; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id C16BFC4CEEB;
Fri, 6 Jun 2025 12:03:20 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749211401;
bh=6oz9cLgBpq1+bwaTR5/JwtLIYahXmjDOpJo1Ih+IxD4=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=SeNM+vw6o2R/VlOg+xOelhhzCXW9usTQ42ANhiV95Y2x9Zn03fWe3qeJLHG/Irx/V
Ql+SwV5H4mHoIKAcoaq2UwshrQHD6bGBm4u6t2zp9iHtjOBL0ZO9RabpIdByFPnF0h
nqzutpLb25wSNP2wH9Foo26YdAFUOUXmRhUVtbiPA3qPycHZ1fc6C8cXHnKZfVN+WK
xT3fOBQgnFjYwte/ANAF2HV/22aK4vTebfl33KbuQ5bPgOrZYwCk0Z72Q37FigH+8c
eqeO+OdQDej06AfYvflVWtrLcZWKoxbZUqoCCKaYZuYGy8Kmsvx7XGjdirdcgiNxpO
sdTSFPhyYXnPQ==
Date: Fri, 6 Jun 2025 14:03:18 +0200
From: Maxime Ripard <mripard@xxxxxxxxxx>
To: Anusha Srivatsa <asrivats@xxxxxxxxxx>
Cc: Neil Armstrong <neil.armstrong@xxxxxxxxxx>,
Jessica Zhang <quic_jesszhan@xxxxxxxxxxx>, Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>, David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>, Inki Dae <inki.dae@xxxxxxxxxxx>,
Jagan Teki <jagan@xxxxxxxxxxxxxxxxxxxx>, Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>,
Andrzej Hajda <andrzej.hajda@xxxxxxxxx>, Robert Foss <rfoss@xxxxxxxxxx>,
Laurent Pinchart <Laurent.pinchart@xxxxxxxxxxxxxxxx>, Jonas Karlman <jonas@xxxxxxxxx>,
Jernej Skrabec <jernej.skrabec@xxxxxxxxx>, Chen-Yu Tsai <wens@xxxxxxxx>,
Samuel Holland <samuel@xxxxxxxxxxxx>, Seung-Woo Kim <sw0312.kim@xxxxxxxxxxx>,
Kyungmin Park <kyungmin.park@xxxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Alim Akhtar <alim.akhtar@xxxxxxxxxxx>, dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-sunxi@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting
Message-ID: <20250606-radical-rigorous-buzzard-ca09cd@houat>
References: <20250604-of_drm_find_panel_part1-v1-0-c632e12e131d@xxxxxxxxxx>
<20250604-of_drm_find_panel_part1-v1-2-c632e12e131d@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha384;
protocol="application/pgp-signature"; boundary="naqzmlhexuyovrm5"
Content-Disposition: inline
In-Reply-To: <20250604-of_drm_find_panel_part1-v1-2-c632e12e131d@xxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--naqzmlhexuyovrm5
Content-Type: text/plain; protected-headers=v1; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting
MIME-Version: 1.0

On Wed, Jun 04, 2025 at 10:45:11PM -0500, Anusha Srivatsa wrote:
> Put the panel reference back when driver is no
> longer using it.
>=20
> Signed-off-by: Anusha Srivatsa <asrivats@xxxxxxxxxx>
> ---
> drivers/gpu/drm/bridge/samsung-dsim.c | 1 +
> 1 file changed, 1 insertion(+)
>=20
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/brid=
ge/samsung-dsim.c
> index 0014c497e3fe7d8349a119dbdda30d65d816cccf..3667855ff0d6d1b608c579573=
de657af7fd14388 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1748,6 +1748,7 @@ static int samsung_dsim_host_attach(struct mipi_dsi=
_host *host,
> dsi->out_bridge =3D ERR_PTR(-EINVAL);
> }
> =20
> + drm_panel_put(panel);
> of_node_put(remote);
> =20
> if (IS_ERR(dsi->out_bridge)) {

Explaining in your commit log why you think it's a good idea to put it
there would be really nice. In particular, it looks super odd to me that
you would put the panel reference in attach.

Also, your patch doesn't work, and you have a reference inbalance. You
have one taken by the panel driver, put in remove. You have one in
drm_panel_add, put in drm_panel_remove. Which reference do you put here?

This applies to your other patches too.

Maxime

--naqzmlhexuyovrm5
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCaELY/wAKCRAnX84Zoj2+
diBYAXwKsnGG/hDaACTi2QF85rFrKiFaFWibUe+aygZ2K7/QBjFUhuAmCr4gs9ij
KBDYTjQBgNXlwuo0a1Tzh+JZDgdPXgj1NZYl1UppVoWcYCBkxzww5vfwCw0+YexU
o1W0BPKmpA==
=VbEd
-----END PGP SIGNATURE-----

--naqzmlhexuyovrm5--


Return-Path: <linux-kernel+bounces-675694-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 43B2A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:03:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id DEF5C162582
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:03:42 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D9A39288538;
Fri, 6 Jun 2025 12:03:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="OwyHz0dS";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="EirVsUt+"
Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154])
(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 1934D2882DE;
Fri, 6 Jun 2025 12:03:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211404; cv=none; b=fu0Mim8lfY8/jbl7fkAMa4xIeY7htS5BburiBhA/APQn4NWgl1M4bjy4vn8pUSVWxrMDbceHvxU3OWp9e8B1b1f+vd74OXjPsH52dPa5rJ9BAs0ezKl+/hbnO1mGgxPsYoX53Mv3sESW45IZ/AbdRntPqaC1Lkm5Bkn1W+4RoGQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211404; c=relaxed/simple;
bh=ItXu5mV3/0ntWGHFjikM6fudcBK1Ei0an4X8RtRpgPM=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=HEoCR4//d+r/lGALbI9LPjVubYKeA/J69DImO6iRaz0za57KrQgmqKyN/ivOpnT2eypQOZMt6xZzrY0bkO2Z8AEtRffGTPJisedSzEBGc7WiaWecZCVkXzbYa8xFYAnymUkz1ghjysK5gsIFrburT0BQLFx0S6VPmz5UNcZG46A=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=OwyHz0dS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=EirVsUt+; arc=none smtp.client-ip=103.168.172.154
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42])
by mailfhigh.phl.internal (Postfix) with ESMTP id 04F261140152;
Fri, 6 Jun 2025 08:03:22 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-02.internal (MEProxy); Fri, 06 Jun 2025 08:03:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749211402;
x=1749297802; bh=Fj022TFRzcr09PkipTT8Q855tluX6YSmqn8UnY8RXu0=; b=
OwyHz0dSLwPVcoLeXuaP0b5MRtkMztGA4LtJVm37ydNGv4DJnfwjYPRMsA8GQLW0
/+SrsEkjPbKK9PJOomZY9Uf+DVtGO8koKs9cIOdvm68oen6v7NihXNMQNhi4LAoL
8Ke1ZG5NRRYLFvmsrBQbbYrLIOReD4ovWA3fV8i36Xd2/ZuKi++f2GGT59csgP8o
kAEnL8cLrNlKDio2qa06kCsiayYvRVMJDg1CH7qUhx8qJx6Hapd+x7Dm1Hje+QJY
eGDl3TxGK2D2zj2yurTBgSNIRrpPW2OT108tH9gSAzthlDiLeb6FQ4W3bm2S7lFf
YZDSAAanVPS0EQFVV0g7ow==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749211402; x=
1749297802; bh=Fj022TFRzcr09PkipTT8Q855tluX6YSmqn8UnY8RXu0=; b=E
irVsUt+PxjIyCePH5JIZJFHjUpeoGsvbuOMd9BSkgnZoi28+1qaKPljAhKo2vPNy
JW1Dr7Rlrkt8QsJ0YBga8RBkJFbwZHz1b8lUABciaSLPvP3+Zl0NyF5isWk+7Hq+
BfeQUXHruLm4n4kyRk/xxUTFetci0Zv9PfhfZIHdZuLeSuENzu4KIW0LTzrBzN2Z
4ek0ggaW6vpU+89665So3sGFiODiUUrRiC6wpskj0koE9Sas+iPO7hk+VhpTtPuQ
YSq+JLOgKH6YFktkJ62fwwBfKMfn2UYU9O2KJJUGEtdaEWm/UEYWUfMGMLYSaV3w
zNkn5zTwNJdv3CZdqt4cA==
X-ME-Sender: <xms:CdlCaDwPTm1hi8gYSLFy2ZATppFxodORt-E2FrYDRMq_Zxo7pjQ0Sw>
<xme:CdlCaLSAMgcySFfUTch5Nc8Sofo5D1ppoWFpnJQtWYQxy4loq9GNltlm3HH2Sz7tC
GFhyKDQjlah6YzG8H0>
X-ME-Received: <xmr:CdlCaNXcciVIy7sPbAG2gu5AhE5SWzPoiaoZYZtOnCmzYZujLG9YYIRPRrnb8cjA63hVAOsEBpsqTPLScgaOuNMT2i0-T3uRAA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdeiucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeevteeg
tddvvdfhtdekgefhfeefheetheekkeegfeejudeiudeuleegtdehkeekteenucevlhhush
htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehnihhklhgrshdrshho
uggvrhhluhhnugesrhgrghhnrghtvggthhdrshgvpdhnsggprhgtphhtthhopeelpdhmoh
guvgepshhmthhpohhuthdprhgtphhtthhopehtohhmihdrvhgrlhhkvghinhgvnhdorhgv
nhgvshgrshesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepmhgthhgvhh
grsgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehl
ihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvh
hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghs
qdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkh
gvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgthhgvhhgr
sgdohhhurgifvghisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlrghurhgvnhhtrd
hpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepjhgr
tghophhordhmohhnughisehiuggvrghsohhnsghorghrugdrtghomh
X-ME-Proxy: <xmx:CdlCaNjQjrPfEpgyQMz76ef_hakII1BIPfZEDOgw6o_WQtbiShfUdA>
<xmx:CdlCaFDA1NZea8SDZmBmzKOFGhaj-gVSr6vLMK_kaFSXo4A0RYqOXA>
<xmx:CdlCaGJeBMgnxpZrpzYRxZZDzODHDPYHDn-hA1NW0U3RJ6y9sgBMdw>
<xmx:CdlCaEDNnYfCIBUXbWR7UnBDJNxwhMohqO3NGC5j9rkzY8yPJJWKbA>
<xmx:CdlCaHrHYaqkCswSHLZvN9Tds5TJ6CAP8dkCG2Cl0BQQsi8yqpbUM2NV>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:03:21 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:03:20 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 05/15] media: rcar-csi2: Move rcar2_calc_mbps()
Message-ID: <20250606120320.GC2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-5-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-5-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your work.

On 2025-05-30 16:50:34 +0300, Tomi Valkeinen wrote:
> Move the function so that it can call rcsi2_get_active_lanes() in the
> following patch.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> ---
> drivers/media/platform/renesas/rcar-csi2.c | 66 +++++++++++++++---------------
> 1 file changed, 33 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index 698eb0e60f32..8aca35096408 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -951,39 +951,6 @@ static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps)
> return 0;
> }
>
> -static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
> - unsigned int lanes)
> -{
> - struct media_pad *remote_pad;
> - struct v4l2_subdev *source;
> - s64 freq;
> - u64 mbps;
> -
> - if (!priv->remote)
> - return -ENODEV;
> -
> - source = priv->remote;
> - remote_pad = &source->entity.pads[priv->remote_pad];
> -
> - freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
> - if (freq < 0) {
> - int ret = (int)freq;
> -
> - dev_err(priv->dev, "failed to get link freq for %s: %d\n",
> - source->name, ret);
> -
> - return ret;
> - }
> -
> - mbps = div_u64(freq * 2, MEGA);
> -
> - /* Adjust for C-PHY, divide by 2.8. */
> - if (priv->cphy)
> - mbps = div_u64(mbps * 5, 14);
> -
> - return mbps;
> -}
> -
> static int rcsi2_get_active_lanes(struct rcar_csi2 *priv,
> unsigned int *lanes)
> {
> @@ -1031,6 +998,39 @@ static int rcsi2_get_active_lanes(struct rcar_csi2 *priv,
> return 0;
> }
>
> +static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
> + unsigned int lanes)
> +{
> + struct media_pad *remote_pad;
> + struct v4l2_subdev *source;
> + s64 freq;
> + u64 mbps;
> +
> + if (!priv->remote)
> + return -ENODEV;
> +
> + source = priv->remote;
> + remote_pad = &source->entity.pads[priv->remote_pad];
> +
> + freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
> + if (freq < 0) {
> + int ret = (int)freq;
> +
> + dev_err(priv->dev, "failed to get link freq for %s: %d\n",
> + source->name, ret);
> +
> + return ret;
> + }
> +
> + mbps = div_u64(freq * 2, MEGA);
> +
> + /* Adjust for C-PHY, divide by 2.8. */
> + if (priv->cphy)
> + mbps = div_u64(mbps * 5, 14);
> +
> + return mbps;
> +}
> +
> static int rcsi2_start_receiver_gen3(struct rcar_csi2 *priv,
> struct v4l2_subdev_state *state)
> {
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675695-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 093A641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:05:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id BAD333B0A0F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:05:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2962328750A;
Fri, 6 Jun 2025 12:05:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Z5TOs/oA";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="u29dhi7p"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 DDCED1E25ED
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:05:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211528; cv=fail; b=gsA5ZWG42PlkbSvMkzxDJcJObX3L0bQN6BboX+AqiO4Ok/gM5AyOK75A7vefOqh8GrjwKOUsdgEHKPSpHpQrRospWwOm3qVkqU9Eujh78dIssvgq0qabybr44kJdsXul+d08t9sfCiGmsL6W1GB70HVFsN4R+29ZIOSOcIjY3+s=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211528; c=relaxed/simple;
bh=8vM3kRxGRNjql0E93wTcZblKVyW0ouBdkNvHwnMXm5o=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=j57fsZXAdrM97LKmNqFvpHMtfkQlb/O3bsHwRveLa62voAuTLLaablpCQXZ5GVWYAvS8rgGwt+F5CDIPsRpcbLlNWKZLR2SvwUYIpj60zGVtvRgi8+wCcLvKvFg4xF3QhSqLb4G1CmpBIkZY++LIQHR6x3DtCiLeXSnhzEenegc=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Z5TOs/oA; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=u29dhi7p; arc=fail smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246631.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NFKC031650;
Fri, 6 Jun 2025 12:05:14 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=P7mBmyIvf8s04x5GwM
yrCyGFH486bw8jXpw1k+wGajY=; b=Z5TOs/oAiFQKmpS1EmhsOV3orAI0T6R9uE
rsbfiWyRI4pTYTOdiT/KfvY6rxZgOx06N1pIOny0UJ4lfXssgB76ai+uD7/SXdu6
ttRoIBe9PMMVt/h5f4oyFA8SteknbfYGYvT+PDCjrLVc36FdTCynuwdkOBVm3mUC
rv8L+MPiIi3CvCmSiL7Ul7PKSrsoGLGBG1DEGcCTV8Ok6r94QQ64ITs3p9afsYLO
yCDNPC0FIRkEpKV+gcEM97L0xX+aMSq99Yn2Cx/WwJuSTYruY7qFUMRrnGIEbONE
J5093ve6DjN/vHpb9Cp76uem8ww7BQ7i4u8dHAKxFcv8d+FuZseg==
Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8dyw97-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 12:05:14 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556BjZl4034599;
Fri, 6 Jun 2025 12:05:13 GMT
Received: from cy4pr05cu001.outbound.protection.outlook.com (mail-westcentralusazon11010001.outbound.protection.outlook.com [40.93.198.1])
by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7d72u3-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 12:05:13 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=UZZuxsJcIE2RrHnAt9F6jF7jG3aiX+nUWUOWGhFxz18M3fOaDJgDAB3RNoLA6Pr/ftYmbLbSQ4f0z5+PAo3I83V7OMoFV1jQLtmHpcIqPe2Cr3E5Nz1TM8dZl31R/Q7b2ZXENKQFSSZYkQi/o1p5fAdJs/JD8ZjFHHCsXsH2rhtj0WvV6Gol2NGvOu7sNxKa70JAsqZTQLlOesbwFFv173O1E2DhzOFz9nj+dcA+dmpdKSVhTyp86g7E3kuPx62PveMgOotVUEja+8FglJdZ5AtUjkJ7M8WwtlhsZEkVTWPsA/KKQDlfXTeh8EP7X106NQIJ6xi2kqaW/tSFJlBFZw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=P7mBmyIvf8s04x5GwMyrCyGFH486bw8jXpw1k+wGajY=;
b=cbf2Ss0dJLHsBDcP42InKq8UtQ9kU79N+XqpthKB6Kt0hJrhKCy03FXOjRm6ogOentPW9EkcwobvrcyVUHV9E93KsG8d1ZvXlK8dGX7RloyuympsClA56CCZqGV6bDfQtXiZW4drbQgnXlpSPBqiDnXrZrdM4/ulxpZMSrPaZtt91ii1fhfoyrtBbAT/QMnn8CHKvckFIXnWqWBm/drfm2afHXA8ZxGjr+c29NAnad3viq0qR/Gm1dVYRCHt+sajiUwR8Pa/b0kwzmj9i8ERy4rjoZZYfIXzK59IldKQYpj/bgX3NPokbIUT47KqlldwpdVwiLp7oD2M6w3kG1velQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=P7mBmyIvf8s04x5GwMyrCyGFH486bw8jXpw1k+wGajY=;
b=u29dhi7ppzCrxIEb4SgsKrV6VBS3nAIPsawWR2E3x9ifCmAxjhsa0su10qUz7L9H3h2E+u/ZvpAWW/NOUYJF7QsrRuS5b3VifWlRlDCjHL4p2vXz9EUZ72VE/4NGZdpYa7Xc3yikBhT4fgRGZ+/Uu1aX+UIAtGNQOam8AS8EcjY=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by CH0PR10MB5131.namprd10.prod.outlook.com (2603:10b6:610:c6::24) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.20; Fri, 6 Jun
2025 12:05:10 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
12:05:10 +0000
Date: Fri, 6 Jun 2025 13:05:08 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: syzbot <syzbot+d16409ea9ecc16ed261a@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: Liam.Howlett@xxxxxxxxxx, akpm@xxxxxxxxxxxxxxxxxxxx,
brad.spengler@xxxxxxxxxxxxxx, jannh@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, pfalcato@xxxxxxx,
syzkaller-bugs@xxxxxxxxxxxxxxxx, vbabka@xxxxxxx
Subject: Re: [syzbot] [mm?] WARNING in vma_modify
Message-ID: <e6e71e0b-347b-4edb-b558-b502f55a637d@lucifer.local>
References: <6842cc67.a00a0220.29ac89.003b.GAE@xxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <6842cc67.a00a0220.29ac89.003b.GAE@xxxxxxxxxx>
X-ClientProxiedBy: LO4P123CA0340.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:18c::21) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|CH0PR10MB5131:EE_
X-MS-Office365-Filtering-Correlation-Id: e5326af3-996c-45ac-eadd-08dda4f262fc
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?QaIuEZlGwHT4VCwDB722A83HPVvkxIoFCcw0VolJyW7q/5ViQRmtooSUZqgA?=
=?us-ascii?Q?C2rOX5i1lt/LwwUFGGt1icVfpDc3AS8Tv7ttFAmwJlmuD0VrbMWvZEb6kAzZ?=
=?us-ascii?Q?HQdmj5kgosqreAfGG1QO73e+q1sr2qJrVN39Pqe31Qr9FnEII9L4pzpVQVor?=
=?us-ascii?Q?gV54k1MF+Q+RDY35luyh/XOQNxAqgU2P5frpau956Q4ZVzMeO2N3f0hjvRN3?=
=?us-ascii?Q?1N4FL8jhaiNstrFevQHlVy67tplNzniZ2QP8QgMOdp/MKlWRUH3x1pCVTYtx?=
=?us-ascii?Q?yiaxyndE8mLTGQjTdpkbLTPxEfXGPX9rtN/8pogFmhdK2h0KpVwOfXIwibsd?=
=?us-ascii?Q?A8XO4QIcLxmnNgWuJv3o6/6lSf4gBP63WrQnZVvFdSHxogKd1CvfkTszN+hP?=
=?us-ascii?Q?v+pqNdQ45l2uiiRcMpZ2dyMiVPfdJn6wFcT1AazHjj4t3/tUdTW0S9y8nfrN?=
=?us-ascii?Q?a1b88oLd2gghFoKQJowgJhgWYqvJQsRFrmFLyE4G9uhbE7WMOR68Ynf2U25k?=
=?us-ascii?Q?z0r1nkNe/glfCzFsK6YN6WjS0cm7l3NcCUEZFwHpZBo6D5rBtYLmVJTRbJEX?=
=?us-ascii?Q?xdtQHc9s1LOvmUN2563FbpNsxkvkKMDLwBHS8UKG1G9o3gmvJv732DkYsfNo?=
=?us-ascii?Q?FaRH7lC7nDMXKrclj5V7GE586wUfbYk9krj4dvR9jJx0YWo0dyoSPHnIsLOe?=
=?us-ascii?Q?OhuqHfyuMXS9v0HCl5oaDh855zkSaYwKziF4UmZzzktP8k+43KtxddH9NHKI?=
=?us-ascii?Q?8kybFefPAPjshgaRZDa3TmU3G8tQPWa8+uvlBVM1refptrTOItf+r7VfgWE8?=
=?us-ascii?Q?QyvfdycIPuv/CaZBz7DhqjvamD23RQ3x73pwWaHqgonJv7aMaSQ1Qwe0Sci0?=
=?us-ascii?Q?4nJZLGkYM+BiQTMjPChsa1H2QxU6R94ea8wfS38uTy0Rnwa+nxF5hqfNuev+?=
=?us-ascii?Q?ZHIpqGM80mwv8jrmK9DrWiBc9hNd2dysvvGR63I8IViLO2pOU7UjcQInf/yc?=
=?us-ascii?Q?QRO8xmqoKf33VLzYaNhpAxncrJF+S+f+UQ2KajATNIeP7Wdu4ox07JIXsxJI?=
=?us-ascii?Q?6t24y7Js9tMPLQ62AZ17bOmN/aoSHd4wE3/Wc0dzkuD5idLPcufJs7aq+IiZ?=
=?us-ascii?Q?Qlqyu/x9xAluXsYHcdHCAxKSEuAacpV1fzTGKXkgmgRGg2BVrJ/I4zR/pm5b?=
=?us-ascii?Q?PdXLd7XbW16xIwuCfs/B2gFdYaEZ+Fzv8Y3jelGSQ+qmBsK5HLa+kgXXfsNI?=
=?us-ascii?Q?C6L6125rbnMaLCabhOXIKahxznxNQs7sgQ+yJ10cjzr/6nniFxsxvitOLnCH?=
=?us-ascii?Q?UvjMzm0hiiVMeTrj4hkGASswgaaz1/7EsNv/hACWbQkb1JVvrzDry0aNTnRH?=
=?us-ascii?Q?9k9IpMBqjidO0qEI1dphb8LDiovM?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?rDCl6M9zWhwmhrkk9xzjxBIHc+aadhbD/DqmOEmUvM7YrbWwOCoa3rmLg5CH?=
=?us-ascii?Q?wETaaQ0cJvlM1k3B81TJtXYLAJPrC+hUvxsN6gRWsODwGOqrQKg4Xl+epXYs?=
=?us-ascii?Q?Fgl2WLOkrfhE30THX89m6mDfGrMNPBx+3IsbFu60v5lCGgGpO76aSdQvHlKQ?=
=?us-ascii?Q?XogOwsRSPlUJ0qG/kAByDuzlOksO/+YjfRUezgEaWEsvwn6+mhJaJzRHH9yo?=
=?us-ascii?Q?bmmdgacVXGNxZBJGh4JgZXXUd2lXlzh9tJru/Q4UQpvd/51JZbcIuSSGnqmJ?=
=?us-ascii?Q?gqdEOd+O7LdHduhsGx51Oip3wzUZ8yY/JhxduGAmYYK2qqZK3BuDOBumKzqm?=
=?us-ascii?Q?C7fJR5na7Rn1c5wsQT1/eC8+sMC9xu92qfbLBjhrvxe2kND/aekCkcG/l+tS?=
=?us-ascii?Q?myDUBXIi4jBkbofjSQ5aiM3MCHa1H98sY0caeZG9fmHI57dBuF7tOiyvZ1AE?=
=?us-ascii?Q?vuBu4HiLs43mAiJ8dwJVtueyPw2SJi+Xljq/n872lnggmf2ko/KWIOBHKE6x?=
=?us-ascii?Q?uEl2Rmrlhf/xaxGzKrFZW7mxZeuOVdAjq7wf1hUBA496w3R+tMa/iq04GzvP?=
=?us-ascii?Q?TaBpvqXvbxkTO1iO1uGSGGxaattVyomabgzJGTzlHrDrMVLBM0HkjZHOhzcw?=
=?us-ascii?Q?xQcTf2nrauB0B7S+6827h9+SWAryc6IvrdgbgYIcfpOgBG3o5t19GROJZH3m?=
=?us-ascii?Q?SP2pJrKuX/tvP/5w9pA0C7kkk3vjTUgh7c5asYGCoHqimazpEwSgB1NCUkKB?=
=?us-ascii?Q?9JZPtJ50nOt1PegVEktblFiniZDqGNqklL9RbDRB4iTV92S8aj2d+HxF7tif?=
=?us-ascii?Q?feaFUJX5hAl1TgNDHglBH+WUk/pwDrWhia33XHZm+i7Wz1gJMUkXPgH0TWpt?=
=?us-ascii?Q?Cl/9ZfMRNmOITojW8IMd6np+G/ItP2vnPk45/p6nQbofqxvr0gtZIUTgEInz?=
=?us-ascii?Q?a20tyYG7xH6nazVrXNYpGgdqtwj6YoLzQR7I1jaJv8o3eHov+18Gcj1oPKky?=
=?us-ascii?Q?BEfBkrFNku7XHGXrBGTRLEaWFqDBPAjPH7Hz5axbK4khy7g7FiZmn7wVEIuS?=
=?us-ascii?Q?B9jbs2m63LnVgChze3Z0Pb9rWDcDogoMNHrg0f1THxPchG8gb9NY7+EPL0/0?=
=?us-ascii?Q?SOFFQK+GTOz/Q7/AAQA75QRX009t4i7vPvbRJI5RQhpf9MCCh1Emni05BDeD?=
=?us-ascii?Q?neHc+SF/WuppYGnCqxRgFMcOQ0ZmNtRjvt9rpH5OnsGmuXcS/zbvYBUUk5Ed?=
=?us-ascii?Q?6Z0LBlncTuapgaRPE46GQDmluOkbzvfp4vrYKh6i1m7ZwpFXMlQ6tO9HeSZB?=
=?us-ascii?Q?3ouphBCJnBfwH7NvXTMrEnEuFOYuwY5yp+Gmr+i+kJTCm7fQMCSzjy4bEvsQ?=
=?us-ascii?Q?/fH1+cVb3jota+Kj92pMgwNrXsGC+feu4l+i7lm0skj/+1WJM3Rgpp2h0BA2?=
=?us-ascii?Q?UnX8j0+w7T6pqiKI73DF4OukssKuB60ww2iCrRF2dbRq0Qr3aVw+2ubHXX9t?=
=?us-ascii?Q?HOvwC2Lty2amM7Sc8LkcFAAtuCK6J8W3yHC7sNt16pS/Iy+8PFQOWJyu2N5r?=
=?us-ascii?Q?G7rnlvJ20vHXtaNjHGISWS8178dxQ2ODmf/cLrRIN0bb+VLFdYOyBwH+s3NH?=
=?us-ascii?Q?4g=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
gYIK5Ep+s+2JwPVcb446S/b0CVyEggUPPK2ELMNtOK2V9b9X3E/bwH54Kr0NviQHSAovF9lSkNx8GjotALLC2G0X51xPtKELfcjF4BtjBf/PHbEc4a++iGoNwN6gKz0iAOO11OKP5/jA393ztDnf3Lhs/lyek7CsLWHHwF1pAkGY8YfmAZ1s/9/C2yTGWSSy0RxrFjOr+nralfnj+fECepIw2I8ap3p4Fulvcl5IkLLEuDT78YshT8iWZ2cPaeEiv3jh3PyEcpFFrm1QwKMMU+eoFIjD5X/VcV2dvOngZf8X6cEceZZv1t6WSi89A2FowR21kN9/nF8dEUjnTLal25Vm9pWDbAOHL9o1OyZ+l7IaUvgPppWPdbuuYz8pZ14W3JulrdPbSMzp9Hnzbvy4moSD7LZK3CM8JLIGC27TwafbAdelo4iWv3+1ZVvhzFodKv5BlBRNzaRQW7JSMuLozXCIou4tuRTlbWHwYd9RBBOOzKDajACVQ9nWGYmBoHa6zqxJybrM4fcpyRxVxMe3fLXUAu8tnKFuedvSJ0aYvKrSmnciDblUwkqX7IcDRQ+eIKrH2DOn6EGiDUO8uXUhSdhaS4qKk7gxC+hgIxNyUyg=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: e5326af3-996c-45ac-eadd-08dda4f262fc
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 12:05:10.7226
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: UTrcfeI4zSLGyNAHIBpk8rNKQz1hEzfm8MXziWZ7z0RtAV5WL0HO904x47W1Uj+XtD/o54EptdLhWheiorl+3qAIhUgHdwWwC1Jw2GOeN0k=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5131
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-06_03,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 bulkscore=0
mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 adultscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060108
X-Authority-Analysis: v=2.4 cv=Va/3PEp9 c=1 sm=1 tr=0 ts=6842d97a b=1 cx=c_pps a=qoll8+KPOyaMroiJ2sR5sw==:117 a=qoll8+KPOyaMroiJ2sR5sw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=edf1wS77AAAA:8 a=3g80flMcAAAA:8 a=oHvirCaBAAAA:8 a=yPCof4ZbAAAA:8 a=hSkVLCK3AAAA:8 a=4RBUngkUAAAA:8 a=GgtC0AtW7QVaeDaU40oA:9
a=BhMdqm2Wqc4Q2JL7t0yJfBCtM/Y=:19 a=CjuIK1q_8ugA:10 a=vVHabExCe68A:10 a=DcSpbTIhAlouE1Uv7lRv:22 a=3urWGuTZa-U-TZ_dHwj2:22 a=cQPPKAXgyycSBL8etih5:22 a=_sbA2Q-Kp09kWB8D3iXc:22 cc=ntf awl=host:13207
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEwOCBTYWx0ZWRfX+TP+7r8Et1pB gquAk32rBxpbr3EbPcbGQylz9v82+1+cZ2tcJOess63EnMyvSAtFCsu1uuwuQMHqjoJ2K3hQvNP 2M04S29Wu3fx/YQtYyjZRFVoT20z+FMmcsVvAfBwbglXBoJKH++fSrX5ZaJE+VbKDKRHvmCzE16
MtdOFWgYDCNDA2bKJYcLc+e5nB1Yid/MSlabTP8HEyGS/6XHuCqbMwfoj1n6NF1MHjvZzpm1GY0 3j6NeHVMMx+HdHRVXhR6WH6RFbXQZzYInsixMkk/Yo/Vb9sk8RQ1JZ4Y5UwYQnIJMfn8fGV3eTY k3kNctvkbgs2L0PxfMF1X1ttqqbB1bSwc+r7pRtwq60dgvw/i4ks2hPaC/Y00xAyqJEmjB08fH+
/pPOp0bvBc4s9fb+ViJhbMf/vEJkEuYJVqHqelVihYezbIVvg6T0mcAcuvjUUQ3ma5CGNzxO
X-Proofpoint-ORIG-GUID: UlxvPVEyUZSxtqTCm3OaGXoK2SkIhg5l
X-Proofpoint-GUID: UlxvPVEyUZSxtqTCm3OaGXoK2SkIhg5l
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 04:09:27AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:

Thanks.

This is because of the never-really-possible-in-pratice 'too small to fail'
preallocation issue that logic in vma_modify() addresses (a fault injection
makes this possible, however).

It stems from mlockall(), which is doing a loop of the below in
apply_mlockall_flags():

for_each_vma(vmi, vma) {
...

error = mlock_fixup(&vmi, vma, &prev, vma->vm_start, vma->vm_end,
newflags);
/* Ignore errors, but prev needs fixing up. */
if (error)
prev = vma;
...
}

However, in the fault-injected path in question in vma_merge_existing_range() we
have an inconsistency - in the case that an abort occurs due to duplication of
anon_vma data, we execute this branch:

abort:
vma_iter_set(vmg->vmi, start);
vma_iter_load(vmg->vmi);

But in the case here, where commit_merge() fails, we do not:

if (err) {
VM_WARN_ON(err != -ENOMEM);

if (anon_dup)
unlink_anon_vmas(anon_dup);

/*
* We've cleaned up any cloned anon_vma's, no VMAs have been
* modified, no harm no foul if the user requests that we not
* report this and just give up, leaving the VMAs unmerged.
*/
if (!vmg->give_up_on_oom)
vmg->state = VMA_MERGE_ERROR_NOMEM;
return NULL;
}

So this means that the iterator, which will have been set to the prior VMA prior
to this failure occurring (since wre're trying to merge with prev here), doesn't
get changed.

So in the mlockall loop, we set prev = vma, then advance to the next VMA, which
is vma (since the iterator was set to the VMA prior to vma), then we are
essentially trying to merge with ourselves... whoops!

This triggers the assert:

VM_WARN_ON_VMG(prev && start <= prev->vm_start, vmg);

Which is why this report occurred.

The solution is to consistently reset the VMA iterator in this case, I'll send a
patch for this in a second, I've tested this and it fixes it locally.

Thanks, Lorenzo

>
> HEAD commit: cd2e103d57e5 Merge tag 'hardening-v6.16-rc1-fix1-take2' of..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=107c7970580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6acfdd5e5c8ef3d0
> dashboard link: https://syzkaller.appspot.com/bug?extid=d16409ea9ecc16ed261a
> compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10d3f00c580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13c781d4580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/4f3c020d1cfe/disk-cd2e103d.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/f67c698d4603/vmlinux-cd2e103d.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/4a3974b951f8/bzImage-cd2e103d.xz
>
> The issue was bisected to:
>
> commit 47b16d0462a460000b8f05dfb1292377ac48f3ca
> Author: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Date: Sat Feb 22 16:19:52 2025 +0000
>
> mm: abort vma_modify() on merge out of memory failure
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15b5580c580000
> final oops: https://syzkaller.appspot.com/x/report.txt?x=17b5580c580000
> console output: https://syzkaller.appspot.com/x/log.txt?x=13b5580c580000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+d16409ea9ecc16ed261a@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: 47b16d0462a4 ("mm: abort vma_modify() on merge out of memory failure")
>
> 7f83ee71a000-7f83ee71ffff: ffff8880117713c0
> 7f83ee720000-7fff07f51fff: 0000000000000000
> 7fff07f52000-7fff07f72fff: ffff88801182e500
> 7fff07f73000-ffffffffffffffff: 0000000000000000
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 5825 at mm/vma.c:808 vma_merge_existing_range mm/vma.c:808 [inline]

This is

VM_WARN_ON_VMG(prev && start <= prev->vm_start, vmg);

See analysis above.

> WARNING: CPU: 1 PID: 5825 at mm/vma.c:808 vma_modify+0x1540/0x1970 mm/vma.c:1604
> Modules linked in:
> CPU: 1 UID: 0 PID: 5825 Comm: syz-executor396 Not tainted 6.15.0-syzkaller-10820-gcd2e103d57e5 #0 PREEMPT(full)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> RIP: 0010:vma_merge_existing_range mm/vma.c:808 [inline]
> RIP: 0010:vma_modify+0x1540/0x1970 mm/vma.c:1604
> Code: 0b 90 e9 9a ed ff ff e8 4e 56 ab ff 90 0f 0b 90 e9 a3 ec ff ff e8 40 56 ab ff 4c 89 f7 48 c7 c6 20 8c 96 8b e8 f1 05 f3 ff 90 <0f> 0b 90 e9 4c ed ff ff e8 23 56 ab ff e9 4f ee ff ff e8 19 56 ab
> RSP: 0018:ffffc90003797b38 EFLAGS: 00010286
> RAX: ffffffff8b5d28cd RBX: ffff8880246ea780 RCX: ffff88802c93bc00
> RDX: 0000000000000000 RSI: ffffffffffffffff RDI: ffffffffffffffff
> RBP: 0000200000000000 R08: ffffc900037976a7 R09: 1ffff920006f2ed4
> R10: dffffc0000000000 R11: fffff520006f2ed5 R12: 0000200000000000
> R13: ffffc90003797c60 R14: ffffc90003797c40 R15: 1ffff920006f2f8c
> FS: 0000555582b74380(0000) GS:ffff888125d5f000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 000055c124e6b168 CR3: 000000007547b000 CR4: 0000000000350ef0
> Call Trace:
> <TASK>
> vma_modify_flags+0x1e8/0x230 mm/vma.c:1645
> mlock_fixup+0x22a/0x360 mm/mlock.c:483
> apply_mlockall_flags+0x2f0/0x3c0 mm/mlock.c:736
> __ia32_sys_munlockall+0x10a/0x220 mm/mlock.c:782
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f83ee6a76a9
> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007fff07f72138 EFLAGS: 00000246 ORIG_RAX: 0000000000000098
> RAX: ffffffffffffffda RBX: 00007fff07f72150 RCX: 00007f83ee6a76a9
> RDX: 00007f83ee6a68e0 RSI: 00007fff07f72150 RDI: 00007fff07f72150
> RBP: 0000000000000001 R08: 00007fff07f71ed7 R09: 00000000000000a0
> R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
> R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
> </TASK>
>
>
> ---
> This report is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.
>
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection
>
> If the report is already addressed, let syzbot know by replying with:
> #syz fix: exact-commit-title
>
> If you want syzbot to run the reproducer, reply with:
> #syz test: git://repo/address.git branch-or-commit-hash
> If you attach or paste a git patch, syzbot will apply it before testing.
>
> If you want to overwrite report's subsystems, reply with:
> #syz set subsystems: new-subsystem
> (See the list of subsystem names on the web dashboard)
>
> If the report is a duplicate of another one, reply with:
> #syz dup: exact-subject-of-another-report
>
> If you want to undo deduplication, reply with:
> #syz undup


Return-Path: <linux-kernel+bounces-675696-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7AD9A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:05:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id E3C29188B814
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C11B528750B;
Fri, 6 Jun 2025 12:05:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="ZejPF38a"
Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E4262874E7
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:05:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211544; cv=none; b=tObzMBlECd7G7fW01IgRkUtOkDDUtZ4ae7tV1GY4lpLiDCKr1f6cupem2Jr85hHKSGjsw4fjaiRZ+vu6ZEAMEedTbYzLeYjlBv+P1DP42cxjfLriYMSJRI6U5wDTY51PVaO3H9+F2H6sNCqA/a1fCnyA4KmhDeJpJRB+PiyWgAg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211544; c=relaxed/simple;
bh=pw5DxZusOl5EtI/08fej6vFmQVNmSEMstPXZfIOtxuk=;
h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=hhT0yKTotVY4VlBBlvJRYYOtBZ23QTJSkofJBpW6f7Fx5fYrpthJgsMurIaJ8U6gtnyljxSBdsRCM+gWLYSv3cws73d00c+8T7D0twMwF9ldC8dM7iz+YakVeFhu45Zmxr61sjdcKvSLIqruj2kfrGRDsY1G8Rzm9LmrFoqKmSc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=ZejPF38a; arc=none smtp.client-ip=209.85.208.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com
Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-606b39b19b6so333739a12.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:05:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=suse.com; s=google; t=1749211540; x=1749816340; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:subject:cc:to:from:date:from:to:cc:subject:date
:message-id:reply-to;
bh=blUSLQmy9t7rc+yhzKuamiyJu/iQaaFL9KW6gmT2m2A=;
b=ZejPF38a0LqdVW5/zknx/22KqHXfdBq7g//umrB2TA9L5St/eYMe78bXc/x78Xy5N0
J16ZJCaK+xqUnmasqNlkiUNswBlzvtpD/qUpWk6bMXNWZLygWOKozueAdGOrqb2CeJdo
7h1HNScLvL/yqZACikq/cA/F44dH9Krerw6R23ZrBCugzsOZgzP/uqAglYsa494ohvuL
JEjU+ys5rCcDadQUzfdgTQ0vMYCMTgrwY7ggSTLakfMy/lR3NwmXQT/X34EOLvIG7SaQ
X5q4ME2BQqBUwd4wXiyrUtqmj1pIcIqdR1+3M9TQQcf7Iu/+rsK/qUZBwKER45/r92Wj
cqKw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749211540; x=1749816340;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=blUSLQmy9t7rc+yhzKuamiyJu/iQaaFL9KW6gmT2m2A=;
b=T8qSZmZ302OT3e7BA07XMw5x85ZgNNDqncUHNSYh92sde+QukMsgfNSi3RJbiX9noc
sGdpaZfbKM6xG9DwbXMDyZmeEKBrXtv9/wZPoqmKqCMe9neIncUZXcVYoyCCKdm5a1dN
WqZpC/ppZjPbA0XeauA9AoK9LwaSsG5+BGeGQH6uEkTbFXtZzcA8YM4TNEVh8ox6+S9y
i45C9dOe3VypTeNn1bfp82zSC43r+Qlw/ulAl3jXfOfZmQMIacVQBW1wna6jOFJtUooF
F8mMJlF4u22gO0hb676dMcog1RqZ6zvqDhGi8ANeRZa8G7l0W4jAVhwkIX47/lPW7Uj0
cUQQ==
X-Gm-Message-State: AOJu0YwPtClahZSLMgMFdAwMcTeJ14ZErshf1CRCvlGG52uCT/Scj22H
wq91YMsuwnL3Uoq+aQ4CyMITTuyd2Hla/3ENtzrWx7Qww4pH9yOujHdAJVAhnh+K4Ms=
X-Gm-Gg: ASbGncvaCdwt+3nynCNQl+FlnJby59iBqZpxK7c9wkBmGA4PzkAaxWGUDPQ8irtkGVx
emqP4H0PnS0ukYuFAhaN05BgKzTpuGpUyblukV1fvntl4rN7RM/IVR5pi2ameHW/UfqZFb9ROWV
Jbp0iNZ1r5N4jbSWKOGu073lmC3cmaDKOckePQnxFAmXcgg9Tl31iZWPSCOy6ibq/PiBNdOmDH2
Vi7leGkP8icwYR1nPPQCCvUwvWIvzTLTs8M+XKA7fjlDBpsX/nI/BKJFeE/IHnvT3HLagM2Oxzy
anK9UvQT7MJlFNdGiGR77KSb85DPR1snu3w6WznWVBaA4lJT4q8XpTN+3gsjKkvABmoAbarhjjL
4wOBwHygRHF3Bne8C4FLf6crNsK+Ckzi1/wZWywHzHknGcp7H+l4KqPAB
X-Google-Smtp-Source: AGHT+IFEWMIzPeLiuWhp169aIeLqFwqJdP4I0BLMQjvCWLHGJqq5NI3ba8l22k9bFyc8ukNwi499Gg==
X-Received: by 2002:a17:907:3c8c:b0:adb:2dc9:ad4 with SMTP id a640c23a62f3a-ade1ab952f9mr87524366b.14.1749211539636;
Fri, 06 Jun 2025 05:05:39 -0700 (PDT)
Received: from mordecai.tesarici.cz (dynamic-2a00-1028-83b8-1e7a-3010-3bd6-8521-caf1.ipv6.o2.cz. [2a00:1028:83b8:1e7a:3010:3bd6:8521:caf1])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1db54c3esm106606666b.39.2025.06.06.05.05.39
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 05:05:39 -0700 (PDT)
Date: Fri, 6 Jun 2025 14:05:28 +0200
From: Petr Tesarik <ptesarik@xxxxxxxx>
To: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>, Frederic Weisbecker
<frederic@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] timers/migration: remove an unneeded call to
find_first_bit()
Message-ID: <20250606140528.2b17567f@xxxxxxxxxxxxxxxxxxxx>
In-Reply-To: <20250530132539.234792-1-ptesarik@xxxxxxxx>
References: <20250530132539.234792-1-ptesarik@xxxxxxxx>
X-Mailer: Claws Mail 4.3.1 (GTK 3.24.50; x86_64-suse-linux-gnu)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 30 May 2025 15:25:39 +0200
Petr Tesarik <ptesarik@xxxxxxxx> wrote:

> Use simple bit arithmetic to extract the least significant bit from the
> active bitmask, because the bit position is not needed, only the bit
> itself.

There has been no reply here, but I received an out-of-band
recommendation to wrap this bit-twiddling trick in a macro.

So, you can ignore this patch for now and wait for a respin after I
add the macro and convert pre-existing uses in the kernel.

Petr T

> No functional change.
>
> Signed-off-by: Petr Tesarik <ptesarik@xxxxxxxx>
> ---
> kernel/time/timer_migration.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
> index 2f6330831f08..0f40727b6cac 100644
> --- a/kernel/time/timer_migration.c
> +++ b/kernel/time/timer_migration.c
> @@ -1277,12 +1277,12 @@ static bool tmigr_inactive_up(struct tmigr_group *group,
> * group is idle!
> */
> if (!childstate.active) {
> - unsigned long new_migr_bit, active = newstate.active;
> + u8 active = newstate.active;
>
> - new_migr_bit = find_first_bit(&active, BIT_CNT);
> + if (active) {
> + u8 lsbit = active & -active;
>
> - if (new_migr_bit != BIT_CNT) {
> - newstate.migrator = BIT(new_migr_bit);
> + newstate.migrator = lsbit;
> } else {
> newstate.migrator = TMIGR_NONE;
>



Return-Path: <linux-kernel+bounces-675697-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7FFB341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:06:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5A0603B18EB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:05:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 429722882BC;
Fri, 6 Jun 2025 12:05:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="guLQZWdw"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 C3A9E2874E9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:05:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211552; cv=none; b=mXEZLV2+o0yU1q84XENNscRd71T3NgXDpfTtroJGnETOrCWVCrQ6JtruYyWUfubT0u9jJnYiKsljy11QfFBUURcAd4QfIZc3ivY/hUGaqzetB2MIVf/pgXmmUhWmUnNhUSyt54QsbHwQTkqzun11ZDUzaKxJb3gH9eQi+pqkrgs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211552; c=relaxed/simple;
bh=CV4a4KGuH728yQyPWaLKgsNTM75BrIPl2zVZKUa7l2A=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=gyBFkL70Z/tLFUCdqH2Bno5hEMBiiXEvAahygj3I2IbVPjfi/nCwjI78GbhiiL+Jmk22D54DYWiIUTzJEMpcJfonzxzMnMsnP+LmSNxLAcj9GVGVp3vS5u7888kZVaz8Ch4yNXLBJVKJxi2JZxaH8vF5VlFnm8AGazu4ZHBeZIk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=guLQZWdw; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211549;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=/tweG0MISrWmVqbzzxaipvMQBJhW3IG/hseCw+v/QAo=;
b=guLQZWdwgPTDp1CE68wVCdF3Vaa/sPbBu3e1Wcr9hlY7JADJBBylPMhNYnMKB6/Qam9gRj
wj5wL6Gfi2VdQTlS/1lxLYAJiyPXrLiF2ZPPOIUQPUauP+JYH1meardf95UI4ZaWKMj/dd
PkwWNdUhnJSUSE4FaK7N0NKBIImQOHg=
Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com
(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-226-MDInHr2wNf-wmBmIOyt2Kw-1; Fri,
06 Jun 2025 08:05:43 -0400
X-MC-Unique: MDInHr2wNf-wmBmIOyt2Kw-1
X-Mimecast-MFC-AGG-ID: MDInHr2wNf-wmBmIOyt2Kw_1749211540
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3AFC318003FC;
Fri, 6 Jun 2025 12:05:40 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4CA5618002A5;
Fri, 6 Jun 2025 12:05:32 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 0/9] drm/i915: Add drm_panic support
Date: Fri, 6 Jun 2025 13:48:04 +0200
Message-ID: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This is a draft of drm_panic support for i915.

I've tested it on the 4 intel laptops I have at my disposal.
* Haswell with 128MB of eDRAM.
* Comet Lake i7-10850H
* Raptor Lake i7-1370P (with DPT, and Y-tiling).
* Lunar Lake Ultra 5 228V (with DPT, and 4-tiling, and using the Xe driver.

I tested panic in both fbdev console and gnome desktop.

Best regards,

v2:
* Add the proper abstractions to build also for Xe.
* Fix dim checkpatch issues.

v3:
* Add support for Y-tiled framebuffer when DPT is enabled.

v4:
* Add support for Xe driver, which shares most of the code.
* Add support for 4-tiled framebuffer found in newest GPU.

v5:
* Rebase on top of git@xxxxxxxxxxxxxxxxxxxxxx:drm/i915/kernel.git drm-intel-next
* Use struct intel_display instead of drm_i915_private.
* Use iosys_map for intel_bo_panic_map().

v6:
* Rebase on top of git@xxxxxxxxxxxxxxxxxxxxxx:drm/i915/kernel.git drm-intel-next
* Use struct intel_display instead of drm_i915_private for intel_atomic_plane.c

v7:
* Fix mismatch {} in intel_panic_flush() (Jani Nikula)
* Return int for i915_gem_object_panic_map() (Ville Syrjälä)
* Reword commit message about alignment/size when disabling tiling (Ville Syrjälä)*

v8:
* Use kmap_try_from_panic() instead of vmap, to access the framebuffer.
* Add ttm_bo_kmap_try_from_panic() for the xe driver, that uses ttm.
* Replace intel_bo_panic_map() with a setup() and finish() function,
to allow mapping only one page of teh framebuffer at a time.
* Configure psr to send the full framebuffer update.

Jocelyn Falempe (9):
drm/i915/fbdev: Add intel_fbdev_get_map()
drm/i915/display/i9xx: Add a disable_tiling() for i9xx planes
drm/i915/display: Add a disable_tiling() for skl planes
drm/ttm: Add ttm_bo_kmap_try_from_panic()
drm/i915: Add intel_bo_panic_setup and intel_bo_panic_finish
drm/i915/display: Add drm_panic support
drm/i915/display: Add drm_panic support for Y-tiling with DPT
drm/i915/display: Add drm_panic support for 4-tiling with DPT
drm/i915/psr: Add intel_psr2_panic_force_full_update

drivers/gpu/drm/i915/display/i9xx_plane.c | 23 +++
.../gpu/drm/i915/display/intel_atomic_plane.c | 169 +++++++++++++++++-
drivers/gpu/drm/i915/display/intel_bo.c | 12 ++
drivers/gpu/drm/i915/display/intel_bo.h | 4 +
.../drm/i915/display/intel_display_types.h | 2 +
drivers/gpu/drm/i915/display/intel_fb_pin.c | 5 +
drivers/gpu/drm/i915/display/intel_fb_pin.h | 2 +
drivers/gpu/drm/i915/display/intel_fbdev.c | 5 +
drivers/gpu/drm/i915/display/intel_fbdev.h | 6 +-
drivers/gpu/drm/i915/display/intel_psr.c | 20 +++
drivers/gpu/drm/i915/display/intel_psr.h | 2 +
.../drm/i915/display/skl_universal_plane.c | 27 +++
drivers/gpu/drm/i915/gem/i915_gem_object.h | 5 +
drivers/gpu/drm/i915/gem/i915_gem_pages.c | 109 +++++++++++
drivers/gpu/drm/i915/i915_vma.h | 5 +
drivers/gpu/drm/ttm/ttm_bo_util.c | 27 +++
drivers/gpu/drm/xe/display/intel_bo.c | 61 +++++++
drivers/gpu/drm/xe/display/xe_fb_pin.c | 5 +
include/drm/ttm/ttm_bo.h | 1 +
19 files changed, 488 insertions(+), 2 deletions(-)


base-commit: 7247efca0dcbc8ac6147db9200ed1549c0662465
--
2.49.0



Return-Path: <linux-kernel+bounces-675698-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 94FFB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:06:13 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B1729173A33
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6906C287507;
Fri, 6 Jun 2025 12:06:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EJICvPO+"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 D6F41288502
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:05:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211561; cv=none; b=iYWqfGHC0yTzC3LrZnyyiIavh77FMtKPQZrSsc86DVIy7ObeHsDfY9OJJ9hrHdINcn2CkZV1LR1lEKnim2qhq9x0OxjGm+ziKTqDWx17+eP32hWRT5pbcLwPI43KCzAo+qBlLj/HGzwu88Lw59gMyV2ezEfLGrXdqrSKUQPk78E=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211561; c=relaxed/simple;
bh=ZyUHJK8E9KfN3/ahCH3y7p+3sEISjtxi7gtR12w3ZUA=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=TwFvSnbNvUtej3+ptdnuOFYe7S7+n/svrHr8yOJfddti6SR4Zcjel8Z98dnGK2pvdBlin1lWFpbnxFp7uneXGiYbj9nKX4vCZ5yyzPMW3Es6wnW7JwU2IiVetVqmmEBN6HLyKYrH1uccHFFWAqWL3y6xXDECEf7pxC3PTNEMEu8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=EJICvPO+; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211558;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=7zgUFcNjP45KVFN7fvEt+xKxva7ecAlvU3lfLilVE+Q=;
b=EJICvPO+iybMkK+nB6Ub67ZgW3HlRNZk/JmBdJ4lZyaDQuJxgkC98Ys7BjrtZjdC0SOVtx
25oglDsxXWXZzTXayEYJMfiqtMrar2K2SauooPNGVlTDa/L+79IArt2C4eV+9oQzu58HcZ
Bi28EtS6NNtOdqSlpVrYzEsBzhiAtfA=
Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com
(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-399-P-GhgdoFNSuMb05AmqCiKA-1; Fri,
06 Jun 2025 08:05:52 -0400
X-MC-Unique: P-GhgdoFNSuMb05AmqCiKA-1
X-Mimecast-MFC-AGG-ID: P-GhgdoFNSuMb05AmqCiKA_1749211549
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3B3B6180045B;
Fri, 6 Jun 2025 12:05:49 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BA96A18003FD;
Fri, 6 Jun 2025 12:05:40 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 1/9] drm/i915/fbdev: Add intel_fbdev_get_map()
Date: Fri, 6 Jun 2025 13:48:05 +0200
Message-ID: <20250606120519.753928-2-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The vaddr of the fbdev framebuffer is private to the struct
intel_fbdev, so this function is needed to access it for drm_panic.
Also the struct i915_vma is different between i915 and xe, so it
requires a few functions to access fbdev->vma->iomap.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---

v2:
* Add intel_fb_get_vaddr() and i915_vma_get_iomap() to build with Xe driver.

v4:
* rename to get_map(), and return the struct iosys_map mapping.
* implement the Xe variant.

drivers/gpu/drm/i915/display/intel_fb_pin.c | 5 +++++
drivers/gpu/drm/i915/display/intel_fb_pin.h | 2 ++
drivers/gpu/drm/i915/display/intel_fbdev.c | 5 +++++
drivers/gpu/drm/i915/display/intel_fbdev.h | 6 +++++-
drivers/gpu/drm/i915/i915_vma.h | 5 +++++
drivers/gpu/drm/xe/display/xe_fb_pin.c | 5 +++++
6 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.c b/drivers/gpu/drm/i915/display/intel_fb_pin.c
index 98a61a7b0b93..b792e9b062d8 100644
--- a/drivers/gpu/drm/i915/display/intel_fb_pin.c
+++ b/drivers/gpu/drm/i915/display/intel_fb_pin.c
@@ -334,3 +334,8 @@ void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state)
intel_dpt_unpin_from_ggtt(fb->dpt_vm);
}
}
+
+void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map)
+{
+ iosys_map_set_vaddr_iomem(map, i915_vma_get_iomap(vma));
+}
diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.h b/drivers/gpu/drm/i915/display/intel_fb_pin.h
index 01770dbba2e0..81ab79da1af7 100644
--- a/drivers/gpu/drm/i915/display/intel_fb_pin.h
+++ b/drivers/gpu/drm/i915/display/intel_fb_pin.h
@@ -12,6 +12,7 @@ struct drm_framebuffer;
struct i915_vma;
struct intel_plane_state;
struct i915_gtt_view;
+struct iosys_map;

struct i915_vma *
intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
@@ -27,5 +28,6 @@ void intel_fb_unpin_vma(struct i915_vma *vma, unsigned long flags);
int intel_plane_pin_fb(struct intel_plane_state *new_plane_state,
const struct intel_plane_state *old_plane_state);
void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state);
+void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map);

#endif
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 2dc4029d71ed..7c4709d58aa3 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -512,3 +512,8 @@ struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev)
{
return fbdev ? fbdev->vma : NULL;
}
+
+void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map)
+{
+ intel_fb_get_map(fbdev->vma, map);
+}
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h b/drivers/gpu/drm/i915/display/intel_fbdev.h
index a15e3e222a0c..150cc5f45bb3 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.h
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.h
@@ -13,6 +13,7 @@ struct drm_fb_helper_surface_size;
struct intel_display;
struct intel_fbdev;
struct intel_framebuffer;
+struct iosys_map;

#ifdef CONFIG_DRM_FBDEV_EMULATION
int intel_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
@@ -22,7 +23,7 @@ int intel_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
void intel_fbdev_setup(struct intel_display *display);
struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev);
-
+void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map);
#else
#define INTEL_FBDEV_DRIVER_OPS \
.fbdev_probe = NULL
@@ -39,6 +40,9 @@ static inline struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev
return NULL;
}

+static inline void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map)
+{
+}
#endif

#endif /* __INTEL_FBDEV_H__ */
diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
index 6a6be8048aa8..4ae610927fa7 100644
--- a/drivers/gpu/drm/i915/i915_vma.h
+++ b/drivers/gpu/drm/i915/i915_vma.h
@@ -353,6 +353,11 @@ static inline bool i915_node_color_differs(const struct drm_mm_node *node,
return drm_mm_node_allocated(node) && node->color != color;
}

+static inline void __iomem *i915_vma_get_iomap(struct i915_vma *vma)
+{
+ return READ_ONCE(vma->iomap);
+}
+
/**
* i915_vma_pin_iomap - calls ioremap_wc to map the GGTT VMA via the aperture
* @vma: VMA to iomap
diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index 461ecdfdb742..ac9a5ba363b2 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -465,3 +465,8 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma)
{
return 0;
}
+
+void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map)
+{
+ *map = vma->bo->vmap;
+}
--
2.49.0



Return-Path: <linux-kernel+bounces-675699-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5D4D841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:06:32 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 1270A189DA7A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C8C22882CD;
Fri, 6 Jun 2025 12:06:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SjukdsKV"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 4A03B288539
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211565; cv=none; b=qaKTvVL4PvzAFfomKea6yxcc95Aa101ASR/NM9hCNdruDHc0bsG/vzrmjrVrFzO9DzZmXsXyGE8KZAPLoHdXFBf+Iddz7+6aTsFn0XXTVasH84iEQ+FsCaD/h69PrzbNVD+WM78CI0Jjh96tN3+Y1NGs8545oF9JPg28AcMvGzo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211565; c=relaxed/simple;
bh=p5isBJgmKl8C9BvUwJH+E8fY5sCG+iCNeIWxK6spo1c=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=KEgjYiodk1nftNWUGr4rnYeOv6Xn/sfX+mG9r8WT6I7oxEWNp0gbl+pAtMD+DTiB4S4NBLATeH/1UEDz/zxDacUM5eaMF1SVTIDM7mTVYtzBGfuZ23m4+7sejJwPMBWMVd7LS1cIw2K564yFzmFVhF/C3BmN6FnqjkSQuPsWa1s=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SjukdsKV; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211563;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=SE4yLfs+tmSJMV3+0jxUQ5+2HoU5En7sT23L/AjgM7I=;
b=SjukdsKVwubDSnLLnMkFWmfOCClMh/UM5iRigP75F5OBpC0LBbvE0PNdxynsVV2Sf8XSLs
/pbXXSsJRcv4p/3jgxFousGEtFJ2clYsI8rAgL63ze55592e1LHMfsoCzklWS8pzBGurB/
VbxGhiaLKnMQr8VkcFLMM9gzc5YT9ss=
Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com
(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-486-svAeglVxMNelhOsnVVuV8g-1; Fri,
06 Jun 2025 08:05:59 -0400
X-MC-Unique: svAeglVxMNelhOsnVVuV8g-1
X-Mimecast-MFC-AGG-ID: svAeglVxMNelhOsnVVuV8g_1749211556
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6FE4A1800773;
Fri, 6 Jun 2025 12:05:56 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 358D918002A5;
Fri, 6 Jun 2025 12:05:49 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 2/9] drm/i915/display/i9xx: Add a disable_tiling() for i9xx planes
Date: Fri, 6 Jun 2025 13:48:06 +0200
Message-ID: <20250606120519.753928-3-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

drm_panic draws in linear framebuffer, so it's easier to re-use the
current framebuffer, and disable tiling in the panic handler, to show
the panic screen.
This assumes that the alignment restriction is always smaller in
linear than in tiled.
It also assumes that the linear framebuffer size is always smaller
than the tiled.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---

v7:
* Reword commit message about alignment/size when disabling tiling (Ville Syrjälä)

drivers/gpu/drm/i915/display/i9xx_plane.c | 23 +++++++++++++++++++
.../drm/i915/display/intel_display_types.h | 2 ++
2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c
index a2a6d52be0a5..b183270bf934 100644
--- a/drivers/gpu/drm/i915/display/i9xx_plane.c
+++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
@@ -903,6 +903,27 @@ static const struct drm_plane_funcs i8xx_plane_funcs = {
.format_mod_supported_async = intel_plane_format_mod_supported_async,
};

+static void i9xx_disable_tiling(struct intel_plane *plane)
+{
+ struct intel_display *display = to_intel_display(plane);
+ enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
+ u32 dspcntr;
+ u32 reg;
+
+ dspcntr = intel_de_read_fw(display, DSPCNTR(display, i9xx_plane));
+ dspcntr &= ~DISP_TILED;
+ intel_de_write_fw(display, DSPCNTR(display, i9xx_plane), dspcntr);
+
+ if (DISPLAY_VER(display) >= 4) {
+ reg = intel_de_read_fw(display, DSPSURF(display, i9xx_plane));
+ intel_de_write_fw(display, DSPSURF(display, i9xx_plane), reg);
+
+ } else {
+ reg = intel_de_read_fw(display, DSPADDR(display, i9xx_plane));
+ intel_de_write_fw(display, DSPADDR(display, i9xx_plane), reg);
+ }
+}
+
struct intel_plane *
intel_primary_plane_create(struct intel_display *display, enum pipe pipe)
{
@@ -1045,6 +1066,8 @@ intel_primary_plane_create(struct intel_display *display, enum pipe pipe)
}
}

+ plane->disable_tiling = i9xx_disable_tiling;
+
modifiers = intel_fb_plane_get_modifiers(display, INTEL_PLANE_CAP_TILING_X);

if (DISPLAY_VER(display) >= 5 || display->platform.g4x)
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index ed4d743fc7c5..3654d88e9c5f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1517,6 +1517,8 @@ struct intel_plane {
bool async_flip);
void (*enable_flip_done)(struct intel_plane *plane);
void (*disable_flip_done)(struct intel_plane *plane);
+ /* For drm_panic */
+ void (*disable_tiling)(struct intel_plane *plane);
};

#define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base)
--
2.49.0



Return-Path: <linux-kernel+bounces-675700-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 787A041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:06:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B7EA51790C9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8819C288537;
Fri, 6 Jun 2025 12:06:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HhwP6uRP"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 29F0E288538
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211572; cv=none; b=ETKPmf+M65LlUG+kwx6QX60ReAn+tm0nUsK5v3u8MHA5HIsTNgNje2czUHBR9+kykBswXvN1EhKi0KcYzbZYUTvKx9QjC9OG9s3NDhJfPN9rUtwevT5HEzUop2F7fowYvOVEfbIMQMgfxy6ntuoGNl8N+BWnZl/9ge0TFj6w4wI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211572; c=relaxed/simple;
bh=J106FO0fiVsdh9zXFS0LOxsLt2GsSFvwk862Ry5I9ok=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=gH9dzg0jYaHrSBtaLGc1/yA/j+pVuGSjTR3YZrj9aKCxhBP44Ott3OiM0CoMkBTQ7C5YQrtYD+Usfp0rArCbic3Il1c+Qvl4Bg3/td50f9Szcaxxer+5kNtUnAs8ZJwwyZSIiSo/h3jliT0mEIZ316aAjblDdvX7iL24PEttuGM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HhwP6uRP; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211570;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=FTTN7phXKaXaCmL5oHxlSPISQmHyCcHScf0EMG0hRFc=;
b=HhwP6uRPlwT8C7x/6ZU7HyDHHxEFuPPuZUzqA1GtfBN/sxDBaAU+ACdCnKw5gKK+Iiy3Zz
21K19hhiUHj0rKEgy7KoPcz3NWsKjnC3xxZVuopS1ELJZEgnfdAftorbXZUGRLfv/rcN2d
omHdCCwBtOi5kh3J9Jb8UODKc6VhdHk=
Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com
(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-86-OWhFJ6N8OmKmUd8G9WGDbg-1; Fri,
06 Jun 2025 08:06:04 -0400
X-MC-Unique: OWhFJ6N8OmKmUd8G9WGDbg-1
X-Mimecast-MFC-AGG-ID: OWhFJ6N8OmKmUd8G9WGDbg_1749211562
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3A7FF1800871;
Fri, 6 Jun 2025 12:06:02 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EE2C318002A5;
Fri, 6 Jun 2025 12:05:56 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 3/9] drm/i915/display: Add a disable_tiling() for skl planes
Date: Fri, 6 Jun 2025 13:48:07 +0200
Message-ID: <20250606120519.753928-4-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

drm_panic draws in linear framebuffer, so it's easier to re-use the
current framebuffer, and disable tiling in the panic handler, to show
the panic screen.

This assumes that the alignment restriction is always smaller in
linear than in tiled.
It also assumes that the linear framebuffer size is always smaller
than the tiled.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---

v7:
* Reword commit message about alignment/size when disabling tiling (Ville Syrjälä)

.../drm/i915/display/skl_universal_plane.c | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index c7b336359a5e..ffcf50443c0c 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -2791,6 +2791,25 @@ static u8 tgl_plane_caps(struct intel_display *display,
return caps;
}

+static void skl_disable_tiling(struct intel_plane *plane)
+{
+ struct intel_plane_state *state = to_intel_plane_state(plane->base.state);
+ struct intel_display *display = to_intel_display(plane);
+ u32 stride = state->view.color_plane[0].scanout_stride / 64;
+ u32 plane_ctl;
+
+ plane_ctl = intel_de_read(display, PLANE_CTL(plane->pipe, plane->id));
+ plane_ctl &= ~PLANE_CTL_TILED_MASK;
+
+ intel_de_write_fw(display, PLANE_STRIDE(plane->pipe, plane->id),
+ PLANE_STRIDE_(stride));
+
+ intel_de_write_fw(display, PLANE_CTL(plane->pipe, plane->id), plane_ctl);
+
+ intel_de_write_fw(display, PLANE_SURF(plane->pipe, plane->id),
+ skl_plane_surf(state, 0));
+}
+
struct intel_plane *
skl_universal_plane_create(struct intel_display *display,
enum pipe pipe, enum plane_id plane_id)
@@ -2837,6 +2856,7 @@ skl_universal_plane_create(struct intel_display *display,
plane->max_height = skl_plane_max_height;
plane->min_cdclk = skl_plane_min_cdclk;
}
+ plane->disable_tiling = skl_disable_tiling;

if (DISPLAY_VER(display) >= 13)
plane->max_stride = adl_plane_max_stride;
--
2.49.0



Return-Path: <linux-kernel+bounces-675701-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6FF1F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:06:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 491F83A2D9D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E3434288524;
Fri, 6 Jun 2025 12:06:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dyJJ/CT1"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 9D948288517
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211581; cv=none; b=IQWbrs6t84Epa0OE4qvd2583jU0aWrw14cIsGr48RF7YN9KqeYuOuax6z1h6mxhAUOdGPA2SRbsEh6z1iloHy7rMsrGlZ7WNZhrxoPiIu8w47kTWfh22SQ/lz7QWHihu+QpaWnSgviH90qXodznk6780153XhC/7cdz8cYo+XEM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211581; c=relaxed/simple;
bh=YChnwPKjQ5Co6nll2v+KEbNjJtvS29A9fQfFAOtkapE=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=dBzj4pCu7/zRuLNtrKC6I8GirlU911OcXcawEmUEmJSefpBZ5hvataHlIHsN4/m7vusA0cH7Lsj72Nb0JA2Uul3SAN1IqcBB5uJgovJzRrQQHn33OjTvnqyGM3zQv48wcg8gQyhdZooJuZR35+5Dp56OZEdrmi8F1JtZSA8j9fM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dyJJ/CT1; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211577;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=P3qImNDgs5IKpXU7/qApHixAm6FFP9iiOGE/4sAcQeA=;
b=dyJJ/CT1LWOcr3OvGA6oddBFyWh6fBfSNYw44DqUW/3N0YHyPhfFCKKL/Hppda99IcdhBg
9RP27HPs3VGrEjhjCG/TIvqhI6taNxBrcAI0q1uFXvl9MEsfs6cWvQz8eTQOqGr7Fzmbb6
kYT+S1ON+HWaDYvZAShtXQVpUq4QkOQ=
Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com
(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-toXoOkylOterjQg5xUPlQg-1; Fri,
06 Jun 2025 08:06:14 -0400
X-MC-Unique: toXoOkylOterjQg5xUPlQg-1
X-Mimecast-MFC-AGG-ID: toXoOkylOterjQg5xUPlQg_1749211572
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 09DBC1800EC5;
Fri, 6 Jun 2025 12:06:12 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B9DA718003FD;
Fri, 6 Jun 2025 12:06:02 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 4/9] drm/ttm: Add ttm_bo_kmap_try_from_panic()
Date: Fri, 6 Jun 2025 13:48:08 +0200
Message-ID: <20250606120519.753928-5-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

If the ttm bo is backed by pages, then it's possible to safely kmap
one page at a time, using kmap_try_from_panic().
Unfortunately there is no way to do the same with ioremap, so it
only supports the kmap case.
This is needed for proper drm_panic support with xe driver.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---

v8:
* Added in v8

drivers/gpu/drm/ttm/ttm_bo_util.c | 27 +++++++++++++++++++++++++++
include/drm/ttm/ttm_bo.h | 1 +
2 files changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 15cab9bda17f..9c3f3b379c2a 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -377,6 +377,33 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,
return (!map->virtual) ? -ENOMEM : 0;
}

+/**
+ *
+ * ttm_bo_kmap_try_from_panic
+ *
+ * @bo: The buffer object
+ * @page: The page to map
+ *
+ * Sets up a kernel virtual mapping using kmap_local_page_try_from_panic().
+ * This can safely be called from the panic handler, if you make sure the bo
+ * is the one being displayed, so is properly allocated, and won't be modified.
+ *
+ * Returns the vaddr, that you can use to write to the bo, and that you should
+ * pass to kunmap_local() when you're done with this page, or NULL if the bo
+ * is in iomem.
+ */
+void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page)
+{
+ if (page + 1 > PFN_UP(bo->resource->size))
+ return NULL;
+
+ if (!bo->resource->bus.is_iomem && bo->ttm->pages && bo->ttm->pages[page])
+ return kmap_local_page_try_from_panic(bo->ttm->pages[page]);
+
+ return NULL;
+}
+EXPORT_SYMBOL(ttm_bo_kmap_try_from_panic);
+
/**
* ttm_bo_kmap
*
diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
index cf027558b6db..8c0ce3fa077f 100644
--- a/include/drm/ttm/ttm_bo.h
+++ b/include/drm/ttm/ttm_bo.h
@@ -429,6 +429,7 @@ int ttm_bo_init_validate(struct ttm_device *bdev, struct ttm_buffer_object *bo,
int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
unsigned long num_pages, struct ttm_bo_kmap_obj *map);
void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
+void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page);
int ttm_bo_vmap(struct ttm_buffer_object *bo, struct iosys_map *map);
void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct iosys_map *map);
int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo);
--
2.49.0



Return-Path: <linux-kernel+bounces-675702-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1713741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:07:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 6100A189DA6D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:07:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 65951288526;
Fri, 6 Jun 2025 12:06:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Es386YUI"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 9381D2882CD
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211594; cv=none; b=SIUZtJTAc7id16+SFttNXKFTR5kEvDOidHfmVBwbPgUl9eH6odd1myLQTTgiMQukAhypevPplOqUVMm5KYx/NZ08wwmZ0cF5GG+xyI0Jn1jLe3K8wFgspGpcPsqzQMpPSHsPvyARbr0qm73zLCdd8IQfnLlbXWbvcMH2yvgdK6o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211594; c=relaxed/simple;
bh=n5acZZkmSqIXAvjWkjYTFVqJaLn0apCicfOWTCJYD2c=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=O3/G/N2VnWco8KqdhIJr2314KzIv6J8rWNgGO33/qbO9SdSvterv8GkKpY2TYWZDUlaMI9P25/e2WjbjACiSLKugngKSuBQ+L62r1ZJYbgYmXr3/Dj9fhoETqDmnke2+Vc8tU4TFWlJNEAlo74X5Ufp+bAe/PqAurnikUU34rWs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Es386YUI; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211591;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=deJBe+dw+c7pFRTX7PwmH5oQvdEyNmO/6Njb6mekRlc=;
b=Es386YUI5JMKtHlaSF/dEWXEG3+H1HTqgKsc3ZVF4aF7QpnqzVJshizML4w5GVMTjswGx3
hcDnjK34uqxswu/yQF4Vc/OQe5OEiX9Zbd+HfxzZsQ+Eh9JfcLhxht3ytho3QYnVMluMMT
zifNH1FpjJRIHf+pxnTzxwhQBXX5gSo=
Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com
(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-uOIuhcEuONG7YWYwCyin-Q-1; Fri,
06 Jun 2025 08:06:28 -0400
X-MC-Unique: uOIuhcEuONG7YWYwCyin-Q-1
X-Mimecast-MFC-AGG-ID: uOIuhcEuONG7YWYwCyin-Q_1749211586
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0A6F91800772;
Fri, 6 Jun 2025 12:06:26 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ED5CD18002A5;
Fri, 6 Jun 2025 12:06:19 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 5/9] drm/i915: Add intel_bo_panic_setup and intel_bo_panic_finish
Date: Fri, 6 Jun 2025 13:48:09 +0200
Message-ID: <20250606120519.753928-6-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Implement both functions for i915 and xe, they prepare the work for
drm_panic support.
They both use kmap_try_from_panic(), and map one page at a time, to
write the panic screen on the framebuffer.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---


v5:
* Use iosys_map for intel_bo_panic_map().

v7:
* Return int for i915_gem_object_panic_map() (Ville Syrjälä)

v8:
* Complete rewrite, to use kmap_try_from_panic() which is safe
to call from a panic handler

drivers/gpu/drm/i915/display/intel_bo.c | 11 +++
drivers/gpu/drm/i915/display/intel_bo.h | 3 +
drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 +
drivers/gpu/drm/i915/gem/i915_gem_pages.c | 92 ++++++++++++++++++++++
drivers/gpu/drm/xe/display/intel_bo.c | 55 +++++++++++++
5 files changed, 165 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_bo.c b/drivers/gpu/drm/i915/display/intel_bo.c
index fbd16d7b58d9..83dbd8ae16fe 100644
--- a/drivers/gpu/drm/i915/display/intel_bo.c
+++ b/drivers/gpu/drm/i915/display/intel_bo.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
/* Copyright © 2024 Intel Corporation */

+#include <drm/drm_panic.h>
#include "gem/i915_gem_mman.h"
#include "gem/i915_gem_object.h"
#include "gem/i915_gem_object_frontbuffer.h"
@@ -57,3 +58,13 @@ void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj)
{
i915_debugfs_describe_obj(m, to_intel_bo(obj));
}
+
+int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb)
+{
+ return i915_gem_object_panic_setup(to_intel_bo(obj), sb);
+}
+
+void intel_bo_panic_finish(struct drm_gem_object *obj)
+{
+ return i915_gem_object_panic_finish(to_intel_bo(obj));
+}
diff --git a/drivers/gpu/drm/i915/display/intel_bo.h b/drivers/gpu/drm/i915/display/intel_bo.h
index ea7a2253aaa5..9ac087ea275d 100644
--- a/drivers/gpu/drm/i915/display/intel_bo.h
+++ b/drivers/gpu/drm/i915/display/intel_bo.h
@@ -4,6 +4,7 @@
#ifndef __INTEL_BO__
#define __INTEL_BO__

+#include <drm/drm_panic.h>
#include <linux/types.h>

struct drm_gem_object;
@@ -23,5 +24,7 @@ struct intel_frontbuffer *intel_bo_set_frontbuffer(struct drm_gem_object *obj,
struct intel_frontbuffer *front);

void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj);
+int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb);
+void intel_bo_panic_finish(struct drm_gem_object *obj);

#endif /* __INTEL_BO__ */
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
index c34f41605b46..9a0c1019dcad 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
@@ -9,6 +9,7 @@
#include <drm/drm_gem.h>
#include <drm/drm_file.h>
#include <drm/drm_device.h>
+#include <drm/drm_panic.h>

#include "intel_memory_region.h"
#include "i915_gem_object_types.h"
@@ -691,6 +692,9 @@ i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj)
int __i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
int i915_gem_object_truncate(struct drm_i915_gem_object *obj);

+int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct drm_scanout_buffer *sb);
+void i915_gem_object_panic_finish(struct drm_i915_gem_object *obj);
+
/**
* i915_gem_object_pin_map - return a contiguous mapping of the entire object
* @obj: the object to map into kernel address space
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index 7f83f8bdc8fb..9bdbac3d9433 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -3,6 +3,7 @@
* Copyright © 2014-2016 Intel Corporation
*/

+#include <drm/drm_panic.h>
#include <drm/drm_cache.h>
#include <linux/vmalloc.h>

@@ -354,6 +355,97 @@ static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
return vaddr ?: ERR_PTR(-ENOMEM);
}

+static struct page **i915_panic_pages;
+static int i915_panic_page = -1;
+static void *i915_panic_vaddr;
+
+static void i915_panic_kunmap(void)
+{
+ if (i915_panic_vaddr) {
+ drm_clflush_virt_range(i915_panic_vaddr, PAGE_SIZE);
+ kunmap_local(i915_panic_vaddr);
+ i915_panic_vaddr = NULL;
+ }
+}
+
+static struct page **i915_gem_object_panic_pages(struct drm_i915_gem_object *obj)
+{
+ unsigned long n_pages = obj->base.size >> PAGE_SHIFT, i;
+ struct page *page;
+ struct page **pages;
+ struct sgt_iter iter;
+
+ pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_ATOMIC);
+ if (!pages)
+ return NULL;
+
+ i = 0;
+ for_each_sgt_page(page, iter, obj->mm.pages)
+ pages[i++] = page;
+ return pages;
+}
+
+/*
+ * The scanout buffer pages are not mapped, so for each pixel,
+ * use kmap_local_page_try_from_panic() to map the page, and write the pixel.
+ * Try to keep the map from the previous pixel, to avoid too much map/unmap.
+ */
+static void i915_gem_object_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int x,
+ unsigned int y, u32 color)
+{
+ unsigned int new_page;
+ unsigned int offset;
+
+ offset = y * sb->pitch[0] + x * sb->format->cpp[0];
+
+ new_page = offset >> PAGE_SHIFT;
+ offset = offset % PAGE_SIZE;
+ if (new_page != i915_panic_page) {
+ i915_panic_kunmap();
+ i915_panic_page = new_page;
+ i915_panic_vaddr = kmap_local_page_try_from_panic(
+ i915_panic_pages[i915_panic_page]);
+ }
+ if (i915_panic_vaddr) {
+ u32 *pix = i915_panic_vaddr + offset;
+ *pix = color;
+ }
+}
+
+/*
+ * Setup the gem framebuffer for drm_panic access.
+ * Use current vaddr if it exists, or setup a list of pages.
+ * pfn is not supported yet.
+ */
+int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct drm_scanout_buffer *sb)
+{
+ enum i915_map_type has_type;
+ void *ptr;
+
+ ptr = page_unpack_bits(obj->mm.mapping, &has_type);
+ if (ptr) {
+ if (i915_gem_object_has_iomem(obj))
+ iosys_map_set_vaddr_iomem(&sb->map[0], (void __iomem *)ptr);
+ else
+ iosys_map_set_vaddr(&sb->map[0], ptr);
+
+ return 0;
+ }
+ if (i915_gem_object_has_struct_page(obj)) {
+ i915_panic_pages = i915_gem_object_panic_pages(obj);
+ sb->set_pixel = i915_gem_object_panic_page_set_pixel;
+ i915_panic_page = -1;
+ return 0;
+ }
+ return -EOPNOTSUPP;
+}
+
+void i915_gem_object_panic_finish(struct drm_i915_gem_object *obj)
+{
+ i915_panic_kunmap();
+ i915_panic_page = -1;
+}
+
/* get, pin, and map the pages of the object into kernel space */
void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
enum i915_map_type type)
diff --git a/drivers/gpu/drm/xe/display/intel_bo.c b/drivers/gpu/drm/xe/display/intel_bo.c
index 27437c22bd70..eb9a3400c110 100644
--- a/drivers/gpu/drm/xe/display/intel_bo.c
+++ b/drivers/gpu/drm/xe/display/intel_bo.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
/* Copyright © 2024 Intel Corporation */

+#include <drm/drm_cache.h>
#include <drm/drm_gem.h>

#include "xe_bo.h"
@@ -59,3 +60,57 @@ void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj)
{
/* FIXME */
}
+
+static int xe_panic_page = -1;
+static void *xe_panic_vaddr;
+static struct xe_bo *xe_panic_bo;
+
+static void xe_panic_kunmap(void)
+{
+ if (xe_panic_vaddr) {
+ drm_clflush_virt_range(xe_panic_vaddr, PAGE_SIZE);
+ kunmap_local(xe_panic_vaddr);
+ xe_panic_vaddr = NULL;
+ }
+}
+/*
+ * The scanout buffer pages are not mapped, so for each pixel,
+ * use kmap_local_page_try_from_panic() to map the page, and write the pixel.
+ * Try to keep the map from the previous pixel, to avoid too much map/unmap.
+ */
+static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int x,
+ unsigned int y, u32 color)
+{
+ unsigned int new_page;
+ unsigned int offset;
+
+ offset = y * sb->pitch[0] + x * sb->format->cpp[0];
+
+ new_page = offset >> PAGE_SHIFT;
+ offset = offset % PAGE_SIZE;
+ if (new_page != xe_panic_page) {
+ xe_panic_kunmap();
+ xe_panic_page = new_page;
+ xe_panic_vaddr = ttm_bo_kmap_try_from_panic(&xe_panic_bo->ttm,
+ xe_panic_page);
+ }
+ if (xe_panic_vaddr) {
+ u32 *pix = xe_panic_vaddr + offset;
+ *pix = color;
+ }
+}
+
+int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb)
+{
+ struct xe_bo *bo = gem_to_xe_bo(obj);
+
+ xe_panic_bo = bo;
+ sb->set_pixel = xe_panic_page_set_pixel;
+ return 0;
+}
+
+void intel_bo_panic_finish(struct drm_gem_object *obj)
+{
+ xe_panic_kunmap();
+ xe_panic_page = -1;
+}
--
2.49.0



Return-Path: <linux-kernel+bounces-675703-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2B75C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:07:20 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 8F862189D46E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:07:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B852F288C0E;
Fri, 6 Jun 2025 12:06:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ACTtunib"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 55699288C03
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211600; cv=none; b=Sz07PSnj64QQW+qoqKkCyoBK2F5gPPh23ZEjaQrFfcbsEH3j4mp8lcCU/XtuPomLCw5Twa7Zxke1+531qo2M08d261Tu52EU+LekDsQYksa2QrTsEvufM9twj9IZ8wBrwfKt2ZYBB6HzglOTMkMZ1zF147SeLCVf0C5wamb5cnM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211600; c=relaxed/simple;
bh=d0NeN53su8ioXaqjOGqs3gVnHafvkQwqIunyTqjRyWA=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=MCjvSk5WGkc532ndzi4y/V/4i7X65hi8q2UNOJFc5q6WD9vsENx3UKsLU+6ybDjcEXP7nFM7hSdpucDmAZNzX1Yzwdmf/QflKLSUOUefwlBstYdNcdpR2AmnKX1zStQVLaUWybDlgQUjEmVPhat6hKpnDTp3nh3xAoPyjyAv7yU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ACTtunib; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211597;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=B4m0uXh7ddZwHt+uVxXuE/IoAj2YeRhsEOnH3V3GUbE=;
b=ACTtunib30pLYCcShk8hfACKggwl8wsVIyWKibL6GJKeuPBW7ItMH2HF14FQzLN6mTMnDW
A2cDU0idpsWb4LLkVIweo4TPPmiO9wldxEWG2lRMQ7+FjSCukk5/OmSuYSiaOb6hRe0jy0
vLs0XVHUSZ6TmJsyMp+IKw55edIOA2U=
Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-267-Cbm_UEj0POiIadNY1W1Rtg-1; Fri,
06 Jun 2025 08:06:34 -0400
X-MC-Unique: Cbm_UEj0POiIadNY1W1Rtg-1
X-Mimecast-MFC-AGG-ID: Cbm_UEj0POiIadNY1W1Rtg_1749211592
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DAD1719560B0;
Fri, 6 Jun 2025 12:06:31 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8240918003FD;
Fri, 6 Jun 2025 12:06:26 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 6/9] drm/i915/display: Add drm_panic support
Date: Fri, 6 Jun 2025 13:48:10 +0200
Message-ID: <20250606120519.753928-7-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This adds drm_panic support for a wide range of Intel GPU. I've
tested it only on 4 laptops, Haswell (with 128MB of eDRAM),
Comet Lake, Raptor Lake, and Lunar Lake.
For hardware using DPT, it's not possible to disable tiling, as you
will need to reconfigure the way the GPU is accessing the
framebuffer, so this will be handled by the following patches.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---

v4:
* Add support for Xe driver.

v6:
* Use struct intel_display instead of drm_i915_private for intel_atomic_plane.c

v7:
* Fix mismatch {} in intel_panic_flush() (Jani Nikula)

v8:
* Use intel_bo_panic_setup() and intel_bo_panic_finish().

.../gpu/drm/i915/display/intel_atomic_plane.c | 82 ++++++++++++++++++-
1 file changed, 81 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 15ede7678636..4095d69924db 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -33,19 +33,23 @@

#include <linux/dma-fence-chain.h>
#include <linux/dma-resv.h>
+#include <linux/iosys-map.h>

#include <drm/drm_atomic_helper.h>
#include <drm/drm_blend.h>
#include <drm/drm_damage_helper.h>
+#include <drm/drm_cache.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_gem.h>
#include <drm/drm_gem_atomic_helper.h>
+#include <drm/drm_panic.h>

#include "gem/i915_gem_object.h"
#include "i915_scheduler_types.h"
#include "i915_vma.h"
#include "i9xx_plane_regs.h"
#include "intel_atomic_plane.h"
+#include "intel_bo.h"
#include "intel_cdclk.h"
#include "intel_cursor.h"
#include "intel_display_rps.h"
@@ -53,6 +57,7 @@
#include "intel_display_types.h"
#include "intel_fb.h"
#include "intel_fb_pin.h"
+#include "intel_fbdev.h"
#include "skl_scaler.h"
#include "skl_universal_plane.h"
#include "skl_watermark.h"
@@ -1266,14 +1271,89 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
intel_plane_unpin_fb(old_plane_state);
}

+
+static void intel_panic_flush(struct drm_plane *plane)
+{
+ struct intel_plane_state *plane_state = to_intel_plane_state(plane->state);
+ struct intel_plane *iplane = to_intel_plane(plane);
+ struct intel_display *display = to_intel_display(iplane);
+ struct drm_framebuffer *fb = plane_state->hw.fb;
+ struct drm_gem_object *obj;
+
+ obj = intel_fb_bo(fb);
+
+ intel_bo_panic_finish(obj);
+
+ /* Flush the cache and don't disable tiling if it's the fbdev framebuffer.*/
+ if (to_intel_framebuffer(fb) == intel_fbdev_framebuffer(display->fbdev.fbdev)) {
+ struct iosys_map map;
+
+ intel_fbdev_get_map(display->fbdev.fbdev, &map);
+ drm_clflush_virt_range(map.vaddr, fb->pitches[0] * fb->height);
+ return;
+ }
+
+ if (fb->modifier && iplane->disable_tiling)
+ iplane->disable_tiling(iplane);
+}
+
+static int intel_get_scanout_buffer(struct drm_plane *plane,
+ struct drm_scanout_buffer *sb)
+{
+ struct intel_plane_state *plane_state;
+ struct drm_gem_object *obj;
+ struct drm_framebuffer *fb;
+ struct intel_display *display = to_intel_display(plane->dev);
+
+ if (!plane->state || !plane->state->fb || !plane->state->visible)
+ return -ENODEV;
+
+ plane_state = to_intel_plane_state(plane->state);
+ fb = plane_state->hw.fb;
+ obj = intel_fb_bo(fb);
+ if (!obj)
+ return -ENODEV;
+
+ if (to_intel_framebuffer(fb) == intel_fbdev_framebuffer(display->fbdev.fbdev)) {
+ intel_fbdev_get_map(display->fbdev.fbdev, &sb->map[0]);
+ } else {
+ int ret;
+ /* Can't disable tiling if DPT is in use */
+ if (intel_fb_uses_dpt(fb))
+ return -EOPNOTSUPP;
+ ret = intel_bo_panic_setup(obj, sb);
+ if (ret)
+ return ret;
+ }
+ sb->width = fb->width;
+ sb->height = fb->height;
+ /* Use the generic linear format, because tiling, RC, CCS, CC
+ * will be disabled in disable_tiling()
+ */
+ sb->format = drm_format_info(fb->format->format);
+ sb->pitch[0] = fb->pitches[0];
+
+ return 0;
+}
+
static const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
.prepare_fb = intel_prepare_plane_fb,
.cleanup_fb = intel_cleanup_plane_fb,
};

+static const struct drm_plane_helper_funcs intel_primary_plane_helper_funcs = {
+ .prepare_fb = intel_prepare_plane_fb,
+ .cleanup_fb = intel_cleanup_plane_fb,
+ .get_scanout_buffer = intel_get_scanout_buffer,
+ .panic_flush = intel_panic_flush,
+};
+
void intel_plane_helper_add(struct intel_plane *plane)
{
- drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
+ if (plane->base.type == DRM_PLANE_TYPE_PRIMARY)
+ drm_plane_helper_add(&plane->base, &intel_primary_plane_helper_funcs);
+ else
+ drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
}

void intel_plane_init_cursor_vblank_work(struct intel_plane_state *old_plane_state,
--
2.49.0



Return-Path: <linux-kernel+bounces-675704-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1CBD841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:07:23 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8451E7A9A64
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:02 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F3162882D6;
Fri, 6 Jun 2025 12:06:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bFbAPOFE"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 72577288C09
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211608; cv=none; b=pnqvIc3Py6GZXVMreFwuTwEA34ADjzFlJPs6vg9oDHvW3alONILcqhiUkfg1pRRiUN5eKuZy9G2KznJRkpB6NSkxJ/NCHYCpT1eHL2S3N3etS+mNgLNgUgJSKiKo1/iPQjI1KEBGsszSA4yRMEGoHb74NlUDv0F6rTJ4nSVu2CY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211608; c=relaxed/simple;
bh=j+cODd6m/VlELnGDpwFpT8ZEc30hawiI2g94AmUkhcU=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=H8tXVC8kvOgHXoUOtUi6Y0GTFeVWigfgkarurnaFxes7xPAnAOUViZujT/eeRyWnQ6W7mXtQvM7nMHMa+3g6c5wQ+V7sDfeo1MGOpPPcEqcihdnaSa3bx0K7Kxs2BJNbsIbD83UUeApfR3Uj6ZWevkmsUE5CUSM37K368k183ks=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bFbAPOFE; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211605;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=04LRSvqeoLp7K6hiMt+5nhRqp6hRGXKPyGrTB58OXbY=;
b=bFbAPOFE97xQ8TUXm380kzsXyoSlrfpj/FdfUaL/k2o2/EaUjbMjxKUkzu7ZWMkkhZnRIw
VyfqK+cEODza06VnUreFMUVnwTOv+owRg2OxS+5wTE7rjSgqjfZcua4uZEQBpdQ5KaxeVy
XfWu2cW4MNokM4uhzt6v20O8H2+GSoU=
Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com
(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-tYOC6bZiOBi7uTbL3bbC5A-1; Fri,
06 Jun 2025 08:06:40 -0400
X-MC-Unique: tYOC6bZiOBi7uTbL3bbC5A-1
X-Mimecast-MFC-AGG-ID: tYOC6bZiOBi7uTbL3bbC5A_1749211598
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CF518180036E;
Fri, 6 Jun 2025 12:06:37 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5F49D18002A5;
Fri, 6 Jun 2025 12:06:32 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 7/9] drm/i915/display: Add drm_panic support for Y-tiling with DPT
Date: Fri, 6 Jun 2025 13:48:11 +0200
Message-ID: <20250606120519.753928-8-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Alder Lake and later, it's not possible to disable tiling when DPT
is enabled.
So this commit implements Y-Tiling support, to still be able to draw
the panic screen.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---

v8:
* Pass the tiling function to intel_bo_panic_setup()

.../gpu/drm/i915/display/intel_atomic_plane.c | 66 ++++++++++++++++++-
drivers/gpu/drm/i915/display/intel_bo.c | 5 +-
drivers/gpu/drm/i915/display/intel_bo.h | 3 +-
.../drm/i915/display/skl_universal_plane.c | 15 +++--
drivers/gpu/drm/i915/gem/i915_gem_object.h | 3 +-
drivers/gpu/drm/i915/gem/i915_gem_pages.c | 21 +++++-
drivers/gpu/drm/xe/display/intel_bo.c | 10 ++-
7 files changed, 108 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 4095d69924db..ce5471bd3c43 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -1271,6 +1271,31 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
intel_plane_unpin_fb(old_plane_state);
}

+/* Handle Y-tiling, only if DPT is enabled (otherwise disabling tiling is easier)
+ * All DPT hardware have 128-bytes width tiling, so Y-tile dimension is 32x32
+ * pixels for 32bits pixels.
+ */
+#define YTILE_WIDTH 32
+#define YTILE_HEIGHT 32
+#define YTILE_SIZE (YTILE_WIDTH * YTILE_HEIGHT * 4)
+
+static unsigned int intel_ytile_get_offset(unsigned int width, unsigned int x, unsigned int y)
+{
+ u32 offset;
+ unsigned int swizzle;
+ unsigned int width_in_blocks = DIV_ROUND_UP(width, 32);
+
+ /* Block offset */
+ offset = ((y / YTILE_HEIGHT) * width_in_blocks + (x / YTILE_WIDTH)) * YTILE_SIZE;
+
+ x = x % YTILE_WIDTH;
+ y = y % YTILE_HEIGHT;
+
+ /* bit order inside a block is x4 x3 x2 y4 y3 y2 y1 y0 x1 x0 */
+ swizzle = (x & 3) | ((y & 0x1f) << 2) | ((x & 0x1c) << 5);
+ offset += swizzle * 4;
+ return offset;
+}

static void intel_panic_flush(struct drm_plane *plane)
{
@@ -1297,6 +1322,35 @@ static void intel_panic_flush(struct drm_plane *plane)
iplane->disable_tiling(iplane);
}

+static unsigned int (*intel_get_tiling_func(u64 fb_modifier))(unsigned int width,
+ unsigned int x,
+ unsigned int y)
+{
+ switch (fb_modifier) {
+ case I915_FORMAT_MOD_Y_TILED:
+ case I915_FORMAT_MOD_Y_TILED_CCS:
+ case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
+ case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
+ case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
+ return intel_ytile_get_offset;
+ case I915_FORMAT_MOD_4_TILED:
+ case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS:
+ case I915_FORMAT_MOD_4_TILED_DG2_MC_CCS:
+ case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC:
+ case I915_FORMAT_MOD_4_TILED_MTL_RC_CCS:
+ case I915_FORMAT_MOD_4_TILED_MTL_RC_CCS_CC:
+ case I915_FORMAT_MOD_4_TILED_MTL_MC_CCS:
+ case I915_FORMAT_MOD_4_TILED_BMG_CCS:
+ case I915_FORMAT_MOD_4_TILED_LNL_CCS:
+ case I915_FORMAT_MOD_X_TILED:
+ case I915_FORMAT_MOD_Yf_TILED:
+ case I915_FORMAT_MOD_Yf_TILED_CCS:
+ default:
+ /* Not supported yet */
+ return NULL;
+ }
+}
+
static int intel_get_scanout_buffer(struct drm_plane *plane,
struct drm_scanout_buffer *sb)
{
@@ -1304,6 +1358,7 @@ static int intel_get_scanout_buffer(struct drm_plane *plane,
struct drm_gem_object *obj;
struct drm_framebuffer *fb;
struct intel_display *display = to_intel_display(plane->dev);
+ unsigned int (*tiling)(unsigned int width, unsigned int x, unsigned int y) = NULL;

if (!plane->state || !plane->state->fb || !plane->state->visible)
return -ENODEV;
@@ -1319,9 +1374,14 @@ static int intel_get_scanout_buffer(struct drm_plane *plane,
} else {
int ret;
/* Can't disable tiling if DPT is in use */
- if (intel_fb_uses_dpt(fb))
- return -EOPNOTSUPP;
- ret = intel_bo_panic_setup(obj, sb);
+ if (intel_fb_uses_dpt(fb)) {
+ if (fb->format->cpp[0] != 4)
+ return -EOPNOTSUPP;
+ tiling = intel_get_tiling_func(fb->modifier);
+ if (!tiling)
+ return -EOPNOTSUPP;
+ }
+ ret = intel_bo_panic_setup(obj, sb, tiling);
if (ret)
return ret;
}
diff --git a/drivers/gpu/drm/i915/display/intel_bo.c b/drivers/gpu/drm/i915/display/intel_bo.c
index 83dbd8ae16fe..16c4ef30133c 100644
--- a/drivers/gpu/drm/i915/display/intel_bo.c
+++ b/drivers/gpu/drm/i915/display/intel_bo.c
@@ -59,9 +59,10 @@ void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj)
i915_debugfs_describe_obj(m, to_intel_bo(obj));
}

-int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb)
+int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb,
+ unsigned int (*tiling)(unsigned int, unsigned int, unsigned int))
{
- return i915_gem_object_panic_setup(to_intel_bo(obj), sb);
+ return i915_gem_object_panic_setup(to_intel_bo(obj), sb, tiling);
}

void intel_bo_panic_finish(struct drm_gem_object *obj)
diff --git a/drivers/gpu/drm/i915/display/intel_bo.h b/drivers/gpu/drm/i915/display/intel_bo.h
index 9ac087ea275d..9eecc18005ae 100644
--- a/drivers/gpu/drm/i915/display/intel_bo.h
+++ b/drivers/gpu/drm/i915/display/intel_bo.h
@@ -24,7 +24,8 @@ struct intel_frontbuffer *intel_bo_set_frontbuffer(struct drm_gem_object *obj,
struct intel_frontbuffer *front);

void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj);
-int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb);
+int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb,
+ unsigned int (*tiling)(unsigned int, unsigned int, unsigned int));
void intel_bo_panic_finish(struct drm_gem_object *obj);

#endif /* __INTEL_BO__ */
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index ffcf50443c0c..e73f171988f3 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -2795,15 +2795,22 @@ static void skl_disable_tiling(struct intel_plane *plane)
{
struct intel_plane_state *state = to_intel_plane_state(plane->base.state);
struct intel_display *display = to_intel_display(plane);
- u32 stride = state->view.color_plane[0].scanout_stride / 64;
+ const struct drm_framebuffer *fb = state->hw.fb;
u32 plane_ctl;

plane_ctl = intel_de_read(display, PLANE_CTL(plane->pipe, plane->id));
- plane_ctl &= ~PLANE_CTL_TILED_MASK;

- intel_de_write_fw(display, PLANE_STRIDE(plane->pipe, plane->id),
- PLANE_STRIDE_(stride));
+ if (intel_fb_uses_dpt(fb)) {
+ /* if DPT is enabled, keep tiling, but disable compression */
+ plane_ctl &= ~PLANE_CTL_RENDER_DECOMPRESSION_ENABLE;
+ } else {
+ /* if DPT is not supported, disable tiling, and update stride */
+ u32 stride = state->view.color_plane[0].scanout_stride / 64;

+ plane_ctl &= ~PLANE_CTL_TILED_MASK;
+ intel_de_write_fw(display, PLANE_STRIDE(plane->pipe, plane->id),
+ PLANE_STRIDE_(stride));
+ }
intel_de_write_fw(display, PLANE_CTL(plane->pipe, plane->id), plane_ctl);

intel_de_write_fw(display, PLANE_SURF(plane->pipe, plane->id),
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
index 9a0c1019dcad..a9d4e7f93c1f 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
@@ -692,7 +692,8 @@ i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj)
int __i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
int i915_gem_object_truncate(struct drm_i915_gem_object *obj);

-int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct drm_scanout_buffer *sb);
+int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct drm_scanout_buffer *sb,
+ unsigned int (*tiling)(unsigned int, unsigned int, unsigned int));
void i915_gem_object_panic_finish(struct drm_i915_gem_object *obj);

/**
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index 9bdbac3d9433..6a1cc0213ad0 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -358,6 +358,7 @@ static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
static struct page **i915_panic_pages;
static int i915_panic_page = -1;
static void *i915_panic_vaddr;
+static unsigned int (*i915_panic_tiling)(unsigned int, unsigned int, unsigned int);

static void i915_panic_kunmap(void)
{
@@ -385,6 +386,14 @@ static struct page **i915_gem_object_panic_pages(struct drm_i915_gem_object *obj
return pages;
}

+static void i915_gem_object_panic_map_set_pixel(struct drm_scanout_buffer *sb, unsigned int x,
+ unsigned int y, u32 color)
+{
+ unsigned int offset = i915_panic_tiling(sb->width, x, y);
+
+ iosys_map_wr(&sb->map[0], offset, u32, color);
+}
+
/*
* The scanout buffer pages are not mapped, so for each pixel,
* use kmap_local_page_try_from_panic() to map the page, and write the pixel.
@@ -396,7 +405,10 @@ static void i915_gem_object_panic_page_set_pixel(struct drm_scanout_buffer *sb,
unsigned int new_page;
unsigned int offset;

- offset = y * sb->pitch[0] + x * sb->format->cpp[0];
+ if (i915_panic_tiling)
+ offset = i915_panic_tiling(sb->width, x, y);
+ else
+ offset = y * sb->pitch[0] + x * sb->format->cpp[0];

new_page = offset >> PAGE_SHIFT;
offset = offset % PAGE_SIZE;
@@ -417,11 +429,14 @@ static void i915_gem_object_panic_page_set_pixel(struct drm_scanout_buffer *sb,
* Use current vaddr if it exists, or setup a list of pages.
* pfn is not supported yet.
*/
-int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct drm_scanout_buffer *sb)
+int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct drm_scanout_buffer *sb,
+ unsigned int (*tiling)(unsigned int, unsigned int, unsigned int))
{
enum i915_map_type has_type;
void *ptr;

+ i915_panic_tiling = tiling;
+
ptr = page_unpack_bits(obj->mm.mapping, &has_type);
if (ptr) {
if (i915_gem_object_has_iomem(obj))
@@ -429,6 +444,8 @@ int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct drm_scan
else
iosys_map_set_vaddr(&sb->map[0], ptr);

+ if (tiling)
+ sb->set_pixel = i915_gem_object_panic_map_set_pixel;
return 0;
}
if (i915_gem_object_has_struct_page(obj)) {
diff --git a/drivers/gpu/drm/xe/display/intel_bo.c b/drivers/gpu/drm/xe/display/intel_bo.c
index eb9a3400c110..af990a8cd674 100644
--- a/drivers/gpu/drm/xe/display/intel_bo.c
+++ b/drivers/gpu/drm/xe/display/intel_bo.c
@@ -64,6 +64,7 @@ void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj)
static int xe_panic_page = -1;
static void *xe_panic_vaddr;
static struct xe_bo *xe_panic_bo;
+static unsigned int (*xe_panic_tiling)(unsigned int, unsigned int, unsigned int);

static void xe_panic_kunmap(void)
{
@@ -84,7 +85,10 @@ static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int
unsigned int new_page;
unsigned int offset;

- offset = y * sb->pitch[0] + x * sb->format->cpp[0];
+ if (xe_panic_tiling)
+ offset = xe_panic_tiling(sb->width, x, y);
+ else
+ offset = y * sb->pitch[0] + x * sb->format->cpp[0];

new_page = offset >> PAGE_SHIFT;
offset = offset % PAGE_SIZE;
@@ -100,11 +104,13 @@ static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int
}
}

-int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb)
+int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_buffer *sb,
+ unsigned int (*tiling)(unsigned int, unsigned int, unsigned int))
{
struct xe_bo *bo = gem_to_xe_bo(obj);

xe_panic_bo = bo;
+ xe_panic_tiling = tiling;
sb->set_pixel = xe_panic_page_set_pixel;
return 0;
}
--
2.49.0



Return-Path: <linux-kernel+bounces-675706-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 926FF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:07:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id D100717A1F7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:07:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 51D852874E9;
Fri, 6 Jun 2025 12:07:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dk1hBAp8"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 A5A672874E7
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:07:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211623; cv=none; b=naNxftE2SDw8OinPE9fZnsvfqGoLbzuWrcUsSSXP+lOkQmG6pnOtl3OFeZSOzwqRTwZZBK2IkCDljC1VpYJGtkS8d1KgeI+A3vI2SNj+rpSkiz3HndlLl/4Y1fytRV0nhZlUEuKLIZjcBRZhGXcmsO+D9Tudfkklp2l5dgHRQfA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211623; c=relaxed/simple;
bh=jZhqw3CFkkpAqCC9nzOWg/77t51D878n8OcC+pjLft4=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=Cau/mVHl1oU/waWKkASXvj06SqT201Pdszz6CRr/w2RscxUNkfMddBSFmnSexyBRugPb81FTIlhqqTKFHS/YUL2cVQ53PBWTUbeSJWqSqj9gLaM9Ih9nJwNP/wAylmNG84c41qXFKZpcFQX1PafQ+wy9DtpwUsC9x7ZQ2f2JnXk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dk1hBAp8; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211619;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=mrjs5eOHCyu5GrbKeIZJ6mBciwCyDUhu9m4iaDSEfRE=;
b=dk1hBAp8S+hkCP0lZSn7YvdpdWzdX2JugbeHOVNLs/Dn3cK08b9VCsOig0srjLzzkuTi/6
Oraic979uAjJFGWZjE3pz1HDBnuRAUZI0WmpbvPrHMDrWBB2voFllKd+fRINlhGwAdczLV
6LZ1DWOxwhL9ycmIThyqaBqzN7mXH9c=
Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-530-hhQ4K7OCP1Wb_WyZHMZmRw-1; Fri,
06 Jun 2025 08:06:56 -0400
X-MC-Unique: hhQ4K7OCP1Wb_WyZHMZmRw-1
X-Mimecast-MFC-AGG-ID: hhQ4K7OCP1Wb_WyZHMZmRw_1749211612
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8FBF819560B3;
Fri, 6 Jun 2025 12:06:52 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E186C18003FD;
Fri, 6 Jun 2025 12:06:44 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 9/9] drm/i915/psr: Add intel_psr2_panic_force_full_update
Date: Fri, 6 Jun 2025 13:48:13 +0200
Message-ID: <20250606120519.753928-10-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

When the panic handler is called, configure the psr to send the full
framebuffer to the monitor, otherwise the panic screen is only
partially visible.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---

v8:
* Added in v8

.../gpu/drm/i915/display/intel_atomic_plane.c | 7 +++++++
drivers/gpu/drm/i915/display/intel_psr.c | 20 +++++++++++++++++++
drivers/gpu/drm/i915/display/intel_psr.h | 2 ++
3 files changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 8c422c6a7186..c9a9f0770205 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -58,6 +58,7 @@
#include "intel_fb.h"
#include "intel_fb_pin.h"
#include "intel_fbdev.h"
+#include "intel_psr.h"
#include "skl_scaler.h"
#include "skl_universal_plane.h"
#include "skl_watermark.h"
@@ -1319,6 +1320,7 @@ static unsigned int intel_4tile_get_offset(unsigned int width, unsigned int x, u
static void intel_panic_flush(struct drm_plane *plane)
{
struct intel_plane_state *plane_state = to_intel_plane_state(plane->state);
+ struct intel_crtc_state *crtc_state = to_intel_crtc_state(plane->state->crtc->state);
struct intel_plane *iplane = to_intel_plane(plane);
struct intel_display *display = to_intel_display(iplane);
struct drm_framebuffer *fb = plane_state->hw.fb;
@@ -1328,6 +1330,11 @@ static void intel_panic_flush(struct drm_plane *plane)

intel_bo_panic_finish(obj);

+ if (crtc_state->enable_psr2_sel_fetch) {
+ /* Force a full update for psr2 */
+ intel_psr2_panic_force_full_update(display, crtc_state);
+ }
+
/* Flush the cache and don't disable tiling if it's the fbdev framebuffer.*/
if (to_intel_framebuffer(fb) == intel_fbdev_framebuffer(display->fbdev.fbdev)) {
struct iosys_map map;
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index db7111374293..283ac2618ea5 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -2888,6 +2888,26 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
return 0;
}

+void intel_psr2_panic_force_full_update(struct intel_display *display,
+ struct intel_crtc_state *crtc_state)
+{
+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+ enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
+ u32 val = man_trk_ctl_enable_bit_get(display);
+
+ /* SF partial frame enable has to be set even on full update */
+ val |= man_trk_ctl_partial_frame_bit_get(display);
+ val |= man_trk_ctl_continuos_full_frame(display);
+
+ /* Directly write the register */
+ intel_de_write_fw(display, PSR2_MAN_TRK_CTL(display, cpu_transcoder), val);
+
+ if (!crtc_state->enable_psr2_su_region_et)
+ return;
+
+ intel_de_write_fw(display, PIPE_SRCSZ_ERLY_TPT(crtc->pipe), 0);
+}
+
void intel_psr_pre_plane_update(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{
diff --git a/drivers/gpu/drm/i915/display/intel_psr.h b/drivers/gpu/drm/i915/display/intel_psr.h
index 0cf53184f13f..9b061a22361f 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.h
+++ b/drivers/gpu/drm/i915/display/intel_psr.h
@@ -57,6 +57,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
struct intel_crtc *crtc);
void intel_psr2_program_trans_man_trk_ctl(struct intel_dsb *dsb,
const struct intel_crtc_state *crtc_state);
+void intel_psr2_panic_force_full_update(struct intel_display *display,
+ struct intel_crtc_state *crtc_state);
void intel_psr_pause(struct intel_dp *intel_dp);
void intel_psr_resume(struct intel_dp *intel_dp);
bool intel_psr_needs_vblank_notification(const struct intel_crtc_state *crtc_state);
--
2.49.0



Return-Path: <linux-kernel+bounces-675707-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5976241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:08:00 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8C7337AA127
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 87202288C0D;
Fri, 6 Jun 2025 12:07:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="SuWL0iqd";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="kK1vmeEd"
Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154])
(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 A155A288C15;
Fri, 6 Jun 2025 12:07:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211627; cv=none; b=gGMNrzmCrNodnXHGKPwiGwNZSLodJWJH+JR1nPVVn+8ao2heJLH+LMKwwh11BtjeNmszgy2svFsjIsqiELbWdDApiKWha6K60jNOp4ESnAHB9D/T/KyybTxrJZGTsAYf+u1EuyxlgMH5/WaBi17ACGY/avxn2DjtkdQIVhGgAtk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211627; c=relaxed/simple;
bh=lg3kmFZQXaT6RdO/u7P41CZ1HWdm8SPqQvfiJsphDpw=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=rvg+RvW/mmEw2zzuOFXHVhw8JnDXOwBNnWaqhZ68+PBlCuiuoonb8AXxHpL7ywvNQrTEmuEhjREO/XngnwHfGY0U+/kKrhWWX7AiELIoHISWim4CltZbhD/UQebZclM/cUt9nlHFKuvv8muYBlZaSbgn/u6M2OLkG6gLFksXR8c=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=SuWL0iqd; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=kK1vmeEd; arc=none smtp.client-ip=103.168.172.154
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41])
by mailfhigh.phl.internal (Postfix) with ESMTP id 981871140144;
Fri, 6 Jun 2025 08:07:04 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
by phl-compute-01.internal (MEProxy); Fri, 06 Jun 2025 08:07:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749211624;
x=1749298024; bh=nh5POVPYAuUyoy5LaIyDc334XOD2OOPorQvukFMjFAQ=; b=
SuWL0iqdM2/T8O4OdKzfzfA5S+UNVDQsq7Aev1PitHbEcj4klwnTP2OFZHvChQzO
fRjMx1EHxooCVH+xG870jWZcR7KjbSbWrpU86IUQOBq/hDgXk/IuRV4pD+NtEr9l
vfuh7fLnXKhdylEbMtmkX3+qKeXNc32TRKuCdGZ8heNpff+ejIfIP8B7tBiVd+Br
erLQrr8HsY69ed1FbROU1TCfGySejYys/AsHBPu2g4PTh2kHBSQdVoPwQO98ritK
dahQ7jwNJeF9T+lIGlbA98lN4fMcoytC7erAloJ5MEhdcYvuYX1GnHxKp8hUkbSw
D0XbjY/thJNokBiSajZDaA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749211624; x=
1749298024; bh=nh5POVPYAuUyoy5LaIyDc334XOD2OOPorQvukFMjFAQ=; b=k
K1vmeEdeAkBavAInnZCPJFGQMc/rJjyaksapEtG/kOxv1WdYBQ502N0aQMZV+c3J
yl+Sr71EPZFqnXl52uCS4GwCJwJYYf805aQKtcgNXAcEN6qdIOiLy7xa3fOevsQp
L1A21nRaefdoAQi73SPDr64/NLFneRUQwrowaU1fh0kNcKBpW64bfuzP3jHXQLfn
vN1TswySlrA9JHMqnhin6YfKQRydV6rHYpdoZi/fVd1hnhjhTBCrben+l9VvP7tJ
vRm8k5xCIKkQovdnf1RBtlJ9VTg8abBdsez4+jM8/SXKs+pOw4TRBA4m3vQ0mCMd
qDNxnyesr20g3ajWEo/Tg==
X-ME-Sender: <xms:6NlCaGX0EvBx7EIhyI8FXvc349lBq1sksLkmGRqkh-cyD9wFjaFXng>
<xme:6NlCaCnptmrJMjcAdypzUKypl37c2aTT4FuMQu6eT1zUvpazrlhX1DwlHdMU0DLb8
q0B4wysvcSTMDPh3C4>
X-ME-Received: <xmr:6NlCaKZ0iDxJjB8vJ2mBwd6T3DHVPQHj_-d45iplg4ZKzqdLfw1ocJHlL7OC0XRl14TaCOhTnrESkN6W5z9Ia9JvSBDIqA3JvA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdeiucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeevteeg
tddvvdfhtdekgefhfeefheetheekkeegfeejudeiudeuleegtdehkeekteenucevlhhush
htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehnihhklhgrshdrshho
uggvrhhluhhnugesrhgrghhnrghtvggthhdrshgvpdhnsggprhgtphhtthhopeelpdhmoh
guvgepshhmthhpohhuthdprhgtphhtthhopehtohhmihdrvhgrlhhkvghinhgvnhdorhgv
nhgvshgrshesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepmhgthhgvhh
grsgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehl
ihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvh
hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghs
qdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkh
gvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgthhgvhhgr
sgdohhhurgifvghisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlrghurhgvnhhtrd
hpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepjhgr
tghophhordhmohhnughisehiuggvrghsohhnsghorghrugdrtghomh
X-ME-Proxy: <xmx:6NlCaNU60iCqoZUxCO4TOZGqQNVectzPJOd-XvXGVBAXEuSh-WvLrA>
<xmx:6NlCaAkv_giklsOeq-tmxLMa4Uroskr-R6hFvNTB9EdS37CWUlJ31w>
<xmx:6NlCaCe5rt2585NfMWkRqkNvJYvdH_YloVK63NQVBy7quDf11jGXdg>
<xmx:6NlCaCFxT1Kb_7G0HFEjNSHaTdxKkipAkCzxo70Jy1s0nFuN0HKxvw>
<xmx:6NlCaE_nwb1jaMssEFXpDARl9as58qtxQdEzp-AVlUyFE0uebzSqQe1c>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:07:03 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:07:02 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 07/15] media: rcar-csi2: Optimize rcsi2_calc_mbps()
Message-ID: <20250606120702.GD2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-7-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-7-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your work.

On 2025-05-30 16:50:36 +0300, Tomi Valkeinen wrote:
> With modern drivers supporting link-freq, we don't need to do any
> calculations based on the bpp and number of lanes when figuring out the
> link frequency. However, the code currently always runs code to get the
> bpp and number of lanes.
>
> Optimize the rcsi2_calc_mbps() so that we only do that when needed, i.e.
> when querying the link-freq is not supported by the upstream subdevice.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>

I wonder if it make sens to add a dev_warn_once() for the old call path
so we won't forget to update all known users of this old way, and once
fixed we can remove the huristic method all together?

> ---
> drivers/media/platform/renesas/rcar-csi2.c | 50 +++++++++++++++++-------------
> 1 file changed, 29 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index 90973f3cba38..e0a0fd96459b 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -1001,15 +1001,10 @@ static int rcsi2_get_active_lanes(struct rcar_csi2 *priv,
> static int rcsi2_calc_mbps(struct rcar_csi2 *priv,
> struct v4l2_subdev_state *state)
> {
> - const struct rcar_csi2_format *format;
> - struct v4l2_mbus_framefmt *fmt;
> struct media_pad *remote_pad;
> struct v4l2_subdev *source;
> - unsigned int lanes;
> - unsigned int bpp;
> s64 freq;
> u64 mbps;
> - int ret;
>
> if (!priv->remote)
> return -ENODEV;
> @@ -1017,28 +1012,41 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv,
> source = priv->remote;
> remote_pad = &source->entity.pads[priv->remote_pad];
>
> - ret = rcsi2_get_active_lanes(priv, &lanes);
> - if (ret)
> - return ret;
> + /*
> + * First try to get the real link freq. If that fails, try the heuristic
> + * method with bpp and lanes (but that only works for one route).
> + */
> + freq = v4l2_get_link_freq(remote_pad, 0, 0);
> + if (freq < 0) {
> + const struct rcar_csi2_format *format;
> + struct v4l2_mbus_framefmt *fmt;
> + unsigned int lanes;
> + unsigned int bpp;
> + int ret;
>
> - fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK);
> - if (!fmt)
> - return -EINVAL;
> + ret = rcsi2_get_active_lanes(priv, &lanes);
> + if (ret)
> + return ret;
>
> - format = rcsi2_code_to_fmt(fmt->code);
> - if (!format)
> - return -EINVAL;
> + fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK);
> + if (!fmt)
> + return -EINVAL;
>
> - bpp = format->bpp;
> + format = rcsi2_code_to_fmt(fmt->code);
> + if (!format)
> + return -EINVAL;
>
> - freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
> - if (freq < 0) {
> - int ret = (int)freq;
> + bpp = format->bpp;
>
> - dev_err(priv->dev, "failed to get link freq for %s: %d\n",
> - source->name, ret);
> + freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
> + if (freq < 0) {
> + int ret = (int)freq;
>
> - return ret;
> + dev_err(priv->dev, "failed to get link freq for %s: %d\n",
> + source->name, ret);
> +
> + return ret;
> + }
> }
>
> mbps = div_u64(freq * 2, MEGA);
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675705-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BCDC441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:08:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8DE8B3B1B50
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:07:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A3043288C3F;
Fri, 6 Jun 2025 12:06:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BRJ/2/N5"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 2957D288C15
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211612; cv=none; b=lMARNoIjE4MaD/mNhGDiX10dz8xoxEb/jjguftjlD6elHkt9pkQf79CzY9Pczf72gsisToCVQvEju6xkD53p9GJcIaGjZtRnyMEkbzDDFUMsQddZtPWyalzklu+G75O1D7lxtuf7A5ceOKVbz37JufJ+q2QGLwLJzqAU6pVIMhI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211612; c=relaxed/simple;
bh=VSl/cmmDftA9q5LXt7BTkwOCTZhsdMZmQ9CjBdt6jwI=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=lsw6fwwUYJVVwITSjn0iqJO9bk6JIdXK2MHqJhr48/5eh72xtrRCKuP0t4T8CUP7QEwjKTtGcw2ivPHvn+GspjcLUL/63jYLyzgFt6bN8RKucdQx6YassrQVEVIycSSv9S5IgnMF9vxMp+k3wFkLFymVgWBpEicchTImEWWlrPM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BRJ/2/N5; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749211610;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=8c6ZwDHb3uYxtsAvJpFTLFi4+b+kzhB9wfsMrz7lsLA=;
b=BRJ/2/N57bWvZoqAVRjLh9EdY7M2KF8IvmPL/F1L6U2xdYibv8NXtt8Hg8r3phPjj9eopY
ciHD4xsLYzZvBmQjGeKEfAqGA1C+CHjgGXVH8+CpR1L2g3KL8NmEjsuLw1erz9nhYfOgFs
9E8fnp4NW8vpt/lJw9BDpfhwl2HfIas=
Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-169-deCbbWWaO527rQf_oRFE7w-1; Fri,
06 Jun 2025 08:06:46 -0400
X-MC-Unique: deCbbWWaO527rQf_oRFE7w-1
X-Mimecast-MFC-AGG-ID: deCbbWWaO527rQf_oRFE7w_1749211604
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 76FD31956089;
Fri, 6 Jun 2025 12:06:44 +0000 (UTC)
Received: from hydra.redhat.com (unknown [10.44.33.65])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 585D918002B5;
Fri, 6 Jun 2025 12:06:38 +0000 (UTC)
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
To: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Christian Koenig <christian.koenig@xxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>,
Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: [PATCH v8 8/9] drm/i915/display: Add drm_panic support for 4-tiling with DPT
Date: Fri, 6 Jun 2025 13:48:12 +0200
Message-ID: <20250606120519.753928-9-jfalempe@xxxxxxxxxx>
In-Reply-To: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Alder Lake and later, it's not possible to disable tiling when DPT
is enabled.
So this commit implements 4-Tiling support, to still be able to draw
the panic screen.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---
.../gpu/drm/i915/display/intel_atomic_plane.c | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index ce5471bd3c43..8c422c6a7186 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -1297,6 +1297,25 @@ static unsigned int intel_ytile_get_offset(unsigned int width, unsigned int x, u
return offset;
}

+static unsigned int intel_4tile_get_offset(unsigned int width, unsigned int x, unsigned int y)
+{
+ u32 offset;
+ unsigned int swizzle;
+ unsigned int width_in_blocks = DIV_ROUND_UP(width, 32);
+
+ /* Block offset */
+ offset = ((y / YTILE_HEIGHT) * width_in_blocks + (x / YTILE_WIDTH)) * YTILE_SIZE;
+
+ x = x % YTILE_WIDTH;
+ y = y % YTILE_HEIGHT;
+
+ /* bit order inside a block is y4 y3 x4 y2 x3 x2 y1 y0 x1 x0 */
+ swizzle = (x & 3) | ((y & 3) << 2) | ((x & 0xc) << 2) | (y & 4) << 4 |
+ ((x & 0x10) << 3) | ((y & 0x18) << 5);
+ offset += swizzle * 4;
+ return offset;
+}
+
static void intel_panic_flush(struct drm_plane *plane)
{
struct intel_plane_state *plane_state = to_intel_plane_state(plane->state);
@@ -1342,6 +1361,7 @@ static unsigned int (*intel_get_tiling_func(u64 fb_modifier))(unsigned int width
case I915_FORMAT_MOD_4_TILED_MTL_MC_CCS:
case I915_FORMAT_MOD_4_TILED_BMG_CCS:
case I915_FORMAT_MOD_4_TILED_LNL_CCS:
+ return intel_4tile_get_offset;
case I915_FORMAT_MOD_X_TILED:
case I915_FORMAT_MOD_Yf_TILED:
case I915_FORMAT_MOD_Yf_TILED_CCS:
--
2.49.0



Return-Path: <linux-kernel+bounces-675708-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 89C2341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:08:12 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id E85107A9B8F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:06:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B1EEC288CB4;
Fri, 6 Jun 2025 12:07:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BQBauKso"
Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F780288C29;
Fri, 6 Jun 2025 12:07:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211635; cv=none; b=mfxa+sDcnDHJGuRNwE4HFih0smDLMIiZPtPHEpmBs9ka4iayjkMCh0o+RbVdPGOj1QNCBSIHeadI2Q9lMAZulZNTqIU8mlCorJKiuZdaawA+g4jHRy+/k48T4QLo8uBhEAWftb68xmpZica2m3zdMiH2f83VTlDricmJ1cL5zTo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211635; c=relaxed/simple;
bh=yLJY0BRHWTXa3UHtKPNGBZr3m05ayE2UCFaKiHPe/T0=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tD4BXirxTIADgDfmQSqg+5Y1kvOhej5VPHTEGOSL2NpRemUfM/m7DwS+GfyPbW9JvcbHCncBpipLBeyOYbQkg+hXKoDDS78aZiEg6H/X15kQO+xtXhkimktOC/edMWLekBWLR7X9R8XcfJ5ua05yKhHP4nmXqlLL/BTNOXqi8gI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BQBauKso; arc=none smtp.client-ip=209.85.221.43
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-3a5123c1533so1133522f8f.2;
Fri, 06 Jun 2025 05:07:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749211631; x=1749816431; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=gJ95E9EY23axZFcMUppGnCR3XLsVeg2NtUQTaqPaYkE=;
b=BQBauKsojKwLtDwte6HuFguys1dKXLg0lwxtqkLYzNtQXn3KM+ih7MUGLA6lo4Su9q
UTgW58UrQHhgqx/MT1thaCfNTgxnkFtfCoAUuSvVw04E6Q3g6UdX+fssUyrx6ye1LcB6
NsMdwnqQz2LC/mGKb+qsuo1Q6q+NzenE5ISWXLPm7VEwh3SyJa3qOXTNuEBwU/7aztaF
PNL0vW1GFvRnOs3lH3C/sFE5JlD9mcVdH20A4xqc/RDp7y3xmEB2/PljMtjOW4FVQh/h
t9Z57Otm+6SVDrbdvl/MYBu7sMRyj4XcQANfuHFyNilsb2LfeDx3s8nKHYsr51bq6jA+
DK6Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749211631; x=1749816431;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=gJ95E9EY23axZFcMUppGnCR3XLsVeg2NtUQTaqPaYkE=;
b=AQwG0LD+kdJa32Uc954uEsRmC4Gd76E0NhZ7slGeZiK2OG7swI8US7fCovMeWOfwBD
+8o0lqzBcVTQ3fqulzXcTxEhgRuU8IhHIKhTPTCopt2m+EQF7y7RvHNadTTh/d7cwhIz
uO5yisyufNF/nz/Qck0RtudI1fTjV9IlMrZnhbi3ZL3ebSSm0NQQ5BdXWz/lqQu8l8zR
6XFUgYYcqDN4c8wCxqmlymHnVCwaW96JsBxnKKX1ojA3OAmLTTT+9269ZgBVMA8BwNFc
XkIsCLM7Z2nKWV7FTKwZZdbjMdP0Bu0waUJFfxpsPHk3X0mZ1fdoUZRPSWazmo6uKtlV
rkiQ==
X-Forwarded-Encrypted: i=1; AJvYcCWPrc7w5e84/qiEkxZZ13XMBfKFQriAOoxmaXqX7ZTHPZyEJHtQnxQyKZPLJOfm+UwzAlFJgv/8IJOA@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YwbAtUxDEMBQg6wSvrdLyH4mA3j+oe2XIecHOtJiOdDbPAfv3Jx
pvq9OjZWcveBo2SC2SFv3zjb2A4z0bB5yubxaVvTZ0ysIy3wUvOu7+YZnoQn51xI
X-Gm-Gg: ASbGnctyNnLgBP4Gd2fx+bioZB0nQA08pjB5jAxlG5lOlqcJpcgOikW5bDGy2P0ccwQ
yMHzOCk1TviEDPU4OCrDURz5E+ohcyZcNN4gQnrFbk4Ok2Eiq1oicxdnkIbB1ZTnl09ZHQ/lIU0
W/O9wGjJbSe7c/5hNXanPraMW5ghPyd4kawzOZnHIl5/kL+Di964484qUjKW3rF43GOMVx0eigp
lxEIQm5kaL6Tee8ks9nNKklxbil97/6nXRixPOANiJfzg5qG6SH3mJH6hDcsGAUAj23WPEeHxpR
aDR9S8MYkcOv01Gj+N6YkS2qvRp7hU3boTR+vFYSJgKFBG/5stUGecLCOKIXkBXrHLyqhdYdfdn
UQAe5zDChQ81uDjeROFeodPSb
X-Google-Smtp-Source: AGHT+IEOtEM9TP1fLEZNVP7do6r2cKStJcuv9OdTia/zzf1zi2+54zrnJ9cEAcb2CZHeUg90uRNjBQ==
X-Received: by 2002:a05:6000:22c4:b0:3a5:276b:1ec0 with SMTP id ffacd0b85a97d-3a531ce1597mr2396156f8f.45.1749211631108;
Fri, 06 Jun 2025 05:07:11 -0700 (PDT)
Received: from masalkhi.. (ip-109-43-113-198.web.vodafone.de. [109.43.113.198])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53244f516sm1671874f8f.74.2025.06.06.05.07.09
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 05:07:10 -0700 (PDT)
From: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx
Cc: arnd@xxxxxxxx,
gregkh@xxxxxxxxxxxxxxxxxxx,
robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx,
abd.masalkhi@xxxxxxxxx
Subject: [PATCH v3 0/3] Add support for STMicroelectronics M24LR EEPROM/NFC chips
Date: Fri, 6 Jun 2025 12:06:28 +0000
Message-ID: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This patch series adds support for the STMicroelectronics M24LR series
RFID/NFC EEPROM devices. These chips expose two I2C addresses: the primary
one provides access to system control and configuration registers, while
the secondary address is used for EEPROM access.

The driver implements both functionalities:
- A sysfs-based interface for the control and system parameter registers.
- EEPROM access via the nvmem subsystem using a secondary I2C dummy client.

Brief summary of changes in v3:
- Full support for ST M24LR chips, including integrated EEPROM access
within the same driver-no need for the at24 driver.
- Dropped usage of the I2C mux API.
- Switched to using the NVMEM subsystem for EEPROM access.
- Removed reference to the i2c-mux binding.
- Added reference to the nvmem binding to reflect EEPROM integration.
- Updated the reg property to support devices exposing two I2C
addresses, one for control and one for EEPROM.

Tested on: M24LR04E-R using Yocto on Raspberry Pi 4

Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>

Abd-Alrhman Masalkhi (3):
dt-bindings: eeprom: Add ST M24LR support
misc: add driver for ST M24LR series RFID/NFC EEPROM chips
ABI: sysfs: add documentation for ST M24LR EEPROM and control
interface

.../ABI/testing/sysfs-bus-i2c-devices-m24lr | 96 +++
.../devicetree/bindings/misc/st,m24lr.yaml | 54 ++
drivers/misc/Kconfig | 17 +
drivers/misc/Makefile | 1 +
drivers/misc/m24lr.c | 705 ++++++++++++++++++
5 files changed, 873 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
create mode 100644 Documentation/devicetree/bindings/misc/st,m24lr.yaml
create mode 100644 drivers/misc/m24lr.c

--
2.43.0



Return-Path: <linux-kernel+bounces-675710-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3038A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:09:00 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 321E2189DFA8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:08:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DD170288508;
Fri, 6 Jun 2025 12:07:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HiPXQgFP"
Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 307BB289367;
Fri, 6 Jun 2025 12:07:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211643; cv=none; b=jpWZp0QH8Qeel6ofcnNOUpmKHAjKIGbvl5E/QUZfGcYGLsLwrFTejAyNrQbierpsC0JqmiRH+nCTN45fORMGTpL3ckGkI1yoTuXY/9k2A9xPDmbo3XvNGTIHwBs3HKiYRaTf17cvsOWfiz4Scn+f3wa1rpRk1bCz1dCTKLEuwa4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211643; c=relaxed/simple;
bh=1aU6DiPih2JcaZs55Kgy5nWudTSKniFEBn9Fbc0X48o=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=V0I2P5KuDbWK5tiI0CGrNzbn8Tpa3XSXz405L8Bc/+v0eanYQl+iqjZQmQqRX0zVeJPPkO4E16aPcuzKJpxcCVY5/D9PwuoFYMKqBZLRlo70vDaTPtP4FFffhAGUYysBnG7krXvP93KRtOG7ZJI9exy7Vkesn8BQAFvmsi4qrOk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HiPXQgFP; arc=none smtp.client-ip=209.85.128.52
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-450cfb790f7so15862245e9.0;
Fri, 06 Jun 2025 05:07:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749211639; x=1749816439; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=oQLhyfa6s1Y1N2934/HNvah+Kn4N5hPI40oGFlKP6mM=;
b=HiPXQgFPfZL7k+cBu/eUp5L83DjDppkH9bQ5cHulrJhJ9Eavd9cyIqiKKEpxAY82rl
BPjtBX+XJ7Ty+5A0aw+zkfsxNBvU2gpHQyPdji+MwJgcn6B7rWxFwOf3nkOMI5C4Ucec
go9yRQUMctFKpupr4Zg/pinlOnl3pdurOJYZTTc+MjZn1MJ8mPOUCfd3ZdS7cWdLgTLq
qOaTmSGfcSumtTAe7mCG3IiSE+DeV7MKaOjLYDjU/nfQlsLrsqPIX0fpocfD1RXBKahp
Klw7GmiZS+MWh5rOcdMgPvHBxx9eoasaIGv0VD3GYXL9Btgp5pb5w/f7uw6FqeOCBoM9
VP/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749211639; x=1749816439;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=oQLhyfa6s1Y1N2934/HNvah+Kn4N5hPI40oGFlKP6mM=;
b=haSkl7cqbbiFH5TzYxXmzEGH/DAIg4B6yV3kkRZRdoR3xYI5Ezam9Zb/H32ZAeHcpg
Q/edPsfKChH1KW0GhIfLL6z5yroCdGnoG/LqyCI5K/L0Aasj51MCn4kpWbSRG3UMBSBu
gzrwZxjVfEcm7w2q+N+KNkYGe5IxJnOmo/xD6jRO36ci4Q/2SN+a+y2p0+4q3VihMD5f
oqP/Q1PeEH1j5GWLXKZdicNHWZ2IgNRw2W72vh4m02Ig7A81UKF9GmSgVwVBQqHEwM0n
djYN11kHq657Z2ghR/gDoAL5rq3MZ8pPnOIP8pFY2UFPn+6Bb/XDhMjWSsnMR+vypDqq
vPVQ==
X-Forwarded-Encrypted: i=1; AJvYcCXBay+ZnmBynmvocleDETo3tPkOZMILGEdNGx5F0zbqNA/oDcgfY6kvZl2KrGobwinSPHe7FF5+YqjL@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzPRUrowBmeaEsKqF2cgfetWKsPfKSViSRzKZLWKeprFrh9ZOoN
k2nrR9STYeMwXNF03zgfoiAaVwi1h0BtdkO40TZvc92wCysGG9ayk3HDz1arKQ==
X-Gm-Gg: ASbGncsrwMBSTA4yPcB6R2G+ff3/QneFR3UpCjsvGXpreh/TVoCAq0F7IiQf9K0LyBE
eqnL4EqGV6JvBIfmr3xMOWPjEpIsfvjSs2l8vux5Hmyt8GNqg4LA0HDfxxbgVOfKHH89v2cZ0Il
CEHqAUxl+LvcqwjBYbA3Z8w69HnqNS/ukPHoKnffrLc/sgG2dhH1JGIySsn3hNb28i854JncVxF
lrTq1XSw94Sy7A/t0iqn8/MYt8lNgBpvLYbk5cRf45a7HFUCnQV4umGpC2/khjGkX3itX/IM9Jr
KKQfQHVp7M77KGrhHhTvEbI1GLTKMYmmdJa+ksbICeO8ckXUrqfPFBetRffx6vCBR9KY2UD4l3W
FW/2WRgH/4ec/4Q==
X-Google-Smtp-Source: AGHT+IGB7hSxzFM+Zz49/eCCU7lmuwQX9rezj6h1KVhyi70e6TzoiW+6dTVTsknwjab4QcSthNsc/Q==
X-Received: by 2002:a05:6000:24c8:b0:3a4:e56a:48c1 with SMTP id ffacd0b85a97d-3a531cbe5a3mr2728398f8f.55.1749211639298;
Fri, 06 Jun 2025 05:07:19 -0700 (PDT)
Received: from masalkhi.. (ip-109-43-113-198.web.vodafone.de. [109.43.113.198])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53244f516sm1671874f8f.74.2025.06.06.05.07.18
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 05:07:19 -0700 (PDT)
From: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx
Cc: arnd@xxxxxxxx,
gregkh@xxxxxxxxxxxxxxxxxxx,
robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx,
abd.masalkhi@xxxxxxxxx
Subject: [PATCH v3 3/3] ABI: sysfs: add documentation for ST M24LR EEPROM and control interface
Date: Fri, 6 Jun 2025 12:06:31 +0000
Message-ID: <20250606120631.3140054-4-abd.masalkhi@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
References: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add sysfs ABI documentation for the STMicroelectronics M24LR device,
covering both the control interface (e.g., unlock, password update, UID,
memory size, and SSS entries) and EEPROM access via the nvmem subsystem.

Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
---
Changes in v3:
- Updated sysfs entry paths to use <busnum>-<primary-addr> to reflect the
control address.

Changes in v2:
- Added initial sysfs ABI documentation.
---
.../ABI/testing/sysfs-bus-i2c-devices-m24lr | 96 +++++++++++++++++++
1 file changed, 96 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr

diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr b/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
new file mode 100644
index 000000000000..53b6fe39162c
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
@@ -0,0 +1,96 @@
+What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/unlock
+Date: 2025-05-31
+KernelVersion: 6.16
+Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
+Description:
+ Write-only attribute used to present a password and unlock
+ access to protected areas of the M24LR chip, including
+ configuration registers such as the Sector Security Status
+ (SSS) bytes. A valid password must be written to enable write
+ access to these regions via the I2C interface.
+
+ Format:
+ - Hexadecimal string representing a 32-bit (4-byte) password
+ - Accepts 1 to 8 hex digits (e.g., "c", "1F", "a1b2c3d4")
+ - No "0x" prefix, whitespace, or trailing newline
+ - Case-insensitive
+
+ Behavior:
+ - If the password matches the internal stored value,
+ access to protected memory/configuration is granted
+ - If the password does not match the internally stored value,
+ it will fail silently
+
+What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/new_pass
+Date: 2025-05-31
+KernelVersion: 6.16
+Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
+Description:
+ Write-only attribute used to update the password required to
+ unlock the M24LR chip.
+
+ Format:
+ - Hexadecimal string representing a new 32-bit password
+ - Accepts 1 to 8 hex digits (e.g., "1A", "ffff", "c0ffee00")
+ - No "0x" prefix, whitespace, or trailing newline
+ - Case-insensitive
+
+ Behavior:
+ - Overwrites the current password stored in the I2C password
+ register
+ - Requires the device to be unlocked before changing the
+ password
+ - If the device is locked, the write silently fails
+
+What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/uid
+Date: 2025-05-31
+KernelVersion: 6.16
+Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
+Description:
+ Read-only attribute that exposes the 8-byte unique identifier
+ programmed into the M24LR chip at the factory.
+
+ Format:
+ - Lowercase hexadecimal string representing a 64-bit value
+ - 1 to 16 hex digits (e.g., "e00204f12345678")
+ - No "0x" prefix
+ - Includes a trailing newline
+
+What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/mem_size
+Date: 2025-05-31
+KernelVersion: 6.16
+Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
+Description:
+ Read-only attribute that exposes the internal memory size code
+ of the M24LR device, as stored in the system register area.
+
+ Format:
+ - Unsigned 8-bit integer
+ - Includes a trailing newline
+
+ Notes:
+ - Value is encoded by the chip and corresponds to the EEPROM
+ size (e.g., 3 = 4 kbit for M24LR04E-R)
+
+What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/sss<N>
+Date: 2025-05-31
+KernelVersion: 6.16
+Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
+Description:
+ Read/write attribute representing the Sector Security Status
+ (SSS) byte for EEPROM sector <N> in the M24LR chips. Each sector
+ has one SSS byte, which defines I2c and RF access control via a
+ combination of protection and password settings.
+
+ Format:
+ - Read: returns a 8-bit hexadecimal value followed by a
+ newline
+ - Write: requires exactly one or two hexadecimal digits
+ - No "0x" prefix, whitespace, or trailing newline
+ - Case-insensitive
+
+ Notes:
+ - Refer to the M24LR chip datasheet for full bit definitions
+ and usage
+ - Write access requires prior password authentication in I2C
+ mode
--
2.43.0



Return-Path: <linux-kernel+bounces-675709-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0C71D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:09:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0B51C3B19D0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:08:00 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 379682882C2;
Fri, 6 Jun 2025 12:07:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jk0UpC+P"
Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B85B5289340;
Fri, 6 Jun 2025 12:07:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211638; cv=none; b=thLhbqTsVyn8z/rtiRoiLQAskLYHCqPdQSpX22PxuOBjwuu0C7iyaiDAEk5rVLOJbC8YsYyO1gm2X9lebnBTpZdc7x5UkMhzpLFTwAU0i97lwJ0wfc0FHLB7Lu71Z6QQaK3MO2FaqLTYjnDyDCucm4aaReEK9c91E9LXBYVaa+0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211638; c=relaxed/simple;
bh=dQLEdNUdN2l/hNT7UgALgimh2FWKT7OVd1iN24fNj+4=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=R5kGMNrLcpTgb2DCK+61Lw5NyF53MkI8czl/BTbsxA+uE48PRsDYa/T8TSoSrwhLkz1yNQMu9a8QI9ToJXONkQjNVjPI/8X7lYDSAjTnk5VvmCCjBukRKpQJwl/IJ/W4yrO76uZGtSy+3as8NhIBop5/Oc0WTbeSkAXRonYh5Y0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jk0UpC+P; arc=none smtp.client-ip=209.85.128.53
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-451dbe494d6so24964605e9.1;
Fri, 06 Jun 2025 05:07:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749211635; x=1749816435; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=mFHAbclmiC1TBKhrN+ddCpgt7t400uvyyz03PUe/ABs=;
b=jk0UpC+P0kU0O8/D/d82/hCMOY87tzonILCagCQ7LHWuBXwvnDDNmVywFTvaXC5HPQ
5CD5JQBFXZweTmpSDzoE8rrJQbcY0R3S6uAyBBQKMmDcRVkSE77Up4Dr2jUZbl/pkuls
qGiHf6jEChMqchhqTJKlZMhKoKK8NIcROChBvrLr6tbsiEdYa0T12IymiVhlHQYCnUU2
rmOWh43R/u4HSpR41ysqdsIwYxhcKkuS+8cL2t4QmjiwoTl8htf2Y0Tp0FdG3zu7JK9J
MimWkCdy1z6HTfqxY1swDIAOpC/g4F21bgnOo3TRp7AvDYd7nzBNFZjPOYLw5GFnp2Z3
7slw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749211635; x=1749816435;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=mFHAbclmiC1TBKhrN+ddCpgt7t400uvyyz03PUe/ABs=;
b=WVinU43uNxF5rFVUf+pMr7eGQOst/3oZhapOlkHfv73aQQzKJQ48h/7XF8utBOLHyw
1RUPhgDZE6tlP3LMX3CRBGGZWP2TPG1V6H/o0/1nw4JDK1/cJi4ASKyrGZdsPUknErq7
GRntbqEcvXjmLlfCqyK5uGyBpL8u1BcOveACX19LhpqHwPIoCoF2DsmuYuGK9FyZfuvO
CQEhKmBMpJK78tea6AI4PUveDagHhTkOpFkL7zFGwTiXpYgBLkwmG9UgzlrggCE2knJ7
DoGulr96miWcgpBU80L5dqsBvnOTqvkaLrKpf/2N23X50B+wPCVHZ0uwzfQJQ9ck1QNi
cMcw==
X-Forwarded-Encrypted: i=1; AJvYcCX4MSAkTs3kfvvqJ1p1rD9CoPJeeQ9rAwDLOHLj5maKVhDewH3/fe/mCl2JE2Cbq3T2FFp85cLPkqFQ@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YwnJcJEFszKan164Rfr10/kMkxsGZnmaTFp4P1ey8VZJtOk8UoK
yFiqykH/DySpa+y+L4dRw5kaXv0q4C8+FACNvhSc12PAPt0EFhLd0lXAoGLd3w==
X-Gm-Gg: ASbGncvd6X5Mp/TwB4LPz7HSS0NxmaLruagbUjz+y5FEJNrCBzoZj1DJ7pXoUcch7kR
WeCZ8EBV8H8tFX0bCTzZ+e8thc8g2BMTCqnApf3I+AwQV+9pNPpgM2es5cuOEdA4ntaWowqfO8j
usz/uRqQAmoPNzZX5ArN2mksorvEJJRyJ/q6o1YfROe0wtfStaaExsVQ1jq7dQB5DnYl7onRQu3
PzONx9ZAqF+wfNN6eo7lmRp4jAh9sitEAfTsi3a0bVl/ofQr4o7svpU9EumaEnTnssUPhAf48lD
X0BQBTiyAyoCF+UMByDhAWHbJMZApViXi0cnaTq0m4vXeUe0BCpfpDd4RoAz67Gt4DgoNt/vgiI
TNQTeN/tkLY0OWQ==
X-Google-Smtp-Source: AGHT+IG3TVH6jOiZ+yEcPvEe/kgM/u71qBIw1h+zOPS0mfXdwJ6w4oDybJPAHp5zgUw7VXUgKU2gcA==
X-Received: by 2002:a05:600c:4e12:b0:43c:ea1a:720c with SMTP id 5b1f17b1804b1-452013abb30mr37000255e9.18.1749211634514;
Fri, 06 Jun 2025 05:07:14 -0700 (PDT)
Received: from masalkhi.. (ip-109-43-113-198.web.vodafone.de. [109.43.113.198])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53244f516sm1671874f8f.74.2025.06.06.05.07.13
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 05:07:14 -0700 (PDT)
From: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx
Cc: arnd@xxxxxxxx,
gregkh@xxxxxxxxxxxxxxxxxxx,
robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx,
abd.masalkhi@xxxxxxxxx
Subject: [PATCH v3 1/3] dt-bindings: eeprom: Add ST M24LR support
Date: Fri, 6 Jun 2025 12:06:29 +0000
Message-ID: <20250606120631.3140054-2-abd.masalkhi@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
References: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add support for STMicroelectronics M24LR RFID/NFC EEPROM chips.
These devices use two I2C addresses: the primary address provides
access to control and system parameter registers, while the
secondary address is used for EEPROM access.

Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
---
Changes in v3:
- Dropped reference to the i2c-mux binding.
- Added reference to the nvmem binding to reflect EEPROM usage.
- Updated 'reg' property to represent the device using two I2C addresses.
- Fixed DT schema errors and yamllint warnings.
- Removed the unused 'pagesize' property.
---
.../devicetree/bindings/misc/st,m24lr.yaml | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 Documentation/devicetree/bindings/misc/st,m24lr.yaml

diff --git a/Documentation/devicetree/bindings/misc/st,m24lr.yaml b/Documentation/devicetree/bindings/misc/st,m24lr.yaml
new file mode 100644
index 000000000000..775d218381b7
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/st,m24lr.yaml
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/st,m24lr.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics M24LR NFC/RFID EEPROM
+
+maintainers:
+ - Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
+
+description:
+ STMicroelectronics M24LR series are dual-interface (RF + I2C)
+ EEPROM chips. These devices support I2C-based access to both
+ memory and a system area that controls authentication and configuration.
+ They expose two I2C addresses, one for the system parameter sector and
+ one for the EEPROM.
+
+allOf:
+ - $ref: /schemas/nvmem/nvmem.yaml#
+
+properties:
+ compatible:
+ enum:
+ - st,m24lr04e-r
+ - st,m24lr16e-r
+ - st,m24lr64e-r
+
+ reg:
+ description:
+ Two I2C address, the primary for control registers, the secondary
+ for EEPROM access.
+ minItems: 2
+ maxItems: 2
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ eeprom@57 {
+ compatible = "st,m24lr04e-r";
+ reg = <0x57>, /* primary-device */
+ <0x53>; /* secondary-device */
+ };
+ };
+...
--
2.43.0



Return-Path: <linux-kernel+bounces-675712-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A1B8841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:09:32 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2C25916EC2E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:09:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D6833288C8C;
Fri, 6 Jun 2025 12:08:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="rJxLUK8F"
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 42BB628750A;
Fri, 6 Jun 2025 12:08: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=1749211687; cv=none; b=Tq6OD51REMWS0sFUD76fnnJTrek3Z0QjgoAn37zVbxSWNyDm7KjHQuNel5in4CbmrgTVvbC7NBU+fyLenkOcMqTgXtL6cBVdj03YoaJUn1u1EbdQzndhbQxVwle+VrLREoCDh6G+GD+j+AyhVDJ8DLkKZ3u/ZMp9V2tkAYj5WD8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211687; c=relaxed/simple;
bh=uGevn5VR673nRTdKY/+4Lo8yeeVvw62KFi9Iuxip3pY=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=kktLPHT7F25lr13ifbTbyT1FYVVMiJ6kJrr5UCqic0CcBltF5cfwc7RNbEmP8qzWISh6C+vTzl/B8oWkXvyxuFcS3tv+HhQPwSLN4VCFxubtVzbgWoGrPGwU27TLsJFB2dmkY81gFiC/Nx4CADWMpx7rRE3Y+1T9i/IzHETysms=
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=rJxLUK8F; arc=none smtp.client-ip=91.207.212.93
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com
Received: from pps.filterd (m0046661.ppops.net [127.0.0.1])
by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556BcvJc008218;
Fri, 6 Jun 2025 14:07:29 +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=
gq6NiYoztE5n+qnbOG6J5+Yuv0005vgbJ4zJGtQw7Ug=; b=rJxLUK8FvA1TErY3
DLk98QrMDNTkYFElI9B4n1C7OyDmdmteVpn7WecBRjuQHqZcUagExffAZDhsq3fV
LdLFxpOyp5ZE+hh707HqQUGIzW2qutx2DT3JmFSpAzSU9aH3UFkOzYSUJ+PB1WKi
ZiMh3D2asltkdobendJUOQhD4/zTEdRLppRZMkuMHibdHvINyt/+w8JPyHM/+mQl
f3YBkYvOQx9vOoz3YfCmSgCJcJAGs4KZIxRt3cV0dM3MUeikctYsauX9yFKxblyT
vPyrc1FO9lcbgWMYKyJbYWdhw5VHcy+6IZHLXGgjF7ShLl9OMZJ6tncXREd4ZYDf
wS1vXw==
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 471g8vkmmv-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:07:29 +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 8A05640051;
Fri, 6 Jun 2025 14:06:16 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id EC863B05FC7;
Fri, 6 Jun 2025 14:06:11 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:06:11 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 9/9] arm64: dts: st: Enable PCIe on the stm32mp257f-ev1 board
Date: Fri, 6 Jun 2025 14:04:03 +0200
Message-ID: <20250606120403.2964857-10-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add PCIe RC and EP support on stm32mp257f-ev1 board.
Default to RC mode.

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
---
arch/arm64/boot/dts/st/stm32mp257f-ev1.dts | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
index 2f561ad40665..f97581aa0841 100644
--- a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
+++ b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
@@ -265,6 +265,27 @@ scmi_vdd_sdcard: regulator@23 {
};
};

+&pcie_ep {
+ pinctrl-names = "default", "init";
+ pinctrl-0 = <&pcie_pins_a>;
+ pinctrl-1 = <&pcie_init_pins_a>;
+ reset-gpios = <&gpioj 8 GPIO_ACTIVE_LOW>;
+ status = "disabled";
+};
+
+&pcie_rc {
+ pinctrl-names = "default", "init", "sleep";
+ pinctrl-0 = <&pcie_pins_a>;
+ pinctrl-1 = <&pcie_init_pins_a>;
+ pinctrl-2 = <&pcie_sleep_pins_a>;
+ status = "okay";
+
+ pcie@0,0 {
+ reset-gpios = <&gpioj 8 GPIO_ACTIVE_LOW>;
+ wake-gpios = <&gpioh 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ };
+};
+
&sdmmc1 {
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc1_b4_pins_a>;
--
2.34.1



Return-Path: <linux-kernel+bounces-675711-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 11C2341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:09:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id DB9F93A7D49
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:08:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C141E28980D;
Fri, 6 Jun 2025 12:07:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bgDaxd/4"
Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87B1F288529;
Fri, 6 Jun 2025 12:07:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211645; cv=none; b=MOe+jdW8SLhkVcjAMI3QUBgEUcKp9GZWrFEwBteLat0T4HRoq4qZWb+3Mc1UgkD38iwjbzT1zgtof6IyVVyP5WGDw/vsi9u9PxEKE4r7wbr16t5DrJLb7I9BIyatUFFdCmkCg/XwQgufVYPya8BBg8q/75wYvaw9ZPIjecIyOjI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211645; c=relaxed/simple;
bh=bzsmLdMIa9al6ePD3W8m1sI9gk9fXKse2kjwCyIVlQI=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=lull5MO13/APoXaUXeTzJBUe8v+hk3APO0b7jzMMm0XsarfEqhT/z8ADRBSjM5i7flwv/oew+Xn03r0ZuWXG9PDBJx08LyWjAeFSY1DLndjwwMM14laEoFeIqsCWbv6YHreWzrs0IIi5cy03AQ5/RfIcyNVyIvLdeUAvYkzm2XI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bgDaxd/4; arc=none smtp.client-ip=209.85.128.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-450cf0120cdso19444825e9.2;
Fri, 06 Jun 2025 05:07:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749211638; x=1749816438; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=tO90m1UkbLNgxP6Sovv0JKa3HNyJrE5FmdEr+Gs6aC8=;
b=bgDaxd/4hNkU7Hri5EBEmbYeUVxxOZ6hYCqFdmbqUI7z4WQlHrR9v3pUSscty1sC7E
V2BlGaiincwUG2ffFYRBUZxYCq/YsTOWTbHX5r8YYQ39jIVInFdgNzPlefdVvdMQ5BDR
iKIbuYU1LOaAjFTBiLFavwqVY/qJZ+Z3wIw/lRG5ay/ZdXhq/H2VH1vODyH3WHm/+kfg
cGrjBmNr68VH+0avILvJQ8cDvSxoC35vjV5/xnGUw/r393xdK1uR8JArdnX/ZKmrOw3R
fg+Z+PSRWicsUx0EW96uSVBL+S1DusDoFGH+8I9KgcV0zNus4Gith9w47n3pEwt9YenH
tkMA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749211638; x=1749816438;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=tO90m1UkbLNgxP6Sovv0JKa3HNyJrE5FmdEr+Gs6aC8=;
b=WFvykS9DO4uipPsay2XEL94d+yi1JI2wGaXundxlnyOxJP2/0oDSDy/F2qU18Y2AlR
Y9D5DegRUNWwIsXy32CXvYpV4LBTV2ZCBWokoNevPxji05xFF3hIlVMWo0Yv1PWp3Rsx
0mPlJsDGrPgJlZB7It4G7PmoXhnYyj/0bocg3szBxisCjywnGczr3Rv39bTWtZAib7Gc
V2xjeuBzv7fk6goL9EbP1IAmuP6Tu9lJkZ5UHbc1OmMXKIIFRMugr8z7g7ErjfgCfEpx
izFi7TRZrO66qVAyM0k8aE1Ljd4cA13mKGGFUQpCMu+wcRiFmdENCvc6CAn1jKUsBtyJ
5R9A==
X-Forwarded-Encrypted: i=1; AJvYcCVWmm3joOKMly5zEW5UYLkp8vRBpjYRm9vN1CdiFwP3Olt0coJuA9HdtkFyL3pYEtzlhWkevwkjbny8@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzlyA2kua+q82sVMeHpWzJhiBl2OteP/l2y1DxaLcAYc4a0EtQA
nAd4W2FjiB6haFzCFISRO71U35v8PYbP5TeUTEu2nCVbRbxklUyGCLC8H/C9Bg==
X-Gm-Gg: ASbGncv1JidYQ0gtLY+5ERYeFMfgt5MYkE3JJ1CF2q5NL7nUy7QeSHOP5QL988Uwh7x
v1o79/x0wDmpHK4YXwzlZCjFBe/p6/HiGNHJy0Ovk52oYat0jCnsCC8eopvAgoFisU81c52KV8T
s0Q+AOvG9MJFJOZe//UedOkMiquMmG0t1NDzqtdUK+uvPQ1p0P+jk9G1ErgCXicX/VUVguz2rjj
jBIgo/f10R16Ey07Rb/6B1+NxdqMM4PIuXxo4OcYGGm8uoGediuI/4ZuSPhda6XtaEaBpQT+qe/
Z8/rhH6kMGhSBFQtKfe3wN0wmtzi7XY7EJIpbXFrPIGHEs0xiW0mzZ9QZTt2PTrnUAFSztHO5vl
VxyBTJ801qZa2mA==
X-Google-Smtp-Source: AGHT+IECTaxH5rhBPhCQRpz4CVtt0hMT5KWfQwFDDYGh0e0E4xCcYp5fIZAuhIoHoRJdQUJrm4LaDQ==
X-Received: by 2002:a05:600c:c16d:b0:450:d611:eb95 with SMTP id 5b1f17b1804b1-4520137c97emr38049505e9.17.1749211637171;
Fri, 06 Jun 2025 05:07:17 -0700 (PDT)
Received: from masalkhi.. (ip-109-43-113-198.web.vodafone.de. [109.43.113.198])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53244f516sm1671874f8f.74.2025.06.06.05.07.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 05:07:16 -0700 (PDT)
From: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx
Cc: arnd@xxxxxxxx,
gregkh@xxxxxxxxxxxxxxxxxxx,
robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx,
abd.masalkhi@xxxxxxxxx
Subject: [PATCH v3 2/3] misc: add driver for ST M24LR series RFID/NFC EEPROM chips
Date: Fri, 6 Jun 2025 12:06:30 +0000
Message-ID: <20250606120631.3140054-3-abd.masalkhi@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
References: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

adds support for STMicroelectronics M24LRxx devices, which expose
two separate I2C addresses: one for system control and one for EEPROM
access. The driver implements both a sysfs-based interface for control
registers (e.g. UID, password authentication) and an nvmem provider
for EEPROM access.

Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
---
Changes in v3:
- Fully support the M24LR chips, including EEPROM access, no need for
the standard at24 driver to handle EEPROM separately.
- Rename the driver file from m24lr_ctl.c to m24lr.c.
- Rename all identifiers from the m24lr_ctl prefix to m24lr.
- Retain the m24lr_ctl prefix for control-related routines to distinguish
them from EEPROM-related logic.
- Drop usage of the I2C mux API.
- Use the NVMEM subsystem to handle EEPROM access.
- Add REGMAP support for EEPROM register access.
- Update Kconfig entry to reflect that the driver now supports both
control and EEPROM functionality.

Changes in v2:
- Fix compiling Errors and Warnings
- Replace scnprintf with sysfs_emit
- Drop success log message from probe.

Comment:
- Running checkpatch emit a warning for non-const regmap_config.
The variable must remain auto and mutable due to runtime manipulation.
---
drivers/misc/Kconfig | 17 +
drivers/misc/Makefile | 1 +
drivers/misc/m24lr.c | 705 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 723 insertions(+)
create mode 100644 drivers/misc/m24lr.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index c161546d728f..96dc2bf2ad45 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -644,6 +644,23 @@ config MCHP_LAN966X_PCI
- lan966x-miim (MDIO_MSCC_MIIM)
- lan966x-switch (LAN966X_SWITCH)

+config M24LR
+ tristate "STMicroelectronics M24LR RFID/NFC EEPROM support"
+ depends on SYSFS
+ select REGMAP_I2C
+ select NVMEM
+ help
+ This enables support for STMicroelectronics M24LR RFID/NFC EEPROM
+ chips. These dual-interface devices expose two I2C addresses:
+ one for EEPROM memory access and another for control and system
+ configuration (e.g. UID, password handling).
+
+ This driver provides a sysfs interface for control functions and
+ integrates with the nvmem subsystem for EEPROM access.
+
+ To compile this driver as a module, choose M here: the
+ module will be called m24lr.
+
source "drivers/misc/c2port/Kconfig"
source "drivers/misc/eeprom/Kconfig"
source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 054cee9b08a4..689b68fad9fd 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -75,3 +75,4 @@ lan966x-pci-objs := lan966x_pci.o
lan966x-pci-objs += lan966x_pci.dtbo.o
obj-$(CONFIG_MCHP_LAN966X_PCI) += lan966x-pci.o
obj-y += keba/
+obj-$(CONFIG_M24LR) += m24lr.o
diff --git a/drivers/misc/m24lr.c b/drivers/misc/m24lr.c
new file mode 100644
index 000000000000..46a3c8ef7b0f
--- /dev/null
+++ b/drivers/misc/m24lr.c
@@ -0,0 +1,705 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * m24lr.c - Sysfs control interface for ST M24LR series RFID/NFC chips
+ *
+ * Copyright (c) 2025 Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
+ *
+ * This driver implements both the sysfs-based control interface and EEPROM
+ * access for STMicroelectronics M24LR series chips (e.g., M24LR04E-R).
+ * It provides access to control registers for features such as password
+ * authentication, memory protection, and device configuration. In addition,
+ * it manages read and write operations to the EEPROM region of the chip.
+ */
+
+#include <linux/i2c.h>
+#include <linux/regmap.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/nvmem-provider.h>
+
+#define M24LR_PAGESIZE_DEFAULT 1u
+
+#define M24LR_WRITE_TIMEOUT 25u
+#define M24LR_READ_TIMEOUT (M24LR_WRITE_TIMEOUT)
+
+#define to_sys_entry(attrp) container_of(attrp, struct m24lr_sys_entry, attr)
+
+/**
+ * struct m24lr_sys_entry - describes a sysfs entry for M24LR device access
+ * @reg_addr: register address in the M24LR device
+ * @reg_size: size of the register in bytes
+ * @attr: sysfs attribute used for exposing register access to userspace
+ *
+ * Used to define readable/writable register entries through sysfs.
+ */
+struct m24lr_sys_entry {
+ unsigned int reg_addr;
+ unsigned int reg_size;
+ struct device_attribute attr;
+};
+
+/**
+ * struct m24lr_chip - describes chip-specific sysfs layout
+ * @page_size: chip-specific limit on the maximum number of bytes allowed
+ * in a single write operation.
+ * @eeprom_size: size of the EEPROM in byte
+ * @n_entries: number of entries in the array
+ * @n_sss_entries: number of sss entries required for the chip
+ * @entries: array of sysfs entries specific to the chip variant
+ *
+ * Supports multiple M24LR chip variants (e.g., M24LRxx) by allowing each
+ * to define its own set of sysfs attributes, depending on its available
+ * registers and features.
+ */
+struct m24lr_chip {
+ unsigned int page_size;
+ unsigned int eeprom_size;
+ unsigned int n_entries;
+ unsigned int n_sss_entries;
+ const struct m24lr_sys_entry *entries;
+};
+
+/**
+ * struct m24lr - core driver data for M24LR chip control
+ * @page_size: chip-specific limit on the maximum number of bytes allowed
+ * in a single write operation.
+ * @eeprom_size: size of the EEPROM in byte
+ * @ctl_regmap: regmap interface for accessing the system parameter sector
+ * @eeprom_regmap: regmap interface for accessing the EEPROM
+ * @lock: mutex to synchronize operations to the device
+ * @sss_entries: array of sssc sysfs entries specific to the chip variant
+ * @n_sss_entries: number of entries in the sss entries array
+ *
+ * Central data structure holding the state and resources used by the
+ * M24LR device driver.
+ */
+struct m24lr {
+ unsigned int page_size;
+ unsigned int eeprom_size;
+ struct regmap *ctl_regmap;
+ struct regmap *eeprom_regmap;
+ struct mutex lock; /* synchronize operations to the device */
+ struct m24lr_sys_entry *sss_entries;
+ unsigned int n_sss_entries;
+};
+
+static ssize_t m24lr_ctl_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
+static ssize_t m24lr_ctl_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count);
+static ssize_t m24lr_ctl_unlock_command(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count);
+static ssize_t m24lr_ctl_newpass_command(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count);
+
+static const struct regmap_range m24lr_ctl_vo_ranges[] = {
+ regmap_reg_range(0, 63),
+};
+
+static const struct regmap_access_table m24lr_ctl_vo_table = {
+ .yes_ranges = m24lr_ctl_vo_ranges,
+ .n_yes_ranges = ARRAY_SIZE(m24lr_ctl_vo_ranges),
+};
+
+static const struct regmap_config m24lr_ctl_regmap_conf = {
+ .name = "m24lr_ctl",
+ .reg_stride = 1,
+ .reg_bits = 16,
+ .val_bits = 8,
+ .disable_locking = false,
+ .cache_type = REGCACHE_RBTREE,/* Flat can't be used, there's huge gap */
+ .volatile_table = &m24lr_ctl_vo_table,
+};
+
+/* define the default sysfs entries for M24LR chips */
+static const struct m24lr_sys_entry m24lr_ctl_sys_entry_default_table[] = {
+ {.attr = __ATTR(unlock, 0200, NULL, m24lr_ctl_unlock_command)},
+ {.attr = __ATTR(new_pass, 0200, NULL, m24lr_ctl_newpass_command)},
+ {.reg_addr = 2324, .reg_size = 8,
+ .attr = __ATTR(uid, 0444, m24lr_ctl_show, NULL)},
+ {.reg_addr = 2334, .reg_size = 1,
+ .attr = __ATTR(mem_size, 0400, m24lr_ctl_show, NULL)},
+};
+
+/* Chip descriptor for M24LR04E-R variant */
+static const struct m24lr_chip m24lr04e_r_chip = {
+ .page_size = 4,
+ .eeprom_size = 512,
+ .n_sss_entries = 4,
+ .n_entries = ARRAY_SIZE(m24lr_ctl_sys_entry_default_table),
+ .entries = m24lr_ctl_sys_entry_default_table,
+};
+
+/* Chip descriptor for M24LR16E-R variant */
+static const struct m24lr_chip m24lr16e_r_chip = {
+ .page_size = 4,
+ .eeprom_size = 2048,
+ .n_sss_entries = 16,
+ .n_entries = ARRAY_SIZE(m24lr_ctl_sys_entry_default_table),
+ .entries = m24lr_ctl_sys_entry_default_table,
+};
+
+/* Chip descriptor for M24LR64E-R variant */
+static const struct m24lr_chip m24lr64e_r_chip = {
+ .page_size = 4,
+ .eeprom_size = 8192,
+ .n_sss_entries = 64,
+ .n_entries = ARRAY_SIZE(m24lr_ctl_sys_entry_default_table),
+ .entries = m24lr_ctl_sys_entry_default_table,
+};
+
+static const struct i2c_device_id m24lr_ids[] = {
+ { "m24lr04e-r", (kernel_ulong_t)&m24lr04e_r_chip},
+ { "m24lr16e-r", (kernel_ulong_t)&m24lr16e_r_chip},
+ { "m24lr64e-r", (kernel_ulong_t)&m24lr64e_r_chip},
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, m24lr_ids);
+
+static const struct of_device_id m24lr_of_match[] = {
+ { .compatible = "st,m24lr04e-r", .data = &m24lr04e_r_chip},
+ { .compatible = "st,m24lr16e-r", .data = &m24lr16e_r_chip},
+ { .compatible = "st,m24lr64e-r", .data = &m24lr64e_r_chip},
+ { }
+};
+MODULE_DEVICE_TABLE(of, m24lr_of_match);
+
+/**
+ * m24lr_parse_le_value - Parse hex string and convert to little-endian binary
+ * @buf: Input string buffer (hex format)
+ * @reg_size: Size of the register in bytes (must be 1, 2, 4, or 8)
+ * @output: Output buffer to store the value in little-endian format
+ *
+ * Converts a hexadecimal string to a numeric value of the given register size
+ * and writes it in little-endian byte order into the provided buffer.
+ *
+ * Return: 0 on success, or negative error code on failure
+ */
+static int m24lr_parse_le_value(const char *buf, u32 reg_size, u8 *output)
+{
+ int err;
+
+ switch (reg_size) {
+ case 1: {
+ u8 tmp;
+
+ err = kstrtou8(buf, 16, &tmp);
+ if (!err)
+ *output = tmp;
+ break;
+ }
+ case 2: {
+ u16 tmp;
+
+ err = kstrtou16(buf, 16, &tmp);
+ if (!err)
+ *(__le16 *)output = cpu_to_le16(tmp);
+ break;
+ }
+ case 4: {
+ u32 tmp;
+
+ err = kstrtou32(buf, 16, &tmp);
+ if (!err)
+ *(__le32 *)output = cpu_to_le32(tmp);
+ break;
+ }
+ case 8: {
+ u64 tmp;
+
+ err = kstrtou64(buf, 16, &tmp);
+ if (!err)
+ *(__le64 *)output = cpu_to_le64(tmp);
+ break;
+ }
+ default:
+ err = -EINVAL;
+ }
+
+ return err;
+}
+
+/**
+ * m24lr_regmap_read - read data using regmap with retry on failure
+ * @regmap: regmap instance for the device
+ * @buf: buffer to store the read data
+ * @size: number of bytes to read
+ * @offset: starting register address
+ *
+ * Attempts to read a block of data from the device with retries and timeout.
+ * Some M24LR chips may transiently NACK reads (e.g., during internal write
+ * cycles), so this function retries with a short sleep until the timeout
+ * expires.
+ *
+ * Returns:
+ * Number of bytes read on success,
+ * -ETIMEDOUT if the read fails within the timeout window.
+ */
+static ssize_t m24lr_regmap_read(struct regmap *regmap, u8 *buf,
+ size_t size, unsigned int offset)
+{
+ int err;
+ unsigned long timeout, read_time;
+ ssize_t ret = -ETIMEDOUT;
+
+ timeout = jiffies + msecs_to_jiffies(M24LR_READ_TIMEOUT);
+ do {
+ read_time = jiffies;
+
+ err = regmap_bulk_read(regmap, offset, buf, size);
+ if (!err) {
+ ret = size;
+ break;
+ }
+
+ usleep_range(1000, 2000);
+ } while (time_before(read_time, timeout));
+
+ return ret;
+}
+
+/**
+ * m24lr_regmap_write - write data using regmap with retry on failure
+ * @regmap: regmap instance for the device
+ * @buf: buffer containing the data to write
+ * @size: number of bytes to write
+ * @offset: starting register address
+ *
+ * Attempts to write a block of data to the device with retries and a timeout.
+ * Some M24LR devices may NACK I2C writes while an internal write operation
+ * is in progress. This function retries the write operation with a short delay
+ * until it succeeds or the timeout is reached.
+ *
+ * Returns:
+ * Number of bytes written on success,
+ * -ETIMEDOUT if the write fails within the timeout window.
+ */
+static ssize_t m24lr_regmap_write(struct regmap *regmap, const u8 *buf,
+ size_t size, unsigned int offset)
+{
+ int err;
+ unsigned long timeout, write_time;
+ ssize_t ret = -ETIMEDOUT;
+
+ timeout = jiffies + msecs_to_jiffies(M24LR_WRITE_TIMEOUT);
+
+ do {
+ write_time = jiffies;
+
+ err = regmap_bulk_write(regmap, offset, buf, size);
+ if (!err) {
+ ret = size;
+ break;
+ }
+
+ usleep_range(1000, 2000);
+ } while (time_before(write_time, timeout));
+
+ return ret;
+}
+
+static ssize_t m24lr_read(struct m24lr *m24lr, u8 *buf, size_t size,
+ unsigned int offset, bool is_eeprom)
+{
+ struct regmap *regmap;
+ long ret;
+
+ if (is_eeprom)
+ regmap = m24lr->eeprom_regmap;
+ else
+ regmap = m24lr->ctl_regmap;
+
+ mutex_lock(&m24lr->lock);
+ ret = m24lr_regmap_read(regmap, buf, size, offset);
+ mutex_unlock(&m24lr->lock);
+
+ return ret;
+}
+
+/**
+ * m24lr_write - write buffer to M24LR device with page alignment handling
+ * @m24lr: pointer to driver context
+ * @buf: data buffer to write
+ * @size: number of bytes to write
+ * @offset: target register address in the device
+ *
+ * Writes data to the M24LR device using regmap, split into chunks no larger
+ * than page_size to respect device-specific write limitations (e.g., page
+ * size or I2C hold-time concerns). Each chunk is aligned to the page boundary
+ * defined by page_size.
+ *
+ * Returns:
+ * Total number of bytes written on success,
+ * A negative error code if any write fails.
+ */
+static ssize_t m24lr_write(struct m24lr *m24lr, const u8 *buf, size_t size,
+ unsigned int offset, bool is_eeprom)
+{
+ unsigned int n, next_sector;
+ struct regmap *regmap;
+ ssize_t ret = 0;
+ long err;
+
+ if (is_eeprom)
+ regmap = m24lr->eeprom_regmap;
+ else
+ regmap = m24lr->ctl_regmap;
+
+ n = min(size, m24lr->page_size);
+ next_sector = roundup(offset + 1, m24lr->page_size);
+ if (offset + n > next_sector)
+ n = next_sector - offset;
+
+ mutex_lock(&m24lr->lock);
+ while (n) {
+ err = m24lr_regmap_write(regmap, buf, n, offset);
+ if (IS_ERR_VALUE(err)) {
+ mutex_unlock(&m24lr->lock);
+ if (ret)
+ return ret;
+ else
+ return err;
+ }
+
+ offset += n;
+ size -= n;
+ ret += n;
+ n = min(size, m24lr->page_size);
+ }
+ mutex_unlock(&m24lr->lock);
+
+ return ret;
+}
+
+/**
+ * m24lr_write_pass - Write password to M24LR043-R using secure format
+ * @m24lr: Pointer to device control structure
+ * @buf: Input buffer containing hex-encoded password
+ * @count: Number of bytes in @buf
+ * @code: Operation code to embed between password copies
+ *
+ * This function parses a 4-byte password, encodes it in big-endian format,
+ * and constructs a 9-byte sequence of the form:
+ *
+ * [BE(password), code, BE(password)]
+ *
+ * The result is written to register 0x0900 (2304), which is the password
+ * register in M24LR04E-R chip.
+ *
+ * Return: Number of bytes written on success, or negative error code on failure
+ */
+static ssize_t m24lr_write_pass(struct m24lr *m24lr, const char *buf,
+ size_t count, u8 code)
+{
+ __be32 be_pass;
+ u8 output[9];
+ long ret;
+ u32 pass;
+ int err;
+
+ if (unlikely(!count))
+ return -EINVAL;
+
+ if (count > 8)
+ return -EINVAL;
+
+ err = kstrtou32(buf, 16, &pass);
+ if (err)
+ return err;
+
+ be_pass = cpu_to_be32(pass);
+
+ memcpy(output, &be_pass, sizeof(be_pass));
+ output[4] = code;
+ memcpy(output + 5, &be_pass, sizeof(be_pass));
+
+ mutex_lock(&m24lr->lock);
+ ret = m24lr_regmap_write(m24lr->ctl_regmap, output, 9, 2304);
+ mutex_unlock(&m24lr->lock);
+
+ return ret;
+}
+
+static ssize_t m24lr_ctl_newpass_command(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct m24lr *m24lr = i2c_get_clientdata(to_i2c_client(dev));
+
+ return m24lr_write_pass(m24lr, buf, count, 7);
+}
+
+static ssize_t m24lr_ctl_unlock_command(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct m24lr *m24lr = i2c_get_clientdata(to_i2c_client(dev));
+
+ return m24lr_write_pass(m24lr, buf, count, 9);
+}
+
+static ssize_t m24lr_ctl_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct m24lr *m24lr = i2c_get_clientdata(to_i2c_client(dev));
+ struct m24lr_sys_entry *entry = to_sys_entry(attr);
+ unsigned int reg_size = entry->reg_size;
+ unsigned int reg_addr = entry->reg_addr;
+ u8 output[8];
+ int err = 0;
+
+ if (unlikely(!count))
+ return -EINVAL;
+
+ if (count > (reg_size << 1))
+ return -EINVAL;
+
+ if (unlikely(!is_power_of_2(reg_size) || reg_size > 8)) {
+ dev_dbg(dev,
+ "Invalid register size: must be a power of 2 and <= 8 bytes (%u)\n",
+ reg_size);
+ return -EIO;
+ }
+
+ err = m24lr_parse_le_value(buf, reg_size, output);
+ if (err)
+ return err;
+
+ return m24lr_write(m24lr, (u8 *)&output, reg_size, reg_addr, false);
+}
+
+static ssize_t m24lr_ctl_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ long ret;
+ u64 val;
+ __le64 input = 0;
+ struct m24lr *m24lr = i2c_get_clientdata(to_i2c_client(dev));
+ struct m24lr_sys_entry *entry = to_sys_entry(attr);
+ unsigned int reg_addr = entry->reg_addr;
+ unsigned int reg_size = entry->reg_size;
+
+ if (unlikely(!is_power_of_2(reg_size) || reg_size > 8)) {
+ dev_dbg(dev,
+ "Invalid register size: must be a power of 2 and <= 8 bytes (%u)\n",
+ reg_size);
+ return -EIO;
+ }
+
+ ret = m24lr_read(m24lr, (u8 *)&input, reg_size, reg_addr, false);
+ if (IS_ERR_VALUE(ret))
+ return ret;
+
+ if (ret != reg_size)
+ return -EIO;
+
+ switch (reg_size) {
+ case 1:
+ val = *(u8 *)&input;
+ break;
+ case 2:
+ val = le16_to_cpu((__le16)input);
+ break;
+ case 4:
+ val = le32_to_cpu((__le32)input);
+ break;
+ case 8:
+ val = le64_to_cpu((__le64)input);
+ break;
+ };
+
+ return sysfs_emit(buf, "%llx\n", val);
+}
+
+static int m24lr_nvmem_read(void *priv, unsigned int offset, void *val,
+ size_t bytes)
+{
+ struct m24lr *m24lr = priv;
+
+ if (unlikely(!bytes))
+ return bytes;
+
+ if (offset + bytes > m24lr->eeprom_size)
+ return -EINVAL;
+
+ return m24lr_read(m24lr, val, bytes, offset, true);
+}
+
+static int m24lr_nvmem_write(void *priv, unsigned int offset, void *val,
+ size_t bytes)
+{
+ struct m24lr *m24lr = priv;
+
+ if (unlikely(!bytes))
+ return -EINVAL;
+
+ if (offset + bytes > m24lr->eeprom_size)
+ return -EINVAL;
+
+ return m24lr_write(m24lr, val, bytes, offset, true);
+}
+
+static const struct m24lr_chip *m24lr_get_chip(struct device *dev)
+{
+ const struct m24lr_chip *ret;
+ const struct i2c_device_id *id;
+
+ id = i2c_match_id(m24lr_ids, to_i2c_client(dev));
+
+ if (dev->of_node && of_match_device(m24lr_of_match, dev))
+ ret = of_device_get_match_data(dev);
+ else if (id)
+ ret = (void *)id->driver_data;
+ else
+ ret = acpi_device_get_match_data(dev);
+
+ return ret;
+}
+
+static int m24lr_probe(struct i2c_client *client)
+{
+ struct regmap_config eeprom_regmap_conf = {0};
+ struct nvmem_config nvmem_conf = {0};
+ struct m24lr_sys_entry *sss = NULL;
+ struct device *dev = &client->dev;
+ struct i2c_client *eeprom_client;
+ const struct m24lr_chip *chip;
+ struct regmap *eeprom_regmap;
+ struct nvmem_device *nvmem;
+ struct regmap *ctl_regmap;
+ unsigned int n_sss;
+ struct m24lr *m24lr;
+ u32 regs[2];
+ long err;
+ u8 test;
+ int i;
+
+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
+ return -EOPNOTSUPP;
+
+ chip = m24lr_get_chip(dev);
+ if (!chip)
+ return -ENODEV;
+
+ m24lr = devm_kzalloc(dev, sizeof(struct m24lr), GFP_KERNEL);
+ if (!m24lr)
+ return -ENOMEM;
+
+ err = device_property_read_u32_array(dev, "reg", regs, ARRAY_SIZE(regs));
+ if (err) {
+ dev_err(dev, "device_property_read_u32_array\n");
+ return err;
+ }
+ /* Create a second I2C client for the eeprom interface */
+ eeprom_client = devm_i2c_new_dummy_device(dev, client->adapter, regs[1]);
+ if (IS_ERR(eeprom_client)) {
+ dev_err(dev,
+ "Failed to create dummy I2C client for the EEPROM\n");
+ return PTR_ERR(eeprom_client);
+ }
+
+ for (i = 0; i < chip->n_entries; i++) {
+ const struct device_attribute *attr = &chip->entries[i].attr;
+
+ err = device_create_file(dev, attr);
+ if (err)
+ dev_warn(dev,
+ "Failed to create sysfs entry '%s'\n",
+ attr->attr.name);
+ }
+
+ n_sss = chip->n_sss_entries;
+ if (n_sss) {
+ sss = devm_kzalloc(dev, n_sss * sizeof(struct m24lr_sys_entry),
+ GFP_KERNEL);
+ if (!sss)
+ return -ENOMEM;
+
+ for (i = 0; i < n_sss; i++) {
+ char *name = devm_kasprintf(dev, GFP_KERNEL, "sss%d", i);
+
+ sss[i].reg_size = 1;
+ sss[i].reg_addr = i;
+ sss[i].attr.attr.name = name;
+ sss[i].attr.attr.mode = 0600;
+ sss[i].attr.show = m24lr_ctl_show;
+ sss[i].attr.store = m24lr_ctl_store;
+
+ err = device_create_file(dev, &sss[i].attr);
+ if (err)
+ dev_warn(dev,
+ "Failed to create sysfs entry '%s'\n",
+ name);
+ }
+ }
+
+ ctl_regmap = devm_regmap_init_i2c(client, &m24lr_ctl_regmap_conf);
+ if (IS_ERR(ctl_regmap)) {
+ err = PTR_ERR(ctl_regmap);
+ dev_err(dev, "Failed to init regmap\n");
+ return err;
+ }
+
+ eeprom_regmap_conf.name = "m24lr_eeprom";
+ eeprom_regmap_conf.reg_bits = 16;
+ eeprom_regmap_conf.val_bits = 8;
+ eeprom_regmap_conf.disable_locking = true;
+ eeprom_regmap_conf.max_register = chip->eeprom_size - 1;
+
+ eeprom_regmap = devm_regmap_init_i2c(eeprom_client,
+ &eeprom_regmap_conf);
+ if (IS_ERR(eeprom_regmap)) {
+ err = PTR_ERR(eeprom_regmap);
+ dev_err(dev, "Failed to init regmap\n");
+ return err;
+ }
+
+ mutex_init(&m24lr->lock);
+ m24lr->page_size = chip->page_size;
+ m24lr->eeprom_size = chip->eeprom_size;
+ m24lr->eeprom_regmap = eeprom_regmap;
+ m24lr->ctl_regmap = ctl_regmap;
+ m24lr->n_sss_entries = n_sss;
+ m24lr->sss_entries = sss;
+
+ nvmem_conf.dev = &eeprom_client->dev;
+ nvmem_conf.owner = THIS_MODULE;
+ nvmem_conf.type = NVMEM_TYPE_EEPROM;
+ nvmem_conf.reg_read = m24lr_nvmem_read;
+ nvmem_conf.reg_write = m24lr_nvmem_write;
+ nvmem_conf.size = chip->eeprom_size;
+ nvmem_conf.word_size = 1;
+ nvmem_conf.stride = 1;
+ nvmem_conf.priv = m24lr;
+
+ nvmem = devm_nvmem_register(dev, &nvmem_conf);
+ if (IS_ERR(nvmem))
+ return PTR_ERR(nvmem);
+
+ i2c_set_clientdata(client, m24lr);
+ i2c_set_clientdata(eeprom_client, m24lr);
+
+ err = m24lr_read(m24lr, &test, 1, 0, true);
+ if (IS_ERR_VALUE(err))
+ return -ENODEV;
+
+ return 0;
+}
+
+static struct i2c_driver m24lr_driver = {
+ .driver = {
+ .name = "m24lr",
+ .of_match_table = m24lr_of_match,
+ },
+ .probe = m24lr_probe,
+ .id_table = m24lr_ids,
+};
+module_i2c_driver(m24lr_driver);
+
+MODULE_AUTHOR("Abd-Alrhman Masalkhi");
+MODULE_DESCRIPTION("st m24lr control driver");
+MODULE_LICENSE("GPL");
--
2.43.0



Return-Path: <linux-kernel+bounces-675714-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DE21241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:09:39 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id D86FA16A5B1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:09:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 47951288CB6;
Fri, 6 Jun 2025 12:08:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="oF1zx9ni"
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 42C22288502;
Fri, 6 Jun 2025 12:08: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=1749211687; cv=none; b=GQ4PLVmIVjOiR9JANC0FjvH513E9UpGVJ86LCXU8p562fA15PkBtUYBhE4/+890SMnZGYnQCtw7ZteoswBp1fvVP9CLwa3SQi0XYvZYJLvbz8PeaaursdlB9iHDync+eSAD0H9bYE+/IqZxANQZSmxZEPwHks6iUevrTWq6FJCI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211687; c=relaxed/simple;
bh=d3q5JvP5CcoG8muXKB/9gfTqlcO5qgg99WjINVwWJz4=;
h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=h3iKCmjJkSbaroso57/nVCWzVohNYcFpNlah4VIOTuPoF8GxPQPsDmRqa5o/VDUjTUCxwt65QWd+aN05SxzeXWBONmODBr5Xl3iWfIGIayTxV07whMos1htjEEKIsGchxJxsJzxpk4FfjGMzOwhk9DDgeZAloavgzT+bmqQbfS8=
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=oF1zx9ni; arc=none smtp.client-ip=91.207.212.93
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com
Received: from pps.filterd (m0369457.ppops.net [127.0.0.1])
by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556BcwM5021324;
Fri, 6 Jun 2025 14:07:29 +0200
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=
cc:content-transfer-encoding:content-type:date:from:message-id
:mime-version:subject:to; s=selector1; bh=UT+h5kLe0gqwv1nVudk7GH
idNHqmz6ANzbk1keBA7O4=; b=oF1zx9niZ6mEh5eWF24IqFI7G62pHG+IMPrMaL
ECDt9F8V47rbveNLoG5p9wzEDsJjjarUyTfYKXX/we2t52DiIKtap4RAWC/T4m3x
lBmhjyHbLrKtqgO7RDTOTUuTeIdzhyPv98mi2tVMmQB6AReQnZ2YdvtIXaCwR3gY
babOsGHWVS/PjrnbVckZT1KHgGnf90MVHYLfUM1UfbyL+S+t/eGBbDku/Ywgt2Hw
HU/vSM5unUOYpJd083Hu+LiEFPDFoyeYg/8Qsz3HeUJ1I8bsDORx05Sfs+q/Ebdl
1Cvr5BvwdCbzam6ENdgUMIjeI71SDuJhLcVkhhI3/720sNYQ==
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 471g8tbn36-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:07:29 +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 D5C3E40049;
Fri, 6 Jun 2025 14:06:03 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1D0F3AE88A7;
Fri, 6 Jun 2025 14:04:26 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:04:25 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 0/9] Add STM32MP25 PCIe drivers
Date: Fri, 6 Jun 2025 14:03:54 +0200
Message-ID: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Changes in v11;
Address comments from Manivanna:
- RC driver: Do not call pm_runtime_get_noresume in probe
More uses of dev_err_probe
- EP driver: Use level triggered PERST# irq

Changes in v10;
- Update pcie_ep bindings with dbi2 and atu regs,
thus remove Reviewed-by and Acked-by.

Changes in v9:
- Describe atu and dbi2 shadowed registers in pcie_ep node
Address RC and EP drivers comments from Manivanna:
- Use dev_error_probe() for pm_runtime_enable() calls
- Reword Kconfig help message
- Move pm_runtime_get_noresume() before devm_pm_runtime_enable()

Changes in v8:
- Whitespace in comment

Changes in v7:
- Use device_init_wakeup to enable wakeup
- Fix comments (Bjorn)

Changes in v6:
- Call device_wakeup_enable() to fix WAKE# wakeup.
Address comments from Manivanna:
- Fix/Add Comments
- Fix DT indents
- Remove dw_pcie_ep_linkup() in EP start link
- Add PCIE_T_PVPERL_MS delay in RC PERST# deassert

Changes in v5:
Address driver comments from Manivanna:
- Use dw_pcie_{suspend/resume}_noirq instead of private ones.
- Move dw_pcie_host_init() to probe
- Add stm32_remove_pcie_port cleanup function
- Use of_node_put in stm32_pcie_parse_port
- Remove wakeup-source property
- Use generic dev_pm_set_dedicated_wake_irq to support wake# irq

Changes in v4:
Address bindings comments Rob Herring
- Remove phy property form common yaml
- Remove phy-name property
- Move wake_gpio and reset_gpio to the host root port

Changes in v3:
Address comments from Manivanna, Rob and Bjorn:
- Move host wakeup helper to dwc core (Mani)
- Drop num-lanes=<1> from bindings (Rob)
- Fix PCI address of I/O region (Mani)
- Moved PHY to a RC rootport subsection (Bjorn, Mani)
- Replaced dma-limit quirk by dma-ranges property (Bjorn)
- Moved out perst assert/deassert from start/stop link (Mani)
- Drop link_up test optim (Mani)
- DT and comments rephrasing (Bjorn)
- Add dts entries now that the combophy entries has landed
- Drop delaying Configuration Requests

Changes in v2:
- Fix st,stm32-pcie-common.yaml dt_binding_check

Changes in v1:
Address comments from Rob Herring and Bjorn Helgaas:
- Drop st,limit-mrrs and st,max-payload-size from this patchset
- Remove single reset and clocks binding names and misc yaml cleanups
- Split RC/EP common bindings to a separate schema file
- Use correct PCIE_T_PERST_CLK_US and PCIE_T_RRS_READY_MS defines
- Use .remove instead of .remove_new
- Fix bar reset sequence in EP driver
- Use cleanup blocks for error handling
- Cosmetic fixes

Christian Bruel (9):
dt-bindings: PCI: Add STM32MP25 PCIe Root Complex bindings
PCI: stm32: Add PCIe host support for STM32MP25
dt-bindings: PCI: Add STM32MP25 PCIe Endpoint bindings
PCI: stm32: Add PCIe Endpoint support for STM32MP25
MAINTAINERS: add entry for ST STM32MP25 PCIe drivers
arm64: dts: st: add PCIe pinctrl entries in stm32mp25-pinctrl.dtsi
arm64: dts: st: Add PCIe Root Complex mode on stm32mp251
arm64: dts: st: Add PCIe Endpoint mode on stm32mp251
arm64: dts: st: Enable PCIe on the stm32mp257f-ev1 board

.../bindings/pci/st,stm32-pcie-common.yaml | 33 ++
.../bindings/pci/st,stm32-pcie-ep.yaml | 73 ++++
.../bindings/pci/st,stm32-pcie-host.yaml | 112 +++++
MAINTAINERS | 7 +
arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi | 20 +
arch/arm64/boot/dts/st/stm32mp251.dtsi | 59 +++
arch/arm64/boot/dts/st/stm32mp257f-ev1.dts | 21 +
drivers/pci/controller/dwc/Kconfig | 24 ++
drivers/pci/controller/dwc/Makefile | 2 +
drivers/pci/controller/dwc/pcie-stm32-ep.c | 384 ++++++++++++++++++
drivers/pci/controller/dwc/pcie-stm32.c | 370 +++++++++++++++++
drivers/pci/controller/dwc/pcie-stm32.h | 16 +
12 files changed, 1121 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/st,stm32-pcie-common.yaml
create mode 100644 Documentation/devicetree/bindings/pci/st,stm32-pcie-ep.yaml
create mode 100644 Documentation/devicetree/bindings/pci/st,stm32-pcie-host.yaml
create mode 100644 drivers/pci/controller/dwc/pcie-stm32-ep.c
create mode 100644 drivers/pci/controller/dwc/pcie-stm32.c
create mode 100644 drivers/pci/controller/dwc/pcie-stm32.h


base-commit: 911483b25612c8bc32a706ba940738cc43299496
--
2.34.1



Return-Path: <linux-kernel+bounces-675715-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3706541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:09:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id EC889168588
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:09:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DF76B28982B;
Fri, 6 Jun 2025 12:08:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="iZnGfrDR"
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 42B31286D7E;
Fri, 6 Jun 2025 12:08: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=1749211687; cv=none; b=l78dnL7VaGV+WGNX3ASrH9hf9snfLR/LUaTFYzb0qd4sgVwrmzxrpTvdEyLfwkCBAWt3r7IHT01mxcgdGIoMTQgDxGWq1drT410lMUHJgqaCwuhplrPhWvvUj8TvOjtJlb/GAw2e+JzJ3QP3B+deIsexyz89mwXRNgc+hxAeNKA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211687; c=relaxed/simple;
bh=Gq69FgEIfLluMzSVD1aoP4sxt1bZava5QJxJDAMbqBc=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=uYrsOKrhlPuofvwUBRpU6Ei6JbaZhk2B0oCKWKtHVFdhuZSrnqbeNTepGlHTU4B/MslkFdM1wghESb2rOqP3rK1SJvltAIRoF9mZuEGxJZdpSCdjjlK46lR0TXu+JJ8W3nFtbVQXukx4IsE8mN/1b7KhbIa59wORwWeEIz3lhnU=
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=iZnGfrDR; arc=none smtp.client-ip=91.207.212.93
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com
Received: from pps.filterd (m0046661.ppops.net [127.0.0.1])
by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556BdDqL009202;
Fri, 6 Jun 2025 14:07:34 +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=
vBJF6KRarwUpjrFtYYQioXIaAh2hhLD6qbg5h0VYs4w=; b=iZnGfrDRPi0egAY3
pr3lNnAc/3hzGxmEdd6lut6h/n+RjkR3cqPRDcUVeWLGh1uyg6p4SdHRPIYfx39P
/pSzhnOhAfKjVX4vCyfY3SXroHULrLmy6/vkogXqlK/Dkk+tQqevOsrIacDP3/Ro
6ljnx+sJjha3kCtvQqaTrljzFZeR7kFQmkN2oFxSXBO4fwrg+QI1mk3RKET7GoD+
E8zUGgUm8i+UzyaAocmR98tccuSqJ7kZFBZGDIbvweT6d+iiq22UpFUCpJY/nEdp
Tzr1RA3PY6hxkQCXcoioUIBm6i7VNC5TIxBDMeYxy56DZJWW+0NJN9B1uqHgG2ki
7yE03w==
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 471g8vkmnc-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:07:34 +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 D15454004B;
Fri, 6 Jun 2025 14:06:11 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 30F63AF0118;
Fri, 6 Jun 2025 14:04:39 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:04:38 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 4/9] PCI: stm32: Add PCIe Endpoint support for STM32MP25
Date: Fri, 6 Jun 2025 14:03:58 +0200
Message-ID: <20250606120403.2964857-5-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add driver to configure the STM32MP25 SoC PCIe Gen1 2.5GT/s or Gen2 5GT/s
controller based on the DesignWare PCIe core in endpoint mode.

Uses the common reference clock provided by the host.

The PCIe core_clk receives the pipe0_clk from the ComboPHY as input,
and the ComboPHY PLL must be locked for pipe0_clk to be ready.
Consequently, PCIe core registers cannot be accessed until the ComboPHY is
fully initialised and REFCLK is enabled and ready.

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
---
drivers/pci/controller/dwc/Kconfig | 12 +
drivers/pci/controller/dwc/Makefile | 1 +
drivers/pci/controller/dwc/pcie-stm32-ep.c | 384 +++++++++++++++++++++
drivers/pci/controller/dwc/pcie-stm32.h | 1 +
4 files changed, 398 insertions(+)
create mode 100644 drivers/pci/controller/dwc/pcie-stm32-ep.c

diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig
index 387151f25f5f..72b9c50c1dfd 100644
--- a/drivers/pci/controller/dwc/Kconfig
+++ b/drivers/pci/controller/dwc/Kconfig
@@ -422,6 +422,18 @@ config PCIE_STM32_HOST
This driver can also be built as a module. If so, the module
will be called pcie-stm32.

+config PCIE_STM32_EP
+ tristate "STMicroelectronics STM32MP25 PCIe Controller (endpoint mode)"
+ depends on ARCH_STM32 || COMPILE_TEST
+ depends on PCI_ENDPOINT
+ select PCIE_DW_EP
+ help
+ Enables Endpoint (EP) support for the DesignWare core based PCIe
+ controller found in STM32MP25 SoC.
+
+ This driver can also be built as a module. If so, the module
+ will be called pcie-stm32-ep.
+
config PCI_DRA7XX
tristate

diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile
index 9d3b43504725..85ec6804a299 100644
--- a/drivers/pci/controller/dwc/Makefile
+++ b/drivers/pci/controller/dwc/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_PCIE_UNIPHIER_EP) += pcie-uniphier-ep.o
obj-$(CONFIG_PCIE_VISCONTI_HOST) += pcie-visconti.o
obj-$(CONFIG_PCIE_RCAR_GEN4) += pcie-rcar-gen4.o
obj-$(CONFIG_PCIE_STM32_HOST) += pcie-stm32.o
+obj-$(CONFIG_PCIE_STM32_EP) += pcie-stm32-ep.o

# The following drivers are for devices that use the generic ACPI
# pci_root.c driver but don't support standard ECAM config access.
diff --git a/drivers/pci/controller/dwc/pcie-stm32-ep.c b/drivers/pci/controller/dwc/pcie-stm32-ep.c
new file mode 100644
index 000000000000..3fad2b1b277d
--- /dev/null
+++ b/drivers/pci/controller/dwc/pcie-stm32-ep.c
@@ -0,0 +1,384 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * STMicroelectronics STM32MP25 PCIe endpoint driver.
+ *
+ * Copyright (C) 2025 STMicroelectronics
+ * Author: Christian Bruel <christian.bruel@xxxxxxxxxxx>
+ */
+
+#include <linux/clk.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of_platform.h>
+#include <linux/of_gpio.h>
+#include <linux/phy/phy.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+#include "pcie-designware.h"
+#include "pcie-stm32.h"
+
+enum stm32_pcie_ep_link_status {
+ STM32_PCIE_EP_LINK_DISABLED,
+ STM32_PCIE_EP_LINK_ENABLED,
+};
+
+struct stm32_pcie {
+ struct dw_pcie pci;
+ struct regmap *regmap;
+ struct reset_control *rst;
+ struct phy *phy;
+ struct clk *clk;
+ struct gpio_desc *perst_gpio;
+ enum stm32_pcie_ep_link_status link_status;
+ unsigned int perst_irq;
+};
+
+static void stm32_pcie_ep_init(struct dw_pcie_ep *ep)
+{
+ struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
+ enum pci_barno bar;
+
+ for (bar = 0; bar < PCI_STD_NUM_BARS; bar++)
+ dw_pcie_ep_reset_bar(pci, bar);
+}
+
+static int stm32_pcie_enable_link(struct dw_pcie *pci)
+{
+ struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
+
+ regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
+ STM32MP25_PCIECR_LTSSM_EN,
+ STM32MP25_PCIECR_LTSSM_EN);
+
+ return dw_pcie_wait_for_link(pci);
+}
+
+static void stm32_pcie_disable_link(struct dw_pcie *pci)
+{
+ struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
+
+ regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR, STM32MP25_PCIECR_LTSSM_EN, 0);
+}
+
+static int stm32_pcie_start_link(struct dw_pcie *pci)
+{
+ struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
+ int ret;
+
+ if (stm32_pcie->link_status == STM32_PCIE_EP_LINK_ENABLED) {
+ dev_dbg(pci->dev, "Link is already enabled\n");
+ return 0;
+ }
+
+ dev_dbg(pci->dev, "Enable link\n");
+
+ ret = stm32_pcie_enable_link(pci);
+ if (ret) {
+ dev_err(pci->dev, "PCIe cannot establish link: %d\n", ret);
+ return ret;
+ }
+
+ enable_irq(stm32_pcie->perst_irq);
+
+ stm32_pcie->link_status = STM32_PCIE_EP_LINK_ENABLED;
+
+ return 0;
+}
+
+static void stm32_pcie_stop_link(struct dw_pcie *pci)
+{
+ struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
+
+ if (stm32_pcie->link_status == STM32_PCIE_EP_LINK_DISABLED) {
+ dev_dbg(pci->dev, "Link is already disabled\n");
+ return;
+ }
+
+ dev_dbg(pci->dev, "Disable link\n");
+
+ disable_irq(stm32_pcie->perst_irq);
+
+ stm32_pcie_disable_link(pci);
+
+ stm32_pcie->link_status = STM32_PCIE_EP_LINK_DISABLED;
+}
+
+static int stm32_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
+ unsigned int type, u16 interrupt_num)
+{
+ struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
+
+ switch (type) {
+ case PCI_IRQ_INTX:
+ return dw_pcie_ep_raise_intx_irq(ep, func_no);
+ case PCI_IRQ_MSI:
+ return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
+ default:
+ dev_err(pci->dev, "UNKNOWN IRQ type\n");
+ return -EINVAL;
+ }
+}
+
+static const struct pci_epc_features stm32_pcie_epc_features = {
+ .msi_capable = true,
+ .align = SZ_64K,
+};
+
+static const struct pci_epc_features*
+stm32_pcie_get_features(struct dw_pcie_ep *ep)
+{
+ return &stm32_pcie_epc_features;
+}
+
+static const struct dw_pcie_ep_ops stm32_pcie_ep_ops = {
+ .init = stm32_pcie_ep_init,
+ .raise_irq = stm32_pcie_raise_irq,
+ .get_features = stm32_pcie_get_features,
+};
+
+static const struct dw_pcie_ops dw_pcie_ops = {
+ .start_link = stm32_pcie_start_link,
+ .stop_link = stm32_pcie_stop_link,
+};
+
+static int stm32_pcie_enable_resources(struct stm32_pcie *stm32_pcie)
+{
+ int ret;
+
+ ret = phy_init(stm32_pcie->phy);
+ if (ret)
+ return ret;
+
+ ret = clk_prepare_enable(stm32_pcie->clk);
+ if (ret)
+ phy_exit(stm32_pcie->phy);
+
+ return ret;
+}
+
+static void stm32_pcie_disable_resources(struct stm32_pcie *stm32_pcie)
+{
+ clk_disable_unprepare(stm32_pcie->clk);
+
+ phy_exit(stm32_pcie->phy);
+}
+
+static void stm32_pcie_perst_assert(struct dw_pcie *pci)
+{
+ struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
+ struct dw_pcie_ep *ep = &stm32_pcie->pci.ep;
+ struct device *dev = pci->dev;
+
+ dev_dbg(dev, "PERST asserted by host\n");
+
+ pci_epc_deinit_notify(ep->epc);
+
+ stm32_pcie_disable_resources(stm32_pcie);
+
+ pm_runtime_put_sync(dev);
+}
+
+static void stm32_pcie_perst_deassert(struct dw_pcie *pci)
+{
+ struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
+ struct device *dev = pci->dev;
+ struct dw_pcie_ep *ep = &pci->ep;
+ int ret;
+
+ dev_dbg(dev, "PERST de-asserted by host\n");
+
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0) {
+ dev_err(dev, "Failed to resume runtime PM: %d\n", ret);
+ return;
+ }
+
+ ret = stm32_pcie_enable_resources(stm32_pcie);
+ if (ret) {
+ dev_err(dev, "Failed to enable resources: %d\n", ret);
+ goto err_pm_put_sync;
+ }
+
+ /*
+ * Need to reprogram the configuration space registers here because the
+ * DBI registers were incorrectly reset by the PHY RCC during phy_init().
+ */
+ ret = dw_pcie_ep_init_registers(ep);
+ if (ret) {
+ dev_err(dev, "Failed to complete initialization: %d\n", ret);
+ goto err_disable_resources;
+ }
+
+ pci_epc_init_notify(ep->epc);
+
+ return;
+
+err_disable_resources:
+ stm32_pcie_disable_resources(stm32_pcie);
+
+err_pm_put_sync:
+ pm_runtime_put_sync(dev);
+}
+
+static irqreturn_t stm32_pcie_ep_perst_irq_thread(int irq, void *data)
+{
+ struct stm32_pcie *stm32_pcie = data;
+ struct dw_pcie *pci = &stm32_pcie->pci;
+ u32 perst;
+
+ perst = gpiod_get_value(stm32_pcie->perst_gpio);
+ if (perst)
+ stm32_pcie_perst_assert(pci);
+ else
+ stm32_pcie_perst_deassert(pci);
+
+ irq_set_irq_type(gpiod_to_irq(stm32_pcie->perst_gpio),
+ (perst ? IRQF_TRIGGER_HIGH : IRQF_TRIGGER_LOW));
+
+ return IRQ_HANDLED;
+}
+
+static int stm32_add_pcie_ep(struct stm32_pcie *stm32_pcie,
+ struct platform_device *pdev)
+{
+ struct dw_pcie_ep *ep = &stm32_pcie->pci.ep;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ ret = regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
+ STM32MP25_PCIECR_TYPE_MASK,
+ STM32MP25_PCIECR_EP);
+ if (ret)
+ return ret;
+
+ reset_control_assert(stm32_pcie->rst);
+ reset_control_deassert(stm32_pcie->rst);
+
+ ep->ops = &stm32_pcie_ep_ops;
+
+ ret = dw_pcie_ep_init(ep);
+ if (ret) {
+ dev_err(dev, "Failed to initialize ep: %d\n", ret);
+ return ret;
+ }
+
+ ret = stm32_pcie_enable_resources(stm32_pcie);
+ if (ret) {
+ dev_err(dev, "Failed to enable resources: %d\n", ret);
+ dw_pcie_ep_deinit(ep);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int stm32_pcie_probe(struct platform_device *pdev)
+{
+ struct stm32_pcie *stm32_pcie;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ stm32_pcie = devm_kzalloc(dev, sizeof(*stm32_pcie), GFP_KERNEL);
+ if (!stm32_pcie)
+ return -ENOMEM;
+
+ stm32_pcie->pci.dev = dev;
+ stm32_pcie->pci.ops = &dw_pcie_ops;
+
+ stm32_pcie->regmap = syscon_regmap_lookup_by_compatible("st,stm32mp25-syscfg");
+ if (IS_ERR(stm32_pcie->regmap))
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->regmap),
+ "No syscfg specified\n");
+
+ stm32_pcie->phy = devm_phy_get(dev, NULL);
+ if (IS_ERR(stm32_pcie->phy))
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->phy),
+ "failed to get pcie-phy\n");
+
+ stm32_pcie->clk = devm_clk_get(dev, NULL);
+ if (IS_ERR(stm32_pcie->clk))
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->clk),
+ "Failed to get PCIe clock source\n");
+
+ stm32_pcie->rst = devm_reset_control_get_exclusive(dev, NULL);
+ if (IS_ERR(stm32_pcie->rst))
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->rst),
+ "Failed to get PCIe reset\n");
+
+ stm32_pcie->perst_gpio = devm_gpiod_get(dev, "reset", GPIOD_IN);
+ if (IS_ERR(stm32_pcie->perst_gpio))
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->perst_gpio),
+ "Failed to get reset GPIO\n");
+
+ ret = phy_set_mode(stm32_pcie->phy, PHY_MODE_PCIE);
+ if (ret)
+ return ret;
+
+ platform_set_drvdata(pdev, stm32_pcie);
+
+ pm_runtime_get_noresume(dev);
+
+ ret = devm_pm_runtime_enable(dev);
+ if (ret < 0) {
+ pm_runtime_put_noidle(&pdev->dev);
+ return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
+ }
+
+ stm32_pcie->perst_irq = gpiod_to_irq(stm32_pcie->perst_gpio);
+
+ /* Will be enabled in start_link when device is initialized. */
+ irq_set_status_flags(stm32_pcie->perst_irq, IRQ_NOAUTOEN);
+
+ ret = devm_request_threaded_irq(dev, stm32_pcie->perst_irq, NULL,
+ stm32_pcie_ep_perst_irq_thread,
+ IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ "perst_irq", stm32_pcie);
+ if (ret) {
+ pm_runtime_put_noidle(&pdev->dev);
+ return dev_err_probe(dev, ret, "Failed to request PERST IRQ: %d\n");
+ }
+
+ ret = stm32_add_pcie_ep(stm32_pcie, pdev);
+ if (ret)
+ pm_runtime_put_noidle(&pdev->dev);
+
+ return ret;
+}
+
+static void stm32_pcie_remove(struct platform_device *pdev)
+{
+ struct stm32_pcie *stm32_pcie = platform_get_drvdata(pdev);
+ struct dw_pcie *pci = &stm32_pcie->pci;
+ struct dw_pcie_ep *ep = &pci->ep;
+
+ dw_pcie_stop_link(pci);
+
+ pci_epc_deinit_notify(ep->epc);
+ dw_pcie_ep_deinit(ep);
+
+ stm32_pcie_disable_resources(stm32_pcie);
+
+ pm_runtime_put_sync(&pdev->dev);
+}
+
+static const struct of_device_id stm32_pcie_ep_of_match[] = {
+ { .compatible = "st,stm32mp25-pcie-ep" },
+ {},
+};
+
+static struct platform_driver stm32_pcie_ep_driver = {
+ .probe = stm32_pcie_probe,
+ .remove = stm32_pcie_remove,
+ .driver = {
+ .name = "stm32-ep-pcie",
+ .of_match_table = stm32_pcie_ep_of_match,
+ },
+};
+
+module_platform_driver(stm32_pcie_ep_driver);
+
+MODULE_AUTHOR("Christian Bruel <christian.bruel@xxxxxxxxxxx>");
+MODULE_DESCRIPTION("STM32MP25 PCIe Endpoint Controller driver");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(of, stm32_pcie_ep_of_match);
diff --git a/drivers/pci/controller/dwc/pcie-stm32.h b/drivers/pci/controller/dwc/pcie-stm32.h
index 387112c4e42c..09d39f04e469 100644
--- a/drivers/pci/controller/dwc/pcie-stm32.h
+++ b/drivers/pci/controller/dwc/pcie-stm32.h
@@ -9,6 +9,7 @@
#define to_stm32_pcie(x) dev_get_drvdata((x)->dev)

#define STM32MP25_PCIECR_TYPE_MASK GENMASK(11, 8)
+#define STM32MP25_PCIECR_EP 0
#define STM32MP25_PCIECR_LTSSM_EN BIT(2)
#define STM32MP25_PCIECR_RC BIT(10)

--
2.34.1



Return-Path: <linux-kernel+bounces-675713-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D824B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:10:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id D5EA0189DB0A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:09:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D4052882DD;
Fri, 6 Jun 2025 12:08:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="VUQ6RWTf"
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 356F4285417;
Fri, 6 Jun 2025 12:08: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=1749211687; cv=none; b=TtVxOIvQh+nlc7rzsX7nUgrOXMXN5HdiI3wz52ugXP9G2uYm+NI7aefpE4FknD4WutupGNYjGkBD6PQhhSbAut7INdxSd3lQqo1i/1blc5CsbW+emhFoLbo1Q37iA3DO2lO+mpSPKfbl48OjwMnuJebgBX1Yv1NNvsW0X5aNN24=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211687; c=relaxed/simple;
bh=aDfuuMiWkf0lkqLLHUt1wwJ5Qz9LTVGJXcN1g2ZjIZ8=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=npZSAcXH/6Bf1gmpD24XpSg6qbunPnGhA+LaVtiJvwRMLd7SJ1wzwoXl4Zv+g85o7b/HYYUfwv1jZkwmN/denF6vR7RXbJQL3QCezlUV/g1ULBVq4s1M8SzeQxQRisu1FZ0TzgUp9W6D/qFF3h7CDTE7TmXeOVflvFhGwkXeFj4=
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=VUQ6RWTf; arc=none smtp.client-ip=91.207.212.93
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com
Received: from pps.filterd (m0369457.ppops.net [127.0.0.1])
by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556BcsQe021223;
Fri, 6 Jun 2025 14:07:34 +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=
H6eETUqWv3VVFbBigRhvmAs5gJe0ByLoViR9hRNwVhM=; b=VUQ6RWTfDfTxUYsf
NE99pnDR4FyU9yniC82rt34B7yDFJ++TEKuUPhfAjY7+nS+GGgVuhJUi6XDiwgYU
QQpV8daQGmxegtibEzhNeGYMAajKCmnGXdKdLCFvKETbxegpkUhBfX8kJnfL/D+m
mlgYAbEegG4TAKtAdsjeoViST6hTuT1T4DziVuMaakrw1nZPccw5slre+GegqH9t
IiLKr8EpXkX3JIGhFR0Pr7yUy1hLUOocF6FC/9u1wrAhGpZXI2++Thjcn576NSqr
naDZPRLz/AAU5NjfJrLr3VHyimozl4EvreYBUs8lF+hZmvGIUNTcYTOSvV3BK63g
vCszrg==
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 471g8tbn3q-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:07:34 +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 D18E540050;
Fri, 6 Jun 2025 14:06:11 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 67064AF0116;
Fri, 6 Jun 2025 14:04:36 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:04:36 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 3/9] dt-bindings: PCI: Add STM32MP25 PCIe Endpoint bindings
Date: Fri, 6 Jun 2025 14:03:57 +0200
Message-ID: <20250606120403.2964857-4-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

STM32MP25 PCIe Controller is based on the DesignWare core configured as
end point mode from the SYSCFG register.

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
Reviewed-by: Rob Herring (Arm) <robh@xxxxxxxxxx>
---
.../bindings/pci/st,stm32-pcie-ep.yaml | 73 +++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/st,stm32-pcie-ep.yaml

diff --git a/Documentation/devicetree/bindings/pci/st,stm32-pcie-ep.yaml b/Documentation/devicetree/bindings/pci/st,stm32-pcie-ep.yaml
new file mode 100644
index 000000000000..b076ada4f332
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/st,stm32-pcie-ep.yaml
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/st,stm32-pcie-ep.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics STM32MP25 PCIe Endpoint
+
+maintainers:
+ - Christian Bruel <christian.bruel@xxxxxxxxxxx>
+
+description:
+ PCIe endpoint controller based on the Synopsys DesignWare PCIe core.
+
+allOf:
+ - $ref: /schemas/pci/snps,dw-pcie-ep.yaml#
+ - $ref: /schemas/pci/st,stm32-pcie-common.yaml#
+
+properties:
+ compatible:
+ const: st,stm32mp25-pcie-ep
+
+ reg:
+ items:
+ - description: Data Bus Interface (DBI) registers.
+ - description: Data Bus Interface (DBI) shadow registers.
+ - description: Internal Address Translation Unit (iATU) registers.
+ - description: PCIe configuration registers.
+
+ reg-names:
+ items:
+ - const: dbi
+ - const: dbi2
+ - const: atu
+ - const: addr_space
+
+ reset-gpios:
+ description: GPIO controlled connection to PERST# signal
+ maxItems: 1
+
+ phys:
+ maxItems: 1
+
+required:
+ - phys
+ - reset-gpios
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/st,stm32mp25-rcc.h>
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/phy/phy.h>
+ #include <dt-bindings/reset/st,stm32mp25-rcc.h>
+
+ pcie-ep@48400000 {
+ compatible = "st,stm32mp25-pcie-ep";
+ reg = <0x48400000 0x400000>,
+ <0x48500000 0x100000>,
+ <0x48700000 0x80000>,
+ <0x10000000 0x10000000>;
+ reg-names = "dbi", "dbi2", "atu", "addr_space";
+ clocks = <&rcc CK_BUS_PCIE>;
+ phys = <&combophy PHY_TYPE_PCIE>;
+ resets = <&rcc PCIE_R>;
+ pinctrl-names = "default", "init";
+ pinctrl-0 = <&pcie_pins_a>;
+ pinctrl-1 = <&pcie_init_pins_a>;
+ reset-gpios = <&gpioj 8 GPIO_ACTIVE_LOW>;
+ access-controllers = <&rifsc 68>;
+ power-domains = <&CLUSTER_PD>;
+ };
--
2.34.1



Return-Path: <linux-kernel+bounces-675716-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 520E941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:10:27 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id D966A1886DBB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:09:46 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ED0C328982C;
Fri, 6 Jun 2025 12:08:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="mscxCIH7"
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 35761286D50;
Fri, 6 Jun 2025 12:08: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=1749211687; cv=none; b=DgHN8VFRngclOe2lzijH6lEE32+SEY1uiKId8szdQwYNUdHy7l8Fa1YR8mcSehStC6w2XaH707o9vt0oSpLGd6LUSGFhKNUulUeZ6xo4PVHYnqWjAqEM4HwCjj1ll6a9valztyQoCICFqLl6AhkIWawNMSnHeU4xLDGGSL3pZaQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211687; c=relaxed/simple;
bh=IvHMt7NuAeuBwR3KtHVYfA8qmFpBImvPwnSXOQBNZJk=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=Ybv2ntRpRo2N3PW2kxXKcoLIeVxMn7N8Iz3iCixZX4W3OnK3LH26kZgJ2fv6f8l6SH2yCQIGfT4vbWvNmnYV46Ly1yk6HCbDDZfWbMNqNHwIfE5FVKP+KIPpXec4uyh33Ih3udGSnvGD205xKNscLs9ljvnNvEzaO8dLOww6WUM=
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=mscxCIH7; arc=none smtp.client-ip=91.207.212.93
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com
Received: from pps.filterd (m0369457.ppops.net [127.0.0.1])
by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556Bd3vC021372;
Fri, 6 Jun 2025 14:07: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=
tcGjV4BEwydwsHiHpYYqEFPkb3gZ2VyAD/ba+IDloBw=; b=mscxCIH7F4Cod/72
UJltox7fiVNOuelwnhmQJcN0FEMoPBzFEDGa2+MT2YIwNQDJxEv2fgXwPDa4VqAQ
OhzEwSw+Xlg63rV5ugPhUOxTabRSvHLW4yPxbJB9j5t2KcZMiiDuw1Je7AooFWKu
+dZyedHlUQzYZ2fOd5rs+F7XQ4/rHIea7nEYJW3LD5sRGil9+Rjt70regpAHIyYC
tgvW0x8AuTKBcAXvt46qizrshwrqH1Fmb7t+OfZ3mE768QA1E5Xd4MvccZNuFYfg
lClCxscXojXNNmiVRBtUX87uePfXCj8XtVfEHDq9vkFjjrnb/u7u822oSDkhiZVi
VaG43Q==
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 471g8tbn3r-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:07:34 +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 D17EE4004F;
Fri, 6 Jun 2025 14:06:11 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 777F2AE7CC5;
Fri, 6 Jun 2025 14:04:33 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:04:33 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 2/9] PCI: stm32: Add PCIe host support for STM32MP25
Date: Fri, 6 Jun 2025 14:03:56 +0200
Message-ID: <20250606120403.2964857-3-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add driver for the STM32MP25 SoC PCIe Gen1 2.5 GT/s and Gen2 5GT/s
controller based on the DesignWare PCIe core.

Supports MSI via GICv2m, Single Virtual Channel, Single Function

Supports WAKE# GPIO.

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
---
drivers/pci/controller/dwc/Kconfig | 12 +
drivers/pci/controller/dwc/Makefile | 1 +
drivers/pci/controller/dwc/pcie-stm32.c | 368 ++++++++++++++++++++++++
drivers/pci/controller/dwc/pcie-stm32.h | 15 +
4 files changed, 396 insertions(+)
create mode 100644 drivers/pci/controller/dwc/pcie-stm32.c
create mode 100644 drivers/pci/controller/dwc/pcie-stm32.h

diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig
index d9f0386396ed..387151f25f5f 100644
--- a/drivers/pci/controller/dwc/Kconfig
+++ b/drivers/pci/controller/dwc/Kconfig
@@ -410,6 +410,18 @@ config PCIE_SPEAR13XX
help
Say Y here if you want PCIe support on SPEAr13XX SoCs.

+config PCIE_STM32_HOST
+ tristate "STMicroelectronics STM32MP25 PCIe Controller (host mode)"
+ depends on ARCH_STM32 || COMPILE_TEST
+ depends on PCI_MSI
+ select PCIE_DW_HOST
+ help
+ Enables Root Complex (RC) support for the DesignWare core based PCIe
+ controller found in STM32MP25 SoC.
+
+ This driver can also be built as a module. If so, the module
+ will be called pcie-stm32.
+
config PCI_DRA7XX
tristate

diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile
index 908cb7f345db..9d3b43504725 100644
--- a/drivers/pci/controller/dwc/Makefile
+++ b/drivers/pci/controller/dwc/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_PCIE_UNIPHIER) += pcie-uniphier.o
obj-$(CONFIG_PCIE_UNIPHIER_EP) += pcie-uniphier-ep.o
obj-$(CONFIG_PCIE_VISCONTI_HOST) += pcie-visconti.o
obj-$(CONFIG_PCIE_RCAR_GEN4) += pcie-rcar-gen4.o
+obj-$(CONFIG_PCIE_STM32_HOST) += pcie-stm32.o

# The following drivers are for devices that use the generic ACPI
# pci_root.c driver but don't support standard ECAM config access.
diff --git a/drivers/pci/controller/dwc/pcie-stm32.c b/drivers/pci/controller/dwc/pcie-stm32.c
new file mode 100644
index 000000000000..6bf1b63f88c6
--- /dev/null
+++ b/drivers/pci/controller/dwc/pcie-stm32.c
@@ -0,0 +1,368 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * STMicroelectronics STM32MP25 PCIe root complex driver.
+ *
+ * Copyright (C) 2025 STMicroelectronics
+ * Author: Christian Bruel <christian.bruel@xxxxxxxxxxx>
+ */
+
+#include <linux/clk.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of_platform.h>
+#include <linux/phy/phy.h>
+#include <linux/pinctrl/devinfo.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/pm_wakeirq.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+#include "pcie-designware.h"
+#include "pcie-stm32.h"
+#include "../../pci.h"
+
+struct stm32_pcie {
+ struct dw_pcie pci;
+ struct regmap *regmap;
+ struct reset_control *rst;
+ struct phy *phy;
+ struct clk *clk;
+ struct gpio_desc *perst_gpio;
+ struct gpio_desc *wake_gpio;
+};
+
+static void stm32_pcie_deassert_perst(struct stm32_pcie *stm32_pcie)
+{
+ /* Delay PERST# de-assertion until the power stabilizes */
+ msleep(PCIE_T_PVPERL_MS);
+
+ gpiod_set_value(stm32_pcie->perst_gpio, 0);
+
+ /* Wait for the REFCLK to stabilize */
+ if (stm32_pcie->perst_gpio)
+ msleep(PCIE_T_RRS_READY_MS);
+}
+
+static void stm32_pcie_assert_perst(struct stm32_pcie *stm32_pcie)
+{
+ gpiod_set_value(stm32_pcie->perst_gpio, 1);
+}
+
+static int stm32_pcie_start_link(struct dw_pcie *pci)
+{
+ struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
+
+ return regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
+ STM32MP25_PCIECR_LTSSM_EN,
+ STM32MP25_PCIECR_LTSSM_EN);
+}
+
+static void stm32_pcie_stop_link(struct dw_pcie *pci)
+{
+ struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
+
+ regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
+ STM32MP25_PCIECR_LTSSM_EN, 0);
+}
+
+static int stm32_pcie_suspend_noirq(struct device *dev)
+{
+ struct stm32_pcie *stm32_pcie = dev_get_drvdata(dev);
+ int ret;
+
+ ret = dw_pcie_suspend_noirq(&stm32_pcie->pci);
+ if (ret)
+ return ret;
+
+ stm32_pcie_assert_perst(stm32_pcie);
+
+ clk_disable_unprepare(stm32_pcie->clk);
+
+ if (!device_wakeup_path(dev))
+ phy_exit(stm32_pcie->phy);
+
+ return pinctrl_pm_select_sleep_state(dev);
+}
+
+static int stm32_pcie_resume_noirq(struct device *dev)
+{
+ struct stm32_pcie *stm32_pcie = dev_get_drvdata(dev);
+ int ret;
+
+ /*
+ * The core clock is gated with CLKREQ# from the COMBOPHY REFCLK,
+ * thus if no device is present, must force it low with an init pinmux
+ * to be able to access the DBI registers.
+ */
+ if (!IS_ERR(dev->pins->init_state))
+ ret = pinctrl_select_state(dev->pins->p, dev->pins->init_state);
+ else
+ ret = pinctrl_pm_select_default_state(dev);
+
+ if (ret) {
+ dev_err(dev, "Failed to activate pinctrl pm state: %d\n", ret);
+ return ret;
+ }
+
+ if (!device_wakeup_path(dev)) {
+ ret = phy_init(stm32_pcie->phy);
+ if (ret) {
+ pinctrl_pm_select_default_state(dev);
+ return ret;
+ }
+ }
+
+ ret = clk_prepare_enable(stm32_pcie->clk);
+ if (ret)
+ goto err_phy_exit;
+
+ stm32_pcie_deassert_perst(stm32_pcie);
+
+ ret = dw_pcie_resume_noirq(&stm32_pcie->pci);
+ if (ret)
+ goto err_disable_clk;
+
+ pinctrl_pm_select_default_state(dev);
+
+ return 0;
+
+err_disable_clk:
+ stm32_pcie_assert_perst(stm32_pcie);
+ clk_disable_unprepare(stm32_pcie->clk);
+
+err_phy_exit:
+ phy_exit(stm32_pcie->phy);
+ pinctrl_pm_select_default_state(dev);
+
+ return ret;
+}
+
+static const struct dev_pm_ops stm32_pcie_pm_ops = {
+ NOIRQ_SYSTEM_SLEEP_PM_OPS(stm32_pcie_suspend_noirq,
+ stm32_pcie_resume_noirq)
+};
+
+static const struct dw_pcie_host_ops stm32_pcie_host_ops = {
+};
+
+static const struct dw_pcie_ops dw_pcie_ops = {
+ .start_link = stm32_pcie_start_link,
+ .stop_link = stm32_pcie_stop_link
+};
+
+static int stm32_add_pcie_port(struct stm32_pcie *stm32_pcie)
+{
+ struct device *dev = stm32_pcie->pci.dev;
+ unsigned int wake_irq;
+ int ret;
+
+ /* Start to enable resources with PERST# asserted */
+
+ ret = phy_set_mode(stm32_pcie->phy, PHY_MODE_PCIE);
+ if (ret)
+ return ret;
+
+ ret = phy_init(stm32_pcie->phy);
+ if (ret)
+ return ret;
+
+ ret = regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
+ STM32MP25_PCIECR_TYPE_MASK,
+ STM32MP25_PCIECR_RC);
+ if (ret)
+ goto err_phy_exit;
+
+ stm32_pcie_deassert_perst(stm32_pcie);
+
+ if (stm32_pcie->wake_gpio) {
+ wake_irq = gpiod_to_irq(stm32_pcie->wake_gpio);
+ ret = dev_pm_set_dedicated_wake_irq(dev, wake_irq);
+ if (ret) {
+ dev_err(dev, "Failed to enable wakeup irq %d\n", ret);
+ goto err_assert_perst;
+ }
+ irq_set_irq_type(wake_irq, IRQ_TYPE_EDGE_FALLING);
+ }
+
+ return 0;
+
+err_assert_perst:
+ stm32_pcie_assert_perst(stm32_pcie);
+
+err_phy_exit:
+ phy_exit(stm32_pcie->phy);
+
+ return ret;
+}
+
+static void stm32_remove_pcie_port(struct stm32_pcie *stm32_pcie)
+{
+ dev_pm_clear_wake_irq(stm32_pcie->pci.dev);
+
+ stm32_pcie_assert_perst(stm32_pcie);
+
+ phy_exit(stm32_pcie->phy);
+}
+
+static int stm32_pcie_parse_port(struct stm32_pcie *stm32_pcie)
+{
+ struct device *dev = stm32_pcie->pci.dev;
+ struct device_node *root_port;
+
+ root_port = of_get_next_available_child(dev->of_node, NULL);
+
+ stm32_pcie->phy = devm_of_phy_get(dev, root_port, NULL);
+ if (IS_ERR(stm32_pcie->phy)) {
+ of_node_put(root_port);
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->phy),
+ "Failed to get pcie-phy\n");
+ }
+
+ stm32_pcie->perst_gpio = devm_fwnode_gpiod_get(dev, of_fwnode_handle(root_port),
+ "reset", GPIOD_OUT_HIGH, NULL);
+ if (IS_ERR(stm32_pcie->perst_gpio)) {
+ if (PTR_ERR(stm32_pcie->perst_gpio) != -ENOENT) {
+ of_node_put(root_port);
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->perst_gpio),
+ "Failed to get reset GPIO\n");
+ }
+ stm32_pcie->perst_gpio = NULL;
+ }
+
+ stm32_pcie->wake_gpio = devm_fwnode_gpiod_get(dev, of_fwnode_handle(root_port),
+ "wake", GPIOD_IN, NULL);
+
+ if (IS_ERR(stm32_pcie->wake_gpio)) {
+ if (PTR_ERR(stm32_pcie->wake_gpio) != -ENOENT) {
+ of_node_put(root_port);
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->wake_gpio),
+ "Failed to get wake GPIO\n");
+ }
+ stm32_pcie->wake_gpio = NULL;
+ }
+
+ of_node_put(root_port);
+
+ return 0;
+}
+
+static int stm32_pcie_probe(struct platform_device *pdev)
+{
+ struct stm32_pcie *stm32_pcie;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ stm32_pcie = devm_kzalloc(dev, sizeof(*stm32_pcie), GFP_KERNEL);
+ if (!stm32_pcie)
+ return -ENOMEM;
+
+ stm32_pcie->pci.dev = dev;
+ stm32_pcie->pci.ops = &dw_pcie_ops;
+ stm32_pcie->pci.pp.ops = &stm32_pcie_host_ops;
+
+ stm32_pcie->regmap = syscon_regmap_lookup_by_compatible("st,stm32mp25-syscfg");
+ if (IS_ERR(stm32_pcie->regmap))
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->regmap),
+ "No syscfg specified\n");
+
+ stm32_pcie->clk = devm_clk_get(dev, NULL);
+ if (IS_ERR(stm32_pcie->clk))
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->clk),
+ "Failed to get PCIe clock source\n");
+
+ stm32_pcie->rst = devm_reset_control_get_exclusive(dev, NULL);
+ if (IS_ERR(stm32_pcie->rst))
+ return dev_err_probe(dev, PTR_ERR(stm32_pcie->rst),
+ "Failed to get PCIe reset\n");
+
+ ret = stm32_pcie_parse_port(stm32_pcie);
+ if (ret)
+ return ret;
+
+ platform_set_drvdata(pdev, stm32_pcie);
+
+ ret = stm32_add_pcie_port(stm32_pcie);
+ if (ret)
+ return ret;
+
+ reset_control_assert(stm32_pcie->rst);
+ reset_control_deassert(stm32_pcie->rst);
+
+ ret = clk_prepare_enable(stm32_pcie->clk);
+ if (ret) {
+ dev_err(dev, "Core clock enable failed %d\n", ret);
+ goto err_remove_port;
+ }
+
+ ret = pm_runtime_set_active(dev);
+ if (ret < 0) {
+ clk_disable_unprepare(stm32_pcie->clk);
+ stm32_remove_pcie_port(stm32_pcie);
+ return dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
+ }
+
+ pm_runtime_no_callbacks(dev);
+
+ ret = devm_pm_runtime_enable(dev);
+ if (ret < 0) {
+ clk_disable_unprepare(stm32_pcie->clk);
+ stm32_remove_pcie_port(stm32_pcie);
+ return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
+ }
+
+ ret = dw_pcie_host_init(&stm32_pcie->pci.pp);
+ if (ret)
+ goto err_disable_clk;
+
+ if (stm32_pcie->wake_gpio)
+ device_init_wakeup(dev, true);
+
+ return 0;
+
+err_disable_clk:
+ clk_disable_unprepare(stm32_pcie->clk);
+
+err_remove_port:
+ stm32_remove_pcie_port(stm32_pcie);
+
+ return ret;
+}
+
+static void stm32_pcie_remove(struct platform_device *pdev)
+{
+ struct stm32_pcie *stm32_pcie = platform_get_drvdata(pdev);
+ struct dw_pcie_rp *pp = &stm32_pcie->pci.pp;
+
+ if (stm32_pcie->wake_gpio)
+ device_init_wakeup(&pdev->dev, false);
+
+ dw_pcie_host_deinit(pp);
+
+ clk_disable_unprepare(stm32_pcie->clk);
+
+ stm32_remove_pcie_port(stm32_pcie);
+
+ pm_runtime_put_noidle(&pdev->dev);
+}
+
+static const struct of_device_id stm32_pcie_of_match[] = {
+ { .compatible = "st,stm32mp25-pcie-rc" },
+ {},
+};
+
+static struct platform_driver stm32_pcie_driver = {
+ .probe = stm32_pcie_probe,
+ .remove = stm32_pcie_remove,
+ .driver = {
+ .name = "stm32-pcie",
+ .of_match_table = stm32_pcie_of_match,
+ .pm = &stm32_pcie_pm_ops,
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+ },
+};
+
+module_platform_driver(stm32_pcie_driver);
+
+MODULE_AUTHOR("Christian Bruel <christian.bruel@xxxxxxxxxxx>");
+MODULE_DESCRIPTION("STM32MP25 PCIe Controller driver");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(of, stm32_pcie_of_match);
diff --git a/drivers/pci/controller/dwc/pcie-stm32.h b/drivers/pci/controller/dwc/pcie-stm32.h
new file mode 100644
index 000000000000..387112c4e42c
--- /dev/null
+++ b/drivers/pci/controller/dwc/pcie-stm32.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * ST PCIe driver definitions for STM32-MP25 SoC
+ *
+ * Copyright (C) 2025 STMicroelectronics - All Rights Reserved
+ * Author: Christian Bruel <christian.bruel@xxxxxxxxxxx>
+ */
+
+#define to_stm32_pcie(x) dev_get_drvdata((x)->dev)
+
+#define STM32MP25_PCIECR_TYPE_MASK GENMASK(11, 8)
+#define STM32MP25_PCIECR_LTSSM_EN BIT(2)
+#define STM32MP25_PCIECR_RC BIT(10)
+
+#define SYSCFG_PCIECR 0x6000
--
2.34.1



Return-Path: <linux-kernel+bounces-675717-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C9A4241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:11:03 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id C3E553B308C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:09:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 55517289E35;
Fri, 6 Jun 2025 12:08:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="GTRLked/"
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 AE57A288C32;
Fri, 6 Jun 2025 12:08:07 +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=1749211689; cv=none; b=BOnAwCdq17mXhJScJyxxLxb5a+o3qSRf/FJ4iFUtuOkZGTkmzK+xg59jBXNCj7uDGaXUAm/nLlGYgfvvFWNKLr/aquqCSxD5yStuUPpJLcQUKhqT5wr/XwHqbcFpedZJi7lkPZJsL/ELz3NDcx/S0cbP6AdMdDQdiAVwREljkDw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211689; c=relaxed/simple;
bh=q+lQXjaZ1l+yG5MxLHXHU02zoVRchMlGeudXCp14EAg=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=BfqMmjOPd7aNAfxXP8GzynsjALMcEuCAeZgY6c4OmzJ2WQZrWTFjMXV0o3PXxH4Q1QJqB8AKmRaLMptusOhkah6kf9tSCYIt1wh5r+SLM2VyAwp1Oo9ZQsL7lb5+wbxzNDeHB7iMqdxnuDGNL6GHB2VBwgwxsckTOO0LtgWdUls=
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=GTRLked/; arc=none smtp.client-ip=91.207.212.93
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com
Received: from pps.filterd (m0046660.ppops.net [127.0.0.1])
by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556Bd9ih023650;
Fri, 6 Jun 2025 14:07:34 +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=
IzV24CKy9+GByv4nV3URGiNxMvyLfi5b2XJFt9IvXeI=; b=GTRLked/0sZgHApf
pqMU5n8p8+4BXKWg/Um0Izzo+c+KMDCiZnZiOj9i3T5T9NcywdB72lTwKFNJf0wt
K+dgh9cRgSK/rbLYEAxjxWYrP+y7AZLWV4obKZsjBSH7AKq0ite9iTubvwqRgOkZ
XX2q19j2c5Q5lrGD33V8JLQL5egDiUlcb48zNUHO8trUI0qsrKqr+DmmknC0jJZm
RZPf9nSmViA4nUyboAyrLR8PHgKN18ZsgJ2eOwf5BGMG+F8BVpQEGR5ccABE2guF
0uyqzuF5t/Ke0j6wdHbZvAyJl5XPAXSoYMXZAXovqj5pATpTVZA/X0doqEhcY+c+
D5MvNQ==
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 471g93kjt7-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:07:34 +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 D16B04004C;
Fri, 6 Jun 2025 14:06:11 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A2A75AEB645;
Fri, 6 Jun 2025 14:04:30 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:04:30 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 1/9] dt-bindings: PCI: Add STM32MP25 PCIe Root Complex bindings
Date: Fri, 6 Jun 2025 14:03:55 +0200
Message-ID: <20250606120403.2964857-2-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Document the bindings for STM32MP25 PCIe Controller configured in
root complex mode with one root port.

Supports 4 INTx and MSI interrupts from the ARM GICv2m controller.

STM32 PCIe may be in a power domain which is the case for the STM32MP25
based boards.

Supports WAKE# from wake-gpios

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
Reviewed-by: Rob Herring (Arm) <robh@xxxxxxxxxx>
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
---
.../bindings/pci/st,stm32-pcie-common.yaml | 33 ++++++
.../bindings/pci/st,stm32-pcie-host.yaml | 112 ++++++++++++++++++
2 files changed, 145 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/st,stm32-pcie-common.yaml
create mode 100644 Documentation/devicetree/bindings/pci/st,stm32-pcie-host.yaml

diff --git a/Documentation/devicetree/bindings/pci/st,stm32-pcie-common.yaml b/Documentation/devicetree/bindings/pci/st,stm32-pcie-common.yaml
new file mode 100644
index 000000000000..5adbff259204
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/st,stm32-pcie-common.yaml
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/st,stm32-pcie-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STM32MP25 PCIe RC/EP controller
+
+maintainers:
+ - Christian Bruel <christian.bruel@xxxxxxxxxxx>
+
+description:
+ STM32MP25 PCIe RC/EP common properties
+
+properties:
+ clocks:
+ maxItems: 1
+ description: PCIe system clock
+
+ resets:
+ maxItems: 1
+
+ power-domains:
+ maxItems: 1
+
+ access-controllers:
+ maxItems: 1
+
+required:
+ - clocks
+ - resets
+
+additionalProperties: true
diff --git a/Documentation/devicetree/bindings/pci/st,stm32-pcie-host.yaml b/Documentation/devicetree/bindings/pci/st,stm32-pcie-host.yaml
new file mode 100644
index 000000000000..443bfe2cdc98
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/st,stm32-pcie-host.yaml
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/st,stm32-pcie-host.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics STM32MP25 PCIe Root Complex
+
+maintainers:
+ - Christian Bruel <christian.bruel@xxxxxxxxxxx>
+
+description:
+ PCIe root complex controller based on the Synopsys DesignWare PCIe core.
+
+allOf:
+ - $ref: /schemas/pci/snps,dw-pcie.yaml#
+ - $ref: /schemas/pci/st,stm32-pcie-common.yaml#
+
+properties:
+ compatible:
+ const: st,stm32mp25-pcie-rc
+
+ reg:
+ items:
+ - description: Data Bus Interface (DBI) registers.
+ - description: PCIe configuration registers.
+
+ reg-names:
+ items:
+ - const: dbi
+ - const: config
+
+ msi-parent:
+ maxItems: 1
+
+patternProperties:
+ '^pcie@[0-2],0$':
+ type: object
+ $ref: /schemas/pci/pci-pci-bridge.yaml#
+
+ properties:
+ reg:
+ maxItems: 1
+
+ phys:
+ maxItems: 1
+
+ reset-gpios:
+ description: GPIO controlled connection to PERST# signal
+ maxItems: 1
+
+ wake-gpios:
+ description: GPIO used as WAKE# input signal
+ maxItems: 1
+
+ required:
+ - phys
+ - ranges
+
+ unevaluatedProperties: false
+
+required:
+ - interrupt-map
+ - interrupt-map-mask
+ - ranges
+ - dma-ranges
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/st,stm32mp25-rcc.h>
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/phy/phy.h>
+ #include <dt-bindings/reset/st,stm32mp25-rcc.h>
+
+ pcie@48400000 {
+ compatible = "st,stm32mp25-pcie-rc";
+ device_type = "pci";
+ reg = <0x48400000 0x400000>,
+ <0x10000000 0x10000>;
+ reg-names = "dbi", "config";
+ #interrupt-cells = <1>;
+ interrupt-map-mask = <0 0 0 7>;
+ interrupt-map = <0 0 0 1 &intc 0 0 GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>,
+ <0 0 0 2 &intc 0 0 GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>,
+ <0 0 0 3 &intc 0 0 GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>,
+ <0 0 0 4 &intc 0 0 GIC_SPI 267 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ ranges = <0x01000000 0x0 0x00000000 0x10010000 0x0 0x10000>,
+ <0x02000000 0x0 0x10020000 0x10020000 0x0 0x7fe0000>,
+ <0x42000000 0x0 0x18000000 0x18000000 0x0 0x8000000>;
+ dma-ranges = <0x42000000 0x0 0x80000000 0x80000000 0x0 0x80000000>;
+ clocks = <&rcc CK_BUS_PCIE>;
+ resets = <&rcc PCIE_R>;
+ msi-parent = <&v2m0>;
+ access-controllers = <&rifsc 68>;
+ power-domains = <&CLUSTER_PD>;
+
+ pcie@0,0 {
+ device_type = "pci";
+ reg = <0x0 0x0 0x0 0x0 0x0>;
+ phys = <&combophy PHY_TYPE_PCIE>;
+ wake-gpios = <&gpioh 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ reset-gpios = <&gpioj 8 GPIO_ACTIVE_LOW>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ ranges;
+ };
+ };
--
2.34.1



Return-Path: <linux-kernel+bounces-675718-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C719241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:11:33 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 49FCE1885B4C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:10:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 565A528852D;
Fri, 6 Jun 2025 12:09:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="2doDdCWI"
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 E9BB22882CD;
Fri, 6 Jun 2025 12:08:57 +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=1749211739; cv=none; b=MeU6jIvkBSEXGcSAecyUPCNVkb+6lepKBkXSxEVTSqNTYgXt00pBwmdpufHr4xKOu4NMoSVDLsQEZX5cL0hiAC/ImXbtZQvq8aRpVMJJ9QmAMbpZPcbdpBYO3CYxjZj39ouYaVK1BEz97hTIcuD8/A377lFFCqkOXI8oe0KZDDQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211739; c=relaxed/simple;
bh=G6NvE9GxeEeMeOWJKddUtQQlAhJTRme2pqmZJ/CadUY=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=XsVEaChGdiLUD9s1GNWP/DOtxyrMR349jpGljLmTSuP/mYCQLS2fEL5Xc7scgwwRY/o4xQLAHYsmF+FdXmdgvmeQ/OESHszo3CWRMY/dtOf35PygWlAPylQHH14GzeoIHtctOinX8wPQ34vhHp5CIm5tB/JoxvAIKKssdGwR1/s=
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=2doDdCWI; 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
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 556Bd3mG009162;
Fri, 6 Jun 2025 14:08:29 +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=
TIENQCtmq3ZB/fAIfe/61ZuEwTYzjNesfAlOb0OOdC0=; b=2doDdCWIKCwP3qKY
YgmwD/Xoowq7fIEaUA0m+NtUHGdOPexsZkIZdMimc12YdlKTURyKQTrOolR+GQOG
uRCzUlWIETpUfD919TLwC9t5x7WFJD6ncdI9qnYomSRabBcYB+6VviOE2HYBgtHL
ZAdFYq2z2/zMLl7lI7WTTHQpcMVJVoN4FinHZuLwPZg5Nmy1CEApyveWfAlMhSYK
SNYv+ft3MfpJ3XM2C/y3COAKL0loijssE9/cGygViIeXyj1F7uyMi/wjwaHhqqMo
twZVvelm60p+t+gAlvDtdpoozk7iXuTJ+W6Njj/C8O8V3Qwku4dGxyfSbh6Fgn65
XU3grw==
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 471g90v2mc-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:08:28 +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 6ACDC40047;
Fri, 6 Jun 2025 14:07:05 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 0541CB054E7;
Fri, 6 Jun 2025 14:05:53 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:05:52 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 5/9] MAINTAINERS: add entry for ST STM32MP25 PCIe drivers
Date: Fri, 6 Jun 2025 14:03:59 +0200
Message-ID: <20250606120403.2964857-6-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add myself as maintainer of STM32MP25 PCIe host and PCIe endpoint drivers

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
---
MAINTAINERS | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1615a93528bd..957054cd94d0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19032,6 +19032,13 @@ L: linux-samsung-soc@xxxxxxxxxxxxxxx
S: Maintained
F: drivers/pci/controller/dwc/pci-exynos.c

+PCI DRIVER FOR STM32MP25
+M: Christian Bruel <christian.bruel@xxxxxxxxxxx>
+L: linux-pci@xxxxxxxxxxxxxxx
+S: Maintained
+F: Documentation/devicetree/bindings/pci/st,stm32-pcie-*.yaml
+F: drivers/pci/controller/dwc/*stm32*
+
PCI DRIVER FOR SYNOPSYS DESIGNWARE
M: Jingoo Han <jingoohan1@xxxxxxxxx>
M: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
--
2.34.1



Return-Path: <linux-kernel+bounces-675719-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AB90441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:11:38 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7E3423B3265
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:10:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 22F2A288CBD;
Fri, 6 Jun 2025 12:09:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="2VQWFA7+"
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 95FEE2882DC;
Fri, 6 Jun 2025 12:08: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=1749211740; cv=none; b=MWuqn4swxo1IOvhqjpdivOhiUl4P3v4fQKvk4wpxxkg331BaD8+IpSElE+A+gonjfRWVTH0yfjkr/qnhrB3Vne6PNbyE94ZV7apnLCxCDqWm4x6SlSq5W4GSYhXQXfoE+U8Vv+trzNvYYhiMY0/NBSZcqUcLBKeGoTsR1UygiKo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211740; c=relaxed/simple;
bh=XXIDPjEhH+9tLViN/vgmOYqtMj6u8wCKfb9mdcMu1JE=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=ecGVKNXbQoh1YW0pvjaMshCNnFr0SZ8zN1U1E6s6GhciCzAaQVpF8VNEgRS1PnFrb4EgPqf0I+PqfVkx+8ECqvFpp0C2IL1Pl0qUqjot9pzlPj1AbbgJzLaSTbmo/HfqET3JAl3x7sqCoB1G+BACtNnz/e7RtNWMn+y/HQcbrAA=
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=2VQWFA7+; 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
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 556Bcxk7004772;
Fri, 6 Jun 2025 14:08:34 +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=
tgrP1AWYk2kC4BwV7ZRkCPmyd2Go31ff+zcO2QFNCU8=; b=2VQWFA7+riQ7dkKz
xKI3Kxc+owTgvioQJXbc9++ow23H1r2LbToSvv5Y2dd+C7mrTl6+xYrqTiLNNdmP
EITu+J3Sq5Z79NahuGqevfWmhJCX299PzaRIgxGE6AlHqtjqL0nshhQcQrfSIbun
m37IssZyK55H7tptydzF1KuvW0+PC5mjwgkIpO7KqTqSbqWG9qfQw/4K99IIKDt/
F/PwCPLfBB8rSQq79BmW+QTGvfJBIU/W1NSfX2KVPJgeSSFbVmWVBHoBdrA2UpqX
BpuAfCgVC+6euxKcaL/6PJirC/nJcp2u3IasKJL5jT8vBy7QJ/r/9MTZB4o5ob/p
0iKZjA==
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 471g93v2mg-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:08:33 +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 6A18140053;
Fri, 6 Jun 2025 14:07:13 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D26C3AFD847;
Fri, 6 Jun 2025 14:06:02 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:06:02 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 7/9] arm64: dts: st: Add PCIe Root Complex mode on stm32mp251
Date: Fri, 6 Jun 2025 14:04:01 +0200
Message-ID: <20250606120403.2964857-8-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add pcie_rc node to support STM32 MP25 PCIe driver based on the
DesignWare PCIe core configured as Root Complex mode

Supports Gen1/Gen2, single lane, MSI interrupts using the ARM GICv2m

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 44 ++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 8d87865850a7..781d0e43ab59 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -122,6 +122,15 @@ intc: interrupt-controller@4ac00000 {
<0x0 0x4ac20000 0x0 0x20000>,
<0x0 0x4ac40000 0x0 0x20000>,
<0x0 0x4ac60000 0x0 0x20000>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ v2m0: v2m@48090000 {
+ compatible = "arm,gic-v2m-frame";
+ reg = <0x0 0x48090000 0x0 0x1000>;
+ msi-controller;
+ };
};

psci {
@@ -1130,6 +1139,41 @@ stmmac_axi_config_1: stmmac-axi-config {
snps,wr_osr_lmt = <0x7>;
};
};
+
+ pcie_rc: pcie@48400000 {
+ compatible = "st,stm32mp25-pcie-rc";
+ device_type = "pci";
+ reg = <0x48400000 0x400000>,
+ <0x10000000 0x10000>;
+ reg-names = "dbi", "config";
+ #interrupt-cells = <1>;
+ interrupt-map-mask = <0 0 0 7>;
+ interrupt-map = <0 0 0 1 &intc 0 0 GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>,
+ <0 0 0 2 &intc 0 0 GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>,
+ <0 0 0 3 &intc 0 0 GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>,
+ <0 0 0 4 &intc 0 0 GIC_SPI 267 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ ranges = <0x01000000 0x0 0x00000000 0x10010000 0x0 0x10000>,
+ <0x02000000 0x0 0x10020000 0x10020000 0x0 0x7fe0000>,
+ <0x42000000 0x0 0x18000000 0x18000000 0x0 0x8000000>;
+ dma-ranges = <0x42000000 0x0 0x80000000 0x80000000 0x0 0x80000000>;
+ clocks = <&rcc CK_BUS_PCIE>;
+ resets = <&rcc PCIE_R>;
+ msi-parent = <&v2m0>;
+ access-controllers = <&rifsc 68>;
+ power-domains = <&CLUSTER_PD>;
+ status = "disabled";
+
+ pcie@0,0 {
+ device_type = "pci";
+ reg = <0x0 0x0 0x0 0x0 0x0>;
+ phys = <&combophy PHY_TYPE_PCIE>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ ranges;
+ };
+ };
};

bsec: efuse@44000000 {
--
2.34.1



Return-Path: <linux-kernel+bounces-675720-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5A1A241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:12:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1D3B93AE858
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:10:28 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 93760289376;
Fri, 6 Jun 2025 12:09:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="7mYPpG/V"
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 035AB288C3A;
Fri, 6 Jun 2025 12:09:00 +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=1749211742; cv=none; b=bITAxadc3iNBYugRXfINpyrhwVD/Vdx9J+jIbKwgXgUb99LYDC0kQxHA+uL+lCjn6GG7nRn1+t1x1ZOldaWU3eYlDS3quj8fBSAeF80a76WK4SV+Z6HFXEEnxyZ5ATiP5HKMyawaePmdaJSSe7VYstC8aFfEKkDrKpBsF7C8K/M=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211742; c=relaxed/simple;
bh=MOVS9MDt5D/qwfv3LrmHj9GwUfRJE7WzWMzzFrmyRuU=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=iNk4/rsqUenYbSLgxV+1/eJbbAM0O9qrlK5hawNmgYIwXuSL7LhkGsxaCFXkRyXjA/Rmk5NfSl99ZW74D2v5Tb+CO1y0Zf5EY6vAi1qVDOmtUIJbBQZg7+mlb2w+kQ8dKPUbodXFqnSX2breBMyG6ZdPhhz5YsvJEYN1cb7F/z0=
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=7mYPpG/V; 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
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 556BcqsW016994;
Fri, 6 Jun 2025 14:08:33 +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=
fbyPxu13Z7uJlDRT+bi78um7V/Mx+bWlVKwoNNppU5w=; b=7mYPpG/VbEDvNOoT
neGJfSoO6tt027gTV7CotxcRrb3tF7nI6wFJgR/a+kQzMJRBZuLJTm5M6HYsTMEn
JFuGuqT/aKj1JY9a/LP4XQxMEqvi6Wx4o9kE0uFk/+2+XMJoqOaNEhabMpRCtS3A
7PqT7jhZB1Eyub2IhhE8Qqvrgj245j3FaPB6HX2oHNAFhZ0GowH5/udXO+5Kr2+P
DEaUKOhgzec4qHe2W7DwW8G+PKvIpG5iNJn+/NHte8O5+6DhbvcXT6q2TIOiovV8
A+cggqVvfTk6xMwqElGty5sOyiPbyR+2qvoDpyHgnYP3j1Ghow+KrMphQyR3vCPq
xL+uog==
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 471g8tv64a-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:08:33 +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 6A51F40054;
Fri, 6 Jun 2025 14:07:13 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2EC5CAFB8DE;
Fri, 6 Jun 2025 14:06:00 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:05:59 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 6/9] arm64: dts: st: add PCIe pinctrl entries in stm32mp25-pinctrl.dtsi
Date: Fri, 6 Jun 2025 14:04:00 +0200
Message-ID: <20250606120403.2964857-7-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add PCIe pinctrl entries in stm32mp25-pinctrl.dtsi
init: forces GPIO to low while probing so CLKREQ is low for
phy_init
default: restore the AFMUX after controller probe

Add Analog pins of PCIe to perform power cycle

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
---
arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi b/arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi
index aba90d555f4e..0480b9af00e8 100644
--- a/arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi
@@ -133,6 +133,26 @@ pins {
};
};

+ pcie_pins_a: pcie-0 {
+ pins {
+ pinmux = <STM32_PINMUX('J', 0, AF4)>;
+ bias-disable;
+ };
+ };
+
+ pcie_init_pins_a: pcie-init-0 {
+ pins {
+ pinmux = <STM32_PINMUX('J', 0, GPIO)>;
+ output-low;
+ };
+ };
+
+ pcie_sleep_pins_a: pcie-sleep-0 {
+ pins {
+ pinmux = <STM32_PINMUX('J', 0, ANALOG)>;
+ };
+ };
+
sdmmc1_b4_pins_a: sdmmc1-b4-0 {
pins1 {
pinmux = <STM32_PINMUX('E', 4, AF10)>, /* SDMMC1_D0 */
--
2.34.1



Return-Path: <linux-kernel+bounces-675725-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F015B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:12:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7092B163D8A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:12:07 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A632328852D;
Fri, 6 Jun 2025 12:10:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="Q0ItGubo";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="OY3NIpiQ"
Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144])
(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 CE5A0286D50;
Fri, 6 Jun 2025 12:10:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211849; cv=none; b=HgLqrpBI3zlIDln2+hlvRum+oSZf93JArm9DCFEHp/+tsyzOYUTONPWpObY/jGUfzRd3uwtza+/PTFJfc8ZJMb5qPakOGKER4WIQIGLxDKZ47kA+jgDI7qnRensQQnZ2X3KlR1tI29Vr68PaVivNQpfwa1fL72QTwriS7uW0Ux8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211849; c=relaxed/simple;
bh=94KB+HcYMpVi/wawb67zOdido85ReHZmMuc6et4mXYw=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=DvKv0HGOv9dh9ZWKPdYP6+Lunc8v1qd99IEUaYwmbSFLzqzEnvfa9boWX47ki4SFnAWFKHHdrkKLjFt8CI6qTTrWFjFChxgtoRdudsaf9Dr56lBa7wrejRp/XR73+XD6r5LMebb/yc7fzJIhwPK5F2ZR5dJu+kbdt/4fhCZAzrA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=Q0ItGubo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=OY3NIpiQ; arc=none smtp.client-ip=103.168.172.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46])
by mailfout.phl.internal (Postfix) with ESMTP id F308C1380364;
Fri, 6 Jun 2025 08:10:46 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
by phl-compute-06.internal (MEProxy); Fri, 06 Jun 2025 08:10:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749211846;
x=1749298246; bh=srmFHO4uL8kW5asVRGGF3E5jltaHcp9O7yYYE2vQeo0=; b=
Q0ItGubonJBMIcUZmcFsS0agDZJNRA47lQuRNL5EcDCaTvV/b8P/IB2bYkvoWr7Y
lM5ArBw3mrOk3At7RK/3ehjLXJJn5vhJClK2KdJr1Jj+kU3J0tXK/pNGDzD1403T
y3vOulwpzCggLVDLh9V0oC9c/SEGtC9GuOLJ6I85MBsTHWGqoWj7hgzoX0L6OezJ
2sIw6OlQXaSSeAt+meTOaHZV/Z9aaEMS9QtAJwv+2d4w559NsYIzvVSK309EeLta
B7F8OHoR6DBYGS8ACoZ4Iv8qzkjtxUKb9aiQu0hKdXGBFpkp4bs6Zd7zOMRYFTjF
On1xT6aSfnMKqgrcuPGh4A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749211846; x=
1749298246; bh=srmFHO4uL8kW5asVRGGF3E5jltaHcp9O7yYYE2vQeo0=; b=O
Y3NIpiQ8LJuVteNrxXwF1OocK10zs6hJtDv+icH+maxBUbCZKQq8t0ZoURor5Lyi
UiXfbJznwe2MFSfc33Bl+LLstv2iC+GsOC09E1QaUH6/ONrb2z0Y8DOX6Tm/0/vz
6NejvNv8L2Noajjch1rlsGLil+ffRKOKD4vmK8idPow2/6HvQb2WTc4/dBZ78VKP
NFFGAPH/cVVBbxku/tTLZy2vMae1p3oY8TxgsRsOB6bKVtnm7V27b3LnRpvsE6mt
KMDaqRTfFDeSWaIRQR44Upne9A39lwIk81nWy2xK06njDVNgCAQmJobbHVczhp7m
ciVV6qdS1p2uThw+huaQw==
X-ME-Sender: <xms:xtpCaHGL9PGvmVn42yhgPKlAg13tl4iIqY7YT3mpBQbI3sXIAXi2lQ>
<xme:xtpCaEUBiYzBZyiAlPjIG2XlnVs1T4zDQUzpILKzPc7XsGVg_e58XswhysSbB0LFC
p2lQc4fYDa01Htiokw>
X-ME-Received: <xmr:xtpCaJLgdeaXH8lcKR5bC-X_dVfyhJCWoekZ2Qbg_YlWQ5ggY6cpxfOnO7I2qDk1bklspXrs3WxxFEtpZK9vUHBk_XPAMZCjUQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdejucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeevteeg
tddvvdfhtdekgefhfeefheetheekkeegfeejudeiudeuleegtdehkeekteenucevlhhush
htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehnihhklhgrshdrshho
uggvrhhluhhnugesrhgrghhnrghtvggthhdrshgvpdhnsggprhgtphhtthhopeelpdhmoh
guvgepshhmthhpohhuthdprhgtphhtthhopehtohhmihdrvhgrlhhkvghinhgvnhdorhgv
nhgvshgrshesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepmhgthhgvhh
grsgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehl
ihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvh
hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghs
qdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkh
gvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgthhgvhhgr
sgdohhhurgifvghisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlrghurhgvnhhtrd
hpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepjhgr
tghophhordhmohhnughisehiuggvrghsohhnsghorghrugdrtghomh
X-ME-Proxy: <xmx:xtpCaFE2b--U_-bZj1the4yFUFB3ebzaA0E6KeFHdioHa6aEk0LzJQ>
<xmx:xtpCaNWqFmqOFcgDjKZnnQnL7cFZOnAP8yq172DLlO56UXBFa5mL6Q>
<xmx:xtpCaAO3ZDxj_2KvB1UCb2VwCAwPif_I1SANtwl1zEy0o_j8d2zBzA>
<xmx:xtpCaM0vsPZjwx-_7UwJJIlc12llYuQLHr-xlXW5Ev3NfrqxL57oMg>
<xmx:xtpCaOsDyyhOtNkW-DvqJeGCtffgl2MuWECCXGgR06KsQwrB3t3UniSo>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:10:46 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:10:45 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 09/15] media: rcar-isp: Switch to Streams API
Message-ID: <20250606121045.GF2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-9-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-9-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your work.

On 2025-05-30 16:50:38 +0300, Tomi Valkeinen wrote:
> Switch to Streams API with a single hardcoded route. This breaks any
> existing userspace which depended on the custom rcar streams
> implementation, but a single camera use case should continue to work.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> ---
> drivers/media/platform/renesas/rcar-isp/csisp.c | 62 ++++++++++++++++++++++---
> 1 file changed, 55 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-isp/csisp.c b/drivers/media/platform/renesas/rcar-isp/csisp.c
> index 2337c5d44c40..a04cbf96b809 100644
> --- a/drivers/media/platform/renesas/rcar-isp/csisp.c
> +++ b/drivers/media/platform/renesas/rcar-isp/csisp.c
> @@ -124,6 +124,17 @@ static const struct rcar_isp_format rcar_isp_formats[] = {
> },
> };
>
> +static const struct v4l2_mbus_framefmt risp_default_fmt = {
> + .width = 1920,
> + .height = 1080,
> + .code = MEDIA_BUS_FMT_RGB888_1X24,
> + .colorspace = V4L2_COLORSPACE_SRGB,
> + .field = V4L2_FIELD_NONE,
> + .ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT,
> + .quantization = V4L2_QUANTIZATION_DEFAULT,
> + .xfer_func = V4L2_XFER_FUNC_DEFAULT,
> +};
> +
> static const struct rcar_isp_format *risp_code_to_fmt(unsigned int code)
> {
> unsigned int i;
> @@ -222,7 +233,7 @@ static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state)
> u32 sel_csi = 0;
> int ret;
>
> - fmt = v4l2_subdev_state_get_format(state, RCAR_ISP_SINK);
> + fmt = v4l2_subdev_state_get_format(state, RCAR_ISP_SINK, 0);
> if (!fmt)
> return -EINVAL;
>
> @@ -336,7 +347,7 @@ static int risp_set_pad_format(struct v4l2_subdev *sd,
> struct v4l2_subdev_state *state,
> struct v4l2_subdev_format *format)
> {
> - struct v4l2_mbus_framefmt *framefmt;
> + struct v4l2_mbus_framefmt *fmt;
>
> if (format->pad > RCAR_ISP_SINK)
> return v4l2_subdev_get_fmt(sd, state, format);
> @@ -344,10 +355,20 @@ static int risp_set_pad_format(struct v4l2_subdev *sd,
> if (!risp_code_to_fmt(format->format.code))
> format->format.code = rcar_isp_formats[0].code;
>
> - for (unsigned int i = 0; i < RCAR_ISP_NUM_PADS; i++) {
> - framefmt = v4l2_subdev_state_get_format(state, i);
> - *framefmt = format->format;
> - }
> + /* Set sink format */
> + fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream);
> + if (!fmt)
> + return -EINVAL;
> +
> + *fmt = format->format;
> +
> + /* Propagate to source format */
> + fmt = v4l2_subdev_state_get_opposite_stream_format(state, format->pad,
> + format->stream);
> + if (!fmt)
> + return -EINVAL;
> +
> + *fmt = format->format;
>
> return 0;
> }
> @@ -364,6 +385,32 @@ static const struct v4l2_subdev_ops rcar_isp_subdev_ops = {
> .pad = &risp_pad_ops,
> };
>
> +static int risp_init_state(struct v4l2_subdev *sd,
> + struct v4l2_subdev_state *state)
> +{
> + static struct v4l2_subdev_route routes[] = {
> + {
> + .sink_pad = RCAR_ISP_SINK,
> + .sink_stream = 0,
> + .source_pad = RCAR_ISP_PORT0,
> + .source_stream = 0,
> + .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
> + },
> + };
> +
> + static const struct v4l2_subdev_krouting routing = {
> + .num_routes = ARRAY_SIZE(routes),
> + .routes = routes,
> + };
> +
> + return v4l2_subdev_set_routing_with_fmt(sd, state, &routing,
> + &risp_default_fmt);
> +}
> +
> +static const struct v4l2_subdev_internal_ops risp_internal_ops = {
> + .init_state = risp_init_state,
> +};
> +
> /* -----------------------------------------------------------------------------
> * Async handling and registration of subdevices and links
> */
> @@ -521,11 +568,12 @@ static int risp_probe(struct platform_device *pdev)
>
> isp->subdev.owner = THIS_MODULE;
> isp->subdev.dev = &pdev->dev;
> + isp->subdev.internal_ops = &risp_internal_ops;
> v4l2_subdev_init(&isp->subdev, &rcar_isp_subdev_ops);
> v4l2_set_subdevdata(&isp->subdev, &pdev->dev);
> snprintf(isp->subdev.name, sizeof(isp->subdev.name), "%s %s",
> KBUILD_MODNAME, dev_name(&pdev->dev));
> - isp->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
> + isp->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS;
>
> isp->subdev.entity.function = MEDIA_ENT_F_VID_MUX;
> isp->subdev.entity.ops = &risp_entity_ops;
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675721-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2261D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:12:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id CCAD9189CCC2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:11:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 43659288C85;
Fri, 6 Jun 2025 12:09:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="K0PmOV9t";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="UzYpSCpl"
Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154])
(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 4CBAA288C06;
Fri, 6 Jun 2025 12:09:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211751; cv=none; b=smDw4pzpCnQSGsEXqgacCG8yUpwtOIOlplOS9tSwW7tkY57Na+eU31JVh5od0VhjW9Fp9/MokCRtwyUxt5xw++k0Db+lJJNTVUOtf0IPMG09kQe0dZzswHOITj2mRYr9DCtQuni7iBLPXMvU2UJCrcQ8amHhotd3wUIzK6EfKUw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211751; c=relaxed/simple;
bh=zFRIM27wwxZXbKsRpeEfDaAcjX+vBobijyI5KCPtNxE=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=IXvMm4ymG19AmcsZlzB7OrF+dmngHo8qKc/cZJfF30A9K6MCepOrSCSGY0vFt6/x4fdLtA8Fdzo0FHsm9JUpuVKu6XKfak4i/R/pGXZuwzHPO3DcJb+0cMBcrSfDSU9yFGbeRYVuWA8uFru5H81HsWrdZ6L1QTFEP2D1DJc0xWQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=K0PmOV9t; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=UzYpSCpl; arc=none smtp.client-ip=103.168.172.154
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42])
by mailfhigh.phl.internal (Postfix) with ESMTP id 4F2641140120;
Fri, 6 Jun 2025 08:09:08 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-02.internal (MEProxy); Fri, 06 Jun 2025 08:09:08 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749211748;
x=1749298148; bh=0U0W8fQoerOuoS9FHPhIiq60Nao0pTqP3T4WtFIsQpY=; b=
K0PmOV9tNdxIsWGIyxihC15g+9IgrDmfdVgQkRhAVLuZEwjscsa813bHo+M7Rebe
jEKiNa+GjH9x7bAnwiHKjE1IwP5IR7v02ZHrONVRaMD+Q5oEj8hjXxWYyp9tLtaz
sjovJC3yPvgxAt71kNoY/ugH5/8obnm7Y9PDFITXBBwInnD8ry3iVjheONw4uZXU
D9st8OfnirB0RnW/LsVObiPeeIn9PdbOUXeMyAlZGIGJgruFytseHXNFdzXeB/PG
g0+Y9hI+TE7PetFPsJgkwUYko57/pl2NJfQwPiUNSzcGb7w800NbSYI3UtlEdOdf
iM00uQVsQTp6hWsz3WwklA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749211748; x=
1749298148; bh=0U0W8fQoerOuoS9FHPhIiq60Nao0pTqP3T4WtFIsQpY=; b=U
zYpSCplOu3QcvtyMmprNCmKsAoVfLA8KnbWZM8ZJSBY4jf8yTQH1YGtP3VYphyMf
v76clgyE0IzF7cf5Xu0J2HJWxWwqWwF4jdXYy7PCxOM4hw2XhVuurRmaxPGaE2gz
TThhdrqf7L3b1b723g4qIAesCetyxggQjqQOGsABHoqjIFfRsBeomzAAHDsF5tUg
UJwc5HlMgQPUet4nA0A581p/PshbWkdIBB3fQWrD1fYTAAvVnlZKV63Ikp3mpU/2
nZBD/8qzW1Lzne3utpt9pea0GSyKQJLdR69me8onJNdUF302NO6pXuu0RMx035UF
x+ExTBMe4xkxSUtQccuYw==
X-ME-Sender: <xms:ZNpCaOPtRu7yd81IFAx_S81EcdHu614FKZq8KlLzCjqHnzNwixauZg>
<xme:ZNpCaM9XJ507sDmZlMLZ-GE3rZmDACrExMxCZhKOgB_uF5GWMAek54B4F4Yqx5ZtW
-j86rVNmW-AXKE7U10>
X-ME-Received: <xmr:ZNpCaFS12K4bHfrVdchooYVq4vYxG0sttUn2bfmyd189I9620-IMveSaqhBpZp1sBxdByDX3Eq7Tq1YtrUcvYgRPcnwgfhn5FA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdejucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeevteeg
tddvvdfhtdekgefhfeefheetheekkeegfeejudeiudeuleegtdehkeekteenucevlhhush
htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehnihhklhgrshdrshho
uggvrhhluhhnugesrhgrghhnrghtvggthhdrshgvpdhnsggprhgtphhtthhopeelpdhmoh
guvgepshhmthhpohhuthdprhgtphhtthhopehtohhmihdrvhgrlhhkvghinhgvnhdorhgv
nhgvshgrshesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepmhgthhgvhh
grsgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehl
ihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvh
hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghs
qdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkh
gvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgthhgvhhgr
sgdohhhurgifvghisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlrghurhgvnhhtrd
hpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepjhgr
tghophhordhmohhnughisehiuggvrghsohhnsghorghrugdrtghomh
X-ME-Proxy: <xmx:ZNpCaOsYgmtyjzMBprCGFIgV0-ePQr4GFNxgJH5W23wy0aMj1rt9SQ>
<xmx:ZNpCaGeCr6c5IT9o_SAYPqJanplCfW5Jj7ltrDRAPlB1cU7fhOVsTg>
<xmx:ZNpCaC2svR4meb4DU-PVy9XxHIrd_tgPk0eRzk7FQdo9fh1fv8Kihw>
<xmx:ZNpCaK9OjLGtU_4uM7C-gZtPDSXmicdAH41T_MIlvBOw8IC0RuPMgA>
<xmx:ZNpCaDXVKtbTQP_ZxRpTiniUxdv1W0CAYBYoHv6RW58W2021fczH7x2l>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:09:07 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:09:06 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 08/15] media: rcar-csi2: Switch to Streams API
Message-ID: <20250606120906.GE2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-8-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-8-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your patch.

On 2025-05-30 16:50:37 +0300, Tomi Valkeinen wrote:
> Switch to Streams API with a single hardcoded route. This breaks any
> existing userspace which depended on the custom rcar streams
> implementation, but a single camera use case should continue to work.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> ---
> drivers/media/platform/renesas/rcar-csi2.c | 47 +++++++++++++++++++++---------
> 1 file changed, 33 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index e0a0fd96459b..20bd44274bd2 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -1028,7 +1028,7 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv,
> if (ret)
> return ret;
>
> - fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK);
> + fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK, 0);
> if (!fmt)
> return -EINVAL;
>
> @@ -1069,7 +1069,7 @@ static int rcsi2_start_receiver_gen3(struct rcar_csi2 *priv,
> int mbps, ret;
>
> /* Use the format on the sink pad to compute the receiver config. */
> - fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK);
> + fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK, 0);
>
> dev_dbg(priv->dev, "Input size (%ux%u%c)\n",
> fmt->width, fmt->height,
> @@ -1650,8 +1650,7 @@ static int rcsi2_set_pad_format(struct v4l2_subdev *sd,
> struct v4l2_subdev_state *state,
> struct v4l2_subdev_format *format)
> {
> - struct rcar_csi2 *priv = sd_to_csi2(sd);
> - unsigned int num_pads = rcsi2_num_pads(priv);
> + struct v4l2_mbus_framefmt *fmt;
>
> if (format->pad > RCAR_CSI2_SINK)
> return v4l2_subdev_get_fmt(sd, state, format);
> @@ -1659,11 +1658,20 @@ static int rcsi2_set_pad_format(struct v4l2_subdev *sd,
> if (!rcsi2_code_to_fmt(format->format.code))
> format->format.code = rcar_csi2_formats[0].code;
>
> - *v4l2_subdev_state_get_format(state, format->pad) = format->format;
> + /* Set sink format */
> + fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream);
> + if (!fmt)
> + return -EINVAL;
> +
> + *fmt = format->format;
> +
> + /* Propagate to source format */
> + fmt = v4l2_subdev_state_get_opposite_stream_format(state, format->pad,
> + format->stream);
> + if (!fmt)
> + return -EINVAL;
>
> - /* Propagate the format to the source pads. */
> - for (unsigned int i = RCAR_CSI2_SOURCE_VC0; i < num_pads; i++)
> - *v4l2_subdev_state_get_format(state, i) = format->format;
> + *fmt = format->format;
>
> return 0;
> }
> @@ -1683,8 +1691,15 @@ static const struct v4l2_subdev_ops rcar_csi2_subdev_ops = {
> static int rcsi2_init_state(struct v4l2_subdev *sd,
> struct v4l2_subdev_state *state)
> {
> - struct rcar_csi2 *priv = sd_to_csi2(sd);
> - unsigned int num_pads = rcsi2_num_pads(priv);
> + static struct v4l2_subdev_route routes[] = {
> + {
> + .sink_pad = RCAR_CSI2_SINK,
> + .sink_stream = 0,
> + .source_pad = RCAR_CSI2_SOURCE_VC0,
> + .source_stream = 0,
> + .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
> + },
> + };
>
> static const struct v4l2_mbus_framefmt rcar_csi2_default_fmt = {
> .width = 1920,
> @@ -1697,10 +1712,13 @@ static int rcsi2_init_state(struct v4l2_subdev *sd,
> .xfer_func = V4L2_XFER_FUNC_DEFAULT,
> };
>
> - for (unsigned int i = RCAR_CSI2_SINK; i < num_pads; i++)
> - *v4l2_subdev_state_get_format(state, i) = rcar_csi2_default_fmt;
> + static const struct v4l2_subdev_krouting routing = {
> + .num_routes = ARRAY_SIZE(routes),
> + .routes = routes,
> + };
>
> - return 0;
> + return v4l2_subdev_set_routing_with_fmt(sd, state, &routing,
> + &rcar_csi2_default_fmt);
> }
>
> static const struct v4l2_subdev_internal_ops rcar_csi2_internal_ops = {
> @@ -2356,7 +2374,8 @@ static int rcsi2_probe(struct platform_device *pdev)
> v4l2_set_subdevdata(&priv->subdev, &pdev->dev);
> snprintf(priv->subdev.name, sizeof(priv->subdev.name), "%s %s",
> KBUILD_MODNAME, dev_name(&pdev->dev));
> - priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
> + priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE |
> + V4L2_SUBDEV_FL_STREAMS;
>
> priv->subdev.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER;
> priv->subdev.entity.ops = &rcar_csi2_entity_ops;
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675722-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 955BA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:12:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 55C6D189DEA0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:11:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BFCE728A1D9;
Fri, 6 Jun 2025 12:09:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="HCEXy332"
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 6825F288C8A;
Fri, 6 Jun 2025 12:09:12 +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=1749211755; cv=none; b=axCrNhU687rPcUtJZYanoirHpVJ3Yv2cl1gqVIHNjaVc7OfvtjaRH0BqhcgM8SsEVL5aRu6Pptb33XV30NrBYwoh8S+O9i1GnB8eVUAeHIv10RrTtSo1RyebLgoPqMs9iuFgkNw8A9XSKObvM2PkVhEzqHd21xKvPMIlH4CedzQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211755; c=relaxed/simple;
bh=H5H7FeLI6VUXLhJIww7m7lXTId3UmpudwkZElVb1WY0=;
h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=vA06hPVQVKbIcMk7DkHbwKCSA3d7bRejifV7dRkR7eM5M3x2PeYGPF1NoNoHBmCSsybWnAdSJ6uZXPWG914psy2qkeI2FnqBtVtvLgqMA0sx07A6tEWQFqNP5QhtqVRjjGa7VQA+PTX6UWnASkl3t610196Gtr6Wo0d0QX4jDhA=
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=HCEXy332; 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
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 556BcpHl016978;
Fri, 6 Jun 2025 14:08:50 +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=
qwk6EpfgixsBWXf3gOju3zo52UAdS22o45N7Qd46Xak=; b=HCEXy332K+qK2QAd
7Qwv9xjmuQIfgReHSh1DUcnbnhPnc/lornoIimXYzlas74c1128iEAr4dBRqyVvk
bYNmFna8yTnW5SOGj6zyLQr2hdhRVO1rWMB5+WhPpXKKuNnOusLSGOOsnS2eq4HX
LQGQ31habd18qA0Hz77neFmqVqBdzyEbWbEDqH9Yid63D9bBnw0OHUWZ1W2sD5Cx
mkYblodm3s0wtCXVcKsYocSme5Wp6tbImvSXwnI05uPENq8NYS+M5XjMxY3YPX5T
/p14uvSPvT63OUgotVyIzNXHRt4EsfYhRm5d7To4SIf6mG4WYsdFcZMaIIFTYcK4
yS538Q==
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 471g8tv65e-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 14:08:49 +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 8AD704004D;
Fri, 6 Jun 2025 14:07:21 +0200 (CEST)
Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71])
by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 25C2FB06D06;
Fri, 6 Jun 2025 14:06:08 +0200 (CEST)
Received: from localhost (10.130.77.120) by SHFDAG1NODE3.st.com (10.75.129.71)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun
2025 14:06:07 +0200
From: Christian Bruel <christian.bruel@xxxxxxxxxxx>
To: <christian.bruel@xxxxxxxxxxx>, <bhelgaas@xxxxxxxxxx>,
<lpieralisi@xxxxxxxxxx>, <kwilczynski@xxxxxxxxxx>,
<manivannan.sadhasivam@xxxxxxxxxx>, <robh@xxxxxxxxxx>,
<krzk+dt@xxxxxxxxxx>, <conor+dt@xxxxxxxxxx>,
<mcoquelin.stm32@xxxxxxxxx>, <alexandre.torgue@xxxxxxxxxxx>,
<p.zabel@xxxxxxxxxxxxxx>, <quic_schintav@xxxxxxxxxxx>,
<shradha.t@xxxxxxxxxxx>, <cassel@xxxxxxxxxx>,
<thippeswamy.havalige@xxxxxxx>
CC: <linux-pci@xxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH v11 8/9] arm64: dts: st: Add PCIe Endpoint mode on stm32mp251
Date: Fri, 6 Jun 2025 14:04:02 +0200
Message-ID: <20250606120403.2964857-9-christian.bruel@xxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
References: <20250606120403.2964857-1-christian.bruel@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com
(10.75.129.71)
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-06_04,2025-06-05_01,2025-03-28_01
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add pcie_ep node to support STM32 MP25 PCIe driver based on the
DesignWare PCIe core configured as Endpoint mode

Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 781d0e43ab59..23dcc889c3e8 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -1140,6 +1140,21 @@ stmmac_axi_config_1: stmmac-axi-config {
};
};

+ pcie_ep: pcie-ep@48400000 {
+ compatible = "st,stm32mp25-pcie-ep";
+ reg = <0x48400000 0x100000>,
+ <0x48500000 0x100000>,
+ <0x48700000 0x80000>,
+ <0x10000000 0x10000000>;
+ reg-names = "dbi", "dbi2", "atu", "addr_space";
+ clocks = <&rcc CK_BUS_PCIE>;
+ resets = <&rcc PCIE_R>;
+ phys = <&combophy PHY_TYPE_PCIE>;
+ access-controllers = <&rifsc 68>;
+ power-domains = <&CLUSTER_PD>;
+ status = "disabled";
+ };
+
pcie_rc: pcie@48400000 {
compatible = "st,stm32mp25-pcie-rc";
device_type = "pci";
--
2.34.1



Return-Path: <linux-kernel+bounces-675726-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6D74F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:12:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8662B16F8DC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:13:00 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 827A12882C2;
Fri, 6 Jun 2025 12:12:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="LrnB7+Iu";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="vqijzerb"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 D9E71285417
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:12:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211973; cv=fail; b=fJPZlVIDbEGcH9bbLUD9CdjeIkS6wvYiSHAtru87hev+1SIuSJiQqd1Az9MHyiOGr+n+lETSxcW46VT9GITHFyLpp36zf21g2X5VvH9oyTe1LQDW5ugv8fsu5jOO0KwfJs9sOetlqjucp4DswACNnNGBE1sqsinigMrbFYikes0=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211973; c=relaxed/simple;
bh=hZ5AoJFa3pvgg3gNmGn4+bBN1xZUQgmp4Fk4JH2IoDA=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=b5hWuT8OvKpSkWGz/Ys0A+v2h0P2LjDlw8qFh5mwzU52UvPxDsrVOj/05E7I+Wgo04Dl6HmZEA79NgAlt34K2XCdJma0YrlMahECM0Ro9AAL04MxwgG+GYlf5vVKnkmSRc3tqt3NaB7VeGZI37OoDPl2cIvhKtZhCXkpA2lJ/hE=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=LrnB7+Iu; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=vqijzerb; arc=fail smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0333520.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MY6D002138;
Fri, 6 Jun 2025 12:12:36 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=hZ5AoJFa3pvgg3gNmG
n4+bBN1xZUQgmp4Fk4JH2IoDA=; b=LrnB7+IuXEodwodjlFWV3nql9QdGqKqNZV
wWenhT7U30jOI5uVyVtX1xHhjXz0nhMPLQgHC0kgWX7+SA+XQI52rYnCwyed7bWc
c8V9/fw3KzuJpCTFF7bovr9D4Qazm2QWfLf+rjBL8lsse0x2m9oIz5U4nZwuDdim
6JkPTzhVGvPGY006S2sTBE+/ffxuMDH0IasSpNVO5ZspUk+h/63uoenDP/fY8Z6d
VE8iEjHg1HfmluANYC4dqostrrgP06NGSYRyt49UK+T/JwsoF8r2QThAwXXDra3k
SllLFtUyFq6881aBIKMfYtmsft6kt5Xfr4yLOxU08BKdHJcnJBbQ==
Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gahfyuk-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 12:12:36 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556ABguX034829;
Fri, 6 Jun 2025 12:12:35 GMT
Received: from ch4pr04cu002.outbound.protection.outlook.com (mail-northcentralusazon11013032.outbound.protection.outlook.com [40.107.201.32])
by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7dff8x-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 12:12:35 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=fvuKXYpuiTU3B218DjRXTTOVtwbF6xg1kWM3+XQ3QtB1o7PAW/vC6p8dPCdF+xbQKEByQHmA1fmUeDJu27s9rEk3SJeBAlxEaOAYdZRz0s/4eoGrREXP6ARg1h5g4ZZ691fRDPMyIf2rjN6yfjHgXohjhMbVW3K69kySfWcBWzfz9Ld0H7jwXv5Fzo8HG/HMLqmNHZGCT/yh++Pqd1fk2KFj7qgcLkimYy6KT7gIpV9BSisN+/Q97lq0GBNO++KVe8mhLB7yXWqUKwWadAdnQaJY8yMJJlhiymFtP798iKfZ+ovTTPHSy40tFgEU4+IjxMgridxah0LVNbr+NMAVmA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=hZ5AoJFa3pvgg3gNmGn4+bBN1xZUQgmp4Fk4JH2IoDA=;
b=I8DxszfdcXPAFVesXDBOzjWhOstwnaQFv1Sxg5EJO1rsG0sEDuZwnHgCmVhXYpUqJZ+Yc3j37PNGK6LzAmxk/VxghgV3zlwDMdhyOCDTs5sYi7zGpE916zeT9hVl6A/xCihHsWPf/SHu2cnQQ6ehuRnmYGqvpnp+GLvCZrfDwYJBY+Y1lOOs4O7XgP6UK3sX3PLA0HhttToQnUccgtPJbQUPjbuJ0QiZCdPbCeSnBNZa0RkvzATspFTp82UzReDhHKmpfEkNZOzAdkEyMNrzHnb8THGlCseyPolZob1yi2cSsO9LV6kbK+xmtfVUDwg0NENvpuqM6tFSPMKP3GztyA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=hZ5AoJFa3pvgg3gNmGn4+bBN1xZUQgmp4Fk4JH2IoDA=;
b=vqijzerbSTLs56oebwJTiQm93uj53x8n3gQbmDq0kigSgiqq5URjGwOfX0PCYXzItSNePqbEn3gziuxzD0XSmoaL5nKDOsWXtIwrDvGriX7BoYMEmwFyMNLq2wnzFaaV+T1q5sx20e232gy+a+Ogiy5IxVxV2/WSXJWf+QwWqVg=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by SN7PR10MB6545.namprd10.prod.outlook.com (2603:10b6:806:2a8::6) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.30; Fri, 6 Jun
2025 12:12:32 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
12:12:32 +0000
Date: Fri, 6 Jun 2025 13:12:30 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: David Hildenbrand <david@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>,
John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
Message-ID: <b00f0914-c06e-4d7c-b856-93a6610b0459@lucifer.local>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
<50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
<e5fa4a36-2af8-48e9-811e-680881c06b86@xxxxxxxxxx>
<1a7513cf-4a0a-4e58-b20d-31c1370b760f@lucifer.local>
<fe31e754-159d-49fd-aac7-64af5e313884@xxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <fe31e754-159d-49fd-aac7-64af5e313884@xxxxxxxxxx>
X-ClientProxiedBy: LO4P123CA0142.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:193::21) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|SN7PR10MB6545:EE_
X-MS-Office365-Filtering-Correlation-Id: 380792f7-cbaa-4c27-70a2-08dda4f36a1d
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?TZqY0KYyeRUSgraMd0spolwC/sEsRjuCWLGWC9XA+pe3CZYC0EYA3UdcmiMj?=
=?us-ascii?Q?LdC+/e47Cs4bTbL7MYL6PwchCS34sVhtTwRXzfK8j7xgNWL+DjVapTAj1dO+?=
=?us-ascii?Q?c4sVkluOGqoorXxoDyOba6zjyAO3nNWmkax0BrCY1RjwFVfRvJBG7k9z9T+S?=
=?us-ascii?Q?cYSdAfTZbnDs/DINSuPL82Fj21437FSG9T6RRgnCEMOv9szQIh/U6MWp0Bae?=
=?us-ascii?Q?bHL5RZ6zBtdFFFevalTjqgfo1NznCwNgGIUCx8egEnng5WtluAyh8vNeZJMb?=
=?us-ascii?Q?bEwwzYFew+4QZk/WSeEwT6MWTOnJDC7e4a35ZOZ+yX6qy4lKB1qCrDyYLI04?=
=?us-ascii?Q?mDU6yGbwnBaYIyZ/DAr4dAXX47h/zHBVCbhUtyNZ8z74yi60AksqR5yvyzYn?=
=?us-ascii?Q?PJPSr9qL8ClCK8MpJsCRIcpdfgVc+uUmSQS1HZohhhS6W29c+uoHEKCSU5i0?=
=?us-ascii?Q?UXpjBi6abhyVTngm4iAUV6l6zppqhW7NUUQDTtv8F8m6GAEVsF4I3W94So5z?=
=?us-ascii?Q?fRGsFvHE/gAGUixtFWMPIVl4cxHevf5ef1QcZilI50lf/BdxKcguX5XEGtVE?=
=?us-ascii?Q?feRvwvFo+BDMt/9LJXYtQhfyLnrYd/8t43gK9Nwv4LX93LS4kbvZNFvsay6Y?=
=?us-ascii?Q?FDMNBmJURyqQeaOv7DzKNSs1FdqiCrusXUsPy0NIL5juXS0i06VtCxra+oPY?=
=?us-ascii?Q?dxAqx1gxbywLS9yW5rUt73M1RK7L3WRbxX10Km0yHnvCj4+1b2SsdrdZTpRZ?=
=?us-ascii?Q?+B7FzHWe5xNGgeQaijSsvfcRs3Hib6CTHmbiV4X80Q1rMK32E5N+4NpcbsAd?=
=?us-ascii?Q?m+OWCiF552l6KARCj0c6rTMnnUFBKKbjoErQCfhMrBOFWf0lZQGk8n0rofbF?=
=?us-ascii?Q?0egqcIQHO1g0qWNzku5Tj94gok74TpLLI8DD90+bpcBDeUVhfOhiyvu9WwNA?=
=?us-ascii?Q?zFA8Rr7bipg+B+7mOElf3wEMUKfSStLBfAlxRj7Hf/xsz1jQ2dDSv3PEEvRO?=
=?us-ascii?Q?vOoJHuYpPblAiC8Nua/YypgNXnYi84JedmnyRFzigDIsxoTZ5wWMO3qMRq0F?=
=?us-ascii?Q?HKmp7MUUCttH1t4awDqK8ilJFlrn8h1SAZK6pXKuqZIYo+XfDQMYbTuR/X+W?=
=?us-ascii?Q?2esSzDvUw6wOOL07Q18D6aey5vIWynqc57ItjVzHSQ+3YyvvDwm1zXg5+7sg?=
=?us-ascii?Q?HazK3X8aCUJo/aeVoY89WAtLrcesDegpPCYmem63Z+H1ZjsPENXkF/qa2wtI?=
=?us-ascii?Q?kQxvDXBf0gA3+hfVSIPwc3x/9spZPKbehHlZ32anOAd9rAEaggj9dY4/zh1a?=
=?us-ascii?Q?h9eaAr955BJdXpIJjgxEQqgy1SMHM9NtYoJCOhYA0pMTHqzKOlDvFRcilbFk?=
=?us-ascii?Q?RRkrklRG5k+dxuVvmQbJMasqfvjfEJp5yLRzDsR67XT5QUzL3QkGGk/BgNDB?=
=?us-ascii?Q?D5NtVCG1FBs=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?jHmSgXDbmSYr6KSqLDoUo59tLWOOXJ1T9kAh8QYGgiL/+FwRtLuI+DbODQsm?=
=?us-ascii?Q?eS77na7ZTju80Pc4Gi2uBSGtGmiZnse3mTajIicOaHb09A1+iEtjc0iy5B9j?=
=?us-ascii?Q?H19C8S7+mrJEesIsWzeY63qMC1GeXogMecBNjEctKtNZ4EXmrAT/TIfob0PV?=
=?us-ascii?Q?TjlJJp4cAGG2XT1Gp1p3ejHCiThivoHnN/oJXifTDl3F6/ojOeFvyEk0fQjx?=
=?us-ascii?Q?1RBvriQ80XNG0lwoQmwEdJwH48Xk47VBwfSPTnjsjfQYk73MmECBdcANNkR6?=
=?us-ascii?Q?mi0Sr2772vdDDtnJpqjSUkctXPMBv7r7pwJ07zDmYIteE8KqyDC/MNskoctx?=
=?us-ascii?Q?vaDPdjRpyy4qrE42qNdaizmFOSSFdGWVq7uLoV1GPTeJH4sYRGnAp+HY/qnT?=
=?us-ascii?Q?hTZBWy9lTnL8vg2+Ba00yWCvW6tBv28O7gksrOi+HxLBEH9779Zqiy57UHyt?=
=?us-ascii?Q?Ob3xqod+Mr7jKKGUndeBfIf/d+kzvlHSVV9Wfz9Xqh+7kHEIKXEiZmo64Slc?=
=?us-ascii?Q?/m/HPEEGGs/JYDdCUYXJEGORBhPKQe5ZOK8YM/rN1s3Lpg2XrqB1cz+por13?=
=?us-ascii?Q?4RYrSGGlxvY2FW+R1034By8OJEJQDObznRpJA8dxI7Axvs4a6DrFae82j40Q?=
=?us-ascii?Q?mb4LzdMucuJzRKvLlTsvPvS6yAN0RSjRY4YV1c2j/eo3VrilCXmbH+3RNr13?=
=?us-ascii?Q?O95GpDrqK+JjOPrS4bW9c3nSzUazfHLgOdiddBblKcIm3YWsbcZ3Hy6wSD+O?=
=?us-ascii?Q?18sEVRMh+eZKQOIFAsBHbg9PC3sNcGINLcY7QObk3TDdazyrUZOhicGLOEVQ?=
=?us-ascii?Q?LV8JdbtT15g9j3q/NgXwtKWaodHpnTZOktC5R80VwUe5hunH1StNeu4P7lL6?=
=?us-ascii?Q?0BbsFi/VOX9+91QKWLRCnvLuhXWyfY5GSKUpqy7NO3KqfosMw9RzV+zDqM5a?=
=?us-ascii?Q?538ZaN9iBZ8JI7F1kaBnsOkJIYYpsU4ad2iHRzV5M1+ZedujifWlTbMsKyCh?=
=?us-ascii?Q?0UHoBWLwNFxCvxD5gPBvIjAgc4j2KwvtiATA6Rbx1+Cf9GjpVyeMX+bnXJmh?=
=?us-ascii?Q?4GTrhJ41OICvCN4yy1deKBamx2NfLPnBdVSHud7K+bcHiT4rmP2zZW4/uVYo?=
=?us-ascii?Q?cG7xtmBYD4da7O4jBxuOIh8e2XODlL1zx4hobrlGUeDH/QuNdYdJkcemxN96?=
=?us-ascii?Q?ydT/PO+3HQ3NjxoeeZvNwd4QELMEBBo/2kLj4drD2zejlGAsyRtUzv0N16rg?=
=?us-ascii?Q?RdOKvpkw1YIj0MZ1QexYevuC5Q9+Mh2r54c1rSZhRiB3mxAmGIJADnjNqU0m?=
=?us-ascii?Q?sVm3UWB4G85XRC3vGFD+j1Lc7qMKGzMYiqXsygYKrp2NY6gNxZeNdeJGW8JM?=
=?us-ascii?Q?GFD7YuSyYY7kK6+lgegVHAjfUDqpYX9/U2423NhHDBrs0exYEWGgXwsz8nIR?=
=?us-ascii?Q?R+2PCfaNa6DW42yaEvrh9TgQH/dghhyRePYfE8YNfj7iJjtHnYPoMnYEygGb?=
=?us-ascii?Q?ZG8eqSz6fKWq/eD7Itz5eX85mPutKOiNzNBR3jnGvdYItnRJIyPJ2rVyzyrJ?=
=?us-ascii?Q?krxZym30D0auQ8kyzvjxaKhdtK1u2k9Yg8DhlbAky2loCss4a/544WubPv/i?=
=?us-ascii?Q?Rw=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
DFAKwQRjjuH34vR4QSh4Gpst9P6udctCS6Fw9+qTIocKbIW+1FFDFfDbW1iS59T24xrhdv3XhhbeY0Uu6+tXo+IZAFLTFhTFClh2mK7+EjqH66CKtOI87orXIUjv1RTykKWzlBPObEz4dI/zktbRAyaI2LwG4ztuLZdqcXTBgK2l4RnNLHDIHH6a4VNUE+d2FLdgqo5DFTz2v6TD6btAgEDkxInPdcAjr2oWmUW7MHUoemgntrK435+RKDvniIgT60Ldi0gbs38EffXWf8jtDUMH2YaOd6GfdQoitdHIDg9NTyJ6rOuz+X9YMmJrisql6bqdmM1raVP2LYAICn7EjsD4KhAoZGpWMRgdvbqWAceP34+XBjUWXnAkx4T0oh6URxFzrvV5sG44xSqKGey0kLiXM4p1omR1o6CjXIXgjAbRFwII09D/vpZsIOmUyaREOgVbpTwn66RPd7kuGUByOcluenjx7S32wY8DnYcMo/wKQIYf9LWc4MagQdH7oNyQMturJ0mgdtbPqOKxjMzKNAHjY3Z1+QsI+F4eyrIfHCf4nbSKkltUecqqXCMJ3bhVnWEsMLu4/ki26A6F51GswmrsZeDisJU0E4ZnYURIGek=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 380792f7-cbaa-4c27-70a2-08dda4f36a1d
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 12:12:32.1575
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: CAUSHOg9eaXUgsYPxSM/6rBG+v0HEyy+Y1YxMaYcGuHLdon5Cwq0t/0iJcereYeZZ3+bmpu2Y5rE/S7rLV6X2HVRdnwxSBYavhEut9dAXow=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6545
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=985
bulkscore=0 spamscore=0 suspectscore=0 malwarescore=0 mlxscore=0
adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
engine=8.12.0-2505160000 definitions=main-2506060110
X-Authority-Analysis: v=2.4 cv=aqqyCTZV c=1 sm=1 tr=0 ts=6842db34 b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=incDtCff1XPBpDD-vqYA:9 a=CjuIK1q_8ugA:10
X-Proofpoint-GUID: ICKyuTJtUVHojeeiMIfGms3yeYqXvD2Z
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDExMCBTYWx0ZWRfX8dIgxDRpQpRg pcKr26m30RC8WsCa4sJA0Ky3kC/4I4s0sCCzmWiC/AX8jJHAQ0BZBmuNV389FQhxbYu4iuioGnq t5x6XYG2LDySS4AE7Vl6NMLBb2NkXk5ybxuzn+Giai9OsYxopsQu+jSg3iSslHXXfBtfoqoD0dJ
COwWKDV2+K/sX4GOyx20o/+3+TXLd+y8+9zbOrqgK+zMy8E0hWRu168ukCYZDSDGQxCbC0wxccs iMJfL9ssz/fLkzul9Z4yS/D0P5uSRHddsIPZbwIyUkyQvbYOCtqzHP4mlzjlX3ixh91AeHBOiFH q5ewJOtn5fYmSgRbiqyuJs6MSmWxSUCkFm9ZgWMO/UjdvyLO4lRCuFINHH6GpMRfSGLouZBw2/5
ejSNoeGBU1HTkBKcc4pzvFyRDvfwBsb7dBqZCqRGMk5Tkzq1mqNm9qR25WzO8ihwDBCQEMKA
X-Proofpoint-ORIG-GUID: ICKyuTJtUVHojeeiMIfGms3yeYqXvD2Z
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 01:44:12PM +0200, David Hildenbrand wrote:
[snip]
> I assume with "this patch" you mean "a patch that gets rid of VM_BUG_ON
> completely", because I want this patch here (that started the discussion) to
> go in first.

Yes, and sure.

I can wait until this is merged upstream and take a look afterwards?

>
> Fascinating how you are always looking for work :P

I mean I have an insane amount of work to do this cycle anyway... but the Call
of Churnthulu is loud to me ;)

>
> Thanks!
>
> --
> Cheers,
>
> David / dhildenb
>


Return-Path: <linux-kernel+bounces-675723-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7BB7B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:13:01 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8CDA53B2C16
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:11:16 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1178628A1DD;
Fri, 6 Jun 2025 12:09:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="NnXfVkE4"
Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2047.outbound.protection.outlook.com [40.107.220.47])
(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 48E1F288CA1;
Fri, 6 Jun 2025 12:09:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.47
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211764; cv=fail; b=ScMF5HKWm1xmCG/+PPNtOSUS40hoX00RpkqUV9Wh/04FZ2OxGjYvl3yatiHuE/w9fmeq5sDJYmYDIbqltEaLeW7FHxGI0weGkTQbG4jOgP70NcNY23dEB2xcjWBSrmL6sS9r7Xtfgep7VjmtDB2bVZf/zRpLvXR66b9drDAdkyQ=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211764; c=relaxed/simple;
bh=KL8LzqukVXdANheSs8UmDNL+OXQ9U2P1dGZkEZZQlr0=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=h9HMObNksdqB3j+jK2EX5ij0hoIo9Wn6dZHASqqp5z4ZxL3jhW6a0QA4p6jLomlYvC857jm6zpW7R2Jgs17A0Y91MagiQPIbiGTAiM9/GaZ/pd8k4w3sGBkTlHHp0OC2msFiza8cwha5UVFvUZlftVNBZyy/CgFSN74v7Q8VlUo=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=NnXfVkE4; arc=fail smtp.client-ip=40.107.220.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=DNAX0P0W7fOnry6PlT9ffgOHb1gLQ7EExKOG3qmxCEHJUI9/qJxCSVUhAnLuKOOB5EERINIWKEu50XmZNVyr6buZNqra4QfhfchSbbbQoFdeIjAR+9uBbGa26U9TB6ZN335vsg+nCSt9h47S/3pwSSqCdZ5cIdvO5YPhYP2+c29yRrA3RUI1d/ZMH1zxBX0qo/AwCXX5IT4LTkHdpcqLUVDadv0k7lpyXrjO4g7DObH051zsIn11q/GtzmipC2wD10xUVq2Bb8xOWr5zwiPY7vCgwQqL+NzBQkvBF4vP5daQxEki+q8Im9HJ4kDfsgchjeGG3tPOaSvCYRxM1Etzvw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=N3vajKJzTltQ5QgU3O/kpupizQuA+grCCB+TaVPS2gM=;
b=EIUdHdrhZPI+er2DOKULb+y1VQWl5CrN1KDNuGUqFedGp95T6y8Ve7gxgzW8OWswgOYBfsv3dwk8fgrUXLkNl+NWsQQ6qv9mfBtrqfadjAcVfCsPrZihZWWGJhHz1MHQQFvk5Ahuner4iy9tSJwsJuMXVQtxXZxEX4uouapJjUfwTSLNlvcDAbU7jGQrCzVuLzK0oHW4zOzZ6mATGhSCCQx90of+61H+ZYAd+Lustqz4PWa+53/4wVQqNVdaTu05gY5WjPXTMJJ6pYQak7WgV26aW+kO26bS1V6r/eg9SBSVsiQNoiiLHvVc2qxPHdwz9Q+qan6e6l6fi34pphDcXw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
dkim=pass header.d=nvidia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=N3vajKJzTltQ5QgU3O/kpupizQuA+grCCB+TaVPS2gM=;
b=NnXfVkE45jiEco5vgLUlgldbxDxZwqzjARarQSbeByMnmCUXbEdkCS4b2vO2epmm8/HA872rx1ZsOAmtFQOroMTI2OWQ3eCsVnAvwKVQo6Rp1T6kqxTdxmP0f4TZeTf14B0A12QV+CQfdBLYTkqw+S+ZnhJyBWs1AJxZ4fPuJhQsUCU16lmqnk9CBIMC8DLNoO39EhZgPiyjlvp/gKTqZR4BsqNBoKJjWZ1hI12HV2IMHQWI6YHN23mbij8rXIGNeEXqj++eGDeB8XHnEe1r0PAluCd9eb5fXGzmbei5MWURJK+W/GCesZTjMLmL1NMRFmuzRhCjGiF/TdNG9D3ENg==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nvidia.com;
Received: from CH3PR12MB8659.namprd12.prod.outlook.com (2603:10b6:610:17c::13)
by DM4PR12MB5939.namprd12.prod.outlook.com (2603:10b6:8:6a::19) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.38; Fri, 6 Jun
2025 12:09:20 +0000
Received: from CH3PR12MB8659.namprd12.prod.outlook.com
([fe80::6eb6:7d37:7b4b:1732]) by CH3PR12MB8659.namprd12.prod.outlook.com
([fe80::6eb6:7d37:7b4b:1732%6]) with mapi id 15.20.8792.038; Fri, 6 Jun 2025
12:09:20 +0000
Date: Fri, 6 Jun 2025 09:09:19 -0300
From: Jason Gunthorpe <jgg@xxxxxxxxxx>
To: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxx>
Cc: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx,
sumit.semwal@xxxxxxxxxx, christian.koenig@xxxxxxx,
pbonzini@xxxxxxxxxx, seanjc@xxxxxxxxxx, alex.williamson@xxxxxxxxxx,
dan.j.williams@xxxxxxxxx, aik@xxxxxxx, linux-coco@xxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx,
linaro-mm-sig@xxxxxxxxxxxxxxxx, vivek.kasireddy@xxxxxxxxx,
yilun.xu@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, lukas@xxxxxxxxx,
yan.y.zhao@xxxxxxxxx, daniel.vetter@xxxxxxxx, leon@xxxxxxxxxx,
baolu.lu@xxxxxxxxxxxxxxx, zhenzhong.duan@xxxxxxxxx,
tao1.su@xxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx, zhiw@xxxxxxxxxx,
simona.vetter@xxxxxxxx, shameerali.kolothum.thodi@xxxxxxxxxx,
iommu@xxxxxxxxxxxxxxx, kevin.tian@xxxxxxxxx
Subject: Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for
TEE-IO support
Message-ID: <20250606120919.GH19710@xxxxxxxxxx>
References: <20250529053513.1592088-1-yilun.xu@xxxxxxxxxxxxxxx>
<20250529053513.1592088-20-yilun.xu@xxxxxxxxxxxxxxx>
<yq5ah60u8kev.fsf@xxxxxxxxxx>
<20250605151029.GC19710@xxxxxxxxxx>
<yq5a7c1q88oy.fsf@xxxxxxxxxx>
<20250605163339.GE19710@xxxxxxxxxx>
<yq5a1prx8bb2.fsf@xxxxxxxxxx>
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <yq5a1prx8bb2.fsf@xxxxxxxxxx>
X-ClientProxiedBy: YT4PR01CA0262.CANPRD01.PROD.OUTLOOK.COM
(2603:10b6:b01:10f::26) To CH3PR12MB8659.namprd12.prod.outlook.com
(2603:10b6:610:17c::13)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: CH3PR12MB8659:EE_|DM4PR12MB5939:EE_
X-MS-Office365-Filtering-Correlation-Id: 61e6fef9-f8ee-4289-2a00-08dda4f2f7cb
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?MmJocU9oVDE3eloyMXg4TFRMTWJnRkM2VmV6N0FtTEZCQkswRThCZEtldGxD?=
=?utf-8?B?SUk1RjlobmFVMnlneXljNEg1YjJ5eHRFSElBMTJFa2JlTnBLcVEzK1dyVmEz?=
=?utf-8?B?Ymhab0JPMXNFZ29MdUN0RVVGUGlGWGZpVjVmQkNURXZuWmVqVzhTcXNaelRn?=
=?utf-8?B?bExCOGFxMXhOR2xmWU03NU9ERmtXSjVxYVpvb2xpUWdoSzE3K3dudlpjaXNT?=
=?utf-8?B?RGxocmtWRzJzOFBOQjF5V0Z1RzBJQ0ZTQkJkdERtT0FnT2tYcWl0TWRBWnJJ?=
=?utf-8?B?c1hKbVRETzliLzFnTnErekEzU1hXQ3RaaXA4R1c0SkpZdkR1cHVTdGFqdG5w?=
=?utf-8?B?d1lCbTVCTkJhOElxR0F5MjM4c2J4RzRHN2wvUk82VzZTaGhIZ1FVcHBhS2M4?=
=?utf-8?B?VzZRRHNwTXpoTDBYY3BBejhabEduN0JHL3pSTVhZWDFGNDFWZGg5S3ZUOGt0?=
=?utf-8?B?RysybGROMGh2VHdSMUpxdGJZWERNczlreGN3dTVWK09SbUkwYlZWYWtBNVB0?=
=?utf-8?B?dmtWRzRPZXhuSlJ1TTljZmFHV2d4Z2ZWMGF1V1ZuYU1GbnhFWG1hL0wzZFFN?=
=?utf-8?B?M0F5eVpZYTN0NGNMTGt1eGJDMGRaRDhVQUVCaExSOFNhVS81RitEcW5CR09X?=
=?utf-8?B?TnR6S1RLVVQrMHhLaURiK2RZZGdqZ1BHalRTZUNXNFptRUtLaGRJZ3c2dXBl?=
=?utf-8?B?VXo3VTNwY293MG5vQ2VocXo2UEUrWjhWb2k0QldINFdUMk90NlVxUUtpemg3?=
=?utf-8?B?SkJFamdoQVBFNUlTT3h6U2FvWTFiUU5lMmZpc2V6T1ArdzRhWUxPeG50Tmsv?=
=?utf-8?B?QUVPa05XbmY3cWZiRGI3V29DVjNvcWIrZ3d0LzU3dTJRTUJ4VFFFRjBUSTda?=
=?utf-8?B?QWVuUStUZTFzQnlNbzRyamJZbkZNQkxiQ2dTTElrOVJPL0l0ejRJb09WeWND?=
=?utf-8?B?bjJZQVM4TnB5Q0pvQWg5R0ZxTlFDSWlsYW9FNjlLbVJNMFpNVzB3WWlyaVN4?=
=?utf-8?B?TExPNHkzN0RjdHgrRy9FcnZGTWcydXRSTTduYUhSN3k2anhoNG1oN1d5Ylpj?=
=?utf-8?B?ZTBkMHZIT0FIN0x4UDZDUFdtLzROajRaTHJ3bE9lS3hBZnZjR1NvWkQ1Szkv?=
=?utf-8?B?TlFKUWM1WGhwY3MvcERYdG5nZ0srWEt3cUpIZ2gyMG5BUEF2c2JyWC9vMENL?=
=?utf-8?B?T0ZsRVpEK1FxSkdhV2V2MFNIN0c3d3dGeDl6TTF3WE9WKytueWM0eHRtUkY0?=
=?utf-8?B?QnVWNmM4eFJkaDkrVi95Q3IvcTVmbDZFS3h2MEw4Sjc2WFY1Yk43bThXcmti?=
=?utf-8?B?K3Y5dTZVSlQzU2xFMVlvUGttYzJTYUFEbzVRTXV1MWxkRWk2VXRKMXpQb0Q3?=
=?utf-8?B?dnYycEE0cjFTd0Rvalo1Slhjak1zcVVFQTRWZHRLdzRubkFsWFdDUWdBbkkw?=
=?utf-8?B?dXJVdmxrR0VhVmkwYTl0cktqa2RSUnVqSGorVUxnRGZxSHYvdnNDODBsYlo0?=
=?utf-8?B?NEIrNkQxV0V6b0ZqNGRMYlVRVHVsbFpiZTFqRm1lRlJzMzNwWkdpRkhDb1BY?=
=?utf-8?B?RVd0R09xRW4wQWxpd3Y2WWJnUEFYVXNMbXpDV2xybFhpQm0xR211VXJCaFpa?=
=?utf-8?B?dWRUTGNXaFRNYU9sSXFnckl4ZmRpS2xDYllzR1pjZHh2Mjh5cFJ0ZjdKelN1?=
=?utf-8?B?VzIvcmUvSnFVS2VVZzhsK2lST0w4cWNKQzZsNk1Vb0RDNnluOGxncEd5a09v?=
=?utf-8?B?TXNjeHZUNGVLcUtnQzF0RmhjVHdHNTE0Nk5QVktQRU1hK0lQcFhqME9SalVO?=
=?utf-8?B?cURYTENBOC9lWjVRQVFteE1xL3luMzZ0ZGJXeGVzSnhnZHZEeks5Y01ZeEtM?=
=?utf-8?B?cEdBNmkyQzBLNk5RRHBCbnpZZVZqWEVkNEF6T09HVE9WeDkyVFRXSHNvNEVs?=
=?utf-8?Q?RvbPuwxiQbs=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH3PR12MB8659.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?VDI3Q1VBM1ViK0Y1RHdoVEpDa3g5ZGtPeTVha25IVmhPSmhBUFlDdjN2WHhm?=
=?utf-8?B?eW9TTVlRcjZpSERoYjY1YW5EQXppZ1RlajdtYzRtY2c5dlFOSkk2WXpWMkF3?=
=?utf-8?B?NElhM0RVU0J2cEs2aEh0WCs4S2txL1VsWGZTbTAwZjMzTnJ5SVJpWGMxcVQv?=
=?utf-8?B?TDBiQTlpdnYwOW1FT25xYVZXcGJMRHpmajYxbEdpU1FzdGladVJVTXhDVlVk?=
=?utf-8?B?akVjNHRTeDNBdTNNdVFVamdJYjk4QVVwY01aSFcwNk9DOHlmUG9lR3RjcDlV?=
=?utf-8?B?eldGZ0tFa1lWbDVFTHFaVXJFbTZ2bzZMaThDQTBPM1ZFTXNtQXozYURQOGxI?=
=?utf-8?B?VTA2L1pqMkNVY3pWMjJBTVNKRVVSMXVmeW0xb3lIYmVEMG54SURpU2tVNkhD?=
=?utf-8?B?NUowZDZJTUpQaXJzZDIrNUh2bHVTVlVhVHVBanU2QktYdDVOd2JTNTRibG1B?=
=?utf-8?B?LzE1NFhnU29kY0JhY2ZBcVN1OTR0UU1wNmx2M2g2ZWtPZUpPQ3Byd3h6U1NL?=
=?utf-8?B?UGZ2RW9vTVp6ZjRCbk12UE42Y0pZZkxOdS9ibGY3My9OMEgyMzdGNHZpUS9i?=
=?utf-8?B?WCtIaEpvbU5kKzAzSGdHWFJkRzlOVWRjaDF3RGI2RFpGUVA5czlEWkxaeHJl?=
=?utf-8?B?V2lubnhSWlVvR2c3bjVLYmM3U0JQYUZNTWY5akU1eER2QXFJQU5UQXNBSTV1?=
=?utf-8?B?US9PYk0xN1JPQXRnVGo2SXZXMWJMMksxLy85d1RmSjc2KzR1b3F3SmxpbSts?=
=?utf-8?B?Sll3UnZPVzVOSktmSEZzNXdmM3RhNGV5VmhQampHL2V0WTl2Qzd3RkRDR1VW?=
=?utf-8?B?YnRxOEM0SzBWcHMvN0pWZ2xFdllSQzFqdkJzOFpya3FsQzFSdVlUWHFHbUxQ?=
=?utf-8?B?dXNmRnNIb0lDVXlJb2R3TWxSdnh0TjIwUFlHWjNwTTlKV0xyVUYxcGtCYVNa?=
=?utf-8?B?Vlp0cEFBVzkvT0M5MVVHMXk0Slg2dkYrZ3BXMi8wMzUvYVNTMXR6Zy9hNy9n?=
=?utf-8?B?eVV1bGlWbXV3U1JwY0hmTEFOUDU0LzM1OXEwUVhta3dhVDJLUFUvYlJmbjRI?=
=?utf-8?B?N0tBVFZhZ05laG1MWUZIR25sbFRQYklwdGhTTFF5YWNyL1gvdVBqOUg1QXRw?=
=?utf-8?B?OUNrbEsvNUxZY2FtbjNMOWVxS0Q4TG1GdEJQMitPV04vbjF3VURmUFNqbUhK?=
=?utf-8?B?bGgzTDBpQUludVY1TGZPUnk1amoxNDZ4WFRqc2RnMTRGY3F0NkpVc3VnODNL?=
=?utf-8?B?VG5LbVRjNEsvc2R0cGgwYmNRNTNlNVM4dSt5cEFkMDhVMnVsK3cyK1lDbTdr?=
=?utf-8?B?dHNuYjNUdXF5dGpTUjQxUk4wZHpYTy9SanhHL1J3ZWZ2RGZPbzV6RzkwQmhs?=
=?utf-8?B?R01HOGxrd0FDSUh5T2hwY29yNkVUZmY0YWRZTFdjOG5DZ2xhVEtjM09iRkZy?=
=?utf-8?B?NUJrMGlwQ081U3F0Z0tvR1FIYVZLNlhuME8zSlZJWUtIZ2J6bVFkbEZwcUVX?=
=?utf-8?B?S2xnd3JTNTR3ME9HeVN4QUVzb2E5VVRaVTVudlVJTXdOY0hmTXV2ZEJ1N0Fn?=
=?utf-8?B?eXZEdm44RDRxd0xTSHFKU3lOZHJVUkVBbjdpaStxTVVsbTd6Wkp2blB2enli?=
=?utf-8?B?Qkd5a2ZucUxMNjJUbXIxTG5oNjZOK0F3R1dqUVZsNktVVjlCV1ZuMG01c0l3?=
=?utf-8?B?dVhXVk9BTnFDVDlLa0U1WlNKcW0wZVYySnBsRVNDZ29QMzFhT2x0UnAvM2hG?=
=?utf-8?B?RVViek90UGlSdXFVVXZsSVRuVUxRTTc1TmdKbFN3OWRtcW1PaVI0WnZMMjI3?=
=?utf-8?B?b2M4RUY5UW16OHp1WUNpakZCTHdMNGVDLzFOaDc0TC93ZlJFV1hYZzkrRG5a?=
=?utf-8?B?Y3RkbVdmRThRRVJrNGNLZzF6bERnajdBd1JHV29QNnlCVFcwWXBDeWx6VWVC?=
=?utf-8?B?YjN5UWYrYS9ORFd2VVZCL2NyUG8zNUY1YWlCcktBdXowRi9GZ29RRnNya1p5?=
=?utf-8?B?UktpTEVvR1FpVFNCTm8rRUltMUlkQWtLQTh4dlVJRFpRTTBHUzg2clhpZWti?=
=?utf-8?B?TWY4K1ZkWUcrQjU0dURST2VnanR0d2lUcm16RWtyUXBlWFMyQnpibmlJTWEy?=
=?utf-8?Q?MXVfLK7ldzpLMsANUdIQvzUqF?=
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 61e6fef9-f8ee-4289-2a00-08dda4f2f7cb
X-MS-Exchange-CrossTenant-AuthSource: CH3PR12MB8659.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 12:09:20.4491
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: AEywOH8tCuw6hGedYoC6SP5tQZM2Inu6b5WsJrLSP3+gVpVC/TGu9ZJOAg1LK4N6
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5939
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 03:02:49PM +0530, Aneesh Kumar K.V wrote:
> Jason Gunthorpe <jgg@xxxxxxxxxx> writes:
>
> > On Thu, Jun 05, 2025 at 09:47:01PM +0530, Aneesh Kumar K.V wrote:
> >> Jason Gunthorpe <jgg@xxxxxxxxxx> writes:
> >>
> >> > On Thu, Jun 05, 2025 at 05:33:52PM +0530, Aneesh Kumar K.V wrote:
> >> >
> >> >> > +
> >> >> > + /* To ensure no host side MMIO access is possible */
> >> >> > + ret = pci_request_regions_exclusive(pdev, "vfio-pci-tsm");
> >> >> > + if (ret)
> >> >> > + goto out_unlock;
> >> >> > +
> >> >> >
> >> >>
> >> >> I am hitting failures here with similar changes. Can you share the Qemu
> >> >> changes needed to make this pci_request_regions_exclusive successful.
> >> >> Also after the TDI is unbound, we want the region ownership backto
> >> >> "vfio-pci" so that things continue to work as non-secure device. I don't
> >> >> see we doing that. I could add a pci_bar_deactivate/pci_bar_activate in
> >> >> userspace which will result in vfio_unmap()/vfio_map(). But that doesn't
> >> >> release the region ownership.
> >> >
> >> > Again, IMHO, we should not be doing this dynamically. VFIO should do
> >> > pci_request_regions_exclusive() once at the very start and it should
> >> > stay that way.
> >> >
> >> > There is no reason to change it dynamically.
> >> >
> >> > The only decision to make is if all vfio should switch to exclusive
> >> > mode or if we need to make it optional for userspace.
> >>
> >> We only need the exclusive mode when the device is operating in secure
> >> mode, correct? That suggests weâ??ll need to dynamically toggle this
> >> setting based on the deviceâ??s security state.
> >
> > No, if the decision is that VFIO should allow this to be controlled by
> > userspace then userspace will tell iommufd to run in regions_exclusive
> > mode prior to opening the vfio cdev and VFIO will still do it once at
> > open time and never change it.
>
> So this will be handled by setting
> vdevice::flags = IOMMUFD_PCI_REGION_EXCLUSIVE in

Not like that.. I would suggest a global vfio sysfs or module parameter, or
maybe a iommufd ictx global option:

IOMMU_OPTION(IOMMU_OPTION_OP_SET, IOMMU_OPTION_EXCLUSIVE_RANGES)

You want something simple here, not tied to vdevice or very dynamic.

The use cases for non-exclusive ranges are very narrow, IMHO

> and vfio_pci_core_mmap() will do
>
> if (!vdev->barmap[index]) {
>
> if (core_vdev->iommufd_device &&
> iommufd_vdevice_region_exclusive(core_vdev->iommufd_device))
> ret = pci_request_selected_regions_exclusive(pdev,
> 1 << index, "vfio-pci");
> else
> ret = pci_request_selected_regions(pdev,
> 1 << index, "vfio-pci");

And IMHO, these should be moved to probe time or at least FD open
time, not at mmap time...

Jason


Return-Path: <linux-kernel+bounces-675724-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 093A141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:13:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id E6D3C3AA52D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:11:29 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ABC6E28982E;
Fri, 6 Jun 2025 12:09:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=senarytech.com header.i=@senarytech.com header.b="dpFK+QGy"
Received: from mail-m155100.qiye.163.com (mail-m155100.qiye.163.com [101.71.155.100])
(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 9B657288511;
Fri, 6 Jun 2025 12:09:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.100
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749211793; cv=none; b=SGoHcXr3Vv10mw08hl9FAYcwhiuaW3rLpLj8tchJJzPQ+dD+TYT390cIzrOT4uCoFkb3P6AB+ohppLlD7IDUlZv6QqDXRXuPRr/8r8p39Qje3nkSwJ6X0MtDxaKLElDYxqa8ddF3vWwVEBE/Cz7huMcWD61Fv6D89noo3IXgdQY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749211793; c=relaxed/simple;
bh=fKLaM3Y/zvFJjqno1ZuE4eCqxRCZBQdRSSXpdfOYEUQ=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=e5kiGe0St54BO3oD9JD25NON4wqKLHxmsxch4KZ32a5wpLAc1JQY2HNDpH+c0cwETxcBunP5ySvZvVQprT+AjF/E//I4v1fJyDGwh+E+Fiyvbxvrl9G0euR9cwPlzyrEyn0NiSxM7af5O9Lqn9PTjIy9pkpNdXH1b2z9mNocFSA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=senarytech.com; spf=pass smtp.mailfrom=senarytech.com; dkim=pass (1024-bit key) header.d=senarytech.com header.i=@senarytech.com header.b=dpFK+QGy; arc=none smtp.client-ip=101.71.155.100
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=senarytech.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=senarytech.com
Received: from f-15NBC1011.. (unknown [59.173.180.60])
by smtp.qiye.163.com (Hmail) with ESMTP id 17c70785f;
Fri, 6 Jun 2025 19:34:15 +0800 (GMT+08:00)
From: "feng.liu" <feng.liu@xxxxxxxxxxxxxx>
To: perex@xxxxxxxx,
tiwai@xxxxxxxx
Cc: linux-sound@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
"feng.liu" <feng.liu@xxxxxxxxxxxxxx>
Subject: [PATCH] Correct boost volume
Date: Fri, 6 Jun 2025 19:33:49 +0800
Message-ID: <20250606113349.129746-1-feng.liu@xxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.45.2
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly
tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkZH0lIVkMdGkhISEhCHkxPGlYVFAkWGhdVEwETFh
oSFyQUDg9ZV1kYEgtZQVlOQlVKTEhVSkNLVU1LWVdZFhoPEhUdFFlBWU9LSFVKS0lCQ01CVUpLS1
VLWQY+
X-HM-Tid: 0a974505283309d6kunme17f59d81e151d
X-HM-MType: 1
X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NSo6Sww*MjE#PRgDMig3TToO
Ii1PCR9VSlVKTE9CSUtCTU5NT09PVTMWGhIXVR0eFRxVFxIOOwgeFRoJAg8eGBNVGBQWRVlXWRIL
WUFZTkJVSkxIVUpDS1VNS1lXWQgBWUFISUpJNwY+
DKIM-Signature:a=rsa-sha256;
b=dpFK+QGyk0gMHMAteJBMJAceC9R4A/PKk+bff+0MnEaAhqnFHxLKItgVmX/k+FU2QtqSg/L2ke11icl/orAqOOp2yuao8NRlWYXkmR6G/adnflVKcYa196gt+UjJXIvA2BXKtDhavbfItkGGLxgNIi3IAUBC0J3i1Jk6sEMnawM=; s=default; c=relaxed/relaxed; d=senarytech.com; v=1;
bh=pIG8r7shakLbmdpIlhngJPrd8+12FVKQFSGXxV9t87E=;
h=date:mime-version:subject:message-id:from;
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Read the Boost Level configured for input pins in the BIOS
init verbs, and restore these settings during audio recording.
This addresses issues of low recording volume or excessive
background noise caused by incorrect boost configurations.

Signed-off-by: feng.liu <feng.liu@xxxxxxxxxxxxxx>

---
sound/pci/hda/patch_conexant.c | 46 ++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 34874039ad4..77101363e06 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -43,6 +43,8 @@ struct conexant_spec {
unsigned int gpio_mute_led_mask;
unsigned int gpio_mic_led_mask;
bool is_cx8070_sn6140;
+
+ unsigned char init_imux_boost_val[HDA_MAX_NUM_INPUTS];
};


@@ -1178,6 +1180,48 @@ static void add_cx5051_fake_mutes(struct hda_codec *codec)
spec->gen.dac_min_mute = true;
}

+static void cxt_fixed_mic_boost(struct hda_codec *codec,
+ unsigned char node_id,
+ unsigned char mic_boost)
+{
+ unsigned char value = 0;
+
+ value = snd_hda_codec_read(codec, node_id, 0, AC_VERB_GET_AMP_GAIN_MUTE, 0);
+ if (value != mic_boost)
+ snd_hda_codec_amp_stereo(codec, node_id, HDA_INPUT, 0, HDA_AMP_VOLMASK, mic_boost);
+}
+
+static void cxt_cap_sync_hook(struct hda_codec *codec,
+ struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct conexant_spec *spec = codec->spec;
+ hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
+
+ if (spec->init_imux_boost_val[mux_pin])
+ cxt_fixed_mic_boost(codec, mux_pin, spec->init_imux_boost_val[mux_pin]);
+}
+
+static int cxt_get_defaut_capture_gain_boost(struct hda_codec *codec)
+{
+ struct conexant_spec *spec = codec->spec;
+ int i;
+ unsigned int boost;
+
+ for (i = 0; i < HDA_MAX_NUM_INPUTS; i++) {
+ if (spec->gen.imux_pins[i] == 0)
+ continue;
+
+ boost = snd_hda_codec_read(codec, spec->gen.imux_pins[i],
+ 0, AC_VERB_GET_AMP_GAIN_MUTE, 0);
+ spec->init_imux_boost_val[spec->gen.imux_pins[i]] = boost;
+ codec_info(codec, "%s, node_id = %x, mic_boost =%x", __func__,
+ spec->gen.imux_pins[i], boost);
+ }
+
+ spec->gen.cap_sync_hook = cxt_cap_sync_hook;
+}
+
static int patch_conexant_auto(struct hda_codec *codec)
{
struct conexant_spec *spec;
@@ -1245,6 +1289,8 @@ static int patch_conexant_auto(struct hda_codec *codec)
if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd)
spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook;

+ cxt_get_defaut_capture_gain_boost(codec);
+
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);

err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
--
2.45.2



Return-Path: <linux-kernel+bounces-675727-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5A25341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:14:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 9BF211886087
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:14:37 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 46892288526;
Fri, 6 Jun 2025 12:14:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZDQjazCJ"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 71784283FDE;
Fri, 6 Jun 2025 12:14:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212055; cv=none; b=HbSbFfzQqQk7KAS2GMC41ueguQpj0SR6SC1xYWFCDBfcsRpSJzZTxt6/4AaHnHSBkivx5Tk2rDI3Nj/JIfP+1hSZ9P6hzeqpOAm1bfgMZVsN8R/ELOZKIBRkHTwmEzBwsr9PF/0n4eznN+80SleuxEvkp32Xq++YXGEzx67UGRo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212055; c=relaxed/simple;
bh=1WJsWhTzFsCD3REzePOpGgsNVGMiEg6va/vljjL/0II=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mrGf1halFHgBhlPpM+5NCzcivOySPTlneCdpFzdPvw8si7nR0GHIioxkDXPcZlwiSf4B3n6774jH0fnlpC74vYhMk7z4sQN3XOF9b3K3qgkW9joIzn1KlfbCGmz9eveHlPmToZvcoWsIXL8UgaeOHhPsx3L1WlUCfO8uSnWhxsA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ZDQjazCJ; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from isaac-ThinkPad-T16-Gen-2.localdomain (cpc90716-aztw32-2-0-cust408.18-1.cable.virginm.net [86.26.101.153])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 250D211DD;
Fri, 6 Jun 2025 14:14:06 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749212046;
bh=1WJsWhTzFsCD3REzePOpGgsNVGMiEg6va/vljjL/0II=;
h=From:To:Cc:Subject:Date:From;
b=ZDQjazCJTHMo4obbI5CXD2mDzuNpEWRIbUIi9XKVgSj9VTzvWrRKtrMAdBDUCNrvO
3qCVZtM8hD3f9KVRo49qQAldwRaGLmF3+ni2QtA+NY+zA7qgEviGals6xso/VawfLS
PJbEuuUsaiHTZ9A1u1VOyhAFKJdKfIMkSM1IJIG4=
From: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
To: laurent.pinchart@xxxxxxxxxxxxxxxx
Cc: kieran.bingham@xxxxxxxxxxxxxxxx,
rmfrfs@xxxxxxxxx,
martink@xxxxxxxxx,
kernel@xxxxxxx,
mchehab@xxxxxxxxxx,
shawnguo@xxxxxxxxxx,
s.hauer@xxxxxxxxxxxxxx,
kernel@xxxxxxxxxxxxxx,
festevam@xxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx,
imx@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Subject: [PATCH 0/2] media: Add line end IRQ to imx-mipi-csis driver
Date: Fri, 6 Jun 2025 13:14:01 +0100
Message-ID: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Many boards, such as the NXP i.MX 8M Plus, feature multiple interrupt
registers. This series refactors interrupt status register debug handling to make
it more intuitive to add other registers such as LINE_END, which has an
entire register containing only one interrupt. Previously, the
mipi_csi_events[] list contained a debug enable field, and this replaces
that with a status_index, which indicates which status register contains
the mask for the interrupt.

The second patch adds the user line interrupt, which is useful for
debugging, as it allows a user to trigger an interrupt after the MIPI
CSI receiver has counted a configurable number of lines. This can make
it possible to discern the true resolution of the image stream reaching
the CSI receiver. It adds an entry to debugfs which lets users choose
how many lines are needed to trigger the interrupt, and can be disabled
both within and outside streaming by setting the value to 0.

Isaac Scott (2):
media: platform: Refactor interrupt status registers
media: platform: Add user line interrupt to imx-mipi-csis driver

drivers/media/platform/nxp/imx-mipi-csis.c | 107 ++++++++++++++-------
1 file changed, 74 insertions(+), 33 deletions(-)

--
2.43.0



Return-Path: <linux-kernel+bounces-675729-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EA69941E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:14:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7A75E176154
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:14:45 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 37F90288C3F;
Fri, 6 Jun 2025 12:14:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lCogGrRX"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 C40EC286D50;
Fri, 6 Jun 2025 12:14:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212059; cv=none; b=IOld23YTRbHht4ebddSQ1xu0QVI/8f12MrMOl3hs4t41qHOs1OIs7GnFbot7RFdceIZvHiXmCLSCByQkrLPmEcWi/U9572bdwbbYYOHLjGRS2/wYsq5MQ4fp/I+FxBeVBrYHyRP+mB/7AhGDKy2m93R8GTfkTBIu+64OjnRhfJc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212059; c=relaxed/simple;
bh=zG+3efq2Ab+EPeEyhmoGZ6e4roDjDNXBh4f0PORKj38=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=cnhwXiqFBiaxz6IZrtaPex03OADy9R3qF7ODMQdG3tIcK64BOf0wsqEOzzN6kyhbmLUkbR0m3df59ARvpc/AKHU+qcM29ydrRrWWEfv1F7D3cBNDoiBcz2qZv469MOJQ4AHPF2MwqL5ZTmJDYdAWQzxhZvqZ+4tHjHElxh3jKaw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=lCogGrRX; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from isaac-ThinkPad-T16-Gen-2.localdomain (cpc90716-aztw32-2-0-cust408.18-1.cable.virginm.net [86.26.101.153])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E01D149B;
Fri, 6 Jun 2025 14:14:11 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749212051;
bh=zG+3efq2Ab+EPeEyhmoGZ6e4roDjDNXBh4f0PORKj38=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=lCogGrRX3Ai4kjdG6h5Pv8nQW1e0t02ejfLdF8uKg6EWtsgBAm+rNQ+LyRc1m/z5p
KNTpJU34AtmiPR8NhvTrl/GEH1f9ywaJPOFD9Ck+VI7esYXrHMw8+SlqQX1mh91hLX
hKRYTtM4ujGkiM0G3YkO+aPLF8m3+x+ShL9FDvoY=
From: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
To: laurent.pinchart@xxxxxxxxxxxxxxxx
Cc: kieran.bingham@xxxxxxxxxxxxxxxx,
rmfrfs@xxxxxxxxx,
martink@xxxxxxxxx,
kernel@xxxxxxx,
mchehab@xxxxxxxxxx,
shawnguo@xxxxxxxxxx,
s.hauer@xxxxxxxxxxxxxx,
kernel@xxxxxxxxxxxxxx,
festevam@xxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx,
imx@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Subject: [PATCH 2/2] media: platform: Add user line interrupt to imx-mipi-csis driver
Date: Fri, 6 Jun 2025 13:14:03 +0100
Message-ID: <20250606121403.498153-3-isaac.scott@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
References: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The NXP i.MX 8M Plus features an interrupt that triggers after the MIPI
CSI receiver counts a user-configurable number of lines. This is useful
for debugging, as it allows users to check if the amount of lines per
frame equals what they are expecting.

Add support for this interrupt in the driver, and an entry into debugfs to
allow the user to configure whether the interrupt is enabled, as well as
the number of lines after which to trigger the interrupt.

This debugfs control can be altered while a stream is in progress, with
0 disabling the interrupt and >0 setting a new desired line count.

Signed-off-by: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/nxp/imx-mipi-csis.c | 45 +++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index bbc549c22aff..0e6bc3c87be4 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -88,6 +88,10 @@
#define MIPI_CSIS_INT_MSK_ERR_CRC BIT(1)
#define MIPI_CSIS_INT_MSK_ERR_UNKNOWN BIT(0)

+/* CSIS Interrupt mask 1 */
+#define MIPI_CSIS_INT_MSK_1 0x18
+#define MIPI_CSIS_INT_MSK_1_LINE_END BIT(0)
+
/* CSIS Interrupt source */
#define MIPI_CSIS_INT_SRC 0x14
#define MIPI_CSIS_INT_SRC_EVEN_BEFORE BIT(31)
@@ -109,6 +113,10 @@
#define MIPI_CSIS_INT_SRC_ERR_UNKNOWN BIT(0)
#define MIPI_CSIS_INT_SRC_ERRORS 0xfffff

+/* CSIS Interrupt source 1 */
+#define MIPI_CSIS_INT_SRC_1 0x1c
+#define MIPI_CSIS_INT_SRC_1_LINE_END BIT(0)
+
/* D-PHY status control */
#define MIPI_CSIS_DPHY_STATUS 0x20
#define MIPI_CSIS_DPHY_STATUS_ULPS_DAT BIT(8)
@@ -221,6 +229,7 @@
#define MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE BIT(0)

#define MIPI_CSIS_FRAME_COUNTER_CH(n) (0x0100 + (n) * 4)
+#define MIPI_CSIS_LINE_INTERRUPT_RATIO(n) (0x0110 + (n) * 4)

/* Non-image packet data buffers */
#define MIPI_CSIS_PKTDATA_ODD 0x2000
@@ -281,6 +290,8 @@ static const struct mipi_csis_event mipi_csis_events[] = {
{ 0, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End"},
{ 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge"},
{ 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge"},
+ /* User Line interrupt */
+ { 2, MIPI_CSIS_INT_SRC_1_LINE_END, "Line End"}
};

#define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
@@ -333,11 +344,14 @@ struct mipi_csis_device {

spinlock_t slock; /* Protect events */
struct mipi_csis_event events[MIPI_CSIS_NUM_EVENTS];
+
struct dentry *debugfs_root;
struct {
bool enable;
u32 hs_settle;
u32 clk_settle;
+ u32 int_line;
+ u32 last_int_line;
} debug;
};

@@ -686,6 +700,15 @@ static void mipi_csis_set_params(struct mipi_csis_device *csis,
MIPI_CSIS_DPHY_BCTRL_L_B_DPHYCTRL(20000000));
mipi_csis_write(csis, MIPI_CSIS_DPHY_BCTRL_H, 0);

+ if (csis->debug.int_line > 0)
+ mipi_csis_write(csis, MIPI_CSIS_LINE_INTERRUPT_RATIO(0),
+ csis->debug.int_line - 1);
+
+ mipi_csis_write(csis, MIPI_CSIS_INT_MSK_1,
+ csis->debug.int_line ?
+ MIPI_CSIS_INT_MSK_1_LINE_END : 0);
+ csis->debug.last_int_line = csis->debug.int_line;
+
/* Update the shadow register. */
val = mipi_csis_read(csis, MIPI_CSIS_CMN_CTRL);
mipi_csis_write(csis, MIPI_CSIS_CMN_CTRL,
@@ -765,10 +788,12 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)
struct mipi_csis_device *csis = dev_id;
unsigned long flags;
unsigned int i;
- u32 status[2];
+ u32 int_lines;
+ u32 status[3];

status[0] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
status[1] = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
+ status[2] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC_1);

spin_lock_irqsave(&csis->slock, flags);

@@ -785,10 +810,25 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)
if (status[0] & MIPI_CSIS_INT_SRC_FRAME_START)
mipi_csis_queue_event_sof(csis);

+ int_lines = READ_ONCE(csis->debug.int_line);
+ if (int_lines != csis->debug.last_int_line) {
+ if (int_lines > 0)
+ mipi_csis_write(csis, MIPI_CSIS_LINE_INTERRUPT_RATIO(0),
+ max(int_lines, 1U) - 1);
+ else
+ mipi_csis_write(csis,
+ MIPI_CSIS_LINE_INTERRUPT_RATIO(0), 0);
+
+ csis->debug.last_int_line = int_lines;
+ mipi_csis_write(csis, MIPI_CSIS_INT_MSK_1,
+ int_lines ? MIPI_CSIS_INT_MSK_1_LINE_END : 0);
+ }
+
spin_unlock_irqrestore(&csis->slock, flags);

mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status[0]);
mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, status[1]);
+ mipi_csis_write(csis, MIPI_CSIS_INT_SRC_1, status[2]);

return IRQ_HANDLED;
}
@@ -928,6 +968,7 @@ static void mipi_csis_debugfs_init(struct mipi_csis_device *csis)
{
csis->debug.hs_settle = UINT_MAX;
csis->debug.clk_settle = UINT_MAX;
+ csis->debug.int_line = 0;

csis->debugfs_root = debugfs_create_dir(dev_name(csis->dev), NULL);

@@ -939,6 +980,8 @@ static void mipi_csis_debugfs_init(struct mipi_csis_device *csis)
&csis->debug.clk_settle);
debugfs_create_u32("ths_settle", 0600, csis->debugfs_root,
&csis->debug.hs_settle);
+ debugfs_create_u32("int_line_0", 0600, csis->debugfs_root,
+ &csis->debug.int_line);
}

static void mipi_csis_debugfs_exit(struct mipi_csis_device *csis)
--
2.43.0



Return-Path: <linux-kernel+bounces-675728-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0E16A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:15:24 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 5E5FD189060C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:14:50 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E8CD8288C24;
Fri, 6 Jun 2025 12:14:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tRwK5q6d"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 6F8DE28852F;
Fri, 6 Jun 2025 12:14:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212058; cv=none; b=dVQoRHAYXYrSWiZveu8faZjDHiQVoj9VlnaZtMEeDG54TPXono5iDGzAOkZoBFCS/9whwMgBCly5F3oV0xe3RWvPMHHnc5HzN4QkBx5SG3x95GtI0ULoLv5Hp01aqo89ESFT6NWt48Ux7eKHIqARPOnU6UEWR87TMAaRFHHgw+Q=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212058; c=relaxed/simple;
bh=OF+fLFPhM40cHFI5sXwjSZI1LzZUrHhaXoT6cLwZwLA=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=YUcJzKPM9I8XozbHr5MI9spa5t6czXU+gfvFowj3Ek9UyZldE/3JrzC+sMRUsNidMimHp70tskK4Ug86LSSKsqb1EMPcLopmBOD0iDvpYB6YkFALf3daX0cEfc/j688/QXFdh6XadvkoWckdD7RO9xXzKGTx6Hbcv9dEWHjzAVs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=tRwK5q6d; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from isaac-ThinkPad-T16-Gen-2.localdomain (cpc90716-aztw32-2-0-cust408.18-1.cable.virginm.net [86.26.101.153])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 64DE91340;
Fri, 6 Jun 2025 14:14:09 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749212050;
bh=OF+fLFPhM40cHFI5sXwjSZI1LzZUrHhaXoT6cLwZwLA=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=tRwK5q6di5lo9Q0wUHSzJk10vOzi/8AYXUpYzqzuT3zS8AbVkWbyTP/PMFkIb/zzY
jVSUHL6ieqmNocDlBiZLNfimXbij4nbn79OO88DjtGgo8lkaoXcPIml+Fst1aJlUdt
vaa6sPqOvSthnAxGpvOAN7oDLSkz0b85Nc8d9BLw=
From: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
To: laurent.pinchart@xxxxxxxxxxxxxxxx
Cc: kieran.bingham@xxxxxxxxxxxxxxxx,
rmfrfs@xxxxxxxxx,
martink@xxxxxxxxx,
kernel@xxxxxxx,
mchehab@xxxxxxxxxx,
shawnguo@xxxxxxxxxx,
s.hauer@xxxxxxxxxxxxxx,
kernel@xxxxxxxxxxxxxx,
festevam@xxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx,
imx@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Subject: [PATCH 1/2] media: platform: Refactor interrupt status registers
Date: Fri, 6 Jun 2025 13:14:02 +0100
Message-ID: <20250606121403.498153-2-isaac.scott@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
References: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The NXP i.MX 8 MP CSI-2 receiver features multiple interrupt and debug
status sources which span multiple registers. The driver currently
supports two interrupt source registers, and attributes the
mipi_csis_event event entries to those registers through a boolean debug
field that indicate if the event relates to the main interrupt status
(false) or debug interrupt status (true) register. To make it easier to
add new event fields, replace the debug bool with a 'status index'
integer than indicates the index of the corresponding status register.

Signed-off-by: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/nxp/imx-mipi-csis.c | 64 +++++++++++-----------
1 file changed, 31 insertions(+), 33 deletions(-)

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index d060eadebc7a..bbc549c22aff 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -249,7 +249,7 @@
#define MIPI_CSI2_DATA_TYPE_USER(x) (0x30 + (x))

struct mipi_csis_event {
- bool debug;
+ unsigned int status_index;
u32 mask;
const char * const name;
unsigned int counter;
@@ -257,30 +257,30 @@ struct mipi_csis_event {

static const struct mipi_csis_event mipi_csis_events[] = {
/* Errors */
- { false, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO Overflow Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong Configuration Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error" },
- { true, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type Not Supported" },
- { true, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type Ignored" },
- { true, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame Size Error" },
- { true, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame" },
- { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early Frame End" },
- { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early Frame Start" },
+ { 0, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT Error"},
+ { 0, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error"},
+ { 0, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error"},
+ { 0, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO Overflow Error"},
+ { 0, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong Configuration Error"},
+ { 0, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error"},
+ { 0, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error"},
+ { 0, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error"},
+ { 1, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type Not Supported"},
+ { 1, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type Ignored"},
+ { 1, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame Size Error"},
+ { 1, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame"},
+ { 1, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early Frame End"},
+ { 1, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early Frame Start"},
/* Non-image data receive events */
- { false, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even frame" },
- { false, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image data after even frame" },
- { false, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image data before odd frame" },
- { false, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image data after odd frame" },
+ { 0, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even frame"},
+ { 0, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image data after even frame"},
+ { 0, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image data before odd frame"},
+ { 0, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image data after odd frame"},
/* Frame start/end */
- { false, MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start" },
- { false, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End" },
- { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge" },
- { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge" },
+ { 0, MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start"},
+ { 0, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End"},
+ { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge"},
+ { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge"},
};

#define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
@@ -765,32 +765,30 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)
struct mipi_csis_device *csis = dev_id;
unsigned long flags;
unsigned int i;
- u32 status;
- u32 dbg_status;
+ u32 status[2];

- status = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
- dbg_status = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
+ status[0] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
+ status[1] = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);

spin_lock_irqsave(&csis->slock, flags);

/* Update the event/error counters */
- if ((status & MIPI_CSIS_INT_SRC_ERRORS) || csis->debug.enable) {
+ if ((status[0] & MIPI_CSIS_INT_SRC_ERRORS) || csis->debug.enable) {
for (i = 0; i < MIPI_CSIS_NUM_EVENTS; i++) {
struct mipi_csis_event *event = &csis->events[i];

- if ((!event->debug && (status & event->mask)) ||
- (event->debug && (dbg_status & event->mask)))
+ if (status[event->status_index] & event->mask)
event->counter++;
}
}

- if (status & MIPI_CSIS_INT_SRC_FRAME_START)
+ if (status[0] & MIPI_CSIS_INT_SRC_FRAME_START)
mipi_csis_queue_event_sof(csis);

spin_unlock_irqrestore(&csis->slock, flags);

- mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status);
- mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, dbg_status);
+ mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status[0]);
+ mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, status[1]);

return IRQ_HANDLED;
}
--
2.43.0



Return-Path: <linux-kernel+bounces-675730-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 858EB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:15:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id E6BD33B130D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:14:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FD6928853F;
Fri, 6 Jun 2025 12:14:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="S48dUPRQ";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="PNPEKMyg"
Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144])
(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 BD802253355;
Fri, 6 Jun 2025 12:14:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212070; cv=none; b=SpZO6L9OYWNrTABytH6rfkn7UuEcIbCPR3dtoPwUT/9sIDV0mDpyyHqurQi0g6O3uKRq2WwLjKx/vvCcwLb95z46+uMytca+17B4HJ7IO+JhqnWIgLrXS6sIHrcgp64RfOjuFsaUogBnW8zI1AOLRAUpwo1wwXtlHJkFMbdj4tg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212070; c=relaxed/simple;
bh=qdxOxEI9x96A9XjkglB81iLIIYJwSgZOX1DcgLYY7SU=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=qqdp2d8qEJ52g3If/u5hDoXXQHgE0cPItbZ0GK4kC7ZV86ZYt7j4N959u6Bv6MmSSLC/JZGIxGZJnu1ku69xDQlDx9xeIQI60NhBB7A2zwdxb2+hSQkpNHlpIMbWbA0wmIXRTDNw7zCXU7t7fRJNhPGFcjHYPTRAeEMGiJF9AVY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=S48dUPRQ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=PNPEKMyg; arc=none smtp.client-ip=103.168.172.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48])
by mailfout.phl.internal (Postfix) with ESMTP id DD0CA138033D;
Fri, 6 Jun 2025 08:14:27 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-08.internal (MEProxy); Fri, 06 Jun 2025 08:14:27 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749212067;
x=1749298467; bh=Z84X3cRTGcgyKLWc3Ch2d3gKywmMCUsq5T9sb22yUnc=; b=
S48dUPRQa90Gky8GVAVbsQXZ5wu/So3y6IlK39TSVWnGjogvwya7cwkUJw1c1m4i
+xJNXeRf0Q858bol16Ot1bskbwbiJysTZywFSTwTZEwB402PuSkPMqHX/WZ5UMHp
kn2m3MrUrZ96fJZpZpAXODb4p6ZCcdHO5z8EyEKRjlm9r4UyyVGhEKdDx5y24lef
LT32ieJBZAXxkjLtzreePOHvA1P6G3AbQG0hkSLnBWEvX9cuEwXkVxFWpuN32tu9
NwpE7NJWMB6rzZB0eNtoGEMJLCplrXMWuWoxXb8UciyPFX0+nlbm+jGEhTz9EAL5
jiFpCPPM8cQ28YJxtBreOA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749212067; x=
1749298467; bh=Z84X3cRTGcgyKLWc3Ch2d3gKywmMCUsq5T9sb22yUnc=; b=P
NPEKMyg3FRtMV8A4wkk34z5RvhEautqc8vzquGY3XO+73VZTGpAXcfPXHvZL3rLt
vHj3H3JjZTw3nfc3t1rEOsXBfewfMu3KkKc0RA2VGqmmVQwIoyLJ08Pa2cDUgyh8
zFGcS3T+3EpLYbYe35hFWSXUTuyX4XpCSQ23fOGoDMtfIvOC+PmNtcgfEVYVgLFF
ZPuharY6rsyuz0Q8GNyeIvgaGucamxAj2JsiK0DM308mLrIVOsI0MoDUIsf4AsyV
dE3tbZvdQKBwY4/SDHpB16WQPI8rz2S1dVrh3Yyr4c8v1Dpe+RHPewrgCI4hloLl
vpjm6FfW9qTDJRoacsq/w==
X-ME-Sender: <xms:o9tCaBEBwj0Q4fk7HDm81DC1uuko__A5H5JoFK7UBONMmJ71c3ae7g>
<xme:o9tCaGXWMZq4pfe2iO3PniPSsB5AsfAtiDC_qq2OgQazGNS9jKQyxNPgzzqiuBrPp
iYZ4w9DBsPgpoptQ3c>
X-ME-Received: <xmr:o9tCaDJfU6B-IK-D3yYFVyy8TWTl0shns41RvFCfVM3Z_OdVabQMnOeApmdwDBatTdpyAx105h7V-HzwUtDLNb5bwjfR9eTFag>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdejucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeelfefg
tddtleeljeeuuddvteefledtfeefjeduheeiffffudetgeejieegffduffenucffohhmrg
hinheptghsihdvrdhvtgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr
ihhlfhhrohhmpehnihhklhgrshdrshhouggvrhhluhhnugesrhgrghhnrghtvggthhdrsh
gvpdhnsggprhgtphhtthhopeelpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeht
ohhmihdrvhgrlhhkvghinhgvnhdorhgvnhgvshgrshesihguvggrshhonhgsohgrrhgurd
gtohhmpdhrtghpthhtohepmhgthhgvhhgrsgeskhgvrhhnvghlrdhorhhgpdhrtghpthht
ohepshgrkhgrrhhirdgrihhluhhssehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpth
htoheplhhinhhugidqmhgvughirgesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht
thhopehlihhnuhigqdhrvghnvghsrghsqdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorh
hgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdho
rhhgpdhrtghpthhtohepmhgthhgvhhgrsgdohhhurgifvghisehkvghrnhgvlhdrohhrgh
dprhgtphhtthhopehlrghurhgvnhhtrdhpihhntghhrghrthesihguvggrshhonhgsohgr
rhgurdgtohhmpdhrtghpthhtohepjhgrtghophhordhmohhnughisehiuggvrghsohhnsg
horghrugdrtghomh
X-ME-Proxy: <xmx:o9tCaHHgAY6QDNBtpiE_O6LFSt5zoeC3FS0d4USW4j-fy6Wr6-xExA>
<xmx:o9tCaHXa4UjxDh1sFNvGTE5UgWjQfRtfd-Xi4IZpxw1U-e_uVujb4g>
<xmx:o9tCaCO-MU3D2pgZE5joK7Aslm5TDdxkOvtiWe6ecYfDoT6B-i3qvg>
<xmx:o9tCaG344qOcGofRsXHEBgCUV8MNFCYemiogFMPXVTfqUmWKxPXWbA>
<xmx:o9tCaCbtjMunXHy-6cg0GIBaSqJCiLpOtp3NwNQis3X-TgBcZ9dBCGmd>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:14:27 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:14:26 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 10/15] media: rcar-csi2: Add .get_frame_desc op
Message-ID: <20250606121426.GG2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-10-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-10-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your work.

On 2025-05-30 16:50:39 +0300, Tomi Valkeinen wrote:
> Add v4l2_subdev_pad_ops.get_frame_desc() implementation.
>
> We also implement a fallback for the case where the upstream subdevice
> does not implement .get_frame_desc. It assumes a single stream with VC =
> 0 and DT based on the configured stream mbus format.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
> ---
> drivers/media/platform/renesas/rcar-csi2.c | 56 ++++++++++++++++++++++++++++++
> 1 file changed, 56 insertions(+)
>
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index 20bd44274bd2..65c7f3040696 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -1676,12 +1676,68 @@ static int rcsi2_set_pad_format(struct v4l2_subdev *sd,
> return 0;
> }
>
> +static int rcsi2_get_frame_desc_fallback(struct v4l2_subdev *sd,
> + unsigned int pad,
> + struct v4l2_mbus_frame_desc *fd)
> +{
> + const struct rcar_csi2_format *format;
> + struct v4l2_subdev_state *state;
> + struct v4l2_mbus_framefmt *fmt;
> + int ret = 0;
> +
> + state = v4l2_subdev_lock_and_get_active_state(sd);
> +
> + fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK, 0);
> + if (!fmt) {
> + ret = -EINVAL;
> + goto out;
> + }
> +
> + format = rcsi2_code_to_fmt(fmt->code);
> + if (!format) {
> + ret = -EINVAL;
> + goto out;
> + }
> +
> + fd->num_entries = 1;
> + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
> + fd->entry[0].stream = 0;
> + fd->entry[0].pixelcode = fmt->code;
> + fd->entry[0].bus.csi2.vc = 0;
> + fd->entry[0].bus.csi2.dt = format->datatype;
> +
> +out:
> + v4l2_subdev_unlock_state(state);
> +
> + return ret;
> +}
> +
> +static int rcsi2_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> + struct v4l2_mbus_frame_desc *fd)
> +{
> + struct rcar_csi2 *priv = sd_to_csi2(sd);
> + int ret;
> +
> + if (WARN_ON(!priv->info->use_isp))
> + return -ENOTTY;

This looks odd, why can't we support the frame descriptor and streams on
Gen3 that do not use the ISP Channel Selector?

> +
> + if (WARN_ON(pad != RCAR_CSI2_SOURCE_VC0))
> + return -EINVAL;
> +
> + ret = v4l2_subdev_get_frame_desc_passthrough(sd, pad, fd);
> + if (ret == -ENOIOCTLCMD)
> + ret = rcsi2_get_frame_desc_fallback(sd, pad, fd);
> + return ret;
> +}
> +
> static const struct v4l2_subdev_pad_ops rcar_csi2_pad_ops = {
> .enable_streams = rcsi2_enable_streams,
> .disable_streams = rcsi2_disable_streams,
>
> .set_fmt = rcsi2_set_pad_format,
> .get_fmt = v4l2_subdev_get_fmt,
> +
> + .get_frame_desc = rcsi2_get_frame_desc,
> };
>
> static const struct v4l2_subdev_ops rcar_csi2_subdev_ops = {
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675731-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B11F441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:15:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 57E223A2485
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:14:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 67CA7288C29;
Fri, 6 Jun 2025 12:14:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="HLB8+8Ij"
Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131])
(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 C2FAD288502;
Fri, 6 Jun 2025 12:14:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212093; cv=none; b=gOMKFLXhPSJH8HuxFfh9ATfHVrD3U4Ya9lDOkhmJqDr+w+fWfwlzMh/aRV5tVM67FWFr17RSnhgRXrfdvjlSFDrfNC5qsnsPM+NYsa4YxmWllsVPXGTG48yjJ/jnOhGQZ3OhMD79cjwNtnl83iaq/1QSiRkkWZ1zmZPQciS6qGw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212093; c=relaxed/simple;
bh=mtgxgmQj9UsAIjld1jEoGHklJSbnp3mdxv/uCwjRC2c=;
h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From:
In-Reply-To:Content-Type; b=k0yw8SyIHanTkNQwbjV5gtXLXmFwCx5SoODT6PCU/X6Z7HkOrZ94s8GEa83DR1xTAq94sQdrM8Pen33zbb+fzwjPbMBH5syGZ7cKZFiW/k14XCEqwdLt6krAxUoGwS3D9VKDbvKyTxaIaMkHDUBZuoOLHlhcNIAyoAu/U6uG0as=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=HLB8+8Ij; arc=none smtp.client-ip=205.220.180.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com
Received: from pps.filterd (m0279872.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565om4Z000698;
Fri, 6 Jun 2025 12:14:42 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=
cc:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=qcppdkim1; bh=
qwrKf8yqUySqbxxRz01I60sgUIGjMheqGVg9YsMRg6Q=; b=HLB8+8Ij6VqLJ3/2
EnArVlSGo0R2zlaXu4+OLckvxFxrboK896B7DpWmhoy7+7PInhaI32KIO0mP9bUj
SY9VylafqshnZ8dQ5uJOZhohSpOZitg4bVpqm2TMs5teOCWiHDWMs+Q/s5BBUT2s
+l2GUYxL9WuEjOcCR0lSyljPQAdIknB34ToSikp3XEpAJ5rMYaxEeWFKq9howdJ7
1iX20kF4OygeuPDBRG+/QyPxPtDnym3L0oSAk4NGlLrqrCDSWqWrcy2zQJtv6QV1
xrpzkzMrvw4NPdkCaZULvLGCbSCayWREeBbAk2ffWWk5XqHZmTO98Mt4PWN0ZRlI
nUqgkw==
Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8qcjsr-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 12:14:42 +0000 (GMT)
Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231])
by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 556CEfkM029835
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 6 Jun 2025 12:14:41 GMT
Received: from [10.50.32.91] (10.80.80.8) by nasanex01a.na.qualcomm.com
(10.52.223.231) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 6 Jun 2025
05:14:36 -0700
Message-ID: <b9b456bc-beb8-769d-5f9f-e13b8860e659@xxxxxxxxxxx>
Date: Fri, 6 Jun 2025 17:44:33 +0530
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Subject: Re: [PATCH] media: venus: Fix MSM8998 frequency table
Content-Language: en-US
To: Arnaud Vrac <rawoul@xxxxxxxxx>,
Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxxxxxxxx>
CC: Konrad Dybcio <konradybcio@xxxxxxxxxx>,
Dikshita Agarwal
<quic_dikshita@xxxxxxxxxxx>,
Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Stanimir Varbanov
<stanimir.k.varbanov@xxxxxxxxx>,
Marc Gonzalez <mgonzalez@xxxxxxxxxx>,
Pierre-Hugues Husson <phhusson@xxxxxxxxxx>,
Hans Verkuil
<hverkuil@xxxxxxxxx>,
Marijn Suijten <marijn.suijten@xxxxxxxxxxxxxx>,
<linux-media@xxxxxxxxxxxxxxx>, <linux-arm-msm@xxxxxxxxxxxxxxx>,
<linux-kernel@xxxxxxxxxxxxxxx>,
Konrad Dybcio
<konrad.dybcio@xxxxxxxxxxxxxxxx>
References: <20250531-topic-venus_98_tbl-v1-1-68e5523a39dc@xxxxxxxxxxxxxxxx>
<btmzhyullmggev43b3syp3anxlm6o5mpz2mthaskuyl7kfx5gw@w5gesyaaytkh>
<CAN5H-g7WLsowjW6CMee5T=W4Lmia9mLWGgX17-mOMjtBo2SwvQ@xxxxxxxxxxxxxx>
From: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>
In-Reply-To: <CAN5H-g7WLsowjW6CMee5T=W4Lmia9mLWGgX17-mOMjtBo2SwvQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To
nasanex01a.na.qualcomm.com (10.52.223.231)
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085
X-Proofpoint-GUID: YwnPuJr7CnCxkMgAFEX-q91f3zjxvMWp
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDExMSBTYWx0ZWRfXy1SqOKzBuQZ8
Mk2qGb2tJd5PPU+3Jmj9Rd61ebqIPDk3JIkGgg3IHJzeJnYA8u7YBfec0xa5518hAybE42BABrT
m0TYVHDEVjvu1mkZ6qRe3/GLWA3M5qbG1pbut52Hvl7UonzKMnUplOdv4gGaLRkj2HhOh0HfipR
Zgs/iN/RBWf2z6fDl2iCvNo+sSf6UoTipWfeUa79kBCa28Ojo789qJNfHQ5pQKceNEQCVnV7JM2
hsHQrJnz/iROJP0KvbdfGpvKFHh5f7HDuuc39/EEVW9ADhiKCJIwgq0eBxXOQjyzuxOxR6USeNq
XyUW6K+jT43GNPlVQ+325GV3KeyKy47i2fP2T60IsDJ5KQYx4geXTC289csL8TNXiMwA+TMSJJt
GSAWbNtuC//tz4zRdg5HLMDITBRi0FiK0i2Tftfex4w6yfLmZhoWHR+S+FjiAdn6Y1fVoQJr
X-Proofpoint-ORIG-GUID: YwnPuJr7CnCxkMgAFEX-q91f3zjxvMWp
X-Authority-Analysis: v=2.4 cv=PrmTbxM3 c=1 sm=1 tr=0 ts=6842dbb2 cx=c_pps
a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17
a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=qC_FGOx9AAAA:8
a=EUspDBNiAAAA:8 a=RZ-WPPcT-TtWywBDAlgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
a=fsdK_YakeE02zTmptMdW:22
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
phishscore=0 priorityscore=1501 mlxlogscore=994 mlxscore=0 lowpriorityscore=0
impostorscore=0 malwarescore=0 spamscore=0 clxscore=1011 adultscore=0
suspectscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060111
X-Spam-Status: No, score=-5.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
NICE_REPLY_A,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi,

On 6/6/2025 5:29 PM, Arnaud Vrac wrote:
> Le dim. 1 juin 2025 à 09:46, Dmitry Baryshkov
> <dmitry.baryshkov@xxxxxxxxxxxxxxxx> a écrit :
>>
>> On Sat, May 31, 2025 at 02:22:00PM +0200, Konrad Dybcio wrote:
>>> From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>>>
>>> Fill in the correct data for the production SKU.
>>>
>>> Fixes: 193b3dac29a4 ("media: venus: add msm8998 support")
>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>>> ---
>>> drivers/media/platform/qcom/venus/core.c | 10 +++++-----
>>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>
>> Verified against msm-4.4
>
> Hello,
>
> The current values are based on
> https://git.codelinaro.org/clo/la/kernel/msm-4.4/-/blob/caf_migration/kernel.lnx.4.4.r38-rel/arch/arm/boot/dts/qcom/msm8998-vidc.dtsi
> which we've been using in production for many years.

I see -v2 updates these to 533/444/.. MHz [1]. If the value changes based on
board variants, these need to be picked from board DT instead of driver then.

[1]
https://git.codelinaro.org/clo/la/kernel/msm-4.4/-/blob/caf_migration/kernel.lnx.4.4.r38-rel/arch/arm/boot/dts/qcom/msm8998-v2.dtsi#L1140

Regards,
Vikash


Return-Path: <linux-kernel+bounces-675732-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 65C3041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:17:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id EC6E63AA3C8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:17:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AE9D52882C2;
Fri, 6 Jun 2025 12:17:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="JoajqsKz"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F5C91A5B8A;
Fri, 6 Jun 2025 12:17:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212246; cv=none; b=jEOSLVHHDUokcIPxr/5oUrL6DQKOFt8Mq6jdhEWZhHI8dJ0B23VP2XNDR8tzF11SK8jzIGpD/O9I8XjrTev91PHgcoNx/RuCmknZyhSWvqw0L8H5LefZxkBWcvjN1+bvQemajswKWh27/UC3FAC99SfS/z96NRlkhRDd50aR3vY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212246; c=relaxed/simple;
bh=6PGymhfnENjOEJYOPptbq9PMQC1IUAFIloZolJHBnn8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=RajBzv5T1WRT2UJhy7bFKG5fWsZ4poJ54wtU3xvFHb9W2I0Mu7ychil+k/8JKpNssqwtKUjmq79VLFPW04QE6vt24xk9asJM59iUBq7kJcA0ZLSJ9XTILR+6ltxBKaeA8aSR6eBXcnIMpLQohcb1JdgaBnTDTB1f6I77CcEnKg8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JoajqsKz; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A509C4CEEB;
Fri, 6 Jun 2025 12:17:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749212245;
bh=6PGymhfnENjOEJYOPptbq9PMQC1IUAFIloZolJHBnn8=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=JoajqsKzP2dnm5UqGXu9+jJ1ELbbCSofvf0cAcYG89knubSKbvRWdk94wbP8TOwXp
La34a4OnhdCFwX+Mnny0AVaCjo7mx37gIBMYRMwA9gMoSJ1U5CHfTJ6j4qxTd1sP/C
3fnX5rdNm0XcA61uXbZAReUVMkvm4tyUlf2NeU6g=
Date: Fri, 6 Jun 2025 14:17:23 +0200
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Amit <lestoppe@xxxxxxxxx>
Cc: johan@xxxxxxxxxx, linux-usb@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [BUG] usb-serial-simple: device conflict with Owon VDS1022I
Message-ID: <2025060620-twister-starved-3fb8@gregkh>
References: <6430992c-d50b-4cfd-bcb9-d7d376c53444@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <6430992c-d50b-4cfd-bcb9-d7d376c53444@xxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 05:00:29PM +0530, Amit wrote:
> Hi,
>
>     PATCH 6.1 082/167 adds serial support for OWON HDS200 through the simple
> usb serial driver (). This causes issues with Owon VDS1022. The VID and PID
> is the same for both devices so the the Linux kernel loads the serial
> driver, preventing the associated software from working.

As vendors are not supposed to use the same device id for different
devices, that's against the USB.org rules, so that's on them, not us :)

>     My current work around for this is to blacklist usb_serial_simple. Given
> that this driver change was recent and still under testing, could we find a
> solution for this that doesn't involve such hacks at my end.
>
>     I  was able to root cause this issue only because the USB device and 
> software was working correctly before. A new user would just assume that the
> device is not Linux compatible.
>
>     I've filed a bugzilla report here :
> https://bugzilla.kernel.org/show_bug.cgi?id=220193
>
>     This is the software : https://github.com/florentbr/OWON-VDS1022

As that's just using libusb, it can disconnect the device from the
usb-serial driver if it needs to from the program itself. Why not
suggest this change to the authors of the software, OR just change it to
use the serial connection that the kernel now presents instead of
attempting to talk to it directly from userspace?

thanks,

greg k-h


Return-Path: <linux-kernel+bounces-675733-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 57C4041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:17:50 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C9CB81886D0F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:18:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 106A928750B;
Fri, 6 Jun 2025 12:17:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="X5uVwdOm"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 79CB41A5B8A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:17:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212263; cv=none; b=gXHBeVT5hQO4Z9G8Ah6nCbVxwzfyXpsUu3WIh7TIX+IZU0QO+21A6RF7fkVlxXK/YYANApaLDQmuEQs2GlI8jyJeJysIXILO5iZrYpmHlaxpMMw1uZRKC8j5zWyntzV7LvrPDJQ1NbjyhLuGE1VYQsHgQqmMaH26OZyQMg+KIQg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212263; c=relaxed/simple;
bh=LPN/4/CnX0MWDBxGhsYOpsuyNF5n+35YxZk989C7Bzk=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=SJGJoQun4FNXsyDReZZGz7tx+cD2ESv7SfaKAA9aJAuIrLvOdLXYk3srtYkIJg0n6+Uu4Sq6nqWex99GxSKkwi9hABZfOmGMjLph9sJfu3koJ8xpThs8xNUhp8rFYlzeYiSB6zbGyfhQ2726/1KV7haup43yrCBsaQyWOPlzmyc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=X5uVwdOm; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749212260;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=GHRkVyBKhV6pzfdHyJRH0hXQMYCdZ9SOamOgwI+aK4g=;
b=X5uVwdOmOY4ZM2rcbNhSDhqISdKjrDHnYdIcnJSpq4cGubJenPGBuQ3evK9SG+JajdlS18
Ig9bNAQIMCv0Ov06njJwoFEhQd5IzlxJbkaGCP9O0Fa/OojyBoLOf2qTWFEB3jVSXHw6PZ
QaNoLafABoGbXEjtGDq8Z9ssIbgbJ4k=
Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com
[209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-522-Kv9pyxnVOyWGnkfOwp3Z7g-1; Fri, 06 Jun 2025 08:17:39 -0400
X-MC-Unique: Kv9pyxnVOyWGnkfOwp3Z7g-1
X-Mimecast-MFC-AGG-ID: Kv9pyxnVOyWGnkfOwp3Z7g_1749212258
Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-450d244bfabso16827195e9.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:17:39 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749212258; x=1749817058;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=GHRkVyBKhV6pzfdHyJRH0hXQMYCdZ9SOamOgwI+aK4g=;
b=HZsSJBzQtTTIF6HdXZdZpYyVUXouLxU9UlwBic4vymC9msZlgA3GpVQYwxjorvGCy+
0HLzCaVn8mfUsYtzHHoEaRvFK9+uCixxz7aL9WLHH9f6o01hoCmhv5xu7dJ+g89OKLB7
QuFvxXfJsjvDOM3qZNtekySVy5admIw28b1oms660ahsHMzkuUFiqIvYoNbKAed95CYF
qWq5FgMcxH3IsHNKbYgB2Bhbdo40fq5idBerlGFM9kFC6HfkL9pLCc7aKX2PRzkRUovE
+cU5HlAxddRyBcBAam/qZKwDNw8HIELpuaBGaCwBoMu4R9HOf81Od++05et7Qf13ARz2
d8ww==
X-Forwarded-Encrypted: i=1; AJvYcCUW8zMipz2tWFlrqFD+hlYKpcwPK93sdldCz7HXCLnejc124JQW7XH/WC9cYp6kcuAMb7fbm0VSSZx53qw=@vger.kernel.org
X-Gm-Message-State: AOJu0YywcIGx/aVMVdYBNM4bLHSRDm1I3yvNfkWZMGrKuI/8w1gzgQ1h
Rs2Nv/FIIM/ah+WJrJASyWiGN+PhB2zPMsialXf6dQHypsk+bERArcEUFLRrh6Yf/ZkRrsi71iy
RmnHYjAbHg53ig+BWPRo56dpMOoIUtJiz1ZpjNwGdt0tCB1X/Cq6HdnoliXGgExo+RQ==
X-Gm-Gg: ASbGncvoEplJWTXRNQH/Ct1/Yg9cYXVeIaSz3Gae3poKTEaUxhj0DFJh9YJiAf/zmaA
VM45S4eqBKAGmwN07hiR+2eJGynlWVeDUEeZ8svkcsd0w4UXezAlhg9g9vdCINIgDX/JEXT9xwL
ZIfrZ1KzEfTCMkqxKIGmpViGwemU57gyAK0j4ZR0iTFfZNsl9V4rbsxU/s9dhkUfIUcXXnG5ZpW
hTuj1NRiOhYEtoUoFyxUdroik65FksaeMyhE0YbF9PqewrqxAyF5aLp7a7i27yq+2gpv6I1XhGn
r8kuooi9t61pRxb9xIBPfPMOtwyInkOfhrcRjcQ+mx/jVRDthj36ysmz6leN5USJbINoyAJsz9y
zzXYLlBE73oLnzfF3gLuHvOzzGudebr857aF5KuyqnQ==
X-Received: by 2002:a5d:5f4f:0:b0:3a4:f41d:696e with SMTP id ffacd0b85a97d-3a531cb3b6amr3031820f8f.27.1749212258004;
Fri, 06 Jun 2025 05:17:38 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IFSGCve0R6k3nlrbweRE2iTyTWKy8fzm0cAPddauZZvT2/n1HnveCaavlWJtejPnJ6AIZAKWA==
X-Received: by 2002:a5d:5f4f:0:b0:3a4:f41d:696e with SMTP id ffacd0b85a97d-3a531cb3b6amr3031799f8f.27.1749212257617;
Fri, 06 Jun 2025 05:17:37 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53229e009sm1789706f8f.16.2025.06.06.05.17.36
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 05:17:37 -0700 (PDT)
Message-ID: <bc7886fd-ea97-48d7-b475-0f2985743680@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:17:36 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>, Vlastimil Babka
<vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>,
John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>
References: <20250604140544.688711-1-david@xxxxxxxxxx>
<aEFC_12om2UHFGbu@tiehlicka>
<1a65d0e6-6088-4a15-9c19-537203fe655c@xxxxxxxxxx>
<aEKnSxHG8_BGj7zQ@tiehlicka>
<e680a8f3-7b45-4836-8da7-7e7a0d2fcd56@xxxxxxxxxx>
<aEK_R93gihEn-xW6@tiehlicka>
<50ff9149-2824-4e57-8d74-d8d0c063c87e@lucifer.local>
<e5fa4a36-2af8-48e9-811e-680881c06b86@xxxxxxxxxx>
<1a7513cf-4a0a-4e58-b20d-31c1370b760f@lucifer.local>
<fe31e754-159d-49fd-aac7-64af5e313884@xxxxxxxxxx>
<b00f0914-c06e-4d7c-b856-93a6610b0459@lucifer.local>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <b00f0914-c06e-4d7c-b856-93a6610b0459@lucifer.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 14:12, Lorenzo Stoakes wrote:
> On Fri, Jun 06, 2025 at 01:44:12PM +0200, David Hildenbrand wrote:
> [snip]
>> I assume with "this patch" you mean "a patch that gets rid of VM_BUG_ON
>> completely", because I want this patch here (that started the discussion) to
>> go in first.
>
> Yes, and sure.
>
> I can wait until this is merged upstream and take a look afterwards?

Or base it on mm-new for now.

I'm afraid there will be a lot of competing churn moving/reworking (or
god forbid, adding) VM_BUG*, and not all goes through Andrew's tree

... so maybe doing stuff per subsystem might make it easier, not sure
what will be best here.

>
>>
>> Fascinating how you are always looking for work :P
>
> I mean I have an insane amount of work to do this cycle anyway... but the Call
> of Churnthulu is loud to me ;)

:D

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675734-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1E0F341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:19:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id B75301893431
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:20:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AB402882A9;
Fri, 6 Jun 2025 12:19:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="V2oKwrla"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 589731CF96;
Fri, 6 Jun 2025 12:19:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212384; cv=none; b=WXVle73eL0y5pPvaAlr4v/IiZCNwgilW5SjBxio4EnycLgwszkZZ7rZn5GwLnhwo4H6M62I2Atu65V8b2YISo3D58duNdFhJEe6401rCiKTSGQYVnPTy3I8s71x+hF1Pu/CjacX3Q0HgM97hh/+bZyF2Hm+qE1S1yOV4BjSSUvA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212384; c=relaxed/simple;
bh=xhiO+qFHPGHPlvqdzuWbCCP7owt+/xut051OtliEkYc=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=GeMRdaPCUw8IrPnT4r6wx7cseJGUAXzVLxFL1kkEB1GNfmV8Bi3upB/OhWqf1Uk79/soRdKAjRsbtodzTis5tSIO5O99DD4kKfdw8M5nKKBz2OfMNQgrm4pjBwqXkf9otsm4i8aSQvhmvqXTB+xO2G3ahpadKA7wf8RhyQ4TJJY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=V2oKwrla; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68075C4CEEB;
Fri, 6 Jun 2025 12:19:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749212383;
bh=xhiO+qFHPGHPlvqdzuWbCCP7owt+/xut051OtliEkYc=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=V2oKwrlaj5H/gMcS+fdhpXSpYFENGRjaoDmTAw5H1rXJMlXA03H+KwosPWypZdRhx
PBd60TsZwDky02JxEl1NtgSwbdB+p/a6cX+UtnoasqqL2Y/+X8rD57nmvZOHg0uRAB
Kdyvo1htsagLeAUGbGGvnUCXflVxwpO5h41iCQtk=
Date: Fri, 6 Jun 2025 14:19:41 +0200
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, arnd@xxxxxxxx,
robh@xxxxxxxxxx, krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx
Subject: Re: [PATCH v3 2/3] misc: add driver for ST M24LR series RFID/NFC
EEPROM chips
Message-ID: <2025060625-deviate-crummy-2633@gregkh>
References: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
<20250606120631.3140054-3-abd.masalkhi@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606120631.3140054-3-abd.masalkhi@xxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 12:06:30PM +0000, Abd-Alrhman Masalkhi wrote:
> adds support for STMicroelectronics M24LRxx devices, which expose
> two separate I2C addresses: one for system control and one for EEPROM
> access. The driver implements both a sysfs-based interface for control
> registers (e.g. UID, password authentication) and an nvmem provider
> for EEPROM access.
>
> Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
> ---
> Changes in v3:
> - Fully support the M24LR chips, including EEPROM access, no need for
> the standard at24 driver to handle EEPROM separately.

Why isn't this under drivers/misc/eeprom/ instead?

thanks,

greg k-h


Return-Path: <linux-kernel+bounces-675735-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1203641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:20:26 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 41C071669FF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:20:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C2F9288508;
Fri, 6 Jun 2025 12:20:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="Epb6M8li";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="LinPWa1e"
Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144])
(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 B18CD2868BD;
Fri, 6 Jun 2025 12:20:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212416; cv=none; b=Gf8iKr7lxHW6FmFnHY++c3rd4LIUDXZUiHqT3xdD0D8mJXq4oeaa8vKrmJoAd5DetGqObtUYnAmkwUM+5ScEkaFqXKqxXavfal3NVgdWjCzQuV4PXD0MIMuB6RuxRQz7DDL2/lww6HEeGD8uadbGfnbRlMgxoIPw9qjqLErAN34=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212416; c=relaxed/simple;
bh=NprR1ehoDfTDot6OFdq1lOyMlHXFb+t2rc/rBu2GTRc=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=nyyVlOh3cZ2YpZsRK6ZbyRFErt2GRrARnwhfC+YrOWD3FlCVRddyXCOZgiRUMB/S8P2723U49wYm5et0jd6/V9z35b08sxrhZyxOZHLCl0OW9Xm7gTAuBCm+SHtpB7LwgPBCnx4NdjiadG3QwLBvmCm8V9p+Lq0I9VGb1kS9X34=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=Epb6M8li; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=LinPWa1e; arc=none smtp.client-ip=103.168.172.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52])
by mailfout.phl.internal (Postfix) with ESMTP id BE7061380388;
Fri, 6 Jun 2025 08:20:13 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
by phl-compute-12.internal (MEProxy); Fri, 06 Jun 2025 08:20:13 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749212413;
x=1749298813; bh=F5eKTBewbMvoySvWxVy/ldrx72GRUC0xaamMpK6cgZM=; b=
Epb6M8lidkBw4TYXg+ox28A0BAv5NMAGmTl2NSSdJI5Zy/6fSvpYFzIeFiOVuNfU
A4+kyvKj46s/5ntJ9FD/mPEjgC8g699m9YQBHls5Qm68jMWC6/Re07cpeYzogfu2
Hjgt3Y1KHODlEJ6g0NbIBB+EUioz14ZCDI22sE9zqw7j8IHBSSv8bnxPsFTVs6uT
/gBuBTwe1C4TAfJpDtHWt6iGgIai1eG8IMLovIKnnOWW0msAOZ8D2p0p4Ynj4/YQ
yQ1wmfhIDt2qbV2lQsiFMHviYCBCmOMflTP+Voh50nkrwQh1yamwf5PKjulayW1Z
VPaAT92lY/zF21CQq+QU3w==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749212413; x=
1749298813; bh=F5eKTBewbMvoySvWxVy/ldrx72GRUC0xaamMpK6cgZM=; b=L
inPWa1eYPdNbPoQ46r6hYmsN/Fc+6cTO8GfCUab68A3NYdPi/Uu6Q9fbrMiLgWuw
4mIrNJU5BBv8Ot8yXBXlIKwXczHI+mgqgS1+XLUqW/11/2+a/Jeai3686ThrAGkN
l5bO6BhQUrrT4pUNxx9yn/jSIa33/ijfLHCOv6p7F5Or90OolQMUdfESYyRDh0Ho
Dbk3rThv9hQdJa0Ym+nglZHk7oeUgOz1RdfXRmnPjA5rCGRf2ylrezn0Ch69XH0w
9r90X9jXsTvRb3VCM3IIsvGqw5VFyUxntlFsmGOhvaN6nr2+hspll9XQPKB52IUl
RvLJN9IQiOwnydVO/xbJw==
X-ME-Sender: <xms:_dxCaKXpJtNpVwaa9UEKcwrv3hwp1vPJLZ0YdRKyY1PSNjeUEnWy-Q>
<xme:_dxCaGnVjZ_nOU64m848wWfCQ2V7rRoBgzQqkZ3Fhc5LETj_tjqwMpfJIOKMTc2JL
o2ARbKikXVMHAFlMOo>
X-ME-Received: <xmr:_dxCaOaLTB_ZyxHMtg9_yoiP-GtnA1e55Tgm1av8QxCtnN0ceiFimcWtXzPGXiIpXZTjuEezk1RxDqe_9oduMbYEx66UEevWBA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdekucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeelfefg
tddtleeljeeuuddvteefledtfeefjeduheeiffffudetgeejieegffduffenucffohhmrg
hinheptghsihdvrdhvtgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr
ihhlfhhrohhmpehnihhklhgrshdrshhouggvrhhluhhnugesrhgrghhnrghtvggthhdrsh
gvpdhnsggprhgtphhtthhopeelpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeht
ohhmihdrvhgrlhhkvghinhgvnhdorhgvnhgvshgrshesihguvggrshhonhgsohgrrhgurd
gtohhmpdhrtghpthhtohepmhgthhgvhhgrsgeskhgvrhhnvghlrdhorhhgpdhrtghpthht
ohepshgrkhgrrhhirdgrihhluhhssehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpth
htoheplhhinhhugidqmhgvughirgesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht
thhopehlihhnuhigqdhrvghnvghsrghsqdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorh
hgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdho
rhhgpdhrtghpthhtohepmhgthhgvhhgrsgdohhhurgifvghisehkvghrnhgvlhdrohhrgh
dprhgtphhtthhopehlrghurhgvnhhtrdhpihhntghhrghrthesihguvggrshhonhgsohgr
rhgurdgtohhmpdhrtghpthhtohepjhgrtghophhordhmohhnughisehiuggvrghsohhnsg
horghrugdrtghomh
X-ME-Proxy: <xmx:_dxCaBWhM8rsJjvx3-70ez0ilJ4xJNl3yrsiGfieUHJDQPcabPrjIw>
<xmx:_dxCaEk4VGwgK_qgqObZYD4-p_oOesSUfY4MiD8Ue-zxEQ3kxc4WGg>
<xmx:_dxCaGcpoHw49EvVkFk40OEg51JKSevfkXZLLIha_HOG30y-9fw0KA>
<xmx:_dxCaGG89eTEPOQ3KjbWLyzjBtzwByRy4lZdyLK2AtMR89NVVRvWdg>
<xmx:_dxCaI_LXh4v8xuHxDH79cIn3CdDxZBAHb2AuvBNnCDnsUo-cKPd5yg3>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:20:12 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:20:11 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 11/15] media: rcar-isp: Call get_frame_desc to find
out VC & DT
Message-ID: <20250606122011.GH2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-11-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-11-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your work.

On 2025-05-30 16:50:40 +0300, Tomi Valkeinen wrote:
> Call get_frame_desc to find out VC & DT, instead of hardcoding the VC
> routing and deducing the DT based on the mbus format.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
> ---
> drivers/media/platform/renesas/rcar-isp/csisp.c | 108 +++++++++++++++++-------
> 1 file changed, 77 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-isp/csisp.c b/drivers/media/platform/renesas/rcar-isp/csisp.c
> index a04cbf96b809..887d8eb21a3a 100644
> --- a/drivers/media/platform/renesas/rcar-isp/csisp.c
> +++ b/drivers/media/platform/renesas/rcar-isp/csisp.c
> @@ -225,24 +225,86 @@ static void risp_power_off(struct rcar_isp *isp)
> pm_runtime_put(isp->dev);
> }
>
> -static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state)
> +static int risp_configure_routing(struct rcar_isp *isp,
> + struct v4l2_subdev_state *state)
> {
> - const struct v4l2_mbus_framefmt *fmt;
> - const struct rcar_isp_format *format;
> - unsigned int vc;
> - u32 sel_csi = 0;
> + struct v4l2_mbus_frame_desc source_fd;
> + struct v4l2_subdev_route *route;
> int ret;
>
> - fmt = v4l2_subdev_state_get_format(state, RCAR_ISP_SINK, 0);
> - if (!fmt)
> - return -EINVAL;
> + ret = v4l2_subdev_call(isp->remote, pad, get_frame_desc,
> + isp->remote_pad, &source_fd);
> + if (ret)
> + return ret;
>
> - format = risp_code_to_fmt(fmt->code);
> - if (!format) {
> - dev_err(isp->dev, "Unsupported bus format\n");
> - return -EINVAL;
> + /* Clear the channel registers */
> + for (unsigned int ch = 0; ch < 12; ++ch) {
> + risp_write_cs(isp, ISPCS_FILTER_ID_CH_REG(ch), 0);
> + risp_write_cs(isp, ISPCS_DT_CODE03_CH_REG(ch), 0);
> }
>
> + /* Clear the proc mode registers */
> + for (unsigned int dt = 0; dt < 64; ++dt)
> + risp_write_cs(isp, ISPPROCMODE_DT_REG(dt), 0);

I agree with Laurent's comments, do we really need to clear these
registers?

> +
> + for_each_active_route(&state->routing, route) {
> + struct v4l2_mbus_frame_desc_entry *source_entry = NULL;
> + const struct rcar_isp_format *format;
> + const struct v4l2_mbus_framefmt *fmt;
> + unsigned int i;
> + u8 vc, dt, ch;
> + u32 v;
> +
> + for (i = 0; i < source_fd.num_entries; i++) {
> + if (source_fd.entry[i].stream == route->sink_stream) {
> + source_entry = &source_fd.entry[i];
> + break;
> + }
> + }
> +
> + if (!source_entry) {
> + dev_err(isp->dev,
> + "Failed to find stream from source frame desc\n");
> + return -EPIPE;
> + }
> +
> + vc = source_entry->bus.csi2.vc;
> + dt = source_entry->bus.csi2.dt;
> + /* Channels 4 - 11 go to VIN */
> + ch = route->source_pad - 1 + 4;
> +
> + fmt = v4l2_subdev_state_get_format(state, route->sink_pad,
> + route->sink_stream);
> + if (!fmt)
> + return -EINVAL;
> +
> + format = risp_code_to_fmt(fmt->code);
> + if (!format) {
> + dev_err(isp->dev, "Unsupported bus format\n");
> + return -EINVAL;
> + }
> +
> + /* VC Filtering */
> + risp_write_cs(isp, ISPCS_FILTER_ID_CH_REG(ch), BIT(vc));
> +
> + /* DT Filtering */
> + risp_write_cs(isp, ISPCS_DT_CODE03_CH_REG(ch),
> + ISPCS_DT_CODE03_EN0 | ISPCS_DT_CODE03_DT0(dt));
> +
> + /* Proc mode */
> + v = risp_read_cs(isp, ISPPROCMODE_DT_REG(dt));
> + v |= ISPPROCMODE_DT_PROC_MODE_VCn(vc, format->procmode);
> + risp_write_cs(isp, ISPPROCMODE_DT_REG(dt), v);

Also as Laurent suggested I thin it would be nicer to build these
registers up in a local variable and do the writes once outside the
loop. That way the clearing of the register will take care of itself ;-)

> + }
> +
> + return 0;
> +}
> +
> +static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state)
> +{
> + u32 sel_csi = 0;
> + int ret;
> +
> ret = risp_power_on(isp);
> if (ret) {
> dev_err(isp->dev, "Failed to power on ISP\n");
> @@ -256,25 +318,9 @@ static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state)
> risp_write_cs(isp, ISPINPUTSEL0_REG,
> risp_read_cs(isp, ISPINPUTSEL0_REG) | sel_csi);
>
> - /* Configure Channel Selector. */
> - for (vc = 0; vc < 4; vc++) {
> - u8 ch = vc + 4;
> - u8 dt = format->datatype;
> -
> - risp_write_cs(isp, ISPCS_FILTER_ID_CH_REG(ch), BIT(vc));
> - risp_write_cs(isp, ISPCS_DT_CODE03_CH_REG(ch),
> - ISPCS_DT_CODE03_EN3 | ISPCS_DT_CODE03_DT3(dt) |
> - ISPCS_DT_CODE03_EN2 | ISPCS_DT_CODE03_DT2(dt) |
> - ISPCS_DT_CODE03_EN1 | ISPCS_DT_CODE03_DT1(dt) |
> - ISPCS_DT_CODE03_EN0 | ISPCS_DT_CODE03_DT0(dt));
> - }
> -
> - /* Setup processing method. */
> - risp_write_cs(isp, ISPPROCMODE_DT_REG(format->datatype),
> - ISPPROCMODE_DT_PROC_MODE_VCn(3, format->procmode) |
> - ISPPROCMODE_DT_PROC_MODE_VCn(2, format->procmode) |
> - ISPPROCMODE_DT_PROC_MODE_VCn(1, format->procmode) |
> - ISPPROCMODE_DT_PROC_MODE_VCn(0, format->procmode));
> + ret = risp_configure_routing(isp, state);
> + if (ret)
> + return ret;
>
> /* Start ISP. */
> risp_write_cs(isp, ISPSTART_REG, ISPSTART_START);
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675736-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C975141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:22:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0EBD1166758
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:22:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BC8512882C2;
Fri, 6 Jun 2025 12:22:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VItbd/rW"
Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED375286D72
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:21:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212521; cv=none; b=ja2MNtLY3CnFFoOB1ekSKg8gxCvXqghhskeERGal1ppBLESqxmKLu72lEjJlSHPJI0r1Wa7+Esr8iAWzBSo9Cq3efTrF3UdpFJH1B5nZwi0B61lMsBVJ1c/14CHm3VPSkgM2Musoo5xJGfLsrEJ8tYsIPHPqYfS5wlJB3vZms6A=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212521; c=relaxed/simple;
bh=nZRE9jMK6GJm014fdSyKTgnZ//JZUiXylfSpJYVDtNk=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=Xp26iMjkRW9ZxExGOvi6vy30Hsvh7KXMpzi+UcqLXk6ciGWJW8hSg5w4sBgxQJUICV15iyt5oruS2qFruP0SkupxtL8nWdeB51gIpAC1iSLkAcJAKnzldPJeVtEVJMI9jOnFhsao+m/dAcSPmbU+SzcT6AJRhCA1izh/Lcod+WM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VItbd/rW; arc=none smtp.client-ip=209.85.208.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-604bff84741so4051124a12.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:21:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749212518; x=1749817318; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=kUcUCGpt2P3y/QMzABkuyFHR7tmd84+UCxMipLCW7j0=;
b=VItbd/rWgaKnkmx223P8oCibjoVCn5jHC84myLG3yQ+Km/njzh6OblUOlnQUSK6PIt
OkTP7Br4scoG9SZzq9+wTq1Qi/rAvqlsUio+6S07GWAwTXT0sH8LszCDTdOsMb9rDnZ4
9icxqjCWs/ZY9gCvy6uifsBrEPjWqtO/Q2dh7OwUUtMQvkp6ACvYUCfMps2Ptxvuo/Lo
4+En69Tjy4r/t7inz1aTTPaFTqqOWkMRdsDYX4ar/MetxMz82GfW2IH8SsD8RI3PtzOS
qZXduWFAfyxaQURI5u1m19oc64MG9daEw/S72PPhNPKd16WNt0DnjILzoh9THOXm8Cdj
SB3w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749212518; x=1749817318;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=kUcUCGpt2P3y/QMzABkuyFHR7tmd84+UCxMipLCW7j0=;
b=Evxqtc+Rw+LvW1U3hv7Zi488hlcTqkpGhVhAH15XTyHccIbx0qMHkL1nGH4yombaGY
5ortASy3F5da4EX3Wpb1rRpCJ1dysuf4sy3WaFJFd91UMGGSb/dQInXXh+70YpaNErrl
SFVRQqoy225sOnRCPMKF6WaBsen04i3jWAIB3CM+tcQaZ0ExVL0gKwzBLmhWZTQnp04V
RaCcdNWstyx9YJ0nTGW3Bo4Xzn1VOqJhtXjno0T5TCLx00dA2eqKnez8FKN0KMTa4Oge
deaOz8ZxhpH0EDCY84KNRLMTwWOO3EwVI1U6HbcayzbyjfY/fkvwkja6aHccbGq3gR9J
N2Hw==
X-Forwarded-Encrypted: i=1; AJvYcCWXlKk1HB7+3ZzBa0Jy5zfY4G8/bwCOnfcQCTxqtwlVZnSXLT9Y8dMGcr2SFG6q/3i0sK2xm2e3i17aIF8=@vger.kernel.org
X-Gm-Message-State: AOJu0YzVOEgK0p54a9+a+aYu9ZLxQekyQXJgc5yTwOrZva/fy60zsrp+
3LDvZP8RmM4VtGzr+axev5BCsawL0SoGyC9XkbcAEtvoelvzuX7mEnRz/7uo
X-Gm-Gg: ASbGncuzwYRbLHCWUolEKjylLRFTjOsIHHmkuAznH1EIC4qtJPqeX74BK1OyzRFXmUx
gYhyea7+GtTZ6m2nOCbyz9sbGI3rVi9q8Seo7+ZqtDU4/tphjXIUumfEHpytYSA4Xb4b+orDadt
qzJjwhL2HLc84anxjj/v9oewF50Xj4PGOTA8jEvXPPxy2ICjei3Vm4UXLuF49IecGFtLWgi0DHh
YF55Cp9JO0dVs/J5U75laWdbasN+nJKYaAHLczndj9XlJVeI8K2dRk0JmGSz8clxDUZWEZh3mve
lD+IG/q2IxEFB5Gm0VjniWE/UOKrbFxPdbpDYCI1l4YIAuddQg4xJyuMmojASrH76yrGjyOFgkA
fIWFeSo3Qoei0ZOSwQajC8DkIiMx0z7Hxq64=
X-Google-Smtp-Source: AGHT+IHQW6szGhy2I7Njh3emGhJdpYN5VryDQbhoUUYzhfd2Hd+ynaIMW6bluAR6kjU64A5DtZfPQA==
X-Received: by 2002:a05:6402:40c5:b0:602:15f:5883 with SMTP id 4fb4d7f45d1cf-607735130d3mr2442075a12.9.1749212517884;
Fri, 06 Jun 2025 05:21:57 -0700 (PDT)
Received: from [10.203.235.164] (mob-194-230-148-44.cgn.sunrise.net. [194.230.148.44])
by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6077837eb84sm946175a12.33.2025.06.06.05.21.56
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 05:21:57 -0700 (PDT)
Message-ID: <24ec4adc-7c80-49e9-93ee-19908a97ab84@xxxxxxxxx>
Date: Fri, 6 Jun 2025 14:21:54 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v2 1/2] genirq: Retain depth for managed IRQs across CPU
hotplug
To: Brian Norris <briannorris@xxxxxxxxxxxx>,
Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Tsai Sung-Fu <danielsftsai@xxxxxxxxxx>,
Douglas Anderson <dianders@xxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
Johan Hovold <johan@xxxxxxxxxx>
References: <20250514201353.3481400-1-briannorris@xxxxxxxxxxxx>
<20250514201353.3481400-2-briannorris@xxxxxxxxxxxx>
Content-Language: en-US
From: Aleksandrs Vinarskis <alex.vinarskis@xxxxxxxxx>
In-Reply-To: <20250514201353.3481400-2-briannorris@xxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 5/14/25 22:13, Brian Norris wrote:
> Affinity-managed IRQs may be shut down and restarted during CPU
> hotunplug/plug, and the IRQ may be left in an unexpected state.
> Specifically:
>
> 1. IRQ affines to CPU N
> 2. disable_irq() -> depth is 1
> 3. CPU N goes offline
> 4. irq_shutdown() -> depth is set to 1 (again)
> 5. CPU N goes online
> 6. irq_startup() -> depth is set to 0 (BUG! client expected IRQ is
> still disabled)
> 7. enable_irq() -> depth underflow / unbalanced enable_irq() WARN
>
> It seems depth only needs preserved for managed IRQs + CPU hotplug, so
> per Thomas's recommendation, we make that explicit.
>
> I add kunit tests that cover some of this in a following patch.
>
> Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
> Co-developed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>


Hi All,

It appears that this commit introduces a critical bug observed on at
least some Qualcomm Snapdragon X1E/X1P laptops, rendering the suspend
function unusable.

With this change in place, after successful suspend the device either:
1. Cannot wake up at all. Screen stays black, even though PM has existed
suspend (observed by external LEDs controlled by PM)

2. Wakes up eventually after minutes (instead of seconds) with SSD
related errors in dmesg. System still exhibits errors eg. UI icons are
not properly loaded, WiFi does not (always) connect.

Example of SSD errors:
```

[   45.997238] PM: suspend exit
[   76.276320] nvme nvme0: I/O tag 320 (5140) QID 3 timeout, completion
polled
[  104.945562] nvme nvme0: I/O tag 38 (9026) QID 2 timeout, completion
polled
[  104.946170] nvme nvme0: I/O tag 147 (8093) QID 4 timeout, completion
polled
[  106.354320] nvme nvme0: I/O tag 321 (3141) QID 3 timeout, completion
polled
[  136.689693] nvme nvme0: I/O tag 322 (3142) QID 3 timeout, completion
polled
[  141.428102] wlP4p1s0: authenticate with 50:64:2b:5f:e3:ba (local
address=8c:3b:4a:a6:fa:f3)
[  141.428123] wlP4p1s0: send auth to 50:64:2b:5f:e3:ba (try 1/3)
[  141.433397] wlP4p1s0: authenticated
[  141.434303] wlP4p1s0: associate with 50:64:2b:5f:e3:ba (try 1/3)
[  141.438224] wlP4p1s0: RX AssocResp from 50:64:2b:5f:e3:ba
(capab=0x1011 status=0 aid=2)
[  141.451828] wlP4p1s0: associated
[  149.984776] ath11k_pci 0004:01:00.0: msdu_done bit in attention is
not set
[  160.635229] ath11k_pci 0004:01:00.0: msdu_done bit in attention is
not set
[  165.873389] nvme nvme0: I/O tag 12 (500c) QID 7 timeout, completion
polled
[  165.873478] nvme nvme0: I/O tag 526 (120e) QID 8 timeout, completion
polled
[  166.026369] nvme nvme0: I/O tag 776 (a308) QID 5 timeout, completion
polled
[  166.026406] nvme nvme0: I/O tag 704 (22c0) QID 6 timeout, completion
polled
[  166.769312] nvme nvme0: I/O tag 128 (d080) QID 4 timeout, completion
polled
[  166.858582] systemd-journald[452]: Time jumped backwards, rotating.
[  196.072359] nvme nvme0: I/O tag 45 (a02d) QID 2 timeout, completion
polled
[  196.072429] nvme nvme0: I/O tag 778 (630a) QID 5 timeout, completion
polled
[  196.072440] nvme nvme0: I/O tag 705 (82c1) QID 6 timeout, completion
polled
[  196.904376] nvme nvme0: I/O tag 346 (215a) QID 3 timeout, completion
polled
[  212.970816] nvme nvme0: I/O tag 129 (e081) QID 4 timeout, completion
polled

```


This series was merged to linux-next on 20250516 introducing this bug.

Reverting commit 788019eb559fd0b3 ("genirq: Retain disable depth for
managed interrupts across CPU hotplug") on either `next-20250516` or
anything newer eg. `next-20250605` fixes the issue.

Tested on Dell XPS 9345 (Snaprdagon X1E-80-100), Asus Zenbook A14
(Snapdragon X1-26-100).


Is it possible to have this addressed/patched up/reverted before
6.16-rc1 goes live and introduces the regression?
It also appears this series was selected for backporting to 6.6, 6.12,
6.14, 6.15:  perhaps this should be postponed/aborted until better
solution is found?


Thanks in advance,

Alex

> ---
> Thomas provided a better suggestion than my v1, without fully-formed
> patch metadata. I've incorporated that as "Co-developed-by". Feel free to
> suggest something different.
>
> Changes in v2:
> * Adapt Thomas Gleixner's alternative solution, to focus only on CPU
> hotplug cases
>
> kernel/irq/chip.c | 22 +++++++++++++++++++++-
> kernel/irq/cpuhotplug.c | 2 +-
> kernel/irq/internals.h | 1 +
> 3 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index 36cf1b09cc84..ab2bf0de3422 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -223,6 +223,19 @@ __irq_startup_managed(struct irq_desc *desc, const struct cpumask *aff,
> return IRQ_STARTUP_ABORT;
> return IRQ_STARTUP_MANAGED;
> }
> +
> +void irq_startup_managed(struct irq_desc *desc)
> +{
> + /*
> + * Only start it up when the disable depth is 1, so that a disable,
> + * hotunplug, hotplug sequence does not end up enabling it during
> + * hotplug unconditionally.
> + */
> + desc->depth--;
> + if (!desc->depth)
> + irq_startup(desc, IRQ_RESEND, IRQ_START_COND);
> +}
> +
> #else
> static __always_inline int
> __irq_startup_managed(struct irq_desc *desc, const struct cpumask *aff,
> @@ -290,6 +303,7 @@ int irq_startup(struct irq_desc *desc, bool resend, bool force)
> ret = __irq_startup(desc);
> break;
> case IRQ_STARTUP_ABORT:
> + desc->depth = 1;
> irqd_set_managed_shutdown(d);
> return 0;
> }
> @@ -322,7 +336,13 @@ void irq_shutdown(struct irq_desc *desc)
> {
> if (irqd_is_started(&desc->irq_data)) {
> clear_irq_resend(desc);
> - desc->depth = 1;
> + /*
> + * Increment disable depth, so that a managed shutdown on
> + * CPU hotunplug preserves the actual disabled state when the
> + * CPU comes back online. See irq_startup_managed().
> + */
> + desc->depth++;
> +
> if (desc->irq_data.chip->irq_shutdown) {
> desc->irq_data.chip->irq_shutdown(&desc->irq_data);
> irq_state_set_disabled(desc);
> diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
> index 15a7654eff68..3ed5b1592735 100644
> --- a/kernel/irq/cpuhotplug.c
> +++ b/kernel/irq/cpuhotplug.c
> @@ -219,7 +219,7 @@ static void irq_restore_affinity_of_irq(struct irq_desc *desc, unsigned int cpu)
> return;
>
> if (irqd_is_managed_and_shutdown(data))
> - irq_startup(desc, IRQ_RESEND, IRQ_START_COND);
> + irq_startup_managed(desc);
>
> /*
> * If the interrupt can only be directed to a single target
> diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
> index b0290849c395..7111747ecb86 100644
> --- a/kernel/irq/internals.h
> +++ b/kernel/irq/internals.h
> @@ -87,6 +87,7 @@ extern void __enable_irq(struct irq_desc *desc);
> extern int irq_activate(struct irq_desc *desc);
> extern int irq_activate_and_startup(struct irq_desc *desc, bool resend);
> extern int irq_startup(struct irq_desc *desc, bool resend, bool force);
> +extern void irq_startup_managed(struct irq_desc *desc);
>
> extern void irq_shutdown(struct irq_desc *desc);
> extern void irq_shutdown_and_deactivate(struct irq_desc *desc);


Return-Path: <linux-kernel+bounces-675737-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5FA2A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:22:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0510D3AFD66
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:22:01 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 02E7D288C1F;
Fri, 6 Jun 2025 12:22:07 +0000 (UTC)
Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4D6E28851F;
Fri, 6 Jun 2025 12:22:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212526; cv=none; b=NMKWqAMB5FyJvIJh83jjPmckXhpuPu8O1ew7QOg/CN/q5ldL1WvgMhndfk03ZSZEXTEwUdTMNDGhOVIOvyViLkCBUUiF4EULPW5qbuTFBE31WJCUiJC2+C9XaxAtOQt/Y8eye0KQN5zWB5JSoKZlyinDME5e8AhXPS2+xVbcZ8I=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212526; c=relaxed/simple;
bh=0U4sLN2bU3FPPQbIwWvuKJBqBIiIXtFnOOChN9lQMko=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=ajhAAOHlrhvKEDjqFk9ch12bkHVg2EQ0LOLxLt+oxLNuy0FveafWuTN/8ZcnQnbM4AUWFZEWMZNmgjYogRFZZfLAMsMThwZqFMaGUQkVPh65oHVHX322raZiBiQVYKtfmcDTt5R3HsTg8NMKiYaDDOTwBjHpDz5E0tDlIhFRLTU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.219.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-6f8a70fe146so38353076d6.0;
Fri, 06 Jun 2025 05:22:04 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749212522; x=1749817322;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=6bq7rC4bOsVX2kPJWiHscsX37vABLUWxhZKEGhe4C/Q=;
b=eq9KNJjvZHxQKEtIqiNZ1/u5ns241dVWKcqk/+758wOmzJ73efVmvmR5U1LyFJtGAB
J+94vehUaN0Ef3O5MGczduglh+cenouvDhv+i+Dq0J0Bclku8+UJZbIEw8lZsHEsr4mx
PesG0/DB0TgWmqznsqI0ro8xY6M0eERP93L0ViAdJBvK69nXl4rSbbXmKoKgYl2b5tF9
yPYd/1qTYkx7p7/GDweRZQGJQ5ajpDYZm3hDTbAhRjooVnYG8l/c2UEwkFmLjMzjkFwR
kwRXOeHa0G3goCrIG6WsuuuoJ0XDOUMfSMZEqa0XpaoUfMz48M+/UC5LWt+1cssHgrXO
Hozw==
X-Forwarded-Encrypted: i=1; AJvYcCUT/KBr8GblQTU/Bo65/hAfN0S7jU1Om3V+Zu2YMVTOP8/CIsjWlfO0vovyvmLbyZNd/W13GV24@xxxxxxxxxxxxxxx, AJvYcCWFarctNwtFqVoNiVd2rTLVY68bFx1np2PbF/yV9bRmOyG9hMVRPKKCGqvDL28tCst3taciKmIKW4W6@xxxxxxxxxxxxxxx, AJvYcCX82a8eZpf393kI5GGkuvULobMa+sQkc8BdAQjshKB0PYzJ+LTn6UzILGQ22dRQsPxA+zHkLKLi2kEczmcr@xxxxxxxxxxxxxxx, AJvYcCXq4imeOZBCel11mccgVb5cpcTHViVFyg0+A4Ahpbk3mVrz4KtmgOonUjnUUBcMIwjif1BeXLbO3KMEfbAGtb474II=@vger.kernel.org
X-Gm-Message-State: AOJu0YzTgQmcoeeXlhReoEWlfHMYDoHPDgYdfx957OipKWQD4h0Bb11s
KA9N5j3wiH+gZK8hQYwMlg+B1UfxeGs3i9Yi/dvWnzOa7bnX3EYXP7FloQrcSOLr
X-Gm-Gg: ASbGncvsh5SJEr83+n4VTeBZX8kPI9/xnemnkIBtQuZulIvGDNKQkJNdUtD2pw8UYki
43msTdFrueyxsHBecMOPOXIle+FrJ6pJIEWkQQbbT8IHpZ5WdBA7Cw8P6XsSHiMIi9ZxIzobC2m
WbDmNI4fhV0d4m/49w6tR5IyiNDilP7c1AyvcObFRQx2hnIKjviHW5vDiC23LeEvo23oHTyyFhU
yGQw9ZHolPhfVEIn9zmiWNIZXWDKviwo2moxALDSkc0toseYU+E+NRpcpW7nTag7BZB4knw1CvY
YsHxIIyvRbOTQlvkkQbBRlul5O2AXZQcn4k7DcmoyvQaICjQwpkfJ1+5G/E1BevkC21T9uJVB76
91cAVmmS/2Bzdp6aygw==
X-Google-Smtp-Source: AGHT+IHh27C0wXWCvQjI0URpPMFiNZfzas2u4sgBp0/x1gtLIqRUbD5MFvUNms09tDp94gSqfBfjVg==
X-Received: by 2002:a05:6214:4106:b0:6fa:cb97:9722 with SMTP id 6a1803df08f44-6fb0903b447mr52363246d6.34.1749212522360;
Fri, 06 Jun 2025 05:22:02 -0700 (PDT)
Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com. [209.85.160.178])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fb09b366easm10358756d6.114.2025.06.06.05.22.01
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 05:22:01 -0700 (PDT)
Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-4a3db0666f2so43409281cf.1;
Fri, 06 Jun 2025 05:22:01 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCW9WCl/Wn+4av92BcnpSxnF9Z+kpk7tuvR03CnfeNQk9goBgjdoN14hcfVAxANhp6iAgEoW8IrthOuAUa+t@xxxxxxxxxxxxxxx, AJvYcCWI2nIVUNphSnG3ROHLkjEGkIWamuDNy+ZKO44IJHuNqOZ1WUtEUFHQxDvRNtzjyD+WY/wYMfLj@xxxxxxxxxxxxxxx, AJvYcCX2Ivk6gXwPUc0RUB349xilBE3rz650jrsfk4IfLp7I/jKWxuPaltcxTPt4eaKsnu/RX8GBgc5SijMM@xxxxxxxxxxxxxxx, AJvYcCXU8PTvR+LcnaHiobQL/saL25kw473NytFmC9zzhEf4PD7/iSnwy3mph15chBRSkYUHKCqX2ADyC/EkiLSWpgJfhIw=@vger.kernel.org
X-Received: by 2002:a05:620a:1030:b0:7d2:26f3:83de with SMTP id
af79cd13be357-7d2298ed2c8mr465034285a.54.1749212521444; Fri, 06 Jun 2025
05:22:01 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250604065200.163778-1-john.madieu.xa@xxxxxxxxxxxxxx> <20250604065200.163778-3-john.madieu.xa@xxxxxxxxxxxxxx>
In-Reply-To: <20250604065200.163778-3-john.madieu.xa@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:21:49 +0200
X-Gmail-Original-Message-ID: <CAMuHMdVpKOZLzvZAAfzMe=GrStqc1bX9WRy-ROdrRkLzXs4iOw@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFtvoYugcH9OSDokLRpIxzWObSPzAwFWFg1APvof6NKzfaRHx1oY0ZfkojI
Message-ID: <CAMuHMdVpKOZLzvZAAfzMe=GrStqc1bX9WRy-ROdrRkLzXs4iOw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 2/4] dt-bindings: net: renesas-gbeth: Add support for
RZ/G3E (R9A09G047) SoC
To: John Madieu <john.madieu.xa@xxxxxxxxxxxxxx>
Cc: prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx, andrew+netdev@xxxxxxx,
davem@xxxxxxxxxxxxx, edumazet@xxxxxxxxxx, kuba@xxxxxxxxxx, pabeni@xxxxxxxxxx,
robh@xxxxxxxxxx, krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx,
magnus.damm@xxxxxxxxx, biju.das.jz@xxxxxxxxxxxxxx, john.madieu@xxxxxxxxx,
netdev@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, 4 Jun 2025 at 08:52, John Madieu <john.madieu.xa@xxxxxxxxxxxxxx> wrote:
> Document support for the GBETH IP found on the Renesas RZ/G3E (R9A09G047) SoC.
> The GBETH block on RZ/G3E is equivalent in functionality to the GBETH found on
> RZ/V2H(P) (R9A09G057).
>
> Signed-off-by: John Madieu <john.madieu.xa@xxxxxxxxxxxxxx>

LGTM (I don't have the User's Manual Additional Document for RZ/V2N)
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675738-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C9FBD41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:24:23 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 03B74179596
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:24:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D9EA2882D9;
Fri, 6 Jun 2025 12:24:18 +0000 (UTC)
Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5E4E42AA9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:24:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.69
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212657; cv=none; b=ofCSStYgGFgzN9BN0ql+z2y7gNWbs9KYiNvG372r0teykt1zMD69nNcRN3CJF1F09zy2smLQg8felJyPvZ2DoSk0nQLRmFReIctOf/sPtTsX7uhJcXE3Pl2932PttWry+2XvamvgbyLOvg1em0pLmmrszJBd5uvKKv0VdP//XrU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212657; c=relaxed/simple;
bh=n8VgKv1z3X0XUZzJmQW3GrUng44F+kGqfY4rB/HrDfA=;
h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To:
Content-Type; b=D3DPrk+ztyIsO/S+g0mpTS0U6qsMAA6ts+7ZLk2rv2XQJjUC7Q5/NDR/LnX+7vTDI7HQp+hzEyKzFjPdRon3A4siScFL7DIVsQLexkleX69XO7/TdRzBHkAX7Rbg8GCkJJr1vGqBL54YxVznI9ysp3pNcr2MxPAtvgU8+UQLodE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.69
Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com
Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-86cc7cdb86fso198304739f.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:24:14 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749212654; x=1749817454;
h=to:from:subject:message-id:in-reply-to:date:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=i63LlcEsT0J9Rnj0jXtmJ6XsBX0WHYzXOxUzGxALE/c=;
b=mioB7sBe5jgxzY1aWRntvRZpqwrwmFppswwKdpvLlxaJd4Xh8FlKkdu+D/kDge+3o0
OEC0UxgzjbFtX3g94pZsZfpZrl6iul9ByQifcA6BGudH2cr0gJSBuHZy+7oDOHY8bxHh
KkF3AqbXlHZ+jb3e+GVqVP1GcZbtPNMvh9lwBdBUzzQldG047IKIohiFztrN+1kLCOld
ZsAsn/bW6QIJVEJrt1z7o2pxW6PDKLhEPrPT0dtdJaspDj7p5cTycO6KSHfz+0Wwa8MT
/TOJnLtgbB0sL2DGOnk7z2amMRQAiQst2Ca3P+odlgwq2GvTmgxP8jnRtynPSayH6mJC
yXJw==
X-Gm-Message-State: AOJu0YzQkd9iPSKq6WQa5MzObqfnkXA4RX723RQsQD1ehG7A3H6jkl6S
s7geWbLTLTHiwVc2WTDMhq0TVYDt5Dv31FzdanBJ4GlYj6vZDShzaNsnHWtV6sWKJNWF7WfxKKj
z0Q3+7S4MYZdQ9buBeHVFE0dT9M1N7a4BE+k3K1WAmlHDt4XwJacZYYn3bi4=
X-Google-Smtp-Source: AGHT+IGQ8QOPqrYOb9zsCVrr+v50l8yPSpC375A2WJX7QdL5Gwe6pajLOIWPIWzy9XcP5/ITwSjDypOknFm8kDMdlXUkoixCC5XX
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Received: by 2002:a05:6e02:3090:b0:3d9:34c8:54ce with SMTP id
e9e14a558f8ab-3ddce4a9ff5mr37882615ab.18.1749212653917; Fri, 06 Jun 2025
05:24:13 -0700 (PDT)
Date: Fri, 06 Jun 2025 05:24:13 -0700
In-Reply-To: <684298d8.050a0220.2461cf.0039.GAE@xxxxxxxxxx>
X-Google-Appengine-App-Id: s~syzkaller
X-Google-Appengine-App-Id-Alias: syzkaller
Message-ID: <6842dded.a00a0220.29ac89.003e.GAE@xxxxxxxxxx>
Subject: Re: [syzbot] Re: [syzbot] [trace?] BUG: corrupted list in ring_buffer_subbuf_order_set
From: syzbot <syzbot+05d673e83ec640f0ced9@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.0 required=5.0 tests=FROM_LOCAL_HEX,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: Re: [syzbot] [trace?] BUG: corrupted list in ring_buffer_subbuf_order_set
Author: hdanton@xxxxxxxx

> Date: Fri, 06 Jun 2025 00:29:28 -0700
> syzbot found the following issue on:
>
> HEAD commit: cd2e103d57e5 Merge tag 'hardening-v6.16-rc1-fix1-take2' of..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=17f0680c580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=d97b092471e3ab82
> dashboard link: https://syzkaller.appspot.com/bug?extid=05d673e83ec640f0ced9
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1795b970580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13b281d4580000

#syz test

--- x/kernel/trace/ring_buffer.c
+++ y/kernel/trace/ring_buffer.c
@@ -6909,7 +6909,6 @@ error:
buffer->subbuf_size = old_size;

atomic_dec(&buffer->record_disabled);
- mutex_unlock(&buffer->mutex);

for_each_buffer_cpu(buffer, cpu) {
cpu_buffer = buffer->buffers[cpu];
@@ -6922,6 +6921,7 @@ error:
free_buffer_page(bpage);
}
}
+ mutex_unlock(&buffer->mutex);

return err;
}
--


Return-Path: <linux-kernel+bounces-675739-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 20EAA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:25:19 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4659A7A27E6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:23:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FCCB28850C;
Fri, 6 Jun 2025 12:25:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="UdM7Ona6";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Xm7vQ7c+"
Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144])
(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 D2E1727FD5A;
Fri, 6 Jun 2025 12:25:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212705; cv=none; b=eiGgWQ19/GV5sOc2dqr4K7l2Bz28hRFAD+B21RCUiWbxmRiLhDxK9qCdKO9cYTifZomXnQzmNGPt7f3OTGLT6ElmXtex5WgGC6EK7YOGUhD7vJ/wANrQ5q1pxeh5gn1YaHppFB3Knpe2LbcduuRjsHLJ0AfZohprmZb0rNhfi/o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212705; c=relaxed/simple;
bh=/LwMGNERnTE/Re/wZKCZmRuWogdYPaqVaY5+sEEkS74=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=SvRg0Oj1LJCM2QUQ1ny+SksyKMsYow282KzemnLrQtog0t7dJvYYa01o0Jr5SPlldA3LtPTq+leEg5dod4PXDv1C1InjnI3X/hV0AkHI3sa3Mp7ya9D5t6w/FmPmEenDzslaXWqKdG8PEcvAgu8dV3UAT3rsOtreiZ8B4ZsnCLw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=UdM7Ona6; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Xm7vQ7c+; arc=none smtp.client-ip=103.168.172.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42])
by mailfout.phl.internal (Postfix) with ESMTP id F298C138036D;
Fri, 6 Jun 2025 08:25:02 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-02.internal (MEProxy); Fri, 06 Jun 2025 08:25:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749212702;
x=1749299102; bh=+Yz74keYzlcBJNNckM7243Jd6xVKNRMOXRAFhHTjxas=; b=
UdM7Ona6Ut6PD/qIdX82XAxCiZuA/Adbumg/LCKzkMK0NLe4qu3PSXrMBziA5CYz
yRefFtROBCuzKl3ZSbN32jbfWaqlxA7jYAWykS3FexMo5Npsdx0TykmLQLRXMZ2E
BNL0SXAAxXoeHbR4P4GNJGs4nmoETzapCUh5nngJ8ssfiKCi3XAqFwjz4HlxP4tj
CtyiRujKGqyRuVT6G8xA/BSdN4jlb3+ZMlkLAWxpGxlnfNzjVXxbsAaWzs/cFiUq
H0CH93D7gIH+uW02qIqNOx9L2rdzBwkNjPCoa9aRt5rk9mfli619Pz9a32CFBRbj
1/hId4bVBh99J+lP5ALhqg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749212702; x=
1749299102; bh=+Yz74keYzlcBJNNckM7243Jd6xVKNRMOXRAFhHTjxas=; b=X
m7vQ7c+IJ/MTG99KovrXlXaMcJjLxF0WGTj5CzvktubnhaEff7q5G3wijb1PJJgY
jov1HjVoXboW4t8WwxBQ3H/BZGbTorgr0A528ZC3h6PYQq1XSO5/vhmksuZL0pO4
oe/D7XNJwnqxyxS6kHtZv8+HKLkM0lJGTuJ+VkqzNv1Uofz1xSVaO9jDj1UzGLqJ
zarGv7ME/cQYjKY/9cH2rVgFZlownRB/lOD+4ncSWCqA8IVhvAqL10hiPveOoYnq
pwW0WEZ4T2/Y9qS+bMslr9MhcOCkgDkZLWU9OvVWVKfHAu0bR/Hq2OmHWbA2Hc8j
6TYXD9VdePZqPMLyCi0dA==
X-ME-Sender: <xms:Ht5CaGkusookHOrOUDU6-qelVeXWxQlDx3Yplu0BSrN5i2olUjDXnw>
<xme:Ht5CaN00UkJvH4GaDmUCx-Yr6FoJd504FUQQBERoqhIrpA6EZA7M78JW7JzeMo8YE
c1iplg5RI4IuUYrZ_Q>
X-ME-Received: <xmr:Ht5CaEpom3F2vzEHktGzPLyWjqsj7i2ba7D47hTWoys_gMh39kjALn2TA9iqH3XPuK66r8ZwBjRSQDfeXYP1QvIQc__4Sh56Uw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdekucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpeevteeg
tddvvdfhtdekgefhfeefheetheekkeegfeejudeiudeuleegtdehkeekteenucevlhhush
htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehnihhklhgrshdrshho
uggvrhhluhhnugesrhgrghhnrghtvggthhdrshgvpdhnsggprhgtphhtthhopeelpdhmoh
guvgepshhmthhpohhuthdprhgtphhtthhopehtohhmihdrvhgrlhhkvghinhgvnhdorhgv
nhgvshgrshesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepmhgthhgvhh
grsgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehl
ihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvh
hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghs
qdhsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkh
gvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgthhgvhhgr
sgdohhhurgifvghisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlrghurhgvnhhtrd
hpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepjhgr
tghophhordhmohhnughisehiuggvrghsohhnsghorghrugdrtghomh
X-ME-Proxy: <xmx:Ht5CaKlP-ZMblpyyypBd6H9uCIWZdisxthkJsSdIknbwWfUo5y5Uzw>
<xmx:Ht5CaE2FyDglCNfV38epkX9UGNUgEU1Gq1R13FHkiC182b18mU1HRA>
<xmx:Ht5CaBuMBn9ScmrenkmJorZzbDhgPCqTB6CDC6bMOckiUXEn9JQEdQ>
<xmx:Ht5CaAV7K_1Dr4LVAcN0xsFnopFTHKqikrTlA8W39NKl2omvWgNR5w>
<xmx:Ht5CaIMUBaTPPx0JbdivynujZCNEotjvaPSsWmzHLCGuDPmsiX_0EUEq>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:25:01 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:25:00 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 12/15] media: rcar-csi2: Add more stream support to
rcsi2_calc_mbps()
Message-ID: <20250606122500.GI2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
<20250530-rcar-streams-v3-12-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-12-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

Thanks for your patch.

On 2025-05-30 16:50:41 +0300, Tomi Valkeinen wrote:
> In the case where link-freq is not available, make sure we fail if there
> are more than one stream configured, and also use the correct stream
> number for that single stream.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>

With Laurent's comments addressed,

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> ---
> drivers/media/platform/renesas/rcar-csi2.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index 65c7f3040696..b9f83aae725a 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -1018,17 +1018,22 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv,
> */
> freq = v4l2_get_link_freq(remote_pad, 0, 0);
> if (freq < 0) {
> + struct v4l2_subdev_route *route = &state->routing.routes[0];
> const struct rcar_csi2_format *format;
> struct v4l2_mbus_framefmt *fmt;
> unsigned int lanes;
> unsigned int bpp;
> int ret;
>
> + if (state->routing.num_routes > 1)
> + return -EINVAL;
> +
> ret = rcsi2_get_active_lanes(priv, &lanes);
> if (ret)
> return ret;
>
> - fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK, 0);
> + fmt = v4l2_subdev_state_get_format(state, route->sink_pad,
> + route->sink_stream);
> if (!fmt)
> return -EINVAL;
>
>
> --
> 2.43.0
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675740-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 854B341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:26:01 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id BFECE1796C2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:26:02 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 31622288517;
Fri, 6 Jun 2025 12:25:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="M7dPO64o"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 391C827FD5A;
Fri, 6 Jun 2025 12:25:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212753; cv=none; b=YJJmIJtZlABGB2b+HcQDzrPk3RmaaGv6IwruTUNYeohFov37OYStXgecV0VryojZMvaC4d8BALiD/7b0BcEoziwmhLYsQg3Hin8qhhx2iawXR5mMeRIhPjsHwu9LCNpHaMVQ91YpR22r0BijUw5kw16xK52MHa6BNp2INs7i7fM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212753; c=relaxed/simple;
bh=+97TlAFovavLSEOye2F0bZZb1ctQiJ0szw3vipntuxY=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=alI7RpqwGaLM74tj2Dupt3QTTq40guh7kZJZxaj6gjzxtasHXzsSP0cLZ5G57hklrXRXiDIKffOLxMOLCTDqc43RChsx8xsf5GAsbfY8c1Tw9MUHBltxcHoBMj1kHFWPxwuEwk4MZ/+yKxX9PNga640tsjnmLIL3KwQQliqv7xg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=M7dPO64o; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2675CC4CEEB;
Fri, 6 Jun 2025 12:25:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749212752;
bh=+97TlAFovavLSEOye2F0bZZb1ctQiJ0szw3vipntuxY=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=M7dPO64ovbpmqj/VsmsITZfJKoGgSN/4sqiUJnOTJHQ7qWCD/9GCRPS0X90KyYggk
IeQo3rlaDgy9WhetWz+CtQ/b/yFyBn737NoxRVThbfeZhldT1noHYK4g2qBHG25iKr
efrTb3veEsOYReUP3MMBbgRZvYWuwq5VHLt1u7X4=
Date: Fri, 6 Jun 2025 14:25:49 +0200
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, arnd@xxxxxxxx,
robh@xxxxxxxxxx, krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx
Subject: Re: [PATCH v3 2/3] misc: add driver for ST M24LR series RFID/NFC
EEPROM chips
Message-ID: <2025060650-tried-widen-4443@gregkh>
References: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
<20250606120631.3140054-3-abd.masalkhi@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606120631.3140054-3-abd.masalkhi@xxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 12:06:30PM +0000, Abd-Alrhman Masalkhi wrote:
> +// SPDX-License-Identifier: GPL-2.0-or-later

Are you sure "or-later" is what you want? Sorry, I have to ask.

> +/*
> + * m24lr.c - Sysfs control interface for ST M24LR series RFID/NFC chips
> + *
> + * Copyright (c) 2025 Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
> + *
> + * This driver implements both the sysfs-based control interface and EEPROM
> + * access for STMicroelectronics M24LR series chips (e.g., M24LR04E-R).
> + * It provides access to control registers for features such as password
> + * authentication, memory protection, and device configuration. In addition,
> + * it manages read and write operations to the EEPROM region of the chip.
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/regmap.h>
> +#include <linux/module.h>
> +#include <linux/device.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/nvmem-provider.h>
> +
> +#define M24LR_PAGESIZE_DEFAULT 1u
> +
> +#define M24LR_WRITE_TIMEOUT 25u
> +#define M24LR_READ_TIMEOUT (M24LR_WRITE_TIMEOUT)
> +
> +#define to_sys_entry(attrp) container_of(attrp, struct m24lr_sys_entry, attr)

This shouldn't be needed, something seems odd...

> +static ssize_t m24lr_ctl_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct m24lr *m24lr = i2c_get_clientdata(to_i2c_client(dev));
> + struct m24lr_sys_entry *entry = to_sys_entry(attr);

Why isn't this just going off of the device? Are you using single
show/store callbacks for multiple attribute types?

> + unsigned int reg_size = entry->reg_size;
> + unsigned int reg_addr = entry->reg_addr;

Ah, you are. Are you sure you need/want to do that?

> + u8 output[8];
> + int err = 0;
> +
> + if (unlikely(!count))

likely/unlikely can ONLY be used when you can benchmark the difference
in the speed of not having it. For a sysfs file, that's not needed at
all, please remove all of these.

> + return -EINVAL;
> +
> + if (count > (reg_size << 1))
> + return -EINVAL;
> +
> + if (unlikely(!is_power_of_2(reg_size) || reg_size > 8)) {
> + dev_dbg(dev,
> + "Invalid register size: must be a power of 2 and <= 8 bytes (%u)\n",
> + reg_size);
> + return -EIO;

Not -EINVAL? This isn't an I/O error.

> + }
> +
> + err = m24lr_parse_le_value(buf, reg_size, output);
> + if (err)
> + return err;
> +
> + return m24lr_write(m24lr, (u8 *)&output, reg_size, reg_addr, false);
> +}
> +
> +static ssize_t m24lr_ctl_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + long ret;
> + u64 val;
> + __le64 input = 0;
> + struct m24lr *m24lr = i2c_get_clientdata(to_i2c_client(dev));
> + struct m24lr_sys_entry *entry = to_sys_entry(attr);
> + unsigned int reg_addr = entry->reg_addr;
> + unsigned int reg_size = entry->reg_size;
> +
> + if (unlikely(!is_power_of_2(reg_size) || reg_size > 8)) {
> + dev_dbg(dev,
> + "Invalid register size: must be a power of 2 and <= 8 bytes (%u)\n",
> + reg_size);
> + return -EIO;
> + }
> +
> + ret = m24lr_read(m24lr, (u8 *)&input, reg_size, reg_addr, false);
> + if (IS_ERR_VALUE(ret))
> + return ret;
> +
> + if (ret != reg_size)
> + return -EIO;
> +
> + switch (reg_size) {
> + case 1:
> + val = *(u8 *)&input;
> + break;
> + case 2:
> + val = le16_to_cpu((__le16)input);
> + break;
> + case 4:
> + val = le32_to_cpu((__le32)input);
> + break;
> + case 8:
> + val = le64_to_cpu((__le64)input);
> + break;
> + };
> +
> + return sysfs_emit(buf, "%llx\n", val);

Why are "raw" read/writes happening from sysfs to the chip? That feels
wrong, and an abuse of the sysfs api.

If you really want "raw" access, make it a binary file that userspace
can mmap or read/write from directly, with the kernel getting out of the
way entirely.

> + n_sss = chip->n_sss_entries;
> + if (n_sss) {
> + sss = devm_kzalloc(dev, n_sss * sizeof(struct m24lr_sys_entry),
> + GFP_KERNEL);
> + if (!sss)
> + return -ENOMEM;
> +
> + for (i = 0; i < n_sss; i++) {
> + char *name = devm_kasprintf(dev, GFP_KERNEL, "sss%d", i);
> +
> + sss[i].reg_size = 1;
> + sss[i].reg_addr = i;
> + sss[i].attr.attr.name = name;
> + sss[i].attr.attr.mode = 0600;
> + sss[i].attr.show = m24lr_ctl_show;
> + sss[i].attr.store = m24lr_ctl_store;
> +
> + err = device_create_file(dev, &sss[i].attr);

You just raced with userspace and lost. This is not how to do this,
please do not dynamically create attributes (hint, this should have
errored out as you didn't correctly initialize them), but also:

> + if (err)
> + dev_warn(dev,
> + "Failed to create sysfs entry '%s'\n",
> + name);

You do not unwind properly if an error happens.

Just use a default attribute group attached to the driver and the driver
core will handle all of that logic for you automatically. Making the
code smaller and even better yet, correct :)

thanks,

greg k-h


Return-Path: <linux-kernel+bounces-675741-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DBD1141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:26:13 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 3A3B11896D4B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:26:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 307B4288508;
Fri, 6 Jun 2025 12:26:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EiZ2fPYn"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7096227FD5A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:26:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212761; cv=none; b=lgm1SyIRsovvCavvZ/xO79thwZ3saRAt6cjP1HZ9A8t2X8H/uFr2aRBrcOyhrkZTMDI3aGN08qSytHPCqgycOr1FbVaMgPce+SIGWM+L8poqo8b9q8rLfNEHpTMxrgBYRTbXMp1FKX0ShAVIGKrobvIs8ILofBntEiXJD3W3aVk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212761; c=relaxed/simple;
bh=NzZ6wArFnrGATALrD5br9/mTy388nlgqYwCWAd+sWQw=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=qUYFhvKG9bg8H+Wz6GdGe8waIv9BcjZqYW7c3833dz5aieX+01rh1YeQng3xmqfW58HttWvep02tQpUqiubxeEWriMmQi1T43u/EOnotQk6kaqUR7gKACx1+70K3l7uj1N7q7iZQOUkDjoqLDxfyfYXGgLHZa5o9tSmUmQ4fVQE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EiZ2fPYn; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82FC6C4CEEB;
Fri, 6 Jun 2025 12:26:00 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749212761;
bh=NzZ6wArFnrGATALrD5br9/mTy388nlgqYwCWAd+sWQw=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=EiZ2fPYnGmkyPX43Dw4Rbvx0AEMETr9vcxm2Uo5W72lIl260ACm5TTMQN7pzV4K+j
GxMnTyYsCT2e80eaEf29V55iZTp32FuhkSxJf7FicEaV8UvsZGBj49Gwwb2p58PCdG
fU8Nj6EUbDTbjyWZ8/yDfinwty/dLFKVVsgbRML4KnaVCTtK0tSH9ezBjb+7F2rP6+
/0GY86t/VVfdd0OEF45x2lbI8reWsnjBlrDY+5hGlIejnWZDx1G2+afosGADTlXc7I
o6GRTORi+JKxTchsxcKyD+Bq2TLV5BivvUwhmDjQunad9C9NQAsGapU/G7f2lGK6oA
6v4vy0rqS1evw==
From: Maxime Ripard <mripard@xxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>,
Dmitry Baryshkov <lumag@xxxxxxxxxx>,
Andrzej Hajda <andrzej.hajda@xxxxxxxxx>,
Neil Armstrong <neil.armstrong@xxxxxxxxxx>,
Robert Foss <rfoss@xxxxxxxxxx>,
Laurent Pinchart <Laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jonas Karlman <jonas@xxxxxxxxx>,
Jernej Skrabec <jernej.skrabec@xxxxxxxxx>,
Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Aradhya Bhatia <aradhya.bhatia@xxxxxxxxx>
Cc: Maxime Ripard <mripard@xxxxxxxxxx>,
DRI Development List <dri-devel@xxxxxxxxxxxxxxxxxxxxx>,
Linux Kernel List <linux-kernel@xxxxxxxxxxxxxxx>,
Nishanth Menon <nm@xxxxxx>,
Vignesh Raghavendra <vigneshr@xxxxxx>,
Devarsh Thakkar <devarsht@xxxxxx>,
Jayesh Choudhary <j-choudhary@xxxxxx>,
Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
Subject: Re: [PATCH v13 0/4] drm/atomic-helper: Re-order CRTC and Bridge ops
Date: Fri, 6 Jun 2025 14:25:56 +0200
Message-ID: <174921275438.1606688.14453750248073205511.b4-ty@xxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250605171524.27222-1-aradhya.bhatia@xxxxxxxxx>
References: <20250605171524.27222-1-aradhya.bhatia@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, 05 Jun 2025 22:45:20 +0530, Aradhya Bhatia wrote:
> This series re-orders the sequences in which the drm CRTC and the drm
> Bridge get enabled and disabled with respect to each other.
>
> The bridge pre_enable calls have been shifted before the crtc_enable and
> the bridge post_disable calls have been shifted after the crtc_disable.
>
> This has been done as per the definition of bridge pre_enable.
> "The display pipe (i.e. clocks and timing signals) feeding this bridge will
> not yet be running when this callback is called".
>
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime


Return-Path: <linux-kernel+bounces-675742-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 73C6441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:28:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4B2F13AE2BF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:28:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AC6B2288517;
Fri, 6 Jun 2025 12:28:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ynoObLXa"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E846128E0F;
Fri, 6 Jun 2025 12:28:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212914; cv=none; b=KimRJKEIYh/msldVPK+S2DVUUMAp02ZE3P6ieQhglvIt8tKI+7J9O7NRLbZqBkdMuuZdBt6xEJVuk2/LMBNMVvJXaHrQsppFEQKnJrIL0bzdTQMK99iWF8ZnZZt/LYSxo4r9tzE2q20yO9eLP0cetdZvtzj08d7ptvx6a8lMaDw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212914; c=relaxed/simple;
bh=jAkYL4VXVnMBgY+eRaXVCeLOmNfQxDZf8QjlfRZ3Fnc=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=EiJSJ0/WHHL8SZHHbUqPzitmJ2sBico3AFCFcDHtrH7dQ4JrALm2ng09xp2QPbIwdeRqcwYo9ENypn4xl9MMVEJhdsyUcRqydzpzpazHJPEX7euXNmwrRuZmyQHdkg8kXmEmr7OiVQi96W+4M4SZilK29AhGdZtgq9IGaW4vDug=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ynoObLXa; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06B72C4CEEB;
Fri, 6 Jun 2025 12:28:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749212913;
bh=jAkYL4VXVnMBgY+eRaXVCeLOmNfQxDZf8QjlfRZ3Fnc=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=ynoObLXaB/tB8TrJbEjSXuDCG94H2eGnP9qg7EnWf0qd/vD7UlXkIdV22PtIuZX+o
IlVPlPpIa5mof3pTFKdeuBZy1qcwF8Cwr9jAsmt3HbGtehFBkdmzplU6LiX75lE8Ed
6eNVn8fHcuG8FbfiGekTd4OrcRwONJ11oQP9aCdE=
Date: Fri, 6 Jun 2025 14:28:30 +0200
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, arnd@xxxxxxxx,
robh@xxxxxxxxxx, krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx
Subject: Re: [PATCH v3 3/3] ABI: sysfs: add documentation for ST M24LR EEPROM
and control interface
Message-ID: <2025060632-luridness-carpool-bf90@gregkh>
References: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
<20250606120631.3140054-4-abd.masalkhi@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606120631.3140054-4-abd.masalkhi@xxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 12:06:31PM +0000, Abd-Alrhman Masalkhi wrote:
> Add sysfs ABI documentation for the STMicroelectronics M24LR device,
> covering both the control interface (e.g., unlock, password update, UID,
> memory size, and SSS entries) and EEPROM access via the nvmem subsystem.
>
> Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
> ---
> Changes in v3:
> - Updated sysfs entry paths to use <busnum>-<primary-addr> to reflect the
> control address.
>
> Changes in v2:
> - Added initial sysfs ABI documentation.
> ---
> .../ABI/testing/sysfs-bus-i2c-devices-m24lr | 96 +++++++++++++++++++
> 1 file changed, 96 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr b/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
> new file mode 100644
> index 000000000000..53b6fe39162c
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
> @@ -0,0 +1,96 @@
> +What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/unlock
> +Date: 2025-05-31

It's later than this.

> +KernelVersion: 6.16

This will not be showing up in 6.16, sorry, it's too late for that.

> +Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
> +Description:
> + Write-only attribute used to present a password and unlock
> + access to protected areas of the M24LR chip, including
> + configuration registers such as the Sector Security Status
> + (SSS) bytes. A valid password must be written to enable write
> + access to these regions via the I2C interface.
> +
> + Format:
> + - Hexadecimal string representing a 32-bit (4-byte) password
> + - Accepts 1 to 8 hex digits (e.g., "c", "1F", "a1b2c3d4")
> + - No "0x" prefix, whitespace, or trailing newline
> + - Case-insensitive
> +
> + Behavior:
> + - If the password matches the internal stored value,
> + access to protected memory/configuration is granted
> + - If the password does not match the internally stored value,
> + it will fail silently

Why is the kernel in the business of adding passwords to devices? That
feels wrong, and a way to just flood the device with a "try all the
values" attempt if needed.

> +What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/sss<N>
> +Date: 2025-05-31
> +KernelVersion: 6.16
> +Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
> +Description:
> + Read/write attribute representing the Sector Security Status
> + (SSS) byte for EEPROM sector <N> in the M24LR chips. Each sector
> + has one SSS byte, which defines I2c and RF access control via a
> + combination of protection and password settings.
> +
> + Format:
> + - Read: returns a 8-bit hexadecimal value followed by a
> + newline
> + - Write: requires exactly one or two hexadecimal digits
> + - No "0x" prefix, whitespace, or trailing newline
> + - Case-insensitive
> +
> + Notes:
> + - Refer to the M24LR chip datasheet for full bit definitions
> + and usage
> + - Write access requires prior password authentication in I2C
> + mode

How "deep" does this sysfs tree get here? This feels like the wrong api
for read/write to the device, just do it with a single binary file if
you really want a "passthrough" way to get to the hardware.

thanks,

greg k-h


Return-Path: <linux-kernel+bounces-675743-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 804D141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:29:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 675071794DA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:29:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 59EE1288C05;
Fri, 6 Jun 2025 12:28:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="m0Tqyx7l";
dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="TupEVE61";
dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="m0Tqyx7l";
dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="TupEVE61"
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60BE0288508
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:28:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212936; cv=none; b=qFYQryX3kmiyMO70Lh6nKsmveDhR1uQVwHAQiyZAGIy3jAHDe8lhyZyfsDpeDzFRoLYFioZdUpVp5zGcBhRcsx/aUFVqn8AKzE5l6cq8i7Mbcbzdn8B3BtFJDgjXE46mqPPgDgGhMkROEakOU1iS1Gab5qBo0PU8W0esfB96Sbw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212936; c=relaxed/simple;
bh=VdugDXsJC+MySYLUkZ+jaVZRS+xfYRsyvBkvIOugRw0=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=KUf0KIKxn23h5Wkr2z66x5WqIzPtJj+7Ca6xFIZbvLVzARwZ4t/Khr558s8nqMwZYHsMOugk4sin1d15U8iNMVEKaexepX28A6wsi7ps2QzbQ6cDkx62rOWQp2dcZ9K8UZR2Lqi4S7fqzQ40q1nAjSekyKyPkNmzkOlbJxmtRG4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=m0Tqyx7l; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=TupEVE61; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=m0Tqyx7l; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=TupEVE61; arc=none smtp.client-ip=195.135.223.130
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de
Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by smtp-out1.suse.de (Postfix) with ESMTPS id 7123321114;
Fri, 6 Jun 2025 12:28:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
t=1749212932; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=DqICevuKoP0IJLpCka+29EYHI1p+jaoZS/6X28IIxdU=;
b=m0Tqyx7lrrlQgV4nYGpP1zIy5aYr8pdM7BZbJIMBFDW/0ldzBITpicmeCTtoT+wULeWu94
LsjTCIfhAF6/IzKqHC5OFGDdeDnSO7qdUCPH04DBgzukifaXTrB4Lyun7eOb3Cf3twLSlU
FM+l/7mya7GOStvYJkxM4HwHwov9eqc=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
s=susede2_ed25519; t=1749212932;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=DqICevuKoP0IJLpCka+29EYHI1p+jaoZS/6X28IIxdU=;
b=TupEVE61L1YpQIEe5C8YHYMwU4SKGD6E0FgkwkiMdTnKNF9+1eDiAjv9oZMVAl6R71fumJ
noODCVmyuCdo7jAg==
Authentication-Results: smtp-out1.suse.de;
none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
t=1749212932; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=DqICevuKoP0IJLpCka+29EYHI1p+jaoZS/6X28IIxdU=;
b=m0Tqyx7lrrlQgV4nYGpP1zIy5aYr8pdM7BZbJIMBFDW/0ldzBITpicmeCTtoT+wULeWu94
LsjTCIfhAF6/IzKqHC5OFGDdeDnSO7qdUCPH04DBgzukifaXTrB4Lyun7eOb3Cf3twLSlU
FM+l/7mya7GOStvYJkxM4HwHwov9eqc=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
s=susede2_ed25519; t=1749212932;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=DqICevuKoP0IJLpCka+29EYHI1p+jaoZS/6X28IIxdU=;
b=TupEVE61L1YpQIEe5C8YHYMwU4SKGD6E0FgkwkiMdTnKNF9+1eDiAjv9oZMVAl6R71fumJ
noODCVmyuCdo7jAg==
Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E11E31369F;
Fri, 6 Jun 2025 12:28:51 +0000 (UTC)
Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
by imap1.dmz-prg2.suse.org with ESMTPSA
id ei86NAPfQmicYwAAD6G6ig
(envelope-from <osalvador@xxxxxxx>); Fri, 06 Jun 2025 12:28:51 +0000
Date: Fri, 6 Jun 2025 14:28:50 +0200
From: Oscar Salvador <osalvador@xxxxxxx>
To: David Hildenbrand <david@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v5 04/10] mm,slub: Use node-notifier instead of
memory-notifier
Message-ID: <aELfAo3RgIU0CV-5@localhost.localdomain>
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<20250605142305.244465-5-osalvador@xxxxxxx>
<0ca963af-8dc9-4cb4-9142-04497c359b81@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <0ca963af-8dc9-4cb4-9142-04497c359b81@xxxxxxxxxx>
X-Spam-Score: -2.80
X-Spamd-Result: default: False [-2.80 / 50.00];
BAYES_HAM(-3.00)[100.00%];
SUSPICIOUS_RECIPS(1.50)[];
NEURAL_HAM_LONG(-1.00)[-1.000];
NEURAL_HAM_SHORT(-0.20)[-1.000];
MIME_GOOD(-0.10)[text/plain];
FREEMAIL_CC(0.00)[linux-foundation.org,suse.cz,huawei.com,oracle.com,sk.com,gmail.com,kvack.org,vger.kernel.org];
MIME_TRACE(0.00)[0:+];
DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];
ARC_NA(0.00)[];
FUZZY_BLOCKED(0.00)[rspamd.com];
TO_MATCH_ENVRCPT_ALL(0.00)[];
RCVD_TLS_ALL(0.00)[];
FREEMAIL_ENVRCPT(0.00)[gmail.com];
MISSING_XM_UA(0.00)[];
FROM_EQ_ENVFROM(0.00)[];
FROM_HAS_DN(0.00)[];
TO_DN_SOME(0.00)[];
RCVD_COUNT_TWO(0.00)[2];
TAGGED_RCPT(0.00)[];
RCPT_COUNT_SEVEN(0.00)[9];
RCVD_VIA_SMTP_AUTH(0.00)[];
DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]
X-Spam-Level:
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 01:56:15PM +0200, David Hildenbrand wrote:
> > @@ -6217,15 +6217,12 @@ static int slab_memory_callback(struct notifier_block *self,
> > int ret = 0;
> > switch (action) {
> > - case MEM_GOING_ONLINE:
> > + case NODE_ADDING_FIRST_MEMORY:
> > ret = slab_mem_going_online_callback(arg);
>
> In slab_mem_going_online_callback we will cast arg to "struct
> memory_notify", no?

Uhm... not sure if I understood this correctly but slab_mem_going_online_callback looks
like this:

static int slab_mem_going_online_callback(void *arg)
{
struct kmem_cache_node *n;
struct kmem_cache *s;
struct node_notify *narg = arg;
int nid = narg->nid;
int ret = 0;



> Probably needs to get fixed.
>
> ... and probably best to pass marg directly.

You mean to cast it directly in slab_memory_callback and pass 'narg'
to slab_mem_going_online_callback?


> > break;
> > - case MEM_GOING_OFFLINE:
> > + case NODE_REMOVING_LAST_MEMORY:
> > ret = slab_mem_going_offline_callback(arg);
>
> slab_mem_going_offline_callback() doesn't even look at arg, so likely we can
> drop that parameter?

Sure.

Thanks for the feedback!



--
Oscar Salvador
SUSE Labs


Return-Path: <linux-kernel+bounces-675744-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 65FF841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:29:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7A4C5174E10
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:29:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 55A4228852F;
Fri, 6 Jun 2025 12:29:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="TGxac6B+"
Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2067.outbound.protection.outlook.com [40.107.223.67])
(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 8722B288C1C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:28:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.67
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212940; cv=fail; b=X6/JtCKY0z0sbeTpgSV+1Z+6F5HDSq8224NelahfYIgys6Fy7h3m7O4hKEIJhb3u88XB1OYyQHtYU3+dwy8hEeGJfisR7MQxsHj1Svc5kTCj7j0zLBxRLZT9aBQQR8YZmgjgQL3irOmHN/wqSoWaeUAE3gMNKRXlIa7bjixMNA4=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212940; c=relaxed/simple;
bh=Id+ne6mJN8OdqQpmvXNRzLyLkhZMuRti9Wl3bTFo8nU=;
h=Message-ID:Date:Subject:To:References:From:In-Reply-To:
Content-Type:MIME-Version; b=XW36492wgBQATG43lU33JWbMoq/FezP3/Iicz3XhADvlsj636LyH0syLNEe5EE5Z8Rma7KdCmLr+9gh/Q0KqJzN7BdWelaPLUAOaEvZ48GMuk/zEO7sFBiIx5SpOerFH7FbSn7PB6H/O+8St/UkxcVcNhJkq8DyYB4m+IfpP5fQ=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=TGxac6B+; arc=fail smtp.client-ip=40.107.223.67
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=TeVDmRShe3SSSlK+auyg5AHLA0ZdYcRm59s1ADH20x//Bj2PFETe5a0iOK9mEcoozXtV+6QRzkezmS/MZ1LoUt5tZykz7Ni1oXlcN8Jz4/4KNur0qXhRExMr8ZBwbv9Q5/mrPIl/ihPu+b3CqxRLEjmDEYYDsfe54CZDSRXAbEKnqmb5MWLuDGg9/lOrXVMKz4/PsDgIdCxaW1kea1gp7FEXpas/LcXv0V9+IYzTrWrkzowsWooQ8PzhZQ4n/wxu/It3FeICk0VNcgaPFbrpN7TjxPY5EAiIog+BIdXbuWht58h4AqNJqiYSFWujb86QYSqVVLUyuDPDNwy2Thx7wg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=qitMhmrN7TmGW/MIO9GqUyinY16BfJEUJB+E7KseOTY=;
b=A0IgHCMYYwrw+z4RPRGneHiD+iOkfKHDAoVq53j8la6+OfF8CrPX+AFsjsqCxNyj+1h6GuoS4/vFiqFg6vu2LUckZsmFnZhFBJRdSJQdAH3oIkdwansioVb2a9N8Ja8q2lBunvu4cG33j7j/uCKyiXpglmNVPpAgZ7xq8KnDxYvx2DKtJkwRCXUkIc4fWND82n9puw5EQG29TxGDqHcxD5T0RslUOp3XwFdCc27dQYlbJhw3d/ogXfsKkUtBTMRCvtqGiCjXC+4/N4RMn09b7zQ1JhZljxsY6C2CDav5sHoC56TSITETyCTJmT9iNR4V+qG2ishsRmcORuz4UECN5Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass
header.d=amd.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=qitMhmrN7TmGW/MIO9GqUyinY16BfJEUJB+E7KseOTY=;
b=TGxac6B+99PVh853v7N4YWkSuzFL4gVzqGEa5aP7BiGwV9r9JmTzXayTlEzqErCYPC98rTXaOdnE4SAlkOqXZyf9ARhs/c3wduoHAjtz/nArcss8/YhNLC8Rlr9cZ9sWALfApCtiGiTrcD2zAKU+Cp38UkxegJtvdjx0BxJRsNM=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=amd.com;
Received: from PH7PR12MB5685.namprd12.prod.outlook.com (2603:10b6:510:13c::22)
by CH3PR12MB8536.namprd12.prod.outlook.com (2603:10b6:610:15e::10) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.34; Fri, 6 Jun
2025 12:28:56 +0000
Received: from PH7PR12MB5685.namprd12.prod.outlook.com
([fe80::46fb:96f2:7667:7ca5]) by PH7PR12MB5685.namprd12.prod.outlook.com
([fe80::46fb:96f2:7667:7ca5%7]) with mapi id 15.20.8722.031; Fri, 6 Jun 2025
12:28:55 +0000
Message-ID: <dd0532a2-4011-41ec-896d-ec066dc23cbc@xxxxxxx>
Date: Fri, 6 Jun 2025 14:28:45 +0200
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 4/9] drm/ttm: Add ttm_bo_kmap_try_from_panic()
To: Jocelyn Falempe <jfalempe@xxxxxxxxxx>,
Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>, Simona Vetter <simona@xxxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>, Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>, Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>, intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
<20250606120519.753928-5-jfalempe@xxxxxxxxxx>
Content-Language: en-US
From: =?UTF-8?Q?Christian_K=C3=B6nig?= <christian.koenig@xxxxxxx>
In-Reply-To: <20250606120519.753928-5-jfalempe@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: MN2PR01CA0048.prod.exchangelabs.com (2603:10b6:208:23f::17)
To PH7PR12MB5685.namprd12.prod.outlook.com (2603:10b6:510:13c::22)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PH7PR12MB5685:EE_|CH3PR12MB8536:EE_
X-MS-Office365-Filtering-Correlation-Id: d0c382d3-c1ff-4ee4-156b-08dda4f5b3e7
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|7416014|376014|1800799024|366016|7053199007|921020;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?SW5Na2U4cUVFVUNaUEloMVV5VFkxV0k5RUtZbWNxOStUdE4rV1pnN0Y5TUhS?=
=?utf-8?B?TTRIQndwU3ptbllhV0ZvYmZvWStIY05Jb3FoLzhKUzlNN2lxWnNSTk1EaWdP?=
=?utf-8?B?MkNoeUZTd1FxbEg4MTRVWFpkeWJjd0lSZjJoeGVrTGZNR2VkQWxpTkducVFa?=
=?utf-8?B?dFJZTzdVc1o2ZnhPVEh5SDJLeE9GeTRMd3ZPeXJSNnU3Q256bnRzdGVZdUlY?=
=?utf-8?B?T1BaNG91THZQa3JWeGcraDI0RnJzU0dMbG43TkcycDhCRVlvbU5zdTVEd2hD?=
=?utf-8?B?MG9VZVZHbHk1VkxMUnJobWZUUmg2QWx3S0NGZVF2YTA1dWNmSnIxL1laaDFV?=
=?utf-8?B?bG5UZWg5b1NWcXhPOTM5RzRZVklzT1QrTUlDRGlFWkZGakhxYTdFeHlsRkhP?=
=?utf-8?B?TG02NW5DUUQvd2dUcjVWZWRKaFlGcmp4TDN5eGhYdHFLN2RKVTNYTG9sdElt?=
=?utf-8?B?RWNZbFE3d2ZSejRGMko4bXJ1UHZZL2FQa0hscGVwUVVOV1ZqelRJV0JxTVhX?=
=?utf-8?B?SmdXQ0JiamkxdFEydXNvWVduTU1rcm9lK0JQUFRDUjZHT3hOMVFLYWljL0hN?=
=?utf-8?B?NUhoNmU4b2ZLbFM0RGRvcjlsS2dIOE5XeURCS3pQc2FGaDljcS8yQ3lFZFl3?=
=?utf-8?B?VGpXMENBQkdMZ2xSUERwK3RlVklCSHIwMjBPMUJmZ05wQnYwNVRuMm5vV3du?=
=?utf-8?B?eVJ2S0FBYUZucnIvSXdHL2dGVm91cTdESHZCRGJ4dDBNcHI2Ynl3OWV6UE5D?=
=?utf-8?B?c0F1RGdrVlNiakh5KzhiaHdSZ2lWbWU5TkhDUlpHM09KcnNMUkN6S3MzeWNj?=
=?utf-8?B?U2g2V2x0dyt0UVgxMWxXcW9ZNlJPVno3MmJLMUVOY2laTVZWVVgzS0FEWDZU?=
=?utf-8?B?OWlkS0hIcHVodWtnc3RISmZ5WXgzc0ZiUm5TeUdJbGRqeVM2enhTLzF5TzZs?=
=?utf-8?B?aU10eTFHZ1lTRUk2dXg4T3dFRnpjWCthaWJNcDRkQ1dMRkxZMWNkMGVtbGtM?=
=?utf-8?B?T1dYcEJLeXQ4OFV3WXRTM2ZWTlpiUXV5R0VCZEJHZUllUEFHMHNHUS9MY3BK?=
=?utf-8?B?Z0Vrckh5L2dXOW5TOXhrVHovaTY5TllEbHBCdUd6WTlqTURPcWUybU5pQ0RS?=
=?utf-8?B?SXdzRlp1b2tLRWk2VW9mTXFnZEZFRDRONjdOMUttdkV2amowVG4zeFIxSjQw?=
=?utf-8?B?d1BySGNZZGpOVDhwZ2xiWDU2VWVvNHYxUm52Y3hLV05EcTlLelY0MUcybXZn?=
=?utf-8?B?TGJYUWhjQXJMM2IyemVvcXJ6ZHhWM3djb2V5TzZaMVluYVNtZ0VGS3Byc0Jx?=
=?utf-8?B?Ri9NRS9FamkxYmN6cHpvNXV4MXEzeTVIYVN0bzhhRk84b1o3OTgrWDV0Qi9N?=
=?utf-8?B?Y1dhZTNRY0kxbjJTa2U1U3l5aFlKQ1VsRWRJY0pycE5meXpyY1J5TVg4MlNz?=
=?utf-8?B?TlRmT2FNaFZ2Rkg4bE16WkJoRThUWEhZZGhCSmEvWDN3WDQ1V1VLZFNtT3NB?=
=?utf-8?B?bW9Yb00yOExldW9PT1hBZWVuOU9rLzR0elUzY3VUclNqRCt3a3NseWVRN0ww?=
=?utf-8?B?Y2FSM3phcEpFTEVsN1pqaUlQSU9ua3RLUU5vVjZ4OWhTdlkrcjl4RnRvRTFl?=
=?utf-8?B?SnptVFpIRk96QkF5a2dsVmRjbHgveTFNaWV0TTdjRUp0OUhVa3BrUzlqbE5i?=
=?utf-8?B?alVRRDlaMWhmRFZWZkdYSjhKdTRWbHduQUFHTWVTejgzRVBoV1hkcksvaXhY?=
=?utf-8?B?THlCTm96MVlZckJvUzlUeGJUa05RVzNYaXZnbE02ZlVudnB5dm90OW16OFkv?=
=?utf-8?B?N3ZGSzJhclkvRXVmOWpSL2l2U3REWVVaZFJZZmRRMXRMMDdyRm9yZ3F3TEhM?=
=?utf-8?B?WEMyZEdYN3RlWHdHWFM4VnpkY1ZLN215U0xqNTYyMEgyakNVWjJEU2NXVjJu?=
=?utf-8?B?K2JMTVJFREZ5NHgrZTJyRGJUbmhYR1EvYmxkMk04dmdrMWV4NjUvSXdoanl6?=
=?utf-8?B?eE81QVNBOFpRPT0=?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB5685.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016)(7053199007)(921020);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?UlRoSGp6YkFObEo1TWxmZ3ZEYUQ3NDRsa09YUG5tWUQ5WDJWU00vdjg2ZmRL?=
=?utf-8?B?d0ZpNk1WZGhoVG1Dc1Y2MGp4THk3SXcyZXJoUjBjeEU2U3J3L2Irb3laTG02?=
=?utf-8?B?RUU2SVl2OElLd3BxNUtJaHIxSWpWS3lMYkIzSzViditpcEIxZHFUQUhMZ2Jz?=
=?utf-8?B?RHI2WUNYQ3dVYUh5eDd5MHpUc1FEVVVPOFlpdGZORXJ6YUgwbUU1Nk1XVVFR?=
=?utf-8?B?Si9XUEw1QVBqQUNOZk95dTF4b2NUeFRQOGFSclFwQ2piSWhIMzkwbmJkYk1o?=
=?utf-8?B?VGJqVnUyOWs0MXJab0VpazdqbERwNUluZzczL2ZPNjgzbWZrR05adVpab1Fs?=
=?utf-8?B?NCtvSkF0RndkUFQ4ajJGRnliWEYxeGdXeWhvNXB2SlkvVStBWE1ETVZNazVL?=
=?utf-8?B?andDV1BQMjNJL0RWdGJQdG4vNkJ6M0JHTmZ4RjdtQktnZU1QWHJDTG9WNVBR?=
=?utf-8?B?cTJPRElvMTM2MnlrbE1xUHRhcEpXWE4rVTROVnEyVWw4aElxOWdmQzJISkly?=
=?utf-8?B?NXdpSEpoNVlYTlBQKzVrVEJ5OC9KYWViRFhvUzNLSTU5QjFkV2lXZHYxL1dZ?=
=?utf-8?B?eGZGTVhMaFc0cERHUXFkOGhZekFyZnVoUXpGNEtLci9hbFJzcmkvNzl3WE16?=
=?utf-8?B?UmdDZDlvdWlpT3BpSXNKSVJzNjd2cStCZlpxbGFib3VvUGw4eWppWmxVc0Y0?=
=?utf-8?B?eWk2TG9XUGM3M0ZVMkZEdGhzeUl0bUNHWUFMdjVLUTNrMG1BSjFseDA1Rmo4?=
=?utf-8?B?RFl0eDZncDlBZWZTeHRDRmJCbTZVdEtVL1p4TDJ3YWJsT3RzREJDYjhJREty?=
=?utf-8?B?bHU5NWpod2Y2ZGdXakFmSCs4a0o0c2szbW91a1UwZFhTblpvSVc1S1RiL2tB?=
=?utf-8?B?NFJWTEkzQ3N2Qm83amxPSkpyMHArWTlQaFdtWHpTcnRtMEhoQlJnV29kU1J5?=
=?utf-8?B?UytPQkJ1SDUvQUxHdWpZeWRLWUdnb1BmRUtSUDBOT051WU5GSkltZzZ2U1po?=
=?utf-8?B?RC9hUGJxMkM0eFRvTW4yTkxxQ1RDZXlYbG10LzZjRlFLR1Bkb3ZNM2xEelMx?=
=?utf-8?B?SlpNTDFIM2d2NmZUUGRIREw4Q1M1bVdSVUc1UzhHTGxLc2hCYWd3ZVFXTXFx?=
=?utf-8?B?ZjVuTUtpR1RZZUcvdUZkbEo5UmNjQXNqWVUvTGNmcVVBTExLSEJsUGtVZU96?=
=?utf-8?B?M0l4ck9mcGE5NlM4d1lZRWFhRE5uR2pBV0dZTGd4eUhsN1BFYUpXUXNiS0tk?=
=?utf-8?B?S2xqNmYvODlOVnVYMDl4NXJubGNKREU3MU1MUzRTVXJjK2gydDFKVWJSLy9l?=
=?utf-8?B?OFhQdXpGSXBONkF0blhpNkZuM2xSMmsxaVE5U0l6RWtTaDRsMXVYWWkzOWt5?=
=?utf-8?B?NTBQR3AxaGY4UzVHazZ1YkRmbXlQQ0FLT0ZHM3RZYzhhK0hsYm1CdTd3em9l?=
=?utf-8?B?QnhwVzdJUzh6RnVQRWFLektFaGR1SCt4ZmR1REw3TFZuN1FXNXVIZUE4UktP?=
=?utf-8?B?dHZsMEQzV21EVk1VamJibTZlalhLVElCM2VrMTNKNnJUYzIrdnBKeUM4NXRy?=
=?utf-8?B?a2tDMjNKUzNxY2FwN3pUM0hYeDkyQ2ZBd0Y2K2JsRG16cm1PQTdVdittZkx0?=
=?utf-8?B?Y3FYWkxrZm1LeTRFT2pNVkYrQ3dNQmJhTXJMZUVoSDVDY2RFbCswMmIzbkIw?=
=?utf-8?B?aEliRTZOOU5veTFhMi9Na05ETlFETllaMFdvTSsrSGliVFdhbENiTzRlLzIr?=
=?utf-8?B?TlhtRSszYkR0K3hYSzBPODVFeCs0TFZZL05nejg3UU1lWGlaeGlzN1Z4dytj?=
=?utf-8?B?elQzaHgxUjlYQlNQT3hBeUxFM20yNkVCQlVwUGZFdkkwN3dxcUZuMURYMEFS?=
=?utf-8?B?ZlcweC9ZZVZXejBwUUloZ1ZOZzBVRm9qelJLeEJ6bFROMTg3NGhYbDI0MnpT?=
=?utf-8?B?RUl3N25KUGFqSFhXRWFNNXVIZWM3L0gwQW5QcjE3MkpDOVB6cEtnQXRFUkRh?=
=?utf-8?B?eHBtWk9ZVCtOUCtPYzlwZ1BJT1Mza3NmNlZtTXdad1JONGZwRDJMZFBONjgx?=
=?utf-8?B?OEpPRWNPRElaZEQ1TEZOT2hNSjkxdGxLUEZ2UHhIaTNyZnZaVi82MEFMNEpw?=
=?utf-8?Q?arXxBGpL+uWz787iEbeiC6/3z?=
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-Network-Message-Id: d0c382d3-c1ff-4ee4-156b-08dda4f5b3e7
X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB5685.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 12:28:55.0649
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: T40f1gKNXrsaEu5jDZZYZq/4ELbagqijwCGDzOoXWxEIiY2EIcdAombfnZvgJtzI
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8536
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 13:48, Jocelyn Falempe wrote:
> If the ttm bo is backed by pages, then it's possible to safely kmap
> one page at a time, using kmap_try_from_panic().

I strongly assume that we don't care about locking anything in this case, don't we?

> Unfortunately there is no way to do the same with ioremap, so it
> only supports the kmap case.

Oh, there actually is on most modern systems.

At least on 64bit systems amdgpu maps the whole VRAM BAR into kernel address space on driver load.

So as long as you have a large BAR system you can trivially have access to the MMIO memory.

> This is needed for proper drm_panic support with xe driver.
>
> Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
> ---
>
> v8:
> * Added in v8
>
> drivers/gpu/drm/ttm/ttm_bo_util.c | 27 +++++++++++++++++++++++++++
> include/drm/ttm/ttm_bo.h | 1 +
> 2 files changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 15cab9bda17f..9c3f3b379c2a 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -377,6 +377,33 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,
> return (!map->virtual) ? -ENOMEM : 0;
> }
>
> +/**
> + *
> + * ttm_bo_kmap_try_from_panic
> + *
> + * @bo: The buffer object
> + * @page: The page to map
> + *
> + * Sets up a kernel virtual mapping using kmap_local_page_try_from_panic().
> + * This can safely be called from the panic handler, if you make sure the bo

"This can *only* be called from the panic handler..."

Apart from those open questions, looks sane to me.

Regards,
Christian.

> + * is the one being displayed, so is properly allocated, and won't be modified.
> + *
> + * Returns the vaddr, that you can use to write to the bo, and that you should
> + * pass to kunmap_local() when you're done with this page, or NULL if the bo
> + * is in iomem.
> + */
> +void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page)
> +{
> + if (page + 1 > PFN_UP(bo->resource->size))
> + return NULL;
> +
> + if (!bo->resource->bus.is_iomem && bo->ttm->pages && bo->ttm->pages[page])
> + return kmap_local_page_try_from_panic(bo->ttm->pages[page]);
> +
> + return NULL;
> +}
> +EXPORT_SYMBOL(ttm_bo_kmap_try_from_panic);
> +
> /**
> * ttm_bo_kmap
> *
> diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
> index cf027558b6db..8c0ce3fa077f 100644
> --- a/include/drm/ttm/ttm_bo.h
> +++ b/include/drm/ttm/ttm_bo.h
> @@ -429,6 +429,7 @@ int ttm_bo_init_validate(struct ttm_device *bdev, struct ttm_buffer_object *bo,
> int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
> unsigned long num_pages, struct ttm_bo_kmap_obj *map);
> void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
> +void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page);
> int ttm_bo_vmap(struct ttm_buffer_object *bo, struct iosys_map *map);
> void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct iosys_map *map);
> int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo);



Return-Path: <linux-kernel+bounces-675745-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C153841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:30:01 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id BA2CD3AE886
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:29:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B143288521;
Fri, 6 Jun 2025 12:29:55 +0000 (UTC)
Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 051A528750B;
Fri, 6 Jun 2025 12:29:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.181
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749212994; cv=none; b=eVPLpGvBd9uJDuiN2inDX8BxlxyXuiSVeE3oEnukqw/vIrpSaxhqttYbt2UynHqUv9ESpBgabmNMwts+IXbJD5mF1zy4tlanxxcIzx0mqKyWcXvDOt7qKLOvIDdOaoOGdROP/U6AyXmpCdxBXlPFUSj+zcqCYef5uV37VknL89Q=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749212994; c=relaxed/simple;
bh=Eat/Q7sTNEFbeM+og4RdCseFvpUP6zHJYmzUhvvvbgo=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=FPmGR3wb5cnTO5/sOGplRD6/jampjf9bHL2pl3eLoajs96bWrtTWJILK3QmSkrJow4pGrpPkrUShH1NNn/eArFvvH3SkjxPv6a8roTaOB8hSDVHSybZeJv1sNWNR5MAeq4dtFDYeBXbO+mrkOrCyvn2uxPYC2TB+hhJADFK+ztQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.181
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vk1-f181.google.com with SMTP id 71dfb90a1353d-527a2b89a11so868502e0c.2;
Fri, 06 Jun 2025 05:29:52 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749212991; x=1749817791;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=GExCOTG1sYNvAgix1/fBXT30B0whNEqEGmqvut8HF5k=;
b=GQqE/cAczPiF+LUBY+q0UQQHAM+ok6lJMO8d/TWUo5g3LJlGSnoab8D1i44M/gFmXr
ghCoVgDeqFiuQXDhcTIIx3rDZKzNSSt8MKhFbn3OQPlh+KNLuBPDZPAgIGf9rJWj8E2w
b9M8v8bSPeupGGIQT4yJ9x/B3XK28nrWQz8uocNvD2kQiAQDLK4wSH+xt9y/pEbHw3GK
4hGBjv8qKK4jI9HEGVqMe382iOTNbMGesqK7FVtFNyr+ZlDIyWYAGh6QNPblOotQMEYB
PuC83kRgH9XNhUHWRECeQdYQJob/Rry/ZInwzg6RI8TiPRi0vkxakLD9ebqNMME8qEmy
77PQ==
X-Forwarded-Encrypted: i=1; AJvYcCUGTNX6rX0Y3TvbzumU77Tr6fwv6mLpmvQ1lcG0MfYqZac/Dp4bTM2662i/ECaBSne38FPRqLv7fwxgA41K@xxxxxxxxxxxxxxx, AJvYcCV8r+Na3sfbf/XVtlkNh0iuqkKs+7UgMXlcvlPB2XhIZ2iXaV6bneAG/aQJIoVBgVSItodBrZ8MEmJrF+obofm3FZ4=@vger.kernel.org, AJvYcCXZuXuokY7BZAa6Lfk8/QIYN0BWYprnpOIAxR/9/5pPINqoMJVLqYVgonyool46DnU7Su8J4Mhr2ko=@vger.kernel.org
X-Gm-Message-State: AOJu0Yw0pv18eDddJJ0+8CgQAy/Tb1Nmix686YxgFHX/T18BgIb2weha
Mr2JHBnwsA62aDjTErvctdS4CQuum2Z5tkL/sD/Z2IqGlWoZFc1IRiMEaPXZadk4
X-Gm-Gg: ASbGncvF//cCIgXapnQTkxCMubP3E4EvQuCX2e6QFJ12UjFYIcLRG6/3OBLGOq8xy2s
dkdPAwWiS9JmfHj3J76qPQqz9qVeJD6JhThdse95IxFzw46aO82bTV+XGWj58DFRHQNdVvB3fPt
y2QXbCI19kYOyfvLtQAvCsI3G0W7ak0lof1grXLTGuqu4rmqUgFZQBlU7/yTzFnrjXEn1BX5TMY
KPHabsZ3gFTjfZvxIwPNlwlwNAXpdvel7Frikp6Oe5sIccr1V+41gYVaecHOUFoJllg/L8y+aw/
BGJ3yG6C8h6f9LYOWLmwqOlol7HBmg4Xu+lHSegl9/BE8oMcSldAmjq9NMXDuNem86/g4/SHiQP
n1/LWsC/qRteHgw==
X-Google-Smtp-Source: AGHT+IGhfSSx/FQtz45yoTXzGgleJm98RgxgTpenMFxS2Z6N0clfju7PjagGXadOQ3a2mHz52O8S5w==
X-Received: by 2002:a05:6122:7d0:b0:520:4996:7d2a with SMTP id 71dfb90a1353d-530e48ca509mr2686435e0c.10.1749212990923;
Fri, 06 Jun 2025 05:29:50 -0700 (PDT)
Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com. [209.85.217.54])
by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-530e63e4251sm1000242e0c.26.2025.06.06.05.29.50
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 05:29:50 -0700 (PDT)
Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-4e2b5ffb932so716250137.0;
Fri, 06 Jun 2025 05:29:50 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCVsZ3fwe68TxZdEgHgnakMZPHjYTQinTCZs8BWifr/TiDC3vEmouHIIAh8aWRYeFaZ+uZl7hTInnGurTjAS9oXSfBA=@vger.kernel.org, AJvYcCVzgy7ZIb/yNq9OIc2jU+n1H2cMzjt9PpVBwrWqc6ohOvnjQM+lXDdMgvdXvRCJXf4qBiQrAgbdOd8=@vger.kernel.org, AJvYcCXnRWD7I3fMm8hmV/YFeo4V2be01KUEGnQgEoOStRvmMc005KORx+B/mBI77m3NPfk2liW6a3Oy6srviOrw@xxxxxxxxxxxxxxx
X-Received: by 2002:a05:6102:808a:b0:4e5:980a:d164 with SMTP id
ada2fe7eead31-4e7726a12fdmr2694286137.0.1749212990462; Fri, 06 Jun 2025
05:29:50 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250528132558.167178-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250528132558.167178-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:29:38 +0200
X-Gmail-Original-Message-ID: <CAMuHMdWAnXWbvHXgLDLVxPWiNgWxsNN5Vt0jXGdcCG6_dRphbg@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFuPxJSj36WTA3iqYChcOwBqPHyk3xTsO7DLXF5cvYDJYarSbZFI5q1mA_A
Message-ID: <CAMuHMdWAnXWbvHXgLDLVxPWiNgWxsNN5Vt0jXGdcCG6_dRphbg@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] clk: renesas: r9a09g056: Add clock and reset entries for USB2.0
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Michael Turquette <mturquette@xxxxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>,
linux-renesas-soc@xxxxxxxxxxxxxxx, linux-clk@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Prabhakar,

On Wed, 28 May 2025 at 15:26, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Add clock and reset entries for USB2.0.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Thanks for your patch!

I couldn't review all details due to lack of the Additional Document,
but I assume it is the same as on RZ/V2H(P), so
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
i.e. will queue in renesas-clk for v6.17.


Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675746-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5248841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:31:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 50B463A5B81
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:31:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EBDF528850D;
Fri, 6 Jun 2025 12:31:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="CWynOh08";
dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="R3FcKnb1";
dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="CWynOh08";
dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="R3FcKnb1"
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67C8A2874FD
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:31:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213102; cv=none; b=l4ME4Zh2Z7Qk5dpCQdvkxmmsf6iYM3zKJ8kaiwmBM2527m9AmFpcDa9CI04rrwQoCMDfejZLeIL6FnxVmxQaQ9eZKi1AxlwL1p17FQ/CxSDkd4Y1NQHV/VBRoAXEMvQsWhM/wiWhNUrN+K2sb0YchaqIWLtydDHODIJAHK/AvaU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213102; c=relaxed/simple;
bh=4Fvn74tNuC5PvD23cKgIks483iXBpQWxvcKayuZZlyg=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=fG2jnsYcp5vcyWEWMCQ3sOIlqB/JmqDFDXYCD++7l+1ezWdSwDDmzshC9pU/Em94IDtD6j/EJVPptNZRPQa/czGCjYK/yGwqsciQwDF1QudTI5zZRhrDW5Ax1im26UnYROYUNzY9H1Bj7YoxJRE7vnukuKg6ICReiQzV1g/BuKM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=CWynOh08; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=R3FcKnb1; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=CWynOh08; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=R3FcKnb1; arc=none smtp.client-ip=195.135.223.130
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de
Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by smtp-out1.suse.de (Postfix) with ESMTPS id 7403A21DB8;
Fri, 6 Jun 2025 12:31:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
t=1749213098; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=BZFBjHP0yQlB4Ntb3LxgelCg+C+4S/iiLHzEXOeCxmE=;
b=CWynOh089i/FK+rgyRN5MJSyJQDC8IBSRyKG2T+zt5ie67bWJB8iFKpYWXIrOogyLYtqzx
qGpC0su+ADfRAQvz7MBk33HBQ4EgqZff1tHTMR66vUY/6sSGPBKut3a7lgjtKvTQx6IHXF
/Fcq6Wa2jcu9umgchm3ICIYuFA11Fvs=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
s=susede2_ed25519; t=1749213098;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=BZFBjHP0yQlB4Ntb3LxgelCg+C+4S/iiLHzEXOeCxmE=;
b=R3FcKnb1dwnVx3vNkKj8GViCfV79LiDAaw22EfDsJDDtyC57ztGgg+xhy4ybRd/xiYUMji
IOtrxtvT7zBLf2AA==
Authentication-Results: smtp-out1.suse.de;
dkim=pass header.d=suse.de header.s=susede2_rsa header.b=CWynOh08;
dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=R3FcKnb1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
t=1749213098; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=BZFBjHP0yQlB4Ntb3LxgelCg+C+4S/iiLHzEXOeCxmE=;
b=CWynOh089i/FK+rgyRN5MJSyJQDC8IBSRyKG2T+zt5ie67bWJB8iFKpYWXIrOogyLYtqzx
qGpC0su+ADfRAQvz7MBk33HBQ4EgqZff1tHTMR66vUY/6sSGPBKut3a7lgjtKvTQx6IHXF
/Fcq6Wa2jcu9umgchm3ICIYuFA11Fvs=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
s=susede2_ed25519; t=1749213098;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=BZFBjHP0yQlB4Ntb3LxgelCg+C+4S/iiLHzEXOeCxmE=;
b=R3FcKnb1dwnVx3vNkKj8GViCfV79LiDAaw22EfDsJDDtyC57ztGgg+xhy4ybRd/xiYUMji
IOtrxtvT7zBLf2AA==
Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DB43E1369F;
Fri, 6 Jun 2025 12:31:37 +0000 (UTC)
Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
by imap1.dmz-prg2.suse.org with ESMTPSA
id IGSqMqnfQmjaZAAAD6G6ig
(envelope-from <osalvador@xxxxxxx>); Fri, 06 Jun 2025 12:31:37 +0000
Date: Fri, 6 Jun 2025 14:31:36 +0200
From: Oscar Salvador <osalvador@xxxxxxx>
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v5 00/10]
Message-ID: <aELfqFrdIiwRFQs2@localhost.localdomain>
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<c4a96aa2-10ae-4dc1-abd8-be91f7e8b583@lucifer.local>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <c4a96aa2-10ae-4dc1-abd8-be91f7e8b583@lucifer.local>
X-Rspamd-Server: rspamd2.dmz-prg2.suse.org
X-Rspamd-Queue-Id: 7403A21DB8
X-Rspamd-Action: no action
X-Spamd-Result: default: False [-3.01 / 50.00];
BAYES_HAM(-3.00)[99.99%];
SUSPICIOUS_RECIPS(1.50)[];
NEURAL_HAM_LONG(-1.00)[-1.000];
R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];
NEURAL_HAM_SHORT(-0.20)[-1.000];
MIME_GOOD(-0.10)[text/plain];
MX_GOOD(-0.01)[];
TO_MATCH_ENVRCPT_ALL(0.00)[];
FREEMAIL_ENVRCPT(0.00)[gmail.com];
FUZZY_BLOCKED(0.00)[rspamd.com];
RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from];
TO_DN_SOME(0.00)[];
DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];
MIME_TRACE(0.00)[0:+];
ARC_NA(0.00)[];
FREEMAIL_CC(0.00)[linux-foundation.org,redhat.com,suse.cz,huawei.com,oracle.com,sk.com,gmail.com,kvack.org,vger.kernel.org];
RCVD_TLS_ALL(0.00)[];
DKIM_TRACE(0.00)[suse.de:+];
RCVD_COUNT_TWO(0.00)[2];
RCPT_COUNT_SEVEN(0.00)[10];
FROM_EQ_ENVFROM(0.00)[];
FROM_HAS_DN(0.00)[];
SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];
RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received];
RCVD_VIA_SMTP_AUTH(0.00)[];
TAGGED_RCPT(0.00)[];
MISSING_XM_UA(0.00)[];
ASN(0.00)[asn:25478, ipnet:::/0, country:RU];
DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]
X-Spam-Score: -3.01
X-Spam-Level:
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 12:30:42PM +0100, Lorenzo Stoakes wrote:
> Hi Oscar,
>
> I don't have time to dig into what's broken here, but this series is breaking
> the mm-new build.
>
> NODE_REMOVED_LAST_MEMORY for instance doesn't seem to be defined, but there's a
> bunch more errors.

Heh, I apologye, I assumed every config has MEMORY_HOTPLUG enabled.
(I'll walk on my knees all day long to make up for that!)

Fixup was posted this morning in

https://lore.kernel.org/linux-mm/aEKdvc8IWgSXSF8Q@localhost.localdomain/T/#u

But we can drop the patchset for now as I'll have to respin a new
version including David's feedback.


--
Oscar Salvador
SUSE Labs


Return-Path: <linux-kernel+bounces-675747-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9078241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:32:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id E22BB3A5F69
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:32:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 24A9928852F;
Fri, 6 Jun 2025 12:32:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CVqrVVfC"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DA25213E7A;
Fri, 6 Jun 2025 12:32:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213153; cv=none; b=tjB3eP/VMfuJWXzedi4oI5xc4GG3T6Bbfha3sXnNf+dvf/HPmXRb5cQzisxnL1tpx5H58UfaoWGbPJfcsMXuy+nPxFk7RnLDpVAUoHhCPtSHDWcVWcV+6MxUq3QQ4GCi16DYgnQzSD+0cIRIa0wFLTQ3vs/cLbBCd3WVF2RFhnk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213153; c=relaxed/simple;
bh=PNTM9e0vJhXMOaOlrgN0eJ6RCfLv95PaA3skUkIbaLI=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=XXB2/1A+HjWZA7YoSf1Vp5yhtpJ5yLFFe+bLAnh8N/hBXbGBhwjJR7jP/RoFkAKwlTatxFhfTSdUT1G0tCbSO2r9+h0UvrTx50VSKU80W9TZMNE4r4sOBZE4nkdX8Gz3X1WvIe4mwMUb36aTpLSedv8laboqfFKaffiGj/wdd3Y=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CVqrVVfC; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8C81C4CEEB;
Fri, 6 Jun 2025 12:32:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749213152;
bh=PNTM9e0vJhXMOaOlrgN0eJ6RCfLv95PaA3skUkIbaLI=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=CVqrVVfCo5lRiWF/yTc2KkGAnzUBdKUnY/E0/uW2KsVM1DKeNmhvjEqjiqkxGW9EO
Ay99FjxewkAYgK40NjjTR5n2+evtmC7r+Pd/HGxRYLe1j34CKxqjlsr7ypagSdgG3X
TLw2f454o9jv4gkToaKATOa2HaHruKzwwRiF2x4uxXTq7VBC4xILTzMVaSrINchezR
DO1C0g018cudAnGU3QMQBArJAG3zT7hXVsBSSL/gNpDBA65d+UfTB5eupOvXFVkuJV
ge6Qr5dEnHDgyl3lWRpRKKr93No5GNHpwXn11OeOcebCrxQB1dbOEMd1qf+z+oPMl1
/dAdq5qYRMKfQ==
Received: from johan by xi.lan with local (Exim 4.97.1)
(envelope-from <johan@xxxxxxxxxx>)
id 1uNWFJ-0000000071Z-0Iw3;
Fri, 06 Jun 2025 14:32:29 +0200
Date: Fri, 6 Jun 2025 14:32:29 +0200
From: Johan Hovold <johan@xxxxxxxxxx>
To: Sasha Levin <sashal@xxxxxxxxxx>
Cc: patches@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx,
Brian Norris <briannorris@xxxxxxxxxxxx>,
Thomas Gleixner <tglx@xxxxxxxxxxxxx>, matthias.bgg@xxxxxxxxx,
angelogioacchino.delregno@xxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-mediatek@xxxxxxxxxxxxxxxxxxx,
Aleksandrs Vinarskis <alex.vinarskis@xxxxxxxxx>
Subject: Re: [PATCH AUTOSEL 6.15 092/110] genirq: Retain disable depth for
managed interrupts across CPU hotplug
Message-ID: <aELf3QmuEJOlR7Dv@xxxxxxxxxxxxxxxxxxxx>
References: <20250601232435.3507697-1-sashal@xxxxxxxxxx>
<20250601232435.3507697-92-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250601232435.3507697-92-sashal@xxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Sun, Jun 01, 2025 at 07:24:14PM -0400, Sasha Levin wrote:
> From: Brian Norris <briannorris@xxxxxxxxxxxx>
>
> [ Upstream commit 788019eb559fd0b365f501467ceafce540e377cc ]
>
> Affinity-managed interrupts can be shut down and restarted during CPU
> hotunplug/plug. Thereby the interrupt may be left in an unexpected state.
> Specifically:
>
> 1. Interrupt is affine to CPU N
> 2. disable_irq() -> depth is 1
> 3. CPU N goes offline
> 4. irq_shutdown() -> depth is set to 1 (again)
> 5. CPU N goes online
> 6. irq_startup() -> depth is set to 0 (BUG! driver expects that the interrupt
> still disabled)
> 7. enable_irq() -> depth underflow / unbalanced enable_irq() warning
>
> This is only a problem for managed interrupts and CPU hotplug, all other
> cases like request()/free()/request() truly needs to reset a possibly stale
> disable depth value.
>
> Provide a startup function, which takes the disable depth into account, and
> invoked it for the managed interrupts in the CPU hotplug path.
>
> This requires to change irq_shutdown() to do a depth increment instead of
> setting it to 1, which allows to retain the disable depth, but is harmless
> for the other code paths using irq_startup(), which will still reset the
> disable depth unconditionally to keep the original correct behaviour.
>
> A kunit tests will be added separately to cover some of these aspects.
>
> [ tglx: Massaged changelog ]
>
> Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Link: https://lore.kernel.org/all/20250514201353.3481400-2-briannorris@xxxxxxxxxxxx
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

This one breaks suspend of laptops like the Lenovo ThinkPad T14s. Issue
was just reported here by Alex:

https://lore.kernel.org/lkml/24ec4adc-7c80-49e9-93ee-19908a97ab84@xxxxxxxxx/

Please drop from all stable queues for now.

Johan


Return-Path: <linux-kernel+bounces-675748-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C211C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:32:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id ED01218975F3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:33:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E9F70288C05;
Fri, 6 Jun 2025 12:32:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="CBAKSw+f";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TH90LD6l"
Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144])
(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 18D282874FD;
Fri, 6 Jun 2025 12:32:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213168; cv=none; b=ZUf5IZzyv9g0JvJYvhoei4f2vJ8L3OOl77djYTLBIGz5jr8UhQwHQxsQTF+np4niNGvS4IpNm+uHm/SohNeocKn4XKXe8B0n6P0WXfHVutekLYGeSlteXvduQQLaGTcmWFDLy5+Q5VMXhifVNyD7DCiwFvQZMbNi4s/rPHTrk3Q=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213168; c=relaxed/simple;
bh=VfMJbgI6+Va2HlS14BKQfeSmAAZDJKqJta7tPbt6A2Q=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=IIIEHr1hpQiUa0UMTXS5g9SIXO97B/H3y0EmgD7Z/ZwRtMVyaqi+kg71hKxJBwC9P04myJAt24BA+AYBbHh1i9ynAA0+9VTHvxT/aPA8GNmDTVGq0tShuycNNbMzy/twfHcfVnW6ca4cIECFQZjzIPsQPVo/vbWQAgH5uNJKjwc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=CBAKSw+f; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TH90LD6l; arc=none smtp.client-ip=103.168.172.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se
Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41])
by mailfout.phl.internal (Postfix) with ESMTP id 46CF21380389;
Fri, 6 Jun 2025 08:32:46 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
by phl-compute-01.internal (MEProxy); Fri, 06 Jun 2025 08:32:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm3; t=1749213166;
x=1749299566; bh=HPIAifU+UcaEAaPCiVEIuHnUY6hZnG7Z1iHdlmvHPAo=; b=
CBAKSw+fniOt4tdCZo/m/9E7RSH1uUI5rdvJUwW0PmqJsmN2WHIOgmZ4WW2h6qvq
gQbDPobOGRYDSqt0DGfQp+VJf6Dvy1DpAJZsACXEFAwIHri0KskIOH1CbB1nPP1K
RZifZ47qrquB8vH6K7C0Sfn3u3FciQl3uVbgYgBhN9hhF15HB+PNKO1p2BoecrGK
Kv8ymP5dsPkoMRl0ywvy/K7DeotV50HzGaEku/cY8ajNuij9M0KCsDCmofD3fd78
gdX9c6bdqa6fPbShBUjbYJrAcS6Pjgk/tM2NPCDXyMDObgLGFfqS9ojSTF40TyBw
LJs7gnu15fiYohkaWwOZdg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749213166; x=
1749299566; bh=HPIAifU+UcaEAaPCiVEIuHnUY6hZnG7Z1iHdlmvHPAo=; b=T
H90LD6lHWo0G+6Nk+T1PN1nS7MHs091yZR5JzcXcnTrSn5vH+IqnMK6lvYX/J/Ej
u7GIMeLFURICnvApM4DvyOrUuptGG5nHdQYpKatmE36b4TynQ6qgalgjd8FGnX55
p6EuJ314G2AwHsYQ2awl1sd1h/Qd5zgWdkBPTh2WVIr4XoLWmhXPgBsn0054rnBO
9cmAj3QKnBT4fzMCa/BDqoq6SXw9D2dfb0TmIoCY91FzqjGneM3LhNQ2YouoY566
HhR7yeSGc+O3JPsKNp1VOLVxRT1DF3QZ87H6arl4hTrhThgjBDBhdurFfhj9x/NB
54U7GtQWke/z7kHjin2SQ==
X-ME-Sender: <xms:7t9CaLu6GFBFcBuRMHpySN4rnZZ8nZFh8IuE_gvb7WTrvRsHHS0i7Q>
<xme:7t9CaMefpeiyGTXq89K4nQh1XVTgOuXklfEeW7LKbqaNtagshYQYfLPdRUJai4qYr
Gk6-ptsprJTxpla6rI>
X-ME-Received: <xmr:7t9CaOwp5rBppbKowAybQVFAkBBfUtvxpr8eIsYjvWt95umOAJOzRX8O483m640Hp2M-AZikE4_l4ciqbNHLRQyhJXFgHp3_OQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehtdelucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej
necuhfhrohhmpefpihhklhgrshcuufpnuggvrhhluhhnugcuoehnihhklhgrshdrshhoug
gvrhhluhhnugesrhgrghhnrghtvggthhdrshgvqeenucggtffrrghtthgvrhhnpefftdeg
feevfefguedtveevlefgleekuedvfeeggfefheefieejhedulefhjeekgfenucffohhmrg
hinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm
pehmrghilhhfrhhomhepnhhikhhlrghsrdhsohguvghrlhhunhgusehrrghgnhgrthgvtg
hhrdhsvgdpnhgspghrtghpthhtohepledpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
ohepthhomhhirdhvrghlkhgvihhnvghnodhrvghnvghsrghssehiuggvrghsohhnsghorg
hrugdrtghomhdprhgtphhtthhopehmtghhvghhrggssehkvghrnhgvlhdrohhrghdprhgt
phhtthhopehsrghkrghrihdrrghilhhusheslhhinhhugidrihhnthgvlhdrtghomhdprh
gtphhtthhopehlihhnuhigqdhmvgguihgrsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhr
tghpthhtoheplhhinhhugidqrhgvnhgvshgrshdqshhotgesvhhgvghrrdhkvghrnhgvlh
drohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgv
lhdrohhrghdprhgtphhtthhopehmtghhvghhrggsodhhuhgrfigviheskhgvrhhnvghlrd
horhhgpdhrtghpthhtoheplhgruhhrvghnthdrphhinhgthhgrrhhtsehiuggvrghsohhn
sghorghrugdrtghomhdprhgtphhtthhopehjrggtohhpohdrmhhonhguihesihguvggrsh
honhgsohgrrhgurdgtohhm
X-ME-Proxy: <xmx:7t9CaKNNHa5KJhQ2ZFZcMVysl0_A3Xuqm8vEDv3QuY2Q-yQbRg7fFQ>
<xmx:7t9CaL9Ewp7KVZSDBpAF9xf7U74j9m2KDX0deoNzys7iJewEK0ZImQ>
<xmx:7t9CaKV7daV4s0iMhXSl43HbqvVAjhBve8EUmMXc0daB6tPW7Mwmrg>
<xmx:7t9CaMd01YQngZBkCLrH_sJrKo7PVGK5stVgYYBbnYjCWyjmjYV1UQ>
<xmx:7t9CaC2u6PO2-BjohjHk64f5C4gEA8HaxZralPVG3DRG20HFugRPH0N4>
Feedback-ID: i80c9496c:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 08:32:45 -0400 (EDT)
Date: Fri, 6 Jun 2025 14:32:44 +0200
From: Niklas =?utf-8?Q?S=C3=B6derlund?= <niklas.soderlund@xxxxxxxxxxxx>
To: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
linux-media@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 00/15] media: rcar: Streams support
Message-ID: <20250606123244.GJ2770609@xxxxxxxxxxxx>
References: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250530-rcar-streams-v3-0-026655df7138@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tomi,

On 2025-05-30 16:50:29 +0300, Tomi Valkeinen wrote:
> Add streams support to Renesas rcar platform driver.
>
> The series attempts to keep compatibility with the current upstream.
> However, in upstream there's some kind of custom multi-stream support
> implemented to the rcar driver, which breaks at patch "media: rcar-csi2:
> Simplify rcsi2_calc_mbps()".
>
> The behavior should not change when using a single stream.
>
> Testing is problematic, as the only way currently for me to get multiple
> streams is by using the GMSL2 deserializer add-on board with GMSL2
> serializers. These are not supported in upstream. If someone has the
> hardware and wants to test, I can share the very-WIP branch that
> contains the missing pieces.

I'm happy to see this new version of this work, it looks so clean! I'm
equally happy to see all the hard-coded assumptions we needed in the
pipeline to emulate streams before being replaced with core
functionality!

I have tested this with the single stream use-cases I have had before on
Gen2, Gen3 and Gen4 and they all seem to function as before, nice work!

Tested-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

As this is a rather large series do you think it would make sens to try
and get some of the preparation/clean up patches merged before the new
streams support?

>
> Tomi
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
> ---
> Changes in v3:
> - Rebased on top of latest linux-media
> - Dropped dependencies which are already in linux-media (only remaining
> dependency is v4l2_subdev_get_frame_desc_passthrough)
> - Tested on white-hawk board, using the staging deser TPG
> - Also tested in a WIP branch for GMSL2 (two video streams)
> - Link to v2: https://lore.kernel.org/r/20250326-rcar-streams-v2-0-d0d7002c641f@xxxxxxxxxxxxxxxx
>
> Changes in v2:
> - Rebased on top of latest upstream, and updated the dependencies to
> match the latest serieses sent.
> - Add new patch "media: rcar-csi2: Use the pad version of v4l2_get_link_freq()"
> - Drop "media: rcar-csi2: Fix typo" (it was not a typo)
> - Update the code in calc_mbps(). The previous method relied on
> V4L2_CID_LINK_FREQ, but that's not available if the link-freq is
> provided via get_mbus_config().
> - Dropped dependencies to Niklas' old series which doesn't apply
> cleanly. It's needed for multi-stream, but not for the current
> upstream which only has a single stream use case.
> - Link to v1: https://lore.kernel.org/r/20250219-rcar-streams-v1-0-f1b93e370aab@xxxxxxxxxxxxxxxx
>
> ---
> Tomi Valkeinen (15):
> media: rcar-csi2: Use the pad version of v4l2_get_link_freq()
> media: rcar-isp: Improve ISPPROCMODE_DT_PROC_MODE_VC
> media: rcar-isp: Move {enable|disable}_streams() calls
> media: rcar-csi2: Move {enable|disable}_streams() calls
> media: rcar-csi2: Move rcar2_calc_mbps()
> media: rcar-csi2: Simplify rcsi2_calc_mbps()
> media: rcar-csi2: Optimize rcsi2_calc_mbps()
> media: rcar-csi2: Switch to Streams API
> media: rcar-isp: Switch to Streams API
> media: rcar-csi2: Add .get_frame_desc op
> media: rcar-isp: Call get_frame_desc to find out VC & DT
> media: rcar-csi2: Add more stream support to rcsi2_calc_mbps()
> media: rcar-csi2: Call get_frame_desc to find out VC & DT (Gen3)
> media: rcar-csi2: Add full streams support
> media: rcar-isp: Add full streams support
>
> drivers/media/platform/renesas/rcar-csi2.c | 426 +++++++++++++++++-------
> drivers/media/platform/renesas/rcar-isp/csisp.c | 228 ++++++++++---
> 2 files changed, 479 insertions(+), 175 deletions(-)
> ---
> base-commit: 5e1ff2314797bf53636468a97719a8222deca9ae
> change-id: 20250219-rcar-streams-1fdea8860e5e
> prerequisite-change-id: 20250218-frame-desc-passthrough-66805e413974:v4
> prerequisite-patch-id: bce4a915a29a64f88ed1bb600c08df37d2ba20c6
> prerequisite-patch-id: 69b75e7dad9ced905cb39a72f18bebbf3e8f998a
> prerequisite-patch-id: 58463f6944c76acd6cf203b14a2836cdb0db2461
>
> Best regards,
> --
> Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
>

--
Kind Regards,
Niklas Söderlund


Return-Path: <linux-kernel+bounces-675749-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 54EB241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:33:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8E75916622F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:33:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B488288517;
Fri, 6 Jun 2025 12:33:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="QQPPGsWv"
Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131])
(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 A9B8A213E7A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:33:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213222; cv=none; b=QMaOUWGfS2sdND/HBwy63CIJwlHlYSTMQOII33Z3P2cPwolSRnDSqk8hXlWNB5iB7gRu/AVuHnteU9duSoc460c2q4HgsvwLdUwuthrPhzmQootR/Uot0/UZ4LPPG7aj2Y+cTtoX2aYpJjLpwTIVM6A1jUG9pvapbBikqjfYMgI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213222; c=relaxed/simple;
bh=ivddDW5T1J4JyvrdspbZFEYi06jSdvMZOcvhE69syLI=;
h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=MhsjMnqDtTyj+DNrKBmGO0fH72O9lDFL8tgOJthjt+yVhsFa2u09eSgxSfJYyA1Mj5IphhlGopaPC1y7f/Bk5IoNonQTyUyZ9ATglZe8wglfQLiumUtl+3Q/1zNBHm0LeHEw2OFAvtHUlkjLh//I509SkigdYOS1naV/u+ckxpk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=QQPPGsWv; arc=none smtp.client-ip=205.220.168.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com
Received: from pps.filterd (m0279865.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5566UHvT007396
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:33:39 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=
cc:content-transfer-encoding:date:from:message-id:mime-version
:subject:to; s=qcppdkim1; bh=s8QIRnPERxawgaDmjJObpuottssSVfUeoUh
Fx/MyZdI=; b=QQPPGsWvIG7XglAeGf4kRQpZ3C9kG3w7hKeUxNtRzAdHxvtyFJ8
bVnyUyRSiAFiubPR9a3meNVq6VlGBiV40s3Cj6rVDYptXpPo7biWdmb8v+laOu8D
h0x+ZOpF9rV2HB7dBeQWC6Q9kuTyt3jF9x7H9FloZKuPb87Z50yn3CHXoKd305O+
zcUNRvcfqMMLY/3aHp6yt0/2+jPXLet1hjZ0+ZpUd3nYbJAKxFbbxP7Of/0/ywnI
jb/cR38OQWp4LA++0oVQm5k0M3m+0RtnBhOw28EDOftODzLxKsCD16M0zQkGHRpd
oJgEbq5hN3LtJTypac+szaggIZZQjye41Ug==
Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8t4jdu-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 12:33:39 +0000 (GMT)
Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6face1d593bso36542626d6.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:33:39 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749213218; x=1749818018;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=s8QIRnPERxawgaDmjJObpuottssSVfUeoUhFx/MyZdI=;
b=iqFDINzqmxicqKPG+8hHnpM8StLMpb35ew9/PEO4p9wcV97CLMmXgZ0rEGu0hQCeLu
4LpTuh59dEHoMLL20YD0mwp5Lc88jWjFsY2oTDCc6vssJ5sJC+44pNLdY07XdhJVamfQ
56PL9VDeWSI96+qtnj0YNRVLC5pE76b9a99QgetGm6jGDPqKyLfkDryxST8kmorCidb0
Ub0WTnmjvzjHmaKoqJPfsEB4R7H3hrPJryLElQrGw6+RT1J9IOL4bb6aTyztXQNrAWEp
zZNrZgpHxO8r62UgEBbsJAYKXg6qVKxMQJ0RdrApdMAF473Y1ndGMrXAMqNPNVHzM7yp
/Fjg==
X-Forwarded-Encrypted: i=1; AJvYcCVBoDlXXj4mYY5ARKTaWxJsUg1JrUobVSDjzULxrs3Oz/xs3yniWBcYvjtL6sy4srdrH+v07dTvUKTNOwc=@vger.kernel.org
X-Gm-Message-State: AOJu0YxpKWPS+7scfxtAyCUzz0Ryb8RG5j/TKRPfWSqu/pdQPtb/GlIf
hU7ni0oYEfsnTsaQCJ+3r/zb5qf5S8Oo3xrwLUgkOpjZNMqgmlKkaJYxxq+XgWbbwcWzARXOKuV
7jPGQPyYqREd0xpcmNJ+AMCx+uchRgPaDR9wIBRB2oBHw0+EJzFgtaO58MzbNQ6Dcr/Y=
X-Gm-Gg: ASbGnct5OnYjNHI4qg0euBfGpoCrzu0bmT13fkZ9am4H33kLLXqQabLd+2oFqGIp9y6
NCksjJ2CHngYfpChOTC8WrTxli2P0EvDInA8AT2G8E4Jqc2c93mEMjdpHaISLxdMEkMmjxpEHMt
8EdK83NktGXYRnb5WDWaZxwu8KL62mZeYdLclIwegDbVBtwAA64rWXbewhCKtAKvB3GFwtW+b++
f/7dye048qmYo5tPvMJqWZxdS7zphhlT67NKpHDM7d2VqUvxRCWaPF0/GC3TGS59PMlvM9zlaCm
QFtFTDL0OHBbAdq9Gllz6gbr7plmdUzvMAe/Rg2a5TUC2gcQG5YTDkfOH+M3oeX6Xw==
X-Received: by 2002:ad4:5ced:0:b0:6eb:28e4:8519 with SMTP id 6a1803df08f44-6fb08f86d87mr50834766d6.21.1749213218274;
Fri, 06 Jun 2025 05:33:38 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHq0LfKT7V7Hdr9+7FwMCh7gMOKBUV5KaU9c5KLNxPHvFir0fRLD3304/1mkrTlVrjWvgwZcg==
X-Received: by 2002:ad4:5ced:0:b0:6eb:28e4:8519 with SMTP id 6a1803df08f44-6fb08f86d87mr50834576d6.21.1749213217966;
Fri, 06 Jun 2025 05:33:37 -0700 (PDT)
Received: from trex.. (142.red-79-144-193.dynamicip.rima-tde.net. [79.144.193.142])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-451f8f12e16sm33777225e9.1.2025.06.06.05.33.36
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 05:33:37 -0700 (PDT)
From: Jorge Ramirez-Ortiz <jorge.ramirez@xxxxxxxxxxxxxxxx>
To: jorge.ramirez@xxxxxxxxxxxxxxxx, quic_vgarodia@xxxxxxxxxxx,
quic_dikshita@xxxxxxxxxxx, bryan.odonoghue@xxxxxxxxxx,
mchehab@xxxxxxxxxx
Cc: linux-media@xxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCHv2] media: venus: protect against spurious interrupts during probe
Date: Fri, 6 Jun 2025 14:33:34 +0200
Message-Id: <20250606123334.4114123-1-jorge.ramirez@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Authority-Analysis: v=2.4 cv=RMizH5i+ c=1 sm=1 tr=0 ts=6842e023 cx=c_pps
a=oc9J++0uMp73DTRD5QyR2A==:117 a=jucdD076RO8dzeEYkB3eYw==:17
a=6IFa9wvqVegA:10 a=EUspDBNiAAAA:8 a=VOU_bqPf6nVU0ntsUH0A:9
a=iYH6xdkBrDN1Jqds4HTS:22
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDExMyBTYWx0ZWRfX4rSmloO1RiZ2
j6nDnlOUPcgBCk2etBJ3tSoAth5/Q+d+6dj5lhWz+qG9zTJGr/w7wf7V2mSDAVTAzLEZr9DqYS0
RhfVrVn9Cuc+zRtUwW08b6f1/rv06660Api9ozISp28y85pOAzJssh9QgaxwXWNWWYjszsqr9ye
Y85J+6hBWkoxoTodxH+GxsUgsX2h6I48kl4XoYLf3njRSYt4voM+fFMmadhUXp5SZlQXVSf8AdF
I6YtkN6Gke2kF5E4VAXod9lZnDV0s62/7Mj7LuUI8/GGiPX3r6lkc5exT7OCqTVoUJJrirUziqz
itRMWH2+oRoO8uG1TPAjuJUsAFaCpTXw2dcCHhDAH+GfoHxBgon1n/QyqyGUUY5PyqkGRMhRBB3
9WeUb/fZNdruKbHrskbaANzxy7xMUtKGcG0OsnXAVlodaJfJs58qTbe2xGa17J60Bfpuif79
X-Proofpoint-GUID: RR9YBfIPaQk5kMNrdHV26W2qT4KaH3rU
X-Proofpoint-ORIG-GUID: RR9YBfIPaQk5kMNrdHV26W2qT4KaH3rU
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
impostorscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0
bulkscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 mlxscore=0
clxscore=1011 priorityscore=1501 classifier=spam authscore=0 authtc=n/a
authcc= route=outbound adjust=0 reason=mlx scancount=1
engine=8.19.0-2505280000 definitions=main-2506060113
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Make sure the interrupt handler is initialized before the interrupt is
registered.

If the IRQ is registered before hfi_create(), it's possible that an
interrupt fires before the handler setup is complete, leading to a NULL
dereference.

This error condition has been observed during system boot on Rb3Gen2.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@xxxxxxxxxxxxxxxx>
---
v2: fix authorship
fix spelling mistake

drivers/media/platform/qcom/venus/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index d305d74bb152..5bd99d0aafe4 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
init_waitqueue_head(&core->sys_err_done);

- ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "venus", core);
+ ret = hfi_create(core, &venus_core_ops);
if (ret)
goto err_core_put;

- ret = hfi_create(core, &venus_core_ops);
+ ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
+ IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ "venus", core);
if (ret)
goto err_core_put;

--
2.34.1



Return-Path: <linux-kernel+bounces-675750-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B1B1841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:34:23 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 84DAA3A8F04
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:34:01 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 893EE288C02;
Fri, 6 Jun 2025 12:34:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="iYmgYv6/"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 3089C287513;
Fri, 6 Jun 2025 12:34:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213255; cv=none; b=G8iXrBezfv9C8553UGPZcc2bdvCoXrD8OFA91rdFOA1OHd9iYtuFTx2o7xvTRg1eTQQC9ZgmHDYk6FdxkLQIndmFzKWNWYF1KdAgcuTrSPFmsLr6ewkQFnuadENV04AYyxkd8Laer9XaV0QX+BjxTZWfU0lEdgX8r4fvvDx1PGw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213255; c=relaxed/simple;
bh=KUB1zHF41EieIHY6D7XrX8haH8SMgp958TtlLmEVyME=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=mykdciOsmDGJsy6nkPZYELNGfEbpBVvFgYCQ4CWHqYEahncwDGmiGZGHiz/GxLIPXY4izC6oajb5bUdypuVC/pXqd6JlQ34Rr3tJ5BwLXD3YAHsE1ozBuFShdn+IFJyt9FDOM3bKvW4hzJuwLTw1MjgtQ6s5svMROTPWuh3+8Ww=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=iYmgYv6/; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 00E1811DD;
Fri, 6 Jun 2025 14:34:06 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749213247;
bh=KUB1zHF41EieIHY6D7XrX8haH8SMgp958TtlLmEVyME=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=iYmgYv6/bkOqUY27LwbLH8YpzTftPCEyojGssCbFJDNzi/e7NTTfKskNvC6JTRalL
weTLpS/8iDMAjVRE9f4JNBoBaRviTxp+dQ7r2//TfTQYSbQpKveA36ua5KsYHRFkoe
Jp4lyDEB7i1raRFKlZvqzbOwFywnH6ytawPeQg9k=
Date: Fri, 6 Jun 2025 15:34:00 +0300
From: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
To: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Cc: kieran.bingham@xxxxxxxxxxxxxxxx, rmfrfs@xxxxxxxxx, martink@xxxxxxxxx,
kernel@xxxxxxx, mchehab@xxxxxxxxxx, shawnguo@xxxxxxxxxx,
s.hauer@xxxxxxxxxxxxxx, kernel@xxxxxxxxxxxxxx, festevam@xxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx, imx@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 1/2] media: platform: Refactor interrupt status registers
Message-ID: <20250606123400.GB27510@xxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
<20250606121403.498153-2-isaac.scott@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20250606121403.498153-2-isaac.scott@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Isaac,

Thank you for the patch.

On Fri, Jun 06, 2025 at 01:14:02PM +0100, Isaac Scott wrote:
> The NXP i.MX 8 MP CSI-2 receiver features multiple interrupt and debug
> status sources which span multiple registers. The driver currently
> supports two interrupt source registers, and attributes the
> mipi_csis_event event entries to those registers through a boolean debug
> field that indicate if the event relates to the main interrupt status
> (false) or debug interrupt status (true) register. To make it easier to
> add new event fields, replace the debug bool with a 'status index'
> integer than indicates the index of the corresponding status register.
>
> Signed-off-by: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>

Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

> ---
> drivers/media/platform/nxp/imx-mipi-csis.c | 64 +++++++++++-----------
> 1 file changed, 31 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> index d060eadebc7a..bbc549c22aff 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -249,7 +249,7 @@
> #define MIPI_CSI2_DATA_TYPE_USER(x) (0x30 + (x))
>
> struct mipi_csis_event {
> - bool debug;
> + unsigned int status_index;
> u32 mask;
> const char * const name;
> unsigned int counter;
> @@ -257,30 +257,30 @@ struct mipi_csis_event {
>
> static const struct mipi_csis_event mipi_csis_events[] = {
> /* Errors */
> - { false, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO Overflow Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong Configuration Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type Not Supported" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type Ignored" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame Size Error" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early Frame End" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early Frame Start" },
> + { 0, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO Overflow Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong Configuration Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type Not Supported"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type Ignored"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame Size Error"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early Frame End"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early Frame Start"},
> /* Non-image data receive events */
> - { false, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even frame" },
> - { false, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image data after even frame" },
> - { false, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image data before odd frame" },
> - { false, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image data after odd frame" },
> + { 0, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even frame"},
> + { 0, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image data after even frame"},
> + { 0, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image data before odd frame"},
> + { 0, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image data after odd frame"},
> /* Frame start/end */
> - { false, MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start" },
> - { false, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge" },
> + { 0, MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start"},
> + { 0, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge"},
> };
>
> #define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
> @@ -765,32 +765,30 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)
> struct mipi_csis_device *csis = dev_id;
> unsigned long flags;
> unsigned int i;
> - u32 status;
> - u32 dbg_status;
> + u32 status[2];
>
> - status = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
> - dbg_status = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
> + status[0] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
> + status[1] = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
>
> spin_lock_irqsave(&csis->slock, flags);
>
> /* Update the event/error counters */
> - if ((status & MIPI_CSIS_INT_SRC_ERRORS) || csis->debug.enable) {
> + if ((status[0] & MIPI_CSIS_INT_SRC_ERRORS) || csis->debug.enable) {
> for (i = 0; i < MIPI_CSIS_NUM_EVENTS; i++) {
> struct mipi_csis_event *event = &csis->events[i];
>
> - if ((!event->debug && (status & event->mask)) ||
> - (event->debug && (dbg_status & event->mask)))
> + if (status[event->status_index] & event->mask)
> event->counter++;
> }
> }
>
> - if (status & MIPI_CSIS_INT_SRC_FRAME_START)
> + if (status[0] & MIPI_CSIS_INT_SRC_FRAME_START)
> mipi_csis_queue_event_sof(csis);
>
> spin_unlock_irqrestore(&csis->slock, flags);
>
> - mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status);
> - mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, dbg_status);
> + mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status[0]);
> + mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, status[1]);
>
> return IRQ_HANDLED;
> }

--
Regards,

Laurent Pinchart


Return-Path: <linux-kernel+bounces-675751-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A69EA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:35:43 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 3EA23189726B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:35:57 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8884C28852D;
Fri, 6 Jun 2025 12:35:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VdV/OTlJ"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 E4CEC287513
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:35:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213335; cv=none; b=ICm7YPycLKcs3X8ims7CDSk0YNLh4EmDGpgFSPQpUcdprWMivPl414hKUD5C47kOtLz/Sd8UDWSvmA5r1VHOHYHQmq+fngcIn25dWkfIORoAC6o+xiBoQ04NjAPB2K2FTIrxUfp1aKlWcaXz4uWRTA0IEhstRRX9F5RMjERCW/o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213335; c=relaxed/simple;
bh=kpRINIUUT3cNR5P8bR7a4qNj9t6jrjVfH1S2gblGSHM=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=VmKIWDQSpwkh8iiETuU+Q3kCd4CE7oa0NCV0wd0v99EFrcAHbj0ZKjkmlrIvQHraSPPVIYYOP1qMoqbsqROGmmjsHb8UBk2wECvYnC/OADJs5MoqhR2/KTvCVT/VhXIAyAl2go8KhVPhlvHuiwONZdR8gOBpiF8hUUaIx5eCHys=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VdV/OTlJ; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749213332;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=sSb0ikd6dE0bNHJf4fDasJAbxnz21Z9UlDYPOcjiVX4=;
b=VdV/OTlJmud2hXMtcpQGU1m6bz/J39Z9DEutp6WbqjNt74cvsTm9ozaKSMUZ+GUeMFskDb
v/DoP2rRu7a1RIYBzBDCZOhzQy+YVTMaL7ZJEgU91ggrMtxT0nPrJK4w6PfdhS8uJEPprO
xFPG+TqSspMXm1zPoFUzLvvCDw6ee60=
Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com
[209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-636-bi0XcQL4Ot2fNu3OXGir2A-1; Fri, 06 Jun 2025 08:35:31 -0400
X-MC-Unique: bi0XcQL4Ot2fNu3OXGir2A-1
X-Mimecast-MFC-AGG-ID: bi0XcQL4Ot2fNu3OXGir2A_1749213330
Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-441c122fa56so10407855e9.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:35:31 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749213330; x=1749818130;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=sSb0ikd6dE0bNHJf4fDasJAbxnz21Z9UlDYPOcjiVX4=;
b=IrN4Kr4JYhOAOXu9S2T7t8JPDkv7js4ze/Sb/0fx0sjBZx4dqeov/EJ7jJQ8oQer87
bRUXbXPk3ynv6P7rUDryUTdLFcOwob+43F/pmukS2L9gDRnj2elcUYj3EPv5iyw8h2V7
c0MP+uUpJsB+xvH5kPFbHdrk2bBDOT+MxTmTkAjiq2fn0QUq526XSgQG4pRXssVbae8i
LS4E60w4NyrWVv6P/pjOd/vnkvRqZQKj/dY+o6wHH8BorfULC60mhN8CayuN1VG0Taex
TPkZZb5MoZ9CKt5pqchpzRMM/nPUdVT5n1FWueVDI7Ia6ZNfsiNMZBfQd8lxND2pwdRG
0oWg==
X-Forwarded-Encrypted: i=1; AJvYcCXbkb2cK1rN2lykOO7F94fJoj4PHXJpNIU4v5XiiGRAMea+VJK7RybdlIJRHyC3U7g8wQf5vwKFU8cZQD0=@vger.kernel.org
X-Gm-Message-State: AOJu0YzLvzmcrkF1lvR4i7HA8NkxIAHQkakk/+utdw2T8ouACD6dkgox
0W2AeUuipnQ3ONEy1vywNlQeAIi6f2y6Camvmng6aoaLBuD8NfmX+Q3DnvFw+6A/Dvi90KMyLce
+/kdDoUeIEQNsltbQTlqQ70OUg30IB/Ud3RUPXLYd6eGKWI4+8pRIC+/1DySE8t7D5A==
X-Gm-Gg: ASbGncsF2PT0meCOJ6DNXYHJgb/0ykl7s1ZGp0EDnHOFbcrLOkdUjj46hVgoKCL4CFx
z6KzPgmMlRCpE25G5i/MhjyMcTiHDAzpgN9ukJFM4nY8/GPnZ7lOi92CeV8GwrlFptkVOSQqkE9
RRJRkJNxbdgIFXEPCKoeGwvc/2GnFYTRAAAiEGSAsI/+kJTK2sDDXvOuwTdU3RNnAlY3Rt0uvI4
S1QZuYQB91k0CwB5kPFspGg7JbPPwbYKLVvkmis56dtzjUQ0LMNkJuzCMLbCwqdOiNMyPJb8E2n
gZaLsxtFMxIdBGy0XUkpvfe9b20EdWY0d4scjXwUn9afkVI/FksH8eqT0hdeYThBaF8mF9ngroD
oNXUKi/lnlIVp8FOnN840gylKHeLhOMjMprbp73Jpdw==
X-Received: by 2002:a05:6000:310d:b0:3a5:2beb:747b with SMTP id ffacd0b85a97d-3a5319b592bmr2739322f8f.3.1749213330325;
Fri, 06 Jun 2025 05:35:30 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IE6Ebolrz1IOoMpW3aYGJSUpFY88OxyWoAs8HB+AGnlcGOsl5vVciX1PlKuEnfQRSWeZP/PAQ==
X-Received: by 2002:a05:6000:310d:b0:3a5:2beb:747b with SMTP id ffacd0b85a97d-3a5319b592bmr2739302f8f.3.1749213329969;
Fri, 06 Jun 2025 05:35:29 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a532436668sm1788926f8f.54.2025.06.06.05.35.29
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 05:35:29 -0700 (PDT)
Message-ID: <e105ba14-f9f5-4510-bf9d-b65440361f51@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:35:28 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 04/10] mm,slub: Use node-notifier instead of
memory-notifier
To: Oscar Salvador <osalvador@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<20250605142305.244465-5-osalvador@xxxxxxx>
<0ca963af-8dc9-4cb4-9142-04497c359b81@xxxxxxxxxx>
<aELfAo3RgIU0CV-5@localhost.localdomain>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <aELfAo3RgIU0CV-5@localhost.localdomain>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 14:28, Oscar Salvador wrote:
> On Fri, Jun 06, 2025 at 01:56:15PM +0200, David Hildenbrand wrote:
>>> @@ -6217,15 +6217,12 @@ static int slab_memory_callback(struct notifier_block *self,
>>> int ret = 0;
>>> switch (action) {
>>> - case MEM_GOING_ONLINE:
>>> + case NODE_ADDING_FIRST_MEMORY:
>>> ret = slab_mem_going_online_callback(arg);
>>
>> In slab_mem_going_online_callback we will cast arg to "struct
>> memory_notify", no?
>
> Uhm... not sure if I understood this correctly but slab_mem_going_online_callback looks
> like this:
>
> static int slab_mem_going_online_callback(void *arg)
> {
> struct kmem_cache_node *n;
> struct kmem_cache *s;
> struct node_notify *narg = arg;
> int nid = narg->nid;
> int ret = 0;
>

I'm stupid and missed that hunk, sorry.

>
>
>> Probably needs to get fixed.
>>
>> ... and probably best to pass marg directly.
>
> You mean to cast it directly in slab_memory_callback and pass 'narg'
> to slab_mem_going_online_callback?

Yes :)



--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675752-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 28C8641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:38:10 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5F6C41706BC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:38:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A847A288C1C;
Fri, 6 Jun 2025 12:37:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="S0EKknag"
Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131])
(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 509462356B9;
Fri, 6 Jun 2025 12:37:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213476; cv=none; b=g5V39bnOhFlZwwanGoERZxJ5VMxfTQR9eQ9+Qy6FNwQcNzhaztyexgPmkfgTvjNbM82WHZ/ff5Lfs7fqC3JP5FC/5ieYd7t40sJuFNcwu0QTxxzsQohCDaPe0AeDbuN1G09fBOi9WxSzrYH28ZnYm3jSDrBu3zXngkyeiAIDvCA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213476; c=relaxed/simple;
bh=8BFKlrQ68QjCmbx5xh4/w0cPsnqeWqA5EfLScv6WkrE=;
h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From:
In-Reply-To:Content-Type; b=JSQ5UJBmEIiVoSsuTP8dzHUEiScy5daZ9NmpPNawLf6NS/X6rXMm8p6/oOj3Zi2e1gGc7GL4dne4xv1xJw1D1nEGaZH1gOvbIk16ScPAr6Ju/mTfIj4ToHiIC9RCGSEcddFIzmj6MNtogZgz6FaSUDVvfg17+6h7aFlGNj4U3X0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=S0EKknag; arc=none smtp.client-ip=205.220.180.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com
Received: from pps.filterd (m0279872.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55663pHt000708;
Fri, 6 Jun 2025 12:37:50 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=
cc:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=qcppdkim1; bh=
1oODGAliAr0P1Y/Ntrn/PvuZ7jpTdNekDsWec4XKAP8=; b=S0EKknagQ6PJY13L
1Dblb5hcsqx0Y0zinF0lLNDlVzglwIOrAFdqoOkZE/dJAu3+xEjEmJf0vHbigkhP
dOG0Xo5F4MwngHeBnEV+J4rzo9DbNl3Fdh27aNblB0/y/aJRftc/T8FiAuw3trKQ
1qZfAd6GxNoV8b36QtZyk+xzlbYc6f3s53qROSKRIx8NMyIVuSOmZS3kt/uW5HfX
WDlZ5XHdUVHQJxmf4VPaqV2zJEQGIR+qqUpQLOEucrBfjPzFuRNVsK4b0Q/sU2aJ
VosKVxVvRQc0Zsd1b4YnDy9frmBPIvmH8NBGJjCjJvog1tiRkJ9ocd6GKXATaaAr
IJxsfg==
Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8qcmek-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 12:37:50 +0000 (GMT)
Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35])
by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 556Cbnue000632
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 6 Jun 2025 12:37:49 GMT
Received: from [10.253.79.143] (10.80.80.8) by nalasex01c.na.qualcomm.com
(10.47.97.35) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 6 Jun 2025
05:37:45 -0700
Message-ID: <996c9a39-5520-4b43-adfa-06ce29223ba0@xxxxxxxxxxx>
Date: Fri, 6 Jun 2025 20:37:43 +0800
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 0/3] media: venus: enable venus on qcs615
To: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>,
Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxxxxxxxx>
CC: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>,
Dikshita Agarwal
<quic_dikshita@xxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio
<konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski
<krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, <linux-media@xxxxxxxxxxxxxxx>,
<linux-arm-msm@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<devicetree@xxxxxxxxxxxxxxx>,
"Nicolas
Dufresne" <nicolas.dufresne@xxxxxxxxxxxxx>
References: <20250530-add-venus-for-qcs615-v8-0-c0092ac616d0@xxxxxxxxxxx>
<wmri66tkksq6i3hfyoveedq5slghnnpozjzx6gck5r3zsiwsg6@xevgh54rnlqd>
<285cae4a-219c-4514-818f-34c8225529de@xxxxxxxxxxx>
<5854a587-aba7-4e71-87f8-249ba00cbc59@xxxxxxxxxx>
Content-Language: en-US
From: Renjiang Han <quic_renjiang@xxxxxxxxxxx>
In-Reply-To: <5854a587-aba7-4e71-87f8-249ba00cbc59@xxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To
nalasex01c.na.qualcomm.com (10.47.97.35)
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085
X-Proofpoint-GUID: MJCRs-B1rtwWlJNjGneRRIOua0tJXyig
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDExMyBTYWx0ZWRfXx/9a70jTHg0Q
iKpMhz+m7Or5xEi5C4FX7Q81Qh484u9YwJ2YiM/z3qBTKAlRqlespbvR/LfvPZOipkjlADsJ7mk
q/Rq/K1lxxs1lQTdc779GnV8zdmBtD471Gwg9qnaw+IBIt+sWTZlgQzNFvVVlIO9dT7KRqTGxkh
00rlvFNvdriHYd8mbHd5v10pG2Pbld5LcH0dg7jjKX/+3G/B+8ZwDNGuCJ7X/YldlIyx3/jxQ2L
xzd26xcxV7OzOW6jS6wVOGy/wBv2J1RP2XeMnl0pJqEOrN2cSkV7PHrFine5agUlZFw52sZD0/m
3sKYR7vEMHNx1yppPEKt9sRuqdiN8GcJDlumuiUzgsPyQXAa2UKcx/V6hwArb12ubGM6tVRxO1u
cqEOZmAgRCF7gqBZxHXwTTg+OhQw7V0ZgNdRPE4/ATgXfIV1CDCGkt/n2WpCJeU4sBDde3Hf
X-Proofpoint-ORIG-GUID: MJCRs-B1rtwWlJNjGneRRIOua0tJXyig
X-Authority-Analysis: v=2.4 cv=PrmTbxM3 c=1 sm=1 tr=0 ts=6842e11e cx=c_pps
a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17
a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10
a=OeXMNpvLbdQpr1KLWfoA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
phishscore=0 priorityscore=1501 mlxlogscore=530 mlxscore=0 lowpriorityscore=0
impostorscore=0 malwarescore=0 spamscore=0 clxscore=1015 adultscore=0
suspectscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060113
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 6/5/2025 8:34 PM, Bryan O'Donoghue wrote:
> On 31/05/2025 01:05, Renjiang Han wrote:
>>>>
>>>> Note:
>>>> This series consist of DT patches and a venus driver patch. The patch
>>>> 1/3, which is venus driver patch, can be picked independently without
>>>> having any functional dependency. But patch 2/3 & patch 3/3, which are
>>>> DT patches, still depend on [1].
>>> I'd say 2/3 and 3/3 still depend on 1/3, otherwise we can get video
>>> core
>>> on QCS615 over(?)clocked.
>> Agree, so we need to make sure that the driver patch is not picked
>> after the DT patch.
>
> This statement is confusing.
>
> 1/3 states that there will be a fallback if there is no OPP table
> present.
>
> Giving the code a glance, I believe that is so, freq_table should be
> used if there is no OPP specified in the DT.
>
> I think we are having a hard time here understanding what you are saying.
>
> My understanding:
>
> - venus modification is standalone 1/3
>   Qcs615 will fallback if no OPP is present
>
> - dt modification 2/3 3/3 is therefore also independent of driver
>
> ---
> bod
yes, let me re-spin this with driver patch alone. Once that gets in,
will bring in the DT patches.

--
Best Regards,
Renjiang



Return-Path: <linux-kernel+bounces-675753-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BBB4141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:38:20 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5A5CB3AE282
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:37:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D3F1288C08;
Fri, 6 Jun 2025 12:38:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wUhpu31R"
Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B7E328852F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:38:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213492; cv=none; b=aLjgUHkvEHefVRURaNZ+XzN5uNaEwbFxgCX0m7hyIA0Rja5wdGLqknTCTVxWzJcpjXFNLP6kAE9quSfyhinJPxEMauG0y2tLWCyX9vL+0gaZ3VWM60wYELnCV3GitX4mwpFELPs8zb36/kPxiUAsCxRgy5jphGBaNu4OsbcJGT4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213492; c=relaxed/simple;
bh=76ceGAtoe6msQi7Co3W0+hpA8OF7n2ceHM3GHX4Q6is=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=snwA0ga1t/uJgAWjgbfQrlKUgGdHhRWc1ubRDsT3VyAob1gu7ky/IdRcn9l39Te+lAntV8eVg6QQ7v6Ppfe5jQzlXG2C7Y19cUNkBqBGTTfFR+jR/b4PZzF6awNYsxZZLv+uEUI8NqjzEOzNC/6BgWMUvPg6MYTVBX8njtdJrCA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wUhpu31R; arc=none smtp.client-ip=209.85.208.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com
Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-6024087086dso9852a12.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:38:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749213489; x=1749818289; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=FeOQnwFRu1+Kj/2MlWTCn9hMSyDZ7M1MsWilhgviDz8=;
b=wUhpu31RUtz1dPzebSVTy51HPG9j7LqL71+XHHkMy+yHxg/W8zYQgKB6yofETPDUim
HuQvAWWv6SqdXC/YFAetMG//HLMC5YuusLQ8iDEEKZ/Ysj2n7PQ6JvhNeLA9NHAz4QR1
UOt5Wm8sIuqP11m846Gbrga9ocy1cPZQhQqFAryMNqE9wcgA7XaUs53yuUU5mYXZM7Ze
WQy1qRiQ7VuCss563lp8CIuKjFLNIUjjkSBh2mDD4xnejoaffMU3rhRuMwvBeN2lPd4t
M7JP25cBO+eK5suTBSs+s0lkNVjNvxKUw8e8ooSk//ATpCaEni2RQIZ1TE4xMr3HrZWL
LJ1w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749213489; x=1749818289;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=FeOQnwFRu1+Kj/2MlWTCn9hMSyDZ7M1MsWilhgviDz8=;
b=v07qyMLXvSClUcMePEkQnw90rKSgcb2qB4/IWQx5vrf3dVkfL47hMUgohFoqpj0RED
dmEpJl00jLYN5eb8sa1db5WiF/CAfNqy3kGN5eJqt7Q0hkm3nsZcIlmLWlKCsShkADe4
E6pW26PKaMr1r/YOpzvkI19kgMsFb5lVggSPx5zCWp9W5BQTMQGUekd8VI4MKDNScvwN
GAfl5tAPYpylgeUobNH2IABxYNCs8MBI2iVW+SqXplifbpoXBZxoN6LY04m0fXJ5tWCy
L4fCuHymx66iDBpWcbj9Hc8UC50+y81ykjOtM7V2dosStivGMoTJtKnLC3Zu8RJDS98I
hxTA==
X-Forwarded-Encrypted: i=1; AJvYcCWfSIspsobVE00amSxY4ZV+PZclcUUbW2OJKmmHL+JCcig28xbSPtp/hz9GDMqiS5yaiYK3QrYlMubroZ0=@vger.kernel.org
X-Gm-Message-State: AOJu0YzLM7N1sDRnRIXt9Z40McJUob8uRZdKU+a0wG+4Ka0F5f3fcLcZ
zoueHF6FA1kDh2/3cqz7rIvkRABb8HcQGi4l0/iBn14x8K4qLycDasOQYuKWpMJFD62YOc0M3yw
sB/toDb4nMENsl8HOwjo0RQfuGCgwwH2BRvJxrbVD
X-Gm-Gg: ASbGncs/XA5IA1PYsbj7UnB6sB17VHi5OQwqPd42pEya0LIhiq1RM5awQ6n0nY3QbtS
AIV2J5QRSZtZHBiOza44uwTYEEqO0Uvwzbc1k5CuA3tQekZlfn2T5PC+Vw+/i5eI7FKIKSWlaz7
K/A2+s5gdZVxo/lBR/52uruounMoaL/t4cGdUcFx/mOJU95+p2MNcE6OA/nuzOvIK4RNLN6A==
X-Google-Smtp-Source: AGHT+IE+fznf396DEdYbm7FDbiMqK8DD7+M7vFeKn4D5k96LIDFgmHNB35OHueWQZma6dil8qwRaIjQmLGcvzLI2aTE=
X-Received: by 2002:a05:6402:3887:b0:600:9008:4a40 with SMTP id
4fb4d7f45d1cf-6077498ed18mr90476a12.4.1749213488536; Fri, 06 Jun 2025
05:38:08 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250606092809.4194056-1-ryan.roberts@xxxxxxx>
In-Reply-To: <20250606092809.4194056-1-ryan.roberts@xxxxxxx>
From: Jann Horn <jannh@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:37:32 +0200
X-Gm-Features: AX0GCFvlWBvUofLsMql7uPnqlPQ_I7AwEatSw2rWNXAV8LpXKA2kOKqETQmhfQc
Message-ID: <CAG48ez1VHfcTJNDLZcoupQBJQ5xpKzEMss8oBhmGYgHFidRU_A@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v1] mm: Close theoretical race where stale TLB entries
could linger
To: Ryan Roberts <ryan.roberts@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mel Gorman <mgorman@xxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 11:28=E2=80=AFAM Ryan Roberts <ryan.roberts@xxxxxxx>=
wrote:
> Commit 3ea277194daa ("mm, mprotect: flush TLB if potentially racing with
> a parallel reclaim leaving stale TLB entries") described a theoretical
> race as such:
>
> """
> Nadav Amit identified a theoritical race between page reclaim and
> mprotect due to TLB flushes being batched outside of the PTL being held.
>
> He described the race as follows:
>
> CPU0 CPU1
> ---- ----
> user accesses memory using RW PTE
> [PTE now cached in TLB]
> try_to_unmap_one()
> =3D=3D> ptep_get_and_clear()
> =3D=3D> set_tlb_ubc_flush_pending()
> mprotect(addr, PROT_READ)
> =3D=3D> change_pte_range()
> =3D=3D> [ PTE non-present - no fl=
ush ]
>
> user writes using cached RW PTE
> ...
>
> try_to_unmap_flush()
>
> The same type of race exists for reads when protecting for PROT_NONE and
> also exists for operations that can leave an old TLB entry behind such
> as munmap, mremap and madvise.
> """
>
> The solution was to introduce flush_tlb_batched_pending() and call it
> under the PTL from mprotect/madvise/munmap/mremap to complete any
> pending tlb flushes.
>
> However, while madvise_free_pte_range() and
> madvise_cold_or_pageout_pte_range() were both retro-fitted to call
> flush_tlb_batched_pending() immediately after initially acquiring the
> PTL, they both temporarily release the PTL to split a large folio if
> they stumble upon one. In this case, where re-acquiring the PTL
> flush_tlb_batched_pending() must be called again, but it previously was
> not. Let's fix that.
>
> There are 2 Fixes: tags here: the first is the commit that fixed
> madvise_free_pte_range(). The second is the commit that added
> madvise_cold_or_pageout_pte_range(), which looks like it copy/pasted the
> faulty pattern from madvise_free_pte_range().
>
> This is a theoretical bug discovered during code review.

Yeah, good point. So we could race like this:

CPU 0 CPU 1
madvise_free_pte_range
pte_offset_map_lock
flush_tlb_batched_pending
pte_unmap_unlock
try_to_unmap_one
get_and_clear_full_ptes
set_tlb_ubc_flush_pending
pte_offset_map_lock
[old PTE still cached in TLB]

which is not a security problem for the kernel (a TLB flush will
happen before the page is actually freed) but affects userspace
correctness.

(Maybe we could at some point refactor this into tlb_finish_mmu(), and
give tlb_finish_mmu() a boolean parameter for "did we maybe try to
unmap/protect some range of memory"; just like how tlb_finish_mmu()
already does the safety flush against concurrent mmu_gather
operations. Maybe that would make it harder to mess this up?)

> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 3ea277194daa ("mm, mprotect: flush TLB if potentially racing with =
a parallel reclaim leaving stale TLB entries")
> Fixes: 9c276cc65a58 ("mm: introduce MADV_COLD")
> Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>

Reviewed-by: Jann Horn <jannh@xxxxxxxxxx>


Return-Path: <linux-kernel+bounces-675754-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4E6F741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:41:21 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id A81B918954AF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:41:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DEFC8288C15;
Fri, 6 Jun 2025 12:41:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IjqZbUCB"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 876EA288537;
Fri, 6 Jun 2025 12:41:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213669; cv=none; b=tH/fCtXz5cHRuDV3Em4hx3N7XsHc62fap04rc0+PcyMXTkRSgNnqU/vKdx101fqovhRTEj8mRusg1Rj/ny13gVK9Z+DEArs0ramCm7rVPdHZdezyJnNrxbhganoNpt5YeSWBiEmPNTLXO3BOWgNkyRSfZYpJ8RySeabHNimGex0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213669; c=relaxed/simple;
bh=1N+xCDZJ/0b4qoHVQOlp9TIGFKwd8yBxgETiQhT7ccs=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=YSFfqtrBJtYAWAMZIFhTyYA6L8c32kr4Vi14OBPGlrpV12fYPKHs6Kpkpg135ppGb7m66FOOjtlLNnAg11OzpdvllB7D7jnJhcxvu4na7Bi0gRsAXBpWnheyEMwGrApOeoFAm3hS0mdo6viK5uff/MMklMxQFaizUH96wkbdyew=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=IjqZbUCB; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id BE0D211DD;
Fri, 6 Jun 2025 14:41:00 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749213660;
bh=1N+xCDZJ/0b4qoHVQOlp9TIGFKwd8yBxgETiQhT7ccs=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=IjqZbUCBHbdcVQfrDKzQGdv2IuKbNQccf7oIsi9R1bvR9ykq2PAIYLRgiIDNtHKK6
toGy0XWAjz4HHl6lvXBf0RmnGLhIoeBtpydCWlsjLWwmHl4lEBC29XwTc20Ik9ueL3
sjkTh+GGLlqPMLVyrDea76VDk4M/tSfxpQNS02/A=
Date: Fri, 6 Jun 2025 15:40:54 +0300
From: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
To: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Cc: kieran.bingham@xxxxxxxxxxxxxxxx, rmfrfs@xxxxxxxxx, martink@xxxxxxxxx,
kernel@xxxxxxx, mchehab@xxxxxxxxxx, shawnguo@xxxxxxxxxx,
s.hauer@xxxxxxxxxxxxxx, kernel@xxxxxxxxxxxxxx, festevam@xxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx, imx@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/2] media: platform: Add user line interrupt to
imx-mipi-csis driver
Message-ID: <20250606124054.GC27510@xxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
<20250606121403.498153-3-isaac.scott@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20250606121403.498153-3-isaac.scott@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Isaac,

Thank you for the patch.

On Fri, Jun 06, 2025 at 01:14:03PM +0100, Isaac Scott wrote:
> The NXP i.MX 8M Plus features an interrupt that triggers after the MIPI
> CSI receiver counts a user-configurable number of lines. This is useful
> for debugging, as it allows users to check if the amount of lines per
> frame equals what they are expecting.
>
> Add support for this interrupt in the driver, and an entry into debugfs to
> allow the user to configure whether the interrupt is enabled, as well as
> the number of lines after which to trigger the interrupt.
>
> This debugfs control can be altered while a stream is in progress, with
> 0 disabling the interrupt and >0 setting a new desired line count.
>
> Signed-off-by: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
> ---
> drivers/media/platform/nxp/imx-mipi-csis.c | 45 +++++++++++++++++++++-
> 1 file changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> index bbc549c22aff..0e6bc3c87be4 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -88,6 +88,10 @@
> #define MIPI_CSIS_INT_MSK_ERR_CRC BIT(1)
> #define MIPI_CSIS_INT_MSK_ERR_UNKNOWN BIT(0)
>
> +/* CSIS Interrupt mask 1 */
> +#define MIPI_CSIS_INT_MSK_1 0x18
> +#define MIPI_CSIS_INT_MSK_1_LINE_END BIT(0)
> +
> /* CSIS Interrupt source */
> #define MIPI_CSIS_INT_SRC 0x14
> #define MIPI_CSIS_INT_SRC_EVEN_BEFORE BIT(31)
> @@ -109,6 +113,10 @@
> #define MIPI_CSIS_INT_SRC_ERR_UNKNOWN BIT(0)
> #define MIPI_CSIS_INT_SRC_ERRORS 0xfffff
>
> +/* CSIS Interrupt source 1 */
> +#define MIPI_CSIS_INT_SRC_1 0x1c
> +#define MIPI_CSIS_INT_SRC_1_LINE_END BIT(0)
> +
> /* D-PHY status control */
> #define MIPI_CSIS_DPHY_STATUS 0x20
> #define MIPI_CSIS_DPHY_STATUS_ULPS_DAT BIT(8)
> @@ -221,6 +229,7 @@
> #define MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE BIT(0)
>
> #define MIPI_CSIS_FRAME_COUNTER_CH(n) (0x0100 + (n) * 4)
> +#define MIPI_CSIS_LINE_INTERRUPT_RATIO(n) (0x0110 + (n) * 4)
>
> /* Non-image packet data buffers */
> #define MIPI_CSIS_PKTDATA_ODD 0x2000
> @@ -281,6 +290,8 @@ static const struct mipi_csis_event mipi_csis_events[] = {
> { 0, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End"},
> { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge"},
> { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge"},
> + /* User Line interrupt */
> + { 2, MIPI_CSIS_INT_SRC_1_LINE_END, "Line End"}
> };
>
> #define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
> @@ -333,11 +344,14 @@ struct mipi_csis_device {
>
> spinlock_t slock; /* Protect events */
> struct mipi_csis_event events[MIPI_CSIS_NUM_EVENTS];
> +
> struct dentry *debugfs_root;
> struct {
> bool enable;
> u32 hs_settle;
> u32 clk_settle;
> + u32 int_line;
> + u32 last_int_line;
> } debug;
> };
>
> @@ -686,6 +700,15 @@ static void mipi_csis_set_params(struct mipi_csis_device *csis,
> MIPI_CSIS_DPHY_BCTRL_L_B_DPHYCTRL(20000000));
> mipi_csis_write(csis, MIPI_CSIS_DPHY_BCTRL_H, 0);
>
> + if (csis->debug.int_line > 0)
> + mipi_csis_write(csis, MIPI_CSIS_LINE_INTERRUPT_RATIO(0),
> + csis->debug.int_line - 1);

Should this become

mipi_csis_write(csis, MIPI_CSIS_LINE_INTERRUPT_RATIO(0),
max(csis->debug.int_line, 1U) - 1);

to write MIPI_CSIS_LINE_INTERRUPT_RATIO to 0 when int_lines == 0, like
below ?

> +
> + mipi_csis_write(csis, MIPI_CSIS_INT_MSK_1,
> + csis->debug.int_line ?
> + MIPI_CSIS_INT_MSK_1_LINE_END : 0);

You should also read csis->debug.int_line into a local variable like in
the interrupt handler to avoid races.

And you also need to clear MIPI_CSIS_INT_MSK_1 in
mipi_csis_enable_interrupts() (when on == false).

> + csis->debug.last_int_line = csis->debug.int_line;
> +
> /* Update the shadow register. */
> val = mipi_csis_read(csis, MIPI_CSIS_CMN_CTRL);
> mipi_csis_write(csis, MIPI_CSIS_CMN_CTRL,
> @@ -765,10 +788,12 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)
> struct mipi_csis_device *csis = dev_id;
> unsigned long flags;
> unsigned int i;
> - u32 status[2];
> + u32 int_lines;
> + u32 status[3];
>
> status[0] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
> status[1] = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
> + status[2] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC_1);
>
> spin_lock_irqsave(&csis->slock, flags);
>
> @@ -785,10 +810,25 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)
> if (status[0] & MIPI_CSIS_INT_SRC_FRAME_START)
> mipi_csis_queue_event_sof(csis);
>
> + int_lines = READ_ONCE(csis->debug.int_line);
> + if (int_lines != csis->debug.last_int_line) {
> + if (int_lines > 0)
> + mipi_csis_write(csis, MIPI_CSIS_LINE_INTERRUPT_RATIO(0),
> + max(int_lines, 1U) - 1);
> + else
> + mipi_csis_write(csis,
> + MIPI_CSIS_LINE_INTERRUPT_RATIO(0), 0);

The whole can be replaced with

mipi_csis_write(csis, MIPI_CSIS_LINE_INTERRUPT_RATIO(0),
max(int_lines, 1U) - 1);

> +
> + csis->debug.last_int_line = int_lines;
> + mipi_csis_write(csis, MIPI_CSIS_INT_MSK_1,
> + int_lines ? MIPI_CSIS_INT_MSK_1_LINE_END : 0);
> + }
> +

I don't think you need to do any of this with the spinlock held as the
spinlock covers the events field only, which you don't touch here. You
can move the code after spin_unlock_irqrestore().

> spin_unlock_irqrestore(&csis->slock, flags);
>
> mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status[0]);
> mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, status[1]);
> + mipi_csis_write(csis, MIPI_CSIS_INT_SRC_1, status[2]);
>
> return IRQ_HANDLED;
> }
> @@ -928,6 +968,7 @@ static void mipi_csis_debugfs_init(struct mipi_csis_device *csis)
> {
> csis->debug.hs_settle = UINT_MAX;
> csis->debug.clk_settle = UINT_MAX;
> + csis->debug.int_line = 0;
>
> csis->debugfs_root = debugfs_create_dir(dev_name(csis->dev), NULL);
>
> @@ -939,6 +980,8 @@ static void mipi_csis_debugfs_init(struct mipi_csis_device *csis)
> &csis->debug.clk_settle);
> debugfs_create_u32("ths_settle", 0600, csis->debugfs_root,
> &csis->debug.hs_settle);
> + debugfs_create_u32("int_line_0", 0600, csis->debugfs_root,
> + &csis->debug.int_line);
> }
>
> static void mipi_csis_debugfs_exit(struct mipi_csis_device *csis)

--
Regards,

Laurent Pinchart


Return-Path: <linux-kernel+bounces-675755-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5C48341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:44:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 074D43AEF07
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:43:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 56348288C0C;
Fri, 6 Jun 2025 12:44:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CLtUpVPe"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 9D421288537
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:44:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213846; cv=none; b=LDeAmCJJOFjztykEt135aq9Fkyw9rVOcOgnQGt3aprOMtPL+unbIYZKdx8O85pNreXEQLEuat8jldr7A9AtxvuxeFR518PfK5FQwMy+wN/sZxLCNYlCEyc2InlA8h5uIr+yjVZ2gQcR96ADhdcHmwD1FC8+r+pUYK5farXKDmZA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213846; c=relaxed/simple;
bh=K+fyfi/7cEPPZS+4gqzT7NBL7maJ3CTpPImf2Tt/67o=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=ItiXy9I3RTv4AlFir7VrJcSACGNuMzYTIHmrKqKhMyQ46YBd7n1BugFOLY7iQenbgLKlH44OzRPHjiCz/6fPsPRvJTE/pc87U1neYt5j3BEy+Up/HK+5x9S8bWbNmk0B0A2rG6aOOgp16mJClxVmF/5f9M+8nN3WQrtYbZQFuho=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CLtUpVPe; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749213843;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=ar6SpSKanTLEMwpjfI2VMVmh2BTyW0PkU6fFk/apfzs=;
b=CLtUpVPe6YNNy1+dniK4aD9AED0jOD2j4rFimxjhk7TL/pqrGnU5Ul6AMM5Pg3/WOItOIc
6dtaNK/mV9aayXF65fYST4jGYc+r1fT0HBwnlR8BUJIipsLQLi4X8P7yImGfeIEQhFN4qp
jlyJKx2NKFeli0g0Wm0fdXG/KVf43JE=
Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com
[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-540-yJN-tPeqMtqBrlcMPS8-Xg-1; Fri, 06 Jun 2025 08:44:02 -0400
X-MC-Unique: yJN-tPeqMtqBrlcMPS8-Xg-1
X-Mimecast-MFC-AGG-ID: yJN-tPeqMtqBrlcMPS8-Xg_1749213841
Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-451d5600a54so16438635e9.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:44:02 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749213841; x=1749818641;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=ar6SpSKanTLEMwpjfI2VMVmh2BTyW0PkU6fFk/apfzs=;
b=oZ9xhbSK+QfHOZrVSDPYZoSCOJ27nIUQyK8pt0DvbB4zBaYae7JG/ULeAin9BV8Se8
W8PhzO3ITJvpLsLgux7krYHK0dlaOjzjAAqv/Pa3k//PO13kNxlbPnTfaWrs9ol6gPVe
FdLt46pjszZ3HmxUEDgNkVJd7yyfY/G4dCroAs+kUCAxQU07aFl4Cmzi8prMSHoPqRaR
Kp1R6eQ+yH9NehhJstfRx4UEswxP4TmSkbhrRpoxHsi94XunUlh9DACcyMMxG4emnM3q
KIDQ8Etimra6Ug6Aad+TtihEWUdXqgsNNC6GqJxO4QhpO6w45YulJ9epbKlTBvJ4BmlH
z+xA==
X-Forwarded-Encrypted: i=1; AJvYcCVFm8qXFWR3t0tq+T5r8I/vRcdVzkHCpNTiuE460W2s2khYuuJn6cfoFdDLpDELWPYGw3F+juuHLEP39Ug=@vger.kernel.org
X-Gm-Message-State: AOJu0YzhZOsrn+qk7B4dpMcx2eaoUpwHPcMFwd6D2vCqjKj3wU4y4lWJ
UfdumeyRv5rYMHtXvSdQNAkW9Ne+ex4bjHp84lKOFYcA6mwaaD/ZjFYE9Xd5PTfTfZwEjJQrn+Q
Zej44Kt2RMFNb7nYCT9621vDhcTta8z0yuPYoJoMxJUOMNHNfqyr49oGvYlRYPwMaNA==
X-Gm-Gg: ASbGncvQ3zSM3jMPjY1ERfHm3saHJ8wjC+y6mLayIZ8BPBtPCff19jKQEkzlYhqFLbp
z2vGtMyYJeFHdPr223QUqh9Q+IZoUX8B/QcUmPW1IJb1O0OSYxOezdPu2z64hVQ/7FPcv27dXs4
9yErPtYL8iW2n+kNXlRuu+//7D9BLeu+0FuYxmoCvytrj04kXPGIjIZkOvacSKP6jsds7WPwwoS
ZsV43QOw1aU/VAwUBu/honKBwUavSYhB3eGezT2vSTaQnsxaW8M+KAbon018NCG99kdZR4OKV0O
aNcBA7ovMqk6s5FXXGtw8fgpf2SlnYZ6ohHM23hZpG15/ipYp6jAfAzE3n8AB0uTTgpLMkTkczf
YFWoK+sZUQGaO1bkd2FRrzcl+luoWjb3H3IjJqow5XQ==
X-Received: by 2002:a05:600c:1c83:b0:441:b5cb:4f94 with SMTP id 5b1f17b1804b1-4520136a9f3mr33012215e9.5.1749213840975;
Fri, 06 Jun 2025 05:44:00 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHU8HkkhEPbHgrJMNZ4OfhFtq64ki74ST8iAN9Am0Inv9D8PpEDiwbPnzWb3zxKPDvGBs9jCA==
X-Received: by 2002:a05:600c:1c83:b0:441:b5cb:4f94 with SMTP id 5b1f17b1804b1-4520136a9f3mr33011955e9.5.1749213840553;
Fri, 06 Jun 2025 05:44:00 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4526e1595d4sm20040765e9.16.2025.06.06.05.43.58
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 05:44:00 -0700 (PDT)
Message-ID: <4f4fab59-abc2-4700-8477-edcb68d633df@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:43:58 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v1] mm: Close theoretical race where stale TLB entries
could linger
To: Ryan Roberts <ryan.roberts@xxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>,
Mel Gorman <mgorman@xxxxxxx>
Cc: linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
References: <20250606092809.4194056-1-ryan.roberts@xxxxxxx>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <20250606092809.4194056-1-ryan.roberts@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 11:28, Ryan Roberts wrote:
> Commit 3ea277194daa ("mm, mprotect: flush TLB if potentially racing with
> a parallel reclaim leaving stale TLB entries") described a theoretical
> race as such:
>
> """
> Nadav Amit identified a theoritical race between page reclaim and
> mprotect due to TLB flushes being batched outside of the PTL being held.
>
> He described the race as follows:
>
> CPU0 CPU1
> ---- ----
> user accesses memory using RW PTE
> [PTE now cached in TLB]
> try_to_unmap_one()
> ==> ptep_get_and_clear()
> ==> set_tlb_ubc_flush_pending()
> mprotect(addr, PROT_READ)
> ==> change_pte_range()
> ==> [ PTE non-present - no flush ]
>
> user writes using cached RW PTE
> ...
>
> try_to_unmap_flush()
>
> The same type of race exists for reads when protecting for PROT_NONE and
> also exists for operations that can leave an old TLB entry behind such
> as munmap, mremap and madvise.
> """
>
> The solution was to introduce flush_tlb_batched_pending() and call it
> under the PTL from mprotect/madvise/munmap/mremap to complete any
> pending tlb flushes.
>
> However, while madvise_free_pte_range() and
> madvise_cold_or_pageout_pte_range() were both retro-fitted to call
> flush_tlb_batched_pending() immediately after initially acquiring the
> PTL, they both temporarily release the PTL to split a large folio if
> they stumble upon one. In this case, where re-acquiring the PTL
> flush_tlb_batched_pending() must be called again, but it previously was
> not. Let's fix that.
>
> There are 2 Fixes: tags here: the first is the commit that fixed
> madvise_free_pte_range(). The second is the commit that added
> madvise_cold_or_pageout_pte_range(), which looks like it copy/pasted the
> faulty pattern from madvise_free_pte_range().
>
> This is a theoretical bug discovered during code review.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 3ea277194daa ("mm, mprotect: flush TLB if potentially racing with a parallel reclaim leaving stale TLB entries")
> Fixes: 9c276cc65a58 ("mm: introduce MADV_COLD")
> Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
> ---
>
> Applies on today's mm-unstable (3f676fe5c7a0). All mm selftests continue to
> pass.
>
> Thanks,
> Ryan

LGTM

Acked-by: David Hildenbrand <david@xxxxxxxxxx>

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675756-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3373441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:44:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5B35F171C17
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:44:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 35E89288C24;
Fri, 6 Jun 2025 12:44:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g+2dH9r1"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5817B2356B9;
Fri, 6 Jun 2025 12:44:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213879; cv=none; b=qBcIg2jHYYT/T+skVmESxqHgZqAt78uyvcjouhfDYZEk3GqW3WAeNj6s+Dpb9hf6L1aaFx1WNNM0/xD27amd+nguZ/Pe9v7aVgxPOADL5dMKDVfUz1PnTL0tqaWj4nmWbVryDdNyQzYuSP7K1FbFq9ltxlbZ7eTxViEERlg46Fg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213879; c=relaxed/simple;
bh=4M96473c5P6FQlta/i0hSdZivhTSIAYCVIdwYwBu9s8=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=OwUEPiHFy+bDYk3Q+Zf8O0F9WTYwBqJbT8vfjqVd5u1ZE3bI/cEiNq3fwg5izacmBHEg9LuTbWaJmcZ3AHbKJk5pX0D7dEcabGJgXz8aPwtP8Floioq2pHbr3w5vftxITyclVdKwzc93llXr0UbjtvGV1MxcLYp7yDvb9idluTI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g+2dH9r1; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5D8DC4CEEB;
Fri, 6 Jun 2025 12:44:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749213877;
bh=4M96473c5P6FQlta/i0hSdZivhTSIAYCVIdwYwBu9s8=;
h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
b=g+2dH9r1PEcK+hR+OoysVwKTcFA2ItbQcL0N/vMVeCwtAKuOyMm0FO52nzwzcLz4T
UWPsuzXlVq7Q1j7XWunesKiY0U7F1LFa8LDlp33lYyOR1vGI3MHAdktzEHNwzKPiG8
RUpcLkzK68cbl8A7+IvFMj7Dd4RVVoRA/US28kZWt8v4FM88tAW/GqaFmPUwhrRdcn
1w+84rOjeFqI9J19BFzUcnYwvqUNGysRR72IjLQm99lSLmJgu5+N864BE/bvlwKGEv
qyaubnpko4ZDoRCT8itQbGoDvDoEAfF/IPwwtPPxuA7pRq91dzmrc0xhbaPl9iC4BN
QNcsT++c66ibA==
Message-ID: <713b87cb-0003-4ee3-a599-9cd41629bb42@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:44:31 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 0/3] media: venus: enable venus on qcs615
To: Renjiang Han <quic_renjiang@xxxxxxxxxxx>,
Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>,
Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Cc: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>,
Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley
<conor+dt@xxxxxxxxxx>, linux-media@xxxxxxxxxxxxxxx,
linux-arm-msm@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>
References: <20250530-add-venus-for-qcs615-v8-0-c0092ac616d0@xxxxxxxxxxx>
<wmri66tkksq6i3hfyoveedq5slghnnpozjzx6gck5r3zsiwsg6@xevgh54rnlqd>
<285cae4a-219c-4514-818f-34c8225529de@xxxxxxxxxxx>
<5854a587-aba7-4e71-87f8-249ba00cbc59@xxxxxxxxxx>
<996c9a39-5520-4b43-adfa-06ce29223ba0@xxxxxxxxxxx>
From: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=krzk@xxxxxxxxxx; keydata=
xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79
cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu
JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH
gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE
J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj
NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS
BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU
vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM
Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD
TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg
S296bG93c2tpIDxrcnprQGtlcm5lbC5vcmc+wsGVBBMBCgA/AhsDBgsJCAcDAgYVCAIJCgsE
FgIDAQIeAQIXgBYhBJvQfg4MUfjVlne3VBuTQ307QWKbBQJoF1BKBQkWlnSaAAoJEBuTQ307
QWKbHukP/3t4tRp/bvDnxJfmNdNVn0gv9ep3L39IntPalBFwRKytqeQkzAju0whYWg+R/rwp
+r2I1Fzwt7+PTjsnMFlh1AZxGDmP5MFkzVsMnfX1lGiXhYSOMP97XL6R1QSXxaWOpGNCDaUl
ajorB0lJDcC0q3xAdwzRConxYVhlgmTrRiD8oLlSCD5baEAt5Zw17UTNDnDGmZQKR0fqLpWy
786Lm5OScb7DjEgcA2PRm17st4UQ1kF0rQHokVaotxRM74PPDB8bCsunlghJl1DRK9s1aSuN
hL1Pv9VD8b4dFNvCo7b4hfAANPU67W40AaaGZ3UAfmw+1MYyo4QuAZGKzaP2ukbdCD/DYnqi
tJy88XqWtyb4UQWKNoQqGKzlYXdKsldYqrLHGoMvj1UN9XcRtXHST/IaLn72o7j7/h/Ac5EL
8lSUVIG4TYn59NyxxAXa07Wi6zjVL1U11fTnFmE29ALYQEXKBI3KUO1A3p4sQWzU7uRmbuxn
naUmm8RbpMcOfa9JjlXCLmQ5IP7Rr5tYZUCkZz08LIfF8UMXwH7OOEX87Y++EkAB+pzKZNNd
hwoXulTAgjSy+OiaLtuCys9VdXLZ3Zy314azaCU3BoWgaMV0eAW/+gprWMXQM1lrlzvwlD/k
whyy9wGf0AEPpLssLVt9VVxNjo6BIkt6d1pMg6mHsUEVzsFNBFVDXDQBEADNkrQYSREUL4D3
Gws46JEoZ9HEQOKtkrwjrzlw/tCmqVzERRPvz2Xg8n7+HRCrgqnodIYoUh5WsU84N03KlLue
MNsWLJBvBaubYN4JuJIdRr4dS4oyF1/fQAQPHh8Thpiz0SAZFx6iWKB7Qrz3OrGCjTPcW6ei
OMheesVS5hxietSmlin+SilmIAPZHx7n242u6kdHOh+/SyLImKn/dh9RzatVpUKbv34eP1wA
GldWsRxbf3WP9pFNObSzI/Bo3kA89Xx2rO2roC+Gq4LeHvo7ptzcLcrqaHUAcZ3CgFG88CnA
6z6lBZn0WyewEcPOPdcUB2Q7D/NiUY+HDiV99rAYPJztjeTrBSTnHeSBPb+qn5ZZGQwIdUW9
YegxWKvXXHTwB5eMzo/RB6vffwqcnHDoe0q7VgzRRZJwpi6aMIXLfeWZ5Wrwaw2zldFuO4Dt
91pFzBSOIpeMtfgb/Pfe/a1WJ/GgaIRIBE+NUqckM+3zJHGmVPqJP/h2Iwv6nw8U+7Yyl6gU
BLHFTg2hYnLFJI4Xjg+AX1hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/
JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu
4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB
YpsFAmgXUF8FCRaWWyoACgkQG5NDfTtBYptO0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v
qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5
RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg
Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2
H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB
dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT
AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu
jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2
zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw
XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A=
In-Reply-To: <996c9a39-5520-4b43-adfa-06ce29223ba0@xxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 14:37, Renjiang Han wrote:
>
> On 6/5/2025 8:34 PM, Bryan O'Donoghue wrote:
>> On 31/05/2025 01:05, Renjiang Han wrote:
>>>>>
>>>>> Note:
>>>>> This series consist of DT patches and a venus driver patch. The patch
>>>>> 1/3, which is venus driver patch, can be picked independently without
>>>>> having any functional dependency. But patch 2/3 & patch 3/3, which are
>>>>> DT patches, still depend on [1].
>>>> I'd say 2/3 and 3/3 still depend on 1/3, otherwise we can get video
>>>> core
>>>> on QCS615 over(?)clocked.
>>> Agree, so we need to make sure that the driver patch is not picked
>>> after the DT patch.
>>
>> This statement is confusing.
>>
>> 1/3 states that there will be a fallback if there is no OPP table
>> present.
>>
>> Giving the code a glance, I believe that is so, freq_table should be
>> used if there is no OPP specified in the DT.
>>
>> I think we are having a hard time here understanding what you are saying.
>>
>> My understanding:
>>
>> - venus modification is standalone 1/3
>>   Qcs615 will fallback if no OPP is present
>>
>> - dt modification 2/3 3/3 is therefore also independent of driver
>>
>> ---
>> bod
> yes, let me re-spin this with driver patch alone. Once that gets in,
> will bring in the DT patches.
Did you read my feedback? There is no "once that gets in". DTS is an
independent hardware description and your patchset claiming there is
dependency is just broken.

I am repeating this since few emails, so shall I NAK it that you will
address the main issue you have?

Best regards,
Krzysztof


Return-Path: <linux-kernel+bounces-675757-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1BE7441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:46:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5819B1723E8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:46:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E9E527E7C8;
Fri, 6 Jun 2025 12:45:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Z5DXLOgH";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="gkqusZ1Q"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 E15AAF9EC
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:45:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749213955; cv=fail; b=ZOrTNMUWv3EgWZ3jGhTsCB4sJ0ctdHna2kG2ObfuxKcIBDyjCdwOaFZ0ZJ8lckKTvydTXR6rHgsxfXT97+R/NlTn3ZKxxMDuTWepiwNvi4OEjwDvL6PHsuQlek9Opv0w3RA/BUqMgFDee8BGt7bivfOUsuGezUbsx14HVFvbemI=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749213955; c=relaxed/simple;
bh=3OXFzlhWe36IjkK8be7Bjn9NqsHIu+06lpfbNSlyBxQ=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=WRu9Tl1B5zxtf66jXJuIG/+PtIGwMOOpQjVFsePe4XyZtrwJq8wsmQ86b2JfhkqFZcHT9kp3Z+jJmk4ykwSiDVxuCKL55A9b3xt7037fESO5vlb2rj2hHcuvoLS1GKxU0ZCsMks6rlrv5Wh4bBZYbD6bqGnaCeTj9dTnO0X7rAo=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Z5DXLOgH; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=gkqusZ1Q; arc=fail smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246631.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MaJr030087;
Fri, 6 Jun 2025 12:45:27 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-type:date:from:in-reply-to:message-id:mime-version
:references:subject:to; s=corp-2025-04-25; bh=3OXFzlhWe36IjkK8be
7Bjn9NqsHIu+06lpfbNSlyBxQ=; b=Z5DXLOgH0ZB7EpZ+L2E+Vew6w2i6Tlf7vm
tEIoSO2bEe0WMO9PMb5HPU7YKzSXCQsK0HcKc6gMgn6jB9bdsP2BGEveutB0it9J
5a68qx1Bqo//i+YfldYoD/ZMYF5xM06icxyCzKVfNXiRrB7cM1PW4M9wLWk6vgAD
52UPrLlFQqvlkMdhD1ozNgUxET6CfahaYEpvMGpwxRf0LNVveoGMG2gY0CysmK1M
Pdfp/ZUXOO9tjfd88uxirt1kBUe3if1wLMcNOdv35/DPhm+G+ItAL0E+siw+gc1z
B6h4hjkHnBEmdf99nnuuZ2EvrN+dxte7T+u5zrJHSYx0nzk4JMBg==
Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8dyxwm-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 12:45:27 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556Ac9IO040959;
Fri, 6 Jun 2025 12:45:26 GMT
Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57])
by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7dfx4s-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 12:45:26 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=a6v/Ny9BY+wz0GhuOyP3s72jx6pruPT4MvH6qx9/vQdU0cFeGBZb5E3IdAaOaY3MLwArkgy99yDG5WyzmebeIf5vtndrZLNfOfJKiQnQmqX/X7bFBCPScKYicrsaT66JuamhVgxi6kTDigDTdSUeWMDmLofL96b062ugAuJ8MhCAubRX6jZq42PNTuJQqxcQdnR1TYFvp0fikAzCksWK6qTkLhd0PZqU7I/ZVWC8NblOBtpCjZNOwOPv6C8g8YXjF9w5N/d1KpyhZgLwx1e6tEjZ6P5+8LNi2kTIN4o7L79G8ltOSiuGPlneNfSBommUCwXfCrHIAQQFlLFOs0QDPQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=3OXFzlhWe36IjkK8be7Bjn9NqsHIu+06lpfbNSlyBxQ=;
b=DOJVEXdqUsDJsxqCvneGqjPjaPq76whaxbC9Go8wtMYVvdjtIOMbT31tbHckGzJLg8gnwNmCMkz32eTSNDgKAIX1g5szqEbuo+qyDkZdJiFs/leiyIlUYzti4OeiF4dWAXSe5vMbX+UYdpTnTOvXEKu9kVgtkkJZRLn+92BKQXHJ3GbyuFlAbLiauRFdwHtrOLODUIVvU4lmnbGGyvIjqm1wwreNhC1yoOlIpP6kSjxkk6NvfWeJcuYj+TUjr6yaO+n69Zh1MsGWSSZU8QM2oHRu2ZSAONP1hfHUziUYABab/9dyJ+DE6CdOic5Wc1H2+2SYvfulNOgPq+KozRtEtw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=3OXFzlhWe36IjkK8be7Bjn9NqsHIu+06lpfbNSlyBxQ=;
b=gkqusZ1QyT+sMJxhMJx8xgrEQI8U5MkmrR10wze0Og53XMwRw2ywxiXTv+f+i1K8NsAwUBRLHHOfw4JGxiy79o1+W3aUCrjUaCc7QVeVJtGqIdqgiM7/AxF5Y1B51FZop1BNZlhcasAwIaZwE5lFvef+HgYwCAuvbNmqJZvjZZU=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by SJ2PR10MB7669.namprd10.prod.outlook.com (2603:10b6:a03:542::21) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.41; Fri, 6 Jun
2025 12:45:23 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
12:45:23 +0000
Date: Fri, 6 Jun 2025 13:45:19 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Oscar Salvador <osalvador@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>,
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>,
Harry Yoo <harry.yoo@xxxxxxxxxx>, Rakie Kim <rakie.kim@xxxxxx>,
Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v5 00/10]
Message-ID: <6a4381d7-1191-41af-85b3-164e25dd9025@lucifer.local>
References: <20250605142305.244465-1-osalvador@xxxxxxx>
<c4a96aa2-10ae-4dc1-abd8-be91f7e8b583@lucifer.local>
<aELfqFrdIiwRFQs2@localhost.localdomain>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aELfqFrdIiwRFQs2@localhost.localdomain>
X-ClientProxiedBy: LO2P265CA0342.GBRP265.PROD.OUTLOOK.COM
(2603:10a6:600:d::18) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|SJ2PR10MB7669:EE_
X-MS-Office365-Filtering-Correlation-Id: cdb721ed-86c3-45da-f5b4-08dda4f800d3
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?tN6v/fFz4Fef3IWMNaPM2ffRT/libaSAK1U2isZPwLD29UvJ7jmvsP3oaQBd?=
=?us-ascii?Q?7+2AdVQ3KpgjiUQU8vObYxBmiSozsa7Z5O4sF2jftuCJxL6Xoddb1o5El32m?=
=?us-ascii?Q?J7f6nnfw654QEWrGZ4aZWDFXNUUwfyLPkAha9YxCAST3hz35N7mKgojCWOuw?=
=?us-ascii?Q?YDOtLjhchAfyPU6uvxDIlN7Ngl5PO+wyrrLqaFntLdJg35Z5rbNpAiTLIRvW?=
=?us-ascii?Q?TWxkIbim6zjWOcjsYWLL2BYizhVcHfyfgSWASvlWQl5KUgFtoQuhoVSdt2jp?=
=?us-ascii?Q?8sLTJxdQo8HBgVLPtR46HVLROZuSk5IKXp8gWi6IYz6UgaIPznN6Qhteoh2x?=
=?us-ascii?Q?AbHiBZ9R7hKy97mI68feK7CF2bYm6jqfPnwUwskpcaVdNwx1oZm7hKNSqL7H?=
=?us-ascii?Q?L2zQgwLWijCZq3g1wL3PFv80p8Uc4OFYPQb7rWC0CMs0bBEX00oTSKrqaPHk?=
=?us-ascii?Q?m60aa2ZiPsridqAPgZl637Q0rdxjogAigKC8NKGceKy6+T4jHvX93BN1ioKz?=
=?us-ascii?Q?erhF/frZXfVpEF5nNOuBxWTkj1G0DVKOJNQMfcrjl4sxy1QTiA84kErmmQZK?=
=?us-ascii?Q?T/aDiuCK1gvFT3f+2/M/AjLn3KZHT/UWS+GBY+OgOMf3RxcDhi/JKU0euBvr?=
=?us-ascii?Q?/FBHuMWxoQUhlyHI71asDvOAsdAn1h/hyDQEUxC6ke2icrEdGvQ7KG7QuWbo?=
=?us-ascii?Q?k92zu9efM2BtYTiYSYg/KSuLcc3ZUTdJvHxWrzYzqskI6xvg8TqalsDhBtUw?=
=?us-ascii?Q?TTy74qDH8WXsBjiZB0cfxUr1MHZ7yiOMugIcYr+KI6IDPinKXN13Rs2d6zfl?=
=?us-ascii?Q?NIS+pE3FSF+RU2AGfuGQ0Zjbo7zzvg1D/8kB2yvl5EMitZlKAfa+1cTPYnFp?=
=?us-ascii?Q?omrC5PRYiKjNisQBYwGJp40RpMiq1dJnCDQy0jumjlnf0jJYhp5d3ku/xYVl?=
=?us-ascii?Q?DGEDDHg36ORnRDxu0oO236FUMeQcZaBHeg0G5OKo0F2AdxDMIocLnsaM33jF?=
=?us-ascii?Q?fB00YoyKlbw2DmVa+rMdCIzN4cUUSAi6zmzIfGkfBN4qW+nn8GbqCGqQrmZF?=
=?us-ascii?Q?aH3NUXVF0ho5d5flpx1FEzAKDn1KAoVpdvI6DaYq8e4Ot12P5BzIT8SYqgVm?=
=?us-ascii?Q?OI/HXTnG1BkPAN5VghldR83ZlxA4nfjDtC+Tv3NOfLHgzaeGZMIG5aAnM/Mn?=
=?us-ascii?Q?8ejxnssP9GFlpGir2OfM9E69qMPw4afO9XnE9nYzmD4UBY7c7/oB0vHIhxby?=
=?us-ascii?Q?cMhCsxK/3UkGZLtYlNBhPhFRiJ4yMF1bTLyG8FY8lnIcKgEoN/tQSMfEjpkG?=
=?us-ascii?Q?UgetHVSqndVwWZmOy9YVSvfS2RPrBvxrkS6RGJkica5samAEDKldGgY4OcBA?=
=?us-ascii?Q?9ojPVLOUi+liB8OffQc7iohieK9H8LaelmP08pr33p9I+nOWNyfiBKDybev8?=
=?us-ascii?Q?4BIp9UVZsnw=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?Fv4QkVGtS+6tAf2O/tDi9jakbnodhEIRGbfC3FeP8C6JPDQfgSh22w++jd1C?=
=?us-ascii?Q?G+495ljpqNVRwdDOFAmyhlv4LmSFetjBiFUpHCUiq4M0H+LmOLNwKRTfxXby?=
=?us-ascii?Q?2i71d8iJXsOB7LgnX79vBhOZNXhR9XioP+cTo8vpmouXvH6m6B+G5lxs4Cl2?=
=?us-ascii?Q?Bw1ga9jhmzGGk80tX5yrXoG9L/rSrm8w2cxByBnqjlc6KF0cGHtlxvp6ec1P?=
=?us-ascii?Q?Dev4E2P+0pEPEbJBhx+U+6k7umoVPCdEqgdcd/bdT0/mUct5PkthYGGt4jER?=
=?us-ascii?Q?1wSVaANXdyA1b2k6HIDQkANkTXJfMFeazKKNca7K8WaS2gXtMkyEkFvkJ93I?=
=?us-ascii?Q?kP2jxq98Jq64IFspNrFsF91lHGz9VqG/Ze1prncx2ixgxl/xeT+p+gd1LJQv?=
=?us-ascii?Q?fHsMo3LZUg5QLVaHp2lFL5KTferAEIGZDsP/ZT/WhoI+e+oPY4cSYmuQi+Ro?=
=?us-ascii?Q?Kb1aVyPGNiYbCI4b6Bm8GPgBtSh3u6grGtpLJhEvjmqRd9iSQhOiihUBz0RD?=
=?us-ascii?Q?e5Ts2bPTYhiWlDBqzWEk3zy7I9n5i5f6h+PQEtKYeMQaWx9iO6tLVRBZCBmR?=
=?us-ascii?Q?iG5f9HhbDmWY0S172jDkM8YevXNIIBnRXB584saTSBrfHeNaf/O6i5A/EjVu?=
=?us-ascii?Q?+FnMQMvBcAiy0lguBcj7RnUNEkq7lVccUh/7grOSYNI/e1ABeIa0AeqGJ7/Y?=
=?us-ascii?Q?x5r5J8HKSYFmNJvBp3t8vp9p40lQqfD0Hh+bQLqL75E/sxCnLQLezZrcmoio?=
=?us-ascii?Q?b1WGyKeXH2u7j6uoQAp/SHJwYCVc+boM2+d6d3Lr/8BoCzpWRu9KMKFkv9YS?=
=?us-ascii?Q?4zE5tqKEWlznFNAldbUonQCqcVi/3AdGD46H5Q8t55WQFbOdB0d4Vn7s8eqc?=
=?us-ascii?Q?Ms0MB9f0PoKDSTv6ibaU41+3J5PmDnm3wcPRIv8oRVlgcXZp/gkUIp7/caps?=
=?us-ascii?Q?xcyDvQSLEYaDGedWY/ddRod8+qoftYVHZy7zCzNuD852SOB9RUxWpG0UHLQa?=
=?us-ascii?Q?NUBG7Sv1rTocXUkHqq8J4Vxt3IGTRKxbgsa1aGffCygrqsCR6U7I2tejtkGU?=
=?us-ascii?Q?SeuB3vIlkJ3SyA5RGLdfua+qACdGd88zK1C+1AKUoHC0N3ZJ95MRlA7IYa3M?=
=?us-ascii?Q?eAjy41qN3rAMIAVm7ct4TlfvF2sAGT2LOjVyL469xsDnYVGidus539rK1zj3?=
=?us-ascii?Q?mhJgaMaru1l4q3QituadSiLtGMu5XFndfPUfw+FN6iZn06dd72OK21oQzDGK?=
=?us-ascii?Q?fcuISKti0qxYgzAYJ1r5kEEuKptPLZtXVsj6t6E1YAsjY+88jyX3cq8+6/XF?=
=?us-ascii?Q?3M7llH/risXA5CBb+hkOH7CEsCZC1wZjleFsjaSalWfsX0ZHO9LJUdiVb+S3?=
=?us-ascii?Q?n5T1e0Fn41ZfSGaefBCD0ziZbbD7ecYGPgBdQzbx+KXaZmzTRoRzTJsqL8bI?=
=?us-ascii?Q?h+Hn3jZywZqkcu0b298TuWnN7k6UMVT2oHZoAy9m8JodnkPT8dL6pAj0j+5C?=
=?us-ascii?Q?ckm+6WB1G7BDAhs8M6LPc5ql7ihjIlWtV3L/Z48GiXsVpI/oFvGvvCeEwPTy?=
=?us-ascii?Q?DJkhG5fb0HOFOOKhp54Y8X47NIj1M1qS1BDik/CuUSb4JDjo9KgY7/GHUAZv?=
=?us-ascii?Q?OQ=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
Pv1FjKqKzpa2s9DuR6rJcFW1rirlFA6woG9Zci97/oQNnM/SrWJLAzuJJf3/wIIN61BOQfWfbOpfxS37DYuuUzIG74GVq+emDnRITPWkmw9wdsCJgwDSlumvW0dkrZOkcapUZXhvEEjOt9/mGQUoWyaEtpq7kn8FqHjGG7WhFCWg6QKButU8VUZTdZx7gbVLVhKgxGKoqMx4Pv8Uwf0eVYtCOewgPJx//5KOd7oyOMIxYDxC9nzhW4OTl53GF3lnIu8EAn1KwvFvGxtE0chHExiHh7ObANu+rzczFRljd1UZApb1IpyGlKFxBNRILm2U4fA9VUsnVmLokNApC7AN+RDu+EBlTYacB1uNv9PqNcbcmTySFwZCTRlhovxDo1yqzh90zSgFSpc+U4AJDuvwtmSGIK6uKnh305MoSyPhFOk42hmi6WO2rd72ELnWY/Y77ojXl6zhSytaXRGN1BSl5aIkeSEpmwmPGmLI/8d53mVnQc7i9LfQtWdbNzwfAMV5hTcOREp9QBhSwIOgwidP/ok7k2d1OYHl+6EvXI5p0ta5/9EdTeVnsCsHTIgWaz1yyZSENPmnPJbZ0hzqlHnpNNZuuVPSY8fwQBCu3lSF0d0=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: cdb721ed-86c3-45da-f5b4-08dda4f800d3
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 12:45:23.3407
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: rY81F0zlJA7DheUXUD9ig6/HU9XqpuNq7vP8sF6+wwR922Jf5SrtBXZF64lcsFzYzbkTT4lZg8a/Qy8NT6sqyQBXbR0NwUKi0J510Om/m5s=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7669
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 malwarescore=0
phishscore=0 mlxscore=0 mlxlogscore=783 suspectscore=0 bulkscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060115
X-Authority-Analysis: v=2.4 cv=Va/3PEp9 c=1 sm=1 tr=0 ts=6842e2e7 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=VwQbUJbxAAAA:8 a=aeQPjN3iLbsYLSR27tkA:9 a=CjuIK1q_8ugA:10 cc=ntf awl=host:13206
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDExNSBTYWx0ZWRfX8HXrxBDXQl7I ebVcLeeA8MlMhdjU3IBur/ZwSMRfV2SXak1E2pdj6C+U1P5mwWJtex9hDLiAb8cSpEp/+4RZx5J 3ibtX/ND34cfP3TEi45h+5mYKxatQnkwj9acQOcCL8f9teLo3Knh6kn2bXrZb0CMtK3ZT7et5vr
IBHoIKYqR6ytghA2WaBq93pktdzrvgafsv7P2LvjHhYoAwFnJvdoHEQaSdYirc67zJnjuZXqS5X ccit+TSEz2s0JcNoZM75gze1i2/cl8W5eULtKSlPc2flBl1Bns3mLV6bHBCTxxviMNWK1chBiNk 9lksKBfcCJeJzVQYqQPoS0aRSmj66CZLrwtBczRJx/fU4Yq8zXBw55krS957UkBIYFX3FgRgH+m
I/MQjQuyQLnlNdjh0QJK7xNXYQ5GITmqPoYH6wQAmb6m40gaarcpRxAcFTBQN+qHTNizfsDN
X-Proofpoint-ORIG-GUID: w_jidXDch6kDDAjdKr955Cw-NMKqgpR5
X-Proofpoint-GUID: w_jidXDch6kDDAjdKr955Cw-NMKqgpR5
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Andrew - as per below could you drop this for now to fix the build?

On Fri, Jun 06, 2025 at 02:31:36PM +0200, Oscar Salvador wrote:
> On Fri, Jun 06, 2025 at 12:30:42PM +0100, Lorenzo Stoakes wrote:
> > Hi Oscar,
> >
> > I don't have time to dig into what's broken here, but this series is breaking
> > the mm-new build.
> >
> > NODE_REMOVED_LAST_MEMORY for instance doesn't seem to be defined, but there's a
> > bunch more errors.
>
> Heh, I apologye, I assumed every config has MEMORY_HOTPLUG enabled.
> (I'll walk on my knees all day long to make up for that!)
>
> Fixup was posted this morning in
>
> https://lore.kernel.org/linux-mm/aEKdvc8IWgSXSF8Q@localhost.localdomain/T/#u
>
> But we can drop the patchset for now as I'll have to respin a new
> version including David's feedback.

Thanks!

Yeah sorry, I tried grepping for a define and it wasn't there, but I guess I
wasn't grepping at mm-new (I rushed it, was in the middle of looking at a syzbot
report :P).

Also a small bugbear, there's no subject in the cover letter :P I mean I
appreciate the beauty of silence as much as the next fellow but the cover letter
subject line is probably not the best place for it ;)

I speak as somebody who's made literally every possible post-send-to-list error
known to humanity, of course :>)

>
>
> --
> Oscar Salvador
> SUSE Labs


Return-Path: <linux-kernel+bounces-675758-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A223741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:48:13 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 2F2DA18972D3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:48:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CA4227CB02;
Fri, 6 Jun 2025 12:48:06 +0000 (UTC)
Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AC70F9EC
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:48:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.199
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214085; cv=none; b=Gcm+hhtNrK8ltE3/+5Lpzq5Yhm2NEw10j4drVZkdfyBLvL/WnqfDFfxKseJkBVhrfyXMPV3uShw/X09Rznf2va14XVdjwkAkWR4JKrbSwxfxGkMzUPj6s4vAIV3+7h0huUGmLIwqlsqI2Ia6rzmDvIHxIqkpNQrSkdQbDAyVIyE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214085; c=relaxed/simple;
bh=sGrwunzjdWlLIYw4Qq81mVH2LOQvVb2mMFndOBL5hKs=;
h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To:
Content-Type; b=KUasFlkVbaOxY52TcSqaBeXi+Vw8KnoECHbCsF6zouOR0fP/6x66mAqZp4vYc0PkqgzEytrtbWzDI/SxcfzbgVNydgUQgibIG4NjNGXw/2eXQg+ih9fwrPgWoVIAOjOq8PrIhgz7jRuBfizivhsTRCFKpbdB3Ojfp7+wQH/fzPU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.199
Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com
Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-3ddbd339f3dso23655005ab.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:48:03 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749214083; x=1749818883;
h=to:from:subject:message-id:in-reply-to:date:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=+aTWNiQth7+7nAa5NbV0wnb9HYSEyA0QplGINNE/8RU=;
b=dAIsUNyv37hUC62EVY+leuPZTjGK1OtBWDIrSvWcb7QxUZBAyOcB9Rn2SgB7RVYUJt
Bb/qWGGfnFZSDotkuzOmADNh5zZm8tFE63ahy/s5qDX0B5i8Hz/oob0Ms/pH9TvDrsJr
/pWOgXOCbq0eWNUEjuKgl7uw4AbEa1X9xl5WgnUxUw3YqwmTdCBt+JXhF8FWm+Z/53pV
7eJKYmq7Lxmfz5FjGBqFOZrG2j3/zyB5eXb5x6Hstk7Le5Q/xJ+wDXCNAB2R5+NPehWs
rlUXy7hKG5wly6VCBUew/PkF8hOVi5GFiwAe3mVEdeyB6xJZMmNlfr13Z4o5OYM73ERC
rDCA==
X-Forwarded-Encrypted: i=1; AJvYcCU5eXML0dG78aBL6kQCQfw8TCiPtoOMpfbEEAZ2iw0iKc8e5BLwLLyLj/OjVdt6wK78js6mlMOHhNG4sYM=@vger.kernel.org
X-Gm-Message-State: AOJu0YxqblbarLd6/ZKUOlvexcPBLOo0lLDGBgVO0PtgRNQcuQxrRify
4hWl9qmlAAAevqg7eWhq64mI9McFM/hggHOQlyp6ATp9rLgqeyzEXIv/KWon7r+D3cgmxcja6EB
XaIoV0hkv+eckbfEW4LSqy7DHvkkbhXEu0SwFuWQmGXY5c0V1m1FXq9Keb44=
X-Google-Smtp-Source: AGHT+IEo3uXes0q+Eiifcpkg3n5CPdDj0zfoGCdnOfM8crZiUzREzYHl+X9HsKeW++ECHWiImSRrCrwLxnhq72WieASSAjzBwDu6
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Received: by 2002:a05:6e02:1a01:b0:3dd:8663:d182 with SMTP id
e9e14a558f8ab-3ddce4165c5mr26184585ab.13.1749214083100; Fri, 06 Jun 2025
05:48:03 -0700 (PDT)
Date: Fri, 06 Jun 2025 05:48:03 -0700
In-Reply-To: <20250606122355.824-1-hdanton@xxxxxxxx>
X-Google-Appengine-App-Id: s~syzkaller
X-Google-Appengine-App-Id-Alias: syzkaller
Message-ID: <6842e383.a00a0220.29ac89.0040.GAE@xxxxxxxxxx>
Subject: Re: [syzbot] [trace?] BUG: corrupted list in ring_buffer_subbuf_order_set
From: syzbot <syzbot+05d673e83ec640f0ced9@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: hdanton@xxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
syzkaller-bugs@xxxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.0 required=5.0 tests=FROM_LOCAL_HEX,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+05d673e83ec640f0ced9@xxxxxxxxxxxxxxxxxxxxxxxxx
Tested-by: syzbot+05d673e83ec640f0ced9@xxxxxxxxxxxxxxxxxxxxxxxxx

Tested on:

commit: e271ed52 Merge tag 'pm-6.16-rc1-3' of git://git.kernel..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14499570580000
kernel config: https://syzkaller.appspot.com/x/.config?x=6ede24871858ac52
dashboard link: https://syzkaller.appspot.com/bug?extid=05d673e83ec640f0ced9
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=15e19570580000

Note: testing is done by a robot and is best-effort only.


Return-Path: <linux-kernel+bounces-675759-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9175D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:48:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id E88EE7A3797
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:47:30 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 167E427CB02;
Fri, 6 Jun 2025 12:48:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="aDGhk55T"
Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B7D1F9EC
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:48:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214122; cv=none; b=ON6fT6lfoFRSdfonHfEN1T+ZuCNPssYOdaz11HRypjINBkZpVDGlj9ny+S+ctrnh9Q1W8Kgbp5c46WFkLWpS0wxmJ8Pa6mHctEefoujswnyP8Txz+1SZr4HlDWOiq0N3R7XjgbAvq/vVNkGhrQL8g25hdEtRVLpM4MBHwzY25fU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214122; c=relaxed/simple;
bh=2HB+nihT3Nm8MQl3kSttEpQoMlmBegXXaIj27Z6mSug=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=a2QfHgpdktRZMzBzK6VIyteiVBs5TYikgm9sOo6GDy/3TU/QKO7QnvHLlOnKgQJJSnhkQoLn1vvG9Q2hqE96A8InhlgkC78IPjxQdwRMR0VvsFR2Isn1C46d7y9Oc6bXvr5KAMnxObH3D7ln22d733y8r8jXLXz/ZAQUnwfUb8Q=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=aDGhk55T; arc=none smtp.client-ip=209.85.208.52
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com
Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-607780f0793so159329a12.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:48:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=suse.com; s=google; t=1749214117; x=1749818917; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=kpUqMhsZTHJI42QQBRjXJzNugx0q67piTAy1meBqflk=;
b=aDGhk55TVxIgarw5o+kGGNIMIA7xvIUc/WDpNAzaM/cYdCx6aS2Owzr9Tu1tYVxk51
Dlql4cB2FPb5i6VTdzwAIbqRvv+dva/wmc1h2R15FTHWopce08GXeTbpzMjG2DsdEwQI
UjuzvtX0w/tefsnYCEy2lCFm+u7iUO2oghyR7gXHPWUtT6Hh5LqI9f8xXspxZY32+D1g
5hZ927RLNNh7iBwQOUfwoEubmA/3jGP+6pFWqMNlXw9FIHtXaej7U23ziBbtgYokP2fI
4zJ+l8etcDgL5h4k3slWN2yYRNcVSWL4x9I++aSGxS97QO9Pp5TXxivmkBjprAgwgbgz
pM+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749214117; x=1749818917;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=kpUqMhsZTHJI42QQBRjXJzNugx0q67piTAy1meBqflk=;
b=EYXq8Z9VZ7JK+ZPyo4EB04cinFttdnR7hdtJbPFn5kL369ULxlcBcXROGcNayk9CKR
pA45tZuSJoD287+7XoSea0FE49yJd3UbBYD2HhIF83z9UOtyyF1JKImJd7/iNLr++k0j
IZY20Gg/874kBji8bcaha87SVjECQdKKE6K5vXPRaAfQ2jSwvWWgEMYNrJvcSAdsZAkM
IqffeIJ7LMrVXk7a0Jq1GaxL/KbfcA9gYDTGBpN/hkR47BuVB7hPVLI/jurRn/8M3Fx4
xAfgXv7qPBlHSM+VDJrTBKYEg0JFNy1ULMmUyYtZIim/R4fiXe+QmZec8uOKS5Y++LEd
DDBg==
X-Gm-Message-State: AOJu0YyqW9ae5nFmuvlnQ8lEmngJis/7D5Yv+Lqt3jYKy7Laa3q5x2h+
4CrEOtFrx4d16ftsjVo3mqMLuztjgbMr+RJxMCFq0vQW66agOXYRrD7YXBuacy/d7Lk=
X-Gm-Gg: ASbGncuYh7lSdJ26q7zqteevNcV8KUCCIBOuZUkeOEFrP+X8GgPzzk5ZgsMvBhz51Ub
fG5zSnKJlovZIA3oMF43+qXCewmr0Lsr2pvbUvKLiSLy7O1la2jZZt96PLi0TqcVXcExNVOnJrs
Sna5PONx1jEtPvjzz7eqOor3nYgLYAFO503qVS09DnNrhzBK11G9iGw8ChttTVtcgnICJgqjI+t
TlfebAOaaQ/cxY+rGIk/8ZWd9PaLo2Qa3dgCZzzCCVbu+DfZ6OJkwYgTxQ7P2gFWlI/vGNwIvkp
cNp2tJwa4t8OIMWJHEzwPuVXiCUs+L4qeYk7A/8BSBh4Wil8+17NMJYGqr2GSzxlZTvYTiP5v8+
SG1qCg1bZ6UaWYX24ZuqA3lSNQi3vlA8OqDU32vLG05EJEv1h4hKNDsTRSyHaFUQ=
X-Google-Smtp-Source: AGHT+IGfkY/cWFUz3uxjjqfrkQi+wsAtTay7BEqR9YU15tg2vfGsXF5SrRy4HIfv021FDjhVhz+kmQ==
X-Received: by 2002:a05:6402:358e:b0:606:c63b:e330 with SMTP id 4fb4d7f45d1cf-60774b80030mr777774a12.11.1749214117024;
Fri, 06 Jun 2025 05:48:37 -0700 (PDT)
Received: from localhost (dynamic-2a00-1028-83b8-1e7a-3010-3bd6-8521-caf1.ipv6.o2.cz. [2a00:1028:83b8:1e7a:3010:3bd6:8521:caf1])
by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-607783c053esm984265a12.48.2025.06.06.05.48.36
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 05:48:36 -0700 (PDT)
From: Petr Tesarik <ptesarik@xxxxxxxx>
To: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>,
Frederic Weisbecker <frederic@xxxxxxxxxx>,
Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: "(open list:HIGH-RESOLUTION TIMERS, TIMER WHEEL, CLOCKEVENTS)" <linux-kernel@xxxxxxxxxxxxxxx>,
Petr Tesarik <ptesarik@xxxxxxxx>
Subject: [PATCH] timers/migration: Clean up the loop in tmigr_quick_check()
Date: Fri, 6 Jun 2025 14:48:18 +0200
Message-ID: <20250606124818.455560-1-ptesarik@xxxxxxxx>
X-Mailer: git-send-email 2.49.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Make the logic easier to follow:

- Remove the final return statement, which is never reached, and move the
actual walk-terminating return statement out of the do-while loop.

- Remove the else-clause to reduce indentation. If a non-lonely group is
encountered during the walk, the loop is immediately terminated with a
return statement anyway; no need for an else.

Signed-off-by: Petr Tesarik <ptesarik@xxxxxxxx>
---
kernel/time/timer_migration.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index 2f6330831f084..c0c54dc5314c3 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1405,23 +1405,20 @@ u64 tmigr_quick_check(u64 nextevt)
return KTIME_MAX;

do {
- if (!tmigr_check_lonely(group)) {
+ if (!tmigr_check_lonely(group))
return KTIME_MAX;
- } else {
- /*
- * Since current CPU is active, events may not be sorted
- * from bottom to the top because the CPU's event is ignored
- * up to the top and its sibling's events not propagated upwards.
- * Thus keep track of the lowest observed expiry.
- */
- nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
- if (!group->parent)
- return nextevt;
- }
+
+ /*
+ * Since current CPU is active, events may not be sorted
+ * from bottom to the top because the CPU's event is ignored
+ * up to the top and its sibling's events not propagated upwards.
+ * Thus keep track of the lowest observed expiry.
+ */
+ nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
group = group->parent;
} while (group);

- return KTIME_MAX;
+ return nextevt;
}

/*
--
2.49.0



Return-Path: <linux-kernel+bounces-675760-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4FD1641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:49:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0244E172613
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:49:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A350283FE6;
Fri, 6 Jun 2025 12:49:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xEYH2/qf"
Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E134B1DA53
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:49:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214183; cv=none; b=eG9pFqGu8ZPzSvDSfHeEe/rR9vaY1/xiYNQBUTGnin6rShC4ceM/wtOqtbEAiCnIcpQElyRfq7nnPC8mKGp7V++QWusq31KmUiN3MVF68EwFsdvzAKc9ohKb3FunKgnOnx3MKOfxI38h42NeEv2R45nj/Pt9fx5es0jAC4pOO04=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214183; c=relaxed/simple;
bh=Kl162rCV+ypEM/wfn7pzFhevVmvQmQXR77cvA0nqf9I=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=MPG16bTRVBKmT1roGkolUjgPBa3I+QVrzIOMQXoWBM5m9XEzXfNDfHVEuQSIU4hUU7XBYXaD0U0pYvDpeMC5+ZCMqaQ/j4DZ81sAj/OQx3Hx+/lLa247Wf+yIha3wh93LbCaAL6bLigUvRxB4CS8bMnqayZwBBNT4f3lH5UrOGE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=xEYH2/qf; arc=none smtp.client-ip=209.85.208.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com
Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5f438523d6fso8538a12.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:49:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749214180; x=1749818980; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=BT+AT6MqsJ3M+MYT3uZEthRD6VpQnEM0vp9KYd7MzOw=;
b=xEYH2/qf1sHLXnOM81CDAF563Fwd1m4Nikqw992j5v+bP4mDVuri3cRtaHhTnQhnlO
A4qUsVfNATAh3cxDfsIjD6KlnSlSEWRo0HcStf+4npQvreyRKUXjKYxsABx6zzWMw6Mz
oywWwF4Fei1EE5QIdj0NoVqDa8p+g3ngN0C0yw1Gv4+ea1XFgGxmp4J6HwfR+quax+RS
WHqEX3je4nSVb7+gXFcVMHX6rpszDKLPekJEMk95CxDHcPkJ/pI60b4yiXC73/dfatc/
cRKELom3GnuDSZdiWka9YNwtisu+ct2YGQl0aTDt5fgsqphzDj9lak0vLQTn1ubBvFdm
+hCg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749214180; x=1749818980;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=BT+AT6MqsJ3M+MYT3uZEthRD6VpQnEM0vp9KYd7MzOw=;
b=Epcw45zeT6D6ecCQo6z4aBZhGTsnncqDJ2xmSecMka9hmyeZKP3IlyK7SrGR8ckyNz
kFQrd4GWAAZtZVaWAwV/N7F7js3jW1jdZ7E35BGt19lGbdILgAXcVfE3wIR5qnJY4mbT
eYVVt3A33/9h7uRAAT55nrfVAtMRpmjzSbHkSsCJNNBFElYSGzCcaVd6rNZs7hxjBQqO
2DJjAgAAGPfl+IdU8mxR0EhvkBL4wnpwnllI8WgfsVwbAKmrt2KJ5U+GdIuL9TCsLEB+
5V3IzHn7HPBI8JG1gb5WArYb0gCXaqRoS9LGXeyHThXAtVfuG+cUO2SPaFGkEM2FfghJ
g/2A==
X-Forwarded-Encrypted: i=1; AJvYcCXedEEYF5hBc4p8wSUZ5khdia6vBHnx/WE8HAHvlCwuTNO4fqBnhu4XwCbtp7vmZn4p78w4iyn/MEkuvDA=@vger.kernel.org
X-Gm-Message-State: AOJu0Yy1kwnJAOg6dQBh7fre3UnD2CrU32itCfMO/U4cAtulju7ZOAkB
jtsGAoMJfXINF089uuuH5YJLbqbxFR8iiDzAM2hg0kFm7k8L2mWNeTid6pevtSEESfVlQQLBtT7
xvc5TPN5JojH4vhazxQGqsj640u32gWmj/TSSg8HF
X-Gm-Gg: ASbGncv3knsno2IwBjnus1drCL1ColkJjCK+1o1zKxTmfdKlI1ZpX3NBPGtWs0u3Tu6
pPqKDVmetpy6JreY0Xzv8oOreAHJBIQ7qaphsd3Ozh3uzuvr+r8JGR8UfX6Rk3m67hx3a1htLZQ
xjobuUEuQj3/V1SjRvAYgRK/sbWFRHtz++x0KjvHXV3AU2IS4vLl/DzwlYm882PQysJR87Zhr61
70wlsFZ
X-Google-Smtp-Source: AGHT+IEj+Za0UCwvZRT2mQseG+6UqOCA9QEGxUq6fGXHr3bK5GUTUQ0XMmeQy0xVJPsfoDBqZGJWVfK2y2vy3sqMkxY=
X-Received: by 2002:a05:6402:344:b0:606:9166:767 with SMTP id
4fb4d7f45d1cf-60773eca718mr76167a12.2.1749214179846; Fri, 06 Jun 2025
05:49:39 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250603-fork-tearing-v1-0-a7f64b7cfc96@xxxxxxxxxx> <20250603-fork-tearing-v1-1-a7f64b7cfc96@xxxxxxxxxx>
In-Reply-To: <20250603-fork-tearing-v1-1-a7f64b7cfc96@xxxxxxxxxx>
From: Jann Horn <jannh@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:49:03 +0200
X-Gm-Features: AX0GCFt0UyWLtHOJ7Xl9oT_PxdylGZdccUKq5b21dR__hVZmMxZwE8eGyyenLKQ
Message-ID: <CAG48ez0eGkBCNSy1Lp7Fz41uyQym0UMvik9vVVjD1GKGhvGpqQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 1/2] mm/memory: ensure fork child sees coherent memory snapshot
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>, "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Michal Hocko <mhocko@xxxxxxxx>, linux-mm@xxxxxxxxx
Cc: Peter Xu <peterx@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Tue, Jun 3, 2025 at 8:21=E2=80=AFPM Jann Horn <jannh@xxxxxxxxxx> wrote:
> @@ -917,7 +917,25 @@ copy_present_page(struct vm_area_struct *dst_vma, st=
ruct vm_area_struct *src_vma
> /*
> * We have a prealloc page, all good! Take it
> * over and copy the page & arm it.
> + *
> + * One nasty aspect is that we could be in a multithreaded proces=
s or
> + * such, where another thread is in the middle of writing to memo=
ry
> + * while this thread is forking. As long as we're just marking PT=
Es as
> + * read-only to make copy-on-write happen *later*, that's easy; w=
e just
> + * need to do a single TLB flush before dropping the mmap/VMA loc=
ks, and
> + * that's enough to guarantee that the child gets a coherent snap=
shot of
> + * memory.
> + * But here, where we're doing an immediate copy, we must ensure =
that
> + * threads in the parent process can no longer write into the pag=
e being
> + * copied until we're done forking.
> + * This means that we still need to mark the source PTE as read-o=
nly,
> + * with an immediate TLB flush.
> + * (To make the source PTE writable again after fork() is done, w=
e can
> + * rely on the page fault handler to do that lazily, thanks to
> + * PageAnonExclusive().)
> */
> + ptep_set_wrprotect(src_vma->vm_mm, addr, src_pte);
> + flush_tlb_page(src_vma, addr);

Hmm... this is actually wrong, because we did
arch_enter_lazy_mmu_mode() up in copy_pte_range(). So I guess I
actually have to do:

arch_leave_lazy_mmu_mode();
ptep_set_wrprotect(src_vma->vm_mm, addr, src_pte);
flush_tlb_page(src_vma, addr);
arch_enter_lazy_mmu_mode();

(arch_flush_lazy_mmu_mode() would look a bit nicer, but powerpc
doesn't implement that.)


Return-Path: <linux-kernel+bounces-675761-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8B1A041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:50:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id CFF5D171685
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:50:42 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C170428851F;
Fri, 6 Jun 2025 12:50:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ix5pt9hO"
Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A895D1E4AB;
Fri, 6 Jun 2025 12:50:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214233; cv=none; b=Ll2Bi3vMTUsTDpy/xmha1qP8wGNXXr8pJtCaqZLCTHC5UCWhhrUxZDvGZKiVGIgiH44z1TJZXtnOOzCOsK4LPhmdBbJ2ZqPHhC8BXg5GriT32SOm1KkZz0b0KPXYBrLp4ArP+UaM63/7Ej69ZM2dFZ2Q73lJbh6TWkefnDslKEA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214233; c=relaxed/simple;
bh=W+LlfNk2HsbBqdZ79RTapibL/KsF2dILx+zv70pwrYI=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=R/FvPRYWLJ2YZE833dbZJZ6L7TIACoIBVlALzWyA76QsDW/WbmiO3EelxQbmZzdacu+l0Be/NVHAcJHMAgEnSKnjkdrbr/gSWNpmy5R6xOyTQqwrYXfWRdIaDHZVXagRTtuKbcUSwFOuKOQMKiUL9Ao9Z1QjSrl0rVUHz2de6QU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ix5pt9hO; arc=none smtp.client-ip=209.85.214.181
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-235a6b89dfaso3281905ad.3;
Fri, 06 Jun 2025 05:50:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749214231; x=1749819031; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=0J3vuS2o0FutGzGx+1kPPU7uFTM+MDxsKMVlIteTB4Q=;
b=Ix5pt9hOwGA+OYCfEhci34fbRDASA9xb7JYJy0ewotj0CcCYNKaBdD60cZwPgf26ek
AZU907C1ujZmPFeNvdNl1WQs3VTjqrpV/xN4XaMvi2q9dFFTPjbMNeZ43Rv8oSPCl4UR
486VLSs6iVNI+MQ8MxGgnUX+XT7U42eZz8OSOkz9jwGKoMubIADDzBtRkSFH9fE3vqWL
8nTfT40KDtwDpqZyhByFwjxCTcqOSHmPJx+WkHcs0j7U60ISzUfpN3O+95pXBnfnBjqm
Hj7UQvkzfX+ze0uDuPgdzx2FjsN7zr2YYSas1f3VSVdWc/92HjIrWnqiILylgEovn519
RYXQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749214231; x=1749819031;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=0J3vuS2o0FutGzGx+1kPPU7uFTM+MDxsKMVlIteTB4Q=;
b=KTa2OczGEE5nJuVGNet+abeZRET9akrXrHbbu+bRXVb4vXQe+8U+HpLvcWv3GCN2L4
sfI3xudGE7C7E4yQTqBvtf04muWU75n3gBFLrJRhWKGdpyO1FH6qIcuuj7ZVsrEXK0JA
taLPlUNb7PvTx2ReebzAbSpZCEznosmDgfWIby7Uzv7dTxj4zj6/5ysJvcHx1fFnTC3H
P2b7l/lXQvMhy/XxUERRAVpJwRQWUqr8AiCut0bihcre17JU/rRmFeDmdp+M72W/aSOF
yjdfSA00PW5Pra0Q35dQGb4X3VjaJdgEp09VKpg2EVQLBz4EMjy9PYn7w4szfdN5nUz1
lHFQ==
X-Forwarded-Encrypted: i=1; AJvYcCUjyb/h631Q9Inl6Ux1HXPyo2+tCNcfBcM1tSI4mxq1NrxYlW+0kc+3EAWKk45zTK1VSIEAMPBADQK4NkU=@vger.kernel.org, AJvYcCVzznssAneEzPFuEPyofOzbrsoslUA0exMB+7Z/ewwl0noG/9O2N+U6MmTivxFo8HAKn7vABWax9UGs@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YyYcpdBeV7BYPXJa1yQdOfjxR3GdnRk17WWjWyHTbI+XqqvkLNe
NDjTw0vk9ueKDn/9wBPCzxJPP4yNVC7Zn62ZuPtsfU/yH0U77lToWHs=
X-Gm-Gg: ASbGnctQW+en5blSkafQh4BCYYL9byruFWqguDD9OOH2oCIx6sCa6In0RZChL5P2TC0
/FSEGyH653kxPmwE9BJ2aT1BViqvjo5uczh+jA3AmQHIT37b1KSBVsHjFu332nLZHp1kHNbjXsZ
1lbWuTzXGxlMUhjS2+4J77/70w0vFCSVT8Zrepedo4c/XzQy7B5uy7btKACl+C3Zc4g7PmBkGo3
+oA3D1PQFtAHVQ+Cj5XxP0IkV9VXmxr4wan1nNN3rTFgf4iTslqb63BHCfUeeqYGjSw28HvFs3R
bH5c6DWxYKfDueFFcbuflE8aPCw4ErTI+RLC/swq1kasPtW7ZNzUvhollCv5mi5eiLPvQTv3GWt
p08AITMiCPP6HaCp3v/ASNxpaxq0=
X-Google-Smtp-Source: AGHT+IHx0FKv5yZh74fOjj8IoRFYxtYWCQ/LS+Nkl4PMdKvrGGqAR3s4MnLBPejuysbls23PDTgzig==
X-Received: by 2002:a17:902:f54d:b0:235:caf9:8b1d with SMTP id d9443c01a7336-236040902d7mr13142645ad.12.1749214230898;
Fri, 06 Jun 2025 05:50:30 -0700 (PDT)
Received: from ?IPV6:2406:7400:56:b5f1:3fae:6c04:a3e1:b0f3? ([2406:7400:56:b5f1:3fae:6c04:a3e1:b0f3])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-23603092f50sm11705095ad.71.2025.06.06.05.50.29
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 05:50:30 -0700 (PDT)
Message-ID: <6f02afbe-cc55-4fe2-8615-1547f1d43efa@xxxxxxxxx>
Date: Fri, 6 Jun 2025 18:20:27 +0530
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [BUG] usb-serial-simple: device conflict with Owon VDS1022I
To: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: johan@xxxxxxxxxx, linux-usb@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
References: <6430992c-d50b-4cfd-bcb9-d7d376c53444@xxxxxxxxx>
<2025060620-twister-starved-3fb8@gregkh>
Content-Language: en-US
From: Amit <lestoppe@xxxxxxxxx>
In-Reply-To: <2025060620-twister-starved-3fb8@gregkh>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Greg,

    You've made valid points on both. Let me check with the authors of
the software, there is an ongoing discussion on this.

regards,

Amit

On 06/06/25 17:47, Greg KH wrote:
> On Fri, Jun 06, 2025 at 05:00:29PM +0530, Amit wrote:
>> Hi,
>>
>>     PATCH 6.1 082/167 adds serial support for OWON HDS200 through the simple
>> usb serial driver (). This causes issues with Owon VDS1022. The VID and PID
>> is the same for both devices so the the Linux kernel loads the serial
>> driver, preventing the associated software from working.
> As vendors are not supposed to use the same device id for different
> devices, that's against the USB.org rules, so that's on them, not us :)
>
>>     My current work around for this is to blacklist usb_serial_simple. Given
>> that this driver change was recent and still under testing, could we find a
>> solution for this that doesn't involve such hacks at my end.
>>
>>     I  was able to root cause this issue only because the USB device and
>> software was working correctly before. A new user would just assume that the
>> device is not Linux compatible.
>>
>>     I've filed a bugzilla report here :
>> https://bugzilla.kernel.org/show_bug.cgi?id=220193
>>
>>     This is the software : https://github.com/florentbr/OWON-VDS1022
> As that's just using libusb, it can disconnect the device from the
> usb-serial driver if it needs to from the program itself. Why not
> suggest this change to the authors of the software, OR just change it to
> use the serial connection that the kernel now presents instead of
> attempting to talk to it directly from userspace?
>
> thanks,
>
> greg k-h


Return-Path: <linux-kernel+bounces-675762-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 71CB141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:51:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id EFA663AB58A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:51:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E5CCB288C29;
Fri, 6 Jun 2025 12:51:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="bHpQu8MX"
Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131])
(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 B833228E0F;
Fri, 6 Jun 2025 12:51:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214298; cv=none; b=gesSh0U3wWbPZkcKldMJEYQyibj/gReIji1Ba4MgqMj2c9xIt7cWT6aZfti8uV3lV4TMkk47ztViPvUvulkxa+3P4WAni5RaDsw4YfjdIeB98vMqEnkxWwB6LhkdAvHgQKY0kT0KMXFJTYpPljcqht+mlNsHWfGr14FUIeQB+/8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214298; c=relaxed/simple;
bh=dtecXRWUyF0yin5ved9QdoDV8185V+TTuWa3QEslO5A=;
h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From:
In-Reply-To:Content-Type; b=d63cQut1IvLMW8RKHs3n533GxZnYbk54LEmZpjmnLDk6/aWjkar7Iqbu+CSX+BSt5XW7uf66EFJWnVH/S8el7gaYNEvciiubAD3nflO4y1Sb1s9Rf+FGVeGZ0iptZ7J7rzH1fM6t7jSqNPhbRGk+E1AXa2ZuaYAjGCDjNXS04Kk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=bHpQu8MX; arc=none smtp.client-ip=205.220.168.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com
Received: from pps.filterd (m0279866.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5568VQDR031008;
Fri, 6 Jun 2025 12:51:31 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=
cc:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=qcppdkim1; bh=
KPZLJlpuZibqD575czjkKdQ3SW/r72UBFjCfKtCMLfg=; b=bHpQu8MXVjdBwRsn
xLH7HSeuEc0QBpCVSiUl/Vy6QX5TP61GsRg2Iouf91ZQcqTGhgZW9iPS1QxTOsiY
lK/2dx+Hqv19NLcW0whJRX04rpB4ytuMJAPBCLjCji+6UQ6S0AG3TTddAKNQ/XlL
w/lqtDnCz8Zz91XI53AAWXGPQWE8IPakTQbj/qNbVA2Kn8GZLiZ6XrkcEJoCTiTM
cTTa/4v2AXNoGTB6G2K/UcHrMOtKgxifj1TPRwYavct1ohJuk1jDXFJ9tTjqaF7w
MNvJKatWZI6A00y6qNKheiwyWc0amZWyT+wCu1JUTtY+zg/cLFO7pZH/XrkvLmWg
51fA6w==
Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8s4q8k-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 12:51:31 +0000 (GMT)
Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35])
by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 556CpUl0026102
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 6 Jun 2025 12:51:30 GMT
Received: from [10.253.79.143] (10.80.80.8) by nalasex01c.na.qualcomm.com
(10.47.97.35) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 6 Jun 2025
05:51:26 -0700
Message-ID: <7aa36a0f-6741-40c2-93f4-036823d245fd@xxxxxxxxxxx>
Date: Fri, 6 Jun 2025 20:51:24 +0800
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 0/3] media: venus: enable venus on qcs615
To: Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Bryan O'Donoghue
<bryan.odonoghue@xxxxxxxxxx>,
Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxxxxxxxx>
CC: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>,
Dikshita Agarwal
<quic_dikshita@xxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio
<konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski
<krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, <linux-media@xxxxxxxxxxxxxxx>,
<linux-arm-msm@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<devicetree@xxxxxxxxxxxxxxx>,
"Nicolas
Dufresne" <nicolas.dufresne@xxxxxxxxxxxxx>
References: <20250530-add-venus-for-qcs615-v8-0-c0092ac616d0@xxxxxxxxxxx>
<wmri66tkksq6i3hfyoveedq5slghnnpozjzx6gck5r3zsiwsg6@xevgh54rnlqd>
<285cae4a-219c-4514-818f-34c8225529de@xxxxxxxxxxx>
<5854a587-aba7-4e71-87f8-249ba00cbc59@xxxxxxxxxx>
<996c9a39-5520-4b43-adfa-06ce29223ba0@xxxxxxxxxxx>
<713b87cb-0003-4ee3-a599-9cd41629bb42@xxxxxxxxxx>
Content-Language: en-US
From: Renjiang Han <quic_renjiang@xxxxxxxxxxx>
In-Reply-To: <713b87cb-0003-4ee3-a599-9cd41629bb42@xxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To
nalasex01c.na.qualcomm.com (10.47.97.35)
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085
X-Proofpoint-ORIG-GUID: 323KRHMxj_jGHTw_9905x9k9nk2FmZAg
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDExNiBTYWx0ZWRfX+OPckuXGwuBi
jSFzDZvsCcavwXjpQeUQbhabayTdBGApWQD/O0tFwySCsTRAwbUO6P3EXlGIte8MODQoU18zHuW
fD9btlVOrlGpRfxac6StYhlgWuRO93PNczh/a2KCyTsHw8rUxOVtc7DqHEOV9eR+JdtAo+/rj+k
IEBKfSVQu69J4qtI5wMi1g+EDRyW2+RRlIPGSH2DnvQvrE/YkN6rS8/EPDwMbdsudGrTlVIX8aC
nln6jdDmRt8EfPLffoJWJpso7bhVBsnOvYp3gmoGQ4lnvC5qNiA/hh+iBzmCZCR4t2/8AAAgmUc
BRw2pl6ak8tlyoGw6SlsYcKwekq3kuxV0vYODyd/IYqAtPW1GQCGnkwXPDZ8Kgi4+uch/hPb8at
cyw6VTh6qJaFSMvWpZHief/Hj8y9T5rWLbMGBKzsIjGT++w1uAqcJGYo1Tzw3t7PAdEUjVYX
X-Authority-Analysis: v=2.4 cv=RdWQC0tv c=1 sm=1 tr=0 ts=6842e453 cx=c_pps
a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17
a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10
a=nhFwFTAwuBtyWiKGGJcA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
X-Proofpoint-GUID: 323KRHMxj_jGHTw_9905x9k9nk2FmZAg
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
bulkscore=0 adultscore=0 mlxscore=0 priorityscore=1501 phishscore=0
clxscore=1015 lowpriorityscore=0 malwarescore=0 suspectscore=0
impostorscore=0 spamscore=0 mlxlogscore=932 classifier=spam authscore=0
authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1
engine=8.19.0-2505280000 definitions=main-2506060116
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 6/6/2025 8:44 PM, Krzysztof Kozlowski wrote:
> On 06/06/2025 14:37, Renjiang Han wrote:
>> On 6/5/2025 8:34 PM, Bryan O'Donoghue wrote:
>>> On 31/05/2025 01:05, Renjiang Han wrote:
>>>>>> Note:
>>>>>> This series consist of DT patches and a venus driver patch. The patch
>>>>>> 1/3, which is venus driver patch, can be picked independently without
>>>>>> having any functional dependency. But patch 2/3 & patch 3/3, which are
>>>>>> DT patches, still depend on [1].
>>>>> I'd say 2/3 and 3/3 still depend on 1/3, otherwise we can get video
>>>>> core
>>>>> on QCS615 over(?)clocked.
>>>> Agree, so we need to make sure that the driver patch is not picked
>>>> after the DT patch.
>>> This statement is confusing.
>>>
>>> 1/3 states that there will be a fallback if there is no OPP table
>>> present.
>>>
>>> Giving the code a glance, I believe that is so, freq_table should be
>>> used if there is no OPP specified in the DT.
>>>
>>> I think we are having a hard time here understanding what you are saying.
>>>
>>> My understanding:
>>>
>>> - venus modification is standalone 1/3
>>>   Qcs615 will fallback if no OPP is present
>>>
>>> - dt modification 2/3 3/3 is therefore also independent of driver
>>>
>>> ---
>>> bod
>> yes, let me re-spin this with driver patch alone. Once that gets in,
>> will bring in the DT patches.
> Did you read my feedback? There is no "once that gets in". DTS is an
> independent hardware description and your patchset claiming there is
> dependency is just broken.
>
> I am repeating this since few emails, so shall I NAK it that you will
> address the main issue you have?
>
> Best regards,
> Krzysztof

Hi Krzysztof

SC7180 and QCS615 use the same video core. Only difference lies in the
freq_table for the video. Freq_table is generally determined at SOC level.
The Venus driver does not currently handle freq_table compatibility well
across platforms. This patch enables the driver to use the OPP-table from
the DT, addressing the frequency compatibility issue.

--
Best Regards,
Renjiang



Return-Path: <linux-kernel+bounces-675763-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2377B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:52:01 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5C944173371
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:52:02 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4485D288502;
Fri, 6 Jun 2025 12:51:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="aLHHbdK0";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="fk1F0OE1"
Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32])
(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 2D4C928E0F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:51:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214307; cv=fail; b=dgxcgVcmYtJhujlR/5qv/t2GSMiZTHm3xm9rp6cADGo9pVM937OXP0T8nY8fSLJ6symmW8Xt3tu9q8qB4Z93/vj6DuSLA3obY/T3m8iVQnz4/anXy7/2kreGVp0PLjuBN8T6Hw+3jgdvWUNVWD6ItpSYTFBH9Zc55IoV8ldr27c=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214307; c=relaxed/simple;
bh=ZnpeZOHCcRBTNutphSNpHFWkFUHssqhUbvwslgaJybE=;
h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Xi5L8frMAIosJ4bJXw3SlsFR+8n1m5TQFJhmmqgiFi6qRuWGRlQCrz9LdfZp+bDMtQt7/PriHOUQllxkaFgAQtuCWvnnzYEt6mRvjA8RdpsL3H4GCYWDx9cyA8D/TFAXUeWm7ovRL+dOCJ+Pd8KmU3KdUh2L8b9c2lISgtNT78Y=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=aLHHbdK0; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=fk1F0OE1; arc=fail smtp.client-ip=205.220.165.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0333521.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NDfG021672;
Fri, 6 Jun 2025 12:51:32 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:content-type:date:from:message-id
:mime-version:subject:to; s=corp-2025-04-25; bh=CvCseE55t0zVpbcG
g+6eYXUrS5M39WTE8wfPVULVQU4=; b=aLHHbdK09hDTkWmQAd1hoPsHssAfhZ4j
ID9e7XS22ysEpi7eI1I0bq13N1YxVWjzk8yQkXnlbjM+3aY4boLC+DAECxt8pkwz
Ho7pol119jQoZKtJOqeBcebp0QRxAkiQMr5WPARqkheBlr+hyhTc9/xooNvldThT
tJrrFlEJp/E3uctBzs5ZiOMEMcF7LDORqsxqZ5zgibeD3hOuk06NVe1wYTSj0LCn
bYR83irPXuDS4yXjDV0fvkpmpxRcy3ktbIsdJ+/FH/X5cEMhP71mMXmyKCyB4hCk
qIBT39XAvMOc/wemzr1NbOwGL1079wyHTOKeooLaYMIoqGzHmqyh9Q==
Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8bqw67-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 12:51:31 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556B7h9r033794;
Fri, 6 Jun 2025 12:51:30 GMT
Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12on2079.outbound.protection.outlook.com [40.107.237.79])
by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7d8a5j-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 12:51:30 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=BBr06JFOTy9pdYYk3a+e3n0o7rmPiSjR6NGx62IAtP7dyHmBcNQyDLk4XB2L8K0u/RbwDcrgERn2webzJQ1ACuf7v0DEpmrz3Umc/LEk0V9Lez8gsw9UMkymaZoHUjFpmlkm5yHBtzsynwtmPPKJhVKmYXEh5XaGwd+vYDLe6loThD3juWb2xs3TFwejbSk4xcIx14tVsFz7Wz/5wsTSi2emt+Ve2up0hXWEwqeWOkAVNOLD8A7WM01FSEoy0lEymeZieXXJlArAm35bTVZudzX+UlNsH/wLheYoebOJ0hp5bX4J0GIqxQ51oem1klg91bxEqrh+O8n0K8OLSuITTw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=CvCseE55t0zVpbcGg+6eYXUrS5M39WTE8wfPVULVQU4=;
b=QQOM0UqXnkxILbN/vDadng2VpdczfEuef0PYaZNPVzb2kDlojcCcdmvzdD6+rX9GX5j/TfonROF7WZ2mHSSs7LCmSsfSv9W5STzJh3FpMs6R96pKUJq+hSgpOffoZjk0HPx1k9CRtY3eOP0e2Kh5CIY2jxmfnRm/YoiQL0Sk3o8JalwVDZwR5pW/R8bJcM2nq8HdKrOWlYkZQ+Bx7Y1K+FI1bNgGPejQKlS6bXFX1A3zmaytfsRG7rY6ShG5jfpMh4dsVgYVw/wuy1hSxLJlLqppmtm86XN+lfnAzNKhdguSsNIeNu1RLXqBnhnN4CwsHSHedwH1+EVgSFv+y7ENRA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=CvCseE55t0zVpbcGg+6eYXUrS5M39WTE8wfPVULVQU4=;
b=fk1F0OE1D534LTV7F/DNSb3qQ93tXMBTUPwf7tfhS4uPon0FQykbHrzCNQmneLxILyman1mDjqHmjxB9m2dKclz3gubWe7zN3dymUy3rSmLw/ts6gTflTgJmc1ZyJlLVaNv+k2rCGLz9O7i6yI0H2M//ufsD6ClC05uvzzlkU40=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by PH7PR10MB5772.namprd10.prod.outlook.com (2603:10b6:510:130::19) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 12:51:27 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
12:51:27 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: "Liam R . Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>,
Pedro Falcato <pfalcato@xxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] mm/vma: reset VMA iterator on commit_merge() OOM failure
Date: Fri, 6 Jun 2025 13:50:32 +0100
Message-ID: <20250606125032.164249-1-lorenzo.stoakes@xxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: LO3P123CA0021.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:388::9) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|PH7PR10MB5772:EE_
X-MS-Office365-Filtering-Correlation-Id: fef0a3f3-4920-4c4d-5857-08dda4f8da13
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?z6WJ/nuCfUULi0MDtxj/erOC/hTN4Rw35GX7suE5eDwkYo1i0MfhtiQ2cyu3?=
=?us-ascii?Q?OtN4du8y+nFU3h1YPPmPl2rrO7dKIRLmyEHeU2oXusWxksuq5YpaXU+MqA8x?=
=?us-ascii?Q?8LfIoLo8mE8Iof8p8MFSpfeZkRmav6ULekTImVP6n/aO0HqPtctTp1C8eDac?=
=?us-ascii?Q?qQlO2M9miqn6wSMUuFIJK/zSmDGXReCM4ijbvjMxQhJsbuJbmGLZgZaGfQkm?=
=?us-ascii?Q?au+7ug5WJjWQL+Al5GkYxUa1rCd4trk/YUhY4rFBHzyWzupH6Rrfz1QONhUl?=
=?us-ascii?Q?Ny74VLfijQ2cXSxKNRh+iqqPc1O7Y2ulmV4bV5CIAlY8ypadsMux4lJOC/cW?=
=?us-ascii?Q?qlEf7OHBxE8QWYVIX4fyxluyin0aUfZtj5q3eOXwWX2iXShxDlDuAkF5VpVS?=
=?us-ascii?Q?ATdee+qPWoBb2TFA9VSpvkzbyA3rYc/DBlotUV62GlRZynr36qvP5Ywuu1kO?=
=?us-ascii?Q?ISyAgUBD/g927akUjFrBuF41iIw4jnx2TtkQavS46eZozYf1XEmPDkeQMxG8?=
=?us-ascii?Q?Qdh3FfoywvURAWIsTXsgsdTnq1Svwi8LunGUiXiL2nwpqCqktxc7jGKwPQQx?=
=?us-ascii?Q?ZuWjjZncFuYyDzxtFEuH9swZJ5E9Vf5b4Gcue5UMi/ld9ibeWVWbIpsuCuJN?=
=?us-ascii?Q?IWMnMM9uhTkrp13Na95LT6SAz4V5NkVvdPpZoVRA4hF6YY17XDO/ZOq3wAa6?=
=?us-ascii?Q?KPFMdtWoSOvmfmeQJq3hWPTKAAEcqf6tAwYa7e6lqlxGDvudDivBpcateNPM?=
=?us-ascii?Q?B2CPfBAirwwXqRJ+aqhSE/0bu5Z7YUoWcm3ST0c7qNCNBA0HahS+XDhawpTF?=
=?us-ascii?Q?hKYOWEbCrtpCtS0uuisclAPNcNVSgm7Mlf57mShBOxYq7dXQ1IbIUTZz+YUC?=
=?us-ascii?Q?jI1G/Au3zXYM3/fCgJ9BkAXPKJh5r9yfnWmxmpqjC8ik/DSUtTLF8aivILtB?=
=?us-ascii?Q?Ev2mNo1KnIUHJR1Y+AG66jC+sm28PbteOmaqRDlBQyX8qDpPOxcjGuYzZhtr?=
=?us-ascii?Q?CtMnhJdef1BsJdCmto9r2eEftp7uoBg7kBzrShuyakCHWZpoJKQh85D840E+?=
=?us-ascii?Q?6mgpu77htJOL/+TKjsmqq7jCEkw8rlPJ4O/WApDaAkAEcV2J/vlUmSStAHO4?=
=?us-ascii?Q?/rnHUy10FSwCPR7d4vc6gIquJ9Y5d454IChbvCQaKfXpkePsiRVTwiSxk17H?=
=?us-ascii?Q?WnTSE+VflD2ID1x5tsVBg7XVmOmD2J01CpfnCHWNWvWC/NpOV3PHux33G38v?=
=?us-ascii?Q?42n+gZO91VGSGMaDwyfJOAI3axj+ntTRGa/kbxLKndOzsh6Odt9UQN9BADHj?=
=?us-ascii?Q?NmH2+lM6wg1woq3URMxP5T+Nk1ytku4JOEDVTQY2LWgMTK7/JDQ7byK9kigs?=
=?us-ascii?Q?s2uj/vCHC/9j5UD48sOmKo/RkCBDgnBfbkKQhdYF4WqbQbj74TfcbdCOaXOO?=
=?us-ascii?Q?47Y9F0qyYVg=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?Dfa7uVjIDcENdxt5fi4yBHNB5a/CQ/dW+OVDIH17YQIPYpL1jx8bkxvuTGKj?=
=?us-ascii?Q?W0vmc4Niy3u8xMrFBBsNqcHPXwxh40uIlbKY9bDdFqOrpgPu/vMIwP54CVLt?=
=?us-ascii?Q?oFExsFNbnAiPkUPS0wkeUAorD3wQi6czqH8w8rBbmO2FuvNHJj7O8A/0dlTO?=
=?us-ascii?Q?dCZsF6WxZiH0mjaRgyz0DBk5IPEeAOTBn3uoXygvhiRb8OrGbuGBw1iQMOoA?=
=?us-ascii?Q?k4weVZtlQtD6O/tLHCjpgX/SlDFGTnB+G7SVD13q9RNSIANcstDKm5js1Fwx?=
=?us-ascii?Q?Qp05s/trA/ErorwapdVL4OdnsTTfyDsLPMQa1fe699KR1BsbajRc4V3oD4Bs?=
=?us-ascii?Q?Uq2+oykT4qkaFwj4VO/tDVjETdo85bK1U49djBF27UHFePZuUz3VYOhnJGEH?=
=?us-ascii?Q?KTbC6VosBbJiKQSy0ZxlNoXvdN+mPc8G3QjO8uC01UcXkguthPxzOfoQUkrC?=
=?us-ascii?Q?86I2ck9/hM/sJC9VvMf5tcCZjWW4/19Xm2mQjZRwcQhElP4a6sZT2FZupVkW?=
=?us-ascii?Q?/cvjd3RZhomthXNSsVM3fYqgIrJS8MyyrbAZ/b2nhC7OVJ+5u29xCJOrZxLu?=
=?us-ascii?Q?3aMIQhGktWuJMRK7E2atHhCxhxyvtfZp5STlCIbJhZnrjJeMnYIs/bUUf3yH?=
=?us-ascii?Q?7zChfv2RIrgudf6vDcQPR3SligcboMTuZ6pJmGfucpzTUG8kIfLT8hhfr2Ks?=
=?us-ascii?Q?yTdFkuZNLL9h3p//kWLdHsRp2tDZBSqA9aOE7X3dpiEaYlJ1cAQ/DM70ydy4?=
=?us-ascii?Q?GGi6ikdHJFB0nT6mU4CLmvY7XBu1n7tv+9nesahtkCZySR4TgkLLlPNyq8Eg?=
=?us-ascii?Q?XbPOaf9A7B/onwWywaQa2CocWgnhA1l2BrcFYm4sahwwrkBwYF39It46GYQw?=
=?us-ascii?Q?rYI1NKmj+WW4m/j7HlRuPCMN4cdbpcIgXJjyVPU7kk34Po5pHsZevTloOk0d?=
=?us-ascii?Q?kOBfVimhGSMbc5S8YNf8eoOVrzNDHBgRcxL0LWxcj0/G8++e2GTsaw6rZriF?=
=?us-ascii?Q?zX8r06fYqK7mp/BrgEgpcbVgWsMA+ynvV09GsF/Tcy/0DCHYWFB1eToVVNyc?=
=?us-ascii?Q?8TTjVNkC6vJupQ311xWA2vShAEPP50uNXfA7yWhgbijR9bwgTWcB/pzIzHeh?=
=?us-ascii?Q?IC3ygFvWYwzldjF+LDyum4WM8O2ZAhOfI5/9YE0kZcahKn/7Kk09sWnRI3MK?=
=?us-ascii?Q?SgufLYKaiNiOo5qmCYnIBBkV142fVz25D3jCgbpdfz9g/qxfHBeEecBC/9bT?=
=?us-ascii?Q?LW6I3D2MfSLwnkvyApYSJonH49Z9fygZPn2tOnOjkMaIY2yHhShcBPnOlRU+?=
=?us-ascii?Q?0H7mulZIowSHuz8ztw68pYouGcKQRWVug3PRafZjukMKj7PZ+sAOapUFaweN?=
=?us-ascii?Q?u4dt+P/See0MPStre/MsoK3teE3DC+1NifmiSZO8yaFV7z1EDhCHZSSgW590?=
=?us-ascii?Q?0ovnYpn6bDnR4IO/WP0fHNpjj2J/Gi/AiWcKyw7N0Rj42c/4EQTSNAhJmtLN?=
=?us-ascii?Q?35gqjplQa4LmFytNQshh2iMMnbar1z6w23VIBBU05V+RTjUfBtvGLK51Lj/X?=
=?us-ascii?Q?1t/fKXZm5sslZuVE1v2Ne++OTXi1FZByeVhjlgnCvqJtVPY4Y4DipfbckctY?=
=?us-ascii?Q?dQ=3D=3D?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
EIYHYony58qN9BZw96q/eE5q7gSUutMB+TGdjDJfjJsujnjfQfPScrIpEHD6Ri6Vbsl2OECJSRQqBbRsCABTV7rkdl+oEh/as9eiRAQMizHbztA42nciQAIPciJrvgBS7COJ3R5EsCKPrXVsxyEYCyHyzGZFyUu82P6+77Gdiz3weBnq51jggdBXv4YhPZvqDA1qeEJnrPv+0abtxjI0YaHNmrIzQnNdu2py6ey4lUZ4IPxccmWSm4vlv1n7RHAUi5cy8TcuHg8F8MSMYzTA0Z10FgSJczAN1fhc1qN5DLWd7HDBsKzdAflnL55btEFwQrIidYANUwZOxkA67jmCNT5PEb+LSwAdoxaCjcGZCT9kCeKKJ8HSHNIxK9r5u9y8wkxxZJHRCtcvQjURjfGfgAEMm7oMonk2pHkzfHSm9lbwYIT+DzJs9cp23usN3RHrVjWd9kf39PyJxOMSb6WXhfnCY1l8WApCGVVrypmCat/Y+YTfO2tX9M2LNE0KKjBG97NPddVJGG8IZFhpZbWveyqcXx+pd6tpKfKrvfbVFgJeLhizZB6Z1/VPpc1zetXNjOedXCkWA63ZfeMk0jPocZv2tGJpiMitHJWLU5W8i5s=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: fef0a3f3-4920-4c4d-5857-08dda4f8da13
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 12:51:27.4696
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: BIDq7bFcErBQhRhWyP5nsjgwcgHbfpKOt7g/t4jXtUG0LnPRe1PSihSRzgh8dWnXo4yWL7cB/e7YA3Fv0MieX4lbMqe+nLPj9cfpRYOH53Y=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5772
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 bulkscore=0
mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 adultscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060116
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDExNiBTYWx0ZWRfXxnZbouR7sa+t MFKtRm1HlggNeF3/3WYNhVamZagZW1uO8WUMyFH5Kbu2nfgD/nlyEgFzuR5l/5ODtGHniuV2h4O 8IOwtsIxgcqR0l1Jz7OhaQ73RGjk7HBjAz3cSRqigLojzgsMyYSXi5JvvWBJSafUa8CLmN1bcvT
rIZqLdf+lPrCiWBeLhp2YxoZ/X14vuJL7CY6QM7X/HAo5LWt1K2HgcxfyQqDNHLnv9omOyxm8dn eHhJhEKB+AHoHkvuEdZymTAlTK3kCD3qymLjRK3pmyBOcbzU256KiL+s3HWugA0o1wjaltNCf/O 6pnZVXPmWVyB5rMlYfMe6IPdmHSIXMgIWsPCiS+XTpcjJq9HX7l20v6/WTkj9okJGMSkodMT2CV
Ihzt4H11FOhfKZT66aqUVzS/KxH7ec2Fv2IUY/idakNDc36RiZS5GsaEzjwDfs6gf62URazh
X-Proofpoint-GUID: ej45UXMGOLm4Ny8oEnjtqrNZbKoFcSRN
X-Proofpoint-ORIG-GUID: ej45UXMGOLm4Ny8oEnjtqrNZbKoFcSRN
X-Authority-Analysis: v=2.4 cv=H+Dbw/Yi c=1 sm=1 tr=0 ts=6842e454 b=1 cx=c_pps a=qoll8+KPOyaMroiJ2sR5sw==:117 a=qoll8+KPOyaMroiJ2sR5sw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=VwQbUJbxAAAA:8 a=1XWaLZrsAAAA:8 a=hSkVLCK3AAAA:8 a=yPCof4ZbAAAA:8 a=kKeYGVQPzdyspAW5r-MA:9 a=cQPPKAXgyycSBL8etih5:22 cc=ntf awl=host:13207
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

While an OOM failure in commit_merge() isn't really feasible due to the
allocation which might fail (a maple tree pre-allocation) being 'too small
to fail', we do need to handle this case correctly regardless.

In vma_merge_existing_range(), we can theoretically encounter failures
which result in an OOM error in two ways - firstly dup_anon_vma() might
fail with an OOM error, and secondly commit_merge() failing, ultimately, to
pre-allocate a maple tree node.

The abort logic for dup_anon_vma() resets the VMA iterator to the initial
range, ensuring that any logic looping on this iterator will correctly
proceed to the next VMA.

However the commit_merge() abort logic does not do the same thing. This
resulted in a syzbot report occurring because mlockall() iterates through
VMAs, is tolerant of errors, but ended up with an incorrect previous VMA
being specified due to incorrect iterator state.

While making this change, it became apparent we are duplicating logic - the
logic introduced in commit 41e6ddcaa0f1 ("mm/vma: add give_up_on_oom option
on modify/merge, use in uffd release") duplicates the vmg->give_up_on_oom
check in both abort branches.

Additionally, we observe that we can perform the anon_dup check safely on
dup_anon_vma() failure, as this will not be modified should this call fail.

Finally, we need to reset the iterator in both cases, so now we can simply
use the exact same code to abort for both.

We remove the VM_WARN_ON(err != -ENOMEM) as it would be silly for this to
be otherwise and it allows us to implement the abort check more neatly.

Reported-by: syzbot+d16409ea9ecc16ed261a@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://lore.kernel.org/linux-mm/6842cc67.a00a0220.29ac89.003b.GAE@xxxxxxxxxx/
Fixes: 47b16d0462a4 ("mm: abort vma_modify() on merge out of memory failure")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
---
mm/vma.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/mm/vma.c b/mm/vma.c
index 1497d7d28096..01b1d26d87b4 100644
--- a/mm/vma.c
+++ b/mm/vma.c
@@ -967,26 +967,9 @@ static __must_check struct vm_area_struct *vma_merge_existing_range(
err = dup_anon_vma(next, middle, &anon_dup);
}

- if (err)
+ if (err || commit_merge(vmg))
goto abort;

- err = commit_merge(vmg);
- if (err) {
- VM_WARN_ON(err != -ENOMEM);
-
- if (anon_dup)
- unlink_anon_vmas(anon_dup);
-
- /*
- * We've cleaned up any cloned anon_vma's, no VMAs have been
- * modified, no harm no foul if the user requests that we not
- * report this and just give up, leaving the VMAs unmerged.
- */
- if (!vmg->give_up_on_oom)
- vmg->state = VMA_MERGE_ERROR_NOMEM;
- return NULL;
- }
-
khugepaged_enter_vma(vmg->target, vmg->flags);
vmg->state = VMA_MERGE_SUCCESS;
return vmg->target;
@@ -995,6 +978,9 @@ static __must_check struct vm_area_struct *vma_merge_existing_range(
vma_iter_set(vmg->vmi, start);
vma_iter_load(vmg->vmi);

+ if (anon_dup)
+ unlink_anon_vmas(anon_dup);
+
/*
* This means we have failed to clone anon_vma's correctly, but no
* actual changes to VMAs have occurred, so no harm no foul - if the
--
2.49.0


Return-Path: <linux-kernel+bounces-675764-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A770741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:52:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id D92A4174E53
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:52:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B866528851F;
Fri, 6 Jun 2025 12:52:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="UsuohR8B"
Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195])
(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 4A81D2882D0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:52:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214344; cv=none; b=D7LTUBb0tGfkPDEagk1E0PNJcXaodyvPORkfJMt7hu8x1/BdGOdH1ZGdhL3JZANhqH/9PTTbXAZCkboHealBL/ojis9TppTeY/ww1OVdyyDCeSptZItLM1Xo/7cGi+v07kQmorkMV2guYlApP07wk7hA3GEvosNNIp8l7ykbZhM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214344; c=relaxed/simple;
bh=ONaGR/IRVw2brl1DvzP1xMGhlckfUTMY9+SsqjrbfPg=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=hWmQ9yXSXF60USLE5r0YYqpIv9z4MFnMdU8O/PQ8WhuDsa49hpoZ4yeV6/FbzOPTSLdhptwZS6sSCfTnKguElNFJi9szEbrSwzCHtqFYrCsp9tZDlTdhWZGE60Aehjc+D1vIVAV0Sp/yErOrtcv3J5HjYT9e1fPM0rjxPppVcCI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=UsuohR8B; arc=none smtp.client-ip=148.251.105.195
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com;
s=mail; t=1749214333;
bh=ONaGR/IRVw2brl1DvzP1xMGhlckfUTMY9+SsqjrbfPg=;
h=From:Date:Subject:To:Cc:From;
b=UsuohR8BVGL3hoDGKOENRcMyYwrH7PXGB6nIzpJJcd9dsTKapwMwwIYfjThp3U4Dj
CjE2pYUEez99p0mmuzfBhOyyKiF2s5qLMNNuLg1/ULMYVLKfBrQOcphJAoWk+ZdXLF
8mpXv9jZ7u29tNa4f4z3ZtyBkBmPeDp23ebvVPLnErLe6Ya8E07dAEON8q91eTq1vy
YE7i54WFjwBLn6EPsvWC0EPaxXsrsfgkWbzr6zcnnsLhNigHIDiCZJOSmMwaiF8+8+
HU0+OVLXzNp3JVyHzzy3KVfNdix50em8HlLgSO+7aG3reF1ziMjJpsr7sErTDDwjIf
f9gp6zkfw5Mng==
Received: from yukiji.home (amontpellier-657-1-116-247.w83-113.abo.wanadoo.fr [83.113.51.247])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
(Authenticated sender: laeyraud)
by bali.collaboradmins.com (Postfix) with ESMTPSA id 1A8D817E0097;
Fri, 6 Jun 2025 14:52:13 +0200 (CEST)
From: Louis-Alexis Eyraud <louisalexis.eyraud@xxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 14:50:12 +0200
Subject: [PATCH] drm/mediatek: mtk_dpi: Reorder output formats on MT8195/88
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-mtk_dpi-mt8195-fix-wrong-color-v1-1-47988101b798@xxxxxxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIAAPkQmgC/zWN0QrCMAxFf6Xk2UBX2NT9igzp1mwGbTvbqoOxf
zc4fAon3HvPCpkSU4ZWrZDozZljEKgOCoabDRMhO2Ew2tS60Q36cr+6meWeqnONIy/4STFMOMR
HTFhb2+uxccaZI8jInEgiP8Gl2znR8yWesj+ht5mk7D2XVgVaCv5d0G3bF5y7KZShAAAA
X-Change-ID: 20250606-mtk_dpi-mt8195-fix-wrong-color-5aab0f6d2d27
To: Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx>,
Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>, Matthias Brugger <matthias.bgg@xxxxxxxxx>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
Cc: kernel@xxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-mediatek@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
Louis-Alexis Eyraud <louisalexis.eyraud@xxxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749214333; l=1912;
i=louisalexis.eyraud@xxxxxxxxxxxxx; s=20250113; h=from:subject:message-id;
bh=ONaGR/IRVw2brl1DvzP1xMGhlckfUTMY9+SsqjrbfPg=;
b=r+8ZRVrWvUhL7zhQKD0bz2TF1ADcbbp8UxfIUYKGE063dqymCkH8GA0zB9oOA53Fu0uliBLWk
yAQnN9JQ/64DgZai79+2/AT7eYsADajmrCfzOgjnNv6+STVh5slLa1M
X-Developer-Key: i=louisalexis.eyraud@xxxxxxxxxxxxx; a=ed25519;
pk=CHFBDB2Kqh4EHc6JIqFn69GhxJJAzc0Zr4e8QxtumuM=
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Reorder output format arrays in both MT8195 DPI and DP_INTF block
configuration by decreasing preference order instead of alphanumeric
one, as expected by the atomic_get_output_bus_fmts callback function
of drm_bridge controls, so the RGB ones are used first during the
bus format negotiation process.

Fixes: 20fa6a8fc588 ("drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88")
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@xxxxxxxxxxxxx>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 6fb85bc6487a019cdcdb3770dc06a1deab8d5bda..a2fdceadf209f6d2166e7523b82ca18c82c7d435 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -1095,7 +1095,6 @@ static const u32 mt8183_output_fmts[] = {
};

static const u32 mt8195_dpi_output_fmts[] = {
- MEDIA_BUS_FMT_BGR888_1X24,
MEDIA_BUS_FMT_RGB888_1X24,
MEDIA_BUS_FMT_RGB888_2X12_LE,
MEDIA_BUS_FMT_RGB888_2X12_BE,
@@ -1103,18 +1102,19 @@ static const u32 mt8195_dpi_output_fmts[] = {
MEDIA_BUS_FMT_YUYV8_1X16,
MEDIA_BUS_FMT_YUYV10_1X20,
MEDIA_BUS_FMT_YUYV12_1X24,
+ MEDIA_BUS_FMT_BGR888_1X24,
MEDIA_BUS_FMT_YUV8_1X24,
MEDIA_BUS_FMT_YUV10_1X30,
};

static const u32 mt8195_dp_intf_output_fmts[] = {
- MEDIA_BUS_FMT_BGR888_1X24,
MEDIA_BUS_FMT_RGB888_1X24,
MEDIA_BUS_FMT_RGB888_2X12_LE,
MEDIA_BUS_FMT_RGB888_2X12_BE,
MEDIA_BUS_FMT_RGB101010_1X30,
MEDIA_BUS_FMT_YUYV8_1X16,
MEDIA_BUS_FMT_YUYV10_1X20,
+ MEDIA_BUS_FMT_BGR888_1X24,
MEDIA_BUS_FMT_YUV8_1X24,
MEDIA_BUS_FMT_YUV10_1X30,
};

---
base-commit: b3bded85d838336326ce78e394e7818445e11f20
change-id: 20250606-mtk_dpi-mt8195-fix-wrong-color-5aab0f6d2d27

Best regards,
--
Louis-Alexis Eyraud <louisalexis.eyraud@xxxxxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675765-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 59AF541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:53:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 15A5F1892E64
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:54:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 88CDD2882D0;
Fri, 6 Jun 2025 12:53:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WluuDH+C"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13])
(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 286F3287515;
Fri, 6 Jun 2025 12:53:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214430; cv=none; b=laDGaDuYsWjci79M60WzZoc70JR5uXVK8QG1ZWHLfCHrkgu1VEbODp8Qr4J4/deImTfErvXcH8Gk9LT882OVaD7f3l8dvXkwzN0b2KNdzeX4e0yl0mmKrHIkZtJ3vouWQVjet3KsE2GmomV6+w1GiQ+UiV6mjZXty37AsMTyRkY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214430; c=relaxed/simple;
bh=n1wykN0q4zEYvLq7DTQo3g0PyzEzM3Sutii1zJAfHIY=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=a8VWm8LNnjhnl8W6gORhpCPSEu7orXQwmJO8WP+4C1FkZy9Sh3HJ5y/CVZVv+d08Y1dDtsmYxNRds5nv9w7EKqmsd1p2wPSUoYQRdSewxS6beL1YlYaFZ8+Al2ROUQa6FKHMUvMJSXlP6qWjzoFsU9pN0MR0SWV/nqDdTRl4+jQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WluuDH+C; arc=none smtp.client-ip=198.175.65.13
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749214429; x=1780750429;
h=date:from:to:cc:subject:message-id:references:
mime-version:in-reply-to;
bh=n1wykN0q4zEYvLq7DTQo3g0PyzEzM3Sutii1zJAfHIY=;
b=WluuDH+CPB477xP4ido3tnucJrMFa3GY47k/qn+O5i2UlMJdpo5IvcVw
C6cric8SLZgRPXjJVj/n1jhPRE0+mo7yrU50REj/sar4QpSgROzgaUbQx
KbsHUmQURLiPUdkBuf7cZ6fObrdmcFpP//DM/HG3PqwFzwCvdchtypYFC
Dj+m33JbfQFkNzE5tFtxOIsJgX0id6V43a3yawSHpBcpYjqGbKEfL64Tl
enwqHyLtHS+Khn8amTuvMklq6UzSGUQeC42IAYYM7Vj+5l+llnH0e7QdJ
P6f1CBUEPaYmkU49y8yqi2vAJEU8wEW1Fkb0nDBlRAQJaRTuINTrLCOfR
A==;
X-CSE-ConnectionGUID: 8z9dY4TaR2iV8SLF2aMU/Q==
X-CSE-MsgGUID: 6e8OgLxAToeMKTvy/YGOPQ==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="62409313"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="62409313"
Received: from orviesa002.jf.intel.com ([10.64.159.142])
by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 05:53:49 -0700
X-CSE-ConnectionGUID: PBzPIMJlR4+S61gzOioHKA==
X-CSE-MsgGUID: yWnVIu1CTEK2prYn7GVKXg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="176771560"
Received: from lkp-server01.sh.intel.com (HELO e8142ee1dce2) ([10.239.97.150])
by orviesa002.jf.intel.com with ESMTP; 06 Jun 2025 05:53:46 -0700
Received: from kbuild by e8142ee1dce2 with local (Exim 4.96)
(envelope-from <lkp@xxxxxxxxx>)
id 1uNWZr-0004zB-32;
Fri, 06 Jun 2025 12:53:43 +0000
Date: Fri, 6 Jun 2025 20:53:08 +0800
From: kernel test robot <lkp@xxxxxxxxx>
To: Masahiro Yamada <masahiroy@xxxxxxxxxx>, linux-kbuild@xxxxxxxxxxxxxxx
Cc: llvm@xxxxxxxxxxxxxxx, oe-kbuild-all@xxxxxxxxxxxxxxx,
Petr Pavlu <petr.pavlu@xxxxxxxx>,
Alexey Gladkov <legion@xxxxxxxxxx>,
Ard Biesheuvel <ardb@xxxxxxxxxx>,
Nathan Chancellor <nathan@xxxxxxxxxx>,
Nicolas Schier <nicolas@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
Masahiro Yamada <masahiroy@xxxxxxxxxx>
Subject: Re: [PATCH 3/4] kbuild: keep .modinfo section in vmlinux.unstripped
Message-ID: <202506062053.zbkFBEnJ-lkp@xxxxxxxxx>
References: <20250606041029.614348-4-masahiroy@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606041029.614348-4-masahiroy@xxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Masahiro,

kernel test robot noticed the following build warnings:

[auto build test WARNING on masahiroy-kbuild/for-next]
[also build test WARNING on masahiroy-kbuild/fixes linus/master v6.15 next-20250606]
[cannot apply to herbert-cryptodev-2.6/master herbert-crypto-2.6/master arnd-asm-generic/master mcgrof/modules-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Masahiro-Yamada/module-remove-meaningless-name-parameter-from-__MODULE_INFO/20250606-121255
base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next
patch link: https://lore.kernel.org/r/20250606041029.614348-4-masahiroy%40kernel.org
patch subject: [PATCH 3/4] kbuild: keep .modinfo section in vmlinux.unstripped
config: s390-randconfig-002-20250606 (https://download.01.org/0day-ci/archive/20250606/202506062053.zbkFBEnJ-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/202506062053.zbkFBEnJ-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506062053.zbkFBEnJ-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> s390x-linux-ld: .tmp_vmlinux1: warning: allocated section `.modinfo' not in segment
>> s390x-linux-ld: .tmp_vmlinux2: warning: allocated section `.modinfo' not in segment
>> s390x-linux-ld: vmlinux.unstripped: warning: allocated section `.modinfo' not in segment

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Return-Path: <linux-kernel+bounces-675766-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 99DBA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:56:12 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id C3ADE174BB3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:56:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DA6A9288C19;
Fri, 6 Jun 2025 12:56:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uBFbsyo4"
Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AFB6F9EC
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:56:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214566; cv=none; b=lsoj/t4BREAARJv7s431+r7UCLw0mQ3EuSWsXZDA44o7jlNQ/ny2QXntx7ZOwqX1B4sCPaqP+SUUZjAlqGm7wtVdUBiyyzAWRT1bmgUUNeUPaBI88FTCNRk2cfMk37+yaS+w6vdtjhUKW7sitX3twe2t1vvQt3ajgQcfeVjKhM0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214566; c=relaxed/simple;
bh=pyP4voBTnGow5cseeEAeEmJxNYO/WBjrdKku1W4VhIE=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=F6H+Z7w25b23IgTq+Xtr2tKj9zUtfSg7SdlWX6DwyMw9Ts41BVv7/plnk+KEIeAmmxKqivk82xi7SbxtN0FybtBrkyVOGUfDuYLi4aKWSbJtSaJLGtGzt25NaflcEi63X209PxJy0plrgvzUvzvaQZ2POT/mNWfwL2b7Vfa6jg8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uBFbsyo4; arc=none smtp.client-ip=209.85.208.45
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com
Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5f438523d6fso8595a12.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:56:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749214561; x=1749819361; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=lej/JzmO0Dw1V/XOb+M60AVoOmPPuLiZ67cVi04ciIo=;
b=uBFbsyo4SkLBrAKLUmvzR34JtdqTWUnPPAzOILSYG9PupdcRaLlRR1c20f/GeS3vtu
C9tQgaeTLgKSWtL/v/yTjo2P4Ll4p9cc2A8YCSkW4ZL67RntHfZlMp3P72vy0vo9DZad
JlNETEPiBUdgZ61Ip/DDT9cGMlNBraDcgHbb4mBhK/MGdCifR2Ow4PebsehI9l87XapG
JzWza0J/yxV33ob9S2cun7Ux407OSytqlFY1Tn80JhXTcEWPzdmXo63LA/yMgBwZu3+X
8v8t7gYstMSJpWb3VvHhmRMbjUJ33dMF1lICdlDADiADxMOGMcNqfWXTaPo+GVk73J7w
Z+Qg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749214561; x=1749819361;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=lej/JzmO0Dw1V/XOb+M60AVoOmPPuLiZ67cVi04ciIo=;
b=DYUR+/65YnMRfNpN9gN2Ro5dl+A0EizruhkfgMnp04czY459biYS+r9fHTx38mpqrv
ZN6bdS8QApJGSqa7VjODnQ+fGV/BQLlOBCiPX8thWt/KRQGedGCPFar1exji+oNz3rL2
w0QzWIEn53CughZSw3bGbIkavXyciJioTdtHFTbog5szmYmAoK2LeiGYhqN4mvX/PBOm
SIQeLcCTOhYpgSCF2b86spzAIB0AAUPfTAJ37KpaYEqKDixn0Ac1HKjhGI5ooCC7/qDj
H2MSUkAfqwHlPsAEY0qQTmHpF7bZe+xTTbExd+MF63S5Fnvux7WJssKsvH7UQkr29DAa
bBNg==
X-Forwarded-Encrypted: i=1; AJvYcCV9Lx7AbfJs4gnkwXnhZXPBp3E33Vaja3JQGB0kADJ02FVGRFh926q/HGa/iLXlOtnd3XxqYYhhfpOicSY=@vger.kernel.org
X-Gm-Message-State: AOJu0YyBaCSkMhqWUcnekAs01zskfncH/l5UkhCIncreBlOkHxcMutvD
TLTaFRlxIBlP0oB6wLWLCVZ3r5RGhJpxtw/LVwrM+2XyMaxK+YDCSD/eEZRvmVGsqG0HckhGnoU
ugujZiWu2J10FoqLIpN0HzyEusGs6d5KoesEIYkYG
X-Gm-Gg: ASbGncvkStP77FYL9nNLjRARkoX7EdRTeJPa/rWV06btLUOLCfWqqQHBsry5YSbccNJ
zUurm2d8q/m5QqFyNbK9VVOrKAgxLr57LUEd4+6T1YPrWjPdPCxcHhcDC8WEoBmZaq8NoPCmNrO
AGT8ho8dnTrTwoI+PdtF0cjR2rGbzQDB4bcQQJNoNjeslI9V6zhgRdSHqzpt2eUarJMV/Zlw==
X-Google-Smtp-Source: AGHT+IHXwcAquv0lb5IUM1aVYSbEaPQ46aM0vazICMyj+IzmQp//DMyCXsrGOLh2XTNX6ibsNYUExUiUldgyqMaL0gE=
X-Received: by 2002:aa7:c346:0:b0:607:1323:9c2c with SMTP id
4fb4d7f45d1cf-607793de3b1mr62222a12.7.1749214561141; Fri, 06 Jun 2025
05:56:01 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250603-fork-tearing-v1-0-a7f64b7cfc96@xxxxxxxxxx>
<20250603-fork-tearing-v1-1-a7f64b7cfc96@xxxxxxxxxx> <ba208d76-7992-4c70-be8f-49082001f194@xxxxxxx>
In-Reply-To: <ba208d76-7992-4c70-be8f-49082001f194@xxxxxxx>
From: Jann Horn <jannh@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:55:25 +0200
X-Gm-Features: AX0GCFtRkqF2Lt6u6n6mq4FlDl2aj4mZ-IS4O5MGhg5wVl65bWzoxagLke2Bp80
Message-ID: <CAG48ez1R7v-L-L33nJUXtj_Y=SKyyFcU8amLs0dQ6ecuC3xMWA@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 1/2] mm/memory: ensure fork child sees coherent memory snapshot
To: Vlastimil Babka <vbabka@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>, "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Mike Rapoport <rppt@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>, Michal Hocko <mhocko@xxxxxxxx>,
linux-mm@xxxxxxxxx, Pedro Falcato <pfalcato@xxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 5, 2025 at 9:33=E2=80=AFAM Vlastimil Babka <vbabka@xxxxxxx> wro=
te:
> On 6/3/25 20:21, Jann Horn wrote:
> > When fork() encounters possibly-pinned pages, those pages are immediate=
ly
> > copied instead of just marking PTEs to make CoW happen later. If the pa=
rent
> > is multithreaded, this can cause the child to see memory contents that =
are
> > inconsistent in multiple ways:
> >
> > 1. We are copying the contents of a page with a memcpy() while userspac=
e
> > may be writing to it. This can cause the resulting data in the child=
to
> > be inconsistent.
> > 2. After we've copied this page, future writes to other pages may
> > continue to be visible to the child while future writes to this page=
are
> > no longer visible to the child.
> >
> > This means the child could theoretically see incoherent states where
> > allocator freelists point to objects that are actually in use or stuff =
like
> > that. A mitigating factor is that, unless userspace already has a deadl=
ock
> > bug, userspace can pretty much only observe such issues when fancy lock=
less
> > data structures are used (because if another thread was in the middle o=
f
> > mutating data during fork() and the post-fork child tried to take the m=
utex
> > protecting that data, it might wait forever).
> >
> > On top of that, this issue is only observable when pages are either
> > DMA-pinned or appear false-positive-DMA-pinned due to a page having >=
=3D1024
> > references and the parent process having used DMA-pinning at least once
> > before.
>
> Seems the changelog seems to be missing the part describing what it's doi=
ng
> to fix the issue? Some details are not immediately obvious (the writing
> threads become blocked in page fault) as the conversation has shown.

I tried to document this in patch 2/2, where I wrote this (though I
guess I should maybe make it more verbose and not just say "subsequent
writes are delayed until mmap_write_unlock()"):

+ * - Before mmap_write_unlock(), a TLB flush ensures that parent threads =
can't
+ * write to copy-on-write pages anymore.
+ * - Before dup_mmap() copies page contents (which happens rarely), the
+ * parent's PTE for the page is made read-only and a TLB flush is issue=
d, so
+ * subsequent writes are delayed until mmap_write_unlock().

But I guess this way makes it hard to review patch 1/2 individually.
Should I just squash the two patches together, and then write in the
commit message "see the comment blocks I'm adding for the fix
approach"? Or is there value in repeating the explanation in the
commit message?

> > Fixes: 70e806e4e645 ("mm: Do early cow for pinned pages during fork() f=
or ptes")
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>
>
> Given how the fix seems to be localized to the already rare slowpath and
> doesn't require us to pessimize every trivial fork(), it seems reasonable=
to
> me even if don't have a concrete example of a sane code in the wild that'=
s
> broken by the current behavior, so:
>
> Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

Thanks!


Return-Path: <linux-kernel+bounces-675767-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EE45A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:56:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9BF6D3AA899
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:56:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D6ED288C34;
Fri, 6 Jun 2025 12:56:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uWVw3eZf"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26FC3F9EC;
Fri, 6 Jun 2025 12:56:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214597; cv=none; b=ndNPFp3rso6vpkArj4hSL/i2Z4gzRxo8UDmbDIAvP0OFkaoJZVBI9rw3Ql2pjNQwBV565wNWRoM84TYhxXnIBWuZCAIIyjhiX01Ovc4jFGRYeZCaMj2qxurQ/gO/lR5yUFT/vJniAXuFOjJWJr5XNXV4f4tDj21aPORvhC52oyE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214597; c=relaxed/simple;
bh=wL+fp9VarHsGsJlpL4iAZOPtoMI7My2h8+Cxc+j3Ilk=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=WaloMMDkf75Hg7lpHh+yozoCPDDSnICG2K/pEyF/t551KD9yF5T+uy0uUfer1CKz/S9wgH4JRbLoyRDygB8WslwS+HLdDz85d/hgZPR3256N5V5IvK8Tp1fvY9yNHGiXXsqdnhqYOzXHUJTOYlskm3z1JcDggMzUWogPZTjwNB0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uWVw3eZf; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F27CC4CEEB;
Fri, 6 Jun 2025 12:56:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749214596;
bh=wL+fp9VarHsGsJlpL4iAZOPtoMI7My2h8+Cxc+j3Ilk=;
h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
b=uWVw3eZfQG4ABC2YEDR5x8sQOOzjay1g+6GCYgiUX79IFg2pmG+OzucJ7ipVsIZ1P
KPMOLZTsMJp9xDBu7ZsU8RyfMdUwMczvQ72xZKIUW/0B2G41U6RJ9SmriKAX9XBaar
UgcUM20QD4F9s4QrQlNJ4fXvQLPwaR/v1JYN+9PoGQpBEUdNFFTt/kF2+E1qtl9plP
YNrs90yOkij9xgzqRfJwrdacOgDC3PqfcbjjFRjZ+OJv6rW0VNxjDeQRpOQDsf+eoD
8WvOa+E+/GON3apsn916x7JRccMZOxmVWn0fkEk6L2wAG3JKgYs4lK+qra9aJ0Dm3C
5UvWrt9R7YMtA==
Message-ID: <247002c0-ee68-4d0d-857a-768bf68bce75@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 14:56:31 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 0/3] media: venus: enable venus on qcs615
To: Renjiang Han <quic_renjiang@xxxxxxxxxxx>,
Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>,
Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Cc: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>,
Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley
<conor+dt@xxxxxxxxxx>, linux-media@xxxxxxxxxxxxxxx,
linux-arm-msm@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>
References: <20250530-add-venus-for-qcs615-v8-0-c0092ac616d0@xxxxxxxxxxx>
<wmri66tkksq6i3hfyoveedq5slghnnpozjzx6gck5r3zsiwsg6@xevgh54rnlqd>
<285cae4a-219c-4514-818f-34c8225529de@xxxxxxxxxxx>
<5854a587-aba7-4e71-87f8-249ba00cbc59@xxxxxxxxxx>
<996c9a39-5520-4b43-adfa-06ce29223ba0@xxxxxxxxxxx>
<713b87cb-0003-4ee3-a599-9cd41629bb42@xxxxxxxxxx>
<7aa36a0f-6741-40c2-93f4-036823d245fd@xxxxxxxxxxx>
From: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=krzk@xxxxxxxxxx; keydata=
xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79
cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu
JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH
gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE
J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj
NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS
BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU
vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM
Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD
TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg
S296bG93c2tpIDxrcnprQGtlcm5lbC5vcmc+wsGVBBMBCgA/AhsDBgsJCAcDAgYVCAIJCgsE
FgIDAQIeAQIXgBYhBJvQfg4MUfjVlne3VBuTQ307QWKbBQJoF1BKBQkWlnSaAAoJEBuTQ307
QWKbHukP/3t4tRp/bvDnxJfmNdNVn0gv9ep3L39IntPalBFwRKytqeQkzAju0whYWg+R/rwp
+r2I1Fzwt7+PTjsnMFlh1AZxGDmP5MFkzVsMnfX1lGiXhYSOMP97XL6R1QSXxaWOpGNCDaUl
ajorB0lJDcC0q3xAdwzRConxYVhlgmTrRiD8oLlSCD5baEAt5Zw17UTNDnDGmZQKR0fqLpWy
786Lm5OScb7DjEgcA2PRm17st4UQ1kF0rQHokVaotxRM74PPDB8bCsunlghJl1DRK9s1aSuN
hL1Pv9VD8b4dFNvCo7b4hfAANPU67W40AaaGZ3UAfmw+1MYyo4QuAZGKzaP2ukbdCD/DYnqi
tJy88XqWtyb4UQWKNoQqGKzlYXdKsldYqrLHGoMvj1UN9XcRtXHST/IaLn72o7j7/h/Ac5EL
8lSUVIG4TYn59NyxxAXa07Wi6zjVL1U11fTnFmE29ALYQEXKBI3KUO1A3p4sQWzU7uRmbuxn
naUmm8RbpMcOfa9JjlXCLmQ5IP7Rr5tYZUCkZz08LIfF8UMXwH7OOEX87Y++EkAB+pzKZNNd
hwoXulTAgjSy+OiaLtuCys9VdXLZ3Zy314azaCU3BoWgaMV0eAW/+gprWMXQM1lrlzvwlD/k
whyy9wGf0AEPpLssLVt9VVxNjo6BIkt6d1pMg6mHsUEVzsFNBFVDXDQBEADNkrQYSREUL4D3
Gws46JEoZ9HEQOKtkrwjrzlw/tCmqVzERRPvz2Xg8n7+HRCrgqnodIYoUh5WsU84N03KlLue
MNsWLJBvBaubYN4JuJIdRr4dS4oyF1/fQAQPHh8Thpiz0SAZFx6iWKB7Qrz3OrGCjTPcW6ei
OMheesVS5hxietSmlin+SilmIAPZHx7n242u6kdHOh+/SyLImKn/dh9RzatVpUKbv34eP1wA
GldWsRxbf3WP9pFNObSzI/Bo3kA89Xx2rO2roC+Gq4LeHvo7ptzcLcrqaHUAcZ3CgFG88CnA
6z6lBZn0WyewEcPOPdcUB2Q7D/NiUY+HDiV99rAYPJztjeTrBSTnHeSBPb+qn5ZZGQwIdUW9
YegxWKvXXHTwB5eMzo/RB6vffwqcnHDoe0q7VgzRRZJwpi6aMIXLfeWZ5Wrwaw2zldFuO4Dt
91pFzBSOIpeMtfgb/Pfe/a1WJ/GgaIRIBE+NUqckM+3zJHGmVPqJP/h2Iwv6nw8U+7Yyl6gU
BLHFTg2hYnLFJI4Xjg+AX1hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/
JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu
4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB
YpsFAmgXUF8FCRaWWyoACgkQG5NDfTtBYptO0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v
qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5
RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg
Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2
H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB
dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT
AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu
jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2
zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw
XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A=
In-Reply-To: <7aa36a0f-6741-40c2-93f4-036823d245fd@xxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 14:51, Renjiang Han wrote:
>
> On 6/6/2025 8:44 PM, Krzysztof Kozlowski wrote:
>> On 06/06/2025 14:37, Renjiang Han wrote:
>>> On 6/5/2025 8:34 PM, Bryan O'Donoghue wrote:
>>>> On 31/05/2025 01:05, Renjiang Han wrote:
>>>>>>> Note:
>>>>>>> This series consist of DT patches and a venus driver patch. The patch
>>>>>>> 1/3, which is venus driver patch, can be picked independently without
>>>>>>> having any functional dependency. But patch 2/3 & patch 3/3, which are
>>>>>>> DT patches, still depend on [1].
>>>>>> I'd say 2/3 and 3/3 still depend on 1/3, otherwise we can get video
>>>>>> core
>>>>>> on QCS615 over(?)clocked.
>>>>> Agree, so we need to make sure that the driver patch is not picked
>>>>> after the DT patch.
>>>> This statement is confusing.
>>>>
>>>> 1/3 states that there will be a fallback if there is no OPP table
>>>> present.
>>>>
>>>> Giving the code a glance, I believe that is so, freq_table should be
>>>> used if there is no OPP specified in the DT.
>>>>
>>>> I think we are having a hard time here understanding what you are saying.
>>>>
>>>> My understanding:
>>>>
>>>> - venus modification is standalone 1/3
>>>>   Qcs615 will fallback if no OPP is present
>>>>
>>>> - dt modification 2/3 3/3 is therefore also independent of driver
>>>>
>>>> ---
>>>> bod
>>> yes, let me re-spin this with driver patch alone. Once that gets in,
>>> will bring in the DT patches.
>> Did you read my feedback? There is no "once that gets in". DTS is an
>> independent hardware description and your patchset claiming there is
>> dependency is just broken.
>>
>> I am repeating this since few emails, so shall I NAK it that you will
>> address the main issue you have?
>>
>> Best regards,
>> Krzysztof
>
> Hi Krzysztof
>
> SC7180 and QCS615 use the same video core. Only difference lies in the
> freq_table for the video. Freq_table is generally determined at SOC level.
> The Venus driver does not currently handle freq_table compatibility well
> across platforms. This patch enables the driver to use the OPP-table from
> the DT, addressing the frequency compatibility issue.
This does not resolve the main problem at all. If SW cannot use the
fallback alone, your fallback has no meaning and is not only confusing
but actually incorrect. And based on previous statements like
"overclocking" it is not only incorrect, but even harmful.

Best regards,
Krzysztof


Return-Path: <linux-kernel+bounces-675768-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7DA1841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:58:23 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id C23BD17542E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:58:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EAD6A288C08;
Fri, 6 Jun 2025 12:58:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="Bw4gDrkF"
Received: from mail.alien8.de (mail.alien8.de [65.109.113.108])
(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 DBA02F9EC
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:58:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214696; cv=none; b=LvFvyrMiprKeEv4DFZPbASdYpaWW2C3WRbCbibqdg9BBZqo4X00FffRxJ1YyDKb226oUMD93lgbUTjAj9myYNeqGvO3fwlDBHR/YNJG+C6YPgvNDTZSYXWc5BDJAjLYFDzUi59/xwzalqsp96/JaajIQWM6cl7SUMcBTHXRvdJ8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214696; c=relaxed/simple;
bh=Pt7QQPoWmy8Bekvkn4vjd/fGg5NotBVDBt9/9nKQ0Rs=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=XWWZpvv2chYx9qRUhI6oCT1/SnAsvmybmBqw0I93A0lV9paHV61+4bkND3tYFIffbGUM7zayFzWl/FOvX+2Sk4hxnCFXAxWnFk0T4qMj0lvzMdHLOG1AONPAOCUVyWEkiO8qS4mg8y/QDIvVht9/qyq8SNXaGANdPQTrXenCuu0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=Bw4gDrkF; arc=none smtp.client-ip=65.109.113.108
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de
Received: from localhost (localhost.localdomain [127.0.0.1])
by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 38FA140E015F;
Fri, 6 Jun 2025 12:58:01 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at mail.alien8.de
Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key)
header.d=alien8.de
Received: from mail.alien8.de ([127.0.0.1])
by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id ZQgywUR7yMxF; Fri, 6 Jun 2025 12:57:58 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8;
t=1749214678; bh=Pt7QQPoWmy8Bekvkn4vjd/fGg5NotBVDBt9/9nKQ0Rs=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=Bw4gDrkFIxIW1OLoqyU8dBiO6qqvrYtOfgM4eXPqiY1415vfmLs+wF7+HHeR2N59V
v7kXQTSlZgi+g8WCjhMNggjLxv0DsGQSgggcF0h9YoOBlXSpnI8SdwQOy8cPp+kk6T
Ql0lzCYEK47QeiUteQJ8H41J7SAYE3+2nljaOm5b3Nl3rX/f10WpQSwFflu1gxnffp
m95X0HJLkc+Gwy2EwZU9tMDFaLfB8ND0KiH+c/Ufo9vAq61QtMJMF2xtlGYXFIQ+Cg
BBdk/nmeZ+mT7NQAElCnDRVbSeoeTbBGYPG8+MU8oE48e2WHs8xVf0HUi9vsuWtIl9
hrTNCPzXroORgm6GIOh7K8FkPWfbrNsYepgRZoCjrkuJqjbSRLxKqgrw8bIGfL1qKk
BAA2NqqL9imB7Qq//iHIaS+5tB7CnZzSbEguvVgv0j2U5P/5rZEFOf1xavdLUpusja
u6Sa6VfHgoo7aIr+/7+5NxLIqyLHV64Sr1PTZepyd8Oyh/til509gfNKvIXeVN479g
M+7QejcopM0t62eRoOdsT55QV6CMe8ZTowBicUm+LBd1wdFfTRSVJPUUw+5HiFxEBr
55WWb9kEPoKus/jcZgUL88HMNtlonCgcLvpXYytNQrWrtjt19f/TLRTFvQWJs/a4Mh
puOkM+lU+cq/oLA8/3Cy2ojE=
Received: by mail.alien8.de (SuperMail on ZX Spectrum 128k, from userid 1005)
id 0268D40E0169; Fri, 6 Jun 2025 12:57:57 +0000 (UTC)
Date: Fri, 6 Jun 2025 12:57:57 +0000
From: Borislav Petkov <bp@xxxxxxxxx>
To: Alexey Kardashevskiy <aik@xxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, Thomas Gleixner <tglx@xxxxxxxxxxxxx>,
Ingo Molnar <mingo@xxxxxxxxxx>,
Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>,
"H. Peter Anvin" <hpa@xxxxxxxxx>,
Nikunj A Dadhania <nikunj@xxxxxxx>,
Ard Biesheuvel <ardb@xxxxxxxxxx>,
Brijesh Singh <brijesh.singh@xxxxxxx>,
Ashish Kalra <ashish.kalra@xxxxxxx>,
Paolo Bonzini <pbonzini@xxxxxxxxxx>,
Michael Roth <michael.roth@xxxxxxx>,
Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>,
Liam Merwick <liam.merwick@xxxxxxxxxx>,
Tom Lendacky <thomas.lendacky@xxxxxxx>, x86@xxxxxxxxxx
Subject: Re: [PATCH 0/4] x86/sev: Rework SNP Guest Request
Message-ID: <20250606125757.GAaELl1eQ64YLesdrd@fat_crate.local>
References: <20250505141238.4179623-1-aik@xxxxxxx>
<fae08232-51ed-cc88-3de0-1cd9b014603b@xxxxxxx>
<33e24f7a-427d-43ef-ac48-ff665e1c1914@xxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <33e24f7a-427d-43ef-ac48-ff665e1c1914@xxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 12:40:15PM +1000, Alexey Kardashevskiy wrote:
> Ping?

Yes, please send a new version collecting all feedback and rebased on
6.16-rc1 after it releases next week.

Thx.


Return-Path: <linux-kernel+bounces-675769-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A1E4441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 08:58:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id E00D21755A7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:58:45 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AA4F288C27;
Fri, 6 Jun 2025 12:58:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=vayavyalabs.com header.i=@vayavyalabs.com header.b="OaGyYPOp"
Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE54BF9EC
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:58:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214717; cv=none; b=ZGaX9K0wrKl/Iljv6Q+T7X8cf/gfA8qD4faWM9kH5uYcNTj5DVIPfs9l0jhhsWPb28qZn5CG/yN9Eo7MHwoieJeIYAH80kEyIejff/gQc1HEIms6w27075/X9/rR2+7aOcdziNQR874HrJF1cVgo5Ge5Vb9IsH9p3QFO5szA438=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214717; c=relaxed/simple;
bh=uha/h2PgevouYEmmRxRudFkJsETHpxRuQukXfnQhRqQ=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=GiKbRQUTSToxiTncSV5aFugkif77R+SOL8Rq8+B5V1LwapKkP5qYvAGIwSGsmT+zCHDQGz56pI0UIykTm/ne4Lisnl9Zr9V9fSQ+uj7nMVtZ4kbyr6q0t1TM6EEL/gl3tvDx+WTvQ2s9IDuHkQiEFnntxAI7lNXe8tOGo24UMBE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=vayavyalabs.com; spf=pass smtp.mailfrom=vayavyalabs.com; dkim=pass (1024-bit key) header.d=vayavyalabs.com header.i=@vayavyalabs.com header.b=OaGyYPOp; arc=none smtp.client-ip=209.85.219.176
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=vayavyalabs.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vayavyalabs.com
Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-e81a7d90835so660727276.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 05:58:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=vayavyalabs.com; s=google; t=1749214715; x=1749819515; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=PYVM84VoP6sUarPE9u1qb7GqcXhlKnWyP+lB1fAcnnY=;
b=OaGyYPOpDrckLwTVUDX9k+4Yzdpwrhe3Pek6SVngf+p+PKrnnG0Wx9ZPE7Ux6SAI+Z
GWLj1BAoOkvbrvlu3m78lUeXinSY+/nX4RkFtIRNISxEBuDfIdijizepEwdboTWx71ah
Iq1CXtFZEaDpEGYlkBzMtfED2OuEoICromTqI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749214715; x=1749819515;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=PYVM84VoP6sUarPE9u1qb7GqcXhlKnWyP+lB1fAcnnY=;
b=t5sn3mmgoaPEspRFEMcBxnKhLodPv67JbygOSfcnaqCjLSEc0XwRLN6jjENyD4CnI5
Lmdss4JSkRZ8wPaH15/gwmOkT9zShub0qfdLQCtvSZwJsu9Oa74KyW+DlHeZbwxXkDpm
y5F/nWdHalmDR3rprPNyu3qkwJgylc6tf/WJS014kk7Hslt6ni9T/VZcDPvwVaM97Gez
ux0bG0KZaKnrrQgx+3rNv2ERKX5lKCUSvWuSFeGVJDQR9oqjdy6bhGzV3qt34fpzM9Tg
nGKZIA+kVAQfxKN3LPJjocH+3+CQIpdUM9rhCYhhQ8J33k/k1KLWGOl5AFQMm6TPi5aE
X3iw==
X-Forwarded-Encrypted: i=1; AJvYcCV/t1lTbz8fOKnfxiVZ/ZJuOdTZ5AkuF+xvTV7B1fHKsLRmWQHRCKTfROniRJqfExg2xHvLASHD3c3jX7Q=@vger.kernel.org
X-Gm-Message-State: AOJu0Yw63AbVZzoAiyUB8nXcOl2vaQdu8yYvQgc9yLCLnE35aoXzkj0Y
oh7GX4Rue+cM471ZeG2iRmUZ0STrShUSim1yrl+KAXT4qo32rK2Fa+5dSqAzf2fGb7V155yCRRN
pYKJ5crFt97foaxbVWCBh+K2cGUd5qS+Qgj87I7skNUaqvWz6tQ3lubQ=
X-Gm-Gg: ASbGncuZEJPAeIRuLDe3mUGg0hbrz0ZYnfG1dmoTXYfT/GKcOgBffGYFQ2VxvQ11DHB
D/M9nDhpkH5eRUc72Mj8pYOUu5UF+btirUU6wipG0XeI3K7m+fwFkHVPVqLig21sm+983gaFSWD
gPNhhUlXN+Dq7Nb7/DnKKlNma0jw7HXVVqLw==
X-Google-Smtp-Source: AGHT+IERw6EH6isuoOp/tViAHSC9/1iGGlc7AkUNjP83hB+Xm1O+NBUINFmr2cFpvG9nP8zidAzav3pjNmYHuSi1FCw=
X-Received: by 2002:a05:6902:2401:b0:e7d:c87a:6249 with SMTP id
3f1490d57ef6-e81a21d8096mr4996073276.36.1749214714686; Fri, 06 Jun 2025
05:58:34 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250602053231.403143-1-pavitrakumarm@xxxxxxxxxxxxxxx>
<20250602053231.403143-2-pavitrakumarm@xxxxxxxxxxxxxxx> <fae97f84-bdb9-42de-b292-92d2b262f16a@xxxxxxxxxx>
<CALxtO0mpQtqPB0h_Wff2dLGo=Mxk02JJQkK4rn+=TuScNdSfxQ@xxxxxxxxxxxxxx>
<3570be5b-cb20-4259-9a9b-959098b902d0@xxxxxxxxxx> <CALxtO0mH=GwhQxQBsmMQYd+qgAue9WxXN1XWo9BncVJvJk6d8A@xxxxxxxxxxxxxx>
<cd6e92af-1304-4078-9ed7-de1cb53c66da@xxxxxxxxxx> <CALxtO0mVMTWqidSv7LQSQd-rA_TmJy_0xgBSd=mP27kg=AXQRg@xxxxxxxxxxxxxx>
<e08b2f76-17b1-4411-a428-b2f0f8a7d7fd@xxxxxxxxxx>
In-Reply-To: <e08b2f76-17b1-4411-a428-b2f0f8a7d7fd@xxxxxxxxxx>
From: Pavitrakumar Managutte <pavitrakumarm@xxxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 18:28:23 +0530
X-Gm-Features: AX0GCFsakdzQ7OpRugY0oL9f74JC3JUnvft7ryph7GBminNclioJcgtbl7Z0Pxc
Message-ID: <CALxtO0nReqeGKY+BNCBD10KSGttxxCrFzczxPjfrQM0eXv9Eug@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 1/6] dt-bindings: crypto: Document support for SPAcc
To: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
Cc: linux-crypto@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, herbert@xxxxxxxxxxxxxxxxxxx, robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx, Ruud.Derwig@xxxxxxxxxxxx,
manjunath.hadli@xxxxxxxxxxxxxxx, adityak@xxxxxxxxxxxxxxx,
Bhoomika Kadabi <bhoomikak@xxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 4:55=E2=80=AFPM Krzysztof Kozlowski <krzk@xxxxxxxxxx=
> wrote:
>
> On 06/06/2025 13:02, Pavitrakumar Managutte wrote:
> > Hi Krzysztof,
> > Appreciate your inputs and feedback. My comments are embedded below.
> >
> > Warm regards,
> > PK
> >
> > On Wed, Jun 4, 2025 at 7:37=E2=80=AFPM Krzysztof Kozlowski <krzk@kernel=
.org> wrote:
> >>
> >> On 04/06/2025 14:20, Pavitrakumar Managutte wrote:
> >>>>
> >>>>>>> +
> >>>>>>> + snps,vspacc-id:
> >>>>>>> + $ref: /schemas/types.yaml#/definitions/uint32
> >>>>>>> + description: |
> >>>>>>> + Virtual SPAcc instance identifier.
> >>>>>>> + The SPAcc hardware supports multiple virtual instances (de=
termined by
> >>>>>>> + ELP_SPACC_CONFIG_VSPACC_CNT parameter), and this ID is use=
d to identify
> >>>>>>> + which virtual instance this node represents.
> >>>>>>
> >>>>>> No, IDs are not accepted.
> >>>>>
> >>>>> PK: This represents the specific virtual SPAcc that is being used i=
n
> >>>>> the current configuration. It is used to index into the register ba=
nks
> >>>>> and the context memories of the virtual SPAcc that is being used. T=
he
> >>>>> SPAcc IP can be configured as dedicated virtual SPAccs in
> >>>>> heterogeneous environments.
> >>>>
> >>>> OK. Why registers are not narrowed to only this instance? It feels l=
ike
> >>>> you provide here full register space for multiple devices and then
> >>>> select the bank with above ID.
> >>>
> >>> PK: No, we cant narrow the registers to only this instance since its
> >>> is just a single SPAcc with multiple virtual SPAcc instances. The sam=
e
> >>> set of registers(aka register banks) and context memories are
> >>> repeated, but sit at different offset addresses (i*4000 +
> >>> register-offsets). The crypto hardware engine inside is shared by all
> >>> the virtual SPAccs. This is very much for a heterogeneous computing
> >>> scenario.
> >>
> >> Then maybe you have one crypto engine? You ask us to guess all of this=
,
> >> also because you do not upstream the DTS for real product. Any
> >> mentioning of "virtual" already raises concerns...
> >
> > PK: Yes this is a single crypto engine, maybe I should have detailed
> > that in the cover letter. I will fix that. And what I have pushed in
>
> So one node, thus no need for this entire virtual device split.

PK: Agreed, its one node for our test case.

>
> > the patch is my complete DTS. It might need updating depending on the
>
> If this is complete, then obviously "snps,vspacc-id" is not necessary.

PK: Yes, its one node, to keep things simple. So we pick a virtual
spacc with its vspacc-id for testing. That way we could test all the
virtual spaccs with a single node, on a need basis.

On the other hand we could create 'n' nodes for 'n' virtual spaccs and
register 'n' vspacc devices with the crypto subsystem. And bind the
individual nodes with unique vspacc-ids. That might depend on the
vendor use case, for which we will add incremental support.

>
>
> Best regards,
> Krzysztof


Return-Path: <linux-kernel+bounces-675770-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A04AB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:01:55 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 973363AB130
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:01:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 52DA0288C37;
Fri, 6 Jun 2025 13:01:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="TepEHMbD"
Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
(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 C3B8217BA6;
Fri, 6 Jun 2025 13:01:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749214901; cv=none; b=lxvvUigQDU/k2AqVhu1Q4r3X5kpjH4BYQwCaKt/sKyEuT2sP+J1Slz+fCl/Ss3tG8lAZRWowcUKBq985ovrDDmaQALzPZW2h5jdrRQqja4wnUnF9/CEs/rEJM/mVPw5yd+RRj3NMQlZn0/v5v/rCcM9HFnvw9TyqKM54Oge9mtY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749214901; c=relaxed/simple;
bh=2hmfzLTFQoz+aXCgJgTLta5MXh4EJa7MD3vdn3sJZ0w=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=bN7Spxz0IMOhN19DquD+d6F29znYM/gXbY25VkZTV9bI6n3K0GMj2EWY3MzZpbTOoLLf/VeK0hjEl0UZfiNF/dwHhJo5oJyxC56bCI+yjq+PFgNpmITm+CfbBy9sBUpcsTNNqwj0EXRF52RqWWuWuqHMqPWEl/lcTPv6GEROuXQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=TepEHMbD; arc=none smtp.client-ip=156.67.10.101
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch;
s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version:
References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject:
Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:
Content-ID:Content-Description:Content-Disposition:In-Reply-To:References;
bh=s3zv3PqwGPQB5IvLFRjdfPtcpTluyD2FX9XC997uiLM=; b=TepEHMbDSDCaHWfi/zvdx7+Lrc
iJ/uecvTglspKsiExk7VVxrh9BdgQegRtdJCWh1eyjF3HeMSpDjtrV84biMU2o37MY5vSDuF+oUmX
ISYzMR3r3wjh2E3mlmS04xytoRbLgQ7VRyFHNB1ACR38KF7fPxgRoPzvaDOwkmKu88kY=;
Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
(envelope-from <andrew@xxxxxxx>)
id 1uNWhK-00Eto5-Hf; Fri, 06 Jun 2025 15:01:26 +0200
Date: Fri, 6 Jun 2025 15:01:26 +0200
From: Andrew Lunn <andrew@xxxxxxx>
To: George Moussalem <george.moussalem@xxxxxxxxxxx>
Cc: Rob Herring <robh@xxxxxxxxxx>, Heiner Kallweit <hkallweit1@xxxxxxxxx>,
Russell King <linux@xxxxxxxxxxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Florian Fainelli <f.fainelli@xxxxxxxxx>,
Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>,
Michael Turquette <mturquette@xxxxxxxxxxxx>,
Stephen Boyd <sboyd@xxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-arm-msm@xxxxxxxxxxxxxxx, linux-clk@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v3 2/5] dt-bindings: net: qca,ar803x: Add IPQ5018
Internal GE PHY support
Message-ID: <23b92ed3-7788-4675-8f80-590e4337025c@xxxxxxx>
References: <20250602-ipq5018-ge-phy-v3-0-421337a031b2@xxxxxxxxxxx>
<20250602-ipq5018-ge-phy-v3-2-421337a031b2@xxxxxxxxxxx>
<20250605181453.GA2946252-robh@xxxxxxxxxx>
<DS7PR19MB8883E074E64AC6FCAB1B1DE69D6EA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <DS7PR19MB8883E074E64AC6FCAB1B1DE69D6EA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

> Under 'properties' node:
> compatible:
> enum:
> - ethernet-phy-id004d.d0c0
>
> Q: do I need to add the PHY IDs of all PHYs that the qca803x driver covers
> or will this one suffice?

The history is complicated, because PHYs can be enumerated, which
makes compatible mean something different to the usual for devices
which cannot be enumerated.

I personally would search the in tree DT files and find any which list
a qca803x compatible, and add those.

Andrew


Return-Path: <linux-kernel+bounces-675771-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 28D2041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:04:06 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 7C2A1188EA18
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:04:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E0FAB288502;
Fri, 6 Jun 2025 13:03:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZmIzByxE"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 81F3B3234
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:03:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215037; cv=none; b=pSrGZiK1aCAhflQEwTaGMp2T2dz98wlsggyvBMLVcsFHs+Zs4/MXkCrAB6Vagypf2xRtYm4cM9baUja1OAiTVm7X4nuS2BDPn27s2SOJ3oZWkVkWcvLKWOVfCVfkPOGK/IDB1Xdh6o8LmrjWoqkNfD7LxFSZqrTC3b1u/C7I7Nw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215037; c=relaxed/simple;
bh=6jsVoGWo/dSumAGNOxr7UqFGaeO67eYLVmbBwUc5Zos=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=JsXvVxJcqdvbIF9nY1JmAgTWjJXeqPDmIoJmUjqIleUutiEY04+XEyj5ExFOHJPHCk0nQtp6KXz1mog+lv0Gmu/B5UHoekQw65cFxfUJBI9IbOiOwlOeM7ujl+h8mmiX+HB/MttEh2ob3FK30Jtp/qQmFYkYEbTx+n/j70c4vwI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZmIzByxE; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749215034;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=HArWEAkGZW4SwR4M4QK2P5FGuqV07y/wP1+Sj+8Jiv8=;
b=ZmIzByxEBd9h3xSVfz7lMfcoNvu7mm0WozdKdn5P7/nPuANo3Vq28Y7gSOf8U+K3+dsVS8
vLvyQQM4/zq+FoPeAUuLACXO9V/MO16yDqvtKsUB5VvxiTysOhL+jj1OPhsLgIY+/AaWGM
ZRAUzfhoSpyDhWLDajtUpfbesmEsPss=
Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com
[209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-467-UhNdEOdCMZ20aWQ4sm_L4w-1; Fri, 06 Jun 2025 09:03:52 -0400
X-MC-Unique: UhNdEOdCMZ20aWQ4sm_L4w-1
X-Mimecast-MFC-AGG-ID: UhNdEOdCMZ20aWQ4sm_L4w_1749215032
Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6face35aad6so19183236d6.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:03:52 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749215032; x=1749819832;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=HArWEAkGZW4SwR4M4QK2P5FGuqV07y/wP1+Sj+8Jiv8=;
b=Q3Z37ncyYgVr9TahVYoByda+LNkGMaJtxXD8u1MGzFJ0U8a2b2J+bEbHVE+L7em5gf
gNu5euEBCOuWurUzUrpZMCGZ14hlMQ79KMVHjrpg2KxDA/WuzoesmJH3KEIm518xBOxf
P2a0GquuO0ztkpNpzduXIZXoJhxPHfdfKhDqEJomae+/E7jipcZay9n+j17mrqi0hCsd
WQlFbAuWk/7WZiTWdSr4W4WnG6zP0yQPfTTe+56t6pm3Gf9IMZymDoJMmjAfjaXWrVxp
u69+Pq+H7wm+ikDGStzBkhSmA3aQNY4EVLxsMvF9Gai5JNSoolKob7DOPvHvU1XRG1/z
QHxQ==
X-Forwarded-Encrypted: i=1; AJvYcCU3z5jcqZyOn13EuMT9i7hAM1huLeH3w8HYoEjPVDD3Gu+roMFaU6NDl4Z2cUJhzTmFGslPJ4TnODmfB2o=@vger.kernel.org
X-Gm-Message-State: AOJu0Yy8zUubHRAJ6ct1H5FtDHULbFwx2QcabGoKo3yOxY77gcwveUBv
WTw9xUHaPzKQRmswn4XUEDoDuG9N60e+MGhXUW1sXzkQ0rjyLI8bfjQSdOV/UIhVoDeMSZIOLcr
i/Kd0bwMs0aLuxdf+jfX/26QgL1hfTQbbNEtYBqGFFbwMK0iL/gSTBOU3wyO6HrDKcA==
X-Gm-Gg: ASbGncsK6MDG3oRRcMgXtdk6oLjQaqfQRFlGKtImNn/0Wg9v/mbIYSVcmL8r5gpNLWO
T0wFVZhetpL8+ihiQuMBD+6CxSA06lBflD0B0HwmGJew+t1HhgSVDV1IOY6yexrmKuHm4M2kBjM
dD5/WTOayhylR6TZLmrKR0JEjqUaxJGzYT+8GoeXQasvQupv/6sdPd3J4Bg2zk1vIba8RdycbjA
FHAT9PbShl6Tevi3Ea0EM8nGHY0pmEdiF7dYZOpLh0veGOHkXYIqRsyZnayBcz4K5hv64yVXe83
a7c=
X-Received: by 2002:a05:6214:21ad:b0:6e4:2f7f:d0bb with SMTP id 6a1803df08f44-6fb08f4307amr50047306d6.4.1749215032192;
Fri, 06 Jun 2025 06:03:52 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IH9BHHM9w2tx8ul52pjQVd+s0UKMZd6LqtfDIdl4wDxhdTCW98c/Y1W4GzTHfIwhEhwfgDeWw==
X-Received: by 2002:a05:6214:21ad:b0:6e4:2f7f:d0bb with SMTP id 6a1803df08f44-6fb08f4307amr50046486d6.4.1749215031425;
Fri, 06 Jun 2025 06:03:51 -0700 (PDT)
Received: from x1.local ([85.131.185.92])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fb09ab8a19sm10972746d6.8.2025.06.06.06.03.50
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:03:50 -0700 (PDT)
Date: Fri, 6 Jun 2025 09:03:48 -0400
From: Peter Xu <peterx@xxxxxxxxxx>
To: David Hildenbrand <david@xxxxxxxxxx>
Cc: Tal Zussman <tz2294@xxxxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Jason A. Donenfeld" <Jason@xxxxxxxxx>,
Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>,
Christian Brauner <brauner@xxxxxxxxxx>, Jan Kara <jack@xxxxxxx>,
Pavel Emelyanov <xemul@xxxxxxxxxxxxx>,
Andrea Arcangeli <aarcange@xxxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/3] userfaultfd: prevent unregistering VMAs through a
different userfaultfd
Message-ID: <aELnNH5LTFHmtdfQ@x1.local>
References: <20250603-uffd-fixes-v1-0-9c638c73f047@xxxxxxxxxxxx>
<20250603-uffd-fixes-v1-2-9c638c73f047@xxxxxxxxxxxx>
<84cf5418-42e9-4ec5-bd87-17ba91995c47@xxxxxxxxxx>
<aEBhqz1UgpP8d9hG@x1.local>
<0a1dab1c-80d2-436f-857f-734d95939aec@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <0a1dab1c-80d2-436f-857f-734d95939aec@xxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 11:06:38PM +0200, David Hildenbrand wrote:
> Not sure if relevant, but consider the following:
>
> an app being controlled by another process using userfaultfd.
>
> The app itself can "escape" uffd control of the other process by simply
> creating a userfaultfd and unregistering VMAs.

IMHO it's okay if it's intentional by the child. E.g., even after this
patch, the child, if intentional, can also mmap() a new VMA on top of the
uffd tracked region to stop being trapped by the parent. The parent might
still get a UNMAP event if registered, but it'll not be able to track the
new VMAs mapped.

Thanks,

--
Peter Xu



Return-Path: <linux-kernel+bounces-675772-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 937BC41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:04:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id DA05D7A7EFD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:03:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F15D288C1E;
Fri, 6 Jun 2025 13:04:32 +0000 (UTC)
Received: from freeshell.de (freeshell.de [116.202.128.144])
(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 A7BF41E3787;
Fri, 6 Jun 2025 13:04:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.202.128.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215071; cv=none; b=KkFb2lIjQ9n0wojPix2vfkeEx5I1fO1c0bTUZL59fWar969SG/E42QyXpviWPwBHnp0snlHyzoOeGL9nBxpWbySeo+Zz+EYJHY4toAGGqmYo4GGC/l/8QcdGsWzAZeJlDsQT1E+jZCJ91OYav90XW4oCrVms75RyzXlhhQ9jAlE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215071; c=relaxed/simple;
bh=qdo417o10JodKd/lScCqNLCBp2CwkQFotTyj/nq4oHQ=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=cLLtLrFjQGj7OWIhWB4aRhg2yuyoAcOmVFKT8jc8RwsnWa2fF78oNNJqLVDSrCC1KN3EXAU7H0MFmn62LjdLI69WEXSesr24KTckvRNrj4AZK+C8gxXXTCLVFX1/aBdk9PlGibx0AN8Qmv/G1dNb3JBjJTdsKkrB+uzo/2IFTBg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=freeshell.de; spf=pass smtp.mailfrom=freeshell.de; arc=none smtp.client-ip=116.202.128.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=freeshell.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=freeshell.de
Received: from hay.lan. (unknown [IPv6:2605:59c0:20f3:a400:6ecf:39ff:fe00:8375])
(Authenticated sender: e)
by freeshell.de (Postfix) with ESMTPSA id DB8AAB4C4438;
Fri, 6 Jun 2025 15:04:24 +0200 (CEST)
From: E Shattow <e@xxxxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx,
Conor Dooley <conor@xxxxxxxxxx>,
Emil Renner Berthing <kernel@xxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>,
Palmer Dabbelt <palmer@xxxxxxxxxxx>,
Albert Ou <aou@xxxxxxxxxxxxxxxxx>,
Alexandre Ghiti <alex@xxxxxxxx>
Cc: E Shattow <e@xxxxxxxxxxxx>
Subject: [PATCH v1 2/3] riscv: dts: starfive: jh7110: add memory controller node
Date: Fri, 6 Jun 2025 06:02:37 -0700
Message-ID: <20250606130253.1105273-3-e@xxxxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250606130253.1105273-1-e@xxxxxxxxxxxx>
References: <20250606130253.1105273-1-e@xxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

add memory controller node used downstream by U-Boot boot loader.

Signed-off-by: E Shattow <e@xxxxxxxxxxxx>
---
arch/riscv/boot/dts/starfive/jh7110.dtsi | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi
index 0ba74ef04679..6fdeac3e0aff 100644
--- a/arch/riscv/boot/dts/starfive/jh7110.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi
@@ -372,6 +372,19 @@ ccache: cache-controller@2010000 {
cache-unified;
};

+ memory-controller@15700000 {
+ compatible = "starfive,jh7110-dmc";
+ reg = <0x0 0x15700000 0x0 0x10000>,
+ <0x0 0x13000000 0x0 0x10000>;
+ clocks = <&syscrg JH7110_PLLCLK_PLL1_OUT>;
+ clock-names = "pll1_out";
+ clock-frequency = <2133>;
+ resets = <&syscrg JH7110_SYSRST_DDR_AXI>,
+ <&syscrg JH7110_SYSRST_DDR_OSC>,
+ <&syscrg JH7110_SYSRST_DDR_APB>;
+ reset-names = "axi", "osc", "apb";
+ };
+
plic: interrupt-controller@c000000 {
compatible = "starfive,jh7110-plic", "sifive,plic-1.0.0";
reg = <0x0 0xc000000 0x0 0x4000000>;
--
2.49.0



Return-Path: <linux-kernel+bounces-675773-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5131341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:04:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 934B8175C13
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:04:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C1223288C9B;
Fri, 6 Jun 2025 13:04:38 +0000 (UTC)
Received: from freeshell.de (freeshell.de [116.202.128.144])
(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 C97931E3787;
Fri, 6 Jun 2025 13:04:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.202.128.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215078; cv=none; b=kmFU6nd7D28dX5+8Ed6YNqLnL0aM2Tu1VuPdYdHGfQhX9KinhhMsRz7G9gH5XQHn+5hIvG7FZva58dmgUXfZzIiD/6iU1yym5L1+WJo3XqwFKkMyhxrw5/JhBMeUnDSKqB+bsOWiT1+qiQrSVrCAkmTL8TfY6udj7gcp6p4oRJQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215078; c=relaxed/simple;
bh=jTSNMcwQcnd09ekHunIb6JTUWDhAjp5JQVTJVZEc7Gc=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=rnXmjoldg8ovEOXqJUxDCCNoqL2x8CTH4RnHeuiC3Iu6oasf2Myv9dUyjUYvHHP5yYJtYwMJsh0teyRrz4Nny+pD04pNh5rUaYWPCZ4f6eNCQJJu/rUfLJopIHqm0jQdJsvBAgEhoVXQsuXWMcp4r4qAbINz6+b10MtIVo0wNz0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=freeshell.de; spf=pass smtp.mailfrom=freeshell.de; arc=none smtp.client-ip=116.202.128.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=freeshell.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=freeshell.de
Received: from hay.lan. (unknown [IPv6:2605:59c0:20f3:a400:6ecf:39ff:fe00:8375])
(Authenticated sender: e)
by freeshell.de (Postfix) with ESMTPSA id 6810BB4C4439;
Fri, 6 Jun 2025 15:04:31 +0200 (CEST)
From: E Shattow <e@xxxxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx,
Conor Dooley <conor@xxxxxxxxxx>,
Emil Renner Berthing <kernel@xxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>,
Palmer Dabbelt <palmer@xxxxxxxxxxx>,
Albert Ou <aou@xxxxxxxxxxxxxxxxx>,
Alexandre Ghiti <alex@xxxxxxxx>
Cc: E Shattow <e@xxxxxxxxxxxx>
Subject: [PATCH v1 3/3] riscv: dts: starfive: jh7110: bootph-pre-ram hinting needed by boot loader
Date: Fri, 6 Jun 2025 06:02:38 -0700
Message-ID: <20250606130253.1105273-4-e@xxxxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250606130253.1105273-1-e@xxxxxxxxxxxx>
References: <20250606130253.1105273-1-e@xxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add bootph-pre-ram hinting to jh7110.dtsi:
- CPU interrupt controller(s)
- core local interrupt timer
- DDR memory controller
- oscillator
- syscrg clock-controller

Signed-off-by: E Shattow <e@xxxxxxxxxxxx>
---
arch/riscv/boot/dts/starfive/jh7110.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi
index 6fdeac3e0aff..8a56e8b91b61 100644
--- a/arch/riscv/boot/dts/starfive/jh7110.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi
@@ -35,6 +35,7 @@ S7_0: cpu@0 {

cpu0_intc: interrupt-controller {
compatible = "riscv,cpu-intc";
+ bootph-pre-ram;
interrupt-controller;
#interrupt-cells = <1>;
};
@@ -68,6 +69,7 @@ U74_1: cpu@1 {

cpu1_intc: interrupt-controller {
compatible = "riscv,cpu-intc";
+ bootph-pre-ram;
interrupt-controller;
#interrupt-cells = <1>;
};
@@ -101,6 +103,7 @@ U74_2: cpu@2 {

cpu2_intc: interrupt-controller {
compatible = "riscv,cpu-intc";
+ bootph-pre-ram;
interrupt-controller;
#interrupt-cells = <1>;
};
@@ -134,6 +137,7 @@ U74_3: cpu@3 {

cpu3_intc: interrupt-controller {
compatible = "riscv,cpu-intc";
+ bootph-pre-ram;
interrupt-controller;
#interrupt-cells = <1>;
};
@@ -167,6 +171,7 @@ U74_4: cpu@4 {

cpu4_intc: interrupt-controller {
compatible = "riscv,cpu-intc";
+ bootph-pre-ram;
interrupt-controller;
#interrupt-cells = <1>;
};
@@ -321,6 +326,7 @@ mclk_ext: mclk-ext-clock {

osc: oscillator {
compatible = "fixed-clock";
+ bootph-pre-ram;
clock-output-names = "osc";
#clock-cells = <0>;
};
@@ -354,6 +360,7 @@ soc {
clint: timer@2000000 {
compatible = "starfive,jh7110-clint", "sifive,clint0";
reg = <0x0 0x2000000 0x0 0x10000>;
+ bootph-pre-ram;
interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>,
<&cpu1_intc 3>, <&cpu1_intc 7>,
<&cpu2_intc 3>, <&cpu2_intc 7>,
@@ -376,6 +383,7 @@ memory-controller@15700000 {
compatible = "starfive,jh7110-dmc";
reg = <0x0 0x15700000 0x0 0x10000>,
<0x0 0x13000000 0x0 0x10000>;
+ bootph-pre-ram;
clocks = <&syscrg JH7110_PLLCLK_PLL1_OUT>;
clock-names = "pll1_out";
clock-frequency = <2133>;
@@ -893,6 +901,7 @@ qspi: spi@13010000 {
syscrg: clock-controller@13020000 {
compatible = "starfive,jh7110-syscrg";
reg = <0x0 0x13020000 0x0 0x10000>;
+ bootph-pre-ram;
clocks = <&osc>, <&gmac1_rmii_refin>,
<&gmac1_rgmii_rxin>,
<&i2stx_bclk_ext>, <&i2stx_lrck_ext>,
--
2.49.0



Return-Path: <linux-kernel+bounces-675774-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 068F541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:05:26 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id DAA457AA672
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:03:53 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EB6FE289348;
Fri, 6 Jun 2025 13:04:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cIPZeR4/"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01F90288CA1;
Fri, 6 Jun 2025 13:04:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215079; cv=none; b=ZJDzk/DPZk4NihEhADrqsEotFxjoWf4nHJ7aePcdfcBqeGymCCATuIJIm4g3d1cjI4TiKDGFVsLsiFZ0OJdJc1L1kfd/V8gGTLjMrom5BUT2fKD4DD9xdGVRoZwzr0quicWcTrrV1zq+cA2SSCxv4E9G4WQHIqluPeQ16OAWimE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215079; c=relaxed/simple;
bh=19Tko733gYHMDfnrQv1Q4FwJ91x3JsEzgx4dOWMr4Bo=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=YECyscoRwQWMxshUQvXNVVXC7QSBxLd5mAUWpVcN6k+5Db0Y685C9hDC84JI7Mw6iaFFU938LZIU1cZA24a62a7685CCdlhzgN0JcjObzdg+U+yRhmOsTe3JJty65TpA1Vd7miL3YaF8SUt9b3YGp2WWZN8zmsJfMzqLk6QPzfQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cIPZeR4/; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3A1EC4CEEB;
Fri, 6 Jun 2025 13:04:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749215077;
bh=19Tko733gYHMDfnrQv1Q4FwJ91x3JsEzgx4dOWMr4Bo=;
h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
b=cIPZeR4/g3GjWpgZo/HgiJpA4K9hPy1NBzMxnwDnffyXxAtuw9gp/KRgVHUCQkGDj
eryUoDW6DKpA3pK2PTPbZgIRLsgmNcLUli3sC679bCSGVr/JdqK0LZ8/9gPzOoteeV
gOn7FvWKN9THKQZv1xvQENNMzh14SKcitL27l0U0xPGupRi4mFu5dkZHjfQJde5hah
S7CimZ7kQ0Vca7bw2ZjhV7SjbPkI6hP1yZAkGRlON8ETvjVZhJ6pP4WNVk1Kdrj1Ki
CKntD4+Qkouij+dtu66gfhsDBwGQNlmjQETk7OnpTRgpHJAhXMxMMq07eiF6XcZig5
5Kg5WeO9Vc40w==
Message-ID: <b207cba7-47d3-43f4-8d59-38df9ec4eec2@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:04:32 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v3 1/6] dt-bindings: crypto: Document support for SPAcc
To: Pavitrakumar Managutte <pavitrakumarm@xxxxxxxxxxxxxxx>
Cc: linux-crypto@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, herbert@xxxxxxxxxxxxxxxxxxx, robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx, Ruud.Derwig@xxxxxxxxxxxx,
manjunath.hadli@xxxxxxxxxxxxxxx, adityak@xxxxxxxxxxxxxxx,
Bhoomika Kadabi <bhoomikak@xxxxxxxxxxxxxxx>
References: <20250602053231.403143-1-pavitrakumarm@xxxxxxxxxxxxxxx>
<20250602053231.403143-2-pavitrakumarm@xxxxxxxxxxxxxxx>
<fae97f84-bdb9-42de-b292-92d2b262f16a@xxxxxxxxxx>
<CALxtO0mpQtqPB0h_Wff2dLGo=Mxk02JJQkK4rn+=TuScNdSfxQ@xxxxxxxxxxxxxx>
<3570be5b-cb20-4259-9a9b-959098b902d0@xxxxxxxxxx>
<CALxtO0mH=GwhQxQBsmMQYd+qgAue9WxXN1XWo9BncVJvJk6d8A@xxxxxxxxxxxxxx>
<cd6e92af-1304-4078-9ed7-de1cb53c66da@xxxxxxxxxx>
<CALxtO0mVMTWqidSv7LQSQd-rA_TmJy_0xgBSd=mP27kg=AXQRg@xxxxxxxxxxxxxx>
<e08b2f76-17b1-4411-a428-b2f0f8a7d7fd@xxxxxxxxxx>
<CALxtO0nReqeGKY+BNCBD10KSGttxxCrFzczxPjfrQM0eXv9Eug@xxxxxxxxxxxxxx>
From: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=krzk@xxxxxxxxxx; keydata=
xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79
cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu
JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH
gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE
J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj
NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS
BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU
vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM
Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD
TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg
S296bG93c2tpIDxrcnprQGtlcm5lbC5vcmc+wsGVBBMBCgA/AhsDBgsJCAcDAgYVCAIJCgsE
FgIDAQIeAQIXgBYhBJvQfg4MUfjVlne3VBuTQ307QWKbBQJoF1BKBQkWlnSaAAoJEBuTQ307
QWKbHukP/3t4tRp/bvDnxJfmNdNVn0gv9ep3L39IntPalBFwRKytqeQkzAju0whYWg+R/rwp
+r2I1Fzwt7+PTjsnMFlh1AZxGDmP5MFkzVsMnfX1lGiXhYSOMP97XL6R1QSXxaWOpGNCDaUl
ajorB0lJDcC0q3xAdwzRConxYVhlgmTrRiD8oLlSCD5baEAt5Zw17UTNDnDGmZQKR0fqLpWy
786Lm5OScb7DjEgcA2PRm17st4UQ1kF0rQHokVaotxRM74PPDB8bCsunlghJl1DRK9s1aSuN
hL1Pv9VD8b4dFNvCo7b4hfAANPU67W40AaaGZ3UAfmw+1MYyo4QuAZGKzaP2ukbdCD/DYnqi
tJy88XqWtyb4UQWKNoQqGKzlYXdKsldYqrLHGoMvj1UN9XcRtXHST/IaLn72o7j7/h/Ac5EL
8lSUVIG4TYn59NyxxAXa07Wi6zjVL1U11fTnFmE29ALYQEXKBI3KUO1A3p4sQWzU7uRmbuxn
naUmm8RbpMcOfa9JjlXCLmQ5IP7Rr5tYZUCkZz08LIfF8UMXwH7OOEX87Y++EkAB+pzKZNNd
hwoXulTAgjSy+OiaLtuCys9VdXLZ3Zy314azaCU3BoWgaMV0eAW/+gprWMXQM1lrlzvwlD/k
whyy9wGf0AEPpLssLVt9VVxNjo6BIkt6d1pMg6mHsUEVzsFNBFVDXDQBEADNkrQYSREUL4D3
Gws46JEoZ9HEQOKtkrwjrzlw/tCmqVzERRPvz2Xg8n7+HRCrgqnodIYoUh5WsU84N03KlLue
MNsWLJBvBaubYN4JuJIdRr4dS4oyF1/fQAQPHh8Thpiz0SAZFx6iWKB7Qrz3OrGCjTPcW6ei
OMheesVS5hxietSmlin+SilmIAPZHx7n242u6kdHOh+/SyLImKn/dh9RzatVpUKbv34eP1wA
GldWsRxbf3WP9pFNObSzI/Bo3kA89Xx2rO2roC+Gq4LeHvo7ptzcLcrqaHUAcZ3CgFG88CnA
6z6lBZn0WyewEcPOPdcUB2Q7D/NiUY+HDiV99rAYPJztjeTrBSTnHeSBPb+qn5ZZGQwIdUW9
YegxWKvXXHTwB5eMzo/RB6vffwqcnHDoe0q7VgzRRZJwpi6aMIXLfeWZ5Wrwaw2zldFuO4Dt
91pFzBSOIpeMtfgb/Pfe/a1WJ/GgaIRIBE+NUqckM+3zJHGmVPqJP/h2Iwv6nw8U+7Yyl6gU
BLHFTg2hYnLFJI4Xjg+AX1hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/
JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu
4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB
YpsFAmgXUF8FCRaWWyoACgkQG5NDfTtBYptO0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v
qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5
RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg
Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2
H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB
dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT
AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu
jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2
zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw
XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A=
In-Reply-To: <CALxtO0nReqeGKY+BNCBD10KSGttxxCrFzczxPjfrQM0eXv9Eug@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 14:58, Pavitrakumar Managutte wrote:
> On Fri, Jun 6, 2025 at 4:55â?¯PM Krzysztof Kozlowski <krzk@xxxxxxxxxx> wrote:
>>
>> On 06/06/2025 13:02, Pavitrakumar Managutte wrote:
>>> Hi Krzysztof,
>>> Appreciate your inputs and feedback. My comments are embedded below.
>>>
>>> Warm regards,
>>> PK
>>>
>>> On Wed, Jun 4, 2025 at 7:37â?¯PM Krzysztof Kozlowski <krzk@xxxxxxxxxx> wrote:
>>>>
>>>> On 04/06/2025 14:20, Pavitrakumar Managutte wrote:
>>>>>>
>>>>>>>>> +
>>>>>>>>> + snps,vspacc-id:
>>>>>>>>> + $ref: /schemas/types.yaml#/definitions/uint32
>>>>>>>>> + description: |
>>>>>>>>> + Virtual SPAcc instance identifier.
>>>>>>>>> + The SPAcc hardware supports multiple virtual instances (determined by
>>>>>>>>> + ELP_SPACC_CONFIG_VSPACC_CNT parameter), and this ID is used to identify
>>>>>>>>> + which virtual instance this node represents.
>>>>>>>>
>>>>>>>> No, IDs are not accepted.
>>>>>>>
>>>>>>> PK: This represents the specific virtual SPAcc that is being used in
>>>>>>> the current configuration. It is used to index into the register banks
>>>>>>> and the context memories of the virtual SPAcc that is being used. The
>>>>>>> SPAcc IP can be configured as dedicated virtual SPAccs in
>>>>>>> heterogeneous environments.
>>>>>>
>>>>>> OK. Why registers are not narrowed to only this instance? It feels like
>>>>>> you provide here full register space for multiple devices and then
>>>>>> select the bank with above ID.
>>>>>
>>>>> PK: No, we cant narrow the registers to only this instance since its
>>>>> is just a single SPAcc with multiple virtual SPAcc instances. The same
>>>>> set of registers(aka register banks) and context memories are
>>>>> repeated, but sit at different offset addresses (i*4000 +
>>>>> register-offsets). The crypto hardware engine inside is shared by all
>>>>> the virtual SPAccs. This is very much for a heterogeneous computing
>>>>> scenario.
>>>>
>>>> Then maybe you have one crypto engine? You ask us to guess all of this,
>>>> also because you do not upstream the DTS for real product. Any
>>>> mentioning of "virtual" already raises concerns...
>>>
>>> PK: Yes this is a single crypto engine, maybe I should have detailed
>>> that in the cover letter. I will fix that. And what I have pushed in
>>
>> So one node, thus no need for this entire virtual device split.
>
> PK: Agreed, its one node for our test case.

We do not talk about test case. We talk about this device.
>
>>
>>> the patch is my complete DTS. It might need updating depending on the
>>
>> If this is complete, then obviously "snps,vspacc-id" is not necessary.
>
> PK: Yes, its one node, to keep things simple. So we pick a virtual
> spacc with its vspacc-id for testing. That way we could test all the
> virtual spaccs with a single node, on a need basis.
>
> On the other hand we could create 'n' nodes for 'n' virtual spaccs and

You said it is complete, now you said you have 'n' more.

> register 'n' vspacc devices with the crypto subsystem. And bind the
> individual nodes with unique vspacc-ids. That might depend on the

I don't understand what is "binding" here. Use Linux or DT terminology.

> vendor use case, for which we will add incremental support.

You did not get the point but you keep saying "yes". This discussion is
getting meaningless and you really do not want to listen. You have
either incomplete picture here or you have only one node. In both cases
virtual ID is not necessary. If you claim virtual ID is necessary, I
claim you have here incomplete picture and you are trying to represent
one device in multiple nodes. No.

Typically one device, one node.

NOT one device and 10 virtual nodes representing virtual devices.

Amount of ping pongs here is way beyond my patience, so before you
respond read that carefully and come with full and accurate hardware
description, so we will not have to ping pong trying to get any sort of
details.

Best regards,
Krzysztof


Return-Path: <linux-kernel+bounces-675775-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CB5A241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:05:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 2E63D18997C7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:05:50 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 86AE1288C9A;
Fri, 6 Jun 2025 13:05:14 +0000 (UTC)
Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46213288C80;
Fri, 6 Jun 2025 13:05:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215114; cv=none; b=TjlAQW4TkahnFD70xG0AXkuGfIEOqZQzjuu6Arb/OqDG2dpsHiVIbvsZzPoZ6ts1HVQPUomtGzunU4ZXp3i2tSqZlj0UlpcFYdOG+E0RVPHIhVPTp6Ps4+eMPApn8b7OfWHzPYYlcrNskiWqA/NS20emKv5Y5HUaBOXq5TkbHY0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215114; c=relaxed/simple;
bh=4OB8rRNnYyxfAn7/3hyYL1XNoSisYk8DCDF9QSdxXWE=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=YrkaXUWF7Ctu/v9ct8mOUWyMPonhxJydKMnj4jY0LrQ9AlnvmaEfpOJb8LKchu7sZHEOUv2iC3CGilBLvMTmKSj1WYcWiJ5FOATNsRyQNkFaIvHq+G70Onht4mf9cYkC6byI+e4JYDAJ4PYEsY7CFlzf8sueOccMTZKghidk/pU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.177
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-408e0986303so1572184b6e.2;
Fri, 06 Jun 2025 06:05:12 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749215109; x=1749819909;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=P4smyQ+8WqK0jxifR87KRhifMuRayG5/N77gUPFqbRM=;
b=czYqHBOJGa3AHoLWi48JCmxeXHDrfg5szWUef+4IcUSiY0o/cm7DFYJPiqs8RVv2MX
POr41VPwQo4W/OLojRp+L3RJriEbT0niITvmfY4SZ0yQf0AXXbwRP6SgEJ/bhOBFt4JU
tyKWfGsbdxx6gNfKaW4dY9+/1gQpNxk/DfxQR1VcgXJpNhtXk71Yv0fl9fKdyfOZJM/N
MJgs5u2yE4K4cukbvz9dMvIHUD6kzVxKBWaX0yuBldbPz0uEkhWbhuq6TWYNM+OjWCCn
RyWa0ziG0vnYZu9V5dXE9HS8bmDx9j8rP3g7fnth8ke68iZvzaY0GuQtCUz8YaOeRtyO
QXkw==
X-Forwarded-Encrypted: i=1; AJvYcCUoBysI3oPN6mLuX0odRAF16nvXyYAAcNoSYnrMARUzNvQqmtOWCfOlS/fbs65dvvi7JEgHPnTCsHkN+cZNhk9jDvs=@vger.kernel.org, AJvYcCVdcTFfX/DGb07aOv1gukNjQRmkj9EwsNX7pRR/c+omNFwbRTv3DM2TY5zBdk4WDdjownp54aEihPahlqYH@xxxxxxxxxxxxxxx, AJvYcCVk2OkmjGtjlyNujYMpQrogg5MyB6pWL6uXvKQASYB58YxBR4mWFRNBgGNAHaUJVYuS3Wt5/46hjD+v@xxxxxxxxxxxxxxx, AJvYcCWMPnWAtBmGwMA6CrYuGO1e5G5j4xsAkGafwDRMg7+LMwythnlQ6x3qtPTk1yFDJ95bojiq9qU9v/iB@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yxg0Y8xNcoXCPmDuBax2K7BVORHClmhRJ1I9rXspUgLokisQWzZ
86CIPc+cz1BrzybYwhit3r2Rqiz230a0GReG1bMlHveqpsqHycbVxKOl9t/AzJVQ
X-Gm-Gg: ASbGncuuwQr8CvOz/OzxXmyog8N32vUuqb/M7lkJllhsm+UEpK0Zn0eLYrlzU/nt468
V19J6yN/Fn9J4DqtJwfkZXMl6H44DEC1DiXsoh2oo1aelgfXlYBrgpnTm4peE6gZw17ecCuZEMq
VnvU85nlng7AhEpmCJ+Tq8WqJA3Yeb/k4PXDr1z0+vOc/OCYWVuoBhK1qYHyHdebTpX0uu27Ras
GJo+uaxNkYmnW0uzht4B3aFe5sCBfugSTy+VPiX87AAqb8pQZIxpj8kH2hYUxcQn1hV2uDn8c/v
F3F0llh6erdKJxhUoM4y/+XuJZxZ2v1ZgMvHms5AGG6DsK0jRE7j9lKg3gywMLKL+O57WQnraM2
iZJkfn7VERMjbWQ==
X-Google-Smtp-Source: AGHT+IEmuW2nj1cLyaotcR1JMQ67J+dMe0mE4Y/SpoqVoE9+UQfXUp3ChqvjyWvlG5a2rMPARV4P6g==
X-Received: by 2002:a05:6808:30a4:b0:404:f4a0:7fbf with SMTP id 5614622812f47-40905134ec3mr2517084b6e.31.1749215109352;
Fri, 06 Jun 2025 06:05:09 -0700 (PDT)
Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com. [209.85.210.42])
by smtp.gmail.com with ESMTPSA id 46e09a7af769-7388a089859sm270017a34.63.2025.06.06.06.05.08
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:05:09 -0700 (PDT)
Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-7306482f958so1324643a34.0;
Fri, 06 Jun 2025 06:05:08 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCW8ntkU3G26yamwe2NBmXgIa833ehiPgTbLoBs1RWiwwE+MiNGUfCOZ4VMjiC2YLfcNS5OdAh13Kytr@xxxxxxxxxxxxxxx, AJvYcCXYYj90O+N+UX20WyUVoyp/FOiBCkNpEmL30vKk9trY6sQgJHQRQwwuLfsFh1vkWkTLQzpj5C2Au/XsJBvEKGpSf+I=@vger.kernel.org, AJvYcCXcNqWrSS+4bQL64D2KlHSJ82xOaev2asyNqiF0mrti/s+/1KoJmb6PaTS2SA1O8H2RY47kaOVAgmCM9Wvt@xxxxxxxxxxxxxxx, AJvYcCXutMri7ZeS02so72sx8ILBdBLus7GqczGoC7QzjnM/0yf+wMuseU+v8ycQnAsLs2cUw+XIZCFTUnI5@xxxxxxxxxxxxxxx
X-Received: by 2002:a05:6830:6617:b0:72b:9506:8db6 with SMTP id
46e09a7af769-73888dba453mr1953425a34.6.1749215108231; Fri, 06 Jun 2025
06:05:08 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250530143135.366417-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> <20250530143135.366417-2-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250530143135.366417-2-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:04:56 +0200
X-Gmail-Original-Message-ID: <CAMuHMdW8yP8Ja90YqjmAAUfwc17WnsX4kLhca_UOSMtcx-J7uA@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFtMgG-6x_z__UisiUo_L1woOb8v1c-Obt5jD9EezPXLPFEEMdGVNQ-j4ok
Message-ID: <CAMuHMdW8yP8Ja90YqjmAAUfwc17WnsX4kLhca_UOSMtcx-J7uA@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 1/6] dt-bindings: i2c: renesas,riic: Move ref for
i2c-controller.yaml to the end
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Chris Brandt <chris.brandt@xxxxxxxxxxx>, Andi Shyti <andi.shyti@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Magnus Damm <magnus.damm@xxxxxxxxx>, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>,
linux-renesas-soc@xxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 30 May 2025 at 16:31, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> In preparation for adding more validation checks, move the `$ref` for
> 'i2c-controller.yaml' to the end of the file. Also, relocate the
> conditional check for 'resets' into the 'allOf' block.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675777-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2E61C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:06:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id E553E189464C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:06:27 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1488A28853F;
Fri, 6 Jun 2025 13:06:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="M4qAFMN5"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 8CB6A288510
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:06:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215168; cv=none; b=d0vBIxv/AD9F2uxmJQLubk2pt9mv2w7UWd/9Q9z0YAJ83EVKImDUJSGUW1eZacAy8+yj/dyy8nyKQ2vdoyz0i/OiCWnyVetME0wKDY6PrqqZEn/I8p8iPw2iFgnktQcStTA6uoAKg2djnmD3ose7lPRSyKaeZEbz2XDMj0gpBWc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215168; c=relaxed/simple;
bh=C1GT0Omhkh4mzSLsciQfyAKel4MDNktx3SepqIEgJtk=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=hMfyctQMUq+40O1VLQ1ZCKkhL334oT89w4WsHbtifP+tYz6dWK1KnwJyHeBqZcA1zV4CtYRW6Lt30CuF0V2rkFk57MthRLxIixJptMOPTw/ntYg1WoSFvkoVODC1dpwHwKkvLvm1KqvE/+pRxoDEp5Gs9d+xQIF5yX7jg0q12qE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=M4qAFMN5; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749215165;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=5BSoPKdS5u7WoJFLwbKI61wUvIj0zk/QD32Y3X5nyxg=;
b=M4qAFMN5dXsugBji0ialuGWprlOz4DEpJOWNHd9zuXu1UwjPNNNEYwRQz/BYsMzVB332M1
JQG2Uxzt/pxBcUvww8cT9fhw5VmPiwpHF6X7mmBYRNrmQurTKSkbB6CMCv+ez3qNmRJM5R
HJKp86/SnluzoKAicwYp4ArJzLlQpII=
Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com
[209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-315-RD9YvcEVO2elz2Nxid6TVA-1; Fri, 06 Jun 2025 09:06:02 -0400
X-MC-Unique: RD9YvcEVO2elz2Nxid6TVA-1
X-Mimecast-MFC-AGG-ID: RD9YvcEVO2elz2Nxid6TVA_1749215161
Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7c5d608e6f5so497108885a.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:06:02 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749215161; x=1749819961;
h=content-transfer-encoding:in-reply-to:autocrypt:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=5BSoPKdS5u7WoJFLwbKI61wUvIj0zk/QD32Y3X5nyxg=;
b=WNNsM85L4l8mX2YiGOYT3HlW5Ps/PkzY5Y18Pk4Dy/u6nZgGgLH5imTLTM89Lgvd4i
gG1aOCo1gGebViyS2Xh3zpcsHyy2i8muR93bdDiMZcw5KIFZBO2671W0uRUd10AftvAU
UhiFkVSjTUonYW+DJApZloL1iaXas+SK9sUp0rAEXU6GpyP7KWojW6TwLZIBucYFChJT
M00dNEqiJ0/uXuUSNmpLU2y+l+30Va1JjGhp+Hv2iOOdx87XgewEG4xmGyDITB3jM6Us
0iNLDpnGqmu+d1+2yKSQ6eEcmrgGz1Tx1XXucGigy2S51M9E1BuvOefkXTkxThODSVFm
fgig==
X-Gm-Message-State: AOJu0YyLqs7mMF6WusMiqGevBler6kmnjC6m/3N4IGqYgztKbLpV/sAL
szAGa2eXTAu8wR925tQFkFlzboRRxjjb14HLv5v+bwSo2lTx32UQ829A1+imwil93+4i5NbNQfo
OkuAU6Nx3+ZKqm0S1eGr0KBCf55i9xOrUpj1A4r6fyg8RXEZIb0OeU5iHEl+BkxCyHw==
X-Gm-Gg: ASbGncuMdIjKXk+YSwGhuefDAuZ7Dd4cXth6ah2HYgfUnfmCk62NO7v5i8AxLFaneK2
OV+0sc0NTT3J21xhYXQuQczKqE0C1KlgQ3UmXFP0K79QQvGNjXGAW7C6akWeMIyI1dpqXXVG+6k
rz+YARyZJk5iyxj0f9ooAr4f5fJhN8A1qz5JoOv9oaxHwxvzYoa3l7bXcGWrSHvkfMdeSJ7nt6T
peVbYED8YhTtsaCgIfY0O3PbTi7s1Xyg47SMVwzu1iAZBhAfV7OizGknlu0u4PzPZhYxBmzQpMw
oZ/feBElomm9I2SzTCphT0PlJlsCt0v+Y7kQogb1DdUQgrmVGjhLkt8JO4H6qx6I9P8kw5zqjqr
IPg==
X-Received: by 2002:a05:620a:3955:b0:7c5:a2de:71d3 with SMTP id af79cd13be357-7d22987fd96mr489759085a.20.1749215161512;
Fri, 06 Jun 2025 06:06:01 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IFUdVvO738H51zx3RkpFD2tOGdJQjBekLK/xn3jpyoVqPrtFayMU3gCbklQpppj/190tyxMbg==
X-Received: by 2002:a05:620a:3955:b0:7c5:a2de:71d3 with SMTP id af79cd13be357-7d22987fd96mr489754185a.20.1749215161067;
Fri, 06 Jun 2025 06:06:01 -0700 (PDT)
Received: from [192.168.1.17] (pool-68-160-160-85.bstnma.fios.verizon.net. [68.160.160.85])
by smtp.gmail.com with ESMTPSA id af79cd13be357-7d250e70898sm126377285a.20.2025.06.06.06.05.59
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:06:00 -0700 (PDT)
Message-ID: <f97a2e18-d672-41b1-ac26-4d1201528ed7@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 09:05:59 -0400
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v2 59/62] livepatch/klp-build: Introduce klp-build script
for generating livepatch modules
To: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>, x86@xxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx, Petr Mladek <pmladek@xxxxxxxx>,
Miroslav Benes <mbenes@xxxxxxx>, live-patching@xxxxxxxxxxxxxxx,
Song Liu <song@xxxxxxxxxx>, laokz <laokz@xxxxxxxxxxx>,
Jiri Kosina <jikos@xxxxxxxxxx>, Marcos Paulo de Souza <mpdesouza@xxxxxxxx>,
Weinan Liu <wnliu@xxxxxxxxxx>, Fazla Mehrab <a.mehrab@xxxxxxxxxxxxx>,
Chen Zhongjin <chenzhongjin@xxxxxxxxxx>, Puranjay Mohan <puranjay@xxxxxxxxxx>
References: <cover.1746821544.git.jpoimboe@xxxxxxxxxx>
<10ccbeb0f4bcd7d0a10cc9b9bd12fdc4894f83ee.1746821544.git.jpoimboe@xxxxxxxxxx>
Content-Language: en-US
From: Joe Lawrence <joe.lawrence@xxxxxxxxxx>
Autocrypt: addr=joe.lawrence@xxxxxxxxxx; keydata=
xsFNBFgTlmsBEADfrZirrMsj9Z9umoJ5p1rgOitLBABITvPO2x5eGBRfXbT306zr226bhfPj
+SDlaeIRwKoQvY9ydB3Exq8bKObYZ+6/OAVIDPHBVlnZbysutSHsgdaGqTH9fgYhoJlUIApz
suQL0MIRkPi0y+gABbH472f2dUceGpEuudIcGvpnNVTYxqwbWqsSsfT1DaAz9iBCeN+T/f/J
5qOXyZT7lC6vLy07eGg0uBh9jQznhbfXPIev0losNe7HxvgaPaVQ+BS9Q8NF8qpvbgpO+vWQ
ZD5+tRJ5t85InNiWR3bv01GcGXEjEVTnExYypajVuHxumqJeqGNeWvx26cfNRQJQxVQNV7Gz
iyAmJO7UulyWQiJqHZPcXAfoWyeKKAJ37YIYfE3k+rm6ekIwSgc9Lacf+KBfESNooU1LnwoQ
ok9Q6R5r7wqnhCziqXHfyN2YGhm0Wx4s7s6xIVrx3C5K0LjXBisjAthG/hbPhJvsCz5rTOmP
jkr+GSwBy2XUdOmtgq1IheBFwvWf08vrzNRCqz3iI1CvRpz0ZYBazmkz924u4ul6W7JuCdgy
qW3UDLA77XlzFrA7nJ6rb77aZF7LJlkahX7lMaKZUzH+K4aVKTdvZ3szm9K+v0iixsM0TEnz
oWsZgrkAA0OX2lpLfXvskoujQ84lY989IF+nUwy0wRMJPeqNxwARAQABzSZKb2UgTGF3cmVu
Y2UgPGpvZS5sYXdyZW5jZUByZWRoYXQuY29tPsLBlgQTAQgAQAIbAwcLCQgHAwIBBhUIAgkK
CwQWAgMBAh4BAheAFiEEXzkJ3py1AClxRoHJx96nQticmuUFAmF2uf8FCRLJJRQACgkQx96n
QticmuU69A/9FB5eF5kc392ifa/G6/m8q5BKVUXBMWy/RcRaEVUwl9lulJd99tkZT5KwwdIU
eYSpmT4SXrMzHj3mWe8RcFT9S39RvmZA6UKQkt9mJ+dvUVyDW1pqAB+S6+AEJyzw9AoVPSIG
WcHTCHdJZfZOMmFjDyduww7n94qXLO0oRMhjvR9vUqfBgEBSLzRSK96HI38brAcj33Q3lCkf
8uNLEAHVxN57bsNXxMYKo/i7ojFNCOyFEdPCWUMSF+M0D9ScXZRZCwbx0369yPSoNDgSIS8k
iC/hbP2YMqaqYjxuoBzTTFuIS60glJu61RNealNjzvdlVz3RnNvD4yKz2JUsEsNGEGi4dRy7
tvULj0njbwdvxV/gRnKboWhXVmlvB1qSfimSNkkoCJHXCApOdW0Og5Wyi+Ia6Qym3h0hwG0r
r+w8USCn4Mj5tBcRqJKITm92IbJ73RiJ76TVJksC0yEfbLd6x1u6ifNQh5Q7xMYk0t4VF6bR
56GG+3v1ci1bwwY5g1qfr7COU7in2ZOxhEpHtdt08MDSDFB3But4ko8zYqywP4sxxrJFzIdq
7Kv8a2FsLElJ3xG7jM260sWJfgZNI5fD0anbrzn9Pe1hShZY+4LXVJR/k3H01FkU9jWan0G/
8vF04bVKng8ZUBBT/6OYoNQHzQ9z++h5ywgMTITy5EK+HhnOwU0EWBOWawEQALxzFFomZI1s
4i0a6ZUn4eQ6Eh2vBTZnMR2vmgGGPZNZdd1Ww62VnpZamDKFddMAQySNuBG1ApgjlFcpX0kV
zm8PCi8XvUo0O7LHPKUkOpPM1NJKE1E3n5KqVbcTIftdTu3E/87lwBfEWBHIC+2K6K4GwSLX
AMZvFnwqkdyxm9v0UiMSg87Xtf2kXYnqkR5duFudMrY1Wb56UU22mpZmPZ3IUzjV7YTC9Oul
DYjkWI+2IN+NS8DXvLW8Dv4ursCiP7TywkxaslVT8z1kqtTUFPjH10aThjsXB5y/uISlj7av
EJEmj2Cbt14ps6YOdCT8QOzXcrrBbH2YtKp2PwA3G3hyEsCFdyal8/9h0IBgvRFNilcCxxzq
3gVtrYljN1IcXmx87fbkV8uqNuk+FxR/dK1zgjsGPtuWg1Dj/TrcLst7S+5VdEq87MXahQAE
O5qqPjsh3oqW2LtqfXGSQwp7+HRQxRyNdZBTOvhG0sys4GLlyKkqAR+5c6K3Qxh3YGuA77Qb
1vGLwQPfGaUo3soUWVWRfBw8Ugn1ffFbZQnhAs2jwQy3CILhSkBgLSWtNEn80BL/PMAzsh27
msvNMMwVj/M1R9qdk+PcuEJXvjqQA4x/F9ly/eLeiIvspILXQ5LodsITI1lBN2hQSbFFYECy
a4KuPkYHPZ3uhcfB0+KroLRxABEBAAHCwXwEGAEIACYCGwwWIQRfOQnenLUAKXFGgcnH3qdC
2Jya5QUCYXa52AUJEskk7QAKCRDH3qdC2Jya5awND/9d9YntR015FVdn910u++9v64fchT+m
LqD+WL24hTUMOKUzAVxq+3MLN4XRIcig4vnLmZ2sZ7VXstsukBCNGdm8y7Y8V1tXqeor82IY
aPzfFhcTtMWOvrb3/CbwxHWM0VRHWEjR7UXG0tKt2Sen0e9CviScU/mbPHAYsQDkkbkNFmaV
KJjtiVlTaIwq/agLZUOTzvcdTYD5QujvfnrcqSaBdSn1+LH3af5T7lANU6L6kYMBKO+40vvk
r5w5pyr1AmFU0LCckT2sNeXQwZ7jR8k/7n0OkK3/bNQMlLx3lukVZ1fjKrB79b6CJUpvTUfg
9uxxRFUmO+cWAjd9vOHT1Y9pgTIAELucjmlmoiMSGpbhdE8HNesdtuTEgZotpT1Q2qY7KV5y
46tK1tjphUw8Ln5dEJpNv6wFYFKpnKsiiHgWAaOuWkpHWScKfNHwdbXOw7kvIOrHV0euKhFa
0j0S2Arb+WjjMSJQ7WpC9rzkq1kcpUtdWnKUC24WyZdZ1ZUX2dW2AAmTI1hFtHw42skGRCXO
zOpdA5nOdOrGzIu0D9IQD4+npnpSIL5IW9pwZMkkgoD47pdeekzG/xmnvU7CF6iDBzwuG3CC
FPtyZxmwRVoS/YeBgzoyEDTwUJDzNGrkkNKnaUbDpg4TLRSCUUhmDUguj0QCa4n8kYoaAw9S
pNzsRQ==
In-Reply-To: <10ccbeb0f4bcd7d0a10cc9b9bd12fdc4894f83ee.1746821544.git.jpoimboe@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

> +# Build and post-process livepatch module in $KMOD_DIR
> +build_patch_module() {
> + local makefile="$KMOD_DIR/Kbuild"
> + local log="$KMOD_DIR/build.log"
> + local cflags=()
> + local files=()
> + local cmd=()
> +
> + rm -rf "$KMOD_DIR"
> + mkdir -p "$KMOD_DIR"
> +
> + cp -f "$SRC/scripts/livepatch/init.c" "$KMOD_DIR"
> +
> + echo "obj-m := $NAME.o" > "$makefile"
> + echo -n "$NAME-y := init.o" >> "$makefile"
> +
> + find "$DIFF_DIR" -type f -name "*.o" | mapfile -t files
> + [[ ${#files[@]} -eq 0 ]] && die "no changes detected"
> +
> + for file in "${files[@]}"; do
> + local rel_file="${file#"$DIFF_DIR"/}"
> + local kmod_file="$KMOD_DIR/$rel_file"
> + local cmd_file
> +
> + mkdir -p "$(dirname "$kmod_file")"
> + cp -f "$file" "$kmod_file"
> +
> + # Tell kbuild this is a prebuilt object
> + cp -f "$file" "${kmod_file}_shipped"
> +
> + echo -n " $rel_file" >> "$makefile"
> +
> + cmd_file="$ORIG_DIR/$(dirname "$rel_file")/.$(basename "$rel_file").cmd"
> + [[ -e "$cmd_file" ]] && cp -f "$cmd_file" "$(dirname "$kmod_file")"

Hi Josh,

Should the .cmd file copy come from the reference SRC and not original
ORIG directory?

cmd_file="$SRC/$(dirname "$rel_file")/.$(basename "$rel_file").cmd"

because I don't see any .cmd files in klp-tmp/orig/

FWIW, I only noticed this after backporting the series to
centos-stream-10. There, I got this build error:

Building original kernel
Copying original object files
Fixing patches
Building patched kernel
Copying patched object files
Diffing objects
vmlinux.o: changed function: cmdline_proc_show
Building patch module: livepatch-test.ko
<...>/klp-tmp/kmod/.vmlinux.o.cmd: No such file or directory
make[2]: *** [scripts/Makefile.modpost:145:
<...>/klp-tmp/kmod/Module.symvers] Error 1
make[1]: *** [<...>/Makefile:1936: modpost] Error 2
make: *** [Makefile:236: __sub-make] Error 2

The above edit worked for both your upstream branch and my downstream
backport.

--
Joe



Return-Path: <linux-kernel+bounces-675776-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8EB4C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:06:19 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4A8307AB3E1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:04:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 077F9288C2E;
Fri, 6 Jun 2025 13:05:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NaKnKfVQ"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16])
(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 DBA3C288510;
Fri, 6 Jun 2025 13:05:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215147; cv=none; b=Oq7MYvlIc5l9Rbu+IKW8PTeFksH2LQ1uNmXABQvTMxRO9I4wuolldXekE2RZixKJWMeTlXee7C7BVRItun6+qBrCS5up/RcgcBSfacF3igxWzIuwWXEeuvfkI5W4O+fMB6yMEtYIpJmj42c1pGMkz1LddZL/Z8p71vqu33cKXEo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215147; c=relaxed/simple;
bh=A2Sd/WTJjnDq4VgsQHc+hkVedj4k04ocVAy2dQ6whM0=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=fMavZwurGhokjy0S9iO9e/vSiO1rlWs9TwUEBVn43EKGkr7rmPG3AVWXkyCIaSLatF1b/JJ9bc1TgAwHKqSGLMRRuTP0MldUB21bTQjJiqxXAbMmo1LhYqWIm6r7uEit8X6zy+bT3kQNZR2MDoXvERni3fkRhHPsH40z3NM+EFM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NaKnKfVQ; arc=none smtp.client-ip=198.175.65.16
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749215145; x=1780751145;
h=message-id:date:mime-version:subject:to:cc:references:
from:in-reply-to:content-transfer-encoding;
bh=A2Sd/WTJjnDq4VgsQHc+hkVedj4k04ocVAy2dQ6whM0=;
b=NaKnKfVQk+R6LZs8w0ej+NnIPRMDU/D1gl32nP0g3IxpYJIBYkH84MXB
pECFA/PdSFUazxTZvYnfwhy2+VVglzV90SLBuCxhZp4KqqRxmqhHWtTSh
+l/Un8c5V/bkESonr6ckGTSKpyNdFh2o9H93/ziO9ieGmf6Q3FoZZXRzk
Cd9bndpTAKgrCbbarBhIqo+I498HaLNosj1c8lPuWo/4bl1cOpJj4o8Jh
djNEHMn7CIBog6D0bXge0UEf8ftbxWdWW7muRMOriDOBJ240Tpgk7VRgO
B8Y0RpwwMqt7tqJQXEWZOpnmpH57OVfCO0rrMwUAiq/AF7CXdIFGRUd6O
w==;
X-CSE-ConnectionGUID: IRtku3/NSOWEP+3y4nrixw==
X-CSE-MsgGUID: 9VujRSbQT+G1zCSpittTXw==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="51438099"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="51438099"
Received: from orviesa009.jf.intel.com ([10.64.159.149])
by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 06:05:41 -0700
X-CSE-ConnectionGUID: bHcp5Q6qShaYt4J2d1NZPw==
X-CSE-MsgGUID: BJBXeGDQQaCxqL+SPIKPbA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="145832218"
Received: from linux.intel.com ([10.54.29.200])
by orviesa009.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 06:05:41 -0700
Received: from [10.246.136.52] (kliang2-mobl1.ccr.corp.intel.com [10.246.136.52])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by linux.intel.com (Postfix) with ESMTPS id 16ECB20B5736;
Fri, 6 Jun 2025 06:05:38 -0700 (PDT)
Message-ID: <e671d9e9-7da5-4f04-8584-fd743fce1202@xxxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 09:05:37 -0400
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH V3] perf: Fix the throttle error of some clock events
To: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>,
Namhyung Kim <namhyung@xxxxxxxxxx>, Ian Rogers <irogers@xxxxxxxxxx>,
Mark Rutland <mark.rutland@xxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>,
"linux-perf-use." <linux-perf-users@xxxxxxxxxxxxxxx>,
Stephane Eranian <eranian@xxxxxxxxxx>, Chun-Tse Shao <ctshao@xxxxxxxxxx>,
Thomas Richter <tmricht@xxxxxxxxxxxxx>, Leo Yan <leo.yan@xxxxxxx>,
Aishwarya TCV <aishwarya.tcv@xxxxxxx>,
Venkat Rao Bagalkote <venkat88@xxxxxxxxxxxxx>
References: <20250604171554.3909897-1-kan.liang@xxxxxxxxxxxxxxx>
<CAADnVQKjyzdNVR_+WCMzORPJAX00tD3HK0vaCz13ZprWaG72Tg@xxxxxxxxxxxxxx>
<d5fcf34f-63fe-451b-89ad-621c38981709@xxxxxxxxxxxxxxx>
<CAADnVQ+N5UaBwLjtLGHAe1PCjpRzxxcFL45gbb0eHMDZD5+X6A@xxxxxxxxxxxxxx>
<3f8b0b58-3b48-470e-b8ff-a71a26370bc3@xxxxxxxxxxxxxxx>
<CAADnVQKRJKsG08KkEriuBQop0LgDr+c9rkNE6MUh_n3rzZoXVQ@xxxxxxxxxxxxxx>
<7638853b-bbc6-464d-8890-29ed92aa5cef@xxxxxxxxxxxxxxx>
<CAADnVQLBv08fjWWVL+7w7TqoYN-EbGT-E=YsAcms+NEQ9zGUeQ@xxxxxxxxxxxxxx>
Content-Language: en-US
From: "Liang, Kan" <kan.liang@xxxxxxxxxxxxxxx>
In-Reply-To: <CAADnVQLBv08fjWWVL+7w7TqoYN-EbGT-E=YsAcms+NEQ9zGUeQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 2025-06-05 8:39 p.m., Alexei Starovoitov wrote:
> On Thu, Jun 5, 2025 at 4:50â?¯PM Liang, Kan <kan.liang@xxxxxxxxxxxxxxx> wrote:
>>
>>
>>
>> On 2025-06-05 4:46 p.m., Alexei Starovoitov wrote:
>>> On Thu, Jun 5, 2025 at 1:24â?¯PM Liang, Kan <kan.liang@xxxxxxxxxxxxxxx> wrote:
>>>>
>>>>
>>>>
>>>> On 2025-06-05 2:45 p.m., Alexei Starovoitov wrote:
>>>>> On Thu, Jun 5, 2025 at 6:46â?¯AM Liang, Kan <kan.liang@xxxxxxxxxxxxxxx> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 2025-06-04 7:21 p.m., Alexei Starovoitov wrote:
>>>>>>> On Wed, Jun 4, 2025 at 10:16â?¯AM <kan.liang@xxxxxxxxxxxxxxx> wrote:
>>>>>>>>
>>>>>>>> From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
>>>>>>>>
>>>>>>>> Both ARM and IBM CI reports RCU stall, which can be reproduced by the
>>>>>>>> below perf command.
>>>>>>>> perf record -a -e cpu-clock -- sleep 2
>>>>>>>>
>>>>>>>> The issue is introduced by the generic throttle patch set, which
>>>>>>>> unconditionally invoke the event_stop() when throttle is triggered.
>>>>>>>>
>>>>>>>> The cpu-clock and task-clock are two special SW events, which rely on
>>>>>>>> the hrtimer. The throttle is invoked in the hrtimer handler. The
>>>>>>>> event_stop()->hrtimer_cancel() waits for the handler to finish, which is
>>>>>>>> a deadlock. Instead of invoking the stop(), the HRTIMER_NORESTART should
>>>>>>>> be used to stop the timer.
>>>>>>>>
>>>>>>>> There may be two ways to fix it.
>>>>>>>> - Introduce a PMU flag to track the case. Avoid the event_stop in
>>>>>>>> perf_event_throttle() if the flag is detected.
>>>>>>>> It has been implemented in the
>>>>>>>> https://lore.kernel.org/lkml/20250528175832.2999139-1-kan.liang@xxxxxxxxxxxxxxx/
>>>>>>>> The new flag was thought to be an overkill for the issue.
>>>>>>>> - Add a check in the event_stop. Return immediately if the throttle is
>>>>>>>> invoked in the hrtimer handler. Rely on the existing HRTIMER_NORESTART
>>>>>>>> method to stop the timer.
>>>>>>>>
>>>>>>>> The latter is implemented here.
>>>>>>>>
>>>>>>>> Move event->hw.interrupts = MAX_INTERRUPTS before the stop(). It makes
>>>>>>>> the order the same as perf_event_unthrottle(). Except the patch, no one
>>>>>>>> checks the hw.interrupts in the stop(). There is no impact from the
>>>>>>>> order change.
>>>>>>>>
>>>>>>>> Reported-by: Leo Yan <leo.yan@xxxxxxx>
>>>>>>>> Reported-by: Aishwarya TCV <aishwarya.tcv@xxxxxxx>
>>>>>>>> Closes: https://lore.kernel.org/lkml/20250527161656.GJ2566836@xxxxxxxxxxxxxxx/
>>>>>>>> Reported-by: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
>>>>>>>> Closes: https://lore.kernel.org/lkml/djxlh5fx326gcenwrr52ry3pk4wxmugu4jccdjysza7tlc5fef@ktp4rffawgcw/
>>>>>>>> Reported-by: Venkat Rao Bagalkote <venkat88@xxxxxxxxxxxxx>
>>>>>>>> Closes: https://lore.kernel.org/lkml/8e8f51d8-af64-4d9e-934b-c0ee9f131293@xxxxxxxxxxxxx/
>>>>>>>> Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
>>>>>>>
>>>>>>> It seems the patch fixes one issue and introduces another ?
>>>>>>>
>>>>>>> Looks like the throttle event is sticky.
>>>>>>> Once it's reached the perf_event no longer works ?
>>>>>>
>>>>>> No. It should still work even the throttle is triggered.
>>>>>>
>>>>>> sdp@d404e6bce080:~$ sudo bash -c 'echo 10 >
>>>>>> /proc/sys/kernel/perf_event_max_sample_rate'
>>>>>> sdp@d404e6bce080:~$ sudo perf record -a -e cpu-clock -c10000 -- sleep 1
>>>>>> [ perf record: Woken up 1 times to write data ]
>>>>>> [ perf record: Captured and wrote 0.559 MB perf.data (584 samples) ]
>>>>>
>>>>> With the patch applied above command hangs in my VM:
>>>>>
>>>>> # perf record -a -e cpu-clock -c10000 -- sleep 1
>>>>> [ 43.656855] hrtimer: interrupt took 21640 ns
>>>>> [ 68.561052] watchdog: BUG: soft lockup - CPU#0 stuck for 41s! [perf:2253]
>>>>> [ 68.561056] Modules linked in: bpf_preload
>>>>> [ 68.561060] CPU: 0 UID: 0 PID: 2253 Comm: perf Not tainted
>>>>> 6.15.0-12294-gc89e5202e569 #1172 PREEMPT
>>>>> [ 68.561062] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
>>>>> BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
>>>>> [ 68.561063] RIP: 0010:handle_softirqs+0x77/0x2a0
>>>>> [ 68.561070] Code: 6b 96 02 00 01 00 00 bd 0a 00 00 00 44 89 64 24
>>>>> 14 89 6c 24 10 40 88 7c 24 04 31 c0 65 66 89 05 5f 6b 96 02 fb bb ff
>>>>> ff ff ff <48> c7 c0 c0 f
>>>>> [ 68.561071] RSP: 0018:ffa0000000003fa0 EFLAGS: 00000246
>>>>> [ 68.561072] RAX: 0000000000000000 RBX: 00000000ffffffff RCX: 00000000000006e0
>>>>> [ 68.561073] RDX: 0000000000000007 RSI: ff1100010212e100 RDI: 0000000000000000
>>>>> [ 68.561074] RBP: 000000000000000a R08: 0000000000000000 R09: 7fffffffffffffff
>>>>> [ 68.561074] R10: 00000005a3af2140 R11: 0000000000004601 R12: 0000000000400100
>>>>> [ 68.561075] R13: 0000000000000000 R14: 0000000000000002 R15: 0000000000000000
>>>>> [ 68.561111] FS: 00007fa1b536f780(0000) GS:ff110004abe26000(0000)
>>>>> knlGS:0000000000000000
>>>>> [ 68.561112] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>>>> [ 68.561113] CR2: 0000000001c67a30 CR3: 000000010f2f3003 CR4: 00000000003716f0
>>>>> [ 68.561113] Call Trace:
>>>>> [ 68.561170] <IRQ>
>>>>> [ 68.561174] irq_exit_rcu+0x91/0xb0
>>>>> [ 68.561176] sysvec_apic_timer_interrupt+0x71/0x90
>>>>> [ 68.561181] </IRQ>
>>>>> [ 68.561181] <TASK>
>>>>> [ 68.561182] asm_sysvec_apic_timer_interrupt+0x1a/0x20
>>>>> [ 68.561184] RIP: 0010:generic_exec_single+0x33/0x120
>>>>> [ 68.561188] Code: 65 39 3d 5c 4d 89 02 74 28 3b 3d b8 f5 17 02 0f
>>>>> 83 de 00 00 00 89 f8 48 0f a3 05 d8 f1 17 02 0f 83 ce 00 00 00 e8 bd
>>>>> fe ff ff <31> c0 5b 5d 9
>>>>> [ 68.561189] RSP: 0018:ffa00000025a3cc0 EFLAGS: 00000206
>>>>> [ 68.561190] RAX: 0000000000000000 RBX: ffffffff8145b310 RCX: ff110004abe26000
>>>>> [ 68.561190] RDX: 0000000000000007 RSI: 0000000000000000 RDI: ff1100042fa26540
>>>>> [ 68.561191] RBP: 0000000000000202 R08: 0000000000000000 R09: 0000000000000000
>>>>> [ 68.561191] R10: ffa00000025a3ee0 R11: 0000000000000000 R12: ffa00000025a3d40
>>>>> [ 68.561192] R13: ff11000100881220 R14: ff11000100880fc0 R15: 0000000000000000
>>>>> [ 68.561192] ? sw_perf_event_destroy+0x70/0x70
>>>>> [ 68.561197] smp_call_function_single+0xc4/0x110
>>>>> [ 68.561199] ? sw_perf_event_destroy+0x70/0x70
>>>>> [ 68.561200] event_function_call+0x160/0x170
>>>>> [ 68.561202] ? ctx_resched+0x2d0/0x2d0
>>>>> [ 68.561205] ? perf_event_set_state+0x60/0x60
>>>>> [ 68.561206] ? _perf_event_disable+0x50/0x50
>>>>> [ 68.561208] perf_event_for_each_child+0x37/0x80
>>>>> [ 68.561209] ? _perf_event_disable+0x50/0x50
>>>>> [ 68.561211] _perf_ioctl+0x1df/0xad0
>>>>> [ 68.561213] ? __set_cpus_allowed_ptr+0x71/0x80
>>>>> [ 68.561216] ? avc_has_perm+0x72/0x160
>>>>> [ 68.561219] ? ldsem_down_write+0x1bb/0x1fc
>>>>> [ 68.561222] perf_ioctl+0x42/0x70
>>>>> [ 68.561224] __x64_sys_ioctl+0x8f/0xd0
>>>>> [ 68.561226] do_syscall_64+0x46/0x160
>>>>> [ 68.561228] entry_SYSCALL_64_after_hwframe+0x4b/0x53
>>>>>
>>>>> but only after a fresh boot.
>>>>>
>>>>> If I run bpf selftests before that it works.
>>>>> Like test_progs -t stacktrace_build_id_nmi
>>>>> followed by the same
>>>>> perf record -a -e cpu-clock ..
>>>>> it works fine.
>>>>>
>>>>
>>>> There should be a bug in V3. When stops in the throttle, the event
>>>> should not be updated, stop(event, 0). But the cpu_clock_event_stop()
>>>> doesn't handle the flag. That changes the behavior a little bit.
>>>>
>>>> Could you please try the below patch and see if it helps?
>>>>
>>>> diff --git a/kernel/events/core.c b/kernel/events/core.c
>>>> index cd85b1820e7d..b6c57ba24e78 100644
>>>> --- a/kernel/events/core.c
>>>> +++ b/kernel/events/core.c
>>>> @@ -2656,8 +2656,8 @@ static void perf_event_unthrottle(struct
>>>> perf_event *event, bool start)
>>>>
>>>> static void perf_event_throttle(struct perf_event *event)
>>>> {
>>>> - event->pmu->stop(event, 0);
>>>> event->hw.interrupts = MAX_INTERRUPTS;
>>>> + event->pmu->stop(event, 0);
>>>> if (event == event->group_leader)
>>>> perf_log_throttle(event, 0);
>>>> }
>>>> @@ -11777,7 +11777,12 @@ static void perf_swevent_cancel_hrtimer(struct
>>>> perf_event *event)
>>>> {
>>>> struct hw_perf_event *hwc = &event->hw;
>>>>
>>>> - if (is_sampling_event(event)) {
>>>> + /*
>>>> + * The throttle can be triggered in the hrtimer handler.
>>>> + * The HRTIMER_NORESTART should be used to stop the timer,
>>>> + * rather than hrtimer_cancel(). See perf_swevent_hrtimer()
>>>> + */
>>>> + if (is_sampling_event(event) && (hwc->interrupts != MAX_INTERRUPTS)) {
>>>> ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);
>>>> local64_set(&hwc->period_left, ktime_to_ns(remaining));
>>>>
>>>> @@ -11832,7 +11837,8 @@ static void cpu_clock_event_start(struct
>>>> perf_event *event, int flags)
>>>> static void cpu_clock_event_stop(struct perf_event *event, int flags)
>>>> {
>>>> perf_swevent_cancel_hrtimer(event);
>>>> - cpu_clock_event_update(event);
>>>> + if (flags & PERF_EF_UPDATE)
>>>> + cpu_clock_event_update(event);
>>>> }
>>>
>>> Nope. The last hunk didn't make any difference.
>>> Same soft lockup.
>>
>> Thanks for the verification.
>>
>> I have some questions, could you please help to clarify?
>>
>> - What's the value of proc/sys/kernel/perf_event_max_sample_rate in the
>> test?
>
> 100000
>
>> - Can the soft lockup issue be produced by both bpf selftests and the
>> perf record command? Or just the perf record command?
>
> just perf record.
>
>> - Can the soft lockup issue be reproduced with the v2 patchset?
>> https://lore.kernel.org/lkml/20250528175832.2999139-1-kan.liang@xxxxxxxxxxxxxxx/
>
> yes. With v2
> perf record -a -e cpu-clock -c10000 -- sleep 1
>
> soft locks up as well with the same stack trace.
>
>> - Furthermore, can the soft lockup issue be reproduced after reverting
>> the recent generic throttle logic fix?
>> commit e800ac51202f ("perf: Only dump the throttle log for the leader")
>> commit 9734e25fbf5a ("perf: Fix the throttle logic for a group")
>
> yes.
>
> perf record -a -e cpu-clock -- sleep 1
> works
>
> but
> perf record -a -e cpu-clock -c100 -- sleep 1
> locks up.
> -c1, -c100, -c10000 all lockup.

Thanks for the confirmation.

The soft lockup issue is likely an existing issue in virtualization,
unrelated to the recent throttle patches.

The issue should be caused by the overwhelming overflows.
The -c means fixed period. It's too small for the SW event in VM.
For 1 GHZ CPU, the -c10000 will trigger 100000 samples per second.
-c1 will trigger 1000000000 samples per second.
The perf_event_max_sample_rate is set to 100000. The throttle mechanism
should be triggered for the above case, but even with 100000 samples per
second. It seems still be big number in virtualization.

There is no such issue without -c. I think it's because of the
auto-adjust mechanism for the freq mode. The period is automatically
adjusted, so a reasonable number of samples can be generated per second.

If you change the proc/sys/kernel/perf_event_max_sample_rate to a small
value, e.g., 1000, I think the issue should be gone.

Could you please give a try?

Thanks,
Kan



Return-Path: <linux-kernel+bounces-675778-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 789C141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:07:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id D0AB47A4B35
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:06:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 001C4288C21;
Fri, 6 Jun 2025 13:07:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XlbBfbY+"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12])
(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 A393B28466F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:07:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215269; cv=none; b=QsUvMKAEhmDmzlvTySpGYWt1q1AFJGGGBaHs1B16xp0mffB659PxcuPYTye5JdfPPlWM3eX4WZItMWt4kunTec9TFtNpphdcmvfuOg8XbTfg3ExuLYtVLZh27FzYL/2sFcKi3bR+ywx0hx/GFOauEHBADTy+4MKj5V8wtfJjhb4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215269; c=relaxed/simple;
bh=kAYfxiYLKb/mg8CdOGTnsW+n1F/MmNtgqssdpnvk/Ak=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZpoZ29FvaDSdv3/znlB3JCaaug3lvn+IgHktXiVEq/2f8HgeFr12YwkeRC/cEzW+6gdSPdcgDd9LwvztaCHHdj49c/xiY9Gm8AzrrlJbvdEkdEU8VQpjrHDHkJlnF+QUWvG+bjF/YIdSTpkL2DUqln0+owmkC6a7c8Z2uNZoRbc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XlbBfbY+; arc=none smtp.client-ip=192.198.163.12
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749215268; x=1780751268;
h=from:to:cc:subject:date:message-id:mime-version:
content-transfer-encoding;
bh=kAYfxiYLKb/mg8CdOGTnsW+n1F/MmNtgqssdpnvk/Ak=;
b=XlbBfbY+/xTyuQO+Uj0vao9eXF3JZM2ATMZ/EL3M99o2QeaQBAIQTEDf
MyYeP8anCI+PCacOk2Sf4TnG92H0WutlvPjZ/8b9j4D97G9lQ0dp5CEfz
G/rRLRWx22gMb+IXCqAr79k4TQyV15zUb2h8iPQcOzYf01AhtuBKGNnD+
PRZPrJekbTWBwbZ2CXug9uJfzxDqfmzj5Y9qxU5y50SHGFFqx2OOb3exQ
SAiMAFHFjIBWq4TCdfWMlsmiQoU50HpUZpMfbVlvsnwzXMU4T93ZlQYvX
2KEvOW15WAJ6ubRSmwqjPSpoosPEnC5f0eVOg/bCz2XwL1UtU4zixWcIn
w==;
X-CSE-ConnectionGUID: EWoeqnXgSjKjxjQ3Ifx4JA==
X-CSE-MsgGUID: HZkc0MudRumqz3lk/L47Wg==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="55155710"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="55155710"
Received: from fmviesa007.fm.intel.com ([10.60.135.147])
by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 06:07:47 -0700
X-CSE-ConnectionGUID: t4CIR9zlQniyQT9CeAjFFg==
X-CSE-MsgGUID: 0DUUwuh5RkaeRPPFNfNkng==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="145755673"
Received: from mgerlach-mobl1.amr.corp.intel.com (HELO khuang2-desk.gar.corp.intel.com) ([10.124.222.150])
by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 06:07:45 -0700
From: Kai Huang <kai.huang@xxxxxxxxx>
To: dave.hansen@xxxxxxxxx,
peterz@xxxxxxxxxxxxx,
tglx@xxxxxxxxxxxxx,
bp@xxxxxxxxx,
mingo@xxxxxxxxxx,
hpa@xxxxxxxxx,
kirill.shutemov@xxxxxxxxxxxxxxx
Cc: rick.p.edgecombe@xxxxxxxxx,
x86@xxxxxxxxxx,
samitolvanen@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v3] x86/virt/tdx: Enforce no indirect calls of TDX assembly
Date: Sat, 7 Jun 2025 01:07:37 +1200
Message-ID: <20250606130737.30713-1-kai.huang@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Two static inline TDX helper functions (sc_retry() and sc_retry_prerr())
pass around function pointers to assembly functions. Normally, the
compiler inlines these helper functions, realizes that the function
pointer targets are completely static and can be resolved at compile
time, and generates direct call instructions.

But, other times (like when CONFIG_CC_OPTIMIZE_FOR_SIZE=y), the compiler
will stop inlining and instead generate indirect call instructions.

Indirect calls to assembly functions require special annotation so that
both hardware and software implementations of Control Flow Integrity
mechanisms can work correctly. But TDX assembly functions are declared
as if they are only called directly.

Annotate both sc_retry() and sc_retry_prerr() as __always_inline so that
the compiler will always inline these helpers and generate direct call
instructions when calling TDX assembly functions (see [1]).

This was found through randconfig testing, presumably setting
CONFIG_CC_OPTIMIZE_FOR_SIZE=1 when objtool spewed a bunch of these:

vmlinux.o: warning: objtool: tdh_mem_range_block+0x7e: relocation to
!ENDBR: __seamcall_ret+0x0

Link: https://lore.kernel.org/lkml/20250605145914.GW39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ [1]
Signed-off-by: Kai Huang <kai.huang@xxxxxxxxx>
---

This is updated version (with patch subject updated) of v1 patch:

https://lore.kernel.org/lkml/20250604003848.13154-1-kai.huang@xxxxxxxxx/

v1 -> v3:
- Follow Peter's suggestion to use __always_inline, instead of
declaring TDX assembly can be called indirectly.
- Change patch subject accordingly.
- Update changelog accordingly, based on Dave's version.

v2 is similar to v1 and was sent right before Peter suggested to use
__always_inline, thus feel free to ignore.

---
arch/x86/include/asm/tdx.h | 2 +-
arch/x86/virt/vmx/tdx/tdx.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
index 8b19294600c4..7ddef3a69866 100644
--- a/arch/x86/include/asm/tdx.h
+++ b/arch/x86/include/asm/tdx.h
@@ -106,7 +106,7 @@ void tdx_init(void);

typedef u64 (*sc_func_t)(u64 fn, struct tdx_module_args *args);

-static inline u64 sc_retry(sc_func_t func, u64 fn,
+static __always_inline u64 sc_retry(sc_func_t func, u64 fn,
struct tdx_module_args *args)
{
int retry = RDRAND_RETRY_LOOPS;
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index 2457d13c3f9e..c7a9a087ccaf 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -75,8 +75,9 @@ static inline void seamcall_err_ret(u64 fn, u64 err,
args->r9, args->r10, args->r11);
}

-static inline int sc_retry_prerr(sc_func_t func, sc_err_func_t err_func,
- u64 fn, struct tdx_module_args *args)
+static __always_inline int sc_retry_prerr(sc_func_t func,
+ sc_err_func_t err_func,
+ u64 fn, struct tdx_module_args *args)
{
u64 sret = sc_retry(func, fn, args);


base-commit: ec7714e4947909190ffb3041a03311a975350fe0
--
2.49.0



Return-Path: <linux-kernel+bounces-675779-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D6BC541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:09:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 71228189B832
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:09:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 373DA288C37;
Fri, 6 Jun 2025 13:09:25 +0000 (UTC)
Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D113CF9EC;
Fri, 6 Jun 2025 13:09:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215364; cv=none; b=pWSaIcSarOr3zT+rTXQvp8uJno6F5RSel1zOYLubRMrKA/vlFBPewslSEuh3ZJFFBuqvX+ercRuYcwBhy9b+1MQV2tefjSTVOp3ZQIF4vyJllUssCOrAvxjdi73ke2Pe67skDAp7j7inJDGrocFOh2IQO2HgXYctm8DXw8E0APM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215364; c=relaxed/simple;
bh=p65BgQsXIRell7NjibwP8/nB9rR+PSzRnhPcxgf6bbU=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DP6gRyRQ5CxAI1h1lLcO/H3bfByW9vXmZR4oQuRx3w0epLCgTqsDH0lBKH15E9w+KLg03HvVo4Qgg6wE4U16crSk4Ltf6Hr6PkfBYJtqdGQ+lFCKr75dG7Ok42d6Hw96Q72gvczEvcCP82r0SWbO+lU2LMgzJaoUB3dl4Gucyzk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joshuagrisham.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.45
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joshuagrisham.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-5532e0ad84aso2240955e87.2;
Fri, 06 Jun 2025 06:09:22 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749215361; x=1749820161;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=SDIM4cWaSDVmDW7CZCAy47kSfugePR2in3Baxdfjghc=;
b=I3kp007GoIKy7jJoMzWSIKMTSK2z8IIsaNypqiwRaa3DPnJNpNn/gvbOvJrsfPvK3c
Of42xFTT+fmKvSM65mJfWFwH0fZxUfyNzD7nFMyT+IubtjUnzU4zR766a46Kff1caIGJ
pg7Qjq/EhbwyAd4quSQz4OnTcNm4k0csdjNCOIT0tiHgJv3kgN8Ac2mlr7Zb7KGeELV7
OiCsLj1bzmln304+x/76H4pkUn8TmaoyPPWme+0zg/nTn6LTlvFcjsq5a8BvZgPFHQNS
puwGeFstElvX9lvbvT6TdpbtwlvCe+Cx9P2iaNcg9ufT1vt6pQZBdlYiAWNteqq+49+7
PrAg==
X-Forwarded-Encrypted: i=1; AJvYcCUGPeUvV+PIqOC7pa9A3H4hMjj2PHqyqIRp9COiRYFdxXV9txre9XVXjqcEBTW7c2XOjqwJQtwpQCpjwPVU0risGNhS5A==@vger.kernel.org, AJvYcCX5OWx1HzHm/sXD2VmnmIgIOapVbTy5j6pghNfz7+A2RX1kBvtDOX6gQRM0/52sfboFZXIqaZmcPIuLCkA=@vger.kernel.org
X-Gm-Message-State: AOJu0YwIc1rmhKJO0mmZTe30wo6MjBXsXJ1kc4Zu3aqqKQWweVG2nDbn
k2MLu1BTXn46FIJI5rNAqGl9SZ63RZGO3OC8Ny9YRzz9b/tnMUbXNBJv
X-Gm-Gg: ASbGncvy7K7dprzk3FVJDd1RPUlwgVgZnECOWqgw0Rf8MFqGdIwxz0ONOkTnupR8ZNF
qvKZQjRFmUHOj/JZ2tSCD5pcUuq8p6+H3nBJvkt8cbTwXefNrM2KYvF73z+U+X6HNDHUFODiJu0
shaMLyPSD/VX7XraJOxNtwEgUeB0TshKsng1djut3H07Jt/y2iw8KmK5d48NrIDbJy6J5A8+mkD
aF8zs+WnVuQ7mikhO6rpRr2jrY2wBjBMxxP4ZjBKPqOdEoqUMBmvTxUn7jAg9hLW2i2yIYMLSX0
h4LJTtNsieJMiwb1oblbQn3Tkh/PP6i34MxvZ/n4vvktVD8Rg0qvDNdpVzTANqGV/6eNthJZrg0
3WC0F0yHn/m7pshQB4TlA4oefyLc=
X-Google-Smtp-Source: AGHT+IGOxCjkdUdURCQroxmFj//+lEKQJxyprwe/KzhvvZnQO0JORgBaWN3NUp/eJgzM2lwmEJUGsw==
X-Received: by 2002:a05:651c:1545:b0:32a:8bb1:d971 with SMTP id 38308e7fff4ca-32adfc290f3mr7905301fa.18.1749215360651;
Fri, 06 Jun 2025 06:09:20 -0700 (PDT)
Received: from galaxybook.local (82-183-24-76.customers.ownit.se. [82.183.24.76])
by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-32ae1cad5c8sm1696921fa.72.2025.06.06.06.09.19
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:09:19 -0700 (PDT)
From: Joshua Grisham <josh@xxxxxxxxxxxxxxxxx>
To: ilpo.jarvinen@xxxxxxxxxxxxxxx,
hdegoede@xxxxxxxxxx,
platform-driver-x86@xxxxxxxxxxxxxxx,
W_Armin@xxxxxx,
thomas@xxxxxxxx,
kuurtb@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Cc: Joshua Grisham <josh@xxxxxxxxxxxxxxxxx>
Subject: [PATCH] platform/x86: samsung-galaxybook: Add SAM0426
Date: Fri, 6 Jun 2025 15:09:08 +0200
Message-ID: <20250606130909.207047-1-josh@xxxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.45.2
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add device ID SAM0426 (Notebook 9 Pro and similar devices) as reported
and tested by GitHub user "diego-karsa" [1].

[1]: https://github.com/joshuagrisham/samsung-galaxybook-extras/issues/69

Signed-off-by: Joshua Grisham <josh@xxxxxxxxxxxxxxxxx>
---
drivers/platform/x86/samsung-galaxybook.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
index 5878a3519..3c13e13d4 100644
--- a/drivers/platform/x86/samsung-galaxybook.c
+++ b/drivers/platform/x86/samsung-galaxybook.c
@@ -1403,6 +1403,7 @@ static int galaxybook_probe(struct platform_device *pdev)
}

static const struct acpi_device_id galaxybook_device_ids[] = {
+ { "SAM0426" },
{ "SAM0427" },
{ "SAM0428" },
{ "SAM0429" },
--
2.45.2



Return-Path: <linux-kernel+bounces-675780-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4BDEA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:10:50 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 43D973B0F65
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:10:28 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CC4CB288C93;
Fri, 6 Jun 2025 13:10:38 +0000 (UTC)
Received: from freeshell.de (freeshell.de [116.202.128.144])
(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 AB02F2405ED;
Fri, 6 Jun 2025 13:10:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.202.128.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215438; cv=none; b=JDLrXRM2dj3MiEjDX12h3eWL/UPMzeXgkHDee6rfHj3GygGWiq4c+kTRTpKuGBD/ZP8Pi5Irp+CvQ6+yxL+OdNEOPnd145cYViT1rUkwiOuSVhIY3j3Z5Go0JlKchpMSEhXSD9NPmk9S2GIMfpGNjPtYSCWmtSzjmFkw5sc66eg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215438; c=relaxed/simple;
bh=+yPr6VbEro0zZyE3N7k5jlifzdfsZRW/5nV+Zah/1zU=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lbd3sYbs0wYohR4yOf271phOEEh2dY3/W1zXKQWqcOTC7FFsLz7LTAHF9TE+euBCRnpubcp6aPDon4+tooTizhoYYu8txiAdl+Qa45zgWQEFWhhgFpb5NnfJZYF+3D6enHlXp7R9TEVbRd7bp5+dgrawLsW8C00rJD3uB1CoN1U=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=freeshell.de; spf=pass smtp.mailfrom=freeshell.de; arc=none smtp.client-ip=116.202.128.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=freeshell.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=freeshell.de
Received: from hay.lan. (unknown [IPv6:2605:59c0:20f3:a400:6ecf:39ff:fe00:8375])
(Authenticated sender: e)
by freeshell.de (Postfix) with ESMTPSA id 95339B4C440C;
Fri, 6 Jun 2025 15:04:12 +0200 (CEST)
From: E Shattow <e@xxxxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>,
Palmer Dabbelt <palmer@xxxxxxxxxxx>,
Albert Ou <aou@xxxxxxxxxxxxxxxxx>,
Alexandre Ghiti <alex@xxxxxxxx>
Cc: E Shattow <e@xxxxxxxxxxxx>
Subject: [PATCH v1 0/3] riscv: dts: starfive: jh7110: More U-Boot downstream changes for JH7110
Date: Fri, 6 Jun 2025 06:02:35 -0700
Message-ID: <20250606130253.1105273-1-e@xxxxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Bring in additional downstream U-Boot boot loader changes for StarFive
VisionFive2 board target (and related JH7110 common boards). There is a
memory controller with no downstream dt-binding; create a basic dt-binding
(and not any Linux driver) in support of the memory-controller dts node
needed by U-Boot starfive_ddr.c driver. Also add bootph-pre-ram hinting
to jh7110.dtsi needed at SPL boot phase.

Changes since RFC:

- Drop additional timer node from series as not strictly needed for boot.
- Add patch for starfive,jh7110-dmc binding
- Adjust ordering of bootph-pre-ram hints to follow devicetree style guide

E Shattow (3):
dt-bindings: memory-controllers: add StarFive JH7110 SoC DMC
riscv: dts: starfive: jh7110: add memory controller node
riscv: dts: starfive: jh7110: bootph-pre-ram hinting needed by boot
loader

.../starfive,jh7110-dmc.yaml | 76 +++++++++++++++++++
arch/riscv/boot/dts/starfive/jh7110.dtsi | 22 ++++++
2 files changed, 98 insertions(+)
create mode 100644 Documentation/devicetree/bindings/memory-controllers/starfive,jh7110-dmc.yaml


base-commit: d50108706a63dfd896db42172bf9f6aebec219c5
--
2.49.0



Return-Path: <linux-kernel+bounces-675781-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 410A341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:10:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 45B817A44D2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:09:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D4B0B288C96;
Fri, 6 Jun 2025 13:10:38 +0000 (UTC)
Received: from freeshell.de (freeshell.de [116.202.128.144])
(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 AAFC020330;
Fri, 6 Jun 2025 13:10:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.202.128.144
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215438; cv=none; b=Dy53dWpL1MgQTZ6Cx8/BuQTOkalx3XAKx5gy4PBTYONIx0TR6HNuJrt9UxvZOfSii7VjsRaaKz0+PolGJ38/+u0zu/vKiSyZxQtkayqhh8zA7rMKbt5LsFJZSKZjUsG9r81UZHaPKZPJUdSfb8/ztuZIuv1qQ5rlZrLNYhGyfn8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215438; c=relaxed/simple;
bh=37z7SKqOfqgqoDLNZYBJd8RKrqH73AtwnVrwoq/OZNM=;
h=From:To:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=hOQfhx9FOBF2zt07ooRDFQjbivPz4WPH70CsI2RJMDXQnS+umZtg4xQ1PZf8P9Ou34xQehFxsMAPq8cbSpj8/B15cPT/G0dIdCgcR6BtOxV7+N5baYQrPalCjw6+yT5hBWfyEaxEe3f1CuVM2Gi772/5p0Cg6gTCabXigCyi8UY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=freeshell.de; spf=pass smtp.mailfrom=freeshell.de; arc=none smtp.client-ip=116.202.128.144
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=freeshell.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=freeshell.de
Received: from hay.lan. (unknown [IPv6:2605:59c0:20f3:a400:6ecf:39ff:fe00:8375])
(Authenticated sender: e)
by freeshell.de (Postfix) with ESMTPSA id 9A0E2B4C4432;
Fri, 6 Jun 2025 15:04:19 +0200 (CEST)
From: E Shattow <e@xxxxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx,
Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
E Shattow <e@xxxxxxxxxxxx>
Subject: [PATCH v1 1/3] dt-bindings: memory-controllers: add StarFive JH7110 SoC DMC
Date: Fri, 6 Jun 2025 06:02:36 -0700
Message-ID: <20250606130253.1105273-2-e@xxxxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250606130253.1105273-1-e@xxxxxxxxxxxx>
References: <20250606130253.1105273-1-e@xxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Document bindings for the JH7110 SoC DMC as implemented in downstream
U-Boot driver starfive_ddr.c

Signed-off-by: E Shattow <e@xxxxxxxxxxxx>
---
.../starfive,jh7110-dmc.yaml | 76 +++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 Documentation/devicetree/bindings/memory-controllers/starfive,jh7110-dmc.yaml

diff --git a/Documentation/devicetree/bindings/memory-controllers/starfive,jh7110-dmc.yaml b/Documentation/devicetree/bindings/memory-controllers/starfive,jh7110-dmc.yaml
new file mode 100644
index 000000000000..299c86893db1
--- /dev/null
+++ b/Documentation/devicetree/bindings/memory-controllers/starfive,jh7110-dmc.yaml
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/memory-controllers/starfive,jh7110-dmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 DMC
+
+maintainers:
+ - E Shattow <e@xxxxxxxxxxxx>
+
+description:
+ JH7110 DMC as implemented by U-Boot boot loader driver starfive_ddr.c
+
+properties:
+ compatible:
+ items:
+ - const: starfive,jh7110-dmc
+
+ reg:
+ minItems: 2
+ maxItems: 2
+
+ clocks:
+ maxItems: 1
+
+ clock-names:
+ items:
+ - const: pll1_out
+
+ clock-frequency:
+ enum: [2133, 2800]
+ default: 2133
+
+ resets:
+ minItems: 3
+ maxItems: 3
+
+ reset-names:
+ items:
+ - const: axi
+ - const: osc
+ - const: apb
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - clock-frequency
+ - resets
+ - reset-names
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/starfive,jh7110-crg.h>
+ #include <dt-bindings/reset/starfive,jh7110-crg.h>
+ soc {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ memory-controller@15700000 {
+ compatible = "starfive,jh7110-dmc";
+ reg = <0x0 0x15700000 0x0 0x10000>,
+ <0x0 0x13000000 0x0 0x10000>;
+ clocks = <&syscrg JH7110_PLLCLK_PLL1_OUT>;
+ clock-names = "pll1_out";
+ clock-frequency = <2133>;
+ resets = <&syscrg JH7110_SYSRST_DDR_AXI>,
+ <&syscrg JH7110_SYSRST_DDR_OSC>,
+ <&syscrg JH7110_SYSRST_DDR_APB>;
+ reset-names = "axi", "osc", "apb";
+ };
+ };
--
2.49.0



Return-Path: <linux-kernel+bounces-675782-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A54F841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:11:15 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 1FFFF189B5C6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:11:29 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C844628935F;
Fri, 6 Jun 2025 13:10:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LtWe8aeq"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2B7120330;
Fri, 6 Jun 2025 13:10:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215441; cv=none; b=RmLQ+HYmWJZgbhqsw1u95ON7pF9EPpcEccnxHpoQO8usk0JcN1fwwUi7pD6UPVujh6q9/Z9ePvNyq8tmG6Pap0Vk0FQwKaNr8YJBbKjXXughGLlF3vPwG4VeGKEnWxkIyVfP9w/jIi40/MWRHkS2egI6vv6EiRC2CvP92ilnboA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215441; c=relaxed/simple;
bh=SVug/aqo8cSEHImdiHsS6qvrHQEZSQXQzALJ1QQBjc8=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=jBL4mr+C00GV8Uv1ozjoN2sUnpk+PITLQrYT86g/d2HCqqKBmqEz1M0P4MhlpvaHZ+rUYjp5oSwaCkL8Plv7pggBQYzBaMinEYb01f7Ex2Fxbd4wTOjgtIF+nnT6hGuuG5TZ1nEcI49RMOyT8dK+w2QAQTvebhWLr2dqLAJ56tM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LtWe8aeq; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70574C4CEEB;
Fri, 6 Jun 2025 13:10:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749215440;
bh=SVug/aqo8cSEHImdiHsS6qvrHQEZSQXQzALJ1QQBjc8=;
h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
b=LtWe8aeqA1NV6B9qkEA63h4NPUHc/zV0YEvSo3zEq/Dr4Lp5CMm3wtVao65ykvhbI
KCRr2PgypwdAv4ZovXTuAlvcr6yQQEPWmgo3gTEQjxxYNy7nKx+oAypzQmRW1g32PL
KKcQ5umixD5eRohYLr02361sDOhuF9zxNdpciY4F8dFkdSVG10DU1kJRIME9ZXs9Zq
k4UvkdIyRf8qZHPsXef8iSIzBcihT8Hs1ohUjEAQ5cJeRkyDhXpGWCeC6TTBDxL0L2
1FkfYxYDT7xYqvGvqC+33wuTf8ZfXXrqM00CH7fcj4UlNXPJRMDYViJahJhLc3EGwc
cMcLUgrmYxK/A==
Message-ID: <8ac3c2da-2824-44fe-942c-fceb8b6f5332@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:10:36 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v3 1/3] dt-bindings: eeprom: Add ST M24LR support
To: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx
Cc: arnd@xxxxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx, robh@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx
References: <20250606120631.3140054-1-abd.masalkhi@xxxxxxxxx>
<20250606120631.3140054-2-abd.masalkhi@xxxxxxxxx>
From: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=krzk@xxxxxxxxxx; keydata=
xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79
cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu
JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH
gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE
J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj
NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS
BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU
vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM
Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD
TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg
S296bG93c2tpIDxrcnprQGtlcm5lbC5vcmc+wsGVBBMBCgA/AhsDBgsJCAcDAgYVCAIJCgsE
FgIDAQIeAQIXgBYhBJvQfg4MUfjVlne3VBuTQ307QWKbBQJoF1BKBQkWlnSaAAoJEBuTQ307
QWKbHukP/3t4tRp/bvDnxJfmNdNVn0gv9ep3L39IntPalBFwRKytqeQkzAju0whYWg+R/rwp
+r2I1Fzwt7+PTjsnMFlh1AZxGDmP5MFkzVsMnfX1lGiXhYSOMP97XL6R1QSXxaWOpGNCDaUl
ajorB0lJDcC0q3xAdwzRConxYVhlgmTrRiD8oLlSCD5baEAt5Zw17UTNDnDGmZQKR0fqLpWy
786Lm5OScb7DjEgcA2PRm17st4UQ1kF0rQHokVaotxRM74PPDB8bCsunlghJl1DRK9s1aSuN
hL1Pv9VD8b4dFNvCo7b4hfAANPU67W40AaaGZ3UAfmw+1MYyo4QuAZGKzaP2ukbdCD/DYnqi
tJy88XqWtyb4UQWKNoQqGKzlYXdKsldYqrLHGoMvj1UN9XcRtXHST/IaLn72o7j7/h/Ac5EL
8lSUVIG4TYn59NyxxAXa07Wi6zjVL1U11fTnFmE29ALYQEXKBI3KUO1A3p4sQWzU7uRmbuxn
naUmm8RbpMcOfa9JjlXCLmQ5IP7Rr5tYZUCkZz08LIfF8UMXwH7OOEX87Y++EkAB+pzKZNNd
hwoXulTAgjSy+OiaLtuCys9VdXLZ3Zy314azaCU3BoWgaMV0eAW/+gprWMXQM1lrlzvwlD/k
whyy9wGf0AEPpLssLVt9VVxNjo6BIkt6d1pMg6mHsUEVzsFNBFVDXDQBEADNkrQYSREUL4D3
Gws46JEoZ9HEQOKtkrwjrzlw/tCmqVzERRPvz2Xg8n7+HRCrgqnodIYoUh5WsU84N03KlLue
MNsWLJBvBaubYN4JuJIdRr4dS4oyF1/fQAQPHh8Thpiz0SAZFx6iWKB7Qrz3OrGCjTPcW6ei
OMheesVS5hxietSmlin+SilmIAPZHx7n242u6kdHOh+/SyLImKn/dh9RzatVpUKbv34eP1wA
GldWsRxbf3WP9pFNObSzI/Bo3kA89Xx2rO2roC+Gq4LeHvo7ptzcLcrqaHUAcZ3CgFG88CnA
6z6lBZn0WyewEcPOPdcUB2Q7D/NiUY+HDiV99rAYPJztjeTrBSTnHeSBPb+qn5ZZGQwIdUW9
YegxWKvXXHTwB5eMzo/RB6vffwqcnHDoe0q7VgzRRZJwpi6aMIXLfeWZ5Wrwaw2zldFuO4Dt
91pFzBSOIpeMtfgb/Pfe/a1WJ/GgaIRIBE+NUqckM+3zJHGmVPqJP/h2Iwv6nw8U+7Yyl6gU
BLHFTg2hYnLFJI4Xjg+AX1hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/
JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu
4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB
YpsFAmgXUF8FCRaWWyoACgkQG5NDfTtBYptO0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v
qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5
RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg
Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2
H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB
dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT
AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu
jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2
zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw
XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A=
In-Reply-To: <20250606120631.3140054-2-abd.masalkhi@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 14:06, Abd-Alrhman Masalkhi wrote:
> Add support for STMicroelectronics M24LR RFID/NFC EEPROM chips.
> These devices use two I2C addresses: the primary address provides
> access to control and system parameter registers, while the
> secondary address is used for EEPROM access.
>
> Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
> ---
> Changes in v3:
> - Dropped reference to the i2c-mux binding.
> - Added reference to the nvmem binding to reflect EEPROM usage.
> - Updated 'reg' property to represent the device using two I2C addresses.
> - Fixed DT schema errors and yamllint warnings.
> - Removed the unused 'pagesize' property.
> ---
> .../devicetree/bindings/misc/st,m24lr.yaml | 54 +++++++++++++++++++


How did you implement this feedback:

"That's not a misc device, but eeprom. Place it in appropriate directory."
?

There is no such device as a misc device.

> 1 file changed, 54 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/misc/st,m24lr.yaml
>
> diff --git a/Documentation/devicetree/bindings/misc/st,m24lr.yaml b/Documentation/devicetree/bindings/misc/st,m24lr.yaml
> new file mode 100644
> index 000000000000..775d218381b7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/misc/st,m24lr.yaml
> @@ -0,0 +1,54 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/misc/st,m24lr.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: STMicroelectronics M24LR NFC/RFID EEPROM
> +
> +maintainers:
> + - Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
> +
> +description:
> + STMicroelectronics M24LR series are dual-interface (RF + I2C)
> + EEPROM chips. These devices support I2C-based access to both
> + memory and a system area that controls authentication and configuration.
> + They expose two I2C addresses, one for the system parameter sector and
> + one for the EEPROM.
> +
> +allOf:
> + - $ref: /schemas/nvmem/nvmem.yaml#
> +
> +properties:
> + compatible:
> + enum:
> + - st,m24lr04e-r
> + - st,m24lr16e-r
> + - st,m24lr64e-r
> +
> + reg:
> + description:
> + Two I2C address, the primary for control registers, the secondary
> + for EEPROM access.
> + minItems: 2
> + maxItems: 2

Replace this all with items and description:
items:
- description: foo
- description: bar


> +
> +required:
> + - compatible
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + eeprom@57 {
> + compatible = "st,m24lr04e-r";
> + reg = <0x57>, /* primary-device */
> + <0x53>; /* secondary-device */

Where is the rest of at24 properties? Not relevant? Not correct? I had
impression this is fully at24 compatible.


Best regards,
Krzysztof


Return-Path: <linux-kernel+bounces-675783-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 76BF741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:11:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 64E883A9DFE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:11:37 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E9FF288C3E;
Fri, 6 Jun 2025 13:11:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="icz4gBox"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE16D1E4B2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:11:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215511; cv=none; b=HiOM8L16ab4FCezz7lVF1QpVqQCXvWsRmB2fOtE/AlqnWy0hx7XwCBpgKoD35BhXDy5JxpX+tPZFxFxOCEVXkSapgN5iAuljaCoAs9EhddM12PKG4WCvnOfFpuX5f+wxf/4Pkruv8zGaxO1Nfvhytto7D+2WWQ/CVUFjgENlB+M=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215511; c=relaxed/simple;
bh=0GVuQojpk9Mb3dzd1WX8x8g8rwjrX/NeL70/4vMlg64=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=qyStjt1Em+4reCo01m925Tqpv0h1Vl3Ffmb+M4tfc+dTLbjnmCQs3JUryj9721FGl0u5V21yTaoBxhSwa2NWaFK2G8h94A8m7RHaTYrwW1TRdYDlpwTZYqOB/JiH+c3b+V2Kpdj8tP30qzdkGK7ngxs9qi4zwVhr+js3BrrYw0Y=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=icz4gBox; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37144C4CEF1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:11:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749215511;
bh=0GVuQojpk9Mb3dzd1WX8x8g8rwjrX/NeL70/4vMlg64=;
h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
b=icz4gBoxMsfNuz9Xc4Rut4lRvznU2kQuuPD5pvQYBOskeuPuG6LVLIvfql1bKvUUl
YKXSUB9vTyBbRNmARiri8sDFUEk4EmvLaJAqnHeA2VxSrkemD0PZfeN0LMVD7L3dJn
JG7g25RYaFPXDkcI4LAVMJYvZIfl3lHngZVXqKMK7AWE8UNA2RV0Ea2Upq2R9d6s6S
L3icPIHSV2mims1BQU6kGxlcpFKpnTCfgL0rdjCyQ+LTk0/C5QYCvoKdtR/4vFbgV/
ZcuEHrJJK5OjgfxJBZR+zPEZMf7N0M3aCXdrpXdnga8RDoV6U/ORR4/W0Oq9gWja2J
Sobfj5vzHsxFA==
Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-60768f080d8so1779214a12.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:11:51 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCVnAFBTHqXzi8N+5e/lF4Y1mRlvSZXKdVVDDjBK+kfZg0+b0Y8/soP5kBTH9LFUptREx2a4UMEqwQu0kOs=@vger.kernel.org
X-Gm-Message-State: AOJu0YxXELMcxMyirHlDZ/lFtw9fq3H/fFkQtt7durVV7ElypM+5ixZb
Pl1BGqUQwAMkWyPddS6PNDq1iFF9yUuKocXbJqsK08OEnx1LE1rZwHq68l4LOFUvo8TM06DaHCz
lEHEFf+eFSHM7WbeNGue5rSIqJ63cY9c=
X-Google-Smtp-Source: AGHT+IGkonwhwsMSN2QFCrW9x7bFLMapaDsabxXJgcN7/UazSOBNAAEU4ymwq4ziVNQTZCJ09V22Zkxx/KY4GB20gRc=
X-Received: by 2002:a05:6402:2807:b0:602:2e21:631f with SMTP id
4fb4d7f45d1cf-6077479a7b0mr2927047a12.24.1749215509801; Fri, 06 Jun 2025
06:11:49 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250605054828.15093-1-ziyao@xxxxxxxxxxx>
In-Reply-To: <20250605054828.15093-1-ziyao@xxxxxxxxxxx>
From: Huacai Chen <chenhuacai@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 21:11:39 +0800
X-Gmail-Original-Message-ID: <CAAhV-H58JGB0QoVBC_LE4Mo5gGdZ=-NcH8FtZupK9hxGFdfvMQ@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFs_Wi3GPn_-VTaU2yt159R1v2DT0MEdn5mw4mPvCP_UNtgOrgvMGLkiBBo
Message-ID: <CAAhV-H58JGB0QoVBC_LE4Mo5gGdZ=-NcH8FtZupK9hxGFdfvMQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v2 0/2] Backlight control improvements for loongson_laptop
To: Yao Zi <ziyao@xxxxxxxxxxx>
Cc: Jianmin Lv <lvjianmin@xxxxxxxxxxx>, WANG Xuerui <kernel@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, loongarch@xxxxxxxxxxxxxxx,
Mingcong Bai <jeffbai@xxxxxxx>, Kexy Biscuit <kexybiscuit@xxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Applied, thanks.

Huacai

On Thu, Jun 5, 2025 at 1:48=E2=80=AFPM Yao Zi <ziyao@xxxxxxxxxxx> wrote:
>
> I've observed strange screen brightness changes on TongFang L860-T2
> 3A5000 laptop after resumption. It's found that a brightness value that
> doesn't match the hardware state before suspension is "restored" for the
> EC, causing the strange behavior.
>
> This series fixes the behavior by obtaining EC's brightness setting
> instead of using a constant as current brightness on probe.
>
> While digging through the code, I've found some unused,
> power-control-related functions in the driver. They're cleaned up and
> used to support power control of backlight in the second patch as well.
>
> Changed from v1:
> - Reword commit message of PATCH 1
> - PATCH 2
> - Always issue a power-on command on probe to ensure the backlight has
> been powered, matching our expectation
> - Cache backlight state in the driver to reduce interaction with EC
> - Link to v1: https://lore.kernel.org/loongarch/20250531113851.21426-1-zi=
yao@xxxxxxxxxxx/
>
> Yao Zi (2):
> platform/loongarch: laptop: Get brightness setting from EC on probe
> platform/loongarch: laptop: Support backlight power control
>
> drivers/platform/loongarch/loongson-laptop.c | 78 ++++++++++----------
> 1 file changed, 39 insertions(+), 39 deletions(-)
>
> --
> 2.49.0
>


Return-Path: <linux-kernel+bounces-675784-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 499A741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:12:13 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 881481716FC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:12:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B8F8A288C8A;
Fri, 6 Jun 2025 13:12:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cfhTfHcc"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF2EC20330;
Fri, 6 Jun 2025 13:12:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215528; cv=none; b=IrEtsJCvJsUCE+37AGmdYeByXHGLs3aF+PVi5JEwd1gs5YErcOcthuoe+rsGhFsS42JE8V+HDhy0TACkev47yU0PCVthngDUIbSuCrTmLvoyTzrzeBTyGOuKDN9vr5V0tcC+P1MHBbW7+LHkwtmt+072Ser60HdHXOwWDjWHan4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215528; c=relaxed/simple;
bh=rGZRqJph/AYEM9AzQLAgB41QMOJBZx9aYxw1lu4xNAE=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=elIe0JzzHeuz4cJLz0Xeh3IzcUtvt3NTr1HrWjcQ/WYrNqM1ttnz81Swhi1OOUm1epN5fwSoTX9A1w0Qb3UczXJKY8fnyuvBN2ngzq/QZj9uWGXRhAZaMvVp2G4PYxDLUT/S8b9GH8diBwTeUfcmpz66jWYQe4J9TNSLmlhSE+w=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cfhTfHcc; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95875C4AF0C;
Fri, 6 Jun 2025 13:12:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749215527;
bh=rGZRqJph/AYEM9AzQLAgB41QMOJBZx9aYxw1lu4xNAE=;
h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
b=cfhTfHcctqgAwVeOqIbGC/R/W/7BnjHIglya57cJl2vhkPKiPzj/EFm8DZt678gm8
7TQhclnrpXmWkM9DR7ahAcoxB1TteyGiT3dObYylKMZsLpOd54fMFeiTEvPvcoFfCJ
LleorvyPfpPt/wonuhD7+A2hz4+7qZzkc/p7Qe0Sp9FWLRDxtBk+ZlISxE2TrOHBQj
HfYcdCXSJEjLHWOrvlJjZPm+pHN7RFb6o8onIcjckbpX4aTes012TmjKAJuUDYBvje
51FQZz6Uax8RqzgGVLjQnUKHpwApXXrZEbvoKVwhzJgR1UgJaddxjvKMDNyXQfvBH6
puwgeeBmQ4tvQ==
Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-ade326e366dso38909466b.3;
Fri, 06 Jun 2025 06:12:07 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCVFEcs3OekLEsXKqSTgS0NDtAsoWkQj232ZO6KQb5RMxtwihrz4bemB/MEaEJN8SX9kaFgX7hYWsZPXLZk=@vger.kernel.org, AJvYcCXUvow9hxW/QSdAWZvj55hLnQ1z4xrWdHVNf7PCL/hWyqISKS9qTZPXMvJJXdzMoCi3iaKfx6r1@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yyi17A0m6MHCN53rsMRs18e7fRU9/cokcAEEhkmrMzVrSYu7A3C
/pwii9R97OPNQcy26gaKPnaDg8zVaMrEA9SYffaen8njnqgkH5dDMJUR5qWxquOCfgpvZnjA3yg
r+LeFByE1mi0Hpde/Hh/0wLWbDyFXmUU=
X-Google-Smtp-Source: AGHT+IE3pzzutoVEt+xG7WoH2SCggVL9nueRxZ/i2LyieJigkTr1b5rrWQyRf4BgAOIe/icLjS3SlRApkbSvZUQGZz0=
X-Received: by 2002:a17:907:7f9f:b0:ad8:99cc:774c with SMTP id
a640c23a62f3a-ade1aa4743fmr302174766b.58.1749215526167; Fri, 06 Jun 2025
06:12:06 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250605055546.15264-1-ziyao@xxxxxxxxxxx>
In-Reply-To: <20250605055546.15264-1-ziyao@xxxxxxxxxxx>
From: Huacai Chen <chenhuacai@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 21:11:55 +0800
X-Gmail-Original-Message-ID: <CAAhV-H5B22f3bJ38F16vs208pZA80oQBrqrhaGTQqeU7xkrXNA@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFuSfHSPLUWXT3X6Z-gVUN1k3vC627BbcSHCLmYtH_uyRJoe269rQgrWQqQ
Message-ID: <CAAhV-H5B22f3bJ38F16vs208pZA80oQBrqrhaGTQqeU7xkrXNA@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] platform/loongarch: laptop: Unregister
generic_sub_drivers on exit
To: Yao Zi <ziyao@xxxxxxxxxxx>
Cc: Jianmin Lv <lvjianmin@xxxxxxxxxxx>, WANG Xuerui <kernel@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, loongarch@xxxxxxxxxxxxxxx,
Mingcong Bai <jeffbai@xxxxxxx>, Kexy Biscuit <kexybiscuit@xxxxxxx>, stable@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Applied, thanks.

Huacai

On Thu, Jun 5, 2025 at 1:56=E2=80=AFPM Yao Zi <ziyao@xxxxxxxxxxx> wrote:
>
> Without correct unregisteration, ACPI notify handlers and the platform
> driver installed by generic_subdriver_init will become dangling
> references after removing loongson_laptop module, triggering various
> kernel faults when a hotkey is sent or at kernel shutdown.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 6246ed09111f ("LoongArch: Add ACPI-based generic laptop driver")
> Signed-off-by: Yao Zi <ziyao@xxxxxxxxxxx>
> ---
> drivers/platform/loongarch/loongson-laptop.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/loongarch/loongson-laptop.c b/drivers/platf=
orm/loongarch/loongson-laptop.c
> index 99203584949d..cfe2cf79dbbe 100644
> --- a/drivers/platform/loongarch/loongson-laptop.c
> +++ b/drivers/platform/loongarch/loongson-laptop.c
> @@ -611,11 +611,17 @@ static int __init generic_acpi_laptop_init(void)
>
> static void __exit generic_acpi_laptop_exit(void)
> {
> + int i;
> +
> if (generic_inputdev) {
> - if (input_device_registered)
> + if (input_device_registered) {
> input_unregister_device(generic_inputdev);
> - else
> +
> + for (i =3D 0; i < ARRAY_SIZE(generic_sub_drivers)=
; i++)
> + generic_subdriver_exit(&generic_sub_drive=
rs[i]);
> + } else {
> input_free_device(generic_inputdev);
> + }
> }
> }
>
> --
> 2.49.0
>


Return-Path: <linux-kernel+bounces-675785-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C2EC541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:12:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 478437A7569
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:11:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 40752288C96;
Fri, 6 Jun 2025 13:12:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PFtvROfn"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 666E3288C3D;
Fri, 6 Jun 2025 13:12:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215553; cv=none; b=FoWSRCbUOIn94Ef+Dx95epRRFo5KRfPaNYEenRFJHF/pRU0t97HoqBxoegv2OQm1nMayhBXAY3ufRYBkuVmCPUrsqtH2PWUJXgEZNRWntAhyzxnFKtytiwq5ImO313Bn4s+RPgVna5cjOnaFg81Q/35Hm6TcaZq7p/EvOfENm04=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215553; c=relaxed/simple;
bh=iBdr1CS6YlWDK+sb2MOzhqb9yTlPeul/8XqyzdJDR54=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=KqV1ocIeHGxUNjt8uwSQTBDQbYMZEf1yDwNEc+OgNWsfNMG0q/bE+yDHPHwmdc31GJaBnewuxHDPdZ+MgMs3a1vPKFZDWsc2xftD+/F97jO1iGIUAmEFTwPqdpQ5sogeDizJnWqtPyB3/mmenJ/D1bKFPA5ItisODpOmzfIAW08=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PFtvROfn; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47F9AC4CEEB;
Fri, 6 Jun 2025 13:12:29 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749215551;
bh=iBdr1CS6YlWDK+sb2MOzhqb9yTlPeul/8XqyzdJDR54=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=PFtvROfnor7bJSbNy7B6qOPNLgMJ53kWkzw2rtijpZQzhLKtAdeuf9SGyO0HWo5Ee
j1Moji54b1Q06HKRkJwgpTr54o5W4BrFBZZ4ad7L7aOGeMKm0CfAoU57tKbIfmSsoI
bO9HuvaWmVwtjoLIUNRkW4jCufUkrgRnlTD/raSxH9vv+u9tzYr+LGLkzWvVgIwaEb
ShyRg9+L4roANY1+u3OSmVC+riz0Nl9st8TUYG4wvrSws/cuhUVKPbfLLOcZWTHmkr
qk7rYNpZZnh920jFTxknLAE6V+JCmTZf885dSDCzfD8bMX9yerwhUkZ6pu5v4iHIWQ
KxODHBa0cwE9A==
Date: Fri, 6 Jun 2025 14:12:27 +0100
From: Simon Horman <horms@xxxxxxxxxx>
To: "Xandy.Xiong" <xiongliang@xxxxxxxxxx>
Cc: Andrew Lunn <andrew+netdev@xxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>,
Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>,
Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>,
"Russell King (Oracle)" <rmk+kernel@xxxxxxxxxxxxxxx>,
Furong Xu <0x1207@xxxxxxxxx>, netdev@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] net: stmmac: add support for platform specific config.
Message-ID: <20250606131227.GF120308@xxxxxxxxxxxxxxxx>
References: <20250606114155.3517-1-xiongliang@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606114155.3517-1-xiongliang@xxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 07:41:55PM +0800, Xandy.Xiong wrote:
> This patch adds support for platform-specific init config in the
> stmmac driver. As SMMU remap, must after dma descriptor setup,
> and same mac link caps must init before phy init. To support these feature,
> a new function pointer 'fix_mac_config' is added to the
> plat_stmmacenet_data structure.
> And call the function pointer 'fix_mac_config' in the __stmmac_open().
>
> Signed-off-by: Xandy.Xiong <xiongliang@xxxxxxxxxx>

Hi,

I think that there needs to be an in-tree user of this callback
for it to be added. And that such a user should be included
in the same patch-set that adds the callback.

Moreover...

## Form letter - net-next-closed

The merge window for v6.16 has begun and therefore net-next is closed
for new drivers, features, code refactoring and optimizations. We are
currently accepting bug fixes only.

Please repost when net-next reopens after June 8th.

RFC patches sent for review only are obviously welcome at any time.

--
pw-bot: changes-requested


Return-Path: <linux-kernel+bounces-675786-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5B49D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:14:15 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 5B7F2188E320
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:14:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 01177288CA7;
Fri, 6 Jun 2025 13:13:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=web.de header.i=spasswolf@xxxxxx header.b="egF/NlpP"
Received: from mout.web.de (mout.web.de [212.227.15.3])
(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 BF4DA20330;
Fri, 6 Jun 2025 13:13:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.3
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215616; cv=none; b=NNmWkXt7v/9Mvd6T8iWHSSUVXDqKJMyh8Ic04ep+3QF2y4WZq7PtWPmTZ1Ku1J2X34cq2QG06Nkud0UAQsNcie9CoopibSiMfK5aTFwBXdcjGMF2ejKVcn3e/ddOc0R6XjXW95zMlDqKVwAqIMLUEos+6fqKO6xoaSRbJzFiC3o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215616; c=relaxed/simple;
bh=j9EZE4q62ThuV+2Zjfct90iVgC2ZOI9xeRJnbY5SyJw=;
h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:MIME-Version; b=az/RTgSBZU33hzbq6A4M/CeBh6Kw/eNDrx+yS2oyYFxxlcTPPP4Myl4fGfWXKVl2RStVsNRX/VkTVefTSFd9EduFragaiar63fSMZLZlr63b+aB2gAZt3q3sHe6aoyiYxbA0RD9ufz7mmrAAjV/Ptwd24o3I7VTvk7BLdQuQryk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=spasswolf@xxxxxx header.b=egF/NlpP; arc=none smtp.client-ip=212.227.15.3
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
s=s29768273; t=1749215588; x=1749820388; i=spasswolf@xxxxxx;
bh=Ci2Fs3IVjrOw8jayotgpd7SLmlfduGsH2A1mfElURos=;
h=X-UI-Sender-Class:Message-ID:Subject:From:To:Cc:Date:In-Reply-To:
References:Content-Type:MIME-Version:Content-Transfer-Encoding:cc:
content-transfer-encoding:content-type:date:from:message-id:
mime-version:reply-to:subject:to;
b=egF/NlpP+TElqXVs2mcG+eaItU2by5xIeuqRUmkCZKLo7f35Ukts3s2rynZaTAJk
0RUD14ZtXWFsGi/q5VB5Y+ozjbbJIN5e0tcPPJbKjXg9evKH0DhJ3vQ35Vq/fsh95
2jyIPXI5dZ7/Xr0R4VoAYrOjM+7rI2QG00YjJNODPc9pko5yG8EvHe6dl5F+jueLa
5FDmgHjoOgnDBbOgaTWU45HBNJmQnsa166cfSfy43hw6VDotSlQKY7ilx53l+YWsw
pQ2ewRtR9p/lpLCaougCTy5jMAoAOhC45L6ZSINA41KCBDFBfU8Rd1H64648rirGx
eWmNi19oS0Q1L1TzOg==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from [192.168.0.101] ([95.223.134.88]) by smtp.web.de (mrweb005
[213.165.67.108]) with ESMTPSA (Nemesis) id 1MCXZf-1uW1K42g6N-00HKnx; Fri, 06
Jun 2025 15:13:07 +0200
Message-ID: <b86bd98b23d1299981c4e95b593eb5a144fbf822.camel@xxxxxx>
Subject: Re: BUG: scheduling while atomic with PREEMPT_RT=y and bpf selftests
From: Bert Karwatzki <spasswolf@xxxxxx>
To: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, linux-next@xxxxxxxxxxxxxxx,
bpf@xxxxxxxxxxxxxxx, linux-rt-users@xxxxxxxxxxxxxxx,
linux-rt-devel@xxxxxxxxxxxxxxx, Thomas Gleixner <tglx@xxxxxxxxxxxxx>,
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>, spasswolf@xxxxxx
Date: Fri, 06 Jun 2025 15:13:05 +0200
In-Reply-To: <20250605084816.3e5d1af1@xxxxxxxxxxxxxxxxxx>
References: <20250605091904.5853-1-spasswolf@xxxxxx>
<20250605084816.3e5d1af1@xxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.56.1-1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:EUfzu2r5Y+S6E6zcWCk+pUUGDD4dSlli2Qs7FhrVxk7lXtsBA1/
91m2kpTjo2XQTfbdHTSuVobgtf0CsoG9Y7+hDzXN8XdiCWggM9JTL38j6cA+vPng7rlHSmf
k6oNjdeh5IuWeJHLz0dM6gVJue7QHdatTgNQ6ebnqdFGM6xFaMqCIdAPQX2lv2MyxD+wlTt
uJbPtvdTMMryI44Hl7rkw==
UI-OutboundReport: notjunk:1;M01:P0:ibbMtDxjIug=;XuACQFZ/BJa1YM82rdBjToQk8cB
phdsFoNcJpzm3OklqiBbzfkdspvWB68sMB4znpD/Ec14y664bVcdZ67RcjTLi3T6iQ1EVlTgw
0uDta7kdaCGsLlHGBA/Fn80m5Of7OQIwuHVEcJqWrDqUorHtIDrBaldrROD9m1wVjrR0Fp1G2
ztvwpuxYdCWuuxtEXCOLwCi292L/x7C9/Vcbb16hZGdwL3Cv/IwGP8XfmrVxumJDrt+4gatvx
kFR4ahXboicsoITloCPAaVIcg6tZl3gmDkhwVFbAGVSqDtUHG5foxlOt6mYDKib3t4IL+NW6Z
81/ILQHv7yMYr5nqVuQyOYozIsoQL7l7hXS+nM9JYYh25/6gfOnrzZiAHWtrTsj5rpLHLDbMN
9icgtq3G+L15xfUlzmrer/0wkZI5aJ8NZdlOhJl4kFSLXB0vtwvmkBoQp9oZBV+5eV+WX+XmO
d6gRZpDXxcmAoBX5UVwsvH3S0YFcr7GtKewqhd0K0TGmJuJ+hKsfWAcxj8TeXW/Zlijk5OZn1
lHwGqdsdy+VNbBwPhgZnkeQ8jkGF1MgFbxVPSrX9jswglFuYJ5BJbqks2PxCpJ4BHcXoe4Fv2
ILznH8inmDmrAR/S108jNj49UUb7+i1HCSpnCy6X/a6A4eCY1KkVuPjyWLwgllzF3oa+dijxx
hVoAcEeYrZ25MrlVxG/WG8yyYK+9IMYE3/j5g5YI/3kwKaRVVTjl43rOWzmXOc0+HU7QKfgqv
IyGr4YKTc/eVKZxxa4b/IhBHjZTR5DG6pdfCU0FbuzKs1x5CWLVPJVqX/9NapsPpM9s2jSLz/
wkMui9BOK7eT4YCb47pkNfeKQQUNgw8ewL+OHLy3Ieec+06sSJTpCXCLhSAlY9Ovo/rDiiVsC
BuM05LO4pyHmpEBZ1MaV4hbRsk0ClxOU1NC4mwZlPgZXV0w2NMzoxJdbQGLu/L7Gf0Thmg5CR
TSAnzBTDM/kEx6EKhKNypgOc0GP1Cz5q6bsDe8n50p7UNYo2/As3DgM75cPO8aHO3JSbFWhLh
41lEiHenyNuaP2VJroIN71AK+K4F8PHoVXYOUF5scI5QeG1JnZxM3URXlCH+EGr5bs0WhaCJQ
+dXikHFfhwPeeHVJgbmp4KANE+Hze500gaesMz++gWXx3ymo7VOSZAh6KmOOJV47aWlf19eXg
QDUnxAr7CT5Un8LYVQf6FJwWjhf3UR6Pi/6hfeNCvNggY+TFMaJjmle2qg5e1SoiqiC2b7Bqz
W5U8TS6DlPRCcA1aKF/js5X9NTGi/mWKrcT/wbdf5yXZDVBTzWBKLjrf9S+KiUCIu5vtYK5tz
m26SgQ97opABoTZusjaZtn3d2V5eak9h0KOxRCCs8aG4Tnne8OWkolgPXEaWrlhsDJi2Kend0
8B3YkHz0BLAz59qFmwEMku/5fiToaeCqm/TehVOTuktuXwZK3HTGZfZSOD7xsAvKrRHrFR9P8
w9+kOIkwOvdtnyQu2xo3rhopI7q6XrAbEni3FjeomqBN3s7m8SZRT5EbXnHJQytRjZn3l27Xc
KDcgbG22zc3BOuMt2gzngz6/PZyqafm410HD7dvZhGkujQvi+4yKuNxTRAbNqGgIxZ8hIw2Ot
rRei2a8cH2TWc8+Irh+jHWxdky5/e6rdpL2MBO2QRMlXPNZdUURHuQjPnQ1kUK+zgtMw0H1Gr
/o+EsuvQwB9UDYZVOglOjDXHmCptd6Zq6VK9PdKlwIe+iCLomYZaN7fyP8iGRz5zlhaGesJub
Op2nHeVAfdj7RiVyMmFKbIUQWWAjvI88/LdEUI9gfNUmLIUrjHVv4DQ468TVldad9L/OsGkCM
EKbGx4nkNRc6wIQQCj3R0GctQAvvnjEu2ZxTxo++AH4pwFo+R+D1IUte+eBmvSjA4ohLNy72X
EMP85MdBBFC201muzSqGI10gGNkEuou1PXK7jKXQZFDNiXWsXNjli1ECtAICfiRGQNuPTMtuO
A4ES1N3HGQZO5/xp3VNWvG9hYYPNrJYwwR66XtVFEup7eg7yGFq763pkMzGGnkghBAmZevLnM
2iH/YpVn5vQ99WRbUAnhIchNbGaVIjVrFGnXebjRKx85pyNdObFkV4JpRKlMTxB/JxvwUTG5F
+L1+9tfSqZ48asp/IMtOMTevvuVrZtUED7NOxe67x36nqW8EJWYU+cQs6nCETasCVDz/gbrqO
NhXj4/nkYjuKAVasW8oFWM5Ltnbg+43gtZGyV71AxNcdlvVoBhWBwy38rFjhIcXJF5kp1aoTJ
Ck4cMN3xSFbseTDUBfGOpN3PWd2jdF5HooI8BINfVi4jva+RRNpk+g62TgWHhKSznWrS0QPLR
VxghK1jRt7sxdAQmEmA2mRnFy3kHEi2YHqqWsVRgp0/8nWv2K76kiW/0b81k/TJgrMrd2hnlg
BujUcbMT1Fs8DOsPu1URFzHo5LU5H51S9MJBNJu8pnwkZNRErdonX9ZFvb6+i4zDqszb1fJ9K
5kGOUL/juVS05jtbO7OmWXZhzJsHWNvgR7QzwvXDgh0mgmhc22bTbSHL4/vW52HmswRGWHsI2
ph3TkZ/Lj6GKu6Xs3Hz4aHlZYOV403Oe4c4rY0Q2RiM3VFcPDVjChctOTEkq/DCF1TuOjOj7M
3m/fgyzpN/JQMcv3YNo++SIDrU36YzzEnJjiXS8WlhqVIS7dFrd95/9VMX2DHTBTOW/6sfDjj
Pp/emz2fH82JluDM69Oy//8PTYb0gshlGMykseVs2U9uz1vYD0Lja8H3mDNkFEfn8u1l/JvV8
BSLXh1TxZaxzH9LkFYRpjU4WxrXWS1r/jouSZ7L4eqPl5h7w26gzqOZdNddQKGcPRKBeDGxJ3
DTxgY1UyxvOLrWoE8ICep17yZs4/2DOWl4qqN0FMSbkzKXx5sKnRLfKXEdSdmV9H0qbbmBmkB
a3Wyij5U9cW4SaZqBSHRrS9cj4OieJAh8rhaEjeOZnyHFNyubc0fWNuLfCKSenMcq6MAEydF2
TinUG1gMquQqnZakbtrbI930WAX4bmEMe2xgx/jbCiQX7z1DhNo439CwSKfWTKdO11aF8+mnZ
kPmmsW061+X/4dImiTFx8/IN86ZtVkpk2azf8QB6RzPrnyx+Hbf0cvsaqqcm2O2KSdzTB9s4O
Xwf3ApqhUKZtokJePKlW+HT8cPMmXi5MPth766KaZ9KBQzaZol1YB0FF/67lNcMn7mJ96Zjsj
q/Emdc3fid11d9poW18WVv6ASr5oFunRxEGDV5ALIUAUyPQ==
X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED,
FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Am Donnerstag, dem 05.06.2025 um 08:48 -0400 schrieb Steven Rostedt:
> On Thu, 5 Jun 2025 11:19:03 +0200
> Bert Karwatzki <spasswolf@xxxxxx> wrote:
>=20
> > This patch seems to create so much output that the orginal error messa=
ge and
> > backtrace often get lost, so I needed several runs to get a meaningful=
message
> > when running
>=20
> Are you familiar with preempt count tracing?

Thanks for pointing me to this, I only very briefly tried out the function=
tracer
judging by an old file I found on 22.01.2022:

-rw-r--r-- 1 root root 75529450 22. Jan 2022 trace.log

>=20
> ~# trace-cmd start -e preempt_enable -e preempt_disable
> ~# trace-cmd show
> # tracer: nop
> #
> # entries-in-buffer/entries-written: 177552/177552 #P:8
> #
> # _-----=3D> irqs-off/BH-disabled
> # / _----=3D> need-resched
> # | / _---=3D> hardirq/softirq
> # || / _--=3D> preempt-depth
> # ||| / _-=3D> migrate-disable
> # |||| / delay
> # TASK-PID CPU# ||||| TIMESTAMP FUNCTION
> # | | | ||||| | |
> trace-cmd-1131 [001] ...1. 965.046684: preempt_disable: call=
er=3Dvfs_write+0x89c/0xe90 parent=3Dvfs_write+0x89c/0xe90
> trace-cmd-1131 [001] ...1. 965.046695: preempt_enable: calle=
r=3Dvfs_write+0x923/0xe90 parent=3Dvfs_write+0x923/0xe90
> trace-cmd-1131 [001] ...1. 965.046729: preempt_disable: call=
er=3D_raw_spin_lock+0x17/0x40 parent=3D0x0
> trace-cmd-1131 [001] ...1. 965.046746: preempt_enable: calle=
r=3D_raw_spin_unlock+0x2d/0x50 parent=3D0x0
> trace-cmd-1131 [001] ...1. 965.046749: preempt_disable: call=
er=3Dcount_memcg_events+0x74/0x480 parent=3Dcount_memcg_events+0x74/0x480
> trace-cmd-1131 [001] ...1. 965.046751: preempt_enable: calle=
r=3Dcount_memcg_events+0x2b4/0x480 parent=3Dcount_memcg_events+0x2b4/0x480
> trace-cmd-1131 [001] ...1. 965.046765: preempt_disable: call=
er=3D_raw_spin_lock+0x17/0x40 parent=3D0x0
> trace-cmd-1131 [001] ...1. 965.046769: preempt_enable: calle=
r=3D_raw_spin_unlock+0x2d/0x50 parent=3D0x0
> trace-cmd-1131 [001] ...1. 965.046771: preempt_disable: call=
er=3Dcount_memcg_events+0x74/0x480 parent=3Dcount_memcg_events+0x74/0x480
> trace-cmd-1131 [001] ...1. 965.046773: preempt_enable: calle=
r=3Dcount_memcg_events+0x2b4/0x480 parent=3Dcount_memcg_events+0x2b4/0x480
> trace-cmd-1131 [001] ...1. 965.046787: preempt_disable: call=
er=3D_raw_spin_lock+0x17/0x40 parent=3D0x0
> trace-cmd-1131 [001] ...1. 965.046801: preempt_enable: calle=
r=3D_raw_spin_unlock+0x2d/0x50 parent=3D0x0
> trace-cmd-1131 [001] ...1. 965.046803: preempt_disable: call=
er=3Dcount_memcg_events+0x74/0x480 parent=3Dcount_memcg_events+0x74/0x480
> trace-cmd-1131 [001] ...1. 965.046805: preempt_enable: calle=
r=3Dcount_memcg_events+0x2b4/0x480 parent=3Dcount_memcg_events+0x2b4/0x480
> trace-cmd-1131 [001] d..1. 965.046812: preempt_disable: call=
er=3D_raw_spin_lock_irq+0x2b/0x60 parent=3D0x0
> trace-cmd-1131 [001] ...1. 965.046815: preempt_enable: calle=
r=3D_raw_spin_unlock_irq+0x38/0x60 parent=3D0x0
> [..]
>=20
> It's very light weight. There's also trace_printk() that is also very li=
ght
> weight to use.

> It's enabled when you enable CONFIG_PREEMPT_TRACER.
>=20
> -- Steve

I tried this and first thought my kernel did not have the right configurat=
ion as

# trace-cmd record -e preempt_disable -e preempt_enable

seemed to do nothing in particular, but it turns out it takes a long time =
to start
(~1min) when the kernel is compiled with CONFIG_LOCKDEP=3Dy. (on the stand=
ard debian
kernel starting to record takes less time, but it does not have CONFIG_PRE=
EMPT_TRACER.)

So after the trace-cmd was running I ran the bpf example and got a trace.d=
at:

# ls -lh trace.dat=20
-rw-r--r-- 1 root root 152M 6. Jun 14:41 trace.dat

turning this into a report with

# trace-cmd report > preemp_trace.rep

gives a rather unwieldly large file

# ls -lh preempt_trace.rep=20
-rw-rw-r-- 1 root root 7,4G 6. Jun 14:46 preempt_trace.rep

This file has about 61 million lines

# wc -l preempt_trace.rep
61627360 preempt_trace.rep

but only 742104 corresponding to the bpf example program "test_progs"

# grep test_progs preempt_trace.rep | wc -l
742104

Is it possible to filter the preempt_{en,dis}able events by task name (i.e=
.
get_current()->comm)?

I tried this (from=C2=A0https://code.tools/man/1/trace-cmd-report/) but it
fails with an error message:
# trace-cmd record -e preempt_enable -F '.*:COMM =3D=3D "test_progs"' -e p=
reempt_disable -F '.*:COMM =3D=3D "test_progs"'

********************
Unable to exec .*:COMM =3D=3D "test_progs"
********************
trace-cmd: No such file or directory
Failed to exec .*:COMM =3D=3D "test_progs"
libtracecmd: No such file or directory
can not stat 'trace.dat.cpu0'


Bert Karwatzki


Return-Path: <linux-kernel+bounces-675788-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D7F2241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:14:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 14FC87A586E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:13:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 27E71288C97;
Fri, 6 Jun 2025 13:14:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oWPYnJJw"
Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195])
(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 14C782874F2;
Fri, 6 Jun 2025 13:14:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215671; cv=none; b=lGARRwCwNN/DPPNxDbn8bp9G+IBC2HxxohsAlmq+OHlBD4PtHqw179WmUOVXMi3+stRVRhCSemo8Fi1lQeduuZJUgDjzkB5WCE+B7QkNnIXTDKYhw6Wgo4LAk9GQPswN4qLwz/kVHwQG45QTj7RrtGhMdKm2lqK3P397r2q8ZH8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215671; c=relaxed/simple;
bh=3NJ+PTFh2Yn3x9J4tEZnxKh27qQe+KeBRZhOB8aY1vI=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=rf9WIh/GWZGPrzlrcjahucfDZhN6AnJMSKnNjd0kGqj8c5wTVWQovT5yQrznFVHIsZafdMpcwdtcCnPgOZUoLiHP2afiX2RcmsDo7Wmj4RXxEOD7JzFz+CyII5ji5J8f4LUBUhv+1CSxroe0GKSg26mPf0yXzM+BPbjhOygpc6E=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oWPYnJJw; arc=none smtp.client-ip=148.251.105.195
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com;
s=mail; t=1749215667;
bh=3NJ+PTFh2Yn3x9J4tEZnxKh27qQe+KeBRZhOB8aY1vI=;
h=From:Date:Subject:To:Cc:From;
b=oWPYnJJwa0UyYbR7t6WBXfzzghJ5KN4dDQf0bO7BmlrLmDt14Q5dxUpKutfdfFb6I
epijd68Du6aRYLqhaEL7IeBds/ozteeemEYTiMdeBjmbf7MQGOhZbO6qUQSmqi45UD
gEGQ4rIAtKQAjWfQ+wI2HYB+nDsqn+EFnD93PWfKbdyzDmq1nPc5nh6T54f8xIP41T
3i7+fdDXDMNlYNQfAOnvlma0hjWawzUf+y0NrPYs+MZjQUhkQEuxXOFTwavaiBdvCh
1alX+gi+SdZpxByG+xQYXGI9r5sZU8cgE7jUrUjJdGz0tNSkcqmSIcCT9Xys30slz0
Tqj9DcuVxKQjg==
Received: from [192.168.1.63] (unknown [IPv6:2600:4041:5b1a:9400:99d:464c:62e0:2118])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
(Authenticated sender: nfraprado)
by bali.collaboradmins.com (Postfix) with ESMTPSA id 34DF417E0156;
Fri, 6 Jun 2025 15:14:25 +0200 (CEST)
From: =?utf-8?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= <nfraprado@xxxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 09:14:22 -0400
Subject: [PATCH] media: platform: mtk-mdp3: Add missing MT8188 compatible
to comp_dt_ids
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-mt8188-mdp-regression-comp-compat-fix-v1-1-e68772d7a3aa@xxxxxxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIAK3pQmgC/x2NSwqEMBBEryK9noZEyUevMriQpCfTi2joyDAg3
t3opuAVvKoDKglThak7QOjHlbe1gX51EL7Lmgg5NoZe9UZZZTHvXnuPORYUSkL1NjBsuTyx7Pj
hPzprfIjWDaPR0LaKUKufn/d8nhe7LEwbdwAAAA==
X-Change-ID: 20250606-mt8188-mdp-regression-comp-compat-fix-7658cd673951
To: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Matthias Brugger <matthias.bgg@xxxxxxxxx>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>,
"Rob Herring (Arm)" <robh@xxxxxxxxxx>
Cc: kernel@xxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-mediatek@xxxxxxxxxxxxxxxxxxx,
=?utf-8?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= <nfraprado@xxxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Commit 4a81656c8eaa ("arm64: dts: mediatek: mt8188: Address binding
warnings for MDP3 nodes") caused a regression on the MDP functionality
when it removed the MT8195 compatibles from the MDP3 nodes, since the
MT8188 compatible was not yet listed as a possible MDP component
compatible in mdp_comp_dt_ids. This resulted in an empty output
bitstream when using the MDP from userspace, as well as the following
errors:

mtk-mdp3 14001000.dma-controller: Uninit component inner id 4
mtk-mdp3 14001000.dma-controller: mdp_path_ctx_init error 0
mtk-mdp3 14001000.dma-controller: CMDQ sendtask failed: -22

Add the missing compatible to the array to restore functionality.

Fixes: 4a81656c8eaa ("arm64: dts: mediatek: mt8188: Address binding warnings for MDP3 nodes")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>
---
drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
index 683c066ed97586a187f7d30191ba0f6c99c83371..7fcb2fbdd64eea18ca0c7e4600bb1f601cf8725e 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
@@ -1530,6 +1530,9 @@ static const struct of_device_id mdp_comp_dt_ids[] __maybe_unused = {
}, {
.compatible = "mediatek,mt8195-mdp3-tcc",
.data = (void *)MDP_COMP_TYPE_TCC,
+ }, {
+ .compatible = "mediatek,mt8188-mdp3-rdma",
+ .data = (void *)MDP_COMP_TYPE_RDMA,
},
{}
};

---
base-commit: 475c850a7fdd0915b856173186d5922899d65686
change-id: 20250606-mt8188-mdp-regression-comp-compat-fix-7658cd673951

Best regards,
--
Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675787-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5FA0741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:15:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 0BD5E1891567
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:14:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A2667288C89;
Fri, 6 Jun 2025 13:14:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="c0+1pPJi"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 0061C288C3D
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:14:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215653; cv=none; b=sRiSLAKfM/M3MEfoIPjIhhAVhHRvTYnxg6AgPUPHv4lvShHCE1Bp5FD8Ijn8ip0j1BQScucrSZaD6WEHX18zIJu9UAfkUcuO0i8UV94qqmnYuU6TMT5/Aee5O9zzq+9DwnRc3KdE73cYKbG35efWzxzf8T8MUAAN6DXuVSWYiXg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215653; c=relaxed/simple;
bh=gf/eMo1Drdee7qnpxNSlWUGvG/MqRAG8ULUx2xh3QFE=;
h=Message-ID:Date:MIME-Version:Subject:To:References:From:
In-Reply-To:Content-Type; b=bUKJq7bl0Gd6GeCIEpNS/X4uyrWFo1dNbYH+kPVG1XG/Msx/W+VIOxfFHc7ceVzIt3a08SnYuYSOvc0h+A+b/H/Tzb3SeEwmLW/TJ5HTAfI6CuyQNl/mhVVcj4mb45deyuxGlgv96iEpTrhZ5JBFpO79OqUpmSLEHXI6jBmKkyw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=c0+1pPJi; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749215650;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=OPcQkvm2yO9gaDxIY/WqB5o2C00Jo+psdQDe9Iafs6c=;
b=c0+1pPJiJSGBv2f4xBQIjhKQGflzL0A69F/b6XgJv70TVdgHqzHLL3081TL2C1dfo5yhqo
m41Z6FYKZ9lT2HhMjGcQTwRmWm1qYv/CLwb+vLYSfv6EJUGOHdRokt5QGjbsjmAM3NzaPR
WMfu+Wupher85rrJK5+b9Ylo88tSOuo=
Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com
[209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-398-f3wmOiNnNP6FXnWHUkNg0Q-1; Fri, 06 Jun 2025 09:14:09 -0400
X-MC-Unique: f3wmOiNnNP6FXnWHUkNg0Q-1
X-Mimecast-MFC-AGG-ID: f3wmOiNnNP6FXnWHUkNg0Q_1749215648
Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-450d9f96f61so14843665e9.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:14:09 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749215648; x=1749820448;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=OPcQkvm2yO9gaDxIY/WqB5o2C00Jo+psdQDe9Iafs6c=;
b=sx6+FISBIDNYBr/lTLNvur3+25CPNJ4eVfOfrlL/3uMGnhYxdPiEdZ1xHfE/6KoH2/
0LSENc0tTXg30aaRUXdb5XGoAYK/SLCjZ2nHKXwe25X+7djXKSZ9dRaKc9XF8T20cjkS
/zz5r1MAYwG6bCikaQR07WtB+n7bQ3NDz5vpsbfbSVo8cYHXtSeOjKUgPf1srpI9C5O/
LIYvlTiWW4mYKuTgHkVFmxexXcvKFml4mMhD75hoNVoA4GE4o3sx3db5cs+6FFFE2iiF
mLjsBefV+0RrHsT8+qdi4gppLSkdKk8aUFVDw+AXByC+ddOJS5nP8aRpn6/sa55oQSbZ
J5mg==
X-Forwarded-Encrypted: i=1; AJvYcCXUeL9CrYGSJa/oysAlupWLPv5WjNBwpGO9aF4cL00vP0UKEokbNDywpfjepUptglil6JQ0JdyVM68HjYI=@vger.kernel.org
X-Gm-Message-State: AOJu0YxF+pzrKctJK19nsr4qOw9wb3XbhxrxUenG0f11zdiAPQtCbtmM
/ODI5SHGCHmn4Li/dEeYqTsEeJnDCpi3V2ybGmxDlW9cr8IOrwBMFDLjhJTZH2hRhsulIvyvU2V
xkbWWVPhkLRG1XJQ8l5iiAYZDT6/drluKtiighogENiXRdfas6Acp4KrMiLN2VY0YqA==
X-Gm-Gg: ASbGncuOiOLYkSKKQz1nH+yzudgVa1YZJkGoWV8hEHaVKmF4MppaEMbTY+ebqH2aNwV
5H7wKamyCnDtXfy3CWEkR5g9BEZVfR7cmS8GXTOs4ihDB339HnpzuehS2+YtjXFslgP9BOEophd
i/xeql6Fl7TJcz/UA/jXazdbQBDhk7BfFqcwwcalH80ckAGv/J3O805zr7rUaYVUeHbyC3t75md
9yjCz3D+vWipHTiUbAMgsY2iidVR1WmYdcUu0PpIjtN4z9mBaZ/igSdrB5yNUdBS7VFrCCDp2GF
PZkLM+XarXbzH0EXcPSWOEcYXBRMZ4aazPRq+4zy5L+Ro0Z1Yx7oSYy/1t363A==
X-Received: by 2002:a05:600c:a08e:b0:43c:fa24:873e with SMTP id 5b1f17b1804b1-45201391375mr37179115e9.13.1749215648359;
Fri, 06 Jun 2025 06:14:08 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IEgw0C5j9K+kUpLKu17QtwP444HtAeVPH30PrMVtLgOGG/Lf58xq+FjEIaE8XuzPGYKNjMZEQ==
X-Received: by 2002:a05:600c:a08e:b0:43c:fa24:873e with SMTP id 5b1f17b1804b1-45201391375mr37178795e9.13.1749215647873;
Fri, 06 Jun 2025 06:14:07 -0700 (PDT)
Received: from ?IPV6:2a01:e0a:c:37e0:ced3:55bd:f454:e722? ([2a01:e0a:c:37e0:ced3:55bd:f454:e722])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-452137277basm24098065e9.32.2025.06.06.06.14.07
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:14:07 -0700 (PDT)
Message-ID: <8ed62378-269f-4385-bf05-eda28098fc1f@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:14:04 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 4/9] drm/ttm: Add ttm_bo_kmap_try_from_panic()
To: =?UTF-8?Q?Christian_K=C3=B6nig?= <christian.koenig@xxxxxxx>,
Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>, Simona Vetter <simona@xxxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>, Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>, Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>, intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
<20250606120519.753928-5-jfalempe@xxxxxxxxxx>
<dd0532a2-4011-41ec-896d-ec066dc23cbc@xxxxxxx>
Content-Language: en-US, fr
From: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
In-Reply-To: <dd0532a2-4011-41ec-896d-ec066dc23cbc@xxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 14:28, Christian König wrote:
> On 6/6/25 13:48, Jocelyn Falempe wrote:
>> If the ttm bo is backed by pages, then it's possible to safely kmap
>> one page at a time, using kmap_try_from_panic().
>
> I strongly assume that we don't care about locking anything in this case, don't we?

Yes, normally it's called for the current framebuffer, so I assume it's
properly allocated, and isn't growing/shrinking while being displayed.

>
>> Unfortunately there is no way to do the same with ioremap, so it
>> only supports the kmap case.
>
> Oh, there actually is on most modern systems.
>
> At least on 64bit systems amdgpu maps the whole VRAM BAR into kernel address space on driver load.
>
> So as long as you have a large BAR system you can trivially have access to the MMIO memory.

For amdgpu, I used the indirect MMIO access, so I didn't need to ioremap
https://elixir.bootlin.com/linux/v6.15/source/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c#L1800

For the xe driver, I only tested on integrated GPU, using system RAM, so
this first approach is good enough.
But I'm still interested to find a solution, is there a way to get the
current io-mapping if it exists?


>
>> This is needed for proper drm_panic support with xe driver.
>>
>> Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
>> ---
>>
>> v8:
>> * Added in v8
>>
>> drivers/gpu/drm/ttm/ttm_bo_util.c | 27 +++++++++++++++++++++++++++
>> include/drm/ttm/ttm_bo.h | 1 +
>> 2 files changed, 28 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index 15cab9bda17f..9c3f3b379c2a 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -377,6 +377,33 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,
>> return (!map->virtual) ? -ENOMEM : 0;
>> }
>>
>> +/**
>> + *
>> + * ttm_bo_kmap_try_from_panic
>> + *
>> + * @bo: The buffer object
>> + * @page: The page to map
>> + *
>> + * Sets up a kernel virtual mapping using kmap_local_page_try_from_panic().
>> + * This can safely be called from the panic handler, if you make sure the bo
>
> "This can *only* be called from the panic handler..."

Yes, I will fix that, it shouldn't be called for normal operations.

>
> Apart from those open questions, looks sane to me.
>
> Regards,
> Christian.
>
>> + * is the one being displayed, so is properly allocated, and won't be modified.
>> + *
>> + * Returns the vaddr, that you can use to write to the bo, and that you should
>> + * pass to kunmap_local() when you're done with this page, or NULL if the bo
>> + * is in iomem.
>> + */
>> +void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page)
>> +{
>> + if (page + 1 > PFN_UP(bo->resource->size))
>> + return NULL;
>> +
>> + if (!bo->resource->bus.is_iomem && bo->ttm->pages && bo->ttm->pages[page])
>> + return kmap_local_page_try_from_panic(bo->ttm->pages[page]);
>> +
>> + return NULL;
>> +}
>> +EXPORT_SYMBOL(ttm_bo_kmap_try_from_panic);
>> +
>> /**
>> * ttm_bo_kmap
>> *
>> diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
>> index cf027558b6db..8c0ce3fa077f 100644
>> --- a/include/drm/ttm/ttm_bo.h
>> +++ b/include/drm/ttm/ttm_bo.h
>> @@ -429,6 +429,7 @@ int ttm_bo_init_validate(struct ttm_device *bdev, struct ttm_buffer_object *bo,
>> int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
>> unsigned long num_pages, struct ttm_bo_kmap_obj *map);
>> void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
>> +void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page);
>> int ttm_bo_vmap(struct ttm_buffer_object *bo, struct iosys_map *map);
>> void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct iosys_map *map);
>> int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo);
>



Return-Path: <linux-kernel+bounces-675790-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1511741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:15:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 80BB13B160F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:14:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 71924289371;
Fri, 6 Jun 2025 13:14:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NQe3K4zj"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE2A0288CBC;
Fri, 6 Jun 2025 13:14:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215682; cv=none; b=S6IVlC87pA6cOGuHmAP5Djx0gI0v/h0Sq+N6yRRJJ9pxbrycNlz7MC2tni88yMGPmUbJXp8XqhZ5iD5c4xJtIUUjV+MufGPgkIBw8EyNcjI0V+qqlhtdqb/UYo3/5/n94Hh5bOkJQ6m9UU+TlL0XuXjL2cecASCQDnlpFaZjNfc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215682; c=relaxed/simple;
bh=7pw97sieU7T1F+62xaELTwjjTTSUaRf6+M7upMa96BU=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=FVWIsguDN8wfMbwGf0+UnGyOVfDsl38zibydsiWDVcGAQgl8swNw0Wcel1PBB0V1f2AwxumyTAmP88EVhOo0iaZ2ykpk/YEwAxpagzgrqFA2jz7j7uEY8Dg6jUqGf1ZGB3qnVBdaHNpxkzwUNNMwbBKR0qm3CXKH+YRhb9ircOE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NQe3K4zj; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DC6BC4CEF0;
Fri, 6 Jun 2025 13:14:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749215681;
bh=7pw97sieU7T1F+62xaELTwjjTTSUaRf6+M7upMa96BU=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=NQe3K4zj6LZA7NsgmitBbENfWid4o30TZbo8pGZZhp25y5aySPEXWZ1srOQJxeg21
kqS40kYX/drmI6hxHfj+fPzPX9Iyl6X+ESHpOn/PDHVY+0C/ubY6uBPK/SjHA27gna
pRsnehK7XueAZ60OhEIdO0HbNb+RsTYY4WxSRh2IvOtnYb7XRLGGRX+KvYhTlfYZj0
tLbz+iSPciAN6cumlXrlhSVXD0fWAEYsXk+qb2eGQ8BFGVdUEcvgMDvUIYMCR1OXbd
VbJcvCkzyyU0xdRiERPn8dRYkH1Oy7GzGul8rp7YUblr1F7PtdK+Ml0xvrhbzXuZjS
IGUn/W1Ksz0GQ==
Date: Fri, 6 Jun 2025 14:14:37 +0100
From: Simon Horman <horms@xxxxxxxxxx>
To: Carlos Fernandez <carlos.fernandez@xxxxxxxxxxxxxxxxxxxxxxx>
Cc: sbhatta@xxxxxxxxxxx, Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>,
Andrew Lunn <andrew+netdev@xxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>,
Hannes Frederic Sowa <hannes@xxxxxxxxxxxxxxxxxxx>,
netdev@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH net v3] macsec: MACsec SCI assignment for ES = 0
Message-ID: <20250606131437.GH120308@xxxxxxxxxxxxxxxx>
References: <20250604123407.2795263-1-carlos.fernandez@xxxxxxxxxxxxxxxxxxxxxxx>
<20250605132110.3922404-1-carlos.fernandez@xxxxxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250605132110.3922404-1-carlos.fernandez@xxxxxxxxxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 03:21:04PM +0200, Carlos Fernandez wrote:
> Hi Sundeep,
>
> In order to test this scenario, ES and SC flags must be 0 and
> port identifier should be different than 1.
>
> In order to test it, I runned the following commands that configure
> two network interfaces on qemu over different namespaces.
>
> After applying this configuration, MACsec ping works in the patched version
> but fails with the original code.
>
> I'll paste the script commands here. Hope it helps your testing.
>
> PORT=11
> SEND_SCI="off"
> ETH1_MAC="52:54:00:12:34:57"
> ETH0_MAC="52:54:00:12:34:56"
> ENCRYPT="on"
>
> ip netns add macsec1
> ip netns add macsec0
> ip link set eth0 netns macsec0
> ip link set eth1 netns macsec1
>
> ip netns exec macsec0 ip link add link eth0 macsec0 type macsec port $PORT send_sci $SEND_SCI end_station off encrypt $ENCRYPT
> ip netns exec macsec0 ip macsec add macsec0 tx sa 0 pn 2 on key 01 12345678901234567890123456789012
> ip netns exec macsec0 ip macsec add macsec0 rx port $PORT address $ETH1_MAC
> ip netns exec macsec0 ip macsec add macsec0 rx port $PORT address $ETH1_MAC sa 0 pn 2 on key 02 09876543210987654321098765432109
> ip netns exec macsec0 ip link set dev macsec0 up
> ip netns exec macsec0 ip addr add 10.10.12.1/24 dev macsec0
>
> ip netns exec macsec1 ip link add link eth1 macsec1 type macsec port $PORT send_sci $SEND_SCI end_station off encrypt $ENCRYPT
> ip netns exec macsec1 ip macsec add macsec1 tx sa 0 pn 2 on key 02 09876543210987654321098765432109
> ip netns exec macsec1 ip macsec add macsec1 rx port $PORT address $ETH0_MAC
> ip netns exec macsec1 ip macsec add macsec1 rx port $PORT address $ETH0_MAC sa 0 pn 2 on key 01 12345678901234567890123456789012
> ip netns exec macsec1 ip link set dev macsec1 up
> ip netns exec macsec1 ip addr add 10.10.12.2/24 dev macsec1
>
> ip netns exec macsec1 ping 10.10.12.1 #Ping works on patched version.

It seems to me that it would be useful to include these instructions in
the commit message. Or better still, add a selftests.


Return-Path: <linux-kernel+bounces-675791-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 18ED841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:15:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 47F66176CEA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:15:15 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B89FC28937A;
Fri, 6 Jun 2025 13:14:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ngHWsDE9"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE231288C93;
Fri, 6 Jun 2025 13:14:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215682; cv=none; b=VHpeAWLm5KDcAu5CuFsADYQGWX2g9CbuqUxRZT5IyvG7z549JyAcB0LAO5slSFPaNPTxW04a1fIu0c0bVrM6XzTXaYjvBvoRcT5YKC30lD5WSSHA5EJQ7eMhvqU+lrgxmcaR6fQ0BxnPUTF2mm3kuK9+4J4/Z9I7XATb5Mh3aOs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215682; c=relaxed/simple;
bh=skZemrol5BSMlsi755QNgC4Z7zGGLts5DGe9/yeSbEQ=;
h=Date:Content-Type:MIME-Version:From:Cc:To:In-Reply-To:References:
Message-Id:Subject; b=U8GQvSXEJPuj9toWX8cAGPJOWxIJwvhDy7QCx1oeM/bP85geWgxi5yj03VQvEQVxOL/3sileOl5YVa/hMOpDSLv47+xV4V3F36LAiniSwSrJrwAjWq+Cq/knENUpbg8ABmuS606w1a2hrgbw+TtBreTJn5yRLaSA+eeDEX7ku3I=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ngHWsDE9; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 253D3C4CEED;
Fri, 6 Jun 2025 13:14:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749215682;
bh=skZemrol5BSMlsi755QNgC4Z7zGGLts5DGe9/yeSbEQ=;
h=Date:From:Cc:To:In-Reply-To:References:Subject:From;
b=ngHWsDE9PaxzLFKKz3qcppmM5qPl2L+jEB/vDrH7i08LK4/60OmaMlr7yPqQeYd5g
H2me/D6I3xsdEkrE1nwqEZcSowgVnk3RggGX3ELOxBFnq+9M/bAidqNSOJXg3mwdhp
Pbm6dRr5tBmgUo21bLgR6HlaE0qDK27sQNECitvKu9tia/lb4/l17q9sJIVhMlQXBj
I6fwAIsX8W/Y6kT4p8DVI+sunEHvh1Y1uBFMguGtCB4/xcx/N66meg1qxhDqUiuDiQ
0qYFp/xLKRf9bVfvCqUTheXY6IWZrC5zOQ6fd906PlahlZQq6k1Ysor/JILbuMeG5O
p6BQHcucZBWWQ==
Date: Fri, 06 Jun 2025 08:14:40 -0500
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
From: "Rob Herring (Arm)" <robh@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx,
Andrew Jeffery <andrew@xxxxxxxxxxxxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-aspeed@xxxxxxxxxxxxxxxx, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Joel Stanley <joel@xxxxxxxxx>
To: Fred Chen <fredchen.openbmc@xxxxxxxxx>
In-Reply-To: <20250606102802.1821638-1-fredchen.openbmc@xxxxxxxxx>
References: <20250606102802.1821638-1-fredchen.openbmc@xxxxxxxxx>
Message-Id: <174921562446.1204173.9232925902067845583.robh@xxxxxxxxxx>
Subject: Re: [PATCH v1 0/2] Add Meta(Facebook) Santabarbara BMC(AST2600)
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On Fri, 06 Jun 2025 18:27:52 +0800, Fred Chen wrote:
> Summary:
> Add linux device tree entry related to Meta(Facebook) Santabarbara
> specific devices connected to BMC(AST2600) SoC.
>
> Fred Chen (2):
> dt-bindings: arm: aspeed: add Meta Santabarbara board
> ARM: dts: aspeed: santabarbara: Add Meta Santabarbara BMC
>
> .../bindings/arm/aspeed/aspeed.yaml | 1 +
> arch/arm/boot/dts/aspeed/Makefile | 1 +
> .../aspeed-bmc-facebook-santabarbara.dts | 978 ++++++++++++++++++
> 3 files changed, 980 insertions(+)
> create mode 100644 arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts
>
> --
> 2.49.0
>
>
>


My bot found new DTB warnings on the .dts files added or changed in this
series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings
are fixed by another series. Ultimately, it is up to the platform
maintainer whether these warnings are acceptable or not. No need to reply
unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then
make sure dt-schema is up to date:

pip3 install dtschema --upgrade


This patch series was applied (using b4) to base:
Base: attempting to guess base-commit...
Base: failed to guess base

If this is not the correct base, please add 'base-commit' tag
(or use b4 which does this automatically)

New warnings running 'make CHECK_DTBS=y for arch/arm/boot/dts/aspeed/' for 20250606102802.1821638-1-fredchen.openbmc@xxxxxxxxx:

arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: timer (arm,armv7-timer): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/timer/arm,arch_timer.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /sdram@1e6e0000: failed to match any schema with compatible: ['aspeed,ast2600-sdram-edac', 'syscon']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: bus@1e600000 (aspeed,ast2600-ahbc): compatible: ['aspeed,ast2600-ahbc', 'syscon'] is too long
from schema $id: http://devicetree.org/schemas/bus/aspeed,ast2600-ahbc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: syscon@1e6e2000 (aspeed,ast2600-scu): 'smp-memram@180' does not match any of the regexes: '^interrupt-controller@[0-9a-f]+$', '^p2a-control@[0-9a-f]+$', '^pinctrl(@[0-9a-f]+)?$', '^pinctrl-[0-9]+$', '^silicon-id@[0-9a-f]+$'
from schema $id: http://devicetree.org/schemas/mfd/aspeed,ast2x00-scu.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/apb@1e6e0000/syscon@1e6e2000/smp-memram@180: failed to match any schema with compatible: ['aspeed,ast2600-smpmem']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/apb@1e6e0000/display@1e6e6000: failed to match any schema with compatible: ['aspeed,ast2600-gfx', 'syscon']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: adc@1e6e9000 (aspeed,ast2600-adc0): 'interrupts' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/iio/adc/aspeed,ast2600-adc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: adc@1e6e9100 (aspeed,ast2600-adc1): 'interrupts' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/iio/adc/aspeed,ast2600-adc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: crypto@1e6fa000 (aspeed,ast2600-acry): 'aspeed,ahbc' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/crypto/aspeed,ast2600-acry.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: sdc@1e740000 (aspeed,ast2600-sd-controller): sdhci@1e740100:compatible: ['aspeed,ast2600-sdhci', 'sdhci'] is too long
from schema $id: http://devicetree.org/schemas/mmc/aspeed,sdhci.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: sdc@1e740000 (aspeed,ast2600-sd-controller): sdhci@1e740200:compatible: ['aspeed,ast2600-sdhci', 'sdhci'] is too long
from schema $id: http://devicetree.org/schemas/mmc/aspeed,sdhci.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/sdc@1e740000/sdhci@1e740100: failed to match any schema with compatible: ['aspeed,ast2600-sdhci', 'sdhci']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/sdc@1e740000/sdhci@1e740200: failed to match any schema with compatible: ['aspeed,ast2600-sdhci', 'sdhci']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: gpio@1e780000 (aspeed,ast2600-gpio): 'pinctrl-0' is a dependency of 'pinctrl-names'
from schema $id: http://devicetree.org/schemas/pinctrl/pinctrl-consumer.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/apb@1e780000/timer@1e782000: failed to match any schema with compatible: ['aspeed,ast2600-timer']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: lpc@1e789000 (aspeed,ast2600-lpc-v2): reg-io-width: 4 is not of type 'object'
from schema $id: http://devicetree.org/schemas/mfd/aspeed-lpc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: lpc@1e789000 (aspeed,ast2600-lpc-v2): lpc-snoop@80: 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/mfd/aspeed-lpc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: kcs@24 (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: kcs@28 (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: kcs@2c (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: kcs@114 (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/apb@1e780000/lpc@1e789000/lhc@a0: failed to match any schema with compatible: ['aspeed,ast2600-lhc']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/apb@1e780000/lpc@1e789000/ibt@140: failed to match any schema with compatible: ['aspeed,ast2600-ibt-bmc']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: fsi@1e79b000 (aspeed,ast2600-fsi-master): compatible: ['aspeed,ast2600-fsi-master', 'fsi-master'] is too long
from schema $id: http://devicetree.org/schemas/fsi/aspeed,ast2600-fsi-master.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/apb@1e790000/fsi@1e79b000: failed to match any schema with compatible: ['aspeed,ast2600-fsi-master', 'fsi-master']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: fsi@1e79b100 (aspeed,ast2600-fsi-master): compatible: ['aspeed,ast2600-fsi-master', 'fsi-master'] is too long
from schema $id: http://devicetree.org/schemas/fsi/aspeed,ast2600-fsi-master.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/apb@1e790000/fsi@1e79b100: failed to match any schema with compatible: ['aspeed,ast2600-fsi-master', 'fsi-master']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dtb: /ahb/apb@1e790000/dma-controller@1e79e000: failed to match any schema with compatible: ['aspeed,ast2600-udma']
arch/arm/boot/dts/aspeed/aspeed-bmc-opp-witherspoon.dtb: /gpio-fsi/cfam@0,0/hub@3400/cfam@1,0/hub@3400: failed to match any schema with compatible: ['fsi-master-hub']
arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dtb: kcs@114 (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-inventec-transformers.dtb: /ahb/apb@1e790000/fsi@1e79b000: failed to match any schema with compatible: ['aspeed,ast2600-fsi-master', 'fsi-master']
arch/arm/boot/dts/aspeed/aspeed-bmc-ibm-blueridge.dtb: syscon@1e6e2000 (aspeed,ast2600-scu): 'smp-memram@180' does not match any of the regexes: '^interrupt-controller@[0-9a-f]+$', '^p2a-control@[0-9a-f]+$', '^pinctrl(@[0-9a-f]+)?$', '^pinctrl-[0-9]+$', '^silicon-id@[0-9a-f]+$'
from schema $id: http://devicetree.org/schemas/mfd/aspeed,ast2x00-scu.yaml#







Return-Path: <linux-kernel+bounces-675789-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AD2E041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:15:49 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 9829A1889AD6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:15:08 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B12AF289346;
Fri, 6 Jun 2025 13:14:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GNX/OhLm"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9C5D288C81;
Fri, 6 Jun 2025 13:14:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215679; cv=none; b=gR2i3k1urmZV++pZsg8P9JeRrBhbfYIdbAnE4+m13c+6ICBw6fHtf/oEnAvUdpQf7WJZ4r6mwCjejPi+sIOyLf0WmqQ06cpAlZNGXBSbW9AaUIx6/MWvJdzHK72Wslri4N1BkcpNgsKUUCcIjUu0Y5VaytVbFKLa49CfIqyJaTo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215679; c=relaxed/simple;
bh=uX87r25sOY/1WTUP20esRNg38m9XX/w5q7gcRgS18QQ=;
h=Date:Content-Type:MIME-Version:From:Cc:To:In-Reply-To:References:
Message-Id:Subject; b=qtAUsXk19lxZwCJwlhsJ9LhhiVQpbVEzIAIUOOj3REz2K2LnissJy4oKqtpTCRaVgEYamFq0161Z1C8rnr04gaFJnduyZV4FCzVNpWifZlxA4ct9GUyAPB1hEXsUxpmZ0/37lFClU7xeSLzWHmI2xOPevjbtRx6BUoJKW+M869c=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GNX/OhLm; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27CBDC4CEED;
Fri, 6 Jun 2025 13:14:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749215679;
bh=uX87r25sOY/1WTUP20esRNg38m9XX/w5q7gcRgS18QQ=;
h=Date:From:Cc:To:In-Reply-To:References:Subject:From;
b=GNX/OhLm3nAycI2ro8ffRV7TtiUUmvidr1pz/SBdzN/BJbprZsY3obGBaVK6I/wLj
aiLzTWGKK81SaKweshbBiVA50sltqeuNc97V7xDTzbtDEU3RYlreGHxYV+kF6XbhWB
8CrC3UoPNMXt/itNSIqddnjH1zuzbvhkhL3biVQR3Eq3pbNwfgvXJ5YIiCoFnAdw55
FspHVDLa/R7taXp9Sc/sg3HaUDAX6QAsN2AKfwcHN9w6K7CmwPbPA7hiFXPYpT5+uV
R5K+cD9uiwCtn1j6ck7v/ej5d1yw96pQ090qYyk9AUxFunc+BIf8fwaS4CcZpfKvaT
grFdgOzKAoUJw==
Date: Fri, 06 Jun 2025 08:14:36 -0500
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
From: "Rob Herring (Arm)" <robh@xxxxxxxxxx>
Cc: joel@xxxxxxxxx, jerry.lin@xxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-aspeed@xxxxxxxxxxxxxxxx, patrick@xxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, krzk+dt@xxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, conor+dt@xxxxxxxxxx,
yang.chen@xxxxxxxxxxxx, andrew@xxxxxxxxxxxxxxxxxxxx
To: Jason Hsu <jasonhell19@xxxxxxxxx>
In-Reply-To: <20250606025251.887953-1-jasonhell19@xxxxxxxxx>
References: <20250606025251.887953-1-jasonhell19@xxxxxxxxx>
Message-Id: <174921562395.1204073.15298468789619817202.robh@xxxxxxxxxx>
Subject: Re: [PATCH v7 0/2] Add Meta(Facebook) Ventura BMC(AST2600)
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On Fri, 06 Jun 2025 10:52:49 +0800, Jason Hsu wrote:
> Add Linux device tree entry related to Meta(Facebook) Ventura specific
> devices connected to BMC(AST2600) SoC.
>
> ---
> v1:
> 1. Create ventura dts file.
> 2. Add commit msg.
> 3. Use format-patch to generate patch.
> 4. Add subject prefixes matching the subsystem.
> ---
> v2:
> 1. Modify email content.
> ---
> v3:
> 1. Add mail list.
> ---
> v4:
> 1. Apply git send-email --thread option.
> 2. Sort nodes in the dts alphanumerically.
> ---
> v5:
> 1. Run scripts/checkpatch.pl and fix reported warnings.
> 2. Remove unnecessary 88E6393X CONFIG FRU.
> ---
> v6:
> 1. Add a new stage for the DTS change.
> 2. Run scripts/checkpatch.pl and fix reported error.
> 3. Fix the issue in a separate patch.
> ---
> v7:
> 1. Fix broken indentation in the device tree file.
> 2. Sort nodes alphabetically, then by address if equal.
> 3. Rename fan sensor nodes from 'hwmon' to 'fan-controller'.
> ---
> Jason Hsu (2):
> ARM: dts: aspeed: ventura: add Meta Ventura BMC
> dt-bindings: arm: aspeed: add Meta Ventura board
>
> .../bindings/arm/aspeed/aspeed.yaml | 1 +
> arch/arm/boot/dts/aspeed/Makefile | 1 +
> .../aspeed/aspeed-bmc-facebook-ventura.dts | 1481 +++++++++++++++++
> 3 files changed, 1483 insertions(+)
> create mode 100644 arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dts
>
> --
> 2.34.1
>
>
>


My bot found new DTB warnings on the .dts files added or changed in this
series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings
are fixed by another series. Ultimately, it is up to the platform
maintainer whether these warnings are acceptable or not. No need to reply
unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then
make sure dt-schema is up to date:

pip3 install dtschema --upgrade


This patch series was applied (using b4) to base:
Base: attempting to guess base-commit...
Base: failed to guess base

If this is not the correct base, please add 'base-commit' tag
(or use b4 which does this automatically)

New warnings running 'make CHECK_DTBS=y for arch/arm/boot/dts/aspeed/' for 20250606025251.887953-1-jasonhell19@xxxxxxxxx:

arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: timer (arm,armv7-timer): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/timer/arm,arch_timer.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /sdram@1e6e0000: failed to match any schema with compatible: ['aspeed,ast2600-sdram-edac', 'syscon']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: bus@1e600000 (aspeed,ast2600-ahbc): compatible: ['aspeed,ast2600-ahbc', 'syscon'] is too long
from schema $id: http://devicetree.org/schemas/bus/aspeed,ast2600-ahbc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: syscon@1e6e2000 (aspeed,ast2600-scu): 'smp-memram@180' does not match any of the regexes: '^interrupt-controller@[0-9a-f]+$', '^p2a-control@[0-9a-f]+$', '^pinctrl(@[0-9a-f]+)?$', '^pinctrl-[0-9]+$', '^silicon-id@[0-9a-f]+$'
from schema $id: http://devicetree.org/schemas/mfd/aspeed,ast2x00-scu.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/apb@1e6e0000/syscon@1e6e2000/smp-memram@180: failed to match any schema with compatible: ['aspeed,ast2600-smpmem']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/apb@1e6e0000/display@1e6e6000: failed to match any schema with compatible: ['aspeed,ast2600-gfx', 'syscon']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: adc@1e6e9000 (aspeed,ast2600-adc0): 'interrupts' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/iio/adc/aspeed,ast2600-adc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: adc@1e6e9100 (aspeed,ast2600-adc1): 'interrupts' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/iio/adc/aspeed,ast2600-adc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: crypto@1e6fa000 (aspeed,ast2600-acry): 'aspeed,ahbc' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/crypto/aspeed,ast2600-acry.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: sdc@1e740000 (aspeed,ast2600-sd-controller): sdhci@1e740100:compatible: ['aspeed,ast2600-sdhci', 'sdhci'] is too long
from schema $id: http://devicetree.org/schemas/mmc/aspeed,sdhci.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: sdc@1e740000 (aspeed,ast2600-sd-controller): sdhci@1e740200:compatible: ['aspeed,ast2600-sdhci', 'sdhci'] is too long
from schema $id: http://devicetree.org/schemas/mmc/aspeed,sdhci.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/sdc@1e740000/sdhci@1e740100: failed to match any schema with compatible: ['aspeed,ast2600-sdhci', 'sdhci']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/sdc@1e740000/sdhci@1e740200: failed to match any schema with compatible: ['aspeed,ast2600-sdhci', 'sdhci']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/apb@1e780000/timer@1e782000: failed to match any schema with compatible: ['aspeed,ast2600-timer']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: lpc@1e789000 (aspeed,ast2600-lpc-v2): reg-io-width: 4 is not of type 'object'
from schema $id: http://devicetree.org/schemas/mfd/aspeed-lpc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: lpc@1e789000 (aspeed,ast2600-lpc-v2): lpc-snoop@80: 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/mfd/aspeed-lpc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: kcs@24 (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: kcs@28 (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: kcs@2c (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: kcs@114 (aspeed,ast2500-kcs-bmc-v2): 'clocks' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-kcs-bmc.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/apb@1e780000/lpc@1e789000/lhc@a0: failed to match any schema with compatible: ['aspeed,ast2600-lhc']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/apb@1e780000/lpc@1e789000/ibt@140: failed to match any schema with compatible: ['aspeed,ast2600-ibt-bmc']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: i2c@400 (aspeed,ast2600-i2c-bus): Unevaluated properties are not allowed ('aspeed,hw-timeout-ms' was unexpected)
from schema $id: http://devicetree.org/schemas/i2c/aspeed,i2c.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: fsi@1e79b000 (aspeed,ast2600-fsi-master): compatible: ['aspeed,ast2600-fsi-master', 'fsi-master'] is too long
from schema $id: http://devicetree.org/schemas/fsi/aspeed,ast2600-fsi-master.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/apb@1e790000/fsi@1e79b000: failed to match any schema with compatible: ['aspeed,ast2600-fsi-master', 'fsi-master']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: fsi@1e79b100 (aspeed,ast2600-fsi-master): compatible: ['aspeed,ast2600-fsi-master', 'fsi-master'] is too long
from schema $id: http://devicetree.org/schemas/fsi/aspeed,ast2600-fsi-master.yaml#
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/apb@1e790000/fsi@1e79b100: failed to match any schema with compatible: ['aspeed,ast2600-fsi-master', 'fsi-master']
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-ventura.dtb: /ahb/apb@1e790000/dma-controller@1e79e000: failed to match any schema with compatible: ['aspeed,ast2600-udma']







Return-Path: <linux-kernel+bounces-675793-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 91B4E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:16:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 831DC3B0D15
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:15:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C7848288CA1;
Fri, 6 Jun 2025 13:15:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UxFegecJ"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 764A72882B6
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:15:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215755; cv=none; b=k5wpNqNTc4gG/iq18zCnZyv7rugm19b3RiI57gmbJIVRXc9T0fDN0cw16AJmYNghm9TukJ5g8nAVnjjnGXea/g0BKmGekRv74cAGyWPWL3C0WHHB/Vtmk+udgFY5dEM5ZfYlK+rb6GLSFPWn0fnhjMN+KY3sj4IV3a/8LjpcXvM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215755; c=relaxed/simple;
bh=63qnBFn3IeeXRHtX0JRv2KN/seMyYa9Ut3ikUMT03o8=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=o32hZSuyp7ZsB9lSX6kCnXve92Ty6nyShnvwzdlzFgiNBCEDi/6RvhNjYsXno85s0QIj53BAtjBij28QjZC77VM8M6pzISaTo0fu+aaBvL5wC85AaQvP+n7cXxgzs36C0NPOki/SP61m9jvORDKB0tFZyP/XyPpZFB/ER3eFKTg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UxFegecJ; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749215752;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=s0OWnwlwuv3H3/Si1rSXJZVeVgGfMEx966EIC+C5qno=;
b=UxFegecJR5vX0P298Y3b6kJQtbuHozBNdW9HC4gwL3+xLkAxUSXa7HscjW9m+V86IE4Ffi
rZtg4CbWOt0auSAIDg9WIOOUwhs8lkRsnqd06KGAJ1q298sjAYYppxfEsr43M5uhPiQQOh
n7z+Rx538wLSvH319yO/8swUa1xD2Iw=
Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com
[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-615-IKS85TjuNFKaQQkhhyGf7g-1; Fri, 06 Jun 2025 09:15:51 -0400
X-MC-Unique: IKS85TjuNFKaQQkhhyGf7g-1
X-Mimecast-MFC-AGG-ID: IKS85TjuNFKaQQkhhyGf7g_1749215750
Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-450dada0f83so17370695e9.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:15:51 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749215750; x=1749820550;
h=content-transfer-encoding:in-reply-to:organization:autocrypt
:content-language:from:references:cc:to:subject:user-agent
:mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
:date:message-id:reply-to;
bh=s0OWnwlwuv3H3/Si1rSXJZVeVgGfMEx966EIC+C5qno=;
b=Sw7Y75VD6RQUrunSTLluZuiUJmrwK/CJJqZCTUo21ZdNnQgODtMdZJuzE/TP1/mnGY
qF5OZQRan0bYNawDXEOQfhrSY8wTJmpH1JkvkJswq7eULmFJxoMneekgqIje3NhCahG7
4Gz2bn0kUBvcDSKKrW1eRriaSB4Zf9+HuEJIiQii2RxawjUC0oBF+z8grD2DfEdyd8rt
j8vlMn/ufnKXclTKs0ssRxYKvllQqcy3fJy6Annz+/JgRYoIO6HFHgb7lKVyP3MtGKZ1
Y3voK+yTE1y8Wp2CG7kiFzS6O4W7RIsxccKKaFEu0m1JPkof0GK87Jg+FqGhnuDQF5U4
6gWQ==
X-Forwarded-Encrypted: i=1; AJvYcCU+7LZpPUAJZuR56MChWFhKCK9bTXi8ENC3QuZhSkjPu+8mT/vUeRS51+tlDuBPupxeMM1ZiU3TQhZDRBQ=@vger.kernel.org
X-Gm-Message-State: AOJu0YzmsOwdla5YA6C4jM26j+2zDZNrGhLEUxCbTzQOxYeHQwRA5x+N
lMX5HpUhaAijJ92RpLVLYfZGAdf4r8fQgFYzSVyygP03e5ICha5dLe8TDjf3HRL3DQDHom2VhkO
ldEh/F0uwuIJ150h7dihZmPo5R5KHU3kyZkwy3GoGLL/bPswJdvUyaaLfZsft0TI0gw==
X-Gm-Gg: ASbGncsT6rYjLA+Vl5JpQnVe8YMWy16PMTmJqSBXPuGGpyaY5BD2ZW/ClnM3W6oghCZ
gCHCRdx8HQ0cWnHUOWfGRkhUz8sRVKygAoePbtlO8g9VxA+iGw/WyE/LnAk5KuNV54TLxG7HJen
S+xksE7MQx/1LVr1FqfnySvxIfAwbYI51DbN0ae7waqJn7SsTEUIj0FyDIDMbq2i13/v5mSU+6K
eLLjlFlLizD8AVGA1HQKU54a/Q4RkqJjNpnI0UMXApcAalqU2Y/oVmJhupVgHIydxpj2aNlyfD+
aGHWAR5MvMHnPhZN7eGEIBzud+PP5ZCkgE51CTkHUaoX//G+6aPbbxPVL097P1iS5d/AvkdYngO
uyxmt/+cz29my9JpMdZAZLaraHXYWVG93CeEoEvuD3Q==
X-Received: by 2002:a05:600c:a44:b0:43c:fcbc:9680 with SMTP id 5b1f17b1804b1-4520140470fmr30901765e9.25.1749215750178;
Fri, 06 Jun 2025 06:15:50 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHcONZMZ9mzWPMwS39oEdC+r6GbtQPJGE/G206HVbssbK1tyXGdWsRNMfKOqk0bAqRBIjoj9g==
X-Received: by 2002:a05:600c:a44:b0:43c:fcbc:9680 with SMTP id 5b1f17b1804b1-4520140470fmr30901485e9.25.1749215749766;
Fri, 06 Jun 2025 06:15:49 -0700 (PDT)
Received: from ?IPV6:2003:d8:2f19:9c00:568:7df7:e1:293d? (p200300d82f199c0005687df700e1293d.dip0.t-ipconnect.de. [2003:d8:2f19:9c00:568:7df7:e1:293d])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213709670sm23732595e9.25.2025.06.06.06.15.48
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:15:49 -0700 (PDT)
Message-ID: <4108db4a-5b3f-4a8a-beb2-9ace3bd199bf@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:15:48 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 2/3] userfaultfd: prevent unregistering VMAs through a
different userfaultfd
To: Peter Xu <peterx@xxxxxxxxxx>
Cc: Tal Zussman <tz2294@xxxxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Jason A. Donenfeld" <Jason@xxxxxxxxx>,
Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>,
Christian Brauner <brauner@xxxxxxxxxx>, Jan Kara <jack@xxxxxxx>,
Pavel Emelyanov <xemul@xxxxxxxxxxxxx>, Andrea Arcangeli
<aarcange@xxxxxxxxxx>, linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-fsdevel@xxxxxxxxxxxxxxx
References: <20250603-uffd-fixes-v1-0-9c638c73f047@xxxxxxxxxxxx>
<20250603-uffd-fixes-v1-2-9c638c73f047@xxxxxxxxxxxx>
<84cf5418-42e9-4ec5-bd87-17ba91995c47@xxxxxxxxxx> <aEBhqz1UgpP8d9hG@x1.local>
<0a1dab1c-80d2-436f-857f-734d95939aec@xxxxxxxxxx> <aELnNH5LTFHmtdfQ@x1.local>
From: David Hildenbrand <david@xxxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=david@xxxxxxxxxx; keydata=
xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ
dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL
QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp
XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK
Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9
PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt
WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc
UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv
jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb
B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk
ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW
AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQTd4Q
9wD/g1oHcA//a6Tj7SBNjFNM1iNhWUo1lxAja0lpSodSnB2g4FCZ4R61SBR4l/psBL73xktp
rDHrx4aSpwkRP6Epu6mLvhlfjmkRG4OynJ5HG1gfv7RJJfnUdUM1z5kdS8JBrOhMJS2c/gPf
wv1TGRq2XdMPnfY2o0CxRqpcLkx4vBODvJGl2mQyJF/gPepdDfcT8/PY9BJ7FL6Hrq1gnAo4
3Iv9qV0JiT2wmZciNyYQhmA1V6dyTRiQ4YAc31zOo2IM+xisPzeSHgw3ONY/XhYvfZ9r7W1l
pNQdc2G+o4Di9NPFHQQhDw3YTRR1opJaTlRDzxYxzU6ZnUUBghxt9cwUWTpfCktkMZiPSDGd
KgQBjnweV2jw9UOTxjb4LXqDjmSNkjDdQUOU69jGMUXgihvo4zhYcMX8F5gWdRtMR7DzW/YE
BgVcyxNkMIXoY1aYj6npHYiNQesQlqjU6azjbH70/SXKM5tNRplgW8TNprMDuntdvV9wNkFs
9TyM02V5aWxFfI42+aivc4KEw69SE9KXwC7FSf5wXzuTot97N9Phj/Z3+jx443jo2NR34XgF
89cct7wJMjOF7bBefo0fPPZQuIma0Zym71cP61OP/i11ahNye6HGKfxGCOcs5wW9kRQEk8P9
M/k2wt3mt/fCQnuP/mWutNPt95w9wSsUyATLmtNrwccz63XOwU0EVcufkQEQAOfX3n0g0fZz
Bgm/S2zF/kxQKCEKP8ID+Vz8sy2GpDvveBq4H2Y34XWsT1zLJdvqPI4af4ZSMxuerWjXbVWb
T6d4odQIG0fKx4F8NccDqbgHeZRNajXeeJ3R7gAzvWvQNLz4piHrO/B4tf8svmRBL0ZB5P5A
2uhdwLU3NZuK22zpNn4is87BPWF8HhY0L5fafgDMOqnf4guJVJPYNPhUFzXUbPqOKOkL8ojk
CXxkOFHAbjstSK5Ca3fKquY3rdX3DNo+EL7FvAiw1mUtS+5GeYE+RMnDCsVFm/C7kY8c2d0G
NWkB9pJM5+mnIoFNxy7YBcldYATVeOHoY4LyaUWNnAvFYWp08dHWfZo9WCiJMuTfgtH9tc75
7QanMVdPt6fDK8UUXIBLQ2TWr/sQKE9xtFuEmoQGlE1l6bGaDnnMLcYu+Asp3kDT0w4zYGsx
5r6XQVRH4+5N6eHZiaeYtFOujp5n+pjBaQK7wUUjDilPQ5QMzIuCL4YjVoylWiBNknvQWBXS
lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv
AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa
N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3
AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB
boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq
3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f
XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ
a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq
Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6
3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8
kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E
th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr
jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt
WNyWQQ==
Organization: Red Hat
In-Reply-To: <aELnNH5LTFHmtdfQ@x1.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06.06.25 15:03, Peter Xu wrote:
> On Thu, Jun 05, 2025 at 11:06:38PM +0200, David Hildenbrand wrote:
>> Not sure if relevant, but consider the following:
>>
>> an app being controlled by another process using userfaultfd.
>>
>> The app itself can "escape" uffd control of the other process by simply
>> creating a userfaultfd and unregistering VMAs.
>
> IMHO it's okay if it's intentional by the child. E.g., even after this
> patch, the child, if intentional, can also mmap() a new VMA on top of the
> uffd tracked region to stop being trapped by the parent. The parent might
> still get a UNMAP event if registered, but it'll not be able to track the
> new VMAs mapped.

Ah, I thought there was a way yo track/intercept all new mappings as
well, but looks like that is at least not the case through UFFD_EVENT_*
as it seems.

--
Cheers,

David / dhildenb



Return-Path: <linux-kernel+bounces-675792-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1A67A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:16:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 15570189EDB1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:15:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 483E9288CBD;
Fri, 6 Jun 2025 13:15:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nHVT0pQW"
Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE32920F09A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:15:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215723; cv=none; b=IZ6DljN253bhT+Q/1MUZ+AOqYdZr5hqxyT/KgL6+Fz7wDcfoHKFdyPu50HceHflVAmDpCKQnAl4qhMA6fMy9NEwvvrfoapaXBoKv4DpoeAy4loBsqvhkzDFVNNYRurl7Z9iQbQ0Xkvr8wk4vNMWVF0X2wrosCrs+x34TgN69w/o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215723; c=relaxed/simple;
bh=gyt4YaLylyEdGqTGCWW7/jEsxjYOduZjnQjBg14MIi4=;
h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:
To:Cc:Content-Type; b=BcjJLXaf7uUDTAaRFP0hxfQiY8WkOf6c/WVqWhQirlmN8BEEjCcPkhgNTl97BDNFWi0aWCTGDWn/56mbwrsLYdT0XSv9DEEi/IEcrhAzBFH01qodpBcfZQkOaXvCfO8lfFVV/d0YVB+GOw7HPQexA0qPlVyOLtg69+tSdWHirpc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nHVT0pQW; arc=none smtp.client-ip=209.85.215.201
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com
Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-b2f103f6074so1408881a12.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:15:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749215721; x=1749820521; darn=vger.kernel.org;
h=cc:to:from:subject:message-id:references:mime-version:in-reply-to
:date:from:to:cc:subject:date:message-id:reply-to;
bh=yGgF9r+9FKkiYTuXty2xB/3AJrpX6qlhSbOSApR1j+c=;
b=nHVT0pQWo7ERZEECiSRejF4scmWQQb9qA7RJPGzFRO+D70E0vHxvE6ry0SDdO2jLEu
ayD/jMv6ENgeGhL8L9M0QBLcKmj+aEmmrOM90onV2fBJyIBkDtCbOotBtfKYpMN33JCo
WYIUfTuxKs/H8XrbsC+piGECk3VDsuLg89MxZK/xGgiD50k0N0q6JALbEYehc4dF/Nk/
bGXMKia3nesSV5aQrL03hdgwufRgBPYOXbO8V/SBLc8mQI+XLvFMBMkERvKUhWzTAAy2
kwwBo1Yj4UYOSmtq4BJpIys3RF1i9RNizQmx4YEWZ7p9irItoCe2SDSTaxsxTiUfp2Xf
51Yw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749215721; x=1749820521;
h=cc:to:from:subject:message-id:references:mime-version:in-reply-to
:date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=yGgF9r+9FKkiYTuXty2xB/3AJrpX6qlhSbOSApR1j+c=;
b=XbBYtgOq2MXmquyC30961q2P8NDUNk47QcJNeCmvzV6Vls+Woqigl2Pk3R45hhaD83
0euz0QkgjgOKeYtbG5LiGKmbvKIVk3RlwKNgWcKUAMAJv6tnBJXCex6jNn8y2FkMCeOB
szZzcssP6SGns1dJ0wB9903UC//8rJW2cCzpjj6uqDAMVHSp0XDtrM8/8LHvyLNful5U
BdVHOhyP3W06+DxxlxP8U85DK8HrkVs0dTHs9VvsBWDnNtgGoX6nO2slcqUPMx/xL+EE
fakkzFPWkXPngQjWJVJKpGFkZzcB8VEisvyYB/MV3ua5qDbdl8c+hzyo6/fpCasvLumr
Zv0Q==
X-Forwarded-Encrypted: i=1; AJvYcCU7ew2+MqKJwhlmidm1biI3T4yYdo+TYMgBXJ3I28Faovop42Oqcy+MAXKJSgeslcC4y7zzCOF9VYqm2FI=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzd8XWSGzuJpT9DDjXOdleOH373fncD4l0hzy2ZD83GTwJ0WyGZ
WKXuGc7StiNPYvrZHN7W/iQdriUbaE8sp5FL7AnLRSVHCcbeEXkAaZXINBZMlMEYY2y+MySyCV4
GzOeM2Q==
X-Google-Smtp-Source: AGHT+IEkmdmlhxkvvno3PR4WzLdHB4CTjnz10V2ZdnBYVgAxNWQfyn5XDRSLEqyR+GWL3cZrVs8zuw5Pz+4=
X-Received: from pjc16.prod.google.com ([2002:a17:90b:2f50:b0:2fb:fa85:1678])
(user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4b09:b0:313:2adc:b4c4
with SMTP id 98e67ed59e1d1-31347678bbcmr5190417a91.24.1749215721138; Fri, 06
Jun 2025 06:15:21 -0700 (PDT)
Date: Fri, 6 Jun 2025 06:15:19 -0700
In-Reply-To: <20250606104945.GY39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
Mime-Version: 1.0
References: <20250506133234.GH4356@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<vukrlmb4kbpcol6rtest3tsw4y6obopbrwi5hcb5iwzogsopgt@sokysuzxvehi>
<20250528074452.GU39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20250528163035.GH31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<20250528163557.GI31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20250529093017.GJ31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<fp5amaygv37wxr6bglagljr325rsagllbabb62ow44kl3mznb6@gzk6nuukjgwv>
<eegs5wq4eoqpu5yqlzug7icptiwzusracrp3nlmjkxwfywzvez@jngbkb3xqj6o>
<4z4fhaqesjlevwiugiqpnxdths5qkkj7vd4q3wgdosu4p24ppl@nb6c2gybuwe5> <20250606104945.GY39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Message-ID: <aELptV62mbTC3YA9@xxxxxxxxxx>
Subject: Re: [PATCH v2 00/13] objtool: Detect and warn about indirect calls in
__nocfi functions
From: Sean Christopherson <seanjc@xxxxxxxxxx>
To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, x86@xxxxxxxxxx,
kys@xxxxxxxxxxxxx, haiyangz@xxxxxxxxxxxxx, wei.liu@xxxxxxxxxx,
decui@xxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, bp@xxxxxxxxx,
dave.hansen@xxxxxxxxxxxxxxx, pbonzini@xxxxxxxxxx, ardb@xxxxxxxxxx,
kees@xxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>, gregkh@xxxxxxxxxxxxxxxxxxx,
linux-hyperv@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
kvm@xxxxxxxxxxxxxxx, linux-efi@xxxxxxxxxxxxxxx, samitolvanen@xxxxxxxxxx,
ojeda@xxxxxxxxxx, xin@xxxxxxxxx
Content-Type: text/plain; charset="us-ascii"
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025, Peter Zijlstra wrote:
> On Thu, Jun 05, 2025 at 10:19:41AM -0700, Josh Poimboeuf wrote:
> > diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S
> > index 29c5c32c16c3..5d1eef193b79 100644
> > --- a/arch/x86/entry/entry_64_fred.S
> > +++ b/arch/x86/entry/entry_64_fred.S
> > @@ -112,11 +112,12 @@ SYM_FUNC_START(asm_fred_entry_from_kvm)
> > push %rax /* Return RIP */
> > push $0 /* Error code, 0 for IRQ/NMI */
> >
> > - PUSH_AND_CLEAR_REGS clear_bp=0 unwind_hint=0
> > + PUSH_AND_CLEAR_REGS clear_callee=0 unwind_hint=0
> > movq %rsp, %rdi /* %rdi -> pt_regs */
> > call __fred_entry_from_kvm /* Call the C entry point */
> > - POP_REGS
> > - ERETS
> > + addq $C_PTREGS_SIZE, %rsp
> > +
> > + ALTERNATIVE "mov %rbp, %rsp", __stringify(ERETS), X86_FEATURE_FRED
>
> So... I was wondering.. do we actually ever need the ERETS?

Yes, to unblock NMIs, because NMIs are blocked on VM-Exit due to NMI.

The !X86_FEATURE_FRED path can use RET (instead of IRET) because NMIs are routed
through vmx_do_nmi_irqoff(), as proposed in this version[*], after you pointed out
that the FRED entry doesn't have the legacy NMI madness.

[*] https://lore.kernel.org/all/aBUiwLV4ZY2HdRbz@xxxxxxxxxx


Return-Path: <linux-kernel+bounces-675795-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0A1B341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:17:16 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7215A7A1D29
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:15:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CA0028852E;
Fri, 6 Jun 2025 13:17:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=santannapisa.it header.i=@santannapisa.it header.b="Dv535wNa"
Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11020117.outbound.protection.outlook.com [52.101.84.117])
(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 CDEB6288C0B
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:17:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.84.117
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215826; cv=fail; b=FykwgNFKU6hczE/WpvE74RWFQvSWBtXgD3jxd6ZS1CSJsVmN8+zXmD9mJWuKcmtGpPAz8AHOy9QmXMVlf6lowJfUW2wlr/GQj7gWLfiUQ6nzZ0ScQ0uNwqlgJthO6O7AQBpnv1EQ91b6hvKV2vo24L76+CO9HAdXVCGYlyvvZaQ=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215826; c=relaxed/simple;
bh=XdfvOIs5+WlmXw83xKb0rDejCHr69Hz+aMCFb1RLkbE=;
h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:
Content-Type:MIME-Version; b=hSRoLiiXL6pV7zx9srkpfv0ZgaeSojm2AAPyFK/gWsDSnhm//q692L8oHQdMagIAu0frtDlUh3RCsvm6EGefkFrnsYLMjQ/R/yppyyxNzpnjNcDNtn6JCvfHGUewR3vbkr7fZUpOT4YrcfqDnhedbv3J91QWSK44udoYhIV9DxU=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=santannapisa.it; spf=pass smtp.mailfrom=santannapisa.it; dkim=pass (1024-bit key) header.d=santannapisa.it header.i=@santannapisa.it header.b=Dv535wNa; arc=fail smtp.client-ip=52.101.84.117
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=santannapisa.it
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=santannapisa.it
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=YsyXYX1iQswpIHvbKFj4QUTJJLGfp9auj1nGR8CgUVYHg2n6FY+w8egOYe+BWDZlqsNxBK5SLPvphOALbvkTJy+QeiGElXnf7H2VYN5XDeCmmvGfzAKmWmSxvYUixNYUXQOrqJXHAG50gNXIFHl/MS7k/5hI/UV/HkrG5Gu1P50FyIhUQNQ7BYgRrA8q4v3SG0BJfXrfCzaW6yzN43Q/vHnAJdYkMARgOIssNgHh08WoI92dmnAmF8qTjdE+I6Pjw3y3gVJhLZ1dqJdNcv8FqhU0fR4DPKm7LdfnrreZKqDY0b7YGp8Ozz7uhZVxFjqXQ9Svu1YwOepcCeU5xkuo7w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=o6mW5RAxU7SbrACRpWC0pqJ5YOJpCz1n5CmeGBI8Elc=;
b=LZgNEplTgbOlM8oRwJyJbs+6XJAUnYuTRNga/EFbo+74TE3n5LrYDrtuttO6GroeqnsZHxDlumi4GpSLuogkKmVa6UEP9/mzH65wLdvNDfBktPN4t9qDLFg93/kFvwDvIV+XrzXzCFErEM9LxZWiO+n82b8CHu1HPEeWBtbREUlbM5wQ6qz42+e3bqOSVXUqFHY5896lBvqkzuMchwH02RXP4Xk3r8T8hqdjxdX/VsxiGM0yADxxynxQ04rCDFfQuOtkJQnOqN2WjQjyafrNinFXtPN6pIRLCbZPr3iDZSFOjKIG88r3Y4zr3XjMpx5CqeQncLt6chnjHvEqtFklmw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=santannapisa.it; dmarc=pass action=none
header.from=santannapisa.it; dkim=pass header.d=santannapisa.it; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=santannapisa.it;
s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=o6mW5RAxU7SbrACRpWC0pqJ5YOJpCz1n5CmeGBI8Elc=;
b=Dv535wNaFOAqYhICKc2eELr4dxgzDtxVa5UqBbUKXqF/rGuEyqyiGs0YEwIpTj4P/p04HpABUiP/A6G6WeHedb6Ff3q5Qhqb2Zge6Zs7VTkGaIx83TkPlKpsSaX3Mv4/7fKvK/gFXlb7RvZmRosaoWmcEanVp4VgAFQ6+RdkcTE=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=santannapisa.it;
Received: from PAVPR03MB8969.eurprd03.prod.outlook.com (2603:10a6:102:32e::7)
by VI0PR03MB10283.eurprd03.prod.outlook.com (2603:10a6:800:1b8::17) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 13:16:57 +0000
Received: from PAVPR03MB8969.eurprd03.prod.outlook.com
([fe80::6bbe:2e22:5b77:7235]) by PAVPR03MB8969.eurprd03.prod.outlook.com
([fe80::6bbe:2e22:5b77:7235%6]) with mapi id 15.20.8813.018; Fri, 6 Jun 2025
13:16:57 +0000
Date: Fri, 6 Jun 2025 15:16:52 +0200
From: luca abeni <luca.abeni@xxxxxxxxxxxxxxx>
To: Marcel Ziswiler <marcel.ziswiler@xxxxxxxxxxxxxxx>
Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Ingo
Molnar <mingo@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Vineeth
Pillai <vineeth@xxxxxxxxxxxxxxx>
Subject: Re: SCHED_DEADLINE tasks missing their deadline with
SCHED_FLAG_RECLAIM jobs in the mix (using GRUB)
Message-ID: <20250606151652.1c9e9988@nowhere>
In-Reply-To: <84b4ab9d1402e4308bf4738e2c53203975ab855a.camel@xxxxxxxxxxxxxxx>
References: <ce8469c4fb2f3e2ada74add22cce4bfe61fd5bab.camel@xxxxxxxxxxxxxxx>
<aBTO3r6Py_emwf1Y@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<f532441d8b3cf35e7058305fd9cd3f2cbd3a9fac.camel@xxxxxxxxxxxxxxx>
<20250507222549.183e0b4a@nowhere>
<92690eb9158c1019dc0945f8298800cad17cae05.camel@xxxxxxxxxxxxxxx>
<20250523214603.043833e3@nowhere>
<c91a117401225290fbf0390f2ce78c3e0fb3b2d5.camel@xxxxxxxxxxxxxxx>
<20250530112108.63a24cde@luca64>
<84b4ab9d1402e4308bf4738e2c53203975ab855a.camel@xxxxxxxxxxxxxxx>
Organization: Scuola Superiore Sant'Anna
X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-ClientProxiedBy: MR1P264CA0195.FRAP264.PROD.OUTLOOK.COM
(2603:10a6:501:57::7) To PAVPR03MB8969.eurprd03.prod.outlook.com
(2603:10a6:102:32e::7)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAVPR03MB8969:EE_|VI0PR03MB10283:EE_
X-MS-Office365-Filtering-Correlation-Id: 503ff8d5-2402-47f7-e582-08dda4fc69e9
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7053199007;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?SGN6cDJLeG5ya0RiVDhrVk9vWmtyYnJGVkZ2UkpDOW16VlFnTmcvY1dXSlNY?=
=?utf-8?B?cGpGbWJhVUQ4WnFIb2YvNjlmWkV3VCszK3FpY3lWekVFcHpBWlYwOWx0WS95?=
=?utf-8?B?V0ZsUkFUQ1JPeFh0MUx2RU85SEpNQTJ2TzEzcnBXZEUzc2xNRzJjOG9JVTUy?=
=?utf-8?B?c29GRjNsNXFRUkNPWFFXQVRoY0VpeWlicmhrVnUzTGlaZUREV3pHaGN4alZi?=
=?utf-8?B?aHdBMC8yd0F5dWVEbnZDYWFPVEROMmQ0ZWpGMTNWMG5YdnBQczZlTkljVlVS?=
=?utf-8?B?S3Z5QWF0aWY0ei9RYjg0ZHJwaWl3cjlCZStpaEgyV0xyYXFyenZLTXpSVTNs?=
=?utf-8?B?bS9qWk94SURzZnlFQnY2b2lQVUJXVUpoVHVaaTJFYS90RXUza0dDUXRHOW5E?=
=?utf-8?B?KzUvd1ZEMWNFMzhkTEhRQnI2Unlmb0pUR1A1MFg0Y1FaQmZLM0E0YmpHVUl3?=
=?utf-8?B?T0MxdzZpakRpZFp3ZzhXYWhCdFovc0NrUkJMOHBtbmhyNTFPbThmbmlNZmNY?=
=?utf-8?B?U29xRDFaZmNSblNSYkYraGwzYm0rYVo1ZzdEUGgySmc1azdWN2hSVFJpV2FG?=
=?utf-8?B?WlZNUDhSeFU1aHdJVSswdVJYK0JmZFFkbWpOQ1pJWWpRVHM3VE05OHQ3OE9m?=
=?utf-8?B?SVllam5NK21OaW1JaW5jU0xrWUM5S09xa0UwOTZuaDdrcXEyVWdwcmpCUUUz?=
=?utf-8?B?dC8rYWhwMjJWd3dMWm5STmRjemdrSGpUOFNzblRabmZndFJxUXk3R21Ub1VR?=
=?utf-8?B?bjlSSGUzeW1FN0xmSDdJT1RFY0xtY25Ya3ZZbWsxVkdMdDRXY3VOMENzMTBS?=
=?utf-8?B?c2JOV3hsLzJlMVdtTGtuYW43VzFkNGdzM21vOFdPUWYyeWl5SUJOU2lGQ3FE?=
=?utf-8?B?aHNKUGhXbENycTh6L2lPV2lsWWJjYmhuQ2V0ZEx4dDZzMU9MajhDRFpzenQ5?=
=?utf-8?B?VERRQWwrU1djajZCanVhUDdUdEovSGMrYWRYV1RMdjVQSG1SdS9xMEUyQkFx?=
=?utf-8?B?UUZnQjJBNmd1dDBZQWVLc2t2SDhyUWtNOWkyczJ0VUZTSzBlL0lVMXQ3V1lw?=
=?utf-8?B?dGtiaHJxY0s4ZTBGaTlMQTBheHA4UEtJV3NvV0gyanU2K2xNTnNpQ3JYV1ZZ?=
=?utf-8?B?RDl3aGNQMDZ6UGFaOVJRWTNod2t1bjFqWUhYa0lVL3BXNG1YQTM4WGdMZ3lB?=
=?utf-8?B?ME5WendrbzkvQ1QvbXcwcGpUdGZiOWd2TkR0UEdZUGZwWll0bm5rYVBpaUk4?=
=?utf-8?B?TTMrWVZ0VklqYnBZNGwrNWxHZ0kxUXN6S0syZEs0VVk2RlFQRmY0SUN0N05K?=
=?utf-8?B?bm1rbEZnUlRORXdqa0ZxVnhSOUFvWXhHT0Vlc2dnNkRFazZxeWdGRWduUFBD?=
=?utf-8?B?STBWSktzVnI5SDI4SHBMbkp1N1dFdllUN0M3TVgxc0I2bG5KUUVYOWpmTGNL?=
=?utf-8?B?NjNOSHFaNmx6aXl3dU1KWDgrNWJXMm56V2U5RnRyUU1Qb3dwRWNnMTl3L0w0?=
=?utf-8?B?anR0YUlQeXRrWVd3dDFQRHVHVnVuNDN4aXBHRklSd0h2dGwzWjYwR0drVmQy?=
=?utf-8?B?WkIrVFhXV1o0dlRrYnloMGVkR1MwcE5PWXRKM2ttdWVwdXBCbkZTRFlIaXpa?=
=?utf-8?B?bEprNExJblFBUXNTeVBpUjRzdWtPV2FZa2JaandtTzRRYlFKSUZuaGhKZGha?=
=?utf-8?B?UE1ZYmVzS1NSSEhEb0RlZFV5Mlg3VnJ5UStYUnRLZ0pMaThuQUZpWk90VzBz?=
=?utf-8?B?RGE2bEN2VGs2U3BScGtWVjNaUStxMTc1aEV0Q0JycTFIczFXTTRvOXlmRzc5?=
=?utf-8?B?SE1JSlBtR0VUaFZMR0xTRmNlUmZNMUxIZzZsS3BQN0FVejl2TDJERjNRU2Rv?=
=?utf-8?B?RnFrMlg2NkJPcE43bTFOdWc2TkloUmZtU1F5OE1pOFZzZnVNRjdIdDdrRmRl?=
=?utf-8?Q?lO8H5pbDvqI=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAVPR03MB8969.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7053199007);DIR:OUT;SFP:1102;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?NEFaZHlJdmkyNjlUK29yVXNkdGJJN3ZmUytzcWFURVMvb3JDK0ZBaU1OZDc1?=
=?utf-8?B?N3haVjZERDlWdWdFR0M4eFdNUnRuemFxQldLSXpuY3NGSnFMSjZzbnNDNjNz?=
=?utf-8?B?WUVrZ0NvVGVuZ3U3OWc1M2tEdWpKOXQrUkUvSTBNdWF6aG9HNUd6a25Oc2pi?=
=?utf-8?B?T0dGczRyVDN2cHJjaEU3MWRPNGdBd3J1VDJneUQ2a04zYi9WYWJ3VmN3NW9t?=
=?utf-8?B?eHVDdEw0SFY0NFRHcU5nSDNBMFJPaVRrZFlpQm4vK0NLMlhOTjNuY2Vnc1lT?=
=?utf-8?B?eXdSbWQwa1NCM1RCOE1UYTloZXBvUUZhblVXbzJiYk1OMmllWFl0N2FyZ0h5?=
=?utf-8?B?ZlJOd2thMGtRemMxcmZlZ3lLSTdycW9ySGlRMG84WU4wdWF2NE9BZEZDU2VQ?=
=?utf-8?B?NWE0WlVXelUzU3lISEk1NWhUNHdmQXowdkQ5cllaMnBmRWxOVmduc2JzbDBq?=
=?utf-8?B?bmlWenFVWEdwSUt6d3FVakRxMm84MFFTcEZtMnovU3dnenNRQWRySVpCRXFu?=
=?utf-8?B?WmhQU1JhQlBON1hVWTFqTE1NSjVzNnFFaU9vY1JDR3pQTDd2d2JFc0w5Rzhp?=
=?utf-8?B?d0FWWUxyR2d4RlZOSU9lZDFOajdRY0U3ZHdyek9XVmRNYUdOcmZVRlJFRi80?=
=?utf-8?B?NWlJSjluZ3Iyb2dPRVZiNk8zbURqVGEzUmVpUTU5K01WcnBKZktPd2l1ZWJM?=
=?utf-8?B?RU9HWGd1c1R5ZVBWajUxVHVFUmpWc2Z5bmNzcys3c29MeXUzeHF3bUlueFVJ?=
=?utf-8?B?b1g2RmgvRlc3dE1QNFZxOGs4Ni94bVJpeHQybWd2dFlGUFZOYXQ5WXJxU2gw?=
=?utf-8?B?WnlWNEtmNVkwa00yaGMxbkc0dXAzODBJWnZTRG5HMVB0N2xaLzMxMEcwenNT?=
=?utf-8?B?ZFRESUVBaG1FQ2hyVE9UeExadWZVM1dyVC83aG5HQ1JNVzJnVVZZd2NVWEwx?=
=?utf-8?B?emZHZ3FqY1pkOE4zaE5LYWhsZGEzNVIvaHliVnFlUzFkMytDRFkrUWVOSFRh?=
=?utf-8?B?YjhGUkErZDBsVmZxaTVjcHlSeG1FTW1OZm1lWjlheXpKU2toeUR5em1NbGxU?=
=?utf-8?B?Y1JmVG16R2FRQ3RwSnJKaVNYM25yMGwrTTB3QWtaeG43YmRWQ0MxR3AyTUI3?=
=?utf-8?B?OVlNZXlGeVhZU0VHaXlXR05rTXFzblRjZnZrNTNrVERlTER6dTRtazMzNzFO?=
=?utf-8?B?TWtSajQ3KzBDWmtyc0tFd1lvSFMxVGJrZjhTcnBQZDl2NDdUdllDUEgvNDF0?=
=?utf-8?B?SFlKS1hXQUlPRUVjQ21VMDBFWE9yNlg4MjlyZTNodHBabzVVQ3pjMlFzUys5?=
=?utf-8?B?eXVSamZjYlovSnNrR2wwMGFVTlIrNit5WEIycTJUVE1GTkQ0Q0VWTlI5Nkd2?=
=?utf-8?B?OEJRV3BNMzBXTlhXWFF5VWZhZHNRMHpnVWhNbjVKSG4vTi9EREtLR1RIMEcz?=
=?utf-8?B?T2FqWGdoQkJ2aDcwNE9tNTF6UjltR3NxV2N5bXZpZjI2K0FseENlcGlGcVYx?=
=?utf-8?B?dUJWaVBEeDQvWHc4ZUM0SXpIWlZFdVNrVlUveUFObFBNN2NrWW1ueEVhRW5Q?=
=?utf-8?B?VENHY1dTZGJtaGZCbG5keUVNSEZpenhTbGRjeHdkNHpSbjJTR2VpRUFqdXEz?=
=?utf-8?B?T2E1S1htejdpYmVLZkQzaDc5Y0pzTFNMR0NBY3hpVVJLZ3p0WnlWa0Z1K0h3?=
=?utf-8?B?N1Z5Wk5OMXhnMTE5YjVKbVg0a05RcE1ra3h2YnF1TkZGQmR2YmQ0V3pFTjgz?=
=?utf-8?B?d1praDJ3ZHVOUUFoS0k4cFZ4UVJBNHBuMSt5RU0rLzM4R0R1SEI5RVZ0cHBw?=
=?utf-8?B?TWxvNjNZNUM2N096Q0lzUkNZcy9yQk51WFp5V2RrL1ByVkt6SkhwR0VOaVd3?=
=?utf-8?B?S3NjNmY4R0FBQy93K0FmUExBUTNyWG11TUxNS2JJWWplY2pqaXlwUGo1KzZZ?=
=?utf-8?B?QzF6diswV2dWaXdsYitDWG8yTVZrMU1jWm4xWUNKbENjaFFrb0d3Y2lFbU1r?=
=?utf-8?B?WENZeXh3V3cvaEoxY1BjRHZkbzZOdlpsMzZFRnQ1ckNwdXhYdC9SY0NmSyty?=
=?utf-8?B?NndIdW5LeS9jU0VDOXZmWW16dFBkSXRPQksvT2dGTUp1RnFaWUtSOVNUV0NP?=
=?utf-8?B?a1Q3WDVFdnNvUGluTjd1SDNmdDhFTnlBNmhwTnNwVkhCcE9CM2F1MlJrUFdl?=
=?utf-8?B?ZkE9PQ==?=
X-OriginatorOrg: santannapisa.it
X-MS-Exchange-CrossTenant-Network-Message-Id: 503ff8d5-2402-47f7-e582-08dda4fc69e9
X-MS-Exchange-CrossTenant-AuthSource: PAVPR03MB8969.eurprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 13:16:57.3408
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: d97360e3-138d-4b5f-956f-a646c364a01e
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: WFGlw6cjC6kcqdzAMcCXq/9Ab2IRnbkq827bAE+KXU9EgL6yGNhmyFPQQZDtV1t4JKlg5ECj3oiMn/jf8b+9y3/7Pri/q24wgtoO84h9bQM=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR03MB10283
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Marcel,

I am still having issues in reproducing your setup with cgroup v2
(maybe it depends on the systemd version, I do not know), but I ran
some experiments using cgroup v1... Here are some ideas:
- When using reclaiming, the core load can become very high (reaching
95%)... This can increase the CPU temperature, and maybe some thermal
throttling mechanism slows it down to avoid overheating? (this
happened one time to me when replicating your setup). This would
explain some missed deadlines
- Related to this... You probably already mentioned it, but which kind
of CPU are you using? How is frequency scaling configured? (that is:
which cpufreq governor are you using?)
- Another random idea: is it possible that you enabled reclaiming only
for some of the SCHED_DEADLINE threads running on a core? (and
reclaiming is maybe disabled for the thread that is missing
deadlines?)

Also, can you try lowering the value of
/proc/sys/kernel/sched_rt_runtime_us and check if the problem still
happens?



Thanks,
Luca
On Tue, 03 Jun 2025 13:18:23 +0200
Marcel Ziswiler <marcel.ziswiler@xxxxxxxxxxxxxxx> wrote:

> Hi Luca
>=20
> Thank you very much!
>=20
> On Fri, 2025-05-30 at 11:21 +0200, luca abeni wrote:
> > Hi Marcel,
> >=20
> > On Sun, 25 May 2025 21:29:05 +0200
> > Marcel Ziswiler <marcel.ziswiler@xxxxxxxxxxxxxxx> wrote:
> > [...] =20
> > > > How do you configure systemd? I am having troubles in
> > > > reproducing your AllowedCPUs configuration... This is an
> > > > example of what I am trying: sudo systemctl set-property
> > > > --runtime custom-workload.slice AllowedCPUs=3D1 sudo systemctl
> > > > set-property --runtime init.scope AllowedCPUs=3D0,2,3 sudo
> > > > systemctl set-property --runtime system.slice AllowedCPUs=3D0,2,3
> > > > sudo systemctl set-property --runtime user.slice
> > > > AllowedCPUs=3D0,2,3 and then I try to run a SCHED_DEADLINE
> > > > application with sudo systemd-run --scope -p
> > > > Slice=3Dcustom-workload.slice <application>=C2=A0 =20
> > >=20
> > > We just use a bunch of systemd configuration files as follows:
> > >=20
> > > [root@localhost ~]# cat /lib/systemd/system/monitor.slice
> > > # Copyright (C) 2024 Codethink Limited
> > > # SPDX-License-Identifier: GPL-2.0-only =20
> > [...]
> >=20
> > So, I copied your *.slice files in /lib/systemd/system (and I added
> > them to the "Wants=3D" entry of /lib/systemd/system/slices.target,
> > otherwise the slices are not created), but I am still unable to run
> > SCHED_DEADLINE applications in these slices. =20
>=20
> We just link them there e.g.
>=20
> [root@localhost ~]# ls -l
> /etc/systemd/system/slices.target.wants/safety1.slice lrwxrwxrwx 1
> root root 37 Nov 10 2011
> /etc/systemd/system/slices.target.wants/safety1.slice ->
> /usr/lib/systemd/system/safety1.slice
>=20
> BTW: /lib is just sym-linked to /usr/lib in our setup.
>=20
> > This is due to the fact that the kernel does not create a new root
> > domain for these cpusets (probably because the cpusets' CPUs are not
> > exclusive and the cpuset is not "isolated": for example,
> > /sys/fs/cgroup/safety1.slice/cpuset.cpus.partition is set to
> > "member", not to "isolated"). =20
>=20
> Not sure, but for me it is indeed root e.g.
>=20
> [root@localhost ~]# cat
> /sys/fs/cgroup/safety1.slice/cpuset.cpus.partition root
>=20
> > So, the "cpumask_subset(span, p->cpus_ptr)" in
> > sched_setsched() is still false and the syscall returns -EPERM.
> >=20
> >=20
> > Since I do not know how to obtain an isolated cpuset with cgroup v2
> > and systemd, I tried using the old cgroup v1, as described in the
> > SCHED_DEADLINE documentation. =20
>=20
> I would have thought it should not make any difference whether cgroup
> v1 or v2 is used, but then who knows.
>=20
> > This worked fine, and enabling SCHED_FLAG_RECLAIM actually reduced
> > the number of missed deadlines (I tried with a set of periodic
> > tasks having the same parameters as the ones you described). So, it
> > looks like reclaiming is working correctly (at least, as far as I
> > can see) when using cgroup v1 to configure the CPU partitions...
> > Maybe there is some bug triggered by cgroup v2, =20
>=20
> Could be, but anyway would be good to also update the SCHED_DEADLINE
> documentation to cgroup v2.
>=20
> > or maybe I am misunderstanding your setup. =20
>=20
> No, there should be nothing else special really.
>=20
> > I think the experiment suggested by Juri can help in understanding
> > where the issue can be. =20
>=20
> Yes, I already did all that and hope you guys can get some insights
> from that experiment.
>=20
> And remember, if I can help in any other way just let me know. Thanks!
>=20
> > Thanks,
> > Luca
> >=20
> > =20
> > > [Unit]
> > > Description=3DPrioritized slice for the safety monitor.
> > > Before=3Dslices.target
> > >=20
> > > [Slice]
> > > CPUWeight=3D1000
> > > AllowedCPUs=3D0
> > > MemoryAccounting=3Dtrue
> > > MemoryMin=3D10%
> > > ManagedOOMPreference=3Domit
> > >=20
> > > [Install]
> > > WantedBy=3Dslices.target
> > >=20
> > > [root@localhost ~]# cat /lib/systemd/system/safety1.slice
> > > # Copyright (C) 2024 Codethink Limited
> > > # SPDX-License-Identifier: GPL-2.0-only
> > > [Unit]
> > > Description=3DSlice for Safety case processes.
> > > Before=3Dslices.target
> > >=20
> > > [Slice]
> > > CPUWeight=3D1000
> > > AllowedCPUs=3D1
> > > MemoryAccounting=3Dtrue
> > > MemoryMin=3D10%
> > > ManagedOOMPreference=3Domit
> > >=20
> > > [Install]
> > > WantedBy=3Dslices.target
> > >=20
> > > [root@localhost ~]# cat /lib/systemd/system/safety2.slice
> > > # Copyright (C) 2024 Codethink Limited
> > > # SPDX-License-Identifier: GPL-2.0-only
> > > [Unit]
> > > Description=3DSlice for Safety case processes.
> > > Before=3Dslices.target
> > >=20
> > > [Slice]
> > > CPUWeight=3D1000
> > > AllowedCPUs=3D2
> > > MemoryAccounting=3Dtrue
> > > MemoryMin=3D10%
> > > ManagedOOMPreference=3Domit
> > >=20
> > > [Install]
> > > WantedBy=3Dslices.target
> > >=20
> > > [root@localhost ~]# cat /lib/systemd/system/safety3.slice
> > > # Copyright (C) 2024 Codethink Limited
> > > # SPDX-License-Identifier: GPL-2.0-only
> > > [Unit]
> > > Description=3DSlice for Safety case processes.
> > > Before=3Dslices.target
> > >=20
> > > [Slice]
> > > CPUWeight=3D1000
> > > AllowedCPUs=3D3
> > > MemoryAccounting=3Dtrue
> > > MemoryMin=3D10%
> > > ManagedOOMPreference=3Domit
> > >=20
> > > [Install]
> > > WantedBy=3Dslices.target
> > >=20
> > > [root@localhost ~]# cat /lib/systemd/system/system.slice=20
> > > # Copyright (C) 2024 Codethink Limited
> > > # SPDX-License-Identifier: GPL-2.0-only
> > >=20
> > > #
> > > # This slice will control all processes started by systemd by
> > > # default.
> > > #
> > >=20
> > > [Unit]
> > > Description=3DSystem Slice
> > > Documentation=3Dman:systemd.special(7)
> > > Before=3Dslices.target
> > >=20
> > > [Slice]
> > > CPUQuota=3D150%
> > > AllowedCPUs=3D0
> > > MemoryAccounting=3Dtrue
> > > MemoryMax=3D80%
> > > ManagedOOMSwap=3Dkill
> > > ManagedOOMMemoryPressure=3Dkill
> > >=20
> > > [root@localhost ~]# cat /lib/systemd/system/user.slice=20
> > > # Copyright (C) 2024 Codethink Limited
> > > # SPDX-License-Identifier: GPL-2.0-only
> > >=20
> > > #
> > > # This slice will control all processes started by systemd-logind
> > > #
> > >=20
> > > [Unit]
> > > Description=3DUser and Session Slice
> > > Documentation=3Dman:systemd.special(7)
> > > Before=3Dslices.target
> > >=20
> > > [Slice]
> > > CPUQuota=3D25%
> > > AllowedCPUs=3D0
> > > MemoryAccounting=3Dtrue
> > > MemoryMax=3D80%
> > > ManagedOOMSwap=3Dkill
> > > ManagedOOMMemoryPressure=3Dkill
> > > =20
> > > > However, this does not work because systemd is not creating an
> > > > isolated cpuset... So, the root domain still contains CPUs 0-3,
> > > > and the "custom-workload.slice" cpuset only has CPU 1. Hence,
> > > > the check /*
> > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 * Don't allow tasks with an affinity
> > > > mask smaller than
> > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 * the entire root_domain to become
> > > > SCHED_DEADLINE. We
> > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 * will also fail if there's no
> > > > bandwidth available. */
> > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if=
(!cpumask_subset(span, p->cpus_ptr)
> > > > || rq->rd->dl_bw.bw =3D=3D 0) {
> > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 retval =3D -EPERM;
> > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto unlock;
> > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
> > > > in sched_setsched() fails.
> > > >=20
> > > >=20
> > > > How are you configuring the cpusets?=C2=A0 =20
> > >=20
> > > See above.
> > > =20
> > > > Also, which kernel version are you using?
> > > > (sorry if you already posted this information in previous emails
> > > > and I am missing something obvious)=C2=A0 =20
> > >=20
> > > Not even sure, whether I explicitly mentioned that other than
> > > that we are always running latest stable.
> > >=20
> > > Two months ago when we last run some extensive tests on this it
> > > was actually v6.13.6.
> > > =20
> > > > Thanks,=C2=A0 =20
> > >=20
> > > Thank you!
> > > =20
> > > > Luca =20
>=20
> Cheers
>=20
> Marcel



Return-Path: <linux-kernel+bounces-675794-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DA32641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:17:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 83725189C2D7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:16:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D4C17288C9A;
Fri, 6 Jun 2025 13:16:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="0ejGqWVE";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="x+1F+91L";
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="kJqquk8x";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="MPC7hMwc"
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18E5A2882B6
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:16:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749215772; cv=none; b=i6oQBiF7SChG48t2vNorHlbGz5TnMSNNGdpOhPsNLHq28Yg2CjYZOfSFrCCLcWnTFBDOszp0MNuj7Qcql2gwEL/VsZ1i1KUJ32x9n+RulPoqOu3QFVrqCJ1CmQWCq0YK8emaGhfYD0WyIZPsCra3aRL+TdJB3WcmVNpHjjSB+uU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749215772; c=relaxed/simple;
bh=aNAeoahf41PqOn8gTd2tZQFikra1qq7P8aoAmbjBAmE=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=BfFsJptuxbEdmXsI4dRw9NEslxL/jxOfvowAZi/cFeWWJzah7yyahlBiLEmc3d22OTEazG5nXhWPYDcaJtfLreATTF58GAFCF11wfSzErZsFfhfZ04eIbpgIb+bCRXfQID/z74MFL7w66jKCCIBke2ZKIqMBvrYZFtHD+5kFMk0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=0ejGqWVE; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=x+1F+91L; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=kJqquk8x; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=MPC7hMwc; arc=none smtp.client-ip=195.135.223.130
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz
Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by smtp-out1.suse.de (Postfix) with ESMTPS id 3BB7B336B7;
Fri, 6 Jun 2025 13:16:08 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749215769; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=li2hhM0PVmESxCRoYcjpQzsbFhjZduZXOZsG1l3eIuE=;
b=0ejGqWVEwf47lGKmWrHoTCdDFkx0TqT6z0IY1TQUC9yTVOhbqwaZaqAMqRcXI5EdA9lqiX
JFFxRocCNRDCYA5OLLDBCKvDScWhj9Fbwl19bxNe2GgPhjBRnpxEiUGri7tMGUBKXkD1F9
TFMGL9au1ZW02oGdnOtxBwYqBpo5W1k=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749215769;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=li2hhM0PVmESxCRoYcjpQzsbFhjZduZXOZsG1l3eIuE=;
b=x+1F+91LL38DEWByOEObnXkKLtUfshj131gBU06Q49T4zKttG3GA8Qut8Wr7PVV8CzrHFg
Szx7d3JBzLfndbDw==
Authentication-Results: smtp-out1.suse.de;
none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749215768; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=li2hhM0PVmESxCRoYcjpQzsbFhjZduZXOZsG1l3eIuE=;
b=kJqquk8xS6TgM53steRf7SQcAJ65YwGmd3MRhq7UMkqrjBezr9TOCHjIkm6+dkvFkjCFPp
v8yrasRbdHYdzng9FmuLFtDB5s5aFl0hw3hv+gUKNdKPGhogJnik0O853d0o4lr6lFMeII
1jgJSkgnkGOgdhGUbDiiNYdMFU8iWHE=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749215768;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=li2hhM0PVmESxCRoYcjpQzsbFhjZduZXOZsG1l3eIuE=;
b=MPC7hMwc5B42bCwyMmJkRDkbKbqfJQ90TO+aC2bKpS8WCuZHcGvLHUrzaFSxbun+I2yEUM
itb0Sy3Oj/bfV7Cg==
Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2EA7E1336F;
Fri, 6 Jun 2025 13:16:08 +0000 (UTC)
Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
by imap1.dmz-prg2.suse.org with ESMTPSA
id sQtfCxjqQmjFdgAAD6G6ig
(envelope-from <jack@xxxxxxx>); Fri, 06 Jun 2025 13:16:08 +0000
Received: by quack3.suse.cz (Postfix, from userid 1000)
id C95B4A0951; Fri, 6 Jun 2025 15:16:07 +0200 (CEST)
Date: Fri, 6 Jun 2025 15:16:07 +0200
From: Jan Kara <jack@xxxxxxx>
To: Zhang Yi <yi.zhang@xxxxxxxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>, linux-ext4@xxxxxxxxxxxxxxx,
linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, tytso@xxxxxxx,
adilger.kernel@xxxxxxxxx, ojaswin@xxxxxxxxxxxxx, yi.zhang@xxxxxxxxxx, libaokun1@xxxxxxxxxx,
yukuai3@xxxxxxxxxx, yangerkun@xxxxxxxxxx
Subject: Re: [PATCH 1/5] ext4: restart handle if credits are insufficient
during writepages
Message-ID: <uruplwi35qaajr3cqyozq7dpbwgqehuzstxpobx44retpek6cb@gplmkhlsaofk>
References: <20250530062858.458039-1-yi.zhang@xxxxxxxxxxxxxxx>
<20250530062858.458039-2-yi.zhang@xxxxxxxxxxxxxxx>
<byiax3ykefdvmu47xrgrndguxabwvakescnkanbhwwqoec7yky@dvzzkic5uzf3>
<3aafd643-3655-420e-93fa-25d0d0ff4f32@xxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <3aafd643-3655-420e-93fa-25d0d0ff4f32@xxxxxxxxxxxxxxx>
X-Spamd-Result: default: False [-3.80 / 50.00];
BAYES_HAM(-3.00)[100.00%];
NEURAL_HAM_LONG(-1.00)[-1.000];
MID_RHS_NOT_FQDN(0.50)[];
NEURAL_HAM_SHORT(-0.20)[-1.000];
MIME_GOOD(-0.10)[text/plain];
DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];
RCVD_COUNT_THREE(0.00)[3];
FROM_HAS_DN(0.00)[];
ARC_NA(0.00)[];
RCPT_COUNT_TWELVE(0.00)[12];
MIME_TRACE(0.00)[0:+];
FUZZY_BLOCKED(0.00)[rspamd.com];
RCVD_TLS_LAST(0.00)[];
TO_MATCH_ENVRCPT_ALL(0.00)[];
FROM_EQ_ENVFROM(0.00)[];
TO_DN_SOME(0.00)[];
RCVD_VIA_SMTP_AUTH(0.00)[];
MISSING_XM_UA(0.00)[];
DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo]
X-Spam-Level:
X-Spam-Score: -3.80
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri 06-06-25 14:54:21, Zhang Yi wrote:
> On 2025/6/5 22:04, Jan Kara wrote:
> >> + /*
> >> + * The credits for the current handle and transaction have
> >> + * reached their upper limit, stop the handle and initiate a
> >> + * new transaction. Note that some blocks in this folio may
> >> + * have been allocated, and these allocated extents are
> >> + * submitted through the current transaction, but the folio
> >> + * itself is not submitted. To prevent stale data and
> >> + * potential deadlock in ordered mode, only the
> >> + * dioread_nolock mode supports this.
> >> + */
> >> + if (err > 0) {
> >> + WARN_ON_ONCE(!ext4_should_dioread_nolock(inode));
> >> + mpd->continue_map = 1;
> >> + err = 0;
> >> + goto update_disksize;
> >> + }
> >> } while (map->m_len);
> >>
> >> update_disksize:
> >> @@ -2467,6 +2501,9 @@ static int mpage_map_and_submit_extent(handle_t *handle,
> >> if (!err)
> >> err = err2;
> >> }
> >> + if (!err && mpd->continue_map)
> >> + ext4_get_io_end(io_end);
> >> +
> >
> > IMHO it would be more logical to not call ext4_put_io_end[_deferred]() in
> > ext4_do_writepages() if we see we need to continue doing mapping for the
> > current io_end.
> >
> > That way it would be also more obvious that you've just reintroduced
> > deadlock fixed by 646caa9c8e196 ("ext4: fix deadlock during page
> > writeback"). This is actually a fundamental thing because for
> > ext4_journal_stop() to complete, we may need IO on the folio to finish
> > which means we need io_end to be processed. Even if we avoided the awkward
> > case with sync handle described in 646caa9c8e196, to be able to start a new
> > handle we may need to complete a previous transaction commit to be able to
> > make space in the journal.
>
> Yeah, you are right, I missed the full folios that were attached to the
> same io_end in the previous rounds. If we continue to use this solution,
> I think we should split the io_end and submit the previous one which
> includes those full folios before the previous transaction is
> committed.

Yes, fully mapped folios definitely need to be submitted. But I think that
should be handled by ext4_io_submit() call in ext4_do_writepages() loop?

> > Thinking some more about this holding ioend for a folio with partially
> > submitted IO is also deadlock prone because mpage_prepare_extent_to_map()
> > can call folio_wait_writeback() which will effectively wait for the last
> > reference to ioend to be dropped so that underlying extents can be
> > converted and folio_writeback bit cleared.
>
> I don't understand this one. The mpage_prepare_extent_to_map() should
> call folio_wait_writeback() for the current processing partial folio,
> not the previous full folios that were attached to the io_end. This is
> because mpd->first_page should be moved forward in mpage_folio_done()
> once we complete the previous full folio. Besides, in my current
> solution, the current partial folio will not be submitted, the
> folio_writeback flag will not be set, so how does this deadlock happen?

Sorry, this was me being confused. I went through the path again and indeed
if we cannot map all buffers underlying the folio, we don't clear buffer
(and folio) dirty bits and don't set folio writeback bit so there's no
deadlock there.

> > So what I think we need to do is that if we submit part of the folio and
> > cannot submit it all, we just redirty the folio and bail out of the mapping
> > loop (similarly as in ENOSPC case).
>
> After looking at the ENOSPC case again, I found that the handling of
> ENOSPC before we enabling large folio is also wrong, it may case stale
> data on 1K block size. Suppose we are processing four bhs on a dirty
> page. We map the first bh, and the corresponding io_vec is added to the
> io_end, with the unwritten flag set. However, when we attempt to map
> the second bh, we bail out of the loop due to ENOSPC. At this point,
> ext4_do_writepages()->ext4_put_io_end() will convert the extent of the
> first bh to written. However, since the folio has not been committed
> (mpage_submit_folio() submit a full folio), it will trigger stale data
> issue. Is that right? I suppose we also have to write partial folio out
> in this case.

Yes, this case will be problematic actually both with dioread_nolock but
also without it (as in this case we create written extents from the start
and we tell JBD2 to only wait for data IO to complete but not to submit
it). We really need to make sure partially mapped folio is submitted for IO
as well in this case.

> > Then once IO completes
> > mpage_prepare_extent_to_map() is able to start working on the folio again.
> > Since we cleared dirty bits in the buffers we should not be repeating the
> > work we already did...
> >
>
> Hmm, it looks like this solution should work. We should introduce a
> partial folio version of mpage_submit_folio(), call it and redirty
> the folio once we need to bail out of the loop since insufficient
> space or journal credits. But ext4_bio_write_folio() will handle the
> the logic of fscrypt case, I'm not familiar with fscrypt, so I'm not
> sure it could handle the partial page properly. I'll give it a try.

As far as I can tell it should work fine. The logic in
ext4_bio_write_folio() is already prepared for handling partial folio
writeouts, redirtying of the page etc. (because it needs to handle writeout
from transaction commit where we can writeout only parts of folios with
underlying blocks allocated). We just need to teach mpage_submit_folio() to
substract only written-out number of pages from nr_to_write.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR


Return-Path: <linux-kernel+bounces-675796-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 19A6641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:21:12 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3C21217A275
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:21:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B534F288C96;
Fri, 6 Jun 2025 13:21:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qq10DXT2"
Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199])
(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 7479B20330;
Fri, 6 Jun 2025 13:20:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216062; cv=none; b=V09gYCegjAecAepjZhIgLl9IA/C2TYXNsNsIK1W5Aeq1QV2+gLrGHSncGS77YILZOE74gilfXmljcjTF9ZTyrG19LTDgnhGFrjv0Xmkf6KTdYONzOjmYS5p0L30UwvMn6Jk1fXbSHxclSW/KLvSlQAfmkCAJJVtV6/BSxN2cHYs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216062; c=relaxed/simple;
bh=d5xSSZzjIO6YCeawzr4MdDA5aSt61eXqUJbb64Fk4Pk=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=M8ATWoagFE9dvp+Y6g7S+LmFowIV/JUS+qnokcWdI2D65TTJwq8vlly6rL+CFBo6kOXWKxcPlr4tMFbBTRC8zq/Zbdb5H7/KFsbvvMdKGM7sQwHlLDZyhENe8xSY+NW+MZ3pmiGFMc2XAlQx/Kc6zF3uVeiy3qmhE0XxXyiFFYQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=qq10DXT2; arc=none smtp.client-ip=90.155.92.199
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version:
References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:
Content-Transfer-Encoding:Content-ID:Content-Description;
bh=O9FE0uB61EEETNdTWzbNvrnPXytymt6dcwtvq6U/pJk=; b=qq10DXT2GTNSGudV/qtRDEQlfe
DhgZVYdDQH26c5BDbUntvNfTk0AMNNN5xGgDlZ9dH/Sx41XiJ1ieT7AYvnTTve4AU4oCBuQF9jyQd
q6XWBPwWxAk6Jp0Sp6PI4mM9ZPC+CieoW5igq/3W0LNZBKy6BUG+A95PNvHMSWHffELK0a978C+J/
nqtO1ZljIE6SBA8cZM81e+RZb8uENAekGG0Zys36cQxaH9UsaeADuo8flKbNPT55UcykrS1gQsE6q
gW+DpATLTNQ1/O3TuETXsIcemTUsKG2hwD0iDrQb0M1yBKIYVRgEX2rAJrMafi4dLeQ5fxbzmu+aG
UMnuo7UA==;
Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net)
by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux))
id 1uNX04-00000001HLz-0rSj;
Fri, 06 Jun 2025 13:20:48 +0000
Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000)
id 20C8E3005AF; Fri, 6 Jun 2025 15:20:47 +0200 (CEST)
Date: Fri, 6 Jun 2025 15:20:47 +0200
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
To: Sean Christopherson <seanjc@xxxxxxxxxx>
Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>,
x86@xxxxxxxxxx, kys@xxxxxxxxxxxxx, haiyangz@xxxxxxxxxxxxx,
wei.liu@xxxxxxxxxx, decui@xxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx,
mingo@xxxxxxxxxx, bp@xxxxxxxxx, dave.hansen@xxxxxxxxxxxxxxx,
pbonzini@xxxxxxxxxx, ardb@xxxxxxxxxx, kees@xxxxxxxxxx,
Arnd Bergmann <arnd@xxxxxxxx>, gregkh@xxxxxxxxxxxxxxxxxxx,
linux-hyperv@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
kvm@xxxxxxxxxxxxxxx, linux-efi@xxxxxxxxxxxxxxx,
samitolvanen@xxxxxxxxxx, ojeda@xxxxxxxxxx, xin@xxxxxxxxx
Subject: Re: [PATCH v2 00/13] objtool: Detect and warn about indirect calls
in __nocfi functions
Message-ID: <20250606132047.GA39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <vukrlmb4kbpcol6rtest3tsw4y6obopbrwi5hcb5iwzogsopgt@sokysuzxvehi>
<20250528074452.GU39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<20250528163035.GH31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<20250528163557.GI31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<20250529093017.GJ31726@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<fp5amaygv37wxr6bglagljr325rsagllbabb62ow44kl3mznb6@gzk6nuukjgwv>
<eegs5wq4eoqpu5yqlzug7icptiwzusracrp3nlmjkxwfywzvez@jngbkb3xqj6o>
<4z4fhaqesjlevwiugiqpnxdths5qkkj7vd4q3wgdosu4p24ppl@nb6c2gybuwe5>
<20250606104945.GY39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<aELptV62mbTC3YA9@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aELptV62mbTC3YA9@xxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 06:15:19AM -0700, Sean Christopherson wrote:
> On Fri, Jun 06, 2025, Peter Zijlstra wrote:
> > On Thu, Jun 05, 2025 at 10:19:41AM -0700, Josh Poimboeuf wrote:
> > > diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S
> > > index 29c5c32c16c3..5d1eef193b79 100644
> > > --- a/arch/x86/entry/entry_64_fred.S
> > > +++ b/arch/x86/entry/entry_64_fred.S
> > > @@ -112,11 +112,12 @@ SYM_FUNC_START(asm_fred_entry_from_kvm)
> > > push %rax /* Return RIP */
> > > push $0 /* Error code, 0 for IRQ/NMI */
> > >
> > > - PUSH_AND_CLEAR_REGS clear_bp=0 unwind_hint=0
> > > + PUSH_AND_CLEAR_REGS clear_callee=0 unwind_hint=0
> > > movq %rsp, %rdi /* %rdi -> pt_regs */
> > > call __fred_entry_from_kvm /* Call the C entry point */
> > > - POP_REGS
> > > - ERETS
> > > + addq $C_PTREGS_SIZE, %rsp
> > > +
> > > + ALTERNATIVE "mov %rbp, %rsp", __stringify(ERETS), X86_FEATURE_FRED
> >
> > So... I was wondering.. do we actually ever need the ERETS?
>
> Yes, to unblock NMIs, because NMIs are blocked on VM-Exit due to NMI.

Ah, bah, indeed! Shame.


Return-Path: <linux-kernel+bounces-675797-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4D14541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:21:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id D6C29189DC7F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:22:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 22F4C288C96;
Fri, 6 Jun 2025 13:21:49 +0000 (UTC)
Received: from mail-ua1-f48.google.com (mail-ua1-f48.google.com [209.85.222.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EE8320330;
Fri, 6 Jun 2025 13:21:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216108; cv=none; b=W/TAjhpOtPwxPDsweYPMU8HvblMH0MNaQG/dfSXYL3nhxJ/5RdJ+e4IsKdQGtWNXXRskAVL4oLKIS5Kq/yNDkjtNs27W8ijPox58zKOparEJmtKw49c5OqYTqUKiROtzLF04qlR1OyCqaLOcpvqzuP6Np186TNQGFTmgVLtlfCw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216108; c=relaxed/simple;
bh=Zc3hOlE1rh4BeCCJuVCK2t0CTBXnExBS3agU5ssS/Bo=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=gBSE7SbQZadGCzT2dRUi0R3gRPmW7mt6YieGRqHk2ee4NwQ4e+VUsRPr/N2nsOdjohZhrak8qcpLW/bU4qgN/zwHstkLgGldsBbWBfl38C2OBzhfogyJWguAuoVQlKf3mqze/sR3oMJmVjJ+53lhRl9NHvLVNDq1Bh/ESSYHGBI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.222.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ua1-f48.google.com with SMTP id a1e0cc1a2514c-87ec4d69b12so68092241.1;
Fri, 06 Jun 2025 06:21:46 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216105; x=1749820905;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=5SHPgJGpGwWRpAKXV7TD2IvmmZsZIIUaR3p49SfxukY=;
b=cRyjiXPoWB8TvAm/gyw+t1UR/xQdaBg0zdqjEHwOIB1uiX2UNl/sobCFyWIVJSFThR
n65swkSlPUH7+6n5/rwq8zfyi7OtesvSPf4QaGknaZo3y7ug5zlMOcET3saqAKMzx1Q2
iO46eC4x58s6exZ91LgCJ32yMGRDW9PQJgf5yPr+hvHwWqVQG73YjwwE2gfD6qVvOZSE
R0IrQhVAR2sEGKf5cSO7YfyCf71pUk/BaT2j3zP67dzHc4D+ZH0uA60p8c2iN243CSf+
q608IFRSz8NIxZJgPhGNXZZEonEN0h6yL0c9f9AGW6Z8YSLCw2bz69HUR/SEir3OG1nQ
9k3A==
X-Forwarded-Encrypted: i=1; AJvYcCUa2RgczKWthvuwRzVojYyHXr9jhxT6Abow99AIpmaxUhBDgZGtxkJx95hZuhFXuI7TiRE5D8PhwwpO+9b7@xxxxxxxxxxxxxxx, AJvYcCV3XIrnM/XpfEhhZP75ArzVGkS3A9Z6FFcFgoIy0VEgi1WSc8tUOrEvKspFr+P1Pdaw9tVVh2fEMUfn@xxxxxxxxxxxxxxx, AJvYcCV5PID3I/IlZJ1ReMeU2cqNpYheWYQx9YMYu/gM/PiuYFGziwjO8CBkDj+nCfhlT9VulrZ25ae10ERh@xxxxxxxxxxxxxxx, AJvYcCXygsh6zWNPHT0qpVo36TcU9Eq25cHWqXAl0aqwpSKraofDN7N33CfqDobw9BqQyCoks9dbRObzKFt6C/UbXq6mCXc=@vger.kernel.org
X-Gm-Message-State: AOJu0YyHBWdqsjthYPsdQWmvhW3Frks3BocaSmtCDcyC5nKVe0G3QzEY
2gbIPAA36J4GuKhe1GwZcRc1KSi01pEfgDKzgWQCYqIQFDeD0ttSD5SA5ZHR/Ato
X-Gm-Gg: ASbGnctU1ido/mJpYHdo1TB7lvHI9LzwrQXHpGIRrM4G7cn9lcrpvkT730eN4tg++rA
760FYM9xRP+yPV8oTu9h4kGI/cDD5lBbswH24aVEk5B3n7DgdtpSKV66L6ObQmSECE6QH5C9MkB
xBMVz/Zl/SEqQB1MucNSAvDWdmkirxJORel2Egn+d2X7MgHL3lSQCKhkLj0Ja/BnghRs2r/9tnb
DtZnHPhlMi0pw7R0r0Et/lWzrgtQzU7gFpFt1hI/wNj5sDB9hW/a85JU4uyHq0Ea9g748ZapSGB
hq9fw6RJbtbxoavet4wtCKOgLMHnkdGAYUsHONKJ6CaAoIYJQ81aUTdnRBUJSSTTXlfqxpGfT0b
3YdwhN8fTpNnGvkI3x91Ex8rn
X-Google-Smtp-Source: AGHT+IGh9IE7imcdH3O8AsrnNV5dQ13WBR36cIaiMVuHG/0MuHPKcPAAI66x/OVcX8PpJHWDuO34HQ==
X-Received: by 2002:a05:6122:926:b0:530:533c:1f6d with SMTP id 71dfb90a1353d-530e48d2947mr3035897e0c.11.1749216104774;
Fri, 06 Jun 2025 06:21:44 -0700 (PDT)
Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com. [209.85.217.53])
by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-530e63e4170sm1082274e0c.27.2025.06.06.06.21.44
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:21:44 -0700 (PDT)
Received: by mail-vs1-f53.google.com with SMTP id ada2fe7eead31-4e58a9bb8fcso636298137.2;
Fri, 06 Jun 2025 06:21:44 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCU/j72tkcMoZHrbHRNajahiCydA02yBab4ZlljtZh9AcR3mv8w/KpUQLcJ0a8hhJJ9qYvznjK953UqN@xxxxxxxxxxxxxxx, AJvYcCV3BB8neHyXyl/eK51uyR+m4dF3+l78rlA9HjfWHUrkC+LkrjEpnBblgIt8LTlI1Dv5frj8mLdy3mXh/nao92KvkGc=@vger.kernel.org, AJvYcCW4aPvN4UKjqHzsnP3Nt8WhfNJzS36nMYowawg/n1U2xc4HO4KfsrlCDrcgLuePCgOs+9o3D46FQBbvJkMd@xxxxxxxxxxxxxxx, AJvYcCWK37T4By7gLgr27cTBDLr3trp9CATgoNHaRrCrtraITmd33afVPI55P64o2CSghh54QQoi/uWmDDkC@xxxxxxxxxxxxxxx
X-Received: by 2002:a05:6102:1486:b0:4e4:8362:dce9 with SMTP id
ada2fe7eead31-4e7729ad87cmr2873795137.9.1749216104213; Fri, 06 Jun 2025
06:21:44 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250530143135.366417-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> <20250530143135.366417-3-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250530143135.366417-3-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:21:31 +0200
X-Gmail-Original-Message-ID: <CAMuHMdXO1fOODiDA4vQBT=+LKRjT5ZoeewdyPSDoTeeoqUVTSA@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFtvhT3pJFghdGRenMhq10cIBWx14-LLPjr4W6t770WjmYutVYh9IEnSwY0
Message-ID: <CAMuHMdXO1fOODiDA4vQBT=+LKRjT5ZoeewdyPSDoTeeoqUVTSA@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 2/6] dt-bindings: i2c: renesas,riic: Document RZ/T2H support
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Chris Brandt <chris.brandt@xxxxxxxxxxx>, Andi Shyti <andi.shyti@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Magnus Damm <magnus.damm@xxxxxxxxx>, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>,
linux-renesas-soc@xxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Prabhakar,

On Fri, 30 May 2025 at 16:31, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Document support for the I2C Bus Interface (RIIC) found on the Renesas
> RZ/T2H (R9A09G077) SoC. The RIIC IP on this SoC is similar to that on
> the RZ/V2H(P) SoC but supports fewer interrupts, lacks FM+ support and
> does not require resets. Due to these differences, add a new compatible
> string `renesas,riic-r9a09g077` for the RZ/T2H SoC.
>
> Unlike earlier SoCs that use eight distinct interrupts, the RZ/T2H uses
> only four, including a combined error/event interrupt. Update the binding
> schema to reflect this interrupt layout and skip the `resets` property
> check, as it is not required on these SoCs.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
> +++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
> @@ -29,32 +29,46 @@ properties:
> - renesas,riic-r9a09g056 # RZ/V2N
> - const: renesas,riic-r9a09g057 # RZ/V2H(P)
>
> - - const: renesas,riic-r9a09g057 # RZ/V2H(P)
> + - enum:
> + - renesas,riic-r9a09g057 # RZ/V2H(P)
> + - renesas,riic-r9a09g077 # RZ/T2H
>
> reg:
> maxItems: 1
>
> interrupts:
> - items:
> - - description: Transmit End Interrupt
> - - description: Receive Data Full Interrupt
> - - description: Transmit Data Empty Interrupt
> - - description: Stop Condition Detection Interrupt
> - - description: Start Condition Detection Interrupt
> - - description: NACK Reception Interrupt
> - - description: Arbitration-Lost Interrupt
> - - description: Timeout Interrupt
> + oneOf:
> + - items:
> + - description: Transmit End Interrupt
> + - description: Receive Data Full Interrupt
> + - description: Transmit Data Empty Interrupt
> + - description: Stop Condition Detection Interrupt
> + - description: Start Condition Detection Interrupt
> + - description: NACK Reception Interrupt
> + - description: Arbitration-Lost Interrupt
> + - description: Timeout Interrupt
> + - items:
> + - description: Transmit End Interrupt
> + - description: Receive Data Full Interrupt
> + - description: Transmit Data Empty Interrupt
> + - description: Transmit error or event Interrupt

Nit: the documentation calls it "Transfer error or event generation".

>
> interrupt-names:
> - items:
> - - const: tei
> - - const: ri
> - - const: ti
> - - const: spi
> - - const: sti
> - - const: naki
> - - const: ali
> - - const: tmoi
> + oneOf:
> + - items:
> + - const: tei
> + - const: ri
> + - const: ti
> + - const: spi
> + - const: sti
> + - const: naki
> + - const: ali
> + - const: tmoi
> + - items:
> + - const: tei
> + - const: ri
> + - const: ti

Given you have a new set of names, perhaps "rxi" and "txi",
to match the documentation?

> + - const: eei

Perhaps use the order from the documentation: eei, rxi, txi, tei?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675798-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5B7F441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:22:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id D4BC6189DDA8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:22:30 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C8EC288C96;
Fri, 6 Jun 2025 13:22:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="ZiTrqzJJ"
Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77])
(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 A90A028852E;
Fri, 6 Jun 2025 13:22:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216128; cv=none; b=YZNffPTTlgygDIsw5UY/88DTAkuYQWMQZ2ksOkAIkZWE8PTJKaKQrODgrs0LzwCc1oRmg51TBwamM/R7bLEfrz4/aANjCzgmVPZV9inY5ciVAFIPhwUomKpUxxCYMGlCZgo2jK0p6Juii/iumhO4mtE6GyOzxGlmygvUgi2kU5w=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216128; c=relaxed/simple;
bh=HXUSPIeGfPlxzaXoYjQ3XjGGPG7eTsTGSFtIt+yUcBg=;
h=From:Subject:Date:Message-ID:MIME-Version:Content-Type:To:CC; b=LTD705vI4O4Aa7zDxoYTxEcoZlauepa80N26AE/yMbB3RMaqxWBh8U9Kgfpvw9DVOUXIkyxXyMj57kDyO6TLfOYAulDjQIo2cKFbbWLMX5HGTRXwlyoxt1vx5uZm2k/hmLulhNJI/cC+/kwYgDk1LkD8z64WpQ/7kcb8K4zAXbE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=ZiTrqzJJ; arc=none smtp.client-ip=148.163.135.77
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com
Received: from pps.filterd (m0167088.ppops.net [127.0.0.1])
by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556A4CZE023305;
Fri, 6 Jun 2025 09:21:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc
:content-transfer-encoding:content-type:date:from:message-id
:mime-version:subject:to; s=DKIM; bh=ey1mPWftpv8vECIwHbLkr5qwFJ1
ZZ9u9LuHvS5v4RzA=; b=ZiTrqzJJPsz8/MlMgre7blKD6nn94WSyGU0Iw2Bo+XY
Q1pOmH4neC+LvoajNXnBeMxjW3QNu1wV8DBj/WQFJ7WlAg5nZAkimH4eMSCfpbCH
n98Vg1JKqsXKpO03CMwIdx60tfqyZh2c1AGvbF3Dmk2qtdcpda4EoGqRGEUAagXs
T2X2t5uv6tvMqsVFfQfWwBeO0i8AMjVb4LiLtM/W6kDh16o9q0J3PhGgU8FNgYfO
RklbUZS9gdVZhih3UoGHPPYBP0bjigSBcpYUEetJMnRet5zVjqcwCzG6EoFPyQnI
EoMUG8r4Fg+f8oou3TBcJTzzb+Bd0/PSr0wNPM0Yh4g==
Received: from nwd2mta4.analog.com ([137.71.173.58])
by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 472k2ucax2-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 09:21:49 -0400 (EDT)
Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5])
by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 556DLmlZ020850
(version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
Fri, 6 Jun 2025 09:21:48 -0400
Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by
ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1748.10; Fri, 6 Jun 2025 09:21:48 -0400
Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by
ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1748.10; Fri, 6 Jun 2025 09:21:48 -0400
Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com
(10.64.17.5) with Microsoft SMTP Server id 15.2.1748.10 via Frontend
Transport; Fri, 6 Jun 2025 09:21:47 -0400
Received: from [127.0.1.1] ([10.44.3.40])
by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 556DLYfg019626;
Fri, 6 Jun 2025 09:21:36 -0400
From: Jorge Marques <jorge.marques@xxxxxxxxxx>
Subject: [PATCH v2 0/2] Add ADI I3C Controller
Date: Fri, 6 Jun 2025 15:21:01 +0200
Message-ID: <20250606-adi-i3c-master-v2-0-e68b9aad2630@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
X-B4-Tracking: v=1; b=H4sIAD3rQmgC/3XMQQrCMBCF4auUWTuSxlSDK+8hXYzJtB2wjSQlK
CV3N3bv8n/wvg0SR+EE12aDyFmShKWGPjTgJlpGRvG1QSvdqbMySF5QTg5nSitH1NS1xrrOOnO
BenpFHuS9g/e+9iRpDfGz+7n9rX+p3KJCZaxlqzwN7nGjhZ5hPLowQ19K+QLKbL/frQAAAA==
X-Change-ID: 20250604-adi-i3c-master-2a5148c58c47
To: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>,
Frank Li
<Frank.Li@xxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski
<krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
CC: <linux-i3c@xxxxxxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-kernel@xxxxxxxxxxxxxxx>,
Jorge Marques <jorge.marques@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749216066; l=1780;
i=jorge.marques@xxxxxxxxxx; s=20250303; h=from:subject:message-id;
bh=HXUSPIeGfPlxzaXoYjQ3XjGGPG7eTsTGSFtIt+yUcBg=;
b=18wnOy8oGffhLR2PP5h7iu8RmNCmspFkVGdGkjM3ytor09e5nQ26iYmyw1ceIAuiJxhCFdRwX
2lRNxhJKQsaDv+ewrFp2htGW9AM21glRU4bTNsRdPc8LnbBYfXWakEp
X-Developer-Key: i=jorge.marques@xxxxxxxxxx; a=ed25519;
pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg=
X-ADIRuleOP-NewSCL: Rule Triggered
X-Proofpoint-GUID: x2DARNsv_yv-LP4Jh0o8RUl5dYp9tw3y
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEyMSBTYWx0ZWRfX8ylsvDl38fMu
IUVhdVcq9bH8rot+FlnsAdoP+JUHVAvFbz9SgvaeeduGfvq8WICvzE1WQEoBBaUPDYALkY49PCE
i5CqbJBjYC4ph6MI95shSUBeI1NSE9YaVspY0geQqEEk0w1886ho385XC6QNhesrCxVXhdlwLSd
2Ngf9CHP+Ppoo/6sxiAePw41RTV7DsTlByz48/Bj6S0EP1WzrNqFs0Ptcjmpr9RCwXqX4ge87BV
py4yEhc0uBRByQ5Cwzdvrmwaz1dI70AM8j87Z5fQm7dRfc+Wj95W8p4UbICqLQEDem6FLv1TdDx
pS+i+xu9urEFV73maDvo3mu+kfcw+FKZxEoWaxRWTBYzLsKRihEUbTXxODfPlaar+HDMYRFLYEt
DDbImcjDXD9JwecyqheEDD69a5XanTxf2w3FcPLXJOo+/ewV5ODHVYW0gFT1EuI1wjSUalFI
X-Proofpoint-ORIG-GUID: x2DARNsv_yv-LP4Jh0o8RUl5dYp9tw3y
X-Authority-Analysis: v=2.4 cv=Fv4F/3rq c=1 sm=1 tr=0 ts=6842eb6d cx=c_pps
a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17
a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=wI1k2SEZAAAA:8 a=VwQbUJbxAAAA:8
a=gAnH3GRIAAAA:8 a=AbWnsF95IPDzd2HxxOMA:9 a=QEXdDO2ut3YA:10
a=6HWbV-4b7c7AdzY24d_u:22
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
adultscore=0 impostorscore=0 suspectscore=0 mlxlogscore=963 spamscore=0
malwarescore=0 phishscore=0 clxscore=1015 lowpriorityscore=0
priorityscore=1501 bulkscore=0 mlxscore=0 classifier=spam authscore=0
authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1
engine=8.19.0-2505280000 definitions=main-2506060121
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

I3C Controller is subset of the I3C-basic specification to interface
peripherals through I3C and I2C. The controller RTL is FPGA
synthesizable and documentation is provided at
https://analogdevicesinc.github.io/hdl/library/i3c_controller

The main target for the I3C Controller IP is low-cost FPGAs.
In this version the driver supports IBI (only the MDB), I3C and I2C
transfers.

Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
---
Changes in v2:
Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml:
- Move allof
- Rename clocks to axi, i3c

adi-i3c-master.c:
- Update license year
- Rework regmap to use FIELD_GET, FIELD_PREP
- Reformat regmap to have FIELDS after REG, prefixed by reg name.
- Add overflow safeguards to cmd, tx fifos
- Fix macro related macros (mostly errondeous `| ~BITMASK`
- Use guard macros, remove goto.
- Simplify daa logic
- Replace devm_clk_get with devm_clk_get_enabled
- Solve 64bit->32bit warnings on x86_64 systems by casting to u32
- Link to v1: https://lore.kernel.org/r/20250604-adi-i3c-master-v1-0-0488e80dafcb@xxxxxxxxxx

---
Jorge Marques (2):
dt-bindings: i3c: Add adi-i3c-master
i3c: master: Add driver for Analog Devices I3C Controller IP

.../devicetree/bindings/i3c/adi,i3c-master.yaml | 63 ++
MAINTAINERS | 6 +
drivers/i3c/master/Kconfig | 11 +
drivers/i3c/master/Makefile | 1 +
drivers/i3c/master/adi-i3c-master.c | 1037 ++++++++++++++++++++
5 files changed, 1118 insertions(+)
---
base-commit: 00286d7d643d3c98e48d9cc3a9f471b37154f462
change-id: 20250604-adi-i3c-master-2a5148c58c47

Best regards,
--
Jorge Marques <jorge.marques@xxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675799-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6D9AA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:22:24 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2B44917A93E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:22:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D9D1289349;
Fri, 6 Jun 2025 13:22:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="DHlw2z/9"
Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77])
(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 312A3288C21;
Fri, 6 Jun 2025 13:22:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216129; cv=none; b=mnR+B0+0awO/GsEejXiFxvEoXnEuNUq7pvjXk7Ddc1bgh7FjCPTT1Lp9e+/VkXtSxHrpcyiykPg8/slte8W47eYXLQhUW94Pat+tboDLAfpOkRnx3ic/werKNqhp5ppKKgihnsJCLsA1FiSfscO8JEidk3d8/MaKT8mlJiPWxoM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216129; c=relaxed/simple;
bh=4lfqDinsst5rxiSPQwy+MHQH7sSvuercecpUyNyRXKg=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References:
In-Reply-To:To:CC; b=ITTpOVhzjofMRKqcuVttNTFFBHNbSRfTssnx+x7hBnDSfbxuQ04b5LeNoQp41qbWErQ7aJv1+bzZMcxmprakgiucXwAvbPTxPFAAhBeQmANwDZJfDaLesyrYGkk019dHUDNs2PYQQ8KAC+bnk/aaUSjnJ0/VyvrGffHx4WS6VKo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=DHlw2z/9; arc=none smtp.client-ip=148.163.135.77
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com
Received: from pps.filterd (m0167088.ppops.net [127.0.0.1])
by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556AVV6v023288;
Fri, 6 Jun 2025 09:21:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=DKIM; bh=vUOoO
fDlzVwDstDNQmrOAz1FyWVCQ/REQ3X9anjHVPY=; b=DHlw2z/9rjOsx6Hs3hH8z
e4aw22LBvxyxbgwXZ8nlz0ZX1ENyB+U0G1gOEFUaZfFihjNIl6g7TW/aOx9klRXu
Dqtz7Xg96SYjX74dI16wOgi/3ZuJ1V6l5HAoJ35MlljJXvMEKch+Xq8R9Ncd9QkS
qDVVc++e5bKAUr7nUy4bpP4AZ/zNi9BZ6OnhFNKQhHRaaRP3CFboW9l53kLhHC6c
AgCSFgJSR/ysFRF2SpBgSBJIpfwJdCaUwAXOw6pjdnnotF/XFWf2Oc3dZiat/NxI
sTXTux7qT8Ytr9JM7tBVx9mCaqKp4sI7uY7cAiNdMalWxMeCgvqq6oy/Z8xR+OLd
A==
Received: from nwd2mta3.analog.com ([137.71.173.56])
by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 472k2ucax0-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 09:21:49 -0400 (EDT)
Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10])
by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 556DLlIG061996
(version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
Fri, 6 Jun 2025 09:21:47 -0400
Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBMBX9.ad.analog.com
(10.64.17.10) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 6 Jun
2025 09:21:47 -0400
Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com
(10.64.17.10) with Microsoft SMTP Server id 15.2.1748.10 via Frontend
Transport; Fri, 6 Jun 2025 09:21:47 -0400
Received: from [127.0.1.1] ([10.44.3.40])
by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 556DLYfh019626;
Fri, 6 Jun 2025 09:21:41 -0400
From: Jorge Marques <jorge.marques@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:21:02 +0200
Subject: [PATCH v2 1/2] dt-bindings: i3c: Add adi-i3c-master
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-ID: <20250606-adi-i3c-master-v2-1-e68b9aad2630@xxxxxxxxxx>
References: <20250606-adi-i3c-master-v2-0-e68b9aad2630@xxxxxxxxxx>
In-Reply-To: <20250606-adi-i3c-master-v2-0-e68b9aad2630@xxxxxxxxxx>
To: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>,
Frank Li
<Frank.Li@xxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski
<krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
CC: <linux-i3c@xxxxxxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-kernel@xxxxxxxxxxxxxxx>,
Jorge Marques <jorge.marques@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749216066; l=2716;
i=jorge.marques@xxxxxxxxxx; s=20250303; h=from:subject:message-id;
bh=4lfqDinsst5rxiSPQwy+MHQH7sSvuercecpUyNyRXKg=;
b=VRfb5ad1fsO2UimjJwuFb6kXNncZyO1T4JI0ATd1fxCfVsnyQONk9K624h4+8S4Z4S9TLTInk
HI6ZMbDwKBWCrV4setzCV62yHy+aIV2ctCAOoJdmIqMLYBcd1ukcQIl
X-Developer-Key: i=jorge.marques@xxxxxxxxxx; a=ed25519;
pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg=
X-ADIRuleOP-NewSCL: Rule Triggered
X-Proofpoint-GUID: yN3oVh1gKricR2O7e8ib3HfbFIcQYaKc
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEyMSBTYWx0ZWRfX19JOc7qrNTjW
1P00HD3W/gGJRRQa6QMY9//qk9YtQIUBKACqgwrTDPZw3Z6TxW3WbF6/IOzqiCgm5LDmdU9c6JZ
Lf520ZAC+8aldlN89ogyndfAY12d/2FlRCvhHZNk/25wL6WQih5lWjBJCapiFBugveB26KFJeKS
G+18LtN5N12WF8kTXqNU7xzGuvdytPOTxDwPAevyaQsx2SQPeJUqAgrKrLWjtFwOkWX+aY07eXk
U26tJo2XFtxYyfKDQ9KeMgKS3hnzFRlmRyTKgctFgALBvccOfKwYIuPOhHsTnlIz00L67TfP8j1
Hnf0tVtTr77XaWxYotYsjfSBy9A+fcvbOndCE7AIqZWXXm4b1vOJ13mUheeH09qNn1i0z4sxhqi
KWjUhbQ3HrFdmPnjfLstzppW5cxf/7/9x+GW1FBaWlctQ9Me0q2Vt13iL/zuMVgraQc/DP8R
X-Proofpoint-ORIG-GUID: yN3oVh1gKricR2O7e8ib3HfbFIcQYaKc
X-Authority-Analysis: v=2.4 cv=Fv4F/3rq c=1 sm=1 tr=0 ts=6842eb6d cx=c_pps
a=PpDZqlmH/M8setHirZLBMw==:117 a=PpDZqlmH/M8setHirZLBMw==:17
a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=gEfo2CItAAAA:8 a=wI1k2SEZAAAA:8
a=gAnH3GRIAAAA:8 a=Br2UW1UjAAAA:8 a=BiVzJI_yISUpa7ZiZSMA:9 a=3ZKOabzyN94A:10
a=QEXdDO2ut3YA:10 a=sptkURWiP4Gy88Gu7hUp:22 a=6HWbV-4b7c7AdzY24d_u:22
a=WmXOPjafLNExVIMTj843:22
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
adultscore=0 impostorscore=0 suspectscore=0 mlxlogscore=861 spamscore=0
malwarescore=0 phishscore=0 clxscore=1015 lowpriorityscore=0
priorityscore=1501 bulkscore=0 mlxscore=0 classifier=spam authscore=0
authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1
engine=8.19.0-2505280000 definitions=main-2506060121
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add bindings doc for ADI I3C Controller IP core, a FPGA synthesizable IP
core that implements the MIPI I3C Basic controller specification.

Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
---
.../devicetree/bindings/i3c/adi,i3c-master.yaml | 63 ++++++++++++++++++++++
MAINTAINERS | 5 ++
2 files changed, 68 insertions(+)

diff --git a/Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml b/Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..e7fae394ad8fd4143eb1fffb9591a30a2d6cc6ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i3c/adi,i3c-master.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices I3C Controller
+
+description: |
+ The ADI I3C controller implements a subset of the I3C-basic specification to
+ interface I3C and I2C peripherals [1].
+
+ [1] https://analogdevicesinc.github.io/hdl/library/i3c_controller
+
+maintainers:
+ - Jorge Marques <jorge.marques@xxxxxxxxxx>
+
+properties:
+ compatible:
+ const: adi,i3c-master
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ minItems: 1
+ items:
+ - description: The AXI interconnect clock.
+ - description: The I3C controller clock.
+
+ clock-names:
+ items:
+ - const: axi
+ - const: i3c
+
+ interrupts:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - interrupts
+
+allOf:
+ - $ref: i3c.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ i3c@44a00000 {
+ compatible = "adi,i3c-master";
+ reg = <0x44a00000 0x1000>;
+ interrupts = <0 56 4>;
+ clocks = <&clkc 15>, <&clkc 15>;
+ clock-names = "axi", "i3c";
+ #address-cells = <3>;
+ #size-cells = <0>;
+
+ /* I3C and I2C devices */
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index 96b82704950184bd71623ff41fc4df31e4c7fe87..6f56e17dcecf902c6812827c1ec3e067c65e9894 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11243,6 +11243,11 @@ S: Maintained
F: Documentation/devicetree/bindings/i3c/aspeed,ast2600-i3c.yaml
F: drivers/i3c/master/ast2600-i3c-master.c

+I3C DRIVER FOR ANALOG DEVICES I3C CONTROLLER IP
+M: Jorge Marques <jorge.marques@xxxxxxxxxx>
+S: Maintained
+F: Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
+
I3C DRIVER FOR CADENCE I3C MASTER IP
M: PrzemysÅ?aw Gaj <pgaj@xxxxxxxxxxx>
S: Maintained

--
2.43.0



Return-Path: <linux-kernel+bounces-675800-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3171D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:22:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 52C171797CD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:22:42 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D750C289362;
Fri, 6 Jun 2025 13:22:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="b6/VG67c"
Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77])
(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 4B7C9288CA1;
Fri, 6 Jun 2025 13:22:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216131; cv=none; b=dJIUhqkkGphFPNwhK1IloYj5xnenD5H7//V5rLjN7LYiFG7Gli7wbLDleE7lsfT2EPpLBi0/yMWnaQfeviijePFQw1PO1RqyaWs3C7RDib8eVGERCFkGGFuWzLLseYDgDHbYNfmf8gGwMnRQaZ7sAoOkLY3/Glm47G6QALez++8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216131; c=relaxed/simple;
bh=U1Q6vwh7qSx89JhABWGqn+wkM/8JDeLk1oRCFJ9sr1Q=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References:
In-Reply-To:To:CC; b=k7AmJB4wxkZ4NdAYfNBoZ50+oJ3RI2tTEdLn/KQaNY0eD7a+sPDpRYDfXg4EJhRBRN1WFaHeA2pCoxQMdHS7ZkXTWRbjMq+nTsN/UHSCFhT3tZMO/xr6lOuWMA9QlsnlPMATkVnGBbolcLYGkLvktFRnwfqncehl/JAqySMRwE0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=b6/VG67c; arc=none smtp.client-ip=148.163.135.77
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com
Received: from pps.filterd (m0167089.ppops.net [127.0.0.1])
by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5569AaEE007711;
Fri, 6 Jun 2025 09:21:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=DKIM; bh=oXrkT
L1hEX4nUcAlo0Fn6vSldW+Qnfsx+gK2cjl9UgM=; b=b6/VG67cDP4WU+8dHGPrN
1sdwkCMXaZb3lPyrYrUQiJ/6qEjNTmgbCiH2shd9NNzOHnbwg3KWg8jsorTFpbOe
wAsZJ3U9757qpdH540Y3MxKaTB4eluyG2PulxGJAloWFGP3p0G9kmtIh8Ky0l0Dn
HG9vEEYpXot89Z6XadUxRthijK7jhsMZh+n9anOr49tssvMlPSetQ2cOjrjPf1qN
smF/g8M3TQiC1jZKU7ARkUBXsU3+MixeT2Am2I9BR2mKQNCUonB+f8+2oNwcaf7B
ttZvtXh84OknCOyXwJxPFdyNcXxotczrVUlaYRcKovw7nWtQizF5BnMFEP3B4PCK
g==
Received: from nwd2mta3.analog.com ([137.71.173.56])
by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 471g9jdjhh-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 09:21:51 -0400 (EDT)
Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10])
by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 556DLoJT062001
(version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
Fri, 6 Jun 2025 09:21:50 -0400
Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com
(10.64.17.10) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 6 Jun
2025 09:21:50 -0400
Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com
(10.64.17.5) with Microsoft SMTP Server id 15.2.1748.10 via Frontend
Transport; Fri, 6 Jun 2025 09:21:50 -0400
Received: from [127.0.1.1] ([10.44.3.40])
by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 556DLYfi019626;
Fri, 6 Jun 2025 09:21:42 -0400
From: Jorge Marques <jorge.marques@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:21:03 +0200
Subject: [PATCH v2 2/2] i3c: master: Add driver for Analog Devices I3C
Controller IP
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-ID: <20250606-adi-i3c-master-v2-2-e68b9aad2630@xxxxxxxxxx>
References: <20250606-adi-i3c-master-v2-0-e68b9aad2630@xxxxxxxxxx>
In-Reply-To: <20250606-adi-i3c-master-v2-0-e68b9aad2630@xxxxxxxxxx>
To: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>,
Frank Li
<Frank.Li@xxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski
<krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
CC: <linux-i3c@xxxxxxxxxxxxxxxxxxx>, <devicetree@xxxxxxxxxxxxxxx>,
<linux-kernel@xxxxxxxxxxxxxxx>,
Jorge Marques <jorge.marques@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749216066; l=31230;
i=jorge.marques@xxxxxxxxxx; s=20250303; h=from:subject:message-id;
bh=U1Q6vwh7qSx89JhABWGqn+wkM/8JDeLk1oRCFJ9sr1Q=;
b=YD2T/EeEuiOy4ffa4y8i3bLL70YGm4Qr9QA0y95W2gOnQh3hLF8z7V/AxF9ZwUmD/PKX4Tpqp
WHFwE2s+UzcCXi6yqzaag+gR0OS2cdNT7PYO7cMw9VahOGyFZASg2NH
X-Developer-Key: i=jorge.marques@xxxxxxxxxx; a=ed25519;
pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg=
X-ADIRuleOP-NewSCL: Rule Triggered
X-Proofpoint-GUID: P5iV4wA0yDhp_gNxDVYsEqXB1r_QIQ8D
X-Authority-Analysis: v=2.4 cv=DfIXqutW c=1 sm=1 tr=0 ts=6842eb6f cx=c_pps
a=PpDZqlmH/M8setHirZLBMw==:117 a=PpDZqlmH/M8setHirZLBMw==:17
a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=gAnH3GRIAAAA:8 a=Br2UW1UjAAAA:8
a=uYelplDOSPtZD9UNFWIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
a=WmXOPjafLNExVIMTj843:22
X-Proofpoint-ORIG-GUID: P5iV4wA0yDhp_gNxDVYsEqXB1r_QIQ8D
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEyMSBTYWx0ZWRfX1NaJftdA5rSO
277lS6dn0sjRP/EyKke7acoxRAhe0nxBX/7gpxbUai2r8+vOIxyVEYxW1vtEWKe+/lG5A9OmF++
CzH9iORyQnOcxkvx2J/nu0/KtpoUnpd0kdRH7QgQXuFlgZshc0gqB/oqtd1g+Ne8scTvJAEYxV0
eHxpItlDdGKgQ7TjFHX9L52dPFrL5K3GR+UoOu+hragCEJlJxYM52tEOX0UNStnoukz+TYoBC2u
nZPmD7IgpN8OH0XUoiITer2PyNheg7jWZHLm65GwQOwKqDo7wp67P6qjE0h6hZoI/I9Yq93sFFW
TOz3BpqLTHd2Sn7w5+K/xNJrM9LJVonZZU2UE/NYYe8uFkdTYLoKx81IRpefMtDhNQqfPm33oCs
Yd2i9Fbji6T6ePgfYhmUpQn7qJRClo+XFZSzQNqnbBiX7NZbDTcUrxx3lIFBGuNOrqWrYaQ6
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
mlxscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 suspectscore=0
adultscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 phishscore=0
lowpriorityscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060121
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add support for Analog Devices I3C Controller IP, an AXI-interfaced IP
core that supports I3C and I2C devices, multiple speed-grades and
I3C IBIs.

Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
---
MAINTAINERS | 1 +
drivers/i3c/master/Kconfig | 11 +
drivers/i3c/master/Makefile | 1 +
drivers/i3c/master/adi-i3c-master.c | 1037 +++++++++++++++++++++++++++++++++++
4 files changed, 1050 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6f56e17dcecf902c6812827c1ec3e067c65e9894..9eb5b6c327590725d1641fd4b73e48fc1d1a3954 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11247,6 +11247,7 @@ I3C DRIVER FOR ANALOG DEVICES I3C CONTROLLER IP
M: Jorge Marques <jorge.marques@xxxxxxxxxx>
S: Maintained
F: Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
+F: drivers/i3c/master/adi-i3c-master.c

I3C DRIVER FOR CADENCE I3C MASTER IP
M: PrzemysÅ?aw Gaj <pgaj@xxxxxxxxxxx>
diff --git a/drivers/i3c/master/Kconfig b/drivers/i3c/master/Kconfig
index 7b30db3253af9d5c6aee6544c060e491bfbeb643..328b7145cdefa20e708ebfa3383e849ce51c5a71 100644
--- a/drivers/i3c/master/Kconfig
+++ b/drivers/i3c/master/Kconfig
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only
+config ADI_I3C_MASTER
+ tristate "Analog Devices I3C master driver"
+ depends on HAS_IOMEM
+ help
+ Support for Analog Devices I3C Controller IP, an AXI-interfaced IP
+ core that supports I3C and I2C devices, multiple speed-grades and
+ I3C IBIs.
+
+ This driver can also be built as a module. If so, the module
+ will be called adi-i3c-master.
+
config CDNS_I3C_MASTER
tristate "Cadence I3C master driver"
depends on HAS_IOMEM
diff --git a/drivers/i3c/master/Makefile b/drivers/i3c/master/Makefile
index 3e97960160bc85e5eaf2966ec0c3fae458c2711e..6cc4f4b73e7bdc206b68c750390f9c3cc2ccb199 100644
--- a/drivers/i3c/master/Makefile
+++ b/drivers/i3c/master/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_ADI_I3C_MASTER) += adi-i3c-master.o
obj-$(CONFIG_CDNS_I3C_MASTER) += i3c-master-cdns.o
obj-$(CONFIG_DW_I3C_MASTER) += dw-i3c-master.o
obj-$(CONFIG_AST2600_I3C_MASTER) += ast2600-i3c-master.o
diff --git a/drivers/i3c/master/adi-i3c-master.c b/drivers/i3c/master/adi-i3c-master.c
new file mode 100644
index 0000000000000000000000000000000000000000..b3799071573f4066eb14123c94ee599cc6331b3d
--- /dev/null
+++ b/drivers/i3c/master/adi-i3c-master.c
@@ -0,0 +1,1037 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * I3C Controller driver
+ * Copyright 2025 Analog Devices Inc.
+ * Author: Jorge Marques <jorge.marques@xxxxxxxxxx>
+ */
+
+#include <linux/bitops.h>
+#include <linux/bitfield.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/errno.h>
+#include <linux/i3c/master.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+#define VERSION_MAJOR(x) ((u32)FIELD_GET(GENMASK(23, 16), (x)))
+#define VERSION_MINOR(x) ((u32)FIELD_GET(GENMASK(15, 8), (x)))
+#define VERSION_PATCH(x) ((u32)FIELD_GET(GENMASK(7, 0), (x)))
+
+#define MAX_DEVS 16
+
+#define REG_VERSION 0x000
+#define REG_ENABLE 0x040
+#define REG_IRQ_MASK 0x080
+#define REG_IRQ_PENDING 0x084
+#define REG_IRQ_PEDING_CMDR BIT(5)
+#define REG_IRQ_PEDING_IBI ((u32)BIT(6))
+#define REG_IRQ_PEDING_DAA BIT(7)
+#define REG_CMD_FIFO 0x0d4
+#define REG_CMD_FIFO_0_IS_CCC BIT(22)
+#define REG_CMD_FIFO_0_BCAST BIT(21)
+#define REG_CMD_FIFO_0_SR BIT(20)
+#define REG_CMD_FIFO_0_LEN(l) FIELD_PREP(GENMASK(19, 8), (l))
+#define REG_CMD_FIFO_0_LEN_MAX 4095
+#define REG_CMD_FIFO_0_DEV_ADDR(a) FIELD_PREP(GENMASK(7, 1), a)
+#define REG_CMD_FIFO_0_RNW BIT(0)
+#define REG_CMD_FIFO_1_CCC(id) FIELD_PREP(GENMASK(7, 0), (id))
+#define REG_CMD_FIFO_ROOM 0x0c0
+#define REG_CMDR_FIFO 0x0d8
+#define REG_CMDR_FIFO_NO_ERROR 0
+#define REG_CMDR_FIFO_CE0_ERROR 1
+#define REG_CMDR_FIFO_CE2_ERROR 4
+#define REG_CMDR_FIFO_NACK_RESP 6
+#define REG_CMDR_FIFO_UDA_ERROR 8
+#define REG_CMDR_FIFO_ERROR(x) FIELD_GET(GENMASK(23, 20), (x))
+#define REG_CMDR_FIFO_XFER_BYTES(x) FIELD_GET(GENMASK(19, 8), (x))
+#define REG_SDO_FIFO 0x0dc
+#define REG_SDO_FIFO_ROOM 0x0c8
+#define REG_SDI_FIFO 0x0e0
+#define REG_IBI_FIFO 0x0e4
+#define REG_FIFO_STATUS 0x0e8
+#define REG_FIFO_STATUS_CMDR_EMPTY BIT(0)
+#define REG_FIFO_STATUS_IBI_EMPTY BIT(1)
+#define REG_OPS 0x100
+#define REG_OPS_SET_SG(x) FIELD_PREP(GENMASK(6, 5), (x))
+#define REG_OPS_PP_SG_MASK GENMASK(6, 5)
+#define REG_IBI_CONFIG 0x140
+#define REG_IBI_CONFIG_LISTEN BIT(1)
+#define REG_IBI_CONFIG_ENABLE BIT(0)
+#define REG_DEV_CHAR 0x180
+#define REG_DEV_CHAR_IS_I2C BIT(0)
+#define REG_DEV_CHAR_IS_ATTACHED BIT(1)
+#define REG_DEV_CHAR_BCR_IBI(x) (((x) & GENMASK(2, 1)) << 1)
+#define REG_DEV_CHAR_WEN BIT(8)
+#define REG_DEV_CHAR_ADDR(x) FIELD_PREP(GENMASK(15, 9), (x))
+
+enum speed_grade {PP_SG_UNSET, PP_SG_1MHZ, PP_SG_3MHZ, PP_SG_6MHZ, PP_SG_12MHZ};
+struct adi_i3c_cmd {
+ u32 cmd0;
+ u32 cmd1;
+ u32 tx_len;
+ const void *tx_buf;
+ u32 rx_len;
+ void *rx_buf;
+ u32 error;
+};
+
+struct adi_i3c_xfer {
+ struct list_head node;
+ struct completion comp;
+ int ret;
+ unsigned int ncmds;
+ unsigned int ncmds_comp;
+ struct adi_i3c_cmd cmds[];
+};
+
+struct adi_i3c_master {
+ struct i3c_master_controller base;
+ u32 free_rr_slots;
+ unsigned int maxdevs;
+ struct {
+ unsigned int num_slots;
+ struct i3c_dev_desc **slots;
+ spinlock_t lock; /* Protect IBI slot access */
+ } ibi;
+ struct {
+ struct list_head list;
+ struct adi_i3c_xfer *cur;
+ spinlock_t lock; /* Protect transfer */
+ } xferqueue;
+ void __iomem *regs;
+ struct clk *clk;
+ unsigned long i3c_scl_lim;
+ struct {
+ u8 addrs[MAX_DEVS];
+ u8 index;
+ } daa;
+};
+
+static inline struct adi_i3c_master *to_adi_i3c_master(struct i3c_master_controller *master)
+{
+ return container_of(master, struct adi_i3c_master, base);
+}
+
+static void adi_i3c_master_wr_to_tx_fifo(struct adi_i3c_master *master,
+ const u8 *bytes, unsigned int nbytes)
+{
+ unsigned int n, m;
+ u32 tmp;
+
+ n = readl(master->regs + REG_SDO_FIFO_ROOM);
+ m = min(n, nbytes);
+ writesl(master->regs + REG_SDO_FIFO, bytes, m / 4);
+
+ if (m & 3) {
+ memcpy(&tmp, bytes + (m & ~3), m & 3);
+ writel(tmp, master->regs + REG_SDO_FIFO);
+ }
+}
+
+static void adi_i3c_master_rd_from_rx_fifo(struct adi_i3c_master *master,
+ u8 *bytes, unsigned int nbytes)
+{
+ readsl(master->regs + REG_SDI_FIFO, bytes, nbytes / 4);
+ if (nbytes & 3) {
+ u32 tmp;
+
+ tmp = readl(master->regs + REG_SDI_FIFO);
+ memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3);
+ }
+}
+
+static bool adi_i3c_master_supports_ccc_cmd(struct i3c_master_controller *m,
+ const struct i3c_ccc_cmd *cmd)
+{
+ if (cmd->ndests > 1)
+ return false;
+
+ switch (cmd->id) {
+ case I3C_CCC_ENEC(true):
+ case I3C_CCC_ENEC(false):
+ case I3C_CCC_DISEC(true):
+ case I3C_CCC_DISEC(false):
+ case I3C_CCC_RSTDAA(true):
+ case I3C_CCC_RSTDAA(false):
+ case I3C_CCC_ENTDAA:
+ case I3C_CCC_SETDASA:
+ case I3C_CCC_SETNEWDA:
+ case I3C_CCC_GETMWL:
+ case I3C_CCC_GETMRL:
+ case I3C_CCC_GETPID:
+ case I3C_CCC_GETBCR:
+ case I3C_CCC_GETDCR:
+ case I3C_CCC_GETSTATUS:
+ case I3C_CCC_GETHDRCAP:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+static int adi_i3c_master_disable(struct adi_i3c_master *master)
+{
+ writel(0, master->regs + REG_IBI_CONFIG);
+
+ return 0;
+}
+
+static struct adi_i3c_xfer *adi_i3c_master_alloc_xfer(struct adi_i3c_master *master,
+ unsigned int ncmds)
+{
+ struct adi_i3c_xfer *xfer;
+
+ xfer = kzalloc(struct_size(xfer, cmds, ncmds), GFP_KERNEL);
+ if (!xfer)
+ return NULL;
+
+ INIT_LIST_HEAD(&xfer->node);
+ xfer->ncmds = ncmds;
+ xfer->ret = -ETIMEDOUT;
+
+ return xfer;
+}
+
+static void adi_i3c_master_start_xfer_locked(struct adi_i3c_master *master)
+{
+ struct adi_i3c_xfer *xfer = master->xferqueue.cur;
+ unsigned int i, n, m;
+
+ if (!xfer)
+ return;
+
+ for (i = 0; i < xfer->ncmds; i++) {
+ struct adi_i3c_cmd *cmd = &xfer->cmds[i];
+
+ if (!(cmd->cmd0 & REG_CMD_FIFO_0_RNW))
+ adi_i3c_master_wr_to_tx_fifo(master, cmd->tx_buf, cmd->tx_len);
+ }
+
+ n = readl(master->regs + REG_CMD_FIFO_ROOM);
+ for (i = 0; i < xfer->ncmds; i++) {
+ struct adi_i3c_cmd *cmd = &xfer->cmds[i];
+
+ m = cmd->cmd0 & REG_CMD_FIFO_0_IS_CCC ? 2 : 1;
+ if (m > n)
+ break;
+ writel(cmd->cmd0, master->regs + REG_CMD_FIFO);
+ if (cmd->cmd0 & REG_CMD_FIFO_0_IS_CCC)
+ writel(cmd->cmd1, master->regs + REG_CMD_FIFO);
+ n -= m;
+ }
+}
+
+static void adi_i3c_master_end_xfer_locked(struct adi_i3c_master *master,
+ u32 pending)
+{
+ struct adi_i3c_xfer *xfer = master->xferqueue.cur;
+ int i, ret = 0;
+ u32 status0;
+
+ if (!xfer)
+ return;
+
+ for (status0 = readl(master->regs + REG_FIFO_STATUS);
+ !(status0 & REG_FIFO_STATUS_CMDR_EMPTY);
+ status0 = readl(master->regs + REG_FIFO_STATUS)) {
+ struct adi_i3c_cmd *cmd;
+ u32 cmdr, rx_len;
+
+ cmdr = readl(master->regs + REG_CMDR_FIFO);
+
+ cmd = &xfer->cmds[xfer->ncmds_comp++];
+ if (cmd->cmd0 & REG_CMD_FIFO_0_RNW) {
+ rx_len = min_t(u32, REG_CMDR_FIFO_XFER_BYTES(cmdr), cmd->rx_len);
+ adi_i3c_master_rd_from_rx_fifo(master, cmd->rx_buf, rx_len);
+ }
+ cmd->error = REG_CMDR_FIFO_ERROR(cmdr);
+ }
+
+ for (i = 0; i < xfer->ncmds; i++) {
+ switch (xfer->cmds[i].error) {
+ case REG_CMDR_FIFO_NO_ERROR:
+ break;
+
+ case REG_CMDR_FIFO_CE0_ERROR:
+ case REG_CMDR_FIFO_CE2_ERROR:
+ case REG_CMDR_FIFO_NACK_RESP:
+ case REG_CMDR_FIFO_UDA_ERROR:
+ ret = -EIO;
+ break;
+
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ }
+
+ xfer->ret = ret;
+
+ if (xfer->ncmds_comp != xfer->ncmds)
+ return;
+
+ complete(&xfer->comp);
+
+ xfer = list_first_entry_or_null(&master->xferqueue.list,
+ struct adi_i3c_xfer, node);
+ if (xfer)
+ list_del_init(&xfer->node);
+
+ master->xferqueue.cur = xfer;
+ adi_i3c_master_start_xfer_locked(master);
+}
+
+static void adi_i3c_master_queue_xfer(struct adi_i3c_master *master,
+ struct adi_i3c_xfer *xfer)
+{
+ init_completion(&xfer->comp);
+ guard(spinlock_irqsave)(&master->xferqueue.lock);
+ if (master->xferqueue.cur) {
+ list_add_tail(&xfer->node, &master->xferqueue.list);
+ } else {
+ master->xferqueue.cur = xfer;
+ adi_i3c_master_start_xfer_locked(master);
+ }
+}
+
+static void adi_i3c_master_unqueue_xfer(struct adi_i3c_master *master,
+ struct adi_i3c_xfer *xfer)
+{
+ guard(spinlock_irqsave)(&master->xferqueue.lock);
+ if (master->xferqueue.cur == xfer)
+ master->xferqueue.cur = NULL;
+ else
+ list_del_init(&xfer->node);
+
+ writel(0x01, master->regs + REG_ENABLE);
+ writel(0x00, master->regs + REG_ENABLE);
+ writel(REG_IRQ_PEDING_CMDR, master->regs + REG_IRQ_MASK);
+}
+
+static enum i3c_error_code adi_i3c_cmd_get_err(struct adi_i3c_cmd *cmd)
+{
+ switch (cmd->error) {
+ case REG_CMDR_FIFO_CE0_ERROR:
+ return I3C_ERROR_M0;
+
+ case REG_CMDR_FIFO_CE2_ERROR:
+ case REG_CMDR_FIFO_NACK_RESP:
+ return I3C_ERROR_M2;
+
+ default:
+ break;
+ }
+
+ return I3C_ERROR_UNKNOWN;
+}
+
+static int adi_i3c_master_send_ccc_cmd(struct i3c_master_controller *m,
+ struct i3c_ccc_cmd *cmd)
+{
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_xfer *xfer;
+ struct adi_i3c_cmd *ccmd;
+
+ xfer = adi_i3c_master_alloc_xfer(master, 1);
+ if (!xfer)
+ return -ENOMEM;
+
+ ccmd = xfer->cmds;
+ ccmd->cmd1 = REG_CMD_FIFO_1_CCC(cmd->id);
+ ccmd->cmd0 = REG_CMD_FIFO_0_IS_CCC |
+ REG_CMD_FIFO_0_LEN(cmd->dests[0].payload.len);
+
+ if (cmd->id & I3C_CCC_DIRECT)
+ ccmd->cmd0 |= REG_CMD_FIFO_0_DEV_ADDR(cmd->dests[0].addr);
+
+ if (cmd->rnw) {
+ ccmd->cmd0 |= REG_CMD_FIFO_0_RNW;
+ ccmd->rx_buf = cmd->dests[0].payload.data;
+ ccmd->rx_len = cmd->dests[0].payload.len;
+ } else {
+ ccmd->tx_buf = cmd->dests[0].payload.data;
+ ccmd->tx_len = cmd->dests[0].payload.len;
+ }
+
+ adi_i3c_master_queue_xfer(master, xfer);
+ if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000)))
+ adi_i3c_master_unqueue_xfer(master, xfer);
+
+ cmd->err = adi_i3c_cmd_get_err(&xfer->cmds[0]);
+ kfree(xfer);
+
+ return 0;
+}
+
+static int adi_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
+ struct i3c_priv_xfer *xfers,
+ int nxfers)
+{
+ struct i3c_master_controller *m = i3c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_xfer *xfer;
+ int i, ret;
+
+ for (i = 0; i < nxfers; i++) {
+ if (xfers[i].len > REG_CMD_FIFO_0_LEN_MAX)
+ return -EOPNOTSUPP;
+ }
+
+ if (!nxfers)
+ return 0;
+
+ xfer = adi_i3c_master_alloc_xfer(master, nxfers);
+ if (!xfer)
+ return -ENOMEM;
+
+ for (i = 0; i < nxfers; i++) {
+ struct adi_i3c_cmd *ccmd = &xfer->cmds[i];
+
+ ccmd->cmd0 = REG_CMD_FIFO_0_DEV_ADDR(dev->info.dyn_addr);
+
+ if (xfers[i].rnw) {
+ ccmd->cmd0 |= REG_CMD_FIFO_0_RNW;
+ ccmd->rx_buf = xfers[i].data.in;
+ ccmd->rx_len = xfers[i].len;
+ } else {
+ ccmd->tx_buf = xfers[i].data.out;
+ ccmd->tx_len = xfers[i].len;
+ }
+
+ ccmd->cmd0 |= REG_CMD_FIFO_0_LEN(xfers[i].len);
+
+ if (i < nxfers - 1)
+ ccmd->cmd0 |= REG_CMD_FIFO_0_SR;
+
+ if (!i)
+ ccmd->cmd0 |= REG_CMD_FIFO_0_BCAST;
+ }
+
+ adi_i3c_master_queue_xfer(master, xfer);
+ if (!wait_for_completion_timeout(&xfer->comp,
+ msecs_to_jiffies(1000)))
+ adi_i3c_master_unqueue_xfer(master, xfer);
+
+ ret = xfer->ret;
+
+ for (i = 0; i < nxfers; i++)
+ xfers[i].err = adi_i3c_cmd_get_err(&xfer->cmds[i]);
+
+ kfree(xfer);
+
+ return ret;
+}
+
+struct adi_i3c_i2c_dev_data {
+ u16 id;
+ s16 ibi;
+ struct i3c_generic_ibi_pool *ibi_pool;
+};
+
+static int adi_i3c_master_get_rr_slot(struct adi_i3c_master *master,
+ u8 dyn_addr)
+{
+ if (!master->free_rr_slots)
+ return -ENOSPC;
+
+ return ffs(master->free_rr_slots) - 1;
+}
+
+static int adi_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, u8 dyn_addr)
+{
+ struct i3c_master_controller *m = i3c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ u8 addr;
+
+ addr = dev->info.dyn_addr ? dev->info.dyn_addr : dev->info.static_addr;
+
+ writel(REG_DEV_CHAR_ADDR(dyn_addr), master->regs + REG_DEV_CHAR);
+ writel((readl(master->regs + REG_DEV_CHAR) &
+ ~REG_DEV_CHAR_IS_ATTACHED) | REG_DEV_CHAR_WEN,
+ master->regs + REG_DEV_CHAR);
+
+ writel(REG_DEV_CHAR_ADDR(addr), master->regs + REG_DEV_CHAR);
+ writel(readl(master->regs + REG_DEV_CHAR) |
+ REG_DEV_CHAR_IS_ATTACHED | REG_DEV_CHAR_WEN,
+ master->regs + REG_DEV_CHAR);
+
+ return 0;
+}
+
+static int adi_i3c_master_attach_i3c_dev(struct i3c_dev_desc *dev)
+{
+ struct i3c_master_controller *m = i3c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_i2c_dev_data *data;
+ int slot;
+ u8 addr;
+
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ slot = adi_i3c_master_get_rr_slot(master, dev->info.dyn_addr);
+ if (slot < 0) {
+ kfree(data);
+ return slot;
+ }
+
+ data->ibi = -1;
+ data->id = slot;
+ i3c_dev_set_master_data(dev, data);
+ master->free_rr_slots &= ~BIT(slot);
+
+ addr = dev->info.dyn_addr ? dev->info.dyn_addr : dev->info.static_addr;
+
+ writel(REG_DEV_CHAR_ADDR(addr), master->regs + REG_DEV_CHAR);
+ writel(readl(master->regs + REG_DEV_CHAR) |
+ REG_DEV_CHAR_IS_ATTACHED | REG_DEV_CHAR_WEN,
+ master->regs + REG_DEV_CHAR);
+
+ return 0;
+}
+
+static void adi_i3c_master_sync_dev_char(struct i3c_master_controller *m)
+{
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct i3c_dev_desc *i3cdev;
+ u8 addr;
+
+ i3c_bus_for_each_i3cdev(&m->bus, i3cdev) {
+ addr = i3cdev->info.dyn_addr ?
+ i3cdev->info.dyn_addr : i3cdev->info.static_addr;
+ writel(REG_DEV_CHAR_ADDR(addr), master->regs + REG_DEV_CHAR);
+ writel(readl(master->regs + REG_DEV_CHAR) |
+ REG_DEV_CHAR_BCR_IBI(i3cdev->info.bcr) | REG_DEV_CHAR_WEN,
+ master->regs + REG_DEV_CHAR);
+ }
+}
+
+static void adi_i3c_master_detach_i3c_dev(struct i3c_dev_desc *dev)
+{
+ struct i3c_master_controller *m = i3c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev);
+ u8 addr;
+
+ addr = dev->info.dyn_addr ? dev->info.dyn_addr : dev->info.static_addr;
+
+ writel(REG_DEV_CHAR_ADDR(addr), master->regs + REG_DEV_CHAR);
+ writel((readl(master->regs + REG_DEV_CHAR) &
+ ~REG_DEV_CHAR_IS_ATTACHED) | REG_DEV_CHAR_WEN,
+ master->regs + REG_DEV_CHAR);
+
+ i3c_dev_set_master_data(dev, NULL);
+ master->free_rr_slots |= BIT(data->id);
+ kfree(data);
+}
+
+static int adi_i3c_master_attach_i2c_dev(struct i2c_dev_desc *dev)
+{
+ struct i3c_master_controller *m = i2c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_i2c_dev_data *data;
+ int slot;
+
+ slot = adi_i3c_master_get_rr_slot(master, 0);
+ if (slot < 0)
+ return slot;
+
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ data->id = slot;
+ master->free_rr_slots &= ~BIT(slot);
+ i2c_dev_set_master_data(dev, data);
+
+ writel(REG_DEV_CHAR_ADDR(dev->addr) |
+ REG_DEV_CHAR_IS_I2C | REG_DEV_CHAR_IS_ATTACHED | REG_DEV_CHAR_WEN,
+ master->regs + REG_DEV_CHAR);
+
+ return 0;
+}
+
+static void adi_i3c_master_detach_i2c_dev(struct i2c_dev_desc *dev)
+{
+ struct i3c_master_controller *m = i2c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_i2c_dev_data *data = i2c_dev_get_master_data(dev);
+
+ writel(REG_DEV_CHAR_ADDR(dev->addr) |
+ REG_DEV_CHAR_IS_I2C | REG_DEV_CHAR_WEN,
+ master->regs + REG_DEV_CHAR);
+
+ i2c_dev_set_master_data(dev, NULL);
+ master->free_rr_slots |= BIT(data->id);
+ kfree(data);
+}
+
+static void adi_i3c_master_bus_cleanup(struct i3c_master_controller *m)
+{
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+
+ adi_i3c_master_disable(master);
+}
+
+static void adi_i3c_master_upd_i3c_scl_lim(struct adi_i3c_master *master)
+{
+ struct i3c_master_controller *m = &master->base;
+ struct i3c_bus *bus = i3c_master_get_bus(m);
+ u8 i3c_scl_lim = 0;
+ struct i3c_dev_desc *dev;
+ u8 pp_sg;
+
+ i3c_bus_for_each_i3cdev(bus, dev) {
+ u8 max_fscl;
+
+ max_fscl = max(I3C_CCC_MAX_SDR_FSCL(dev->info.max_read_ds),
+ I3C_CCC_MAX_SDR_FSCL(dev->info.max_write_ds));
+
+ switch (max_fscl) {
+ case I3C_SDR1_FSCL_8MHZ:
+ max_fscl = PP_SG_6MHZ;
+ break;
+ case I3C_SDR2_FSCL_6MHZ:
+ max_fscl = PP_SG_3MHZ;
+ break;
+ case I3C_SDR3_FSCL_4MHZ:
+ max_fscl = PP_SG_3MHZ;
+ break;
+ case I3C_SDR4_FSCL_2MHZ:
+ max_fscl = PP_SG_1MHZ;
+ break;
+ case I3C_SDR0_FSCL_MAX:
+ default:
+ max_fscl = PP_SG_12MHZ;
+ break;
+ }
+
+ if (max_fscl &&
+ (i3c_scl_lim > max_fscl || !i3c_scl_lim))
+ i3c_scl_lim = max_fscl;
+ }
+
+ if (!i3c_scl_lim)
+ return;
+
+ master->i3c_scl_lim = i3c_scl_lim - 1;
+
+ pp_sg = readl(master->regs + REG_OPS) & ~REG_OPS_PP_SG_MASK;
+ pp_sg |= REG_OPS_SET_SG(master->i3c_scl_lim);
+
+ writel(pp_sg, master->regs + REG_OPS);
+}
+
+static void adi_i3c_master_get_features(struct adi_i3c_master *master,
+ unsigned int slot,
+ struct i3c_device_info *info)
+{
+ memset(info, 0, sizeof(*info));
+
+ info->dyn_addr = 0x31;
+ info->dcr = 0x00;
+ info->bcr = 0x40;
+ info->pid = 0;
+}
+
+static int adi_i3c_master_do_daa(struct i3c_master_controller *m)
+{
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ u32 irq_mask;
+ int ret, addr;
+
+ addr = 0x8;
+ for (u8 i = 0; i < MAX_DEVS; i++) {
+ addr = i3c_master_get_free_addr(m, addr);
+ if (addr < 0)
+ return addr;
+ master->daa.addrs[i] = addr;
+ }
+
+ irq_mask = readl(master->regs + REG_IRQ_MASK);
+ writel(irq_mask | REG_IRQ_PEDING_DAA,
+ master->regs + REG_IRQ_MASK);
+
+ master->daa.index = 0;
+ ret = i3c_master_entdaa_locked(&master->base);
+
+ writel(irq_mask, master->regs + REG_IRQ_MASK);
+
+ /* DAA always finishes with CE2_ERROR or NACK_RESP */
+ if (ret && ret != I3C_ERROR_M2)
+ return ret;
+
+ /* Add I3C devices discovered */
+ for (u8 i = 0; i < master->daa.index; i++)
+ i3c_master_add_i3c_dev_locked(m, master->daa.addrs[i]);
+ /* Sync retrieved devs info with the IP */
+ adi_i3c_master_sync_dev_char(m);
+
+ i3c_master_defslvs_locked(&master->base);
+
+ adi_i3c_master_upd_i3c_scl_lim(master);
+
+ return 0;
+}
+
+static int adi_i3c_master_bus_init(struct i3c_master_controller *m)
+{
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct i3c_device_info info = { };
+ int ret;
+
+ ret = i3c_master_get_free_addr(m, 0);
+ if (ret < 0)
+ return ret;
+
+ adi_i3c_master_get_features(master, 0, &info);
+ ret = i3c_master_set_info(&master->base, &info);
+ if (ret)
+ return ret;
+
+ writel(REG_IBI_CONFIG_LISTEN,
+ master->regs + REG_IBI_CONFIG);
+
+ return 0;
+}
+
+static void adi_i3c_master_handle_ibi(struct adi_i3c_master *master,
+ u32 ibi)
+{
+ struct adi_i3c_i2c_dev_data *data;
+ struct i3c_ibi_slot *slot;
+ struct i3c_dev_desc *dev;
+ u8 da, id;
+ u8 *mdb;
+
+ da = (ibi >> 17) & GENMASK(6, 0);
+ for (id = 0; id < master->ibi.num_slots; id++) {
+ if (master->ibi.slots[id] &&
+ master->ibi.slots[id]->info.dyn_addr == da)
+ break;
+ }
+
+ if (id == master->ibi.num_slots)
+ return;
+
+ dev = master->ibi.slots[id];
+ guard(spinlock)(&master->ibi.lock);
+
+ data = i3c_dev_get_master_data(dev);
+ slot = i3c_generic_ibi_get_free_slot(data->ibi_pool);
+ if (!slot)
+ return;
+
+ mdb = slot->data;
+ mdb[0] = (ibi >> 8) & GENMASK(7, 0);
+
+ slot->len = 1;
+ i3c_master_queue_ibi(dev, slot);
+}
+
+static void adi_i3c_master_demux_ibis(struct adi_i3c_master *master)
+{
+ u32 status0;
+
+ for (status0 = readl(master->regs + REG_FIFO_STATUS);
+ !(status0 & REG_FIFO_STATUS_IBI_EMPTY);
+ status0 = readl(master->regs + REG_FIFO_STATUS)) {
+ u32 ibi = readl(master->regs + REG_IBI_FIFO);
+
+ adi_i3c_master_handle_ibi(master, ibi);
+ }
+}
+
+static void adi_i3c_master_handle_da_req(struct adi_i3c_master *master)
+{
+ u8 payload0[8];
+ u32 addr;
+
+ /* Clear device characteristics */
+ adi_i3c_master_rd_from_rx_fifo(master, payload0, 6);
+ addr = master->daa.addrs[master->daa.index++];
+ addr = (addr << 1) | (parity8(addr) ? 0 : 1);
+
+ writel(addr, master->regs + REG_SDO_FIFO);
+}
+
+static irqreturn_t adi_i3c_master_irq(int irq, void *data)
+{
+ struct adi_i3c_master *master = data;
+ u32 pending;
+
+ pending = readl_relaxed(master->regs + REG_IRQ_PENDING);
+ writel_relaxed(pending, master->regs + REG_IRQ_PENDING);
+ if (pending & REG_IRQ_PEDING_CMDR) {
+ spin_lock(&master->xferqueue.lock);
+ adi_i3c_master_end_xfer_locked(master, pending);
+ spin_unlock(&master->xferqueue.lock);
+ }
+ if (pending & REG_IRQ_PEDING_IBI)
+ adi_i3c_master_demux_ibis(master);
+ if (pending & REG_IRQ_PEDING_DAA)
+ adi_i3c_master_handle_da_req(master);
+
+ return IRQ_HANDLED;
+}
+
+static int adi_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
+ struct i2c_msg *xfers,
+ int nxfers)
+{
+ struct i3c_master_controller *m = i2c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_xfer *xfer;
+ int i, ret;
+
+ for (i = 0; i < nxfers; i++) {
+ if (xfers[i].len > REG_CMD_FIFO_0_LEN_MAX)
+ return -EOPNOTSUPP;
+ if (xfers[i].flags & I2C_M_TEN)
+ return -EOPNOTSUPP;
+ }
+
+ if (!nxfers)
+ return 0;
+
+ xfer = adi_i3c_master_alloc_xfer(master, nxfers);
+ if (!xfer)
+ return -ENOMEM;
+
+ for (i = 0; i < nxfers; i++) {
+ struct adi_i3c_cmd *ccmd = &xfer->cmds[i];
+
+ ccmd->cmd0 = REG_CMD_FIFO_0_DEV_ADDR(xfers[i].addr);
+
+ if (xfers[i].flags & I2C_M_RD) {
+ ccmd->cmd0 |= REG_CMD_FIFO_0_RNW;
+ ccmd->rx_buf = xfers[i].buf;
+ ccmd->rx_len = xfers[i].len;
+ } else {
+ ccmd->tx_buf = xfers[i].buf;
+ ccmd->tx_len = xfers[i].len;
+ }
+
+ ccmd->cmd0 |= REG_CMD_FIFO_0_LEN(xfers[i].len);
+ }
+
+ adi_i3c_master_queue_xfer(master, xfer);
+ if (!wait_for_completion_timeout(&xfer->comp,
+ msecs_to_jiffies(1000)))
+ adi_i3c_master_unqueue_xfer(master, xfer);
+
+ ret = xfer->ret;
+ kfree(xfer);
+ return ret;
+}
+
+static int adi_i3c_master_disable_ibi(struct i3c_dev_desc *dev)
+{
+ struct i3c_master_controller *m = i3c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct i3c_dev_desc *i3cdev;
+ u32 enabled = 0;
+ int ret;
+
+ ret = i3c_master_disec_locked(m, dev->info.dyn_addr,
+ I3C_CCC_EVENT_SIR);
+
+ i3c_bus_for_each_i3cdev(&m->bus, i3cdev) {
+ if (dev != i3cdev && i3cdev->ibi)
+ enabled |= i3cdev->ibi->enabled;
+ }
+ if (!enabled) {
+ writel(REG_IBI_CONFIG_LISTEN,
+ master->regs + REG_IBI_CONFIG);
+ writel(readl(master->regs + REG_IRQ_MASK) & ~REG_IRQ_PEDING_IBI,
+ master->regs + REG_IRQ_MASK);
+ }
+
+ return ret;
+}
+
+static int adi_i3c_master_enable_ibi(struct i3c_dev_desc *dev)
+{
+ struct i3c_master_controller *m = i3c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+
+ writel(REG_IBI_CONFIG_LISTEN | REG_IBI_CONFIG_ENABLE,
+ master->regs + REG_IBI_CONFIG);
+
+ writel(readl(master->regs + REG_IRQ_MASK) | REG_IRQ_PEDING_IBI,
+ master->regs + REG_IRQ_MASK);
+
+ return i3c_master_enec_locked(m, dev->info.dyn_addr,
+ I3C_CCC_EVENT_SIR);
+}
+
+static int adi_i3c_master_request_ibi(struct i3c_dev_desc *dev,
+ const struct i3c_ibi_setup *req)
+{
+ struct i3c_master_controller *m = i3c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_i2c_dev_data *data;
+ unsigned long flags;
+ unsigned int i;
+
+ data = i3c_dev_get_master_data(dev);
+ data->ibi_pool = i3c_generic_ibi_alloc_pool(dev, req);
+ if (IS_ERR(data->ibi_pool))
+ return PTR_ERR(data->ibi_pool);
+
+ spin_lock_irqsave(&master->ibi.lock, flags);
+ for (i = 0; i < master->ibi.num_slots; i++) {
+ if (!master->ibi.slots[i]) {
+ data->ibi = i;
+ master->ibi.slots[i] = dev;
+ break;
+ }
+ }
+ spin_unlock_irqrestore(&master->ibi.lock, flags);
+
+ if (i < master->ibi.num_slots)
+ return 0;
+
+ i3c_generic_ibi_free_pool(data->ibi_pool);
+ data->ibi_pool = NULL;
+
+ return -ENOSPC;
+}
+
+static void adi_i3c_master_free_ibi(struct i3c_dev_desc *dev)
+{
+ struct i3c_master_controller *m = i3c_dev_get_master(dev);
+ struct adi_i3c_master *master = to_adi_i3c_master(m);
+ struct adi_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev);
+ unsigned long flags;
+
+ spin_lock_irqsave(&master->ibi.lock, flags);
+ master->ibi.slots[data->ibi] = NULL;
+ data->ibi = -1;
+ spin_unlock_irqrestore(&master->ibi.lock, flags);
+
+ i3c_generic_ibi_free_pool(data->ibi_pool);
+}
+
+static void adi_i3c_master_recycle_ibi_slot(struct i3c_dev_desc *dev,
+ struct i3c_ibi_slot *slot)
+{
+ struct adi_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev);
+
+ i3c_generic_ibi_recycle_slot(data->ibi_pool, slot);
+}
+
+static const struct i3c_master_controller_ops adi_i3c_master_ops = {
+ .bus_init = adi_i3c_master_bus_init,
+ .bus_cleanup = adi_i3c_master_bus_cleanup,
+ .attach_i3c_dev = adi_i3c_master_attach_i3c_dev,
+ .reattach_i3c_dev = adi_i3c_master_reattach_i3c_dev,
+ .detach_i3c_dev = adi_i3c_master_detach_i3c_dev,
+ .attach_i2c_dev = adi_i3c_master_attach_i2c_dev,
+ .detach_i2c_dev = adi_i3c_master_detach_i2c_dev,
+ .do_daa = adi_i3c_master_do_daa,
+ .supports_ccc_cmd = adi_i3c_master_supports_ccc_cmd,
+ .send_ccc_cmd = adi_i3c_master_send_ccc_cmd,
+ .priv_xfers = adi_i3c_master_priv_xfers,
+ .i2c_xfers = adi_i3c_master_i2c_xfers,
+ .request_ibi = adi_i3c_master_request_ibi,
+ .enable_ibi = adi_i3c_master_enable_ibi,
+ .disable_ibi = adi_i3c_master_disable_ibi,
+ .free_ibi = adi_i3c_master_free_ibi,
+ .recycle_ibi_slot = adi_i3c_master_recycle_ibi_slot,
+};
+
+static const struct of_device_id adi_i3c_master_of_match[] = {
+ { .compatible = "adi,i3c-master" },
+ {}
+};
+
+static int adi_i3c_master_probe(struct platform_device *pdev)
+{
+ struct adi_i3c_master *master;
+ unsigned int version;
+ int ret, irq;
+
+ master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL);
+ if (!master)
+ return -ENOMEM;
+
+ master->regs = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(master->regs))
+ return PTR_ERR(master->regs);
+
+ master->clk = devm_clk_get_enabled(&pdev->dev, "axi");
+ if (IS_ERR(master->clk))
+ return PTR_ERR(master->clk);
+
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0)
+ return irq;
+
+ version = readl(master->regs + REG_VERSION);
+ if (VERSION_MAJOR(version) != 0) {
+ dev_err(&pdev->dev, "Unsupported IP version %u.%u.%c\n",
+ VERSION_MAJOR(version),
+ VERSION_MINOR(version),
+ VERSION_PATCH(version));
+ return -EINVAL;
+ }
+
+ writel(0x00, master->regs + REG_ENABLE);
+ writel(0x00, master->regs + REG_IRQ_MASK);
+
+ ret = devm_request_irq(&pdev->dev, irq, adi_i3c_master_irq, 0,
+ dev_name(&pdev->dev), master);
+ if (ret)
+ return ret;
+
+ platform_set_drvdata(pdev, master);
+
+ master->maxdevs = MAX_DEVS;
+ master->free_rr_slots = GENMASK(master->maxdevs, 1);
+
+ writel(REG_IRQ_PEDING_CMDR, master->regs + REG_IRQ_MASK);
+
+ spin_lock_init(&master->ibi.lock);
+ master->ibi.num_slots = 15;
+ master->ibi.slots = devm_kcalloc(&pdev->dev, master->ibi.num_slots,
+ sizeof(*master->ibi.slots),
+ GFP_KERNEL);
+ if (!master->ibi.slots)
+ return -ENOMEM;
+
+ return i3c_master_register(&master->base, &pdev->dev,
+ &adi_i3c_master_ops, false);
+}
+
+static void adi_i3c_master_remove(struct platform_device *pdev)
+{
+ struct adi_i3c_master *master = platform_get_drvdata(pdev);
+
+ writel(0xff, master->regs + REG_IRQ_PENDING);
+ writel(0x00, master->regs + REG_IRQ_MASK);
+ writel(0x01, master->regs + REG_ENABLE);
+
+ i3c_master_unregister(&master->base);
+}
+
+static struct platform_driver adi_i3c_master = {
+ .probe = adi_i3c_master_probe,
+ .remove = adi_i3c_master_remove,
+ .driver = {
+ .name = "adi-i3c-master",
+ .of_match_table = adi_i3c_master_of_match,
+ },
+};
+module_platform_driver(adi_i3c_master);
+
+MODULE_AUTHOR("Jorge Marques <jorge.marques@xxxxxxxxxx>");
+MODULE_DESCRIPTION("Analog Devices I3C master driver");
+MODULE_LICENSE("GPL");

--
2.43.0



Return-Path: <linux-kernel+bounces-675801-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C501C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:23:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 81F1D3B27DE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:22:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B3465289358;
Fri, 6 Jun 2025 13:22:41 +0000 (UTC)
Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com [209.85.221.179])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96AB9289343;
Fri, 6 Jun 2025 13:22:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.179
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216161; cv=none; b=aGVMNYDQlYcn3AHOhrYw2JNtSDPYghBU3bdqE6Qjuoc6A41rxPW+D7SxpUOBknmi4jogvxZKh3tooTvIJA+aRd2oF6j1jpFydfDKBrLM1LjXJ9JNeLoyahWkzRlFKK93gAonC6tQkK4mm0LnFYLM4P6geWPXh8nD9+laQBxSVPs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216161; c=relaxed/simple;
bh=ZsoJUjaH+oW4xo2G82bXQWjuaJqme9bI2wN1OlWKaZA=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=AmX0g6XhaoR8qgkPq6VEJq5VPzuJ0qTsY7I+RL1eqSflfUGcgarZ6fgy0lUhm2ErGISH7dtTgF+oJsywii4KGg7ofpV6Ipy1zzA7dFmFgqf1zOgD2gYlb/myUVemyzX5uYL90IfcBkC9pzXhYr1NWvHNa7eZjdVC1ibyTi3/NsY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.179
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vk1-f179.google.com with SMTP id 71dfb90a1353d-52d9a275c27so1461756e0c.0;
Fri, 06 Jun 2025 06:22:39 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216157; x=1749820957;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=0WI/wExaY6eJYLw1Pr2aYNx1yhBsKo1FCeIuLICYqtY=;
b=QMP+snqcucIQwrjSGgPgYQgNDQ6EKvfTGF82x6Z7BnG5o+nngI3NZxZKyNx4RncCnF
A30Dxqwzmza4xFNcK64GBmsiv1NuhtmN7LhA4XAvu5QgrzE54OhTUprpxJdruck8Z88O
yWWLPxfXJt5qHKvdXa0e+dM1bKWArxCFobmvO/BwGzQqDRT0QnJayi7NKvLa/zDJBID+
S0tiPtVlfgZfrLiFQJEOqn9GCZEp62F7MDxU5q/hEp3s2Rm/1meE8Q4w4ni5+s7kTNUO
MWwlt97ftyyMREIBrGBm3jrm5Fmmgjt/Gr9rn7x2jIa1OUkFPIp8Sx/bYFKQcWRq6/e2
liVg==
X-Forwarded-Encrypted: i=1; AJvYcCUnyTWlyI+HoECMhU9WSAbfM4AbylSqTvNwoMMZ2fI9CDv/Znoijjf1oFvm70+8UJce8AcGmukmthq5Qhu8IzoLCXQ=@vger.kernel.org, AJvYcCVDaLUd8wbWxOH3Un+L/F69KqABVfcieoKnLy+EKtIye72Zq5MwW0eHHBxExuQjuGgc13sXFI3ZTot0@xxxxxxxxxxxxxxx, AJvYcCXnund3PeqyhEP9li4pBIJeuXcivDCoZGBWT0AgmLfaMVvC1YBmeHCe5OPE8xkoSXU6Lwi/oJK7I4SN@xxxxxxxxxxxxxxx, AJvYcCXy102tDK1ZxloQfgOlDGhbXLL7Tzuda5oKri3Hbpjpjh7uYnC44H58UtD1mONCMfzPOP86TIB4bUQz8JCd@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yz9ueEwgrGBp2Rw3L7MOUmpmcAGFswOBb6lsUUHtZzZHLmlegSZ
ZbR9YinUDOxiacFt0gj0NHEZQncsh7/02le7svjCG9+IX816UzJ/kIaW0f0X3dxG
X-Gm-Gg: ASbGncuxEFHRtr4J6/0VPWfGpeSj6CrdiOsoIxWXlkhuqVlPuZKB6Ky+ZWlWJuQmz/w
gY19Kz3PFxQYrBaO3WKXrkbrh5sEgOLYrbkxAc04R1+UACxFnipeN7+9ZtvtGSqw0vC3GhvWlkd
6+rQXm7RUeL6oexHU/37IVyc645to1CxXpezFgkNpOj0KAnWDhxxOXJzEdbcCP4F/CecYKcHl7r
v65mL2VU17h1yJtdWU6q0cqt2O+Smo+EZr+aj2pDa5a5fUZry4EdWy3IitKwCcAMt5ZLvv+Pzgi
R2qCmLeHIJ52AYlLn9WWIbzQG1W4SckY3y+PVdTlt+7AdQhXmeXwKyPQ2GNaO//oR/2RuZ+uh1e
MHhKAhd0dFPV+abyh3Xh/nJCFH+EvvktmxRM=
X-Google-Smtp-Source: AGHT+IHjyyUrgUoFL4ZLk6Amkq5vhXLvxbXBs+lVBPtlig3neeFV4+dsM3b/3HeVe8tHg2+BW+Sgyg==
X-Received: by 2002:a05:6122:4f97:b0:530:602c:4d4c with SMTP id 71dfb90a1353d-530e4799d82mr2720231e0c.1.1749216157504;
Fri, 06 Jun 2025 06:22:37 -0700 (PDT)
Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com. [209.85.217.42])
by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-530e64315aasm1074278e0c.48.2025.06.06.06.22.36
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:22:37 -0700 (PDT)
Received: by mail-vs1-f42.google.com with SMTP id ada2fe7eead31-4e47c2a9cdcso1436434137.1;
Fri, 06 Jun 2025 06:22:36 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCVYBy5/RJ31bNJPR3kg1Ws76xBY3d0kuBHAtJ+8+uw6emXe28y9ZzhjeOUv0cecDWCSqcZpXY+P3MbB@xxxxxxxxxxxxxxx, AJvYcCVYwkBvZJOTPhp5LrTeFf+c6x9K9i+YNvZs2AijehEyOeZoM/uLmdjs1Z3D1gCchoSHJqqA+XRliill/dPd4Ad+dpw=@vger.kernel.org, AJvYcCVw/gRh4ikMCZOTDoixQyuJ4ZaTJjqi8hKPnxKkBWtwrNazdiKemkKqcSqx/k9OgnwhSPydf3/Adl6r@xxxxxxxxxxxxxxx, AJvYcCXCPkuz7NMKOlXCGjwdsyS6jwgV3u4U50PZraRDuM1Sfz/6A0Dn/oBgAS54l1T9kSBMjAuflU5TL2X2IrQ6@xxxxxxxxxxxxxxx
X-Received: by 2002:a05:6102:2b9a:b0:4db:154e:ad1d with SMTP id
ada2fe7eead31-4e7728caademr3197869137.2.1749216156656; Fri, 06 Jun 2025
06:22:36 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250530143135.366417-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> <20250530143135.366417-4-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250530143135.366417-4-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:22:23 +0200
X-Gmail-Original-Message-ID: <CAMuHMdXtMYaXC3H2rq9bj5nAndbdHxSmKrd1Sfe+exSvbx8r1A@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFuZnGL2g4R1vtjMM1CxH1Pkf-zaqqHeM-r0-cbgiLfKvJLbRBgcT1l-mKY
Message-ID: <CAMuHMdXtMYaXC3H2rq9bj5nAndbdHxSmKrd1Sfe+exSvbx8r1A@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Chris Brandt <chris.brandt@xxxxxxxxxxx>, Andi Shyti <andi.shyti@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Magnus Damm <magnus.damm@xxxxxxxxx>, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>,
linux-renesas-soc@xxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 30 May 2025 at 16:31, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Document support for the I2C Bus Interface (RIIC) found on the Renesas
> RZ/N2H (R9A09G087) SoC. The RIIC IP on this SoC is identical to that on
> the RZ/T2H SoC so `renesas,riic-r9a09g077` will be used as a fallback
> compatible.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675802-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4757F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:23:39 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3F0E51672CD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:23:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B22B288CA1;
Fri, 6 Jun 2025 13:23:31 +0000 (UTC)
Received: from mail-vk1-f180.google.com (mail-vk1-f180.google.com [209.85.221.180])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 517C728852E;
Fri, 6 Jun 2025 13:23:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.180
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216210; cv=none; b=PJdGP8JzPpCIUFWy7VsHbXPDoZVtO7mg3dBvx7p56YNLlZXGYi6honPVsL4MksIRitXFN8r2xByUDkddMjOdF+KrsBOG7/LHHSjogRhSr6lFd7OcBtuxt4xyVjO5wsic5+5ZFIvY5t7sk7rX+Yae2dz+Nv4AxcZnFjH8pTfB4Lc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216210; c=relaxed/simple;
bh=1O43kLCCjpP+TNHlQ+g741PwHG3hmtdBwonuIrGfRoo=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=gZnlocDQjEAmaQCH8DN6zTLnBt8RcCpN8Vtaxisy6Y9kDhzBdRsYDh+nsEnfZPvFuI7RCorgcWOLbrFsaba+/6UnenuPgTdwVR3NL+mh3cBGkMcKuSfk6VwB7gswenmzYMZ4No/9JXHrAC2zqA/C7IIEWNA9ZvutxlTjNYYdr2E=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.180
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vk1-f180.google.com with SMTP id 71dfb90a1353d-530d764149eso569929e0c.1;
Fri, 06 Jun 2025 06:23:29 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216208; x=1749821008;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=NLGBlMljGxUzYj6zseFCN06dcUibxMge+KFFj/3wDMM=;
b=FJVASKvqetGoLk0RuwffwhhkVsGti67ijfEM9MQaRa2ozUqEUVgVsH70/cv8xYQ/ET
5Q3MzEDutHhS47VXPCFXrmQ1RBFdrMkpnY85mpDKUSGcoHrveFTIGDQwTpaUhCF2f3CR
DtUAsruBjtAcZT+dyMP34m34mjRldFvNSiWOhdZa6cGSsJ62OR8y/A/TS+/aBYAnjgZB
UvfBL1oqIw//O6/M+yEsRILI2NEHAZZ/dTL7hSq2jx6nbFMvRlEkTkwazac7sj8OnKrG
PeoAxZDFQs7BNLtI/4yME73HcJ5qEHt5QRCe3HeuXSrAD4rGz9Q2ZRlYGssUMmnks0gN
sfcA==
X-Forwarded-Encrypted: i=1; AJvYcCU5XKTopKajvrm++d2doJzX0HPIZocPLlo5YcNMBXzn21V1lj796Ex2ICPLe6mhZJqKAMJphSFkKXCs@xxxxxxxxxxxxxxx, AJvYcCVi4d/W1w6108hur19TAFPiCkmhqeXsU3VRKIOVjfULLFWH20HtXVcydM8vHDuFh5A+HgADfJMynHC2@xxxxxxxxxxxxxxx, AJvYcCVmBH1EsztcICbSTlCKtNDIw0wqUIz508O3huXpAKYCp8CLJyAUGga9x9Kq6LA7/SnHp99sbHWtiDdBXuS+nF8reC4=@vger.kernel.org, AJvYcCWMGHvjiMA3x8dhGchCskN4OKyunLtB2fV61yyiGwO0F4Q7nZJgDOZeU5c6YBRP76cVju2m/rrLjvuTxhiK@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YxK5H/Mv8T1AlGH8GjzBSNQlUJRXysS7en2Dsu9zyR/1VigSiUX
WPkgLXEqfejJGe6Gk0pt9s+VfOOk6zQs6+JffjISKs1EfY8LRBn4QkB5BDy++PUW
X-Gm-Gg: ASbGncuKV2wo4phWd6aDyrJ++4HusH8kYNLKZ95y0TpVQYf7/aOHKxSZhWj8n9gYT3u
DDmHDs8gPmqSyStaMSU5woYWtSqNAfrvhhrQx+naKg68SROSz5RmfnHuLYkA1CrtqwTwD1QC1m7
AN8tIflfPePN43O/rzK9XWEie+82wwbg8xR9aZy6MvPydU4M3KPXIVdPJLSOqhTpIUzj2PW+t1U
ZdFNhzsB2MIK0bYTGzQlGKjY4y9Oc/4oNglgHoSZM3CqO4airV8IUSnhtuebapIWH4FdWVHErg+
caLecmXban2jhiJ4qB7JGkxMcqkj1ySclHmsVj2/1yc/XD35sbGvYBkNv9CxGKD0Rwv87SNMDej
Zq9oJzRmyWeAnkg==
X-Google-Smtp-Source: AGHT+IHq2D9lKGc7g69migtcE+5GG57ZiCTikQJ1Q00qBHumZqKLVU0QDGedWKQjhEkcJhJCTk3Rlw==
X-Received: by 2002:a05:6122:82a4:b0:530:52d0:d021 with SMTP id 71dfb90a1353d-530e4890241mr3109914e0c.7.1749216207846;
Fri, 06 Jun 2025 06:23:27 -0700 (PDT)
Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com. [209.85.222.44])
by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-530e6411d61sm1078109e0c.41.2025.06.06.06.23.27
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:23:27 -0700 (PDT)
Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-87ea6361feeso632558241.3;
Fri, 06 Jun 2025 06:23:27 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCUXPQ7vL+261npMh4XpyX9m9leUUExl4F/NrEB+keJFPmnbaSPknqh6+S/PgRvYdczFwhWxoEHu/k2OAQ7z@xxxxxxxxxxxxxxx, AJvYcCVP/p3lLuesVWpDwtkRkIef8xrhizuB9L5EIg+8lg/f1eeeqQ+KKtC1gXwQez3H2yrgj0Wxx/Neea1g@xxxxxxxxxxxxxxx, AJvYcCX5+W6czwN6lYfNEsKxJ8Mh3XQIXFUqgMMrwBSKL+DRdZQNT63nwU0me46/qUgG6/49gBdM0H/VhAYH5PA/sokHGv0=@vger.kernel.org, AJvYcCXo4p+prSt76m0RlBdeTGy5RZtlDErNlHdupQDGbyeKm3AX6kiEmoNPc9zlI6bjPay2ExW8pFGaSlsN@xxxxxxxxxxxxxxx
X-Received: by 2002:a05:6102:3a0d:b0:4e5:babd:310b with SMTP id
ada2fe7eead31-4e7729af39emr2765647137.10.1749216207242; Fri, 06 Jun 2025
06:23:27 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250530143135.366417-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> <20250530143135.366417-5-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250530143135.366417-5-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:23:15 +0200
X-Gmail-Original-Message-ID: <CAMuHMdVshPg_xbZFb_TPRcKv8YxenzR-L0Zz8v7jXspbm_XF7A@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFsXpYx6ymQqw0Hxe6p0jBPNp2Xx59RXtnVFcr-qgO5qSij21Hb50FlPBDE
Message-ID: <CAMuHMdVshPg_xbZFb_TPRcKv8YxenzR-L0Zz8v7jXspbm_XF7A@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 4/6] i2c: riic: Pass IRQ desc array as part of OF data
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Chris Brandt <chris.brandt@xxxxxxxxxxx>, Andi Shyti <andi.shyti@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Magnus Damm <magnus.damm@xxxxxxxxx>, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>,
linux-renesas-soc@xxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 30 May 2025 at 16:31, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> In preparation for adding support for Renesas RZ/T2H and RZ/N2H SoCs,
> which feature a combined error interrupt instead of individual error
> interrupts per condition, update the driver to support configurable IRQ
> layouts via OF data.
>
> Introduce a new `irqs` field and `num_irqs` count in `riic_of_data` to
> allow future SoCs to provide a custom IRQ layout. This patch is a
> non-functional change for existing SoCs and maintains compatibility with
> the current `riic_irqs` array.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

No regressions on RZ/A1H, RZ/A2M, and RZ/Five, so
Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675803-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3654641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:24:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id EBA3017AD50
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:24:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 18E7A288CA8;
Fri, 6 Jun 2025 13:24:01 +0000 (UTC)
Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C8BC28852E;
Fri, 6 Jun 2025 13:23:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216240; cv=none; b=VPiMgmn6Ofw7Ug8fuiFSrHya2G6RjleDvQRGxFogiJtg0ketJHy8q6710CvP8/CIy9xNxXiMf0mcnVDliKKplYwf0SHvrn51PJiW4c6iMZOD/tmfbwYpXHHzsyEbhThl2PzUv9UJsYYFDmnUgTnO4mnTHxaJzwT1etPXFgT9Wo4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216240; c=relaxed/simple;
bh=ODzVjULCU7LA5AwD99W9he//DtffyhQ9WeBhknElp8I=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=CJd8SDf0k8oXFV0fJy1nFdfBuyhFdGxvxidyMVcvY7XDBPCKQMNPs2uFXGApCDc0mHFLLyKTwWKxvLn7lTR95HxRSNO1XJBMGCviSPdiM2GQX2Du6ejdrlSaJUDttVdMhbZGz3Y4VREXvKe48vUv334zzwHwITEGcyvVt2toJFo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.217.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-4e45ebe7ac1so451611137.2;
Fri, 06 Jun 2025 06:23:59 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216237; x=1749821037;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=mp5mCaEdHKFmEnLbLz+m6JFQFDxSV2BJAh/7PrIe5RY=;
b=jc+nexL360YBPZzkGL2lV8VWC/Q8BFpT9N4eKMVWDszFJrkvFmKYIDEK0QrFtiNRHv
aPmTcfci7/tRfYnV/MnI75xiWUEBPjGnf+RSAh4KdwouQSfM3nrYNzEICxodgFVRG7TC
B3e3kJBbPjCNHmpy7Dj5GYwhEokFI4mtkrTsXh8Z5I5hKCweDdkWjgsxkdIbEl2Z4Ul/
6Yu1v8IB9+WDTf+ZKiU5efmdCZFG8PA/5N60eBn1OTL0BHB1aug0ewiaRiBOHUDsuYwc
5EcfMFFVI8i97hDZPJH9LVYWgQ4dVy6041I55grKr7P8kBIcK45Qn67YgeyXRLtflXI3
750g==
X-Forwarded-Encrypted: i=1; AJvYcCVQklKoegDMYwbOFJIV2xJ298vgAYMh8AToInFNhfnbiX/nCHbLodSKvF+MHkEvMOEI4c6rNdrjua7E@xxxxxxxxxxxxxxx, AJvYcCWJP3Kq9wTrp8IACv2TBXflgeKWw3MD/r9fYiAGH7rhDzTJDWN4dyDFwXzLOSRgZbW4om/ZBicGMLDBWrI9XJcT6TU=@vger.kernel.org, AJvYcCWTeafZTyjtpWfhvfPEym/7Tg1K9oXqGRjy2VF7BQF+GpviSsa7mT+uwc009l8UHQZjJ8ldGFlthWYVPfWf@xxxxxxxxxxxxxxx, AJvYcCXGdH2xr0G/JcCeOqBwiDYUFVhSc9MEM9MKLa1dAz45JJxuiBiWG9FTBgANS1eKyZ5UfasOpg8+X5Kp@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzBP+69pdr2OQ3WwOqwa9gNyenexB1Aj0/hqdbAU8wP8n6oEh4G
9kah30Ktk9id7d8BfKMjl1Eb2vaQ5Vcx0FUkotpO035AQ79uF2ilW19TSJzvUGhL
X-Gm-Gg: ASbGnct1BUNNxHAJjxOTqOQaxjbjUMkvWUzTOQGg1E2K01iu68ZyIbPS5TlzuNj0YT5
x+qPk4qcmPQ5PhApqgS1gSUCd+4WFwxlAWDH94gIcuxF5Hr/fp+6DjhyqQ5IvWtTtCrLzNwXhBy
Xs5aoVQkwTh4TqjrAKXS/UzmbEhvChZ3w/0Vk923LfrJzqDW2v8bCOtH3Z5/PtXXjDFZqGgm5KR
7Iv/xtjkpMUWkurEEcEImTKGyRmd14fizcz+dN4N3RYiJwqDjNerWmp3TKHvVrkVtz20KM52Hxr
Jl872zrO22uzxMEf4QSbeyP+B5df2Spl2K3a879AbnfQe27bOGY86SzfwRteSfzhBbXjAXX6vbJ
C1iTmkp1XKNo3kR0SxX6JhVVR4H9hiN++hqM=
X-Google-Smtp-Source: AGHT+IHRUA+s4LhE0rQQMXTB8bxlu6SiKH0fWfYoPKkOqmyfNKC2GKnlf7ZkrcTPc2U4P/8hXYExyg==
X-Received: by 2002:a05:6102:e14:b0:4e5:9cf0:4eb6 with SMTP id ada2fe7eead31-4e772887fc2mr2641089137.5.1749216236842;
Fri, 06 Jun 2025 06:23:56 -0700 (PDT)
Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com. [209.85.217.54])
by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-87ec4dc0c21sm312759241.5.2025.06.06.06.23.56
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:23:56 -0700 (PDT)
Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-4e58ef9cb69so635017137.1;
Fri, 06 Jun 2025 06:23:56 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCUFZNlsL7bn8xSAt3Fr1TlgiTLvdr2YD607TR2wlgHIyll3wgcSF7+4uhPbd3ozAgGRUIDP9ZOBjwbI@xxxxxxxxxxxxxxx, AJvYcCVC5knTn0qwZLZI8VdGKqgpI8wTWzfHppTvxmCfIsVqyIChHY2H1fMiZEBvcj4ihHfotbEaIvde8jWiw5Em@xxxxxxxxxxxxxxx, AJvYcCVN7JYP07AspQGBSS0AekaxS+3pK0Ub+XaV0iuX+TRFEmVB0KNDDAOUMjOgtX7HcO0fi4yA8zh5Yo4A@xxxxxxxxxxxxxxx, AJvYcCWLw/eGGWw4irGKCdjHwKgUFjPpk/8GU/N7b2jphz6O2ZfVT7mk98TA0rg4AbKEP/nUTgw2p89CCg7hRQC2fPGF7Po=@vger.kernel.org
X-Received: by 2002:a05:6102:149f:b0:4c1:9780:3830 with SMTP id
ada2fe7eead31-4e772a0b67amr2750672137.23.1749216236152; Fri, 06 Jun 2025
06:23:56 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250530143135.366417-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> <20250530143135.366417-6-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250530143135.366417-6-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:23:43 +0200
X-Gmail-Original-Message-ID: <CAMuHMdVmzU6_3Na==q02jEb-mJmkA6oT1g+xP2RUw9UC1wEx9w@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFvn0KOWXwFEAW2t_z0vkiPVJ2lZPCcUTJH01Ivefj35RTpeaQ5i6J8a6R0
Message-ID: <CAMuHMdVmzU6_3Na==q02jEb-mJmkA6oT1g+xP2RUw9UC1wEx9w@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 5/6] i2c: riic: Move generic compatible string to end of array
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Chris Brandt <chris.brandt@xxxxxxxxxxx>, Andi Shyti <andi.shyti@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Magnus Damm <magnus.damm@xxxxxxxxx>, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>,
linux-renesas-soc@xxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 30 May 2025 at 16:31, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Reorder the entry in `riic_i2c_dt_ids` to place the generic compatible
> string `renesas,riic-rz` at the end of the array, following the
> convention used in other Renesas drivers.
>
> Also, drop the unnecessary comma after the sentinel entry, as it is
> not needed.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675804-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 15F5641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:25:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0280D3B2CA4
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:24:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BF37288C80;
Fri, 6 Jun 2025 13:24:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MoyErIVI"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10])
(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 E15A028852E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:24:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216295; cv=none; b=G83pu6Jh47gjML2nVLniEEg9xYCiIvFrJ13/pzIzdkVmf1rzj4IWdBb1Ix+xznghCeVd6hOV+DQojZwNCrnDpr2lZU8ahE5o4a+YjMM9HG+bX3NSZXdDIP7SMmlhFwqoEsJNtJT5WjGumkZHMfym+C2mA7ikoorE9dyysaW3zx0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216295; c=relaxed/simple;
bh=mR55Kc+kasQ+GdFfuLzdqz3KzIMWEML2Li9QTwOSxo4=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
MIME-Version:Content-Type; b=oqpWDIH7wQ/qmHgHiFyT8G7Ac2dQ2sbwrt6OlkjtBGmWLiStpjVY11WFdpueDcbbbw4TJGLSVmq/d+8ijNetjyVNKoLi8uRR36zSlNrLExFjinUCkkeqtQ/rM0uenSL3VOGPDJgC2ZyWdXHgh2LN+CgYLpL2IsS+endSiRalM5A=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MoyErIVI; arc=none smtp.client-ip=198.175.65.10
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749216293; x=1780752293;
h=from:to:cc:subject:in-reply-to:references:date:
message-id:mime-version:content-transfer-encoding;
bh=mR55Kc+kasQ+GdFfuLzdqz3KzIMWEML2Li9QTwOSxo4=;
b=MoyErIVI6LtQwVkvjNDLg6JV6EIvsFnp0H4utOzOnSwdoEqU+Y2eo+zE
1qnxlzcMHpuzMHFGxYK+bzjg7pnBQ0bC7ACPmQaBW9bzcHeeZxbQPxNmU
hajvR7FWDnhkE3eN1AjJUvqPckZm7nWL9x0u5FCFS8tDUR+YtGKjGkroy
ano7RCGWQN+rS2T9oti7afNeQF51vOgX2k911eDGrVUP4OD31t9bhCyEG
oBJfOThE4hu7iL8D0kzNMrcBwEPYrbQwV6b+6F/QIbrL93rSEJo/qWJWD
7JdUp0JAo5XYscsO953QjU9MA+OiW4Ucubpym1zTKN1aXTaxNMZ1M+e4H
A==;
X-CSE-ConnectionGUID: l38oyRKfSwGQGZ5QQirunA==
X-CSE-MsgGUID: izvhKUaRTjeorqo9BY23Iw==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="68805140"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="68805140"
Received: from orviesa009.jf.intel.com ([10.64.159.149])
by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 06:24:52 -0700
X-CSE-ConnectionGUID: Uu4+QIsIQTyV/d6ER5uSjQ==
X-CSE-MsgGUID: 8g3tbaSETyKuPkm74jU9BQ==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="145835952"
Received: from pgcooper-mobl3.ger.corp.intel.com (HELO localhost) ([10.245.245.33])
by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 06:24:46 -0700
From: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>
To: Jocelyn Falempe <jfalempe@xxxxxxxxxx>, Rodrigo Vivi
<rodrigo.vivi@xxxxxxxxx>, Joonas Lahtinen
<joonas.lahtinen@xxxxxxxxxxxxxxx>, Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
Ville =?utf-8?B?U3lyasOkbMOk?= <ville.syrjala@xxxxxxxxxxxxxxx>, David
Airlie
<airlied@xxxxxxxxx>, Simona Vetter <simona@xxxxxxxx>, Christian Koenig
<christian.koenig@xxxxxxx>, Huang Rui <ray.huang@xxxxxxx>, Matthew Auld
<matthew.auld@xxxxxxxxx>, Matthew Brost <matthew.brost@xxxxxxxxx>, Maxime
Ripard <mripard@xxxxxxxxxx>, Thomas Zimmermann <tzimmermann@xxxxxxx>,
intel-gfx@xxxxxxxxxxxxxxxxxxxxx, intel-xe@xxxxxxxxxxxxxxxxxxxxx,
dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Cc: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Subject: Re: [PATCH v8 5/9] drm/i915: Add intel_bo_panic_setup and
intel_bo_panic_finish
In-Reply-To: <20250606120519.753928-6-jfalempe@xxxxxxxxxx>
Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
<20250606120519.753928-6-jfalempe@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:24:43 +0300
Message-ID: <5e5014e3f1cbc9c91d2d6e4a3258c775a468bf46@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 06 Jun 2025, Jocelyn Falempe <jfalempe@xxxxxxxxxx> wrote:
> Implement both functions for i915 and xe, they prepare the work for
> drm_panic support.
> They both use kmap_try_from_panic(), and map one page at a time, to
> write the panic screen on the framebuffer.
>
> Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
> ---
>
>
> v5:
> * Use iosys_map for intel_bo_panic_map().
>
> v7:
> * Return int for i915_gem_object_panic_map() (Ville Syrj=C3=A4l=C3=A4)
>
> v8:
> * Complete rewrite, to use kmap_try_from_panic() which is safe
> to call from a panic handler
>
> drivers/gpu/drm/i915/display/intel_bo.c | 11 +++
> drivers/gpu/drm/i915/display/intel_bo.h | 3 +
> drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 +
> drivers/gpu/drm/i915/gem/i915_gem_pages.c | 92 ++++++++++++++++++++++
> drivers/gpu/drm/xe/display/intel_bo.c | 55 +++++++++++++
> 5 files changed, 165 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bo.c b/drivers/gpu/drm/i9=
15/display/intel_bo.c
> index fbd16d7b58d9..83dbd8ae16fe 100644
> --- a/drivers/gpu/drm/i915/display/intel_bo.c
> +++ b/drivers/gpu/drm/i915/display/intel_bo.c
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: MIT
> /* Copyright =C2=A9 2024 Intel Corporation */
>=20=20
> +#include <drm/drm_panic.h>
> #include "gem/i915_gem_mman.h"
> #include "gem/i915_gem_object.h"
> #include "gem/i915_gem_object_frontbuffer.h"
> @@ -57,3 +58,13 @@ void intel_bo_describe(struct seq_file *m, struct drm_=
gem_object *obj)
> {
> i915_debugfs_describe_obj(m, to_intel_bo(obj));
> }
> +
> +int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_=
buffer *sb)
> +{
> + return i915_gem_object_panic_setup(to_intel_bo(obj), sb);
> +}
> +
> +void intel_bo_panic_finish(struct drm_gem_object *obj)
> +{
> + return i915_gem_object_panic_finish(to_intel_bo(obj));
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_bo.h b/drivers/gpu/drm/i9=
15/display/intel_bo.h
> index ea7a2253aaa5..9ac087ea275d 100644
> --- a/drivers/gpu/drm/i915/display/intel_bo.h
> +++ b/drivers/gpu/drm/i915/display/intel_bo.h
> @@ -4,6 +4,7 @@
> #ifndef __INTEL_BO__
> #define __INTEL_BO__
>=20=20
> +#include <drm/drm_panic.h>
> #include <linux/types.h>
>=20=20
> struct drm_gem_object;
> @@ -23,5 +24,7 @@ struct intel_frontbuffer *intel_bo_set_frontbuffer(stru=
ct drm_gem_object *obj,
> struct intel_frontbuffer *front);
>=20=20
> void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj);
> +int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_=
buffer *sb);
> +void intel_bo_panic_finish(struct drm_gem_object *obj);
>=20=20
> #endif /* __INTEL_BO__ */
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm=
/i915/gem/i915_gem_object.h
> index c34f41605b46..9a0c1019dcad 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> @@ -9,6 +9,7 @@
> #include <drm/drm_gem.h>
> #include <drm/drm_file.h>
> #include <drm/drm_device.h>
> +#include <drm/drm_panic.h>
>=20=20
> #include "intel_memory_region.h"
> #include "i915_gem_object_types.h"
> @@ -691,6 +692,9 @@ i915_gem_object_unpin_pages(struct drm_i915_gem_objec=
t *obj)
> int __i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
> int i915_gem_object_truncate(struct drm_i915_gem_object *obj);
>=20=20
> +int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct =
drm_scanout_buffer *sb);
> +void i915_gem_object_panic_finish(struct drm_i915_gem_object *obj);
> +
> /**
> * i915_gem_object_pin_map - return a contiguous mapping of the entire o=
bject
> * @obj: the object to map into kernel address space
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/=
i915/gem/i915_gem_pages.c
> index 7f83f8bdc8fb..9bdbac3d9433 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
> @@ -3,6 +3,7 @@
> * Copyright =C2=A9 2014-2016 Intel Corporation
> */
>=20=20
> +#include <drm/drm_panic.h>
> #include <drm/drm_cache.h>
> #include <linux/vmalloc.h>
>=20=20
> @@ -354,6 +355,97 @@ static void *i915_gem_object_map_pfn(struct drm_i915=
_gem_object *obj,
> return vaddr ?: ERR_PTR(-ENOMEM);
> }
>=20=20
> +static struct page **i915_panic_pages;
> +static int i915_panic_page =3D -1;
> +static void *i915_panic_vaddr;

How do the per module variables work when you have multiple devices?

BR,
Jani.

> +
> +static void i915_panic_kunmap(void)
> +{
> + if (i915_panic_vaddr) {
> + drm_clflush_virt_range(i915_panic_vaddr, PAGE_SIZE);
> + kunmap_local(i915_panic_vaddr);
> + i915_panic_vaddr =3D NULL;
> + }
> +}
> +
> +static struct page **i915_gem_object_panic_pages(struct drm_i915_gem_obj=
ect *obj)
> +{
> + unsigned long n_pages =3D obj->base.size >> PAGE_SHIFT, i;
> + struct page *page;
> + struct page **pages;
> + struct sgt_iter iter;
> +
> + pages =3D kvmalloc_array(n_pages, sizeof(*pages), GFP_ATOMIC);
> + if (!pages)
> + return NULL;
> +
> + i =3D 0;
> + for_each_sgt_page(page, iter, obj->mm.pages)
> + pages[i++] =3D page;
> + return pages;
> +}
> +
> +/*
> + * The scanout buffer pages are not mapped, so for each pixel,
> + * use kmap_local_page_try_from_panic() to map the page, and write the p=
ixel.
> + * Try to keep the map from the previous pixel, to avoid too much map/un=
map.
> + */
> +static void i915_gem_object_panic_page_set_pixel(struct drm_scanout_buff=
er *sb, unsigned int x,
> + unsigned int y, u32 color)
> +{
> + unsigned int new_page;
> + unsigned int offset;
> +
> + offset =3D y * sb->pitch[0] + x * sb->format->cpp[0];
> +
> + new_page =3D offset >> PAGE_SHIFT;
> + offset =3D offset % PAGE_SIZE;
> + if (new_page !=3D i915_panic_page) {
> + i915_panic_kunmap();
> + i915_panic_page =3D new_page;
> + i915_panic_vaddr =3D kmap_local_page_try_from_panic(
> + i915_panic_pages[i915_panic_page]);
> + }
> + if (i915_panic_vaddr) {
> + u32 *pix =3D i915_panic_vaddr + offset;
> + *pix =3D color;
> + }
> +}
> +
> +/*
> + * Setup the gem framebuffer for drm_panic access.
> + * Use current vaddr if it exists, or setup a list of pages.
> + * pfn is not supported yet.
> + */
> +int i915_gem_object_panic_setup(struct drm_i915_gem_object *obj, struct =
drm_scanout_buffer *sb)
> +{
> + enum i915_map_type has_type;
> + void *ptr;
> +
> + ptr =3D page_unpack_bits(obj->mm.mapping, &has_type);
> + if (ptr) {
> + if (i915_gem_object_has_iomem(obj))
> + iosys_map_set_vaddr_iomem(&sb->map[0], (void __iomem *)ptr);
> + else
> + iosys_map_set_vaddr(&sb->map[0], ptr);
> +
> + return 0;
> + }
> + if (i915_gem_object_has_struct_page(obj)) {
> + i915_panic_pages =3D i915_gem_object_panic_pages(obj);
> + sb->set_pixel =3D i915_gem_object_panic_page_set_pixel;
> + i915_panic_page =3D -1;
> + return 0;
> + }
> + return -EOPNOTSUPP;
> +}
> +
> +void i915_gem_object_panic_finish(struct drm_i915_gem_object *obj)
> +{
> + i915_panic_kunmap();
> + i915_panic_page =3D -1;
> +}
> +
> /* get, pin, and map the pages of the object into kernel space */
> void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
> enum i915_map_type type)
> diff --git a/drivers/gpu/drm/xe/display/intel_bo.c b/drivers/gpu/drm/xe/d=
isplay/intel_bo.c
> index 27437c22bd70..eb9a3400c110 100644
> --- a/drivers/gpu/drm/xe/display/intel_bo.c
> +++ b/drivers/gpu/drm/xe/display/intel_bo.c
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: MIT
> /* Copyright =C2=A9 2024 Intel Corporation */
>=20=20
> +#include <drm/drm_cache.h>
> #include <drm/drm_gem.h>
>=20=20
> #include "xe_bo.h"
> @@ -59,3 +60,57 @@ void intel_bo_describe(struct seq_file *m, struct drm_=
gem_object *obj)
> {
> /* FIXME */
> }
> +
> +static int xe_panic_page =3D -1;
> +static void *xe_panic_vaddr;
> +static struct xe_bo *xe_panic_bo;
> +
> +static void xe_panic_kunmap(void)
> +{
> + if (xe_panic_vaddr) {
> + drm_clflush_virt_range(xe_panic_vaddr, PAGE_SIZE);
> + kunmap_local(xe_panic_vaddr);
> + xe_panic_vaddr =3D NULL;
> + }
> +}
> +/*
> + * The scanout buffer pages are not mapped, so for each pixel,
> + * use kmap_local_page_try_from_panic() to map the page, and write the p=
ixel.
> + * Try to keep the map from the previous pixel, to avoid too much map/un=
map.
> + */
> +static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsig=
ned int x,
> + unsigned int y, u32 color)
> +{
> + unsigned int new_page;
> + unsigned int offset;
> +
> + offset =3D y * sb->pitch[0] + x * sb->format->cpp[0];
> +
> + new_page =3D offset >> PAGE_SHIFT;
> + offset =3D offset % PAGE_SIZE;
> + if (new_page !=3D xe_panic_page) {
> + xe_panic_kunmap();
> + xe_panic_page =3D new_page;
> + xe_panic_vaddr =3D ttm_bo_kmap_try_from_panic(&xe_panic_bo->ttm,
> + xe_panic_page);
> + }
> + if (xe_panic_vaddr) {
> + u32 *pix =3D xe_panic_vaddr + offset;
> + *pix =3D color;
> + }
> +}
> +
> +int intel_bo_panic_setup(struct drm_gem_object *obj, struct drm_scanout_=
buffer *sb)
> +{
> + struct xe_bo *bo =3D gem_to_xe_bo(obj);
> +
> + xe_panic_bo =3D bo;
> + sb->set_pixel =3D xe_panic_page_set_pixel;
> + return 0;
> +}
> +
> +void intel_bo_panic_finish(struct drm_gem_object *obj)
> +{
> + xe_panic_kunmap();
> + xe_panic_page =3D -1;
> +}

--=20
Jani Nikula, Intel


Return-Path: <linux-kernel+bounces-675805-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1FEB841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:25:13 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 232333B2CAA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:24:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A421C28934C;
Fri, 6 Jun 2025 13:24:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bMeXzgKt"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 39526288C37
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:24:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216297; cv=none; b=WGuoyjJzGpuSw7ddFzkyKBADH9XKDjKUDMOFnOEUanZnephqH06vN9Tkv+P/n1q0SzZz135HpNtTkHzKWUhWUf/JEDp7yA+3p1i4J1HUCLgOfgSuxeqHvHWZ236XJoyfpMRfEg0GWaOBn9BFYIQy9aaU5XUIp0Y0T4r/nvYMHlM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216297; c=relaxed/simple;
bh=XaUFchsTlj47ki7jmwSOkGfvA6QoHDzYcRN06zVBsh0=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=si/dP7ZUTRUj3SbL1abCEZda+j03ooAeXjVSwD/vx/SNFR9R87VfgE5U4yODwS8kwpuxglQ7XDF+QUeCgsycC16wQ7/X/JXcOYAAjGJmkq2X9e5uMtfvlMVb8gD5RTeTOW8C3fX8lGs+H2HsvYhsNITKsA2XLOitSyaHcK89bWs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bMeXzgKt; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749216295;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=Ky+WeROHZ4Ae+uVfELGBGltSg87Rkj3Uw9xYsa9j3qg=;
b=bMeXzgKtFZH5L+oZf1hFR+XQI6E8Tbd/sEYeWgE75j5Rs4jXghP8SAo4wlrfFI16vuJtk+
LVSjAOXGf2EaHjNJuxT8dlTk3E6Oj6qFWAg0XUnZztTdhFpWZxmFZp1brkqiUSsPTAIbav
PSrrx4kbcrTWiMhLzJVQChORU/XrmWQ=
Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com
[209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-655-UTzIust-MY2jkAHA4zm9DA-1; Fri, 06 Jun 2025 09:24:54 -0400
X-MC-Unique: UTzIust-MY2jkAHA4zm9DA-1
X-Mimecast-MFC-AGG-ID: UTzIust-MY2jkAHA4zm9DA_1749216294
Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7d0962035b7so355967085a.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:24:54 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216294; x=1749821094;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=Ky+WeROHZ4Ae+uVfELGBGltSg87Rkj3Uw9xYsa9j3qg=;
b=OX/Jp8/ulewqUl6DJ6FD06Xcr6O7lJLWCCoWbszIDRiX8Yu+sa+Ecwwpul1I18ZroA
MFdjWgAU1U/9qmhdxRrHEkgLXVR7E6kRAHIVNc36HaUGWkI+4WXzet6nJlF5r6R9PXze
XzAJtYoIRHemXnonvrOj5Jl/QZBnrsblpS0ZUJe3hyoYCvdKFJBEvRWvYs7Mf1lPaAC2
V23hgr16tV4Q7Hxus0lD2/IfblAojbwZfzTZAN+Sg4waVL5XEpcbIQ12LKG7QlpIM2XE
mN55nD+y2YiVstRgKtNrklyk/Nc+yYQxTHA1xifajqpsZAAPXxsE8VeI2wsiVhGsgzCv
GPgQ==
X-Forwarded-Encrypted: i=1; AJvYcCUbjzQNzXsJCNbZX/B0ptadtuF6m5n8g9TJL5UI40vOtJOc2obo0kCRsV70OWmm7QDrUDyRzcqndJO8pS0=@vger.kernel.org
X-Gm-Message-State: AOJu0YzhTvy7/RW79n1Snpz1R0l+YYSpzB77QIylrZo3pBM2OISTnQoM
hKM6zXvlKROsbr/kJN4Yvm0jgNrsZvmWfU+KwLCvdLF4FzdoadQZVhYpFnzQrXRg9n104rOuGgi
mIXBrcRhpB06UAQlUiKuFqCejxP5LIQ9yUhcEaG/w6QY/CGdpQ2bKKJGBX2hi4wxO6Q==
X-Gm-Gg: ASbGncvg2jldj4P4MEGjtf3b07JaM00Y7hsefXz3UFNpus81jAqNja78UPFfAMNGb7j
prTPKCxhk1X2UjNcH6UcakFNNg53lVdKgOg0vWpiE9qD5hapviVBLXlFj1dYxNOqAl+5FJeWzhT
Ezb0dS3dZvchqLY664DZrwDfdpDuT7vBQBH1uaBQvQUpUKGivp/+PrX5hJ7pgHImBwWV4H+iY08
JOqFLPLw74O2tHk/AXNTqyX6O7dva/IjjFNXWcCWJ7nQJ7fY2RHmwaLPX6wwtTFpt0mOuN8JnDE
8g8=
X-Received: by 2002:a05:620a:2608:b0:7d0:9688:b650 with SMTP id af79cd13be357-7d22990277cmr623270885a.54.1749216293751;
Fri, 06 Jun 2025 06:24:53 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHyw7rhIbtMEbMw7aXS5kBcEv8c0niayT/VMXPsAHzS6JTC/rav5RqlYy0t+iQ6S4rhlqvdfA==
X-Received: by 2002:a05:620a:2608:b0:7d0:9688:b650 with SMTP id af79cd13be357-7d22990277cmr623265985a.54.1749216293377;
Fri, 06 Jun 2025 06:24:53 -0700 (PDT)
Received: from x1.local ([85.131.185.92])
by smtp.gmail.com with ESMTPSA id af79cd13be357-7d25a5948f8sm129289485a.49.2025.06.06.06.24.52
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:24:52 -0700 (PDT)
Date: Fri, 6 Jun 2025 09:24:50 -0400
From: Peter Xu <peterx@xxxxxxxxxx>
To: Tal Zussman <tz2294@xxxxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Jason A. Donenfeld" <Jason@xxxxxxxxx>,
Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>,
Christian Brauner <brauner@xxxxxxxxxx>, Jan Kara <jack@xxxxxxx>,
Andrea Arcangeli <aarcange@xxxxxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/3] userfaultfd: prevent unregistering VMAs through a
different userfaultfd
Message-ID: <aELsIq2uOT5d1Tng@x1.local>
References: <20250603-uffd-fixes-v1-0-9c638c73f047@xxxxxxxxxxxx>
<20250603-uffd-fixes-v1-2-9c638c73f047@xxxxxxxxxxxx>
<84cf5418-42e9-4ec5-bd87-17ba91995c47@xxxxxxxxxx>
<aEBhqz1UgpP8d9hG@x1.local>
<CAKha_sqFV_0TsM1NgwtYYY0=ouDjkO7OOZc2WsR0X5hK5AUOJA@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAKha_sqFV_0TsM1NgwtYYY0=ouDjkO7OOZc2WsR0X5hK5AUOJA@xxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 05:11:53PM -0400, Tal Zussman wrote:
> On Wed, Jun 4, 2025 at 11:10â?¯AM Peter Xu <peterx@xxxxxxxxxx> wrote:
> >
> > On Wed, Jun 04, 2025 at 03:23:38PM +0200, David Hildenbrand wrote:
> > > On 04.06.25 00:14, Tal Zussman wrote:
> > > > Currently, a VMA registered with a uffd can be unregistered through a
> > > > different uffd asssociated with the same mm_struct.
> > > >
> > > > Change this behavior to be stricter by requiring VMAs to be unregistered
> > > > through the same uffd they were registered with.
> > > >
> > > > While at it, correct the comment for the no userfaultfd case. This seems
> > > > to be a copy-paste artifact from the analagous userfaultfd_register()
> > > > check.
> > >
> > > I consider it a BUG that should be fixed. Hoping Peter can share his
> > > opinion.
> >
> > Agree it smells like unintentional, it's just that the man page indeed
> > didn't mention what would happen if the userfaultfd isn't the one got
> > registered but only requesting them to be "compatible".
> >
> > DESCRIPTION
> > Unregister a memory address range from userfaultfd. The pages in
> > the range must be â??compatibleâ?? (see UFFDIO_REGISTER(2const)).
> >
> > So it sounds still possible if we have existing userapp creating multiple
> > userfaultfds (for example, for scalability reasons on using multiple
> > queues) to manage its own mm address space, one uffd in charge of a portion
> > of VMAs, then it can randomly take one userfaultfd to do unregistrations.
> > Such might break.
>
> As I mentioned in my response to James, it seems like the existing behavior
> is broken as well, due to the following in in userfaultfd_unregister():
>
> if (!vma_can_userfault(cur, cur->vm_flags, wp_async))
> goto out_unlock;
>
> where wp_async is derived from ctx, not cur.
>
> Pasting here:
>
> This also seems to indicate that the current behavior is broken and may reject
> unregistering some VMAs incorrectly. For example, a file-backed VMA registered
> with `wp_async` and UFFD_WP cannot be unregistered through a VMA that does not
> have `wp_async` set.

This is true. Meanwhile it seems untrivial to fix the flag alone with the
prior per-vma loop to check compatibility. We could drop the prior check
but then it slightly breaks the abi in another way..

Then let's go with the change to see our luck.

Could you mention more things when repost in the commit log? (1) wp_async
bug, (2) explicitly mention that this is a slight ABI change, and (3) not
needed to backport to stable.

Thanks,

--
Peter Xu



Return-Path: <linux-kernel+bounces-675806-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 92AF841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:26:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 214AA189E785
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:26:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 72F65288CA7;
Fri, 6 Jun 2025 13:26:01 +0000 (UTC)
Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FC9828852E;
Fri, 6 Jun 2025 13:25:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216361; cv=none; b=lTxXdOjyLz6oeucgUOP6FZ2wFog9vgQW/MzRAHDouO7uYWoe1MokzIf1sWO/+ou3rZ/a5FpFZOSWO17P7v0uSidB1c/FYHBly5Zk4sxfCcby4myhTBdOG7uOTLmUZnV3ZPNLWz61xsMINaagQ75Mw67pqzr0oJvjRPrvaAkpgAw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216361; c=relaxed/simple;
bh=HlmQyiD7lRAJAjekPuStEFPuTq66ZgP31O0JnrgtbHk=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=gPSYP+X1LtU0ggFd1SN7UNdCl3o1OISxDTV6uGPfjo+xs4YmNOyAvjlE33X0bbVKdGjs4fvezFIRiOmghPaqT865pktvmMXdTERkWqcuCvZtLHvUnHg37EfejNPsphljgykd6weEQT8WNl8RPrnN2METwTyWw4zJLxNGchTaf7Q=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.217.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-4e7561d3466so656710137.0;
Fri, 06 Jun 2025 06:25:59 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216357; x=1749821157;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=PA1efIKwevEKJ6PmR6nxG1RXXlI/tsd7nqF/WhwHFDg=;
b=tD6YljsItJKd8CVbwoH143qI3rHaAWQoJTJbsi0eiirVMkrFB6dp8LIPvAuv7KvmYp
oG4Z7nasdEMSJ9yPq2t9jTDEPJPSTOz8s28ws8Xj37/V0cJs390gVPC1+nsnAmD0MWRa
mulVLhh6KJYGrqUpqPJcOz05oGDwPwXDsUk3cpgK8f99gM3chUkqLuBcasyx2ywKfMB0
eMv2laJ1zaCKDgSV1wX/RaEp84ELKm5TpI+UoALoc9i7sUTRvGW5/dEOZ8NVKZX40uTr
kc0ce/jVPi18EF/Z7ClXduYydpfuVe95KG4Gf8jUQC77pga+uR5DVtc4D1HEG9ZIY2dB
laBQ==
X-Forwarded-Encrypted: i=1; AJvYcCW+bLWIxq3+JyvTa5WIfkTjJrm14dP8OUAj9jfzqGNp8M5r46FcwVkhdNnB/ITzyF4q6K3AsXLE9kdLmuVRBvEH/I8=@vger.kernel.org, AJvYcCW22m1FK2DqvHvk4HDIkvNOjC7kurot9QyZpwHRGG1ffrY+b8Z5DJ9o0LPZOtGPYximN/ehUS9xfjMP@xxxxxxxxxxxxxxx, AJvYcCWVcSbXKXPfbK0ltsFof75ft1w8VTsLy26BU3qnBycIXu4uGZvvB9BK74rfQZXtYV78e1JepV93A5as4keG@xxxxxxxxxxxxxxx, AJvYcCWfhhKnZjP6kvMenjSt4sP+Doq2gudXBOsxb6WQeigt4QxMOjzGE8By/5CzoBOcsVoK/EKqJDP+JIzW@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YwmlzaJmvmS2749JnYLQSPI2GzYPCUAOsZh2v6PdyAfQfSkPZnX
ADJzk939X8AFwDZHIvM2M9DJLcGNCa8nm7bFhMww/dY74VcMHTwWg9tnoDK3qC6z
X-Gm-Gg: ASbGncv3BTJfC7vD+xJat5i3frMeLzHycvvn/UCkxETQPZnq3SVyji43PNicNrixDWs
eaVV0W4cBrCfLBT8NjXJYbi39RG3hdZAFb3R3UhDwoWOu9A8n8ck22OsNgiKf7zW5HHbRVVyJ7G
dVSq+LCoH8PP2GQbdurAUzsp7nAlzUfXzSM+Se3ujvCIieXckDKEqFBr6Pr3WFWjyyScLVS3al6
KkHQhXUIyQbs6IRNPU6C+VlT1rcf2VySvTwXmtBya0QXJOt8+aq23hKFKm4uIxbn/KMXF985HYc
TKKdH9mk9FLE0zNhK/0wkvhiAtFHPWcErEVoENC7rS9b4a+OzPpAiocFoC7y/YPUug9mWJOfz2q
KVfkLlWcg1PUYLamG4NzdJ8qK
X-Google-Smtp-Source: AGHT+IF/qQBp9p1aqHwZklw6BFWt3YtdokV535zi0/OBCD5JhqoJw7lKmSjbCHAaRH2Le0omLv/Y5w==
X-Received: by 2002:a05:6102:41a7:b0:4e6:ddd0:96ea with SMTP id ada2fe7eead31-4e7728badc8mr2617904137.10.1749216357589;
Fri, 06 Jun 2025 06:25:57 -0700 (PDT)
Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com. [209.85.222.51])
by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4e7737d37c2sm1149780137.5.2025.06.06.06.25.57
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:25:57 -0700 (PDT)
Received: by mail-ua1-f51.google.com with SMTP id a1e0cc1a2514c-86f9c719d63so572387241.1;
Fri, 06 Jun 2025 06:25:57 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCWEbUD2Gavn4iUuipM99X4WKbXhm4HV2smXLUY9JDvikEGA+K1UBqnu1S1gS8vz67xYya7DNqenZfQAZ3cd@xxxxxxxxxxxxxxx, AJvYcCWTHUjJxU/HruAC+4AkqYJ0m2M3a/BAJpIPf1cHpYhTjq42RV15js0S9LXInB8tuGaSZbs5V99K3bR6@xxxxxxxxxxxxxxx, AJvYcCWkwXWJYuUWjN2yD4qcakNotrYjXpfjnTiO+zI8iJ2Q+p+6ZWDpWWjI4MmGihfWibLCbKoLKmGlY7Xa@xxxxxxxxxxxxxxx, AJvYcCXUrGFhmwSNABqA5c03+pLUtTF45LTpPPBMUpLGNVmuUHBsyal3z3U1EqqEHhcsq8DPjFNmEAtLuzhbHWqPf/Ai6Ss=@vger.kernel.org
X-Received: by 2002:a05:6102:534f:b0:4e5:a567:8e57 with SMTP id
ada2fe7eead31-4e772a087cbmr3025305137.24.1749216357192; Fri, 06 Jun 2025
06:25:57 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250530143135.366417-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> <20250530143135.366417-5-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250530143135.366417-5-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:25:45 +0200
X-Gmail-Original-Message-ID: <CAMuHMdWeBa2fzSKL1Q9jgr3NgoDuQZsGnZbu42cnEoEJSoiNEQ@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFtfDLFR8_lgMUMxpakZL3MpfYTfvPNdY5fs0NEbOi2ivKeG8bfrE6iA-XI
Message-ID: <CAMuHMdWeBa2fzSKL1Q9jgr3NgoDuQZsGnZbu42cnEoEJSoiNEQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 4/6] i2c: riic: Pass IRQ desc array as part of OF data
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Chris Brandt <chris.brandt@xxxxxxxxxxx>, Andi Shyti <andi.shyti@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Magnus Damm <magnus.damm@xxxxxxxxx>, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>,
linux-renesas-soc@xxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Prabhakar,

On Fri, 30 May 2025 at 16:31, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> In preparation for adding support for Renesas RZ/T2H and RZ/N2H SoCs,
> which feature a combined error interrupt instead of individual error
> interrupts per condition, update the driver to support configurable IRQ
> layouts via OF data.
>
> Introduce a new `irqs` field and `num_irqs` count in `riic_of_data` to
> allow future SoCs to provide a custom IRQ layout. This patch is a
> non-functional change for existing SoCs and maintains compatibility with
> the current `riic_irqs` array.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> ---
> drivers/i2c/busses/i2c-riic.c | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
> index 23375f7fe3ad..4950b790cfe7 100644
> --- a/drivers/i2c/busses/i2c-riic.c
> +++ b/drivers/i2c/busses/i2c-riic.c
> @@ -102,6 +102,8 @@ enum riic_reg_list {
>
> struct riic_of_data {
> const u8 *regs;
> + const struct riic_irq_desc *irqs;
> + u8 num_irqs;
> bool fast_mode_plus;
> };
>

> @@ -607,10 +611,14 @@ static const u8 riic_rz_a_regs[RIIC_REG_END] = {
> static const struct riic_of_data riic_rz_a_info = {
> .regs = riic_rz_a_regs,
> .fast_mode_plus = true,
> + .irqs = riic_irqs,
> + .num_irqs = ARRAY_SIZE(riic_irqs),

Nit: Perhaps initialize the members in the order of declaration?

> };
>
> static const struct riic_of_data riic_rz_a1h_info = {
> .regs = riic_rz_a_regs,
> + .irqs = riic_irqs,
> + .num_irqs = ARRAY_SIZE(riic_irqs),
> };
>
> static const u8 riic_rz_v2h_regs[RIIC_REG_END] = {
> @@ -631,6 +639,8 @@ static const u8 riic_rz_v2h_regs[RIIC_REG_END] = {
> static const struct riic_of_data riic_rz_v2h_info = {
> .regs = riic_rz_v2h_regs,
> .fast_mode_plus = true,
> + .irqs = riic_irqs,
> + .num_irqs = ARRAY_SIZE(riic_irqs),

Likewise.

> };
>
> static int riic_i2c_suspend(struct device *dev)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675807-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AF3A641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:26:38 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6AFA117B056
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:26:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A03D4288CBD;
Fri, 6 Jun 2025 13:26:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D7l7ogoD"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDB74288C21;
Fri, 6 Jun 2025 13:26:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216388; cv=none; b=QDv1jAg1bRFyVH8k/ULnXMsDKETH4KXUpeDE1cO71E0+v1tyPzoGpZGt5sVr4/1W2p3i4bAczKemaQk+t+nDuefdg3fuRL48NaWrVFfuCez4aMySRAJe8FeAlPxhZyElyohpT3pE84e+TQ639Cp87WdNEzUNpfUHeBYHx9VGzeY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216388; c=relaxed/simple;
bh=Z/dWd9rA9GTOYSgrU43nybvWakOOsjsLc4UhtvDk3G8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=LR+Vj8krisYLIiv6tgqzW7L6Jwe5w/AGOQ6Jr/VjHnQacpxWVaUGfVqp2/qra7W6+6uTAM0HD5oK4DvNGWcES6IxpuA+K0WsyZiUZioADq/ZobojO+UrzGTy4XrY0XJan4H0oU871kgBUavSNc6oIgXmsvnIeqPsM6OEex9NZ9w=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D7l7ogoD; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B120C4CEED;
Fri, 6 Jun 2025 13:26:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749216387;
bh=Z/dWd9rA9GTOYSgrU43nybvWakOOsjsLc4UhtvDk3G8=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=D7l7ogoDU3evrTZJxuGtWePx8NtwxE4u+ULL6FopavgRWdOFDHnSxl9AGRi/Vq0SZ
Il0hxQqFwy1xdiQCDvHLqTJX5LhEBuQfhrBJqMI4EYVPg52cuF/ZBDojf4V7iPJtSK
uyIHZy3Ny/IGm9hZmMH9O8UuQaBja87IIpRXO4monGycYYL7ef/pn0cTTuNt50iNJu
GXOy+egMZrDv0XVeJfsr3EEpHl4Xo+yOfwxsYvYXSEuxDollnDn5Ms8E9Zuz6eN4hJ
Ij33SGWp+3wCgelPLEaK7dYQmCLKrjc+VcbSdTn2T1M77p5KNsKvgZRv7hCiyepiQa
J6AMpF/XfEqZQ==
Date: Fri, 6 Jun 2025 15:26:19 +0200
From: Danilo Krummrich <dakr@xxxxxxxxxx>
To: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Cc: Miguel Ojeda <ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>,
"Rafael J . Wysocki" <rafael@xxxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
rust-for-linux@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-acpi@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?iso-8859-1?Q?Bj=F6rn?= Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>,
Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Len Brown <lenb@xxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>,
Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>,
Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
Subject: Re: [PATCH v2 0/5] rust: Add ACPI match table support for Rust
drivers
Message-ID: <aELsexA6yvW8ai9-@pollux>
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 05:19:56PM +0100, Igor Korotin wrote:
> This patch series introduces support for ACPI match tables in Rust
> drivers.

Which commit does this patch series apply to?

In general, I recommend to use '--base' on 'git format-patch'.


Return-Path: <linux-kernel+bounces-675808-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EF3D441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:28:28 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 9858F189E891
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:28:42 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A11EB288CAE;
Fri, 6 Jun 2025 13:28:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A4YzpGvl"
Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 114D4433AC;
Fri, 6 Jun 2025 13:28:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216500; cv=none; b=b1rCbjb2U/3CORzmh/9flZcNCvlGE+IVInTjbAjM2J4xmS+bgMVuOgMzI0pMyjodWUoO0pJgB+CBf4iN/2wb5rm8tCuLkymTkLMyUiTzZqwMiCnY4WKhiWEAgX3dECuz/KptAF3+I2VmB8pT0BCTH8+Q9LwR8BZEzW5ylNGn71k=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216500; c=relaxed/simple;
bh=lStWFN05KBUEosEhtBYZ9ONh/8t5JOiGDv2syrsmQe8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=H4GmtXNeKCVcXJE1kWB+Aqf+PRCg16a0yyiFR26D6Jrg6/4oSEn9XI7LozlgWa4hf7yWp8JiSl9X1TfLD9Okqw2jDJhL4D6Fa07ZQour/6Y598NzGplXGYQTjMPUZqSL/NKkRBPbB64DA5shqGk1z5GflzQ/b4wsTpRRimJsbn0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=A4YzpGvl; arc=none smtp.client-ip=209.85.214.179
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-234d366e5f2so25580015ad.1;
Fri, 06 Jun 2025 06:28:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749216497; x=1749821297; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id
:reply-to;
bh=KTegNuqrzt3gKagTIOaKfGpBHiW0UAiaKMfj1a7uVEs=;
b=A4YzpGvlbKN2k7RnY7DikQVAae2JxfLdB8dMCVjTxeTAzqKzDybEq8s2LA7BtWJQYf
Bj1e2kP1I3tJcfPdMt1zvxqtRt8u4KpQ7y8cbBRlM1wA8kpIdjIyluW93WtISdJj801h
jiR5McvyylRAd6Fk46g6KJX8LZ2i1eaAFsfxs9XLCpuh72oLadJDbKWMZlab8goxW7Xd
7AEeewT3mZOZDfcp2dWQ+0EycPSVpMUvpM06IhbtxbhfkSY41WMM5rOrdUS4CPzCNT2o
mMZwnpX5mNXdq/dSellELlK44jqVKxckoOri+kcTTEYIj6Flq5FE9U3t6Su0S26C00BY
L8Hw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216497; x=1749821297;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=KTegNuqrzt3gKagTIOaKfGpBHiW0UAiaKMfj1a7uVEs=;
b=PCPfh2JSbFTiAWuRVTNMNJbkCJS76uSRajYlbbr/hl13yAdYQVfFGabsUfxA2DuDXB
mxc3HCXHiT3v8DWeDiVJ53IK4ogRTzElNIfzFAI7UUTp3wSi3zs0Yg/gb5+6hvO+yct8
hZOXTvGnUFNcaFr0ez5FqpTb5B5dWEDpn17cATBYU129W+GSY9+aoL1U0Af+oZkwfOZb
/DRHFxeI3K0pvqE99o1HxOGmK3IKMVr8h6hYGgQ0vi88qkMi0/qRZQEWi/Nx4ggGDe69
PFC1LBa9OqWuq0BtewOx/ySVUo684nPi5kFtpZ4jZCcikfD4yNl8F7Tku/46yoExhO/2
hV7Q==
X-Forwarded-Encrypted: i=1; AJvYcCWIBEMElSkysdbETNNwF1vfp1sza9f+O+ePRsAXiAluMHPuFjA8YbuVT2jcd761dCgfPSGrfGoL@xxxxxxxxxxxxxxx, AJvYcCWgs2tS4DLivFxGkIDVTbq+mPs6m2Ah6uZslkSVCGiFbEXX4LAVFXvkAaGcJn6PDBiThUhib01K3ua1zA==@vger.kernel.org, AJvYcCXIgw5h5o0mVAsMh1hwVEnH/3prCeFn5rYzOayeWj1h8kOB5y9aVsRT/Pu9N2aHJxzEBeLpmi7O2iOqkE9m@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yw+IJu0HfBlclvlnLl04tJ/LnDnYPhzPdqMOBfkvLq95k+yVugx
1wHcI5Zng25ytuBYJqRnL9+F/oHDzHATnxJoytL0HMI6DHJYfFTX+vn2
X-Gm-Gg: ASbGncvf5QagD+V/NwUN0XuUa2nn1KLSu51m/lQJcnz0/lYYoomtA2H6fI4jh1syqew
HazqYnDk/M/VAprHEt/SyQadv97xFJSJPXKGCp3wbhvRpDICCB7AF8yZASNdeKaIafricaNf2Nr
Y2mpENT5mrydR5vPmy+5dnnDZrDd/E8K7CvYI6oWezu+SuIWvC/BvLojqzmj8CI1I+gmGtZETrd
RtLjBPfELt6DSL1RZiz8bv9hom2hE//sqWCigcYmAVQAJ6K7TwB5+e0ET9PVO3Wkhzh6mNCtCtk
j9tbEag7WJdXQX8/qpoKjyc6vLuxjwTnW/Z1PXuePitS6XvwG8EN1BlX65xEbHHzDtg61aNVMWQ
=
X-Google-Smtp-Source: AGHT+IHE8g080vlp+6jRvIwvEJW60lAMP7cUpeAu9+WDcZPbdxQ6k42dMYN4XsYp4WIx1kOYxtI9IA==
X-Received: by 2002:a17:902:e80d:b0:235:e96b:191c with SMTP id d9443c01a7336-23601d25bcbmr50342415ad.29.1749216497128;
Fri, 06 Jun 2025 06:28:17 -0700 (PDT)
Received: from server.roeck-us.net ([2600:1700:e321:62f0:da43:aeff:fecc:bfd5])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-236032fcf2esm12172135ad.123.2025.06.06.06.28.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:28:16 -0700 (PDT)
Sender: Guenter Roeck <groeck7@xxxxxxxxx>
Date: Fri, 6 Jun 2025 06:28:15 -0700
From: Guenter Roeck <linux@xxxxxxxxxxxx>
To: Gui-Dong Han <hanguidong02@xxxxxxxxx>
Cc: jdelvare@xxxxxxxx, linux-hwmon@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, baijiaju1990@xxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] hwmon: (ftsteutates) Fix TOCTOU race in fts_read()
Message-ID: <98f33209-be61-4a5f-8f0d-41f6570f79dc@xxxxxxxxxxxx>
References: <20250606071640.501262-1-hanguidong02@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606071640.501262-1-hanguidong02@xxxxxxxxx>
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 07:16:40AM +0000, Gui-Dong Han wrote:
> In the fts_read() function, when handling hwmon_pwm_auto_channels_temp,
> the code accesses the shared variable data->fan_source[channel] twice
> without holding any locks. It is first checked against
> FTS_FAN_SOURCE_INVALID, and if the check passes, it is read again
> when used as an argument to the BIT() macro.
>
> This creates a Time-of-Check to Time-of-Use (TOCTOU) race condition.
> Another thread executing fts_update_device() can modify the value of
> data->fan_source[channel] between the check and its use. If the value
> is changed to FTS_FAN_SOURCE_INVALID (0xff) during this window, the
> BIT() macro will be called with a large shift value (BIT(255)).
> A bit shift by a value greater than or equal to the type width is
> undefined behavior and can lead to a crash or incorrect values being
> returned to userspace.
>
> Fix this by reading data->fan_source[channel] into a local variable
> once, eliminating the race condition. Additionally, add a bounds check
> to ensure the value is less than BITS_PER_LONG before passing it to
> the BIT() macro, making the code more robust against undefined behavior.
>
> This possible bug was found by an experimental static analysis tool
> developed by our team.
>
> Fixes: 1c5759d8ce05 ("hwmon: (ftsteutates) Replace fanX_source with pwmX_auto_channels_temp")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Gui-Dong Han <hanguidong02@xxxxxxxxx>

Applied.

Thanks,
Guenter


Return-Path: <linux-kernel+bounces-675809-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C5FC041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:28:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 308DC7AA231
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:27:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D7505289364;
Fri, 6 Jun 2025 13:28:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rN8ugWxS"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D78CD288CB4;
Fri, 6 Jun 2025 13:28:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216501; cv=none; b=cPzqqEIDs5qAeaIFPGQ9zW8JwyC/BF3xDjgorlowp43nnondjO8hHsxT2l7z8Xcie6lq4krZN2hKsHPQUYmLDKB32y+akXgBmMxPGURNsgGgIqoEOXwGwvQTiSFrrFoT5aiCz8wAjX7jHHAa0fuiGB63o3Kww1gRFY65FWX6B+o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216501; c=relaxed/simple;
bh=YgSQOMAF2b5WWx7Y03Wg5UQpUV9r7pptM31Y3UsFm78=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=B0q/Gbj9z3CzWVZLi94D32wir9/jDCLgjOH8XAN48Cw23qEyjts2ORFHEoEuOUdQlYHzdQKszXZvB4egorQ7WW4z/qUs4Upj76BoeHvqGSFs+hnmIFiWaoBsEex0kRs+TfmYvb1kceyYBhvAzT9wYKuF82sYydDwhbaAmlDvBtc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rN8ugWxS; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FA8BC4CEEB;
Fri, 6 Jun 2025 13:28:20 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749216500;
bh=YgSQOMAF2b5WWx7Y03Wg5UQpUV9r7pptM31Y3UsFm78=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=rN8ugWxSko1Du8wyQZwMk9xXJz45NS6VyiTEPvYWNMtRn3xY8qTPvAwSlEk5juxLy
6aZGXIC3ShnkOldnw6uBPRDHwDCr7AaScNEqVzTAhis1wrPGmHIyJKBo1O0QNHvoVD
3wXQe0LzAWWdUImGcdGNHaY22PMKAZN4kxLdElVYJ1cDS//9gSxO4wNqmHb4eYvV+d
UOTGxpaE1NK4RJVae9px0rPmHbJJCiknMjP3LZrAmwbOcVhPPHnRmPv7K/3sXd7XYy
pzBxDVWZWcpXStnkX+1psNpVfpBViZnAdvpo2s9+BBw2GqVVX2J7NRNCK8qklRc1o0
KEPTwteWRB9Tg==
Date: Fri, 6 Jun 2025 08:28:18 -0500
From: Rob Herring <robh@xxxxxxxxxx>
To: Frank Li <Frank.Li@xxxxxxx>
Cc: Andrew Lunn <andrew+netdev@xxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Stefan Wahren <wahrenst@xxxxxxx>,
"open list:NETWORKING DRIVERS" <netdev@xxxxxxxxxxxxxxx>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" <devicetree@xxxxxxxxxxxxxxx>,
open list <linux-kernel@xxxxxxxxxxxxxxx>, imx@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v2 1/1] dt-bindings: net: convert qca,qca7000.txt yaml
format
Message-ID: <20250606132818.GA1246648-robh@xxxxxxxxxx>
References: <20250602224402.1047281-1-Frank.Li@xxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250602224402.1047281-1-Frank.Li@xxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Mon, Jun 02, 2025 at 06:44:01PM -0400, Frank Li wrote:
> Convert qca,qca7000.txt yaml format.
>
> Additional changes:
> - add refs: spi-peripheral-props.yaml, serial-peripheral-props.yaml and
> ethernet-controller.yaml.
> - simple spi and uart node name.
> - use low case for mac address in examples.
> - add check reg choose spi-peripheral-props.yaml or
> spi-peripheral-props.yaml.
>
> Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
> ---
> change in v2
> - add Ethernet over UART" description here back
> - add add check reg choose spi-peripheral-props.yaml
> - move spi related properties in if-then branch
> - move uart related properies in if-else branch
> ---
> .../devicetree/bindings/net/qca,qca7000.txt | 87 ---------------
> .../devicetree/bindings/net/qca,qca7000.yaml | 104 ++++++++++++++++++
> MAINTAINERS | 2 +-
> 3 files changed, 105 insertions(+), 88 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/net/qca,qca7000.txt
> create mode 100644 Documentation/devicetree/bindings/net/qca,qca7000.yaml
>
> diff --git a/Documentation/devicetree/bindings/net/qca,qca7000.txt b/Documentation/devicetree/bindings/net/qca,qca7000.txt
> deleted file mode 100644
> index 8f5ae0b84eec2..0000000000000
> --- a/Documentation/devicetree/bindings/net/qca,qca7000.txt
> +++ /dev/null
> @@ -1,87 +0,0 @@
> -* Qualcomm QCA7000
> -
> -The QCA7000 is a serial-to-powerline bridge with a host interface which could
> -be configured either as SPI or UART slave. This configuration is done by
> -the QCA7000 firmware.
> -
> -(a) Ethernet over SPI
> -
> -In order to use the QCA7000 as SPI device it must be defined as a child of a
> -SPI master in the device tree.
> -
> -Required properties:
> -- compatible : Should be "qca,qca7000"
> -- reg : Should specify the SPI chip select
> -- interrupts : The first cell should specify the index of the source
> - interrupt and the second cell should specify the trigger
> - type as rising edge
> -- spi-cpha : Must be set
> -- spi-cpol : Must be set
> -
> -Optional properties:
> -- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at.
> - Numbers smaller than 1000000 or greater than 16000000
> - are invalid. Missing the property will set the SPI
> - frequency to 8000000 Hertz.
> -- qca,legacy-mode : Set the SPI data transfer of the QCA7000 to legacy mode.
> - In this mode the SPI master must toggle the chip select
> - between each data word. In burst mode these gaps aren't
> - necessary, which is faster. This setting depends on how
> - the QCA7000 is setup via GPIO pin strapping. If the
> - property is missing the driver defaults to burst mode.
> -
> -The MAC address will be determined using the optional properties
> -defined in ethernet.txt.
> -
> -SPI Example:
> -
> -/* Freescale i.MX28 SPI master*/
> -ssp2: spi@80014000 {
> - #address-cells = <1>;
> - #size-cells = <0>;
> - compatible = "fsl,imx28-spi";
> - pinctrl-names = "default";
> - pinctrl-0 = <&spi2_pins_a>;
> -
> - qca7000: ethernet@0 {
> - compatible = "qca,qca7000";
> - reg = <0x0>;
> - interrupt-parent = <&gpio3>; /* GPIO Bank 3 */
> - interrupts = <25 0x1>; /* Index: 25, rising edge */
> - spi-cpha; /* SPI mode: CPHA=1 */
> - spi-cpol; /* SPI mode: CPOL=1 */
> - spi-max-frequency = <8000000>; /* freq: 8 MHz */
> - local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
> - };
> -};
> -
> -(b) Ethernet over UART
> -
> -In order to use the QCA7000 as UART slave it must be defined as a child of a
> -UART master in the device tree. It is possible to preconfigure the UART
> -settings of the QCA7000 firmware, but it's not possible to change them during
> -runtime.
> -
> -Required properties:
> -- compatible : Should be "qca,qca7000"
> -
> -Optional properties:
> -- local-mac-address : see ./ethernet.txt
> -- current-speed : current baud rate of QCA7000 which defaults to 115200
> - if absent, see also ../serial/serial.yaml
> -
> -UART Example:
> -
> -/* Freescale i.MX28 UART */
> -auart0: serial@8006a000 {
> - compatible = "fsl,imx28-auart", "fsl,imx23-auart";
> - reg = <0x8006a000 0x2000>;
> - pinctrl-names = "default";
> - pinctrl-0 = <&auart0_2pins_a>;
> -
> - qca7000: ethernet {
> - compatible = "qca,qca7000";
> - local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
> - current-speed = <38400>;
> - };
> -};
> diff --git a/Documentation/devicetree/bindings/net/qca,qca7000.yaml b/Documentation/devicetree/bindings/net/qca,qca7000.yaml
> new file mode 100644
> index 0000000000000..5258288132968
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/qca,qca7000.yaml
> @@ -0,0 +1,104 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/qca,qca7000.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm QCA7000
> +
> +maintainers:
> + - Frank Li <Frank.Li@xxxxxxx>
> +
> +description: |
> + The QCA7000 is a serial-to-powerline bridge with a host interface which could
> + be configured either as SPI or UART slave. This configuration is done by
> + the QCA7000 firmware.
> +
> + (a) Ethernet over SPI
> +
> + In order to use the QCA7000 as SPI device it must be defined as a child of a
> + SPI master in the device tree.
> +
> + (b) Ethernet over UART
> +
> + In order to use the QCA7000 as UART slave it must be defined as a child of a
> + UART master in the device tree. It is possible to preconfigure the UART
> + settings of the QCA7000 firmware, but it's not possible to change them during
> + runtime
> +
> +properties:
> + compatible:
> + const: qca,qca7000
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> +if:
> + required:
> + - reg
> +
> +then:
> + properties:
> + spi-cpha: true
> +
> + spi-cpol: true
> +
> + spi-max-frequency:
> + default: 8000000
> + maximum: 16000000
> + minimum: 1000000
> +
> + qca,legacy-mode:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description:
> + Set the SPI data transfer of the QCA7000 to legacy mode.
> + In this mode the SPI master must toggle the chip select
> + between each data word. In burst mode these gaps aren't
> + necessary, which is faster. This setting depends on how
> + the QCA7000 is setup via GPIO pin strapping. If the
> + property is missing the driver defaults to burst mode.
> +
> + allOf:
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
> + - $ref: ethernet-controller.yaml#

ethernet-controller.yaml should be moved out of the 'if' schemas.

> +
> +else:
> + properties:
> + current-speed:
> + default: 115200
> +
> + allOf:
> + - $ref: /schemas/serial/serial-peripheral-props.yaml#
> + - $ref: ethernet-controller.yaml#
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ethernet@0 {
> + compatible = "qca,qca7000";
> + reg = <0x0>;
> + interrupt-parent = <&gpio3>; /* GPIO Bank 3 */
> + interrupts = <25 0x1>; /* Index: 25, rising edge */
> + spi-cpha; /* SPI mode: CPHA=1 */
> + spi-cpol; /* SPI mode: CPOL=1 */
> + spi-max-frequency = <8000000>; /* freq: 8 MHz */
> + local-mac-address = [ a0 b0 c0 d0 e0 f0 ];
> + };
> + };
> +
> + - |
> + serial {
> + ethernet {
> + compatible = "qca,qca7000";
> + local-mac-address = [ a0 b0 c0 d0 e0 f0 ];
> + current-speed = <38400>;
> + };
> + };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c14da518a214c..6416ada9900af 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -20295,7 +20295,7 @@ QUALCOMM ATHEROS QCA7K ETHERNET DRIVER
> M: Stefan Wahren <wahrenst@xxxxxxx>
> L: netdev@xxxxxxxxxxxxxxx
> S: Maintained
> -F: Documentation/devicetree/bindings/net/qca,qca7000.txt
> +F: Documentation/devicetree/bindings/net/qca,qca7000.yaml
> F: drivers/net/ethernet/qualcomm/qca*
>
> QUALCOMM BAM-DMUX WWAN NETWORK DRIVER
> --
> 2.34.1
>


Return-Path: <linux-kernel+bounces-675810-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5490941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:31:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 77DD0167716
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:31:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 52D8028852B;
Fri, 6 Jun 2025 13:31:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="y89NGOqs";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="omhTFxJB"
Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154])
(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 B87C72F2E;
Fri, 6 Jun 2025 13:31:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216671; cv=none; b=dc2osxqkNmAIbaMSxDSys1oxXfSTLyTvCkr3QKRDIWRFmUPZPNAYS0TFykO70SIEHHIrwVhsg9gAti71wjDIYhEhg6wqZEvN8Cm6Ey5r+0eo9zDKDpZIDkL+Js5KV0f6pJX2SpyvDTc1McdpWa7gMnK8H9xcJE9+w+oY1D/1384=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216671; c=relaxed/simple;
bh=N9Wy1DLXhhISqceJ4s1aGdwZLuvYZPRCEL0gR1l+Rv4=;
h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References:
Subject:Content-Type; b=bktsA1Fx/BMpcuynE41kkJY17RJfNWQe8HRp+46CpBZIC1Me3Ss+7I4OPTy1hNnFXwUBXC6QquimB9nF3K268/sLPtKADSJHTsi9yQXxhHV+gP2ERkVWstW+I+jFDqhSxcRx8zz2J5nF+aLjMPnKp4gwDcbq3Pi2ouAgmTomyuA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=y89NGOqs; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=omhTFxJB; arc=none smtp.client-ip=103.168.172.154
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com
Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46])
by mailfhigh.phl.internal (Postfix) with ESMTP id 5C6B2114017E;
Fri, 6 Jun 2025 09:31:05 -0400 (EDT)
Received: from phl-imap-08 ([10.202.2.84])
by phl-compute-06.internal (MEProxy); Fri, 06 Jun 2025 09:31:05 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm2; t=1749216665;
x=1749303065; bh=N9Wy1DLXhhISqceJ4s1aGdwZLuvYZPRCEL0gR1l+Rv4=; b=
y89NGOqs+DarZJgbfqAm+EDavPOclNYRXH8bvhG3eul3FsnnSePAXHG81xplfpSs
U9AAB69kZwQDf77ItFKMVd2XYVEgogZ2zh87Fkah9hzgPdMzm7SZssZVgN6e/vGL
THBVMDrIAPS0C6lPucTk4F6emLIKL1sVgdkyfwVYVj9qR2DqSkB1Gf/BB75ab36c
KuTt/ieEn76riHaOlFCNh4JZLZbmV05x6cJN10MRy4KK7E8OWEymrjC0ZExPZhUX
FICtFKeJonwLAFJhAIe/n7N9NmSrgQNnfh55wLRrHoP97q/dvt8fzeWGYr8Meoyd
hb4I4iJ+aX+oWlxBlFB1yA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749216665; x=
1749303065; bh=N9Wy1DLXhhISqceJ4s1aGdwZLuvYZPRCEL0gR1l+Rv4=; b=o
mhTFxJBV2G4IaP30Kawj8S7hVwmCO9bc9XxOlsbAYfNSqJuy/nVyXBzxzz0wq2g9
uDVQ6cRPUkwMrMO18E8ezlE7lVG/8lJMi9hkLfbYll2HFJrDdgjrkTovHxHCh9MC
uHt46xiqrZgtJFfiANqnqshWq1lGeMSnfFISy6WZbwwpyizAIM1gbdZF3fjSV5PB
npPk2lTyyHmqo6iXV6G7fyRpQsIutgCmXhPK5W40qkvs1tD/iBsm3Eh/EDV8OXlt
x+izrM+0o46+G9hYFUcC15TrNzhdsGYN/ad/4leWJNLlhf9iNzexxJc6/VwaBBYJ
pfSOiR9OFlNTSBR74sOpg==
X-ME-Sender: <xms:mO1CaF3y-PoQRmBUsux-o_My9SDfmboERuV5KrkgNAQ9XsBHmpQALQ>
<xme:mO1CaMHbcOH2LMejk0ZdOW1Rj2_3FeitSGcR4CN8_1mRaa5fVO1jjmKNKxpqs2VOU
hpHUf9uhWah5CJgDHc>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehudehucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepofggfffhvfevkfgjfhfutgfgsehtqhertdertdej
necuhfhrohhmpedflfhirgiguhhnucgjrghnghdfuceojhhirgiguhhnrdihrghnghesfh
hlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepjeehfeduvddtgffgvdffkeet
hefhlefgvdevvdekuefffeekheehgeevhfevteejnecuvehluhhsthgvrhfuihiivgeptd
enucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgr
thdrtghomhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpth
htohepthhssghoghgvnhgusegrlhhphhgrrdhfrhgrnhhkvghnrdguvgdprhgtphhtthho
pehsthgrsghlvgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrh
hnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqmhhi
phhssehvghgvrhdrkhgvrhhnvghlrdhorhhg
X-ME-Proxy: <xmx:mO1CaF5PyU2ISWJI6C87-K0tOmypjUbpRv-kD5vcTLhqBWJ-ib3x0w>
<xmx:mO1CaC2rkO9iKjqDn4T9CbJRmnIJ8TuNhMAXg9hjDP-UdyNRkPyp_A>
<xmx:mO1CaIEUIwrhbZYsnyxsRK3jqxE0AT89HPVWLdQkge2NQDUxz6lexA>
<xmx:mO1CaD89LhunXFsKt-IPdD9Xz71LVYRdcWziAd4IqnvQDe7TIfxr3A>
<xmx:me1CaOfWZhG6k0IdECmyaog9GBQ2ro84lnkJK8oetKefBmkpdkK3J9yv>
Feedback-ID: ifd894703:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
id AE41E2CE0065; Fri, 6 Jun 2025 09:31:04 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-ThreadId: Tfa3886415041e94f
Date: Fri, 06 Jun 2025 14:30:43 +0100
From: "Jiaxun Yang" <jiaxun.yang@xxxxxxxxxxx>
To: "Thomas Bogendoerfer" <tsbogend@xxxxxxxxxxxxxxxx>
Cc: "linux-mips@xxxxxxxxxxxxxxx" <linux-mips@xxxxxxxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxx
Message-Id: <a70690be-64ba-4337-bca2-23f93b645b62@xxxxxxxxxxxxxxxx>
In-Reply-To: <20250605-tlb-fix-v1-1-4af496f17b2f@xxxxxxxxxxx>
References: <20250605-tlb-fix-v1-1-4af496f17b2f@xxxxxxxxxxx>
Subject: Re: [PATCH] MIPS: mm: tlb-r4k: Uniquify TLB entries on init
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



=E5=9C=A82025=E5=B9=B46=E6=9C=885=E6=97=A5=E5=91=A8=E5=9B=9B =E4=B8=8A=E5=
=8D=8811:02=EF=BC=8CJiaxun Yang=E5=86=99=E9=81=93=EF=BC=9A
> Hardware or bootloader will initialize TLB entries to any value, which
> may collide with kernel's UNIQUE_ENTRYHI value. On MIPS microAptiv/M51=
50
> family of cores this will trigger machine check exception and cause bo=
ot
> failure. On M5150 simulation this could happen 7 times out of 1000 boo=
ts.
>
> Replace local_flush_tlb_all() with r4k_tlb_uniquify() which probes each
> TLB ENTRIHI unique value for collisions before it's written and overwr=
ites
> any conflicting entries with safe values before initializing the kerne=
l's
> UNIQUE_ENTRYHI pattern.

I just realised it might be easier to cycling ASID instead of address in
Entry Hi.

Will come try a v2.

Thanks
Jiaxun

[...]

--=20
- Jiaxun


Return-Path: <linux-kernel+bounces-675811-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2583E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:32:15 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id ED9FD18874D3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:32:28 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 309A0288531;
Fri, 6 Jun 2025 13:32:07 +0000 (UTC)
Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 325AF2F2E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:32:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.70
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216726; cv=none; b=qYCkty4bDt2KtU/jXN/r3iGSeDXgCOKxw+HE2E6TWC4anlptr0wKsdKgthVVaBFHLeInk2vM2GJI3LmXzbvfXLqk6K6+sQinunWgbf/DfMw2dotxMYiSag67zSD/hq2lhM4RwLivGfcQlEBB2ckIY2+WYD33HetWMFyGf9+XQ80=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216726; c=relaxed/simple;
bh=pPxE0Rh7zt+WiUbcZhat5ZtYXJLy2EXUnzZmlBB8KYU=;
h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To:
Content-Type; b=dkOjvfhNkLEEe4cI9gC6Fu7G3vC9dR2SjfmrhwsB7/PcpkT0qNizi0ZFMkyxcj+TNzEPAhuM5qXt2NLZBKblHypSBrIBhoduf4WYLtX0xAnC1N9UOJyEJ/6qDHkmpqwtmTlPhG/q8cpnPSkx8ZcBSRJIZxmKP8EwfyIP8I8xUXI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.70
Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com
Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-86d0daf3b2cso397260639f.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:32:04 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216724; x=1749821524;
h=to:from:subject:message-id:in-reply-to:date:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=Vy8jpwWKC1tsSeCMfFT/aQMZK2RywTQmkrz8RbjKPtc=;
b=n+Xju6QwFosk1oAufRZHZAKpjlXSAhJHOyluAwjyk5moxF7p4tNqwA6o3mp9D+BEbB
+nPwkVpUofG7pdUjruKuAaEH0F1LyyS5byzQvI0L4IQ2u83Qtk1M8wnR3j3wChIFjsmj
GFWqJmxxDdy5tK2xs019LFLAM4rp864mKb7QMRc8f3jCkRkWjNCAjm965O19IMJcucPc
s0mWOpMaMzF2J7JXxk27ibJYzMa3HNft8hEBhx1FlABJ2b8KcX2/sWuJ3+EVYLS1v3+4
c7baqF71rQzt8UIDSfyjvFYyf+pg8TN0Hk7yGM77SnmzwlxgTyp62JlSax++5f+HjBcC
6GYg==
X-Forwarded-Encrypted: i=1; AJvYcCUWLhIItQRCZwEht8hiygJgykJ06P+vAhTx0ivneLufBpe+VZNlwUl4MYi3k55taM1HK1pdliB9uiHnNRk=@vger.kernel.org
X-Gm-Message-State: AOJu0YyWob2FQdQWShfhrOQR+TB37QpD/W9MrC0g2v6X2XT9LZv9Cs7V
V7ulRIlAFXNHuFuV5L5YLMVhfurJW9MK8X21RU1gVnferRPiFYZrws95o10H3y7t/RVWXr7RqhA
daiagJPrYuVMwycrfq95wrdTnVSaALY4nwoOHYim/w4Jee/B1joc6o2uQz/8=
X-Google-Smtp-Source: AGHT+IEqgzucn1d1hDX/lALBgFl0/Xk4uBHJDAvKDiE85gN+7nyegaotk81wpONgVQv4t79aG8wdbQhtNZoCrYH/XDuihhcHF0Bp
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Received: by 2002:a05:6e02:3713:b0:3d9:2aa3:fe2e with SMTP id
e9e14a558f8ab-3ddce436717mr38359915ab.10.1749216724302; Fri, 06 Jun 2025
06:32:04 -0700 (PDT)
Date: Fri, 06 Jun 2025 06:32:04 -0700
In-Reply-To: <20250606125623.1827-1-hdanton@xxxxxxxx>
X-Google-Appengine-App-Id: s~syzkaller
X-Google-Appengine-App-Id-Alias: syzkaller
Message-ID: <6842edd4.a00a0220.29ac89.0041.GAE@xxxxxxxxxx>
Subject: Re: [syzbot] [mm?] WARNING in vma_modify
From: syzbot <syzbot+d16409ea9ecc16ed261a@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: hdanton@xxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
syzkaller-bugs@xxxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.0 required=5.0 tests=FROM_LOCAL_HEX,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in vma_modify

7fcac9c9e000-7ffd51cbbfff: 0000000000000000
7ffd51cbc000-7ffd51cdcfff: ffff88807946b8c0
7ffd51cdd000-ffffffffffffffff: 0000000000000000
------------[ cut here ]------------
WARNING: CPU: 0 PID: 6557 at mm/vma.c:808 vma_merge_existing_range mm/vma.c:808 [inline]
WARNING: CPU: 0 PID: 6557 at mm/vma.c:808 vma_modify+0x15ff/0x1a30 mm/vma.c:1604
Modules linked in:
CPU: 0 UID: 0 PID: 6557 Comm: syz.0.16 Not tainted 6.15.0-syzkaller-12426-ge271ed52b344-dirty #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
RIP: 0010:vma_merge_existing_range mm/vma.c:808 [inline]
RIP: 0010:vma_modify+0x15ff/0x1a30 mm/vma.c:1604
Code: 0b 90 e9 a5 ec ff ff e8 3f 60 ab ff 90 0f 0b 90 e9 e5 eb ff ff e8 31 60 ab ff 4c 89 f7 48 c7 c6 a0 91 96 8b e8 b2 06 f3 ff 90 <0f> 0b 90 e9 46 ec ff ff e8 14 60 ab ff e9 57 ed ff ff e8 0a 60 ab
RSP: 0018:ffffc90003befb28 EFLAGS: 00010286
RAX: ffffffff8b5e58cd RBX: ffff88807e5c0280 RCX: ffff88802e4e3c00
RDX: 0000000000000000 RSI: ffffffffffffffff RDI: ffffffffffffffff
RBP: 0000200000000000 R08: ffffc90003bef6a7 R09: 1ffff9200077ded4
R10: dffffc0000000000 R11: fffff5200077ded5 R12: 1ffff9200077df8c
R13: 0000200000000000 R14: ffffc90003befc40 R15: ffffc90003befc60
FS: 00007fcac9c746c0(0000) GS:ffff888125c55000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000558b9147a950 CR3: 000000005bd9d000 CR4: 0000000000350ef0
Call Trace:
<TASK>
vma_modify_flags+0x1e8/0x230 mm/vma.c:1645
mlock_fixup+0x22a/0x360 mm/mlock.c:483
apply_mlockall_flags+0x2f0/0x3c0 mm/mlock.c:736
__ia32_sys_munlockall+0x10a/0x220 mm/mlock.c:782
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fcac8d8e969
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcac9c74038 EFLAGS: 00000246 ORIG_RAX: 0000000000000098
RAX: ffffffffffffffda RBX: 00007fcac8fb6080 RCX: 00007fcac8d8e969
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007fcac9c74090 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 0000000000000001 R14: 00007fcac8fb6080 R15: 00007ffd51cdb4b8
</TASK>


Tested on:

commit: e271ed52 Merge tag 'pm-6.16-rc1-3' of git://git.kernel..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13bcb282580000
kernel config: https://syzkaller.appspot.com/x/.config?x=73696606574e3967
dashboard link: https://syzkaller.appspot.com/bug?extid=d16409ea9ecc16ed261a
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=152371d4580000



Return-Path: <linux-kernel+bounces-675812-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 342A341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:32:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 97ACA3AC0BC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:32:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D09C28852B;
Fri, 6 Jun 2025 13:32:14 +0000 (UTC)
Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 205EF2F2E;
Fri, 6 Jun 2025 13:32:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216733; cv=none; b=Tnlttf9z/fGCU3KM45pjIhFu+Kw9yvhscnlYSXifmrmeiT94qPCmEtCBV6M1T2KXhn86jLxiSu2uz1M2/awyelDfsX45JIxlhTffNFBhOR19WsxAf91fTPQjLEExhq3PESVcGQZvQ/Zu/dE7BNOIDObGqaeYgcUx6L3ZM4BGJSs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216733; c=relaxed/simple;
bh=rDhuXebl9LfoDzStrAyuudg6kEWfHwfevtQnt6H057M=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=Kw9Rf61U9wkAQF/Dx/KTpqJsWqxpsmNoD38pYdyAemqeyZuagr8Ba9Lmfh3+5G1MI3tx67CdqCJTmFqgBJJ1YGOM7crrXSMUBxAlL52m8Y8Aoj3Whe8osYY/VgixmWSRbbqTXwNa+8GnAiKM06XIG3vM4eDk8M2JeY4lbkwkzXE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.173
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-4a43d2d5569so26049341cf.0;
Fri, 06 Jun 2025 06:32:10 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216730; x=1749821530;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=dDtNol4Z+GeSmVmtFuSAOZHVVS18b4JA8DnUVIUdu24=;
b=glB1ZN3KQB1Xiz3sG7Y2ENUl5+rKrut4MAlLTOk+JLiZbX/iJgfZQ+dydWAULZgHbr
KssW512vHZU+bsJI6EKTw/KKK7N2eztEsqLojzx0FjpLgkYRJ0pocyNr175ZVNW9X13v
BinPLhcCCjztzIGkBSIZKqVuAxaHoKwzTlNmgwCEI9/smpngdFMmwm2K62Q8QPX2LwLA
amBlCe9xiIAFnJHVStbrLpFqtRXxriPSXvHwuI4oAX3EyESLGFcGDoyhxBGk7kkpjUWv
FWWPfa0dF7m31gUBKgO7Ju5BJAnk+Sdnin/N0jf638KaHQDl34rkRjAhXrcWvPyud8M4
eaLA==
X-Forwarded-Encrypted: i=1; AJvYcCUEjy6fRM9h1vKpU6AfngZk/EmMlXLYLdaWdf/CFyLLrWapkRuAmH4FNx8Ovg8q0fmtFQZslq2IJU5Moe0Y@xxxxxxxxxxxxxxx, AJvYcCWKz5rKeNp8kBKozaipJ8D+mXxnkObmMTQ/PHBKdLm+bnrHkMw4/piw797bwFVP5qxHOF+4lxoN+6QfIjqW1nAyBKc=@vger.kernel.org, AJvYcCX3P+l6w9EbCAbypOBmjvWBtvx5LrLKwki+vwRNV/kqRX2RHxBNi05QElpvTHZ910GqsQqa5AeZq2Of@xxxxxxxxxxxxxxx, AJvYcCX65bSQSX/R3ygBD/2RX/CzIuOGgh9r/lCCq/SStWmPcR9h27VImm0nkrKvVG+9Gc2l0l7PgIfv3fYl@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yxyfq1jV6w5gZh9n7zvZxBV6mSistDtVrpmrPZopK0+TsFsGEtF
Kpe0mLybMkz2fXdGKNEX6ZfeGTtmynxNpYyzxLyWdgDPqsKSrkB/44kA+S3gkXOB
X-Gm-Gg: ASbGncuLzNCDZplbs5oBRrUKSk82b8We5a8bokRQ4D3m25qRKxrnZj6beLGuzgSpJ9M
B4o+LchxxtA5RDjPjLrnQ8lJj52IxrseITesuZKj6zE0n/UshMOkQZUwx7eOI5hlw4jEm8+lX7z
px+V0lMt4a5+CJJ5jACy7O9ndnN6jQCfgqGGgPxca3pA7kvgbZFUc71gg6D0kpmw2yTrb18CFmV
xpVXt+mM5g94sSY8V30Jkzx/gmdYgphiLtR2vsywIlZF2yAxJvvRLSvzXRAYDvDt6RJrOKfvjN4
RQx7las2BTB0CFGhmF/B0IhB3sXdEDtcIyEoDJtTTLDFXXGdtjfyB7GbF6AkrxyTZbSeJsPVZVY
Ye/mFyKmOaNEe5HsX1MR/+wwEc9HJd+Sa2UPJBTw=
X-Google-Smtp-Source: AGHT+IHXY6E3zBR6z0gcyqUkpE40OHp3HzckSuyUnmS9XnM8THApTgx2xRpW3NXJEopXhhAgFTHZuw==
X-Received: by 2002:a05:622a:4293:b0:497:6a94:dba0 with SMTP id d75a77b69052e-4a5b9d325f1mr49826651cf.25.1749216729537;
Fri, 06 Jun 2025 06:32:09 -0700 (PDT)
Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com. [209.85.222.174])
by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a61116b81asm12917071cf.21.2025.06.06.06.32.08
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:32:08 -0700 (PDT)
Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7d09b0a5009so206391685a.1;
Fri, 06 Jun 2025 06:32:08 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCVoBUBpwBjPBG5waqIu8p2X/JHvFmJUgs2A4GTKPb97h4YWXU0NnrRyaTKdppLesOO8gl74B3NugPyinX6w@xxxxxxxxxxxxxxx, AJvYcCWkRHq7tZQX15QF3snABw3C3CIXRqx7ZjhK3pKH1H4AuxRrwE53pK9c0RccOBDWSdeWXAinJf4CuVoZHDwYikd65E4=@vger.kernel.org, AJvYcCX7HKBVUyT4Xi7hI240gIDVCKHEnhTEaHPtJM065KGV80te8EH7Jwj8RIn+gtf8f660kWC3Z8Udf1ur@xxxxxxxxxxxxxxx, AJvYcCXLAb3utE2AgsDnUNMWLvFWQIE9jXuPCHSHnK3CTbxO7ZqtV93mbYs9NPIyc6TOvP1xzfgtP70T8hI9@xxxxxxxxxxxxxxx
X-Received: by 2002:a05:620a:24d5:b0:7c7:a5cb:2b65 with SMTP id
af79cd13be357-7d2298ad9f1mr465138785a.26.1749216728311; Fri, 06 Jun 2025
06:32:08 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250530143135.366417-1-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> <20250530143135.366417-7-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
In-Reply-To: <20250530143135.366417-7-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:31:55 +0200
X-Gmail-Original-Message-ID: <CAMuHMdX61j-6_GwnibUs-m0ASm5JGhGGzLe6i41vjcz1ouZUjQ@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFvMLlrc8WWZ659b2wYy_2MgUzXn1Vl-0zrZy5LFvjpEPaA4YkZ5mevdJ28
Message-ID: <CAMuHMdX61j-6_GwnibUs-m0ASm5JGhGGzLe6i41vjcz1ouZUjQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 6/6] i2c: riic: Add support for RZ/T2H SoC
To: Prabhakar <prabhakar.csengg@xxxxxxxxx>
Cc: Chris Brandt <chris.brandt@xxxxxxxxxxx>, Andi Shyti <andi.shyti@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Magnus Damm <magnus.damm@xxxxxxxxx>, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>,
linux-renesas-soc@xxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Biju Das <biju.das.jz@xxxxxxxxxxxxxx>,
Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Prabhakar,

On Fri, 30 May 2025 at 16:31, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Add support for the Renesas RZ/T2H (R9A09G077) SoC, which features a
> different interrupt layout for the RIIC controller. Unlike other SoCs
> with individual error interrupts, RZ/T2H uses a combined error interrupt
> (EEI).
>
> Introduce a new IRQ descriptor table for RZ/T2H, along with a custom
> ISR (`riic_eei_isr`) to handle STOP and NACK detection from the shared
> interrupt.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/i2c/busses/i2c-riic.c
> +++ b/drivers/i2c/busses/i2c-riic.c
> @@ -326,6 +327,19 @@ static irqreturn_t riic_stop_isr(int irq, void *data)
> return IRQ_HANDLED;
> }
>
> +static irqreturn_t riic_eei_isr(int irq, void *data)
> +{
> + u8 icsr2 = riic_readb(data, RIIC_ICSR2);
> +
> + if (icsr2 & ICSR2_NACKF)
> + return riic_tend_isr(irq, data);
> +
> + if (icsr2 & ICSR2_STOP)
> + return riic_stop_isr(irq, data);

Just wondering: can both ICSR2_NACKF and ICSR2_STOP be set?
As riic_tend_isr() clears only ICSR2_NACKF, while riic_stop_isr()
clears all bits, the two calls could be chained, if needed.

> +
> + return IRQ_NONE;
> +}
> +
> static u32 riic_func(struct i2c_adapter *adap)
> {
> return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Return-Path: <linux-kernel+bounces-675813-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6051041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:33:16 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 23BEE18884E6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:33:30 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E3C828934E;
Fri, 6 Jun 2025 13:33:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="HeKgCYiq"
Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131])
(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 960AF2F2E;
Fri, 6 Jun 2025 13:32:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216780; cv=none; b=XB83UyI+TMyFmpfZfAgYz1FDdfzsc5cLZ87yiAL9Rhd5SPs48O5XWxh6JLZXEXiGi/Jowpi0RgssKI2Uk+w0HfOIZabEBP7r1ZDeE5EkBcKb20eyKu9m7tfZNzGSueItm22OMaguSF1EW+2378zIyy+efdpX49Dd1FcbXkK5DCs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216780; c=relaxed/simple;
bh=6RuF3Znt+tzQ+CHuQwvoPvsyYVJVvXA7G1mYnBcSznQ=;
h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From:
In-Reply-To:Content-Type; b=bsX64u8Y+bEZR6x/gALOv5YCrOY1yzRRTd2J0AbfPw9ZWFvH7ft9AuKoNIylfTHI+46/kuNFQieiQHSS9eCIYUAe3j4jZDrgPaurAMQF2kE+xnltU4FEFoNMvv83PvsR8xAcH98DMW0YjTzCk71dwcCSIR+qPuxGJ7/M6jMAO6w=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=HeKgCYiq; arc=none smtp.client-ip=205.220.180.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com
Received: from pps.filterd (m0279871.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556AZi9a012803;
Fri, 6 Jun 2025 13:32:51 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=
cc:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=qcppdkim1; bh=
Es2qJC6PPNbgqcXhrSCL+dvAJQdmrGgRvfxTwABm56k=; b=HeKgCYiqFouGAnKU
dQFUmPzWEWl7MX4kY7/Sq99hHU+VUllGwwM7zpGsAW4578gNyc1Op9Ih+8sFUnxj
LxrMRqZy2bf5iTQPZhYiWu6rOtCQUoBSlNs9u2r3j19063VjToV1U4iKdsoBURSx
bgzEF/RT9E1on64TMEGL7c2gRoFe8DloR+X2q3gpD85X5BMvbIkm6n9sPStNFocK
DyIDZHRDtqCMtkOabQSmXOpxgqrNvMAwMreoJgalT9iyiywfIVj3h0azmmcPROO1
OmctL6hfC3o+uxtmFoiimGFhnXah09+7Dubj0bOgA2xLqeKjC5WmAVxAEgGKCHa7
DKNJig==
Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 473nphsqxq-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 13:32:51 +0000 (GMT)
Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35])
by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 556DWoRD025923
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 6 Jun 2025 13:32:50 GMT
Received: from [10.253.79.143] (10.80.80.8) by nalasex01c.na.qualcomm.com
(10.47.97.35) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 6 Jun 2025
06:32:46 -0700
Message-ID: <d5aee491-3ba2-4beb-8b8f-4ba8372e6d16@xxxxxxxxxxx>
Date: Fri, 6 Jun 2025 21:32:44 +0800
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 0/3] media: venus: enable venus on qcs615
To: Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Bryan O'Donoghue
<bryan.odonoghue@xxxxxxxxxx>,
Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxxxxxxxx>
CC: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>,
Dikshita Agarwal
<quic_dikshita@xxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio
<konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski
<krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, <linux-media@xxxxxxxxxxxxxxx>,
<linux-arm-msm@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<devicetree@xxxxxxxxxxxxxxx>,
"Nicolas
Dufresne" <nicolas.dufresne@xxxxxxxxxxxxx>
References: <20250530-add-venus-for-qcs615-v8-0-c0092ac616d0@xxxxxxxxxxx>
<wmri66tkksq6i3hfyoveedq5slghnnpozjzx6gck5r3zsiwsg6@xevgh54rnlqd>
<285cae4a-219c-4514-818f-34c8225529de@xxxxxxxxxxx>
<5854a587-aba7-4e71-87f8-249ba00cbc59@xxxxxxxxxx>
<996c9a39-5520-4b43-adfa-06ce29223ba0@xxxxxxxxxxx>
<713b87cb-0003-4ee3-a599-9cd41629bb42@xxxxxxxxxx>
<7aa36a0f-6741-40c2-93f4-036823d245fd@xxxxxxxxxxx>
<247002c0-ee68-4d0d-857a-768bf68bce75@xxxxxxxxxx>
Content-Language: en-US
From: Renjiang Han <quic_renjiang@xxxxxxxxxxx>
In-Reply-To: <247002c0-ee68-4d0d-857a-768bf68bce75@xxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To
nalasex01c.na.qualcomm.com (10.47.97.35)
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085
X-Proofpoint-ORIG-GUID: ELZWQvtfk4vMVcc4do65dkOWUgD4OYgl
X-Authority-Analysis: v=2.4 cv=N8QpF39B c=1 sm=1 tr=0 ts=6842ee03 cx=c_pps
a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17
a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10
a=scSONbXNw8eJHw9vBkAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEyMiBTYWx0ZWRfX2O+JbySA59j7
E0P/k6LOqIR/dbtYJ0JEMQP8zzqj6m6s4Lrr6rmI+VRtnFLdBKQ4NNt8i+wOknpDc0zwUqf4skv
tXUoXMQFHiJ98F2FRKPWobE4PT8JIqnzgk4ZEwZJ/3yxxc3g4+HZanwlmjGCBtIZ+LRIV5hwZij
sMdb9+VfSvUv78qt8QEW5enhVUWiWQ8ApgEepdms32vG8vWfiRH9A8CiJGwWTInMUZ6f3bQm1kL
x76Qe6z8wyxM73+YbxIsxlZ7U8I+95xJYR0b7K8WM8IJzBVkp2s8BXncNlH7i0fHwnkTxWPnTem
e5DaAcy9I8/ILFGv+vVD3cQa8KNWMFon2VHTcwzk3N+8kWUFDaQp2yyTmsE7IokRqfHO4KNQZIH
E4ELfFKSkFLsM0gm+ryeJdSBDM98vqHtLk5Zdk6J4CE7CIm+nrs7BMBopAIVSNmOYfdc0V+u
X-Proofpoint-GUID: ELZWQvtfk4vMVcc4do65dkOWUgD4OYgl
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
phishscore=0 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0
mlxscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015
impostorscore=0 mlxlogscore=999 classifier=spam authscore=0 authtc=n/a
authcc= route=outbound adjust=0 reason=mlx scancount=1
engine=8.19.0-2505280000 definitions=main-2506060122
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 6/6/2025 8:56 PM, Krzysztof Kozlowski wrote:
> On 06/06/2025 14:51, Renjiang Han wrote:
>> On 6/6/2025 8:44 PM, Krzysztof Kozlowski wrote:
>>> On 06/06/2025 14:37, Renjiang Han wrote:
>>>> On 6/5/2025 8:34 PM, Bryan O'Donoghue wrote:
>>>>> On 31/05/2025 01:05, Renjiang Han wrote:
>>>>>>>> Note:
>>>>>>>> This series consist of DT patches and a venus driver patch. The patch
>>>>>>>> 1/3, which is venus driver patch, can be picked independently without
>>>>>>>> having any functional dependency. But patch 2/3 & patch 3/3, which are
>>>>>>>> DT patches, still depend on [1].
>>>>>>> I'd say 2/3 and 3/3 still depend on 1/3, otherwise we can get video
>>>>>>> core
>>>>>>> on QCS615 over(?)clocked.
>>>>>> Agree, so we need to make sure that the driver patch is not picked
>>>>>> after the DT patch.
>>>>> This statement is confusing.
>>>>>
>>>>> 1/3 states that there will be a fallback if there is no OPP table
>>>>> present.
>>>>>
>>>>> Giving the code a glance, I believe that is so, freq_table should be
>>>>> used if there is no OPP specified in the DT.
>>>>>
>>>>> I think we are having a hard time here understanding what you are saying.
>>>>>
>>>>> My understanding:
>>>>>
>>>>> - venus modification is standalone 1/3
>>>>>   Qcs615 will fallback if no OPP is present
>>>>>
>>>>> - dt modification 2/3 3/3 is therefore also independent of driver
>>>>>
>>>>> ---
>>>>> bod
>>>> yes, let me re-spin this with driver patch alone. Once that gets in,
>>>> will bring in the DT patches.
>>> Did you read my feedback? There is no "once that gets in". DTS is an
>>> independent hardware description and your patchset claiming there is
>>> dependency is just broken.
>>>
>>> I am repeating this since few emails, so shall I NAK it that you will
>>> address the main issue you have?
>>>
>>> Best regards,
>>> Krzysztof
>> Hi Krzysztof
>>
>> SC7180 and QCS615 use the same video core. Only difference lies in the
>> freq_table for the video. Freq_table is generally determined at SOC level.
>> The Venus driver does not currently handle freq_table compatibility well
>> across platforms. This patch enables the driver to use the OPP-table from
>> the DT, addressing the frequency compatibility issue.
> This does not resolve the main problem at all. If SW cannot use the
> fallback alone, your fallback has no meaning and is not only confusing
> but actually incorrect. And based on previous statements like
> "overclocking" it is not only incorrect, but even harmful.
>
> Best regards,
> Krzysztof
The fallback is only triggered when there is no OPP table in the DT.
Since the QCS615 DT will include an OPP table, the fallback logic will
not be used.

Also, if the freq from the freq_table and the OPP table are the same,
would it be acceptable to drop the freq_table from the driver?

--
Best Regards,
Renjiang



Return-Path: <linux-kernel+bounces-675814-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 58A8B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:35:15 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4FABA3AC9BD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:34:53 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E6BEF289346;
Fri, 6 Jun 2025 13:35:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PZHfQXDW"
Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59C0228466C;
Fri, 6 Jun 2025 13:35:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216904; cv=none; b=hqnjCTkbDEgpv5tu3teM+hzpiEJUQV0VT6puNl1iAnvHdwzPsoBuR5dPeqF1tADuhbBz8pbVBQvn11fWVEzSI6B2FkcNALooB1hS4lFX5jbVkiHdI6+p9mHibC9mmlOI7fljgCjb/uM0AWYvIMitPlLd5bDw4WLw3VZNIAwwR/g=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216904; c=relaxed/simple;
bh=/z4KNTY6K1QX9BqG+GXj3WT7AYkNxHHXlkhmMGQe8dA=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=kosladHcgVsnmfxWI7kiskE6zf2MNKm7qA6Wn8dnB0epqaLc2IiJfVq23NOz8N5CD1Ogf8Gk8CAL36Z61ntLtVBZZ1Wyu7gyUilCKgMdDZGIodJuiCsehmpoFRAaKOp8mL3K/G7Rf2Q3fl/bI9SAMDdLkJuVtC4+xiK/eE4QAbY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PZHfQXDW; arc=none smtp.client-ip=209.85.222.169
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-7cee9f0af46so215050585a.3;
Fri, 06 Jun 2025 06:35:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749216901; x=1749821701; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:feedback-id:from:to:cc:subject:date
:message-id:reply-to;
bh=li311bFWIwjWn8TvNMnkERHq2b02zAYt2SjH2f5Hw9U=;
b=PZHfQXDWA3IATUVeTXdxGiRJYm8FHkKP8vpmEfkDDql63vukvYyPMGdDIQLxd2h60S
Ms6RY04z8yw1FpqQ7jrhCV3kO7G9NKlabxwXgc7yuEAyp2V8GUPRQ57uHSzeKddwpqPm
EdezgBXvqJYyxZ481tbEVAnLiYDaGOkZnO7fv3HhvjMUoVuu7cBgfGct3jy4GfGcgQbR
GMPIqyLhGnqCrLR5GguzX7x1hPX9DEhd3z8aLaku2lGp2dRhSCOpZEGbOZvUULN9k28+
TxIUqgX1eYd0gmYcWzdFlxNbjuH1AP8mks5FUVpCzuwS/CHS90joXYfMsqUObnkX+KN0
P9Gw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216901; x=1749821701;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=li311bFWIwjWn8TvNMnkERHq2b02zAYt2SjH2f5Hw9U=;
b=eYXf6fiX1CXdaYg+dAs03hTi7sMkorUj4oSDRMokTGTljeTgRkBbgOg8obbnKVOdkq
+at/v8PnhgxouapTxeJ4h4/5hXbU5VoRo7sqcp5+TD9ZuqIbNmZFzB0g0I81gxrtj8Rp
3HZHZLIbJ5ghdGXfPxxQucDPS7AedNISquDxJuxvndmhnAUNPn3Za9//v1HI0SQjjXKY
5sYxSbwqJ3n/mKpRRBvGrMjMg+O0gAa3o1WtQMycxN4iQLU0vHlm1g6sWBsO7i6AEo62
KHRQZmd6DFsbDV/jctN8G+LkXSTQuIo8nGdKthg+P/7wUrzUyB/Whh/TyPEJEBTin1Vv
dd3w==
X-Forwarded-Encrypted: i=1; AJvYcCUYBeMY02Rij12hxEnEiG6I0RH9ncROLXeZ1+CPMZVGIg9jTrwmMufeDwdYMmCiR+UiYTIC5OVnx7g=@vger.kernel.org, AJvYcCWU9R/uM6diQCzZvYG696VFxLjqEIH2UXS9TlEHcUiidZNnmctqhbGDoqNbkT7EdFElmaZDUxTzjCyP3qc=@vger.kernel.org, AJvYcCX0bygzJ0v0SMIAZc0F2C3BkLJufELj5i28xAwXN8yR84y0XBn/BxtuyNObHx6HwXLfUqWguAXMxArVkXP4vvQ=@vger.kernel.org
X-Gm-Message-State: AOJu0YwGYhwnq3shAlx3j4LPnko4kZnlqHJMTCo/7pH1iTyxfQD8L6pm
4+lV4WfG43JuZ10u13F/eUrRjUwuQH/ZRZ06pPYInV53qIrIrwouXePv
X-Gm-Gg: ASbGncsoqAjrQX+lh9qz379OpxZlwZe2AdAX/lnxL1fdCQRhlJz15wx5xRYoE32atD3
jc8f8KNlFSFt+9IxSKoe9zRQVNztreW1HGGCjA5uUYg19pNM59EPEIWZrnboLPSCq5tKhOYWv6F
h+4dYjFZ4yfCsMADcOIhbcBJgasjfD8FbHBLcB/CudcLsg/n5F/nGCGgZ64sqyWEUuqaIifbQZg
XwIouzXpgdl7VQJDrcgnqkr7ZbV3Tkf/eK5g2HeOcWLcSAU3q0EU+N8Er8Z3H58m8OMS8quT5pF
/4c7p3d8XxGr0Rj/wRkkQt5KDBJPIU1lurSMVtiqP04ZyPOuHLOIiFLjRGiSLl2ST36rMVnjixI
LuBIHqT12Q8jzrOghltf3M/yr6zEw5DFrAbG/QGTruRi2/TSCOc+b
X-Google-Smtp-Source: AGHT+IGdv0PS1gCrF8HQzy1OVLhLukJz18uMLvvURPoeqzXqH+XjqhJus4TcmLLdKA2xzN/X0VJTRA==
X-Received: by 2002:a05:620a:2910:b0:7c5:60c7:339 with SMTP id af79cd13be357-7d229896807mr549791285a.9.1749216901107;
Fri, 06 Jun 2025 06:35:01 -0700 (PDT)
Received: from fauth-a2-smtp.messagingengine.com (fauth-a2-smtp.messagingengine.com. [103.168.172.201])
by smtp.gmail.com with ESMTPSA id af79cd13be357-7d2513357basm131888285a.4.2025.06.06.06.35.00
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:35:00 -0700 (PDT)
Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42])
by mailfauth.phl.internal (Postfix) with ESMTP id CF8D81200043;
Fri, 6 Jun 2025 09:34:59 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-02.internal (MEProxy); Fri, 06 Jun 2025 09:34:59 -0400
X-ME-Sender: <xms:g-5CaNRpeF7_7vsGG9v5ez9zypqGV4oaphkT89ARD1sU3yQ3dyY-rA>
<xme:g-5CaGyjvxdiFuo_L9i03pJPxRSI6FDLsNwWw22oSFcU48rDLFv9H6wBDPDA2-gyn
D-Vf4bxMaJ-iQaf9A>
X-ME-Received: <xmr:g-5CaC31W5AqpHQdU7zDlZ2SUuW7OvW4k2mYMC_CcMXwkQFm7_1wba-eYQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdehudehucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden
ucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrd
gtohhmqeenucggtffrrghtthgvrhhnpefftdeihfeigedtvdeuueffieetvedtgeejuefh
hffgudfgfeeggfeftdeigeehvdenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuve
hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdo
mhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieegqddujeejke
ehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgr
mhgvpdhnsggprhgtphhtthhopedujedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoh
eplhhoshhsihhnsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehvihhrvghshhdrkhhu
mhgrrheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlh
drohhrghdprhgtphhtthhopeihuhhrhidrnhhorhhovhesghhmrghilhdrtghomhdprhgt
phhtthhopehojhgvuggrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopegrlhgvgidrgh
grhihnohhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepghgrrhihsehgrghrhihguhho
rdhnvghtpdhrtghpthhtohepsghjohhrnhefpghghhesphhrohhtohhnmhgrihhlrdgtoh
hmpdhrtghpthhtoheprgdrhhhinhgusghorhhgsehkvghrnhgvlhdrohhrgh
X-ME-Proxy: <xmx:g-5CaFA-zWWrv8JLb3Wnksy-nxHZWpITNKKXVPnjDyFJG27FOuW6eA>
<xmx:g-5CaGgsY8xTMgxvIj-dagcYAAUAo-KGwQOsICDASq8jd_Bj1F8lRw>
<xmx:g-5CaJr05cAIrBlfLm-gzzhBJSYarjBFEEYsBswpRojhZqamNwzDpA>
<xmx:g-5CaBgTQTj2RvSqaBsJTY-3n7ssks1XCJTtRrJPybS0GqjXbt-KbQ>
<xmx:g-5CaBR-rd1jMbvxffL4vy9pD7P1uujEqMepQUhJRW0fYO1IjQPm0Dv7>
Feedback-ID: iad51458e:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
6 Jun 2025 09:34:58 -0400 (EDT)
Date: Fri, 6 Jun 2025 06:34:56 -0700
From: Boqun Feng <boqun.feng@xxxxxxxxx>
To: Benno Lossin <lossin@xxxxxxxxxx>
Cc: Viresh Kumar <viresh.kumar@xxxxxxxxxx>,
"Rafael J. Wysocki" <rafael@xxxxxxxxxx>,
Yury Norov <yury.norov@xxxxxxxxx>, Miguel Ojeda <ojeda@xxxxxxxxxx>,
Alex Gaynor <alex.gaynor@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?iso-8859-1?Q?Bj=F6rn?= Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>,
Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Danilo Krummrich <dakr@xxxxxxxxxx>,
Vincent Guittot <vincent.guittot@xxxxxxxxxx>,
linux-pm@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
rust-for-linux@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] rust: cpumask: Validate CPU number in set() and clear()
Message-ID: <aELugDefiviXZjx6@xxxxxxxx>
References: <8b5fc7889a7aacbd9f1f7412c99f02c736bde190.1749183428.git.viresh.kumar@xxxxxxxxxx>
<aEJwm16HSwCyt7aB@xxxxxxxx>
<DAFAR5SUQSU9.OSLB2UAXE9DY@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <DAFAR5SUQSU9.OSLB2UAXE9DY@xxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,WEIRD_PORT autolearn=ham autolearn_force=no
version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 10:11:13AM +0200, Benno Lossin wrote:
> On Fri Jun 6, 2025 at 6:37 AM CEST, Boqun Feng wrote:
> > On Fri, Jun 06, 2025 at 09:47:28AM +0530, Viresh Kumar wrote:
> >> The C `cpumask_{set|clear}_cpu()` APIs emit a warning when given an
> >> invalid CPU number - but only if `CONFIG_DEBUG_PER_CPU_MAPS=y` is set.
> >>
> >> Meanwhile, `cpumask_weight()` only considers CPUs up to `nr_cpu_ids`,
> >> which can cause inconsistencies: a CPU number greater than `nr_cpu_ids`
> >> may be set in the mask, yet the weight calculation won't reflect it.
> >>
> >> This leads to doctest failures when `nr_cpu_ids < 4`, as the test tries
> >> to set CPUs 2 and 3:
> >>
> >> rust_doctest_kernel_cpumask_rs_0.location: rust/kernel/cpumask.rs:180
> >> rust_doctest_kernel_cpumask_rs_0: ASSERTION FAILED at rust/kernel/cpumask.rs:190
> >>
> >> Fix this by validating the CPU number in the Rust `set()` and `clear()`
> >> methods to prevent out-of-bounds modifications.
> >>
> >
> > Thanks for the quick fix!
> >
> > While this can fix the current problem, but it's not a good solution for
> > the long run. Because outside a test, we should never use an arbitrary
> > i32 as a cpu number (we usually get it from smp_processor_id(), or
> > something else). So the `< nr_cpu_ids` testing is not necessary in
> > normal use cases.
> >
> > We should instead provide a wrapper for cpu id:
> >
> > /// # Invariants
> > ///
> > /// The number is always in [0..nr_cpu_ids) range.
> > pub struct CpuId(i32);
> >
> > and
> >
> > impl CpuId {
> > /// # Safety
> > /// Callers must ensure `i` is a valid cpu id (i.e. 0 <= i <
> > /// nr_cpu_ids).
> > pub unsafe fn from_i32_unchecked(i: i32) -> Self {
> > // INVARIANT: The function safety guarantees `i` is a valid
> > // cpu id.
> > CpuId(id);
> > }
> >
> > pub fn from_i32(i: i32) -> Option<Self> {
> > if i < 0 || i >= nr_cpu_ids {
> > None
> > } else {
> > // SAFETY: `i` has just been checked as a valid cpu id.
> > Some(unsafe { Self::from_i32_unchecked(i) })
> > }
> > }
> >
> > pub fn current() -> Self {
> > // SAFETY: smp_processor_id() always return valid cpu id.
> > unsafe { Self::from_i32_unchecked(smp_processor_id()) }
> > }
> > }
> >
> > All `Cpumask` functions then take `CpuId` instead of `i32` as the
> > parameter. Needless to say if we were to have a cpumask_next() wrapper,
> > the return value will be `CpuId` (or `Option<CpuId>`), i.e. if a bit was
> > set in a cpumask, then it must represent a correct cpu id.
> >
> > Make sense?
>
> Just to make sure, the `nr_cpu_ids` stays constant, right?
>

Sort of. I believe the value won't be changed once the kernel boots, in
most cases (modulo NR_CPUS=1 or CONFIG_FORCE_NR_CPUS=y), it's a
read-mostly variable not a constant, and the value gets set by either a
kernel command line or how many CPUs the kernel actually detect at boot
time. See:

https://github.com/Rust-for-Linux/linux/blob/rust-next/kernel/smp.c#L995:w

> >> @@ -101,10 +108,16 @@ pub fn set(&mut self, cpu: u32) {
> >> /// This mismatches kernel naming convention and corresponds to the C
> >> /// function `__cpumask_clear_cpu()`.
> >> #[inline]
> >> - pub fn clear(&mut self, cpu: i32) {
> >> + pub fn clear(&mut self, cpu: i32) -> Result {
> >> + // SAFETY: It is safe to read `nr_cpu_ids`.
> >> + if unsafe { cpu as u32 >= bindings::nr_cpu_ids } {
> >
> > You probably want to check whether `bindings::nr_cpu_ids` can be
> > accessible if NR_CPUS == 1 or CONFIG_FORCE_NR_CPUS=y, because then
> > nr_cpu_ids is a macro definition.
>
> Just define a helper function?
>

Maybe, but it is then "a variable read" vs "a FFI function call" if we
want to check every time in clear()/set(), of course if we only check it
in CpuId::from_i32() mentioned above, the performance impact shouldn't
be observable, because we won't call that method often.

Either, I was just pointing out the current fix may cause build errors.

Regards,
Boqun

> ---
> Cheers,
> Benno


Return-Path: <linux-kernel+bounces-675815-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BE25F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:35:57 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id C3FDE3AD543
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:35:35 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 776CB289346;
Fri, 6 Jun 2025 13:35:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GT5XxhiH"
Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F0622874F9;
Fri, 6 Jun 2025 13:35:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749216947; cv=none; b=EqgSEP87M5Xb/18bUfcbmNfpU4bDG6TFSS3CXB0zky1CsJaFV2+2w4NRQAykZDFAiLF/S6LCROSLOoPvGTwMV3wV60YH4ujwney95RQFtQe2L2/xinuOR7YQRIB9BW/W/rs18dw2WEzWd80p/cciv7u8fyc+39qU0pwCZR2fqUY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749216947; c=relaxed/simple;
bh=0ml/MHinxxJm56VhkaRsfFKv/4fFXloCq1LTKaQ+fVo=;
h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References:
In-Reply-To:Content-Type; b=RAx1wTinZ5tvR/bt9WhgJh6N32uVJVD4e/60KzAWmrM+b7IP0uk83WGci+lfUpG+x5+9/l15cV+YG3HcDjE0jKPKz/a2wA/xuRaG/t7dcYmLt5Ohxis9+DSDtErKsJ/eqzU1C9x5oTGHjpu1MCZkseYYjeDEqChUoTkIUrFNUks=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GT5XxhiH; arc=none smtp.client-ip=209.85.210.174
Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-747fc7506d4so2183256b3a.0;
Fri, 06 Jun 2025 06:35:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749216945; x=1749821745; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:content-language:references
:cc:to:subject:user-agent:mime-version:date:message-id:from:sender
:from:to:cc:subject:date:message-id:reply-to;
bh=J6k/v7MmiVZncaG0gAng2Qdjjf1NhngohmIKq82nZVQ=;
b=GT5XxhiHCoSUsdV7qar9bw1g7K85HwCbcaDD/kTLmmbup8cvpONPW69i9ml0Bxkktc
Ilu9u0OEkpvNT6PwA+8fRJif8c2HM+3+4yT37aidA816CdkO6R1PUJNsDsT2OE2QqaVo
yZRx/Q70AvvtGTjVv+2xg3B+48L64He5k4rpP+u4Xtmgvpx9mpeS2t9149T2kf0e55Ab
eSoh2qumwB40okN1X+zharKzakASXA4bjNM1CXkIfcrioVcFX4wgY8knmvQ9Rz6w6XsC
WK5kjHsNMz4bxWhbqoNZ2AY0b79EVK3wbpGWnq1rzomppMxLGS7RsN5bmaGgg173GeNJ
9zMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749216945; x=1749821745;
h=content-transfer-encoding:in-reply-to:content-language:references
:cc:to:subject:user-agent:mime-version:date:message-id:from:sender
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=J6k/v7MmiVZncaG0gAng2Qdjjf1NhngohmIKq82nZVQ=;
b=pZ2OSTE4TUs0CvubQTP/y/ayogEF7WnlXV4TqsHl3jVdAnNbcZjDY4tPz6pNcoIgY+
k8xqtoD06yoURVgWYOODIym6u2RRzm0a80yYK2X/XxBOuAs+oPQN4NFYJCDjRCF7eLub
OO3LqG4dpRK5zq2MuM1+AjtmE+0AgfR/57l4hxUIy2QflLOLunxGZnSBRvOtpP9rI6PS
ExWWwv62ipLJHWgD7cTAbJV2cytIADhWu9N0sV0Njz2pDFiu3yxCxuRAmWzQlD06be9C
Bbig1vu0ccjyE/zo3+8roJzND2w1ZA/VHyGk0or8Ucs8SvPhgSBDE5xWKUqfIkYFtakl
j+hw==
X-Forwarded-Encrypted: i=1; AJvYcCVSfIU36+gAXxL1VPGbuZxmThF+OkRvS4bkp7non+NdohBOrYvnbHcLMihP/s30lA0RwIr1sPTpgJJuxJFrkA==@vger.kernel.org, AJvYcCW4g2YriXPn35ETz5zIl5HQV6WWZdpSQqBiACIEx6NZhJnnc4r+NgkjHhirUEO7JCEUFSflv3UEkLMvYnqz@xxxxxxxxxxxxxxx, AJvYcCWD6NdZqHQIVkmFpPZm77mAWNJd19/xfjzl3u3eNmtPUdDFmLNsgF4PCDFnfsDe9Qqiu8HZXxDZ95U=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzq6zatOG9cxxA3xXeVOmHnDMHbHK4dS4QVV0S3Gws0MKovvqkc
vQ5uVjsl3xdpzoVCFr72g3ECnw2SCi6DXxnoO8gDbQii/xBoqeoffq3s
X-Gm-Gg: ASbGnctI7PKCGMQ/G5PGYrD0WKyrQeCUmwZ+Z3AjecIdAqItAseLxAlrAGp5UN3c2Vk
QLHA5ZPkTXdhaUqnzvRwZnz/6lsEmF4SYgweX6kC6kMCvHP3LjQTQ+PN68KmcJyc4AKxuQjO11L
kqkt9uKrBmcvduVT8BqOBEJ39lLrDGlHWYBh+xue2Gn1OZixdBYkA3oRxxizhIP9bUKarKhnAwe
vue+zenkrlGMhas5Kc5mgNPAJYAX+cLeZnB0dR1xhzwudmRF8hFPwyvWRAtd0K/Dp7YqGSk3xiP
fLmJqp1rc6pVkqsvk/J9xpCEIfzMkBBUIcwREokrSgZit/OZB+gCPlQ=
X-Google-Smtp-Source: AGHT+IGVAVfaCO3WJmW8EZtwdSKaSpA2gT2x6UkvCUzMZbUmgdcLsdnbM0vABNk8ZcknIZtO7DrmhA==
X-Received: by 2002:a05:6a00:188e:b0:742:da7c:3f28 with SMTP id d2e1a72fcca58-74827f37c17mr4990489b3a.21.1749216945558;
Fri, 06 Jun 2025 06:35:45 -0700 (PDT)
Received: from [10.0.2.172] ([70.37.26.38])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482b0842d3sm1299017b3a.98.2025.06.06.06.35.44
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 06:35:45 -0700 (PDT)
Sender: Sinan Kaya <franksinankaya@xxxxxxxxx>
From: Sinan Kaya <Okaya@xxxxxxxxxx>
X-Google-Original-From: Sinan Kaya <okaya@xxxxxxxxxx>
Message-ID: <7649f016-87f1-475d-8ff7-7608b14c5654@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 09:35:44 -0400
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 2/2] dmaengine: qcom_hidma: fix handoff FIFO memory leak
on driver removal
To: Eugen Hristev <eugen.hristev@xxxxxxxxxx>, Qasim Ijaz
<qasdev00@xxxxxxxxx>, Vinod Koul <vkoul@xxxxxxxxxx>,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
dmaengine@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx
References: <20250601224231.24317-1-qasdev00@xxxxxxxxx>
<20250601224231.24317-3-qasdev00@xxxxxxxxx>
<3c6513fe-83b3-4117-8df6-6f8c7eb07303@xxxxxxxxxx>
Content-Language: en-US
In-Reply-To: <3c6513fe-83b3-4117-8df6-6f8c7eb07303@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 6/5/2025 9:04 AM, Eugen Hristev wrote:
>> diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c
>> index fee448499777..0c2bae46746c 100644
>> --- a/drivers/dma/qcom/hidma_ll.c
>> +++ b/drivers/dma/qcom/hidma_ll.c
>> @@ -816,6 +816,7 @@ int hidma_ll_uninit(struct hidma_lldev *lldev)
>>
>> required_bytes = sizeof(struct hidma_tre) * lldev->nr_tres;
>> tasklet_kill(&lldev->task);
>> + kfifo_free(&lldev->handoff_fifo);
>> memset(lldev->trepool, 0, required_bytes);
>> lldev->trepool = NULL;
>> atomic_set(&lldev->pending_tre_count, 0);
> Is it possible that the handoff_fifo is freed, then we could observe
> reset complete interrupts before they are being cleared in
> hidma_ll_uninit later on, which would lead to the following call chain
>
> hidma_ll_inthandler - hidma_ll_int_handler_internal -
> hidma_handle_tre_completion - hidma_post_completed -
> tasklet_schedule(&lldev->task); - hidma_ll_tre_complete - kfifo_out

According to the documentation, the way to guarantee this from not happening

is to call tasklet_disable() to ensure that tasklet completes execution.
Only after that

data structures used by the tasklet can be freed.

I think proper order is:

1. tasklet_disable

2. tasklet_kill

3. kfifo_free





Return-Path: <linux-kernel+bounces-675816-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0C38441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:37:45 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 877BB3AD3BF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:37:21 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C125289358;
Fri, 6 Jun 2025 13:37:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qje3yDI1"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7726A28466C;
Fri, 6 Jun 2025 13:37:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217050; cv=none; b=dLMIdfx9KjErkHGlRulClvbeyrePktYMUH5BrYR7k+1jpZLdc8cb5+gGLw5pJKBpW32X5jklvxs4HbrWhjSwRIInTa4ZirscRHDNhv1jKdu7bcAM/HIGaJG3fq0MKCrqsY76SudaXmw0Ya/DZT0BzFwRoFafxfBB45XbOFKoiIA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217050; c=relaxed/simple;
bh=X7XpGECVvpMPfrkP+mW0VHeflAdnttqoI0luHFxrs/0=;
h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=lrTaSLHNy/Q6IAGUOp5hLDJwBhau8wO5ARCLvilbUKN3X9LxxiTwt82mKN6OZXgayviKDNcfyGGtxj7C0VOfFNbjVGJ5XqVAi9zqfJnaie+kty2hq8w+XJq0FfJCEw4s6seuwcU6KH0r9fFJ1U77AC7sHkfNiqUAyuThClve3Xk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Qje3yDI1; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPS id 0AAB9C4CEEB;
Fri, 6 Jun 2025 13:37:30 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749217050;
bh=X7XpGECVvpMPfrkP+mW0VHeflAdnttqoI0luHFxrs/0=;
h=From:Subject:Date:To:Cc:Reply-To:From;
b=Qje3yDI1idsepVzll2phkWgJ4pfDcJgTEF0GkiQN+0pRDoh6offPehcXsMQx1sGPT
zqdOrNpc+weDdgYADyPcXltXuEklOap0bBypRpwXww7U0ADMc2H2SBXM9tR3vHPD2+
OCjTq3ORSQVardg9Sq+TexaVcPcRtDF56E5N5SalvcHSfcxkMZLwJiBO1b5FLc+SPE
Xj6JXjVoDwo67uIqnjaiNMFfRL5aYEcbR4q1GZ+BVYsnOn/GHtmgY1thX8dDDHCroh
pQiD9PCJzBGxsVjJ1XF4bC/DZo3MSyTrjDXJFh6/8ZBXX3MXjpWVN5VCdpW3JHm6cJ
do+xE4R/41tbg==
Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1])
by smtp.lore.kernel.org (Postfix) with ESMTP id E93CAC5B555;
Fri, 6 Jun 2025 13:37:29 +0000 (UTC)
From: =?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu_via_B4_Relay?= <devnull+felix.piedallu.non.se.com@xxxxxxxxxx>
Subject: [PATCH 0/2] SPI: omap2-mcspi: Fix SPI CS behaviour around
cs_change in SPI transfers
Date: Fri, 06 Jun 2025 15:37:23 +0200
Message-Id: <20250606-cs_change_fix-v1-0-27191a98a2e5@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-B4-Tracking: v=1; b=H4sIABPvQmgC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE
vPSU3UzU4B8JSMDI1MDMwMz3eTieIhEfFpmhW5SkqlhYrJBmlFScpISUE9BUSpQGGxedGxtLQA
Snt9UXwAAAA==
To: Mark Brown <broonie@xxxxxxxxxx>,
Louis Chauvet <louis.chauvet@xxxxxxxxxxx>
Cc: linux-spi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
=?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu?= <felix.piedallu@xxxxxxxxxx>,
pascal.eberhard@xxxxxx
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749217048; l=1712;
i=felix.piedallu@xxxxxxxxxx; s=20250606; h=from:subject:message-id;
bh=X7XpGECVvpMPfrkP+mW0VHeflAdnttqoI0luHFxrs/0=;
b=9Gw88HDO4sOl5Z78eu6YPKIanAs+oYZtHOlWMd9EmPytklBEmMBgCvnt1fSFcAa6kJI1g5fCD
Zdpio3XEFzRCInG9+sOcIfofNgoy2S5aZKyyLSLqJOf8U/dgj36Hsvv
X-Developer-Key: i=felix.piedallu@xxxxxxxxxx; a=ed25519;
pk=Xe1dw6DIV7hmFbzuJfvaioG+S30kGix0QpIi5qPg99w=
X-Endpoint-Received: by B4 Relay for felix.piedallu@xxxxxxxxxx/20250606
with auth_id=427
X-Original-From: =?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu?= <felix.piedallu@xxxxxxxxxx>
Reply-To: felix.piedallu@xxxxxxxxxx
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

These patches fix the behaviour of the SPI Chip Select of the OMAP2 MCSPI
driver used on TI SoCs.

The omap2-mcspi driver supports the use of multi mode (multichannel in TI
documentation). In this mode, the CS is asserted and deasserted by the
hardware.

The multi mode is disabled for messages when cs_change=0 for all transfers
(e.g when CS is kept asserted between transfers of a same message).

The multi mode also needs to be disabled for messages when cs_change=1 on the
last transfer (e.g when CS is kept asserted after the WHOLE message), and the
message right after.

Currently, that is not the case and it CS is deasserted by hardware when it
shouldn't.
This breaks peripheral drivers that send multiple messages with the CS asserted
in between.

Patch 1 ensures that multi mode is disabled when cs_change=1 on the last
transfer of the message.

Patch 2 ensures that multi mode is disable on a message following one with
cs_change=1 on the last transfer.

This is the case for the TPM TIS SPI driver that uses this logic for flow
control purposes.

Tested on an AM6442 platform with a TPM ST33HTPH2X32AHE4.

Signed-off-by: Félix Piédallu <felix.piedallu@xxxxxxxxxx>
---
Félix Piédallu (2):
spi: omap2-mcspi: Disable multi mode when CS should be kept asserted after message
spi: omap2-mcspi: Disable multi-mode when the previous message kept CS asserted

drivers/spi/spi-omap2-mcspi.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
---
base-commit: c46b66be7eb595e66e93eda13149e0d4f90924ea
change-id: 20250606-cs_change_fix-bb51ac0f2bcb

Best regards,
--
Félix Piédallu <felix.piedallu@xxxxxxxxxx>




Return-Path: <linux-kernel+bounces-675817-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 112DE41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:37:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 08C023B0CDE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:37:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C36528935A;
Fri, 6 Jun 2025 13:37:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PWH0n2xz"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 772D7288525;
Fri, 6 Jun 2025 13:37:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217050; cv=none; b=TaIIo04jA4Kztgp7DTdjwFAL9XSZgJrA4x116TvqNR1uEOWCQ1Kvv3z5i8T/277PADyWACHjDKiESQjSLoIZO9fqM8a/T23cTNjvwJF16ZMs1UD8lslxP1vS/1VEGtq+GAfcEFJ9iAqx5sofMIHZKaBCc7h9o9ieG/gcQhCjLNI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217050; c=relaxed/simple;
bh=tEh4huufuzq1ic95WEsI0KqGy+7qRjXvIMpWGZsEQyE=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=seUArZtgcH2Ymz8trb1pQWX+pZQl1ORjlhkkau7KuhuBv2D7PPbhgBk6m0eGhDy4Cs0XGpa0XgGfEe+3sfx+Fhb8PFUO3mcwjYaY+/sJ/Tz46CQ2htUzVUBlscttOimrGJnWBPR0lHSkX3/u50eNE2j49zNRPka8ATyHk0YghPo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PWH0n2xz; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPS id 1CAC3C4CEF0;
Fri, 6 Jun 2025 13:37:30 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749217050;
bh=tEh4huufuzq1ic95WEsI0KqGy+7qRjXvIMpWGZsEQyE=;
h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From;
b=PWH0n2xz5hiZvfDmGlk5sH0M/AJxmbIO2rgvts8/YauCLdHkR6JGLx7rau9pN79QR
aklejQSXoN6NOovylhhT+0tdUCdeqdCc5vMASWWSgi/2Sr6NNtT/lmXedmjlT7vuEM
3k/u4NPsZHr/2rz0Bx46lKIWk2t2ZCtIJpto9OOqMidAghE7huFxD/mIKARM5VPv0f
oxCLu6pipvLTEUQNCu+L2oB8Su1RhCBrFIT8XyCx4oW5CSIOO7z9q/fBIP7yLBJ41v
OQQQxs0r+DOIwX9ji7Ly/PVJf7/HOd+T9Byp9Uztgsv8pR1PtvHNEr104Bar8Z1m3e
wO1BsbemPKdpA==
Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1])
by smtp.lore.kernel.org (Postfix) with ESMTP id 0D2A5C5AD49;
Fri, 6 Jun 2025 13:37:30 +0000 (UTC)
From: =?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu_via_B4_Relay?= <devnull+felix.piedallu.non.se.com@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 15:37:24 +0200
Subject: [PATCH 1/2] spi: omap2-mcspi: Disable multi mode when CS should be
kept asserted after message
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-cs_change_fix-v1-1-27191a98a2e5@xxxxxxxxxx>
References: <20250606-cs_change_fix-v1-0-27191a98a2e5@xxxxxxxxxx>
In-Reply-To: <20250606-cs_change_fix-v1-0-27191a98a2e5@xxxxxxxxxx>
To: Mark Brown <broonie@xxxxxxxxxx>,
Louis Chauvet <louis.chauvet@xxxxxxxxxxx>
Cc: linux-spi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
=?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu?= <felix.piedallu@xxxxxxxxxx>,
pascal.eberhard@xxxxxx
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749217048; l=1438;
i=felix.piedallu@xxxxxxxxxx; s=20250606; h=from:subject:message-id;
bh=JnAoqQPfwv0/3qSqrSpr+Emp+bDl4r2kMZHc5R7JQHQ=;
b=8Ly+pvHTwUY2wFGqufeGI2YcF55VFo+rqbUDf1C5kiDONvrNB6+y6N6gl5YdAjDtCD3poym5O
Ld5KT/ZUM/yDjrWLG8AjzZEGZcDAHgB3oXXN3oIGQ1wYZiSfUeASf8F
X-Developer-Key: i=felix.piedallu@xxxxxxxxxx; a=ed25519;
pk=Xe1dw6DIV7hmFbzuJfvaioG+S30kGix0QpIi5qPg99w=
X-Endpoint-Received: by B4 Relay for felix.piedallu@xxxxxxxxxx/20250606
with auth_id=427
X-Original-From: =?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu?= <felix.piedallu@xxxxxxxxxx>
Reply-To: felix.piedallu@xxxxxxxxxx
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Félix Piédallu <felix.piedallu@xxxxxxxxxx>

When the last transfer of a SPI message has the cs_change flag, the CS is kept
asserted after the message.
Multi-mode can't respect this as CS is deasserted by the hardware at the end of
the message.

Disable multi-mode when not applicable to the current message.

Fixes: d153ff4056cb ("spi: omap2-mcspi: Add support for MULTI-mode")
Signed-off-by: Félix Piédallu <felix.piedallu@xxxxxxxxxx>
---
drivers/spi/spi-omap2-mcspi.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 532b2e9c31d0d..05766b98de36f 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1287,9 +1287,15 @@ static int omap2_mcspi_prepare_message(struct spi_controller *ctlr,
mcspi->use_multi_mode = false;
}

- /* Check if transfer asks to change the CS status after the transfer */
- if (!tr->cs_change)
- mcspi->use_multi_mode = false;
+ if (list_is_last(&tr->transfer_list, &msg->transfers)) {
+ /* Check if transfer asks to keep the CS status after the whole message */
+ if (tr->cs_change)
+ mcspi->use_multi_mode = false;
+ } else {
+ /* Check if transfer asks to change the CS status after the transfer */
+ if (!tr->cs_change)
+ mcspi->use_multi_mode = false;
+ }

/*
* If at least one message is not compatible, switch back to single mode

--
2.43.0




Return-Path: <linux-kernel+bounces-675818-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2D2B041E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:37:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id AB96C1899D5C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:37:59 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 45CDF28935C;
Fri, 6 Jun 2025 13:37:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ATqrxo2S"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84092288531;
Fri, 6 Jun 2025 13:37:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217050; cv=none; b=XyFKWnV3McynBvCZLRy/xVdu7GK8NZ00WeZSmK+YUWP298UEOZXzxyFzcNp5ltv23+9K7ZsLGmXTsbcNcWcjerrB7G5bCWcphMHoGSlbeNlTY3YvCQ1DVXXtjnaPSQWPjEyA6pjCW39kpQHKfG5I/UUtC9feg2uTI5UXqdJ9NOA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217050; c=relaxed/simple;
bh=j1ZG+UVR+5As58K0nOWtz3Gvux3o3cl7YptKLb923LI=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=qmKknSxwcHPrm8f3dviazesnTAsno5Ik15QGp8ye4oOB891bKryHK753AsOpI8KlEVqZa5CZLu9GGCZ93mBfv5KL4Vpg0q6z+LtaCGxEigAv3T3imAnmxhjTxetYKM5XezX6ncFbTFiNsi/jIY0S0gUhC0wysC8U/C43NyRTvd4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ATqrxo2S; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPS id 29AE1C4CEF2;
Fri, 6 Jun 2025 13:37:30 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749217050;
bh=j1ZG+UVR+5As58K0nOWtz3Gvux3o3cl7YptKLb923LI=;
h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From;
b=ATqrxo2SXxWoHPJer9feNq4yP+txY6GY78Ue+4DmtPi+BM158n6kJOpNA8sbDMD28
k0Z4F+f6+n5+BqmR2b03ONdht8F7kovbP3yGlLebrfT2kHeb/uOX/6avJENZ1CUGUa
zpydLpYdl31qrNvvgL9jMie7T0f/UTx0aapUzelukchP+KMcWLTh1KNx2dABip88J2
eEDpOBYRNg9Xldog4GDEh3HjcqVU+SujNCNTh/NV40xbrg4EM4/ARqjpGMMCHmDVIP
XclNR/bMk9Q1qP/hvbfcB4ztR7SIqvaJCCp6s5l3XHAd/EEMVjL5AF1clcRE3PxmpL
3trmifwV5RyUA==
Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1])
by smtp.lore.kernel.org (Postfix) with ESMTP id 1C032C61DB8;
Fri, 6 Jun 2025 13:37:30 +0000 (UTC)
From: =?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu_via_B4_Relay?= <devnull+felix.piedallu.non.se.com@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 15:37:25 +0200
Subject: [PATCH 2/2] spi: omap2-mcspi: Disable multi-mode when the previous
message kept CS asserted
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-cs_change_fix-v1-2-27191a98a2e5@xxxxxxxxxx>
References: <20250606-cs_change_fix-v1-0-27191a98a2e5@xxxxxxxxxx>
In-Reply-To: <20250606-cs_change_fix-v1-0-27191a98a2e5@xxxxxxxxxx>
To: Mark Brown <broonie@xxxxxxxxxx>,
Louis Chauvet <louis.chauvet@xxxxxxxxxxx>
Cc: linux-spi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
=?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu?= <felix.piedallu@xxxxxxxxxx>,
pascal.eberhard@xxxxxx
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749217048; l=2225;
i=felix.piedallu@xxxxxxxxxx; s=20250606; h=from:subject:message-id;
bh=ZfK7KhDeQVloCseH0ix7UHPadZvoLWxPnDeBOqVmuHc=;
b=zAg37+l7LEpXbrIyD57QaE5LxdWhhzikt5JuQVFnSfTgdNHtR2dlVVo/MIXi+fh9L2k8bNtf+
Csixkf4Oi5rAxvN/O43I2fBIZ7umaEKjlpquA+0lFQttGho9C/QsuWx
X-Developer-Key: i=felix.piedallu@xxxxxxxxxx; a=ed25519;
pk=Xe1dw6DIV7hmFbzuJfvaioG+S30kGix0QpIi5qPg99w=
X-Endpoint-Received: by B4 Relay for felix.piedallu@xxxxxxxxxx/20250606
with auth_id=427
X-Original-From: =?utf-8?q?F=C3=A9lix_Pi=C3=A9dallu?= <felix.piedallu@xxxxxxxxxx>
Reply-To: felix.piedallu@xxxxxxxxxx
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Félix Piédallu <felix.piedallu@xxxxxxxxxx>

When the last transfer of a SPI message has the cs_change flag, the CS is kept
asserted after the message.
The next message can't use multi-mode because the CS will be briefly deasserted
before the first transfer.

Remove the early exit of the list_for_each_entry because the last transfer
actually needs to be always checked.

Fixes: d153ff4056cb ("spi: omap2-mcspi: Add support for MULTI-mode")
Signed-off-by: Félix Piédallu <felix.piedallu@xxxxxxxxxx>
---
drivers/spi/spi-omap2-mcspi.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 05766b98de36f..4c5f12b76de6a 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -134,6 +134,7 @@ struct omap2_mcspi {
size_t max_xfer_len;
u32 ref_clk_hz;
bool use_multi_mode;
+ bool last_msg_kept_cs;
};

struct omap2_mcspi_cs {
@@ -1269,6 +1270,10 @@ static int omap2_mcspi_prepare_message(struct spi_controller *ctlr,
* multi-mode is applicable.
*/
mcspi->use_multi_mode = true;
+
+ if (mcspi->last_msg_kept_cs)
+ mcspi->use_multi_mode = false;
+
list_for_each_entry(tr, &msg->transfers, transfer_list) {
if (!tr->bits_per_word)
bits_per_word = msg->spi->bits_per_word;
@@ -1289,22 +1294,17 @@ static int omap2_mcspi_prepare_message(struct spi_controller *ctlr,

if (list_is_last(&tr->transfer_list, &msg->transfers)) {
/* Check if transfer asks to keep the CS status after the whole message */
- if (tr->cs_change)
+ if (tr->cs_change) {
mcspi->use_multi_mode = false;
+ mcspi->last_msg_kept_cs = true;
+ } else {
+ mcspi->last_msg_kept_cs = false;
+ }
} else {
/* Check if transfer asks to change the CS status after the transfer */
if (!tr->cs_change)
mcspi->use_multi_mode = false;
}
-
- /*
- * If at least one message is not compatible, switch back to single mode
- *
- * The bits_per_word of certain transfer can be different, but it will have no
- * impact on the signal itself.
- */
- if (!mcspi->use_multi_mode)
- break;
}

omap2_mcspi_set_mode(ctlr);

--
2.43.0




Return-Path: <linux-kernel+bounces-675819-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5410541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:39:01 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 97F91188E629
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:39:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 50EA6288CBA;
Fri, 6 Jun 2025 13:38:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dQRlP5B3"
Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0195A27FD5A;
Fri, 6 Jun 2025 13:38:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217131; cv=none; b=kbM6TWIMB8rVdDFQFlbhT46csO7qsc+w7YciNkSIRZYu1cogQqzdNVWEMOKWybmVTxwReZIonsIeb/Rhui1zGGVKyZFeYl9joMXCIjFvfyJ1UmerS9gp9jx/pPRTsYJmbGD4lyW0RHjfWYVDWsoLRiSPU0wApxbFOprI77UOzU0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217131; c=relaxed/simple;
bh=i/sMVuO8iNJ8ZhAbZ6eyUTqL1PCfrshV3q08uPOaI8s=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=VMF6Kg80zaidN/GSZcBnZetdZoA5UfhDYuNK71x/+LWT5Ifassfny/Wwpa+uVMyjJOf4d4AncFZ5tn+faQSW0Rk9gcq3yzp20elOJJN4Jn2UgfR2J/7yXpmq6fk6xevyVu2xK7U4om7w1Purd+HcEt4vslfGUkqZ+OHfup5xvfM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dQRlP5B3; arc=none smtp.client-ip=209.85.128.43
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-450ce3a2dd5so18577715e9.3;
Fri, 06 Jun 2025 06:38:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749217128; x=1749821928; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=UBzs9Ew5KwIBcYOeb4WQWOnLhpy4yI/0V3+nv2AZEbo=;
b=dQRlP5B3QXBsTPD9IU2CTjUL+HIy5ms0Twwbrwsgs4/iWvgFd6+enqVjKoU1Y9c4Wa
ASWwNTcNp0MCF4ewdTjKb1CNdO4Nqgund+v2MM7wi+OaG1ID/vs2O4tgx1tVkvUWOMSm
+KsH+XFSSbLmb0jLNlzPlrkYaUN7ATEvZuxGdma1xfAGL4A1+2c8PBA92jNHdtJZ3oeJ
I/rSs8e+qMyaHUYeY+AqVijAuO1Alp2NUA6E1Qb45X2e3pRJ87dJyCqPyDI7oHbEuJWu
kGPHjgpQaYan0aiQY095SesPqweNWpZAqMT1UETrm52qNyBU4+V54VuhkTYwnlrD5wCd
V+2A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217128; x=1749821928;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=UBzs9Ew5KwIBcYOeb4WQWOnLhpy4yI/0V3+nv2AZEbo=;
b=kRy95VLqd+NPiXOPCAQ+DzuyCdiFQYTywv4fktSD8lteKQZyCexNd8jaT+2Eop2GMS
1FbokJEkuvz1SZq2E31Z/Z0wnfn7cJ43B9Ws4POeD5B0uPENbi6jSy2gZheegtVPc3rL
2HV327vG4V/KtYf23QgjEQnbyIZ1Tb7RhA6753Dq420CY9I4HyyqXD7HwmCXwi9DJD00
VTtEA4o/FpmXYvx2q3j93hT4IDjLOmCAd+uO36v1Nvp40e6XvuyCqGzJq2JIkpkZSRLl
pt04xixXbJfdT8ok1OwTFn4qBgj+P/OciDwWyeDKGptR4WcfmzO6P8g5maGZ9M0dKm+3
tGQw==
X-Forwarded-Encrypted: i=1; AJvYcCVnrxNs7VkHgLJv7PaGMBB2BiUwLU3/vR3J3yBq052hGFOuD4qSjoiSItINpbcXikjUuIfPOnZ9GOJv1PCE@xxxxxxxxxxxxxxx, AJvYcCXVqJ7xDkO1y5XcCbbx8pLAQI1jBq2rYyQYzNV0pdIMnPAOLLhoGOerYUyfqDkdl2LRTPrOOVb4mGT7@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yxb/nIs53pQ/o+b2WOg9k0jlsYE1ldbRFA16GlweVGJRRI2qGDI
VKYvWSGgZHDebpmRtHObWs4mBm5FrnxEmTjc2sCQsGtGEi34SKGeKgAa
X-Gm-Gg: ASbGncuN3qrWHz3oRFj3bdXmpBC6oT7fE0ssbn7zoLJf7V0hW708sPj2LKAFR6It3er
OPuOJI4yQD88+Y32D0+Tj2oYaHJLXs9Ih9atCQ8bYqIoi7I1VT10FyU3fSNiPTd2urnRyKCy/LL
FEQuu+3Vr2lzaNh0wgL/Q/YE1na726QA8cTVxRZZn58Veom6JUJd3o/y6Oka5ksfWn/3RBI78Q4
P79GXa/4C8tGz5p83jYnVtlO4iCXjQa0kBB92dYmaz/j111pIuxnVeaLdeM+/X74UuuGP0FPzEf
VK3jYObj3GP4GSDaJJhMrSInSzoiib2PAtV2yUeHOzl1+hj4MDrjSRTGztBAiy8mCSc3nwcuMYH
7WgzJywhhgcO4vQ==
X-Google-Smtp-Source: AGHT+IGEeYlCUaUS7RpBCRaEkytsgTz8ufVp559clScKzg118VfvwDv+t0Kd/rSexBzezC1CyldiaQ==
X-Received: by 2002:a05:600c:8b72:b0:43d:9f2:6274 with SMTP id 5b1f17b1804b1-45201360d06mr36840335e9.14.1749217127892;
Fri, 06 Jun 2025 06:38:47 -0700 (PDT)
Received: from masalkhi.. (ip-109-43-113-198.web.vodafone.de. [109.43.113.198])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364d4sm1906758f8f.55.2025.06.06.06.38.46
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:38:47 -0700 (PDT)
From: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
To: gregkh@xxxxxxxxxxxxxxxxxxx
Cc: abd.masalkhi@xxxxxxxxx,
arnd@xxxxxxxx,
conor+dt@xxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
robh@xxxxxxxxxx
Subject: Re: [PATCH v3 2/3] misc: add driver for ST M24LR series RFID/NFC EEPROM chips
Date: Fri, 6 Jun 2025 13:38:45 +0000
Message-ID: <20250606133845.3140152-1-abd.masalkhi@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <2025060625-deviate-crummy-2633@gregkh>
References: <2025060625-deviate-crummy-2633@gregkh>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi greg,

Thanks for the feedback.

>> adds support for STMicroelectronics M24LRxx devices, which expose
>> two separate I2C addresses: one for system control and one for EEPROM
>> access. The driver implements both a sysfs-based interface for control
>> registers (e.g. UID, password authentication) and an nvmem provider
>> for EEPROM access.
>>
>> Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
>> ---
>> Changes in v3:
>> - Fully support the M24LR chips, including EEPROM access, no need for
>> the standard at24 driver to handle EEPROM separately.
>
> Why isn't this under drivers/misc/eeprom/ instead?

The M24LR series is a dual-interface EEPROM with both I2C and ISO/IEC 15693
RF support. While it is technically an EEPROM, it also exposes a control
interface over I2C via a seprated address, which is used to manage features
such as password protection, energy harvesting configuration, and UID access.
This control interface is not memory-mapped like traditional EEPROMs, which
is why I did not place it under the eeprom

Best regards,
Abd-Alrhman Masalkhi


Return-Path: <linux-kernel+bounces-675820-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5727B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:39:24 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7E9AA3B2B17
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:38:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F67428937B;
Fri, 6 Jun 2025 13:39:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b="kX2stUGY"
Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150])
(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 4B31B27FD5A;
Fri, 6 Jun 2025 13:38:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.143.211.150
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217141; cv=none; b=okuciEbyt+5K/FBlIVIEBYYXbASJBdEqGUhsK7NbY3wuxOqo7rqfRytZb5plKVOvwzpErsoFeFxDBeh04+5rIxjqi6NtSyczCR34njOUMz21QplDc/bhgzORWQTiSthWzqd1ASc34Cm4k9Er97UckU/k2DAg668KNWLNQw9VwRw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217141; c=relaxed/simple;
bh=mdgDgqmHWYRMiJBeD5MRWizVMkY2pth50iG8rwuBYOo=;
h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References:
In-Reply-To:Content-Type; b=ol+VIMfRd+hXq9/5imDAvGpzAh4wM39XuE3xhJcLHzt0slQ9qDYZMyTxsxm0nNC4edK7Pk2NPRE7z8B0X979OwnHQNZEte3NW1m7Ezr4WJqvhJkbMIhLRNd4MBVhVB4V2llDPlVJguraTOcK1B/xj035R4JdP8ogXNxgauVRiHg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=swemel.ru; spf=pass smtp.mailfrom=swemel.ru; dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b=kX2stUGY; arc=none smtp.client-ip=95.143.211.150
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=swemel.ru
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=swemel.ru
Message-ID: <49730b18-605f-4194-8f93-86f832f4b8f8@xxxxxxxxx>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail;
t=1749217127;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=1jhQpF+R0Z64uKurrBCjq0j+He4F0llIw3IZaku5tJQ=;
b=kX2stUGY573U2qg5ZI0N4pwIUvvKTudDnhgBPWBxxBfNPRZa04Z6CrkvK4PuxDlhqJ3LoC
Q9GTAM36hxbyZMg72yzNobP8Sz4rBd1z+kE8wvjSZxuCkBw/uDfwb0YIORVzLfgvb+Ogqq
q5AIMWU8zyzj/qGt9DJNU/u3whTPNEM=
Date: Fri, 6 Jun 2025 16:39:45 +0300
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
From: Konstantin Andreev <andreev@xxxxxxxxx>
Subject: Re: [PATCH v2] security,fs,nfs,net: update
security_inode_listsecurity() interface
To: linux-security-module@xxxxxxxxxxxxxxx
Cc: linux-nfs@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-fsdevel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx,
selinux@xxxxxxxxxxxxxxx, Stephen Smalley <stephen.smalley.work@xxxxxxxxx>,
Christian Brauner <brauner@xxxxxxxxxx>,
Casey Schaufler <casey@xxxxxxxxxxxxxxxx>, Paul Moore <paul@xxxxxxxxxxxxxx>
References: <20250428195022.24587-2-stephen.smalley.work@xxxxxxxxx>
Content-Language: en-US
Disposition-Notification-To: Konstantin Andreev <andreev@xxxxxxxxx>
In-Reply-To: <20250428195022.24587-2-stephen.smalley.work@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 06 Jun 2025 13:38:46.0205 (UTC) FILETIME=[53AB3ED0:01DBD6E8]
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Stephen Smalley, 28/04/2025:
> Update the security_inode_listsecurity() interface to allow
> use of the xattr_list_one() helper and update the hook
> implementations.
>
> Link: https://lore.kernel.org/selinux/20250424152822.2719-1-stephen.smalley.work@xxxxxxxxx/

Sorry for being late to the party.

Your approach assumes that every fs-specific xattr lister
called like

| vfs_listxattr() {
| if (inode->i_op->listxattr)
| error = inode->i_op->listxattr(dentry, list, size)
| ...

must call LSM to integrate LSM's xattr(s) into fs-specific list.
You did this for tmpfs:

| simple_xattr_list() {
| security_inode_listsecurity()
| // iterate real xatts list


Well, but what about other filesystems in the linux kernel?
Should all of them also modify their xattr listers?

To me, taking care of security xattrs is improper responsibility
for filesystem code.

May it be better to merge LSM xattrs
and fs-backed xattrs at the vfs level (vfs_listxattr)?

--
Konstantin Andreev


Return-Path: <linux-kernel+bounces-675821-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 125E141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:40:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6DC863AE40A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:39:44 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A5A4B28934E;
Fri, 6 Jun 2025 13:39:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZkwI0RYP"
Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B5AA288C23;
Fri, 6 Jun 2025 13:39:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217197; cv=none; b=kHmFBKUeh0poLBq4vc8Dn3iB/Jfq3D4jMM0npv5HdSym4UAnl17N++3QxYIBLNb1Udk44aImOcL7rHt+xmG32pJCNe2wd4W0K9lShjUYKHeFtxBF1RF90IdpnzJh2d7m0hO8OfDar5mL/w5w42hs3AyvuG0aGXxAKCGGIhsIYr8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217197; c=relaxed/simple;
bh=kpYBCOWqlcUbNI8U/W5uVMq4kEfwQ6kJSs+hTJoI0Gg=;
h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:
Message-Id:References:To; b=o8ITaMlrjm3tDL3rTiKctWwxsY33aY1Zv7K+1qlKsLd4A2378z3srd2DrdsqCucYwNg/qvXUcM01JF0SGkzvR970X/jKU/x5pioKju9KnttOzUqE/NJ9Wj1J8PTS229hH5G/15PmwcGP+MuJCu9eFGQH3+mOGiCDQFfN3LMt2Yg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZkwI0RYP; arc=none smtp.client-ip=209.85.210.176
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-74019695377so1406020b3a.3;
Fri, 06 Jun 2025 06:39:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749217195; x=1749821995; darn=vger.kernel.org;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=T0kzSCcm7K1KpCxO5k7+lql1juWpoA+wPJQtkbiIdI0=;
b=ZkwI0RYPLrQ+f+2/XRKTslWVbNHij+AzJZdksvaCKQ7qZtr0F8AyUED3DnxVCQRF26
4bS7E1Lt3GxQIcfGx+MNLxF2P1bKPsRqUCCWqYQPKcl9giuzIDipW3qovrCgD4GiEqWY
4NbBzMqIxb9USdtUFz/m6O2mxs8TDNiNWGZR7GBbUizTGT/kE930OJTDz/08CphKVd57
XvvB6Vgwf/aBznXVjAD6rGSWi7yfps+J00OPzjNX6Z5JHXdVLML5oj2dcqubXWtqLzJI
tBXOyhh62mZE2WejbMNhvX5xfl+KWQstVmAAImcoNi7r4kVopr2fcppdps8pLtbyPG8q
O+Nw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217195; x=1749821995;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=T0kzSCcm7K1KpCxO5k7+lql1juWpoA+wPJQtkbiIdI0=;
b=Zs563dvnvNqiaFgFitlhNrOz/wn/fC2jgeYL0LL3FbdVTx+kGwOfJ5iWYbJc4zb76e
iByIbje27i/fkXejs0E20SppzQS1sVa+UCwu7WQg2Rm+kl/4GNlPjoQWG8B/FufBv8Yp
0Z/Nh7zSzxS7k7+h1WC/dLaFUJ2+WWVEZ5AuMkdoQFXUsb4tK9x3xILj/9+z+GU9CRTF
JXjYI2D4Ig6SjV92qiZ4bJqoYIZX46PZWLkAAFCJnWEtDYhcZ+8RJ3gT/2FXthqhwg9x
r75WdqxzEhndHSS6RCZPDJdytuecU2V8sU5n5sQgX2S8WcL9X0dkobdbVhQAj/bEpXRn
eaog==
X-Forwarded-Encrypted: i=1; AJvYcCWpztSKviYP/ibl2zmrwIlNA8lW4eCcFL47W+nNneX6V8PjkyI0Vd2MKOkaOzXjzTeSHLx34LSC@xxxxxxxxxxxxxxx, AJvYcCX/eEw8BMRYQPLjcg77VyBnrfMjup9s04C2waztBJ9tm3n6NCYcKIHs7jvNeycScfvYY91Ca47HFJogrbtH@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YxFqa0CHohq6C3yCB0gOsfbyBVqOX8P/UmhhClU9+/q7v64Vp52
ixwm1DjgMIgDCywsAoBpqS71k01pkxWPE3WbgCTLlpigAygu2j7HlL4hc/04KIPeBLP4bw==
X-Gm-Gg: ASbGncvaMYb/mov6xpXzYJqFm/hPY/1FoG0q2ek8eIzdfF+tq4k6W9wGZWLpSFyUq/f
xndtuEFv9a4dcMjXCXIIU0SgDzfwn4BkfLN2ohAgASo0Khc7w9KPvwCHZwps243GNHfJsXot7i7
6gIYimDv/yGnbNazSbfI0bcazWymoIF9osOdBPewLBzlMWZWHqqoDEdIFYjoi4IkxGJJ0rN6Dzj
dly2kAc+c1dRe9cVyhzfxfiDJf5pb5i3aQDRDBJjPwVIIa0fiQAdyaoC80OYWayMjrde1ImSm1m
Gn/lpy3Tlad81nJbp88ClMdI4kUfmWn1BFyVOuHU8GZ1qSpMYpxTLrzu6d/i1zz1SqPtEAnj
X-Google-Smtp-Source: AGHT+IEMlcmwoxdTvWn0G98Yet4VJ5pqbwUzfEyzyHyYpjEiKg/CzXJUy3i9Oim6mG2bP7tJSFDg0w==
X-Received: by 2002:a05:6a21:a8c:b0:1f5:769a:a4bf with SMTP id adf61e73a8af0-21ee264c083mr6045628637.36.1749217195492;
Fri, 06 Jun 2025 06:39:55 -0700 (PDT)
Received: from smtpclient.apple ([202.8.105.124])
by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b2f5f66a7c9sm1161513a12.46.2025.06.06.06.39.51
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Fri, 06 Jun 2025 06:39:55 -0700 (PDT)
Content-Type: text/plain;
charset=utf-8
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\))
Subject: Re: [PATCH v0] cgroup: Add lock guard support
From: Jemmy Wong <jemmywong512@xxxxxxxxx>
In-Reply-To: <20250606104248.GA1118@xxxxxxxxxxx>
Date: Fri, 6 Jun 2025 21:39:39 +0800
Cc: Jemmy <jemmywong512@xxxxxxxxx>,
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>,
Tejun Heo <tj@xxxxxxxxxx>,
=?utf-8?Q?Michal_Koutn=C3=BD?= <mkoutny@xxxxxxxx>,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
Alexei Starovoitov <ast@xxxxxxxxxx>,
Daniel Borkmann <daniel@xxxxxxxxxxxxx>,
Andrii Nakryiko <andrii@xxxxxxxxxx>,
Eduard Zingerman <eddyz87@xxxxxxxxx>,
Song Liu <song@xxxxxxxxxx>,
Yonghong Song <yonghong.song@xxxxxxxxx>,
John Fastabend <john.fastabend@xxxxxxxxx>,
KP Singh <kpsingh@xxxxxxxxxx>,
Stanislav Fomichev <sdf@xxxxxxxxxxx>,
Hao Luo <haoluo@xxxxxxxxxx>,
Jiri Olsa <jolsa@xxxxxxxxxx>,
"open list:CONTROL GROUP (CGROUP)" <cgroups@xxxxxxxxxxxxxxx>,
LKML <linux-kernel@xxxxxxxxxxxxxxx>
Content-Transfer-Encoding: quoted-printable
Message-Id: <CB194CAD-0279-4A4B-90EA-A510F1A3438E@xxxxxxxxx>
References: <20250605211053.19200-1-jemmywong512@xxxxxxxxx>
<CAADnVQJyATTb9GFyBhOy5V_keAO5NZ6+zucLRyN27Cmg2FGPVA@xxxxxxxxxxxxxx>
<20250606104248.GA1118@xxxxxxxxxxx>
To: Johannes Weiner <hannes@xxxxxxxxxxx>
X-Mailer: Apple Mail (2.3826.600.51.1.1)
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Johannes,

Thanks for your feedback. I understand your concerns about the=20
indentation and visual clarity with the lock guard.=20
Let me explain why I think it=E2=80=99s still a good choice:

1. Less Error-Prone
Lock guards automatically release the lock when the scope ends,=20
even with early returns or errors. Manual lock/unlock can miss an =
unlock,=20
causing deadlocks=E2=80=94lock guards prevent this.

2. Clear Critical Sections
The scoped_guard clearly shows where the critical section starts and =
ends,=20
making the code easier to follow and maintain, even if it adds =
indentation.

3. Fixing the Concerns
I agree the extra indentation can look messy. I can refactor to reduce =
nesting=20
or adjust the style to make critical sections clearer.=20
I=E2=80=99ll also ensure the lock guard only covers the critical =
section,=20
avoiding non-critical work inside.

Many modern programming languages provide lock guard-like constructs
to manage synchronization safely,=20
showing that this approach is a widely accepted best practice.=20
Manual lock/unlock is often discouraged because it=E2=80=99s =
error-prone,=20
especially in complex codebases. Here are a few examples:

C++:
std::mutex m;
void example() {
std::lock_guard<std::mutex> lock(m); // Locks m
// Critical section
} // Automatically unlocks m when scope ends


Rust:
use std::sync::Mutex;
let m =3D Mutex::new(0);
{
let mut guard =3D m.lock().unwrap(); // Locks mutex
*guard +=3D 1; // Critical section
} // Automatically unlocks here

Java:
ReentrantLock lock =3D new ReentrantLock();
try (lock.lock();) { // Locks and ensures unlock
// Critical section
} // Automatically unlocks here

Python:
from threading import Lock
lock =3D Lock()
with lock: # Locks here
# Critical section
# Automatically unlocks here

I think lock guards make the code safer and clearer,=20
but I=E2=80=99m happy to tweak the implementation to address your =
concerns.=20
Let me know your thoughts!

Best,
Jemmy


> On Jun 6, 2025, at 6:42=E2=80=AFPM, Johannes Weiner =
<hannes@xxxxxxxxxxx> wrote:
>=20
> On Thu, Jun 05, 2025 at 05:54:15PM -0700, Alexei Starovoitov wrote:
>> On Thu, Jun 5, 2025 at 2:11=E2=80=AFPM Jemmy Wong =
<jemmywong512@xxxxxxxxx> wrote:
>>>=20
>>> This change replaces manual lock acquisition and release with lock =
guards
>>> to improve code robustness and reduce the risk of lock =
mismanagement.
>>> No functional changes to the cgroup logic are introduced.
>>>=20
>>> Signed-off-by: Jemmy Wong <jemmywong512@xxxxxxxxx>
>>>=20
>>> ---
>>> include/linux/cgroup.h | 7 +
>>> kernel/bpf/cgroup.c | 96 +++---
>>> kernel/bpf/local_storage.c | 12 +-
>>=20
>> Nack for bpf bits.
>> It only uglifies the code.
>=20
> I agree with this.
>=20
> The extra indentation from scoped guard is unfortunate.
>=20
> The guard with implicit unlock gives me the heebeejeebees - it's
> asymmetric and critical sections don't stand out visually at all.

There=E2=80=99re two types of guard: guard and socped_guard.=20

The guard is asymptomatic and doesn=E2=80=99t stand out visually very =
well.
We could choose socped_guard which clearly defines the boundaries of =
critical section.

To clarify usage:
- For critical sections is part of a function, prefer socped_guard,=20
as it explicitly delineates the boundaries of the critical section.
- For critical sections spanning an entire function, prefer guard,=20
as it better suits the broader scope.

> Adjusting critical section boundaries with guard means either:
> * indentation churn to convert to scoped guard,
> * forcing abstraction splits along critical sections (non-API
> _locked functions), which makes the code flow harder to follow,
> * or straight-up violating abstraction layering and adding
> non-critical stuff to callers where it doesn't make sense.
>=20
> I don't remember the last production bug from forgetting to drop a
> lock. Meanwhile, the things that people actually seem to struggle with
> when it comes to locks appear to become harder with those primitives.


Return-Path: <linux-kernel+bounces-675822-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B5FFD41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:42:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 442F01898C50
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:42:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A15C28934E;
Fri, 6 Jun 2025 13:41:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cacx1iEy"
Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B7403A1BA
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:41:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217318; cv=none; b=hY3GWfV3L9E7aiyX64j6RxYSK/jcu+4afZdNGbtTd8m8DG7nbxdYHDNRXTykI117gvbWEwir9mIZnJXgbuXDp9p1hYwlnNA0S8CPPRfu2FKOSVBcLwKuDtGJkUzJ6L2VFf25SzHP4mtzuQPiM/4a2zPkYlL8lLelWSg0xYGTGdM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217318; c=relaxed/simple;
bh=9nLwSViwc+aWV16xCbkbc68VQlSagffWIhULfrfxBu4=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=IveEvbhu6iJHJhJYJDscoYZ9u7uv3ypW4tNCE0+Joaqu3y9MXKRnRlRbhiuNrPLR6arEs8Fn+uy1IhwXm5Oh16/bbSoSSjfuEGClLzDV0ZcY7+PKw4EiArMamXlcPOa/OxqDaF1hEcTFl1AVC4OVJnApNLyBpoRp74pvnPkzP0k=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cacx1iEy; arc=none smtp.client-ip=209.85.128.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-451ebd3d149so14128085e9.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:41:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749217313; x=1749822113; darn=vger.kernel.org;
h=cc:to:message-id:content-transfer-encoding:mime-version:subject
:date:from:from:to:cc:subject:date:message-id:reply-to;
bh=HTFOzWRKtno69oZOUe1NTizA/xt3mfhoIf6VlgXm33Q=;
b=cacx1iEyTvCfe7IQU8l+6wGSFSEQvDRGeow0bZsqQE1OPWQSOKlgA0I0ThSJFKAsgb
ztPS8fpTGrFKkMKmiOnKGARVHDC0fpOQf59yfI+N/q62aF/ySIcxnwNDygcfV5BWZkhN
nTqeZkgwA+mD+cMUA8i9XEcKIqhh5byGLyTRJ3+TVrhD0lVCG8onhEGXiTcdjeVluU48
+oUrK3o+T98kuH+qxiUMvKcdq38Tb4eYpbV2PwO88rBv3keOJ+/ZX6NTGfBiuveoO9oa
nRCuhjzXJtQRUDO76ihVaxmtQ0YLONAm9M9rvGIVlfvqmG9yZiZvq2k9oRc28ydOgJw+
4Hxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217313; x=1749822113;
h=cc:to:message-id:content-transfer-encoding:mime-version:subject
:date:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=HTFOzWRKtno69oZOUe1NTizA/xt3mfhoIf6VlgXm33Q=;
b=sp+ecAseWH8wBJ6Nn/NKwzWbC4P2HuCDLB/Q7Tf8Jt0FYuaFhU2vnkSewXHMkJ2+e5
EuN/4UfoTFpVsIALpdr/+XYG+s4GlXVQtxF/cnS6yX9V/Vi0ahet2hQFIs+omaEU6Snw
anPWPfvw2COEN9EThXB9Hoe/JBUGz+0Db48IKDJuuLXDoTiDtDS5+JuXmtmvccGGwucR
2CRf1LJYRNUEk5h0h8g312+3Luu55H3IZml5jBFPKRP8e++AXRrdZzYRsQJRMU7e54pW
c/oZEiPT8aM6YJPag7eJgrfJgt6mlo9xiSI8r7Q4JFbDp+00JKh7IfIB/J6sIiFB/X7+
Md/g==
X-Forwarded-Encrypted: i=1; AJvYcCXXNjQqCbNm9cb/Shve2u8nrW+MfQdvqj3yG+UKX/DmNLMsCWPxcbo34nUX3bTbenijlQFoopFOc569Nds=@vger.kernel.org
X-Gm-Message-State: AOJu0YwjTugWpocFswzG0PgdObtWRKr5pMtVwzjELG9RNbxXl3m34ZHN
k6CTiYKDT9Pbk4NtQaZ7PB6TTbtPACZH0cR4mg+DkN5UBNKI0UClOlG1gsJtZswrLTc=
X-Gm-Gg: ASbGncvieiuTs5k224eWj5r2dTo019N8mrU+Kc7pSTi3QLBh3Hhw6XRMbGvE19i13vU
0XN1f/ZHV9M1hFIFtjdaFCE38TDUUN2koEWI520phG2KLR6g3z+NzrmLg0KDuxfxvgx/jK3BcKb
9bPiOi22DBBbwEQcdZaluMYCfgQxAP9cZm2//mIoUz5H8EXP/FNon7IEL5BbqKxl/SOl9S/P30C
x3MlSI27+dj/9c4gXVlyZZKoBGgoo58FryG0xQwNfmSgkL+fT12bE+6jpQ5//5ri10j8hnKj3Ea
oeCxbeIUxUBfG5L8JIoKeu5SsM4k/0ig2I2H1Fq009QAG2V12sMwhHK7Wj78k6caVptHKewIWhh
4EqnkHKpwGDtkXNl9u5htpNib8442m2boLmv460vEPg==
X-Google-Smtp-Source: AGHT+IE1rwwQG+rrsjon14loLoaLqiSSZKx9HHA2Hy4/99w3nYKxkficVfbYFMwV7U9uCCDFDR7jUg==
X-Received: by 2002:a05:600c:6099:b0:440:61eb:2ce5 with SMTP id 5b1f17b1804b1-452013bb38dmr43474495e9.17.1749217313338;
Fri, 06 Jun 2025 06:41:53 -0700 (PDT)
Received: from ta2.c.googlers.com (213.20.187.35.bc.googleusercontent.com. [35.187.20.213])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-452730b9b3esm21744355e9.25.2025.06.06.06.41.52
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:41:52 -0700 (PDT)
From: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 13:41:47 +0000
Subject: [PATCH] mailbox: stop the release and reacquire of the chan lock
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-mbox-drop-reacquire-lock-v1-1-d36d1a13d83f@xxxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIABrwQmgC/x3MSwqAMAwA0atI1gaq2ApeRVzYNmrwU01RBPHuF
pdvMfNAJGGK0GQPCF0cOWwJRZ6Bm/ptJGSfDKUqtTLK4GrDjV7CjkK9O04WwiW4GYvK1k77wWj
rIeW70MD3v2679/0A0bwLw2oAAAA=
X-Change-ID: 20250606-mbox-drop-reacquire-lock-14b7c5df65bd
To: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Cc: peter.griffin@xxxxxxxxxx, andre.draszik@xxxxxxxxxx,
willmcvicker@xxxxxxxxxx, cristian.marussi@xxxxxxx, sudeep.holla@xxxxxxx,
kernel-team@xxxxxxxxxxx, arm-scmi@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749217312; l=4642;
i=tudor.ambarus@xxxxxxxxxx; s=20241212; h=from:subject:message-id;
bh=9nLwSViwc+aWV16xCbkbc68VQlSagffWIhULfrfxBu4=;
b=yN4/VRu2saV+kafEgQ/J98zKsJ5c/2AtnH4fkCjwcQCOOssEK0vbYLKHc3ubvIscEIATb5UE6
rIpC5QBMDZUDAE+3ENPq6msKD+CmxZbAON0pZc8TugUi1B9xRzibRA0
X-Developer-Key: i=tudor.ambarus@xxxxxxxxxx; a=ed25519;
pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI=
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

There are two cases where the chan lock is released and reacquired
were it shouldn't really be:

1/ released at the end of add_to_rbuf() and reacquired at the beginning
of msg_submit(). After the lock is released at the end of add_to_rbuf(),
if the mailbox core is under heavy load, the mailbox software queue may
fill up without any of the threads getting the chance to drain the
software queue.
T#0 acquires chan lock, fills rbuf, releases the lock, then
T#1 acquires chan lock, fills rbuf, releases the lock, then
...
T#MBOX_TX_QUEUE_LEN returns -ENOBUFS;
We shall drain the software queue as fast as we can, while still holding
the channel lock.

2/ tx_tick() releases the lock after setting chan->active_req = NULL.
This gives again the possibility for the software queue to fill up, as
described in case 1/.

Address the cases from above by draining the software queue while still
holding the channel lock.

Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>
---
drivers/mailbox/mailbox.c | 75 ++++++++++++++++++++++++++---------------------
1 file changed, 41 insertions(+), 34 deletions(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 5cd8ae22207309fadbe8fe7f6fd8b4bc2c345cfd..b064a0bd98fd07bfa4dc4186c90e5989d5dfd510 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -26,8 +26,6 @@ static int add_to_rbuf(struct mbox_chan *chan, void *mssg)
{
int idx;

- guard(spinlock_irqsave)(&chan->lock);
-
/* See if there is any space left */
if (chan->msg_count == MBOX_TX_QUEUE_LEN)
return -ENOBUFS;
@@ -48,49 +46,49 @@ static void msg_submit(struct mbox_chan *chan)
{
unsigned count, idx;
void *data;
- int err = -EBUSY;
-
- scoped_guard(spinlock_irqsave, &chan->lock) {
- if (!chan->msg_count || chan->active_req)
- break;

- count = chan->msg_count;
- idx = chan->msg_free;
- if (idx >= count)
- idx -= count;
- else
- idx += MBOX_TX_QUEUE_LEN - count;
+ count = chan->msg_count;
+ idx = chan->msg_free;
+ if (idx >= count)
+ idx -= count;
+ else
+ idx += MBOX_TX_QUEUE_LEN - count;

- data = chan->msg_data[idx];
+ data = chan->msg_data[idx];

- if (chan->cl->tx_prepare)
- chan->cl->tx_prepare(chan->cl, data);
- /* Try to submit a message to the MBOX controller */
- err = chan->mbox->ops->send_data(chan, data);
- if (!err) {
- chan->active_req = data;
- chan->msg_count--;
- }
+ if (chan->cl->tx_prepare)
+ chan->cl->tx_prepare(chan->cl, data);
+ /* Try to submit a message to the MBOX controller */
+ if (!chan->mbox->ops->send_data(chan, data)) {
+ chan->active_req = data;
+ chan->msg_count--;
}
+}

- if (!err && (chan->txdone_method & TXDONE_BY_POLL)) {
- /* kick start the timer immediately to avoid delays */
- scoped_guard(spinlock_irqsave, &chan->mbox->poll_hrt_lock)
- hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
- }
+static void mbox_kick_start_timer(struct mbox_chan *chan)
+{
+ /* kick start the timer immediately to avoid delays */
+ scoped_guard(spinlock_irqsave, &chan->mbox->poll_hrt_lock)
+ hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
}

static void tx_tick(struct mbox_chan *chan, int r)
{
+ bool sent = false;
void *mssg;

scoped_guard(spinlock_irqsave, &chan->lock) {
mssg = chan->active_req;
chan->active_req = NULL;
+
+ if (chan->msg_count) {
+ msg_submit(chan);
+ sent = true;
+ }
}

- /* Submit next message */
- msg_submit(chan);
+ if (sent && (chan->txdone_method & TXDONE_BY_POLL))
+ mbox_kick_start_timer(chan);

if (!mssg)
return;
@@ -243,18 +241,27 @@ EXPORT_SYMBOL_GPL(mbox_client_peek_data);
*/
int mbox_send_message(struct mbox_chan *chan, void *mssg)
{
+ bool sent = false;
int t;

if (!chan || !chan->cl)
return -EINVAL;

- t = add_to_rbuf(chan, mssg);
- if (t < 0) {
- dev_err(chan->mbox->dev, "Try increasing MBOX_TX_QUEUE_LEN\n");
- return t;
+ scoped_guard(spinlock_irqsave, &chan->lock) {
+ t = add_to_rbuf(chan, mssg);
+ if (t < 0) {
+ dev_err(chan->mbox->dev, "Try increasing MBOX_TX_QUEUE_LEN\n");
+ return t;
+ }
+
+ if (!chan->active_req) {
+ msg_submit(chan);
+ sent = true;
+ }
}

- msg_submit(chan);
+ if (sent && (chan->txdone_method & TXDONE_BY_POLL))
+ mbox_kick_start_timer(chan);

if (chan->cl->tx_block) {
unsigned long wait;

---
base-commit: a0bea9e39035edc56a994630e6048c8a191a99d8
change-id: 20250606-mbox-drop-reacquire-lock-14b7c5df65bd

Best regards,
--
Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675823-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 45CFF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:42:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 469AF3AC216
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:42:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 188C2289353;
Fri, 6 Jun 2025 13:42:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="gdM9hmqL";
dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ujZFEKGP"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 27143288CB2;
Fri, 6 Jun 2025 13:42:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217361; cv=fail; b=hCYgYZmMKoc4hVTz4sx5+Tv2JxRalMg+coKE+vXTkw+xdWDtFUj3jGbrxsMaT7BlTgBWvVSnsGYmrA79MQA7AHxYJL5VY3XmDLcqSSMqmtNv6PocT+ARYCG5/3mRZo4iWfUnq7mIJHKg/iDcgIqi+vq1oQ0e2vgGe9JkSSSjyZ0=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217361; c=relaxed/simple;
bh=ApA3niORv5NqgA+qW1GewKpafM0Rklu9TT0TjWoXWbU=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=B79ovBGw0JOiu0X4wHlSNCVdWtV1A/zC2VZx4FgoVuIAILTk2UJEsQ45hLZ2kdJM0HfTyQqPPoIKij8En2nd9C/97H1vALlw6uM7UDBYWejZI9qCBcJjUFLoyRGjpobo55mdt5t+FCpkLYTJxAtXfAqhMOALAiCk6exFMasMLp8=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=gdM9hmqL; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ujZFEKGP; arc=fail smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246632.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565NO5N012746;
Fri, 6 Jun 2025 13:41:58 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=
corp-2025-04-25; bh=ApA3niORv5NqgA+qW1GewKpafM0Rklu9TT0TjWoXWbU=; b=
gdM9hmqLBoB6IoEiGCKrf5BwrHc/yEdOZtEdVSJ6Nvs8msIWUuyTRKLRHwy59V5U
FMyFdaAvgbPgffdIJykAHgT3x4q3bJOsQBoVRH5VNtN27IL1SaWy636sBVXNLC4J
YEquyqsGZMCgkMocDq+n07rMZda13BsyjpxsK9cMBgqYwbADFGEYm+Ycxd8XKRYf
7SmyNOjUVfySLfQKPUI742NfUGDDIyVEkLvNf4TyAiw1AZZgfXeRszBG6v7J5mE+
YUpPiMu/7eK7OtKaQeWlWExlv22nZvDT/YGRX5kFhrsn2X5sL07f8l21sf4ZjVY8
MMRwXAc7AxRV+gKvK6EaDA==
Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8j82rw-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 13:41:57 +0000 (GMT)
Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556C8XHH033797;
Fri, 6 Jun 2025 13:41:57 GMT
Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04on2083.outbound.protection.outlook.com [40.107.100.83])
by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7d9qf3-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 13:41:57 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=JbphUMBQ+3HqvxD2Awb8nW6H8ApNRsZtX7DaXYquRN1pUSVgLQ2j2iCXyAE4Bm++A2DiDXNt9WN9EZi8Oej2LoLPeowNwvs6MHub18fHSD2Y++4jCC4xdMf/biEsOKkrw0IJ1cunn7vsdQAI2GgM72y3aejk8O3Bgli5IxMDOgU4N1pS0IHBO1iHHz5xw9KdYAOS38xvyWx741CzR9KessxMX8anCI82npf+WA/+bJP+JgtR0MfM3nciL4qvHrXO+eZ7prkrK1+14wrU3Kv1qcXuLUffvQs0UJVcXPvV9JEhvZUYuSSESnC/wLAN0YTG8bdcmgkKkCMHlDIgLSd2DA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=ApA3niORv5NqgA+qW1GewKpafM0Rklu9TT0TjWoXWbU=;
b=GcOAWTCUxiFql3H///0tkWvUUdQ3CTnB8TlvfIAQkJlAP/NJnszQuaCTxDpNXjama8FPwEcF19GK8sIS9nUB0CelOdKeX2AykCjd1kmniisrDAalxCbPa+s7ohSeAqASsZqUqhi5FeN1Bv2nLU3Od2DlAsIuDzYkbCYVlzdQUmMvdP3kDLDoLmDQsQc38/4y0J8HfgApJSoVp82bUyR5gVAC8clW6XslRprUsf7WpfZACqtgI0I5IJsimSWEe2zlyeb+b41Skr71rr5CAFHNGIhuasHaw7qNksfIr05cmn+jPXIuijseRq9qzblAGoAY2Aov66s/JDXYiRv97SKpvQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=ApA3niORv5NqgA+qW1GewKpafM0Rklu9TT0TjWoXWbU=;
b=ujZFEKGPekWtOxqJICn624ZONClMwZHocNhJlHl8fLjvE00DJl3hZ461FIVT5OVbch+VTcjR4NsZ8S6f0cChIf12HRIWVuaFRwn5vXIX9kg0Uw87K/yqA3JHZNzmf90P6WHiwbJt0i2TsppilOLnUDkzrchlsmk67LWSdi9B1/A=
Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16)
by PH7PR10MB6132.namprd10.prod.outlook.com (2603:10b6:510:1f4::11) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 13:41:53 +0000
Received: from DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com
([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.8813.022; Fri, 6 Jun 2025
13:41:53 +0000
Date: Fri, 6 Jun 2025 14:41:49 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
To: Jann Horn <jannh@xxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
Barry Song <baohua@xxxxxxxxxx>,
"Liam R . Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>,
Suren Baghdasaryan <surenb@xxxxxxxxxx>, Michal Hocko <mhocko@xxxxxxxx>,
Muchun Song <muchun.song@xxxxxxxxx>,
Oscar Salvador <osalvador@xxxxxxx>,
Huacai Chen <chenhuacai@xxxxxxxxxx>, WANG Xuerui <kernel@xxxxxxxxxx>,
Jonas Bonn <jonas@xxxxxxxxxxxx>,
Stefan Kristiansson <stefan.kristiansson@xxxxxxxxxxxxx>,
Stafford Horne <shorne@xxxxxxxxx>,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>,
Palmer Dabbelt <palmer@xxxxxxxxxxx>, Albert Ou <aou@xxxxxxxxxxxxxxxxx>,
Alexandre Ghiti <alex@xxxxxxxx>, loongarch@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-openrisc@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx
Subject: Re: [PATCH v2] mm/pagewalk: split walk_page_range_novma() into
kernel/user parts
Message-ID: <3664f529-cba0-4e9b-a434-356695c109db@lucifer.local>
References: <20250604141958.111300-1-lorenzo.stoakes@xxxxxxxxxx>
<CAG48ez3hvPbfc2dapQQu9TKrjdi5mhZ4tAWi+m0tNZeEtSZBrQ@xxxxxxxxxxxxxx>
<af6d28d0-d646-45d5-832c-66add20ea388@xxxxxxxxxx>
<CAG48ez3-QiaT1hSFz64xiucR4azQsrcj+6rQrLoz+d0zd-BUuQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAG48ez3-QiaT1hSFz64xiucR4azQsrcj+6rQrLoz+d0zd-BUuQ@xxxxxxxxxxxxxx>
X-ClientProxiedBy: LO3P123CA0030.GBRP123.PROD.OUTLOOK.COM
(2603:10a6:600:388::13) To DM4PR10MB8218.namprd10.prod.outlook.com
(2603:10b6:8:1cc::16)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|PH7PR10MB6132:EE_
X-MS-Office365-Filtering-Correlation-Id: 1cb47e8f-e018-4f5e-efe9-08dda4ffe56a
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?R3hJTFB0RGd0NkUyNnZxSFNHQ0VDSHFuYUR0dklxYklKLzFUYjN5anJuVEtp?=
=?utf-8?B?TUlSdFJKMTNSQ1JtSzZiWitremV0M3JLbjV3T3ZzRkovYVdiai9PT0djaW8x?=
=?utf-8?B?bGhyR3I5Z3ZzSGpwQlAzcTZ2S0IyVS9tVzVibnQzemhtWjZaMCtNOTNNODJa?=
=?utf-8?B?eEV2amtFUXN1UkNLVnE0RnhlQ05TUmF2MjZuTE9LbEJNaFlUeUkrakhDSi9n?=
=?utf-8?B?LzdoZTNXL1NIdmt1Sm1xTU9Td2IyR203amkwMmhLVnc2b3pvWngxS1gyVGpU?=
=?utf-8?B?NGFYaGpVcEdpbkd5czlGNDJMcHAwUFpubzgveE96a1MyZ3NMQzhRamlhUmpa?=
=?utf-8?B?Wk5KaWM1MmdvYWZSYmhRT24raU45SXR4SXVhdnpnRnEwd0QwL3FRRkpmTVB1?=
=?utf-8?B?NWZ4Unc4ZTVIb2VXWEVxTzA2NHdnWmo0SFdzaUlCeXcrUzVJNnYvOWErNzJx?=
=?utf-8?B?RXBoQ1BUZEU4aHl4NXhQeUxhMmxGREplUEovQ2ZqbkVnRHNScElNdnd2NHJG?=
=?utf-8?B?UE91aFdaVjFwMWx0ZWlLU2Y0UDdwM294L2tiODRmaXRnUVJLS0gxWDk0YTc1?=
=?utf-8?B?Uy9KbVhxRXY1TUZ3OVNORVF4S3hEdWJHeW1NYkZsY0tiamFaOWhGTElmWjZI?=
=?utf-8?B?eUtXenFSUEZSeHQ5QWtYUFBQNWZVZlNmOFBVYUdUSFV5N2xTVVBmZVJVL1dt?=
=?utf-8?B?V0ZtMGN3QUovMWVjd1ZKd3hKNTJ0NmUxQ09lYVliakxwdnNNY2YyNk00a2NP?=
=?utf-8?B?MjQyS2luOXZHUWNKWTlwT213UFNQbERsNlpFZEhzeDlnUk94bTJBQkxMTFJ1?=
=?utf-8?B?NUhIemJjNmFRNmc0SGFWVGtkYmNhaDVXazJFTFlOb1pzSlRSZ01EZXFwOW9a?=
=?utf-8?B?aUN2d3puLytVQXNyOElWTFZvV21XQUhsQkU0NTUzRkZ5YWNpZ1FsMUU2RkZo?=
=?utf-8?B?eCtLTWF6aGF6Wm5iQnB2ZWdWUllZakxnZXVGcHlBUmJCcjAyRjVPMTlaaDBn?=
=?utf-8?B?N3UyNm5qSEJzeGVXQ0kycFpUR1ZMRnltQXpBeEpEUVhpMkZ0TDdTRmpRMWoz?=
=?utf-8?B?UThWNngweVdiSVB1Rk5kU3FKRHh5OFAzTEw0dFM4bW44NVBHdlNYUGZkU1Aw?=
=?utf-8?B?WlZLSDROUHdYS1B0SXVxekdIaFpnbkVFTmJtbmwvaWFpRVFQWElsTHNkNXJ5?=
=?utf-8?B?V3FKYzl0Slp4dU1PRjNDWkNjcUl3Y2plVCtGUlFzK2tuczY2UVdCMEZNbDhq?=
=?utf-8?B?NTBSSS8rWkpOeTZXMGx2amhxUDB6My9uQytrdTVBNWNrWlUvUWIxMkEwOGVB?=
=?utf-8?B?MUFNNnBaaGNyS282bjJhNVJEbnFDR0p5Y3lMeG9BQzhqUUNRVTNNaEhWUWFI?=
=?utf-8?B?dEJNNTBkNnFDNWlwRFZEV0Jnb0l2QldCUjlxOWRBeUx1b3FNSU5qS2JmTXY5?=
=?utf-8?B?ZUdUR1BUT3FHN1duMjZMZjZVaVNHRE5yRW9HSmRzSnM3bWtaeERpM2R2TFNs?=
=?utf-8?B?WFBlZG9EdmVmdWQyc3lJUUxwVHlWeG9SckpnNUcxWWxvdlFINHIrSHFJUzZ6?=
=?utf-8?B?Z2JVZ0pCUUpTUzVuek16ZVgzODVOYWJlRG04TUpRQWx4SnowTjJvdEJQa2xI?=
=?utf-8?B?TU11b1l3RWswcE5OR1ZiT051UDRvSjZZMlJ1cVk5allqSE1FVEw3bWIyVmNH?=
=?utf-8?B?V05kZUtoTjlLR0VuYllyWG5oSUdDbVFINVhpYk1VeU9DcnR5SGh1ZzRaRm1V?=
=?utf-8?B?UzhxcGUwdnQvSHk4TnNMYWRva1hEbWJwazZTYmFaNDNCdFprYXJ5dzJNZDVa?=
=?utf-8?B?amtFM0x3OXBKdFFEazZmUWVZekxaR1lpN3IxeHl3MWI3aU0wV0gwVzVkdUJP?=
=?utf-8?B?UVg2UTVYdThhNXdIR1U5U3JLbncrYXJxVGlWbDFmWGxSc3BpeWdYNEtGc29u?=
=?utf-8?Q?vxdKMia2PCM=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?SmtoY1JaMVRocDVyQVV0WG5TUWVhVDNobWdBdVJUVTcwbEFiVWlFbmVOczN1?=
=?utf-8?B?RlFSeSs2ZUNiaytvbXJLZFZ1ejI3SGkwVWprUHJMcGZQVHVqWVFXL3JlM0ts?=
=?utf-8?B?VXJjaHBtOHdzVU95Y2RTMVZBclErQnF6YlNha0VwSmVSR3Y5am9VQnJIY2g2?=
=?utf-8?B?Z3BNdXR5VnFVZ0c4dTRlUTFNSzRVeHdMOUxac09ETnBqYmpKd3RIc0xvL1BC?=
=?utf-8?B?M2xoc2dpSlNIQU1YZG1SdlFGRVpxZ1VHckphTHp5Yi91YkY1L1NwZUl0b2xM?=
=?utf-8?B?dkltQTd4SkVUMUpHd3lDWmIrNEN5ZmU5Qmg3dW5yOHFDaUhkWkFNYnVpS1Bl?=
=?utf-8?B?RVp0NEpNV0ZuYVRWSUI1dytvQXgyZTRVRGlvQUVLN244cnlRa2FGK3h4cFph?=
=?utf-8?B?bEIySTFkclVuaERzUXplUjlzdGNOR1hUbVRYY0FOamRJQXorb1EybVY4K2RT?=
=?utf-8?B?eHdsSUVoeWtuT1hPczFwY3VvZXhBcWFPRVJ4aXgvdm8yVkJPbXVxQlVzYWUv?=
=?utf-8?B?N2JsSUdiM1hkRnJRSnNFMzN2OFRlVmhoZ3VsWEJ5bFAyT0RJYnAwdUlZUmIv?=
=?utf-8?B?UkVQUENFU09BWTVZTDRBREkzODBiVkl6S0oxbzJWeHd1OGlaaUNMQXFyV2V1?=
=?utf-8?B?TUhPZGptOVY4Q1N2N1kvc2lZRGVQRkkvTWdHblAvcXRpQmxYUlgrZ05odGlh?=
=?utf-8?B?T2djWFM1SklsRzBuaFk3US95TzYrL0JyS2dRd1VMYkVCSHdOR2cyaDNTMzR2?=
=?utf-8?B?OVQ0RUt6a0hla0ViVlF4dWM4NllGYTVuQ3ZoQWdIY1pVNzJ5cUtjSlpWbXkz?=
=?utf-8?B?YVU3OHI3cEgwT3pDSUdOYWZjMzlIcjVYZjJoWXVyUFpoamtDb2JYTzZZOEgv?=
=?utf-8?B?TVZJRFJMaDdmUkY2dnhweWI0T09SODFKY1FwWThIV2lvRnYrTS9UOWcvMjNx?=
=?utf-8?B?YTZ2cFJqbTZCNXRoaFlLMlZJOVBCUUliOEs4OG5xYzVBQ1pGQ0tzNmpCK0lU?=
=?utf-8?B?S05WMzVoQ0xHc0ZxeTh1QUxBY2xNWGt1NmU4eWFJdXJVSXM2Zm9sbWVYVmEw?=
=?utf-8?B?cWZKYnQ4NFNHNXFyYUtoeFAxSjI2MkxvWXBjcXB5N1ptaDlEdEYzbmJlaHho?=
=?utf-8?B?b2JwL3c5TDgxdVptbGxPRGpTWC8rdVpadTdFTnRBM3c2UFRsUkFBNDdvaStM?=
=?utf-8?B?NWxaeTNJQ2hJMXZkUXhvNy94ZXFhRDdRRkVDSDFnMkZCZEZ6cWt0T08wRHJw?=
=?utf-8?B?NWt6V1VUR2tFaGI2ZHdMQit6Y0Q3WjBIam1tR29Ja1hWR1ppZHJrTHpza2pM?=
=?utf-8?B?OXpPdXFQZTJ3TGdnMkdHeEtuV2dENzgvTG04b2RDNUh0UzRac05sd0R4L255?=
=?utf-8?B?TzA5cDlmTTRTMVljVjBTd3NTT25HeXVmaTl0MW5zZ0RDU2FWcVB1ZkQwbXlM?=
=?utf-8?B?SlNNdloxTERQVUg5RnpUdDMrUnJXdXdqL2ljdU12UkIxWS9tRmpmcTdnWWZP?=
=?utf-8?B?MmsvTWtsTHlsMjk3Zi81QVloNHZuZEpyZzlDdUIxRTZpb2hLZ0Nmb0IxNFRX?=
=?utf-8?B?TTNkUUtJQjRLaTF5azBxa3NpRXl5TmRqQ056Vnh4U3grTDJybkVmZU5wVVNk?=
=?utf-8?B?dEc5azdnbE1peEw1TzlSYndYcVdkckRaN25kb2RmSU9DU1VBcVlGbTNGRlNT?=
=?utf-8?B?Vjh3K0N5MHAyQkFITHRJUytGN1FHM0hIenc3U0JLcThVQmJSUjRiYTF0c3pn?=
=?utf-8?B?SWNINUhvUGl6WGo1RzN4QTdCOWhCblp2Z01IVmhQR2VKRzk0UEgzZTRuTHhi?=
=?utf-8?B?UW80WGFnTjhucjFBSjc0cUxWd28vcEtnSjcxYzJDWXU5WGpMNVFkbzJHUUZH?=
=?utf-8?B?NGtGcTVsQzMzQkdzTEN6WmpKNy9xb1Rrd25FS3V2TWpMR3RZR3pvL3k4bUJF?=
=?utf-8?B?QWZ5NG9GQkVWNS9jajlubCtKcUFTOGdTT2g3anREeCs0V3pHNmZiRmhTWHFN?=
=?utf-8?B?bXhBRlphMVVGOEJGSi93SU9FUUZ3ZHd2RXI0bjZpNW9maTg0WGpiK1l1ck12?=
=?utf-8?B?Ni8vRVRrRlRFOUpycnZLQUZGK3pFTWI0aXBnTVhpUVhQSTMyeVdJcHh1SmJt?=
=?utf-8?B?dFdNQ0Z1RVVoUmYyNzV1Q21NbGpYYVhmalFHNmpKRHJQdzgvbVVDRng0ek5y?=
=?utf-8?B?YUE9PQ==?=
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0:
TKHU7JlWd/tPXHWuRv+4fNSzlXEEW4E8/lXlYJIkm4wBLkb6da4/Ee1lHGpAlz8cI6GMBaaA5PyMRALQpDqXbFEd+pF8rVycASCWKIFzlvAbRMupcvpukAbBb2ZFKYuW9RCLXJb/bD/Z7RccRSkxWEBYchJ0ttmpBrJ8Syf8Ty/3Q6O8C5wVzbQlFq+MDhxcdqVsGOGUUzygQ1C5i7ItmYUlgdc31eH1Ppvw2eNBC/3zgDusuxozknEggNzKnGXpL5vKhiIf5EsZnWiHMaT9T8rrx011Ua4MuIskVt0F5FpPIZNuUmYe4KmBenxi/zF0ZW14T45BXEoPRry7oXt23ZwLQEtQ8efAd9kg0GnPuZ581Rf3mdHyvE01lh2o0PqAeflEz/eZP/Z8RGi19jEiLMZmooAnR0VNkt3pWa44MZuByPfCNP0LYyvzh00oEzZfZ6qTh7huF4TOjwv9qf7ACBx8GUqQ1AEMrHg0o0qIdNm2CWW/S2v96LCaxhufdX7tDOX39LFpu5S31kyCVI1y6hkd8Q9tDVFMS775d+IjzmIcmSHRnHvm0sPji4z0CySQmT38zp3ZLyfej07XS5XNO1kbFmhRKP/+wyzCFDugIWI=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 1cb47e8f-e018-4f5e-efe9-08dda4ffe56a
X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 13:41:53.0246
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 2oRqwLEJ49syUbPhQo7hU619PxMmym9hlBxDkfBn9SnUhXEnkKVtrRIY9BppLqN/r3eJ8DCVy5Jr7+/AjZUbzMhWZQMfwefNjZ6rp5AiZlQ=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6132
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-06_04,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 bulkscore=0
mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 adultscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060124
X-Proofpoint-GUID: -jFIZ8eEI2im3NM1Oprz65htIbhzq-dD
X-Proofpoint-ORIG-GUID: -jFIZ8eEI2im3NM1Oprz65htIbhzq-dD
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEyNCBTYWx0ZWRfX7s8xQqQDRqTe K7/euXT1ZmyMXRYpAixSo5WjoeKrUJTgWIky7IzSidc9EnMbfEpCIyppHc4B3ehzByP6SMr6AqF NMCOREH4MtW+gdLPQMVYzleIBgXsqJVd6fvhmJWqk2z0UN4xPLxVH4NxLssb+AvO9ibUHfR0vtn
e6gsacTLvuKjPoCNSpktgE04vvqm8vCRbk5wMRQqzkj9EULT6XQYPI093ETqq/DgPWyGlm4yQD4 JXKJxBD1d+brY2cDq2ocbsAWlQBJnwxj0k09BvD8+QbvSjwfRixtVcSR0ZusftJ7rvfFiec2y1c xpQrwXVvYuCkdYEZW1VZQYrQRMhQzFdh56BJa46fWsvLm+CLNxxHJd9HkaNyHxxn36B/Fzu9lJ/
3vYz6RNrUvsI+u9w0IAfss498E27x0EwXdS7dF6Gom3XADkxbXy0Dbxv43jReRquV7C6El39
X-Authority-Analysis: v=2.4 cv=QI1oRhLL c=1 sm=1 tr=0 ts=6842f026 b=1 cx=c_pps a=qoll8+KPOyaMroiJ2sR5sw==:117 a=qoll8+KPOyaMroiJ2sR5sw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19
a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=VwQbUJbxAAAA:8 a=20KFwNOVAAAA:8 a=yPCof4ZbAAAA:8 a=UjR7xggHdibGdW3K1PsA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=5XbyYV5GRZAA:10 cc=ntf
awl=host:13207
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 12:59:20PM +0200, Jann Horn wrote:
> On Thu, Jun 5, 2025 at 10:23â?¯PM David Hildenbrand <david@xxxxxxxxxx> wrote:
> > On 05.06.25 21:19, Jann Horn wrote:
> > > On Wed, Jun 4, 2025 at 4:21â?¯PM Lorenzo Stoakes
> > > <lorenzo.stoakes@xxxxxxxxxx> wrote:
> > >> The walk_page_range_novma() function is rather confusing - it supports two
> > >> modes, one used often, the other used only for debugging.
> > >>
> > >> The first mode is the common case of traversal of kernel page tables, which
> > >> is what nearly all callers use this for.
> > >>
> > >> Secondly it provides an unusual debugging interface that allows for the
> > >> traversal of page tables in a userland range of memory even for that memory
> > >> which is not described by a VMA.
> > >>
> > >> It is far from certain that such page tables should even exist, but perhaps
> > >> this is precisely why it is useful as a debugging mechanism.
> > >>
> > >> As a result, this is utilised by ptdump only. Historically, things were
> > >> reversed - ptdump was the only user, and other parts of the kernel evolved
> > >> to use the kernel page table walking here.
> > >
> > > Just for the record, copy-pasting my comment on v1 that was
> > > accidentally sent off-list:
> > > ```
> > > Sort of a tangential comment: I wonder if it would make sense to give
> > > ptdump a different page table walker that uses roughly the same safety
> > > contract as gup_fast() - turn off IRQs and then walk the page tables
> > > locklessly. We'd need basically no locking and no special cases
> > > (regarding userspace mappings at least), at the cost of having to
> > > write the walker code such that we periodically restart the walk from
> > > scratch and not being able to inspect referenced pages. (That might
> > > also be nicer for debugging, since it wouldn't block on locks...)
> > > ```
> >
> > I assume we don't have to dump more than pte values etc? So
> > pte_special() and friends are not relevant to get it right.
> >
> > GUP-fast depend on CONFIG_HAVE_GUP_FAST, not sure if that would be a
> > concern for now.
>
> Ah, good point, that's annoying... maaaybe we should just gate this
> entire feature on CONFIG_HAVE_GUP_FAST to make sure the userspace
> mappings are designed to be walkable in this way? It's in debugfs,
> which _theoretically_
> (https://docs.kernel.org/filesystems/debugfs.html) means there are no
> stability guarantees, and I think it is normally used on architectures
> that define CONFIG_HAVE_GUP_FAST...

Hm, it's a nice idea, but I wonder if it's worthwhile just for ptdump?

I really hate how we're just arbitrarily using init_mm.mmap_lock as a mutex
here though.

Could we GUP fast walkers here in general I wonder...? Or optionally maybe
for more general page table walking?

I mean of course gated on availability.

We sorely need a truly generalised page walker :) though of course it's a
matter of people having time :P


Return-Path: <linux-kernel+bounces-675824-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0456241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:48:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2504D16BE83
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:48:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D1D2288C29;
Fri, 6 Jun 2025 13:48:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UpRwy4zS"
Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF703284674
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:48:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217685; cv=none; b=BG3Hsv9ygDpdTzkT2j/D23jyxiyAAq9VfLXdZJGv/VFjkxBJsIMSE2trVxGi31Vi+gyM0UAGoF86i95LgAk7a1gfCTr0QVaudT+JSdpyLr7vgRykqGfvYYnAEELYb/pWWgC1UsDTLLCC0mtLYbm8ihfe1Vej0ZzCwQKSG9xPqZg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217685; c=relaxed/simple;
bh=z1CqVsJ1ckuC/WRsoWE2v886V0CEr2UctLIbqfChQGI=;
h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=sBQ++lnxiHE0kjs6xuzLxVP1s+1q/rON0Vmp6rkBUXJ9PwnC9ttwFdZMgMETbuno+pbwNYT2g/HLe2iM+2Y8IrfJss6kcB5s3J3KlcZaXna1hDStck884JHHaNS+zS1e8sVuU0ol2TkIsM94d+7TDp9AEOI8yHFSD99IWtqsNg8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UpRwy4zS; arc=none smtp.client-ip=209.85.210.177
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-742c5eb7d1cso2569050b3a.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:48:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749217683; x=1749822483; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=xg6qWBW9452a89D15vuiBGGJUNV9bhzosnI+08qf8bo=;
b=UpRwy4zSgSPwyvxsLLN8dudHy4rGpFLKywaqVQbxh8LqF0BdpfblvB90XKJr0OH8wi
Yq2t4HEOnL+Qlo/wJQ+pJRDegSdqhmxDm5Dj4HwudhE5CQgugpg0b2+quhBoBEvYQW3i
pb5gptSDJ3ETIBZkW50okzFjpuykWtpEw7CqKOhNDZVWc1MBzU38rKo+WkWmylPNc23J
15wVGBWAYJPAZGabBVribmorXTWi+HeSYDhVht4/OZfQHKBD/WJbiNkDsx0V3gIjluwk
UO4oP5WdZ5G1mRMmcpqf33tefY+5eFs+fp5HlkewGG0xAjLqSc5LuVVPyByh21mCgUJ4
iS2Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217683; x=1749822483;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=xg6qWBW9452a89D15vuiBGGJUNV9bhzosnI+08qf8bo=;
b=DDp5g9bepeTPV18W2c3OnfeRxSXln2iKBSC7l4CkXhRIuLaY3vTyEV3hF/pNqMAR6y
7wRgJ3t6D/PMku7Gi2EcXVjjUWhnYecuNXtk62IuGz6o6Q9MLWzZMf+ntUHeZR2mXaUh
tCFacCSnPSeEcZiGbRtAVXP0OgrH2yqri8EazLJhJuYHtWxAxwhk2DpV3guOldmaEYKZ
imTPpadlg8wTI/0kzjEMXJlQKz0OsdATeKOB8h+oTn0BSLZhzIRhG5l8cAa+bVuYRL0t
Hd5R3YHQrFQ83R7uYj3ZiXFv4CI9s2pCgzccTkvFfOq5ynqMWB7AedglV6rj3X7wea+5
2t+w==
X-Forwarded-Encrypted: i=1; AJvYcCWKDiWTd/v8900RhDlPgPUw2P8pEOVJSdZPBVYks4n0om2O7rUpl3etVGnBuVEMGjLV6v7vjcwgc/UPt3E=@vger.kernel.org
X-Gm-Message-State: AOJu0YwUjyhUUH6po5QWVmgHX6QYiwJ0RzROmgxkC3Q8QJgtIta/dxID
WAubRB81EucoONgVhiaMtHqDZynm1WxUldHQ9tn7TAz8k0jT3lDqh8pT
X-Gm-Gg: ASbGncvw2V5ceqTB+D+3Z4iucnIJCDzTb+OGkMLhO8rDKr8skGvOh/LYJbaBDFvXkfV
SHzvw0qqJCHzEMrR69bMs1BhmAGERH42T+FO6UqF8PB6H71Rrzph+Uw1yPr7JjE1Y22fnWPR/eK
s1YFpASPPuTh1zifbRM/R4TdEv2D7hUCuHeU2yBfglp0l2HzPu8mMGqHD92gWRpNC8vEnuyw71L
t/DbJpQ0kXs6NqG1Zr3MHBRW7YfihprURoxo6wiqT09vWgqjooRjRxhSv3KcZSRHZ8tQ2xFr8gp
Ddkx+YxmBq688E+SmCLomj/Ky9xmHKkAA7eCm8L0HsxAo+taZV3uNAGfIE5ybiEfIilWL0+M5In
MHTZMWw==
X-Google-Smtp-Source: AGHT+IGkvFTXTyoyFP5THpiFg7vz28z93vYZnhgXj37vty+QoUT/oX3Gk9XgnFYyH9xdaWnr72Cmkw==
X-Received: by 2002:a05:6a00:3cc8:b0:746:25d1:b711 with SMTP id d2e1a72fcca58-74827f159a3mr4536689b3a.17.1749217683105;
Fri, 06 Jun 2025 06:48:03 -0700 (PDT)
Received: from visitorckw-System-Product-Name.. ([140.113.216.168])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482b0c1168sm1296798b3a.136.2025.06.06.06.48.00
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:48:02 -0700 (PDT)
From: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
To: paul.walmsley@xxxxxxxxxx,
palmer@xxxxxxxxxxx,
aou@xxxxxxxxxxxxxxxxx,
alex@xxxxxxxx,
akpm@xxxxxxxxxxxxxxxxxxxx
Cc: linux-riscv@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
jserv@xxxxxxxxxxxxxxxx,
Kuan-Wei Chiu <visitorckw@xxxxxxxxx>,
Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Subject: [PATCH v3 0/3] Optimize GCD performance on RISC-V by selecting implementation at runtime
Date: Fri, 6 Jun 2025 21:47:55 +0800
Message-Id: <20250606134758.1308400-1-visitorckw@xxxxxxxxx>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The current implementation of gcd() selects between the binary GCD and
the odd-even GCD algorithm at compile time, depending on whether
CONFIG_CPU_NO_EFFICIENT_FFS is set. On platforms like RISC-V, however,
this compile-time decision can be misleading: even when the compiler
emits ctz instructions based on the assumption that they are efficient
(as is the case when CONFIG_RISCV_ISA_ZBB is enabled), the actual
hardware may lack support for the Zbb extension. In such cases, ffs()
falls back to a software implementation at runtime, making the binary
GCD algorithm significantly slower than the odd-even variant.

To address this, we introduce a static key to allow runtime selection
between the binary and odd-even GCD implementations. On RISC-V, the
kernel now checks for Zbb support during boot. If Zbb is unavailable,
the static key is disabled so that gcd() consistently uses the more
efficient odd-even algorithm in that scenario. Additionally, to further
reduce code size, we select CONFIG_CPU_NO_EFFICIENT_FFS automatically
when CONFIG_RISCV_ISA_ZBB is not enabled, avoiding compilation of the
unused binary GCD implementation entirely on systems where it would
never be executed.

This series ensures that the most efficient GCD algorithm is used in
practice and avoids compiling unnecessary code based on hardware
capabilities and kernel configuration.

Co-developed-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Signed-off-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>

---
This series has been tested on QEMU to verify that the correct GCD
implementation is used both with and without Zbb support.

v2 -> v3:
- Drop if (!a || !b) check in binary_gcd()
- Move DECLARE_STATIC_KEY_TRUE(efficient_ffs_key) to gcd.h
v1 -> v2:
- Use a static key to select the GCD implementation at runtime.

v2: https://lore.kernel.org/lkml/20250524155519.1142570-1-visitorckw@xxxxxxxxx/
v1: https://lore.kernel.org/lkml/20250217013708.1932496-1-visitorckw@xxxxxxxxx/

Kuan-Wei Chiu (3):
lib/math/gcd: Use static key to select implementation at runtime
riscv: Optimize gcd() code size when CONFIG_RISCV_ISA_ZBB is disabled
riscv: Optimize gcd() performance on RISC-V without Zbb extension

arch/riscv/Kconfig | 1 +
arch/riscv/kernel/setup.c | 5 +++++
include/linux/gcd.h | 3 +++
lib/math/gcd.c | 27 +++++++++++++++------------
4 files changed, 24 insertions(+), 12 deletions(-)

--
2.34.1



Return-Path: <linux-kernel+bounces-675825-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 581CE41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:48:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C57C51897D2F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:48:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D560F28937E;
Fri, 6 Jun 2025 13:48:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f9b0Og8N"
Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C48B28936C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:48:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217689; cv=none; b=hoxDya0Gp1cHYwW5qBOFsx8WnW6LR+MNsn7pSOIKUg9/9yPUarFJuHsbN/Ez6+oHwbXKSF6KmMvyzaMhaQUK3SLtD3FyftqtSmXeOQW/0saDpODUDErv5YEmYyoSwUdPQbSpQR3CjNaopuHpkFwqneulQJBtfbLhitM1Ensq2fg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217689; c=relaxed/simple;
bh=QAzuCIf6SmB3yJkUb6LPFPckwrq7uhWrHQG0HRpWI6c=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=KXoKSeYcMEMzYHPOVoVJAZqBSoq8rV4mBSJ3yKTzB8YXvw8yRHpniCqZj4qoU0iG0RGXpIGjDSv/LHiZBzuYiQUMWPmLhMGem7d03hv6oJxPDRfcH4FqTo19pS+N22iKHEXRCf1BDt0rD8iITqdwsieiPHD3xhMOnLdRyTLPCvA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f9b0Og8N; arc=none smtp.client-ip=209.85.210.178
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-742c46611b6so2732997b3a.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:48:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749217687; x=1749822487; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=lbLXfMia3LGx0x5vatzlSPOE+phQVH8WezZPhdpMpIw=;
b=f9b0Og8NfjbE7BHYXqYz5gm5MEaM1m1fR7BCfZF7P2WDq4W8dOP9iae2eu+VMI68zv
JaEG597oZpi5o5IjGl3c0BCVMAoCfHztWCvkIOBmuLtRSfrbB8kk+n78VdUe3HZNesYK
TMk8k+Z6Aot1uZ9fgBiqRcXyWkmu05OtiK/tcf3T8irWL/BVW41/S2nYyi5qeTg9cuRt
u+YCguXZ8YBVXl3VVNlftbiMX98OXT8aeKAfM3ZjL0Cy3xDIENSoo4MvtBRlourr7zoC
RT/4vuON03WC1+PgMGJXAikdeBftDtDE9DcUMac9O/Qc2EPfkBNP88ofRBAcPkYgMoHy
Tekg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217687; x=1749822487;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=lbLXfMia3LGx0x5vatzlSPOE+phQVH8WezZPhdpMpIw=;
b=MYKWiO6wPltM+dSxmuiK/qWAY1iadTpg7ftNjS03in+rtkmIqETWizqaYz1G/+CZkT
Y2jcQCo8Rg7pBkHfyDVPsCtRBicaDvYRyVcqsePXe/wNBdOW9vzf50GDlALRr5fInZek
DcpzaCzaPwi5pPz73ixKDJJ3OtKqY+o1lmsU1MddF8eUf5Xg1wuyLcQ38h12XWIUMDfj
a3y6nf/RyDj3XHO4Lah8z+rJ0CC4SKX+2ZNIU43tu8wZRR0w8lwYITQBncPJ8DCyRnws
LDQHVR5yiuwWndViaYBIqDCYCnbz7SfDXVtHvVs18HfnGd6HyXn7Ak5JZrQ0f97KmHbi
xYww==
X-Forwarded-Encrypted: i=1; AJvYcCUR9HtTsnNJ4cotUSA0Fie0Dl52O2zE4aS9aVc07FCvu9dpVlftpyUp/dEOx2Hh0B6WcRL8+hyFKDJrwi4=@vger.kernel.org
X-Gm-Message-State: AOJu0YwU5Q3ariCjaR3X5/s2fRwGGv1xOLcagF8r+Z9Zan/dCFVfGAy3
HHF1EQzNWJDEVCMTVg4Gd7XTJlWwD3x9oU95P9OEi0C0B1G+1Nbymo1Bupuq6w==
X-Gm-Gg: ASbGncujCZIBd6H11Ac6bLYnIlp9ex7CbLBVOYPp9l4Po1iifnj7bNSWCrIYmzUaYsd
atXP+PNu8ehWXf91mQABEdI3kZipJdDBiAGRGlBVk7uUwgx345Q+gnyUS3DQUsQBI479q61r7Q2
gTMaeY7E5lJtDW5qdgYLV+ZsgFhr3V260B3dHi4DnrCPSROZANGoKmCY9vPk5zPsr5laiUrY6Bo
De5cU3sseXMsJOtozQvDexufr5LOa3X4bSCN2EPvUHytYIECqsqeI4X5De24R2xjMtVYLu7bX3I
m3un6ycLYioXPLcT3ukY3GHRuAE1+bsOxJHjftGynZOaqT6vqS/pDihN4cgmzfy5tzjHC2SV6f9
Yh4O1eeOA1TPqFTB+
X-Google-Smtp-Source: AGHT+IEWQEWWMghu/cP6dwFr5jCrVGt0sZKMZoG/iTAmXCUcpXkPFPhjT4lzx4jV92YNz8SClJVpsg==
X-Received: by 2002:a05:6a00:4884:b0:748:3385:a4a with SMTP id d2e1a72fcca58-74833850decmr553711b3a.23.1749217686884;
Fri, 06 Jun 2025 06:48:06 -0700 (PDT)
Received: from visitorckw-System-Product-Name.. ([140.113.216.168])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482b0c1168sm1296798b3a.136.2025.06.06.06.48.04
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:48:06 -0700 (PDT)
From: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
To: paul.walmsley@xxxxxxxxxx,
palmer@xxxxxxxxxxx,
aou@xxxxxxxxxxxxxxxxx,
alex@xxxxxxxx,
akpm@xxxxxxxxxxxxxxxxxxxx
Cc: linux-riscv@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
jserv@xxxxxxxxxxxxxxxx,
Kuan-Wei Chiu <visitorckw@xxxxxxxxx>,
Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Subject: [PATCH v3 1/3] lib/math/gcd: Use static key to select implementation at runtime
Date: Fri, 6 Jun 2025 21:47:56 +0800
Message-Id: <20250606134758.1308400-2-visitorckw@xxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606134758.1308400-1-visitorckw@xxxxxxxxx>
References: <20250606134758.1308400-1-visitorckw@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On platforms like RISC-V, the compiler may generate hardware FFS
instructions even if the underlying CPU does not actually support them.
Currently, the GCD implementation is chosen at compile time based on
CONFIG_CPU_NO_EFFICIENT_FFS, which can result in suboptimal behavior on
such systems.

Introduce a static key, efficient_ffs_key, to enable runtime selection
between the binary GCD (using ffs) and the odd-even GCD implementation.
This allows the kernel to default to the faster binary GCD when FFS is
efficient, while retaining the ability to fall back when needed.

Co-developed-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Signed-off-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
---
include/linux/gcd.h | 3 +++
lib/math/gcd.c | 27 +++++++++++++++------------
2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/include/linux/gcd.h b/include/linux/gcd.h
index cb572677fd7f..616e81a7f7e3 100644
--- a/include/linux/gcd.h
+++ b/include/linux/gcd.h
@@ -3,6 +3,9 @@
#define _GCD_H

#include <linux/compiler.h>
+#include <linux/jump_label.h>
+
+DECLARE_STATIC_KEY_TRUE(efficient_ffs_key);

unsigned long gcd(unsigned long a, unsigned long b) __attribute_const__;

diff --git a/lib/math/gcd.c b/lib/math/gcd.c
index e3b042214d1b..62efca6787ae 100644
--- a/lib/math/gcd.c
+++ b/lib/math/gcd.c
@@ -11,22 +11,16 @@
* has decent hardware division.
*/

+DEFINE_STATIC_KEY_TRUE(efficient_ffs_key);
+
#if !defined(CONFIG_CPU_NO_EFFICIENT_FFS)

/* If __ffs is available, the even/odd algorithm benchmarks slower. */

-/**
- * gcd - calculate and return the greatest common divisor of 2 unsigned longs
- * @a: first value
- * @b: second value
- */
-unsigned long gcd(unsigned long a, unsigned long b)
+static unsigned long binary_gcd(unsigned long a, unsigned long b)
{
unsigned long r = a | b;

- if (!a || !b)
- return r;
-
b >>= __ffs(b);
if (b == 1)
return r & -r;
@@ -44,9 +38,15 @@ unsigned long gcd(unsigned long a, unsigned long b)
}
}

-#else
+#endif

/* If normalization is done by loops, the even/odd algorithm is a win. */
+
+/**
+ * gcd - calculate and return the greatest common divisor of 2 unsigned longs
+ * @a: first value
+ * @b: second value
+ */
unsigned long gcd(unsigned long a, unsigned long b)
{
unsigned long r = a | b;
@@ -54,6 +54,11 @@ unsigned long gcd(unsigned long a, unsigned long b)
if (!a || !b)
return r;

+#if !defined(CONFIG_CPU_NO_EFFICIENT_FFS)
+ if (static_branch_likely(&efficient_ffs_key))
+ return binary_gcd(a, b);
+#endif
+
/* Isolate lsbit of r */
r &= -r;

@@ -80,6 +85,4 @@ unsigned long gcd(unsigned long a, unsigned long b)
}
}

-#endif
-
EXPORT_SYMBOL_GPL(gcd);
--
2.34.1



Return-Path: <linux-kernel+bounces-675826-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3D0B341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:48:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2ADA83ADE74
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:48:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 22139289816;
Fri, 6 Jun 2025 13:48:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iXIEYfOZ"
Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F65028980E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:48:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217693; cv=none; b=m2yVdMf70Pa5Pr6LhwhurlWB32Y2tVK2HQfTwAe25Yyw0wUa3zPGQfZ8M4rblQWEik5rBfU/nhqv4Km+GBU9qXQLXgfbE+/S1E9/47HMFs5+oMwqW2zUd04rttOadNmk9raN6RfUHVtDpk+rrfRP+LEP5YY4jvvkt+wdqipYp4Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217693; c=relaxed/simple;
bh=NswgQ1t2swuHv8wddM8n4IMJSh/NdUsfmZylZ40IPmc=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=CtEfOb47lApaztWSb00by73umLnimoXykQwdzGP79sMBRlBIfpcNEO8hCgkgYVbJk+n+0bKpIAdzFzAKD5wOvONzJdH3+s0kK3E0rrvmr/KNecV455jfUzNYa9XS5b8EIcQ2KHk7FG6ar3lH/xf837uLf/01z44fnP1pJW/4r1w=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iXIEYfOZ; arc=none smtp.client-ip=209.85.210.180
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-747d59045a0so1488090b3a.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:48:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749217690; x=1749822490; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=1FT74bOydnUw1XVZ+DksJusFTfOc0V0/ESQZbybugO8=;
b=iXIEYfOZFUEcOjlv+C+Ku0pfdhwaX7desw0QMKnUygx+lVrQOhFauJVmZD9A0tzRiN
Dtw4yzQZFgg74DK9yIH1Ps8dxpfL+LlGvFKZJ3rJ4Zh66XQRj+XFl8ZO0NndIxyPWW4a
1X91Khoux0xQRk/wxxfb2XBDsV3faxI93ntEun/Bsd2J2c+gEqvMtgSb44dMb+J9wk/n
NM0YDkzMyF7GMjk4e7YW3q3kDsqot5zc/CZViYakiEoLRGw+EnZ6bzt3uqHqob/hkBpp
3m2qny7kN7CuDTccezx1Q6OutM7tVKKEswmewR2KnLtosyDp9LcRzJkuFHWVfGvBHfZI
4ByA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217690; x=1749822490;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=1FT74bOydnUw1XVZ+DksJusFTfOc0V0/ESQZbybugO8=;
b=hp7FaLtaJte23mzNXpFB9OsyP746UtVE+/nWYcsgz98OOiDD246hCPe1DOhDSKLYV3
Timua/Yfstv3y0rr5HX+zTr7OxBmh70mmOSLTQuoSGmtgOMmanyNEBRgPdPZXOmCeit8
WFuWmn7Sfd/P3Nj3DnIa5u5LE2WIx469ZVONTxDq9fqmul71ndQoTD4FSqaIvGovCuRP
gAUp6F7r8SoP3SnouG7SyjqXDtlDkCKBTBFXo1zjXS23d0AED4hE3t0lJSCZ6R74GNHS
1S5ADYzXHvqskfClhNOIBS+dilZOx7tbPN5jV60C2pjK+3wBu0AlkwVFitzy+7Hq43y9
xFNw==
X-Forwarded-Encrypted: i=1; AJvYcCXnB2S0BcmpiY5VGqLGrPayFyt8Hl4+9ZZN7Kck3xohgrGCtuvzKxFhg8CbEABc5SIXYnyoGAGUg5ZqOmg=@vger.kernel.org
X-Gm-Message-State: AOJu0YzR1J6OIQDypLETFS39TdoYa+j8Vlme1IJTuxYiDPjeOGkE+A1d
er3wCS4E+7WpUD/1eO0uU5jG2aZsHsXfXkGT3hBBlsdlzPSvADB/U5Pf
X-Gm-Gg: ASbGncscNQIAJYzi2b5tG4pO4SrWcwrSJrlsmcXX3H7ktajjiEnX8qLyxYLtkbkOKq0
gTtwVrMECPWsTtE/iR2tiiRItuLkZrWeVRKn76m6YAJX8F6PZSWId912+Y1c65CnwnMHPgN86me
uau/dWtC2QekpKiQSAmQPfh7Usi62Sjsa/Dbg2MQVuwmsM+fbpccOChYBRw7pHlQNG4am+MKW8x
TPeoVcXk2qt6l8brUe0+KJ11zBveER7R1yqN9UFczAVI+7+fqjO68sOcIGb8W9qbJ+Q0t1Q0MGt
MhyuqXvqDxXqZ6vI1nXfiF32baRhVL+bvYHo88OhR6Pzh+E3zsl05q6+iyP0tsNdib0svNLaiCU
oidzdHw==
X-Google-Smtp-Source: AGHT+IG3Kv6F9aF4jSJA62zhy/5qbGz+kSKhCfE+F4DJ3V6XCScYluGiO1lVGNxqP0lX0yuL5Q9aAg==
X-Received: by 2002:aa7:8891:0:b0:748:33ab:aa3b with SMTP id d2e1a72fcca58-74833abbae5mr823623b3a.4.1749217690203;
Fri, 06 Jun 2025 06:48:10 -0700 (PDT)
Received: from visitorckw-System-Product-Name.. ([140.113.216.168])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482b0c1168sm1296798b3a.136.2025.06.06.06.48.08
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:48:09 -0700 (PDT)
From: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
To: paul.walmsley@xxxxxxxxxx,
palmer@xxxxxxxxxxx,
aou@xxxxxxxxxxxxxxxxx,
alex@xxxxxxxx,
akpm@xxxxxxxxxxxxxxxxxxxx
Cc: linux-riscv@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
jserv@xxxxxxxxxxxxxxxx,
Kuan-Wei Chiu <visitorckw@xxxxxxxxx>,
Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Subject: [PATCH v3 2/3] riscv: Optimize gcd() code size when CONFIG_RISCV_ISA_ZBB is disabled
Date: Fri, 6 Jun 2025 21:47:57 +0800
Message-Id: <20250606134758.1308400-3-visitorckw@xxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606134758.1308400-1-visitorckw@xxxxxxxxx>
References: <20250606134758.1308400-1-visitorckw@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The binary GCD implementation depends on efficient ffs(), which on
RISC-V requires hardware support for the Zbb extension. When
CONFIG_RISCV_ISA_ZBB is not enabled, the kernel will never use binary
GCD, as runtime logic will always fall back to the odd-even
implementation.

To avoid compiling unused code and reduce code size, select
CONFIG_CPU_NO_EFFICIENT_FFS when CONFIG_RISCV_ISA_ZBB is not set.

$ ./scripts/bloat-o-meter ./lib/math/gcd.o.old ./lib/math/gcd.o.new
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-274 (-274)
Function old new delta
gcd 360 86 -274
Total: Before=384, After=110, chg -71.35%

Co-developed-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Signed-off-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
---
arch/riscv/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index bbec87b79309..f085adc6f573 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -95,6 +95,7 @@ config RISCV
select CLINT_TIMER if RISCV_M_MODE
select CLONE_BACKWARDS
select COMMON_CLK
+ select CPU_NO_EFFICIENT_FFS if !RISCV_ISA_ZBB
select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
select EDAC_SUPPORT
select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
--
2.34.1



Return-Path: <linux-kernel+bounces-675827-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CC79941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:48:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 24CD6171D84
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:48:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A70828982D;
Fri, 6 Jun 2025 13:48:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N3igN07b"
Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03803289812
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:48:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217695; cv=none; b=nuzOnc5uaCYvXwLhl6UbUr3a3KfMgzUNLGrtfzQGPrmB8mN1n5mHvk0+wwDjgr7ixiY2nmppVUgxNBMM4f0eaHUx6ZqrY1cO7qGM6uumsaIIWxNMjWUqwfmdVIkypqubp3FUHegnZLBx5wpKn1Cm1vLq0382YaQwqg6EF+c4hzE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217695; c=relaxed/simple;
bh=Oi3QsCzRxepRdbDtewkYUCbSzibLPqhb+4LK9MdIn8A=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=uATNzF0HLDAhlhav6vCOLiFTPEfO/EnhLZwcah/dPCpzNLMFvs1NfUa78BBNt/VczGoZuNF9LQkWojnMuFvlOz+3UnoSRXlXLMkMZbYCU02nFBhCGScSmyUiSCe6BjZsbo1f19TifHFVzZwSN63CW8mqi6trjahAf/EDD1b+Rh4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N3igN07b; arc=none smtp.client-ip=209.85.210.173
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-747ef5996edso1691231b3a.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:48:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749217693; x=1749822493; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=kU7d5eZEBEM5ZZef60sJsbo5aCH1yeHkH+fQHK1apWU=;
b=N3igN07bGz7zWS+KLAag224Vibq0NJVHO+piwILybxwjUYr3w91g7bU3gPeBtCOwgr
ecG9XayHLe9PnGSfR+QJ9Nw8wNx5SFYHOrGRj3W/j0M6RpWKO4YNgOnenFeyOY1fxEHf
siirvrQ0fxFjYLHLDPF+QTuxoNJ/eBdwyCV5Eq0AL++eYRQRi7jerx3r2YhPa9d7Mwao
oKeM5feU8n2rbs4DwbWiAJ1YTJVyPN8IsRhW+50RKx1iyO2hdQSvTEmGm8rxAOZb8BmY
kKKmoUjHYli41B9G/t54oENI+yTUoPWfXYpF2p+Do8ynnqvAk4gjGG3M0vUlb/tZ5nfS
4S9A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217693; x=1749822493;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=kU7d5eZEBEM5ZZef60sJsbo5aCH1yeHkH+fQHK1apWU=;
b=wn8JS4E4oShkV8YH+7sD39GnDADNfuzyThWXXa+2P038Kc9d4ETpl8Ivw6yhsjh6f/
4Q5iF4xbJQZ360nffIKRvTbN5+jhPD+9nPAlgqMoxI35c3h6vPqq7PweFADltpfzlC6+
oRPZpSdrn6L6uh2Glmk9qZNRWeJnkGwR01JRIPW0BLVBRkRrJ4z5O5uJVXiISnlepsT3
enCaEnznzQO08vlmH3188s2+8ZX68U5Ge9kLxosqvTps/NMIaduwrPOyYNXMOcfdCVOC
HNzidUJBP8ja3+pditp9KAwkt2XtIphxT14vXkETNCBG2qdWDRUMr9apBHL1hhqKj0wE
US+w==
X-Forwarded-Encrypted: i=1; AJvYcCV+yIhchS35YaqQW5Rd+mBIeTEYPuS03/BqkVsCrjp3yv8VvflZmetppPZqEljamvxNh1YlXRjzAMrEPeA=@vger.kernel.org
X-Gm-Message-State: AOJu0YwElvpb26Mktws1aZ65JEpAKlCbNumIjLerwlVgrDWhOkoEzZu/
xbkEoQnOUbD2xB04HItU/M2Oyjc+5p1jixuKWlvsYwzsdxFJPT1hwh3j
X-Gm-Gg: ASbGncsbgfwkG+tcD/PWskIqUO19/TqnpmA0W1BMgTjp6rrOded83IdUVJNr9qP1r2T
Hb6QDKi5Oeq38TLySjDOvc7e9rmizlWFQaZTb6h0BZx90h/ZkkSlbeETLvNj5T+e9kYwpND2TOh
afuV24l/8xSwU+fVPcB4IC/jir65uC5RgJ6dXOqT/CKlje5GxoWDNctfne1fzvqE6fV4zTu4BbN
eReOEzC5PNzanO6lzcJXh8cGlEt9ua3LQjUZ/nMXnlOMs3MeN5VHCHecwhFUVy7ZqkawmgO8K3c
IMfcQbWYcvXsqljU282GlPCju9xu2+QBhTWohYy/MHJZvcC37ZalSdPm0FgZwUkNvWjlX/wmIO1
aHcRQ/Ta7M9t6hgvF
X-Google-Smtp-Source: AGHT+IGDoK2JlG7KoYJ5vVkB4BKmEp/jqZJehdcJafNyJAIF9KFDbi3qeJO0gnBEIMGaNHfzjrn6Og==
X-Received: by 2002:a05:6a00:10d3:b0:736:51ab:7aed with SMTP id d2e1a72fcca58-748280aca00mr4408977b3a.16.1749217693258;
Fri, 06 Jun 2025 06:48:13 -0700 (PDT)
Received: from visitorckw-System-Product-Name.. ([140.113.216.168])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482b0c1168sm1296798b3a.136.2025.06.06.06.48.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:48:12 -0700 (PDT)
From: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
To: paul.walmsley@xxxxxxxxxx,
palmer@xxxxxxxxxxx,
aou@xxxxxxxxxxxxxxxxx,
alex@xxxxxxxx,
akpm@xxxxxxxxxxxxxxxxxxxx
Cc: linux-riscv@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
jserv@xxxxxxxxxxxxxxxx,
Kuan-Wei Chiu <visitorckw@xxxxxxxxx>,
Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Subject: [PATCH v3 3/3] riscv: Optimize gcd() performance on RISC-V without Zbb extension
Date: Fri, 6 Jun 2025 21:47:58 +0800
Message-Id: <20250606134758.1308400-4-visitorckw@xxxxxxxxx>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20250606134758.1308400-1-visitorckw@xxxxxxxxx>
References: <20250606134758.1308400-1-visitorckw@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The binary GCD implementation uses FFS (find first set), which benefits
from hardware support for the ctz instruction, provided by the Zbb
extension on RISC-V. Without Zbb, this results in slower
software-emulated behavior.

Previously, RISC-V always used the binary GCD, regardless of actual
hardware support. This patch improves runtime efficiency by disabling
the efficient_ffs_key static branch when Zbb is either not enabled in
the kernel (config) or not supported on the executing CPU. This selects
the odd-even GCD implementation, which is faster in the absence of
efficient FFS.

This change ensures the most suitable GCD algorithm is chosen
dynamically based on actual hardware capabilities.

Co-developed-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Signed-off-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>
Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
---
arch/riscv/kernel/setup.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index f7c9a1caa83e..785c7104fde7 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -21,6 +21,8 @@
#include <linux/efi.h>
#include <linux/crash_dump.h>
#include <linux/panic_notifier.h>
+#include <linux/jump_label.h>
+#include <linux/gcd.h>

#include <asm/acpi.h>
#include <asm/alternative.h>
@@ -361,6 +363,9 @@ void __init setup_arch(char **cmdline_p)

riscv_user_isa_enable();
riscv_spinlock_init();
+
+ if (!IS_ENABLED(CONFIG_RISCV_ISA_ZBB) || !riscv_isa_extension_available(NULL, ZBB))
+ static_branch_disable(&efficient_ffs_key);
}

bool arch_cpu_is_hotpluggable(int cpu)
--
2.34.1



Return-Path: <linux-kernel+bounces-675828-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0AEC741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:49:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 20410188B3E1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:49:37 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 54C70289364;
Fri, 6 Jun 2025 13:49:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hbG6q4zG"
Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35AA7288513
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:49:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217752; cv=none; b=PTrjra42Jx9bqixE9yBZZfkV7QSF2+5dCr6JqneGYIPRfrDHZ5PSMU6yxsxHNLInsuGDIBqX8mYpYYO/Q4b1g2KdHGcpcBa8GDwExq4CPVklUCSJdLVS5naV2TOZ/YR+fYN3ZEuK+iw68A/vOPiGn5OEJ9JU72uk02nnkz2xWZQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217752; c=relaxed/simple;
bh=eOrgybtFDd1McNbczIGE5aDNUmgzfN7eK5kKrNqNOWs=;
h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:
To:Cc:Content-Type; b=S1lUh4PLPzV/f8BbeADr8FDQy3KTZI0dVrM0WWzRB9rqZaVrhqJU9bv29cql4avhYKNfJWXJTrk33cKhvRsRkyZPUJHKI/vw9C4/e7VXm7kjHPXSKoiTddlMGsioLDzDEy0IcI/s0A7iIjfbfO5Vs4TSR4UcyCAFNuYC+R88AIQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hbG6q4zG; arc=none smtp.client-ip=209.85.210.202
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com
Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-747fa83d81dso1907678b3a.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:49:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749217750; x=1749822550; darn=vger.kernel.org;
h=cc:to:from:subject:message-id:references:mime-version:in-reply-to
:date:from:to:cc:subject:date:message-id:reply-to;
bh=hzNM8F6NiHQrZckFu72OcpGDXikxNc9SHjTtjEP9BA4=;
b=hbG6q4zGu72nlfjztjZI0YfG3LrK3U5rqr49NBzYKxHpYmX7Q/QgeuqdEZTGrfz3u8
0baJ7R3HdwfNb3zphZbuA8nrau8lSUvmdN8hzpCzMWFE+Z/P/sEbmdkKuOyIBCJva1Fl
r/uvOXlwy9kwa3Etd27BwSyw7z3kvV6VAaq2waeAk2jD960y09ESm5DBx5J3zlHtck/q
Gd7VY7RUmKLmtjDzCOsgchwUcJFNusuMcLgIHDxC9klwfp+Izptiue85HfwBr/rMjsuo
9wrE0hN1NWhrrC66vOyy0ePwQBl6Ab/jFarAjBS0r3CNFABPhSpwYIEl2ABD0v9c69HD
ZH0w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217750; x=1749822550;
h=cc:to:from:subject:message-id:references:mime-version:in-reply-to
:date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=hzNM8F6NiHQrZckFu72OcpGDXikxNc9SHjTtjEP9BA4=;
b=Dp5+VnelEi99BJmrtL9TDXoTy7U1+FZ7TsySSGTG6AjXnPNZdW+OYuQlb3PhFBxabi
UsSoxehbSUzAZwJieA8zQV5JupGt7x7dUq85/jANXVMlDGax4m8Y4DlvJjmB7/fUhwEv
U1bQEUOSVn9nKk7QBEpdyYsvMa6qTi41xTw5ySLTgt3PwsYHKO3Xe7MKLb21bBm3Y2b7
HzQRXFYb4Uq4biav8PrmWfgOwZiJ+pIrFCxtiyLnICT8/ZZUqsQTnI5dLK2oNdryG+1t
xu22bTSL4SNav2/3eW/5guIzy1NeMZ7NgKzo32DIOWpXfON0BXaI2Z13Sp/1AjnGpvI0
dykg==
X-Gm-Message-State: AOJu0Yz8tHTlGxpvTb9N0fFDa02klpNGo+oBVuDSD+rK750ffUDuB2lD
F03F5vxl6P0g79forx89eSs6G7optLmv/RfVt0s0OYY099zf/1Dc2ZqCid210LSuFDkSYiHu+Ej
0jPoKQQ==
X-Google-Smtp-Source: AGHT+IGvZHCQQyzNzpnMEJUc2ZlKMTphQYXkVqOMWSYOWdZh6uqcMIUnZOUB8iQqtYXwGJfi7xk18c0XRq8=
X-Received: from pfbgr12.prod.google.com ([2002:a05:6a00:4d0c:b0:746:31ae:c7f7])
(user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:4f8b:b0:742:8d52:62f1
with SMTP id d2e1a72fcca58-74827ff9ff0mr5353880b3a.8.1749217750454; Fri, 06
Jun 2025 06:49:10 -0700 (PDT)
Date: Fri, 6 Jun 2025 06:49:09 -0700
In-Reply-To: <aEIeBU72WBWnlZdZ@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
Mime-Version: 1.0
References: <20250401161106.790710-1-pbonzini@xxxxxxxxxx> <20250401161106.790710-8-pbonzini@xxxxxxxxxx>
<aEIeBU72WBWnlZdZ@xxxxxxxxxx>
Message-ID: <aELx1fPBfuyxTnJx@xxxxxxxxxx>
Subject: Re: [PATCH 07/29] KVM: do not use online_vcpus to test vCPU validity
From: Sean Christopherson <seanjc@xxxxxxxxxx>
To: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, roy.hopkins@xxxxxxxx,
thomas.lendacky@xxxxxxx, ashish.kalra@xxxxxxx, michael.roth@xxxxxxx,
jroedel@xxxxxxx, nsaenz@xxxxxxxxxx, anelkz@xxxxxxxxx,
James.Bottomley@xxxxxxxxxxxxxxxxxxxxx
Content-Type: text/plain; charset="us-ascii"
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025, Sean Christopherson wrote:
> On Tue, Apr 01, 2025, Paolo Bonzini wrote:
> > Different planes can initialize their vCPUs separately, therefore there is
> > no single online_vcpus value that can be used to test that a vCPU has
> > indeed been fully initialized.
> >
> > Use the shiny new plane field instead, initializing it to an invalid value
> > (-1) while the vCPU is visible in the xarray but may still disappear if
> > the creation fails.
>
> Checking vcpu->plane _in addition_ to online_cpus seems way safer than checking
> vcpu->plane _instead_ of online_cpus. Even if we end up checking only vcpu->plane,
> I think that should be a separate patch.

Alternatively, why not do the somewhat more obvious thing if making online_vcpus
per-plane?

Oh! Is it because vCPUs can be sparesly populated? E.g. give a 4-vCPU VM, plane1
could have vCPU0 and vCPU3, but not vCPU1 or or vCPU2?

That's implicitly captured in the docs, but we should very explicitly call that
out in the relevant changelogs (this one especially), so that the motivation for
using vcpu->plane to detect validity is captured. E.g. even if that detail were
explicitly stated in the docs, it would be easy to overlook when doing `git blame`
a few years from now.


Return-Path: <linux-kernel+bounces-675829-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3780F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:50:32 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 039673AFA33
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:50:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B8D46289378;
Fri, 6 Jun 2025 13:50:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qg8qAs4c"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D30B627F164;
Fri, 6 Jun 2025 13:50:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217820; cv=none; b=QQtzjQ8zXGNP9LGap2aNjKe7WLq9p2N153WgdVVoxtZFpihUJaEfTJzc795XSFbZW+oV8qTuRgcrM96G9I0pE/W9jsGF6AUKDJ44PR1Q2aSSnhFL8LyvU73ymoWIRm2NwZ8HIVXUV85+2Q09uH61ZDZPIMINdn1UcsNeEGPTuWU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217820; c=relaxed/simple;
bh=RvvYVQ5MhdaaL45STXuT2LS673L9xdDS8erLOZOlJak=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=OCQCAuzT3Gzhh43JJVGzAN+rXozCalfzCQ8TLf2gvkvQzVpoTTE987GpiRNywEHw9q9+2kktNB/5iW1k0J1xvRN7UWAjLHFawcpjmoQaGdupErKln6ossuQ7mDfS2VAGU14IqrMle3r/3OX2YgIV18PAl/F6ksTuh3aH0FIz8+A=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qg8qAs4c; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 891BFC4CEEB;
Fri, 6 Jun 2025 13:50:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749217818;
bh=RvvYVQ5MhdaaL45STXuT2LS673L9xdDS8erLOZOlJak=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=qg8qAs4cFm3Hc2vDwqoJE/iVCWx/sXCbl6qW/Ct7ghYNgpZ+MCRqm7TO/ZaR9xiy6
sdLmDjzNsE/SV1LfHEnyInyp+BGWeGCm1A5A5rilHuw2vPIOjMNWjxqEopWfkjeTg2
cZJBhBaeKxrKtzu083NGdQJqRMpT9AqqHxGjwYbk/I3hEUabFF38ULa7gzFdznxGZZ
DXXaFjgX8PONtmKWkDiqk6PLNQ8b+PaMmTychwDD6QifSfZd7RHSeJVjy7FvUXJrAa
aarsCmfZ0TItTxMnUrszsIOgBudVQlkv2P5GTlGYCCW7aI8L097iYunDDZ0HNDJCK8
0JyjtPnfKX6mQ==
Date: Fri, 6 Jun 2025 15:50:10 +0200
From: Danilo Krummrich <dakr@xxxxxxxxxx>
To: Igor Korotin <igor.korotin@xxxxxxxxx>
Cc: Miguel Ojeda <ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>,
"Rafael J . Wysocki" <rafael@xxxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
rust-for-linux@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-acpi@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?iso-8859-1?Q?Bj=F6rn?= Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>,
Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Len Brown <lenb@xxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>,
Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>,
Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>,
Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Subject: Re: [PATCH v2 3/5] rust: driver: Add ACPI id table support to
Adapter trait
Message-ID: <aELyEqg0GrkC8oZY@pollux>
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605162726.3659792-1-igor.korotin@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250605162726.3659792-1-igor.korotin@xxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 05:27:26PM +0100, Igor Korotin wrote:
> From: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
>
> Extend the `Adapter` trait to support ACPI device identification.
>
> This mirrors the existing Open Firmware (OF) support (`of_id_table`) and
> enables Rust drivers to match and retrieve ACPI-specific device data
> when `CONFIG_ACPI` is enabled.
>
> To avoid breaking compilation, a stub implementation of `acpi_id_table()`
> is added to the Platform adapter; the full implementation will be provided
> in a subsequent patch.
> ---
> rust/bindings/bindings_helper.h | 1 +
> rust/kernel/driver.rs | 58 ++++++++++++++++++++++++++++++---
> rust/kernel/platform.rs | 5 +++
> 3 files changed, 60 insertions(+), 4 deletions(-)
>
> diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
> index e0bcd130b494..d974fc6c141f 100644
> --- a/rust/bindings/bindings_helper.h
> +++ b/rust/bindings/bindings_helper.h
> @@ -6,6 +6,7 @@
> * Sorted alphabetically.
> */
>
> +#include <linux/acpi.h>
> #include <kunit/test.h>
> #include <linux/blk-mq.h>
> #include <linux/blk_types.h>
> diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs
> index ec9166cedfa7..d4098596188a 100644
> --- a/rust/kernel/driver.rs
> +++ b/rust/kernel/driver.rs
> @@ -6,7 +6,7 @@
> //! register using the [`Registration`] class.
>
> use crate::error::{Error, Result};
> -use crate::{device, of, str::CStr, try_pin_init, types::Opaque, ThisModule};
> +use crate::{device, of, acpi, str::CStr, try_pin_init, types::Opaque, ThisModule};
> use core::pin::Pin;
> use pin_init::{pin_data, pinned_drop, PinInit};
>
> @@ -141,6 +141,38 @@ pub trait Adapter {
> /// The type holding driver private data about each device id supported by the driver.
> type IdInfo: 'static;
>
> + /// The [`acpi::IdTable`] of the corresponding driver
> + fn acpi_id_table() -> Option<acpi::IdTable<Self::IdInfo>>;
> +
> + /// Returns the driver's private data from the matching entry in the [`acpi::IdTable`], if any.
> + ///
> + /// If this returns `None`, it means there is no match with an entry in the [`acpi::IdTable`].
> + #[cfg(CONFIG_ACPI)]
> + fn acpi_id_info(dev: &device::Device) -> Option<&'static Self::IdInfo> {
> + let table = Self::acpi_id_table()?;
> +
> + // SAFETY:
> + // - `table` has static lifetime, hence it's valid for read,
> + // - `dev` is guaranteed to be valid while it's alive, and so is `pdev.as_ref().as_raw()`.
> + let raw_id = unsafe { bindings::acpi_match_device(table.as_ptr(), dev.as_raw()) };
> +
> + if raw_id.is_null() {
> + None
> + } else {
> + // SAFETY: `DeviceId` is a `#[repr(transparent)` wrapper of `struct of_device_id` and
> + // does not add additional invariants, so it's safe to transmute.
> + let id = unsafe { &*raw_id.cast::<acpi::DeviceId>() };
> +
> + Some(table.info(<acpi::DeviceId as crate::device_id::RawDeviceId>::index(id)))
> + }
> + }
> +
> + #[cfg(not(CONFIG_ACPI))]
> + #[allow(missing_docs)]
> + fn acpi_id_info(_dev: &device::Device) -> Option<&'static Self::IdInfo> {
> + None
> + }
> +
> /// The [`of::IdTable`] of the corresponding driver.
> fn of_id_table() -> Option<of::IdTable<Self::IdInfo>>;
>
> @@ -178,9 +210,27 @@ fn of_id_info(_dev: &device::Device) -> Option<&'static Self::IdInfo> {
> /// If this returns `None`, it means that there is no match in any of the ID tables directly
> /// associated with a [`device::Device`].
> fn id_info(dev: &device::Device) -> Option<&'static Self::IdInfo> {
> - let id = Self::of_id_info(dev);
> - if id.is_some() {
> - return id;
> + // SAFETY: `id_info` is called from `Adapter::probe_callback` with a valid `dev` argument.
> + let fwnode = unsafe{ (*dev.as_raw()).fwnode};

There is an abstraction for FwNode on the list [1] that I plan to merge soon.
Generally, it would make sense to build on top of that.

However, I don't understand why we need this and the subsequent
is_acpi_device_node() and is_of_node() checks.

Instead, I think we can keep the existing code and just add the following.

let id = Self::acpi_id_info(dev);
if id.is_some() {
return id;
}

[1] https://lore.kernel.org/lkml/20250530192856.1177011-1-remo@xxxxxxxxxxx/

> +
> + // SAFETY: `bindings::is_acpi_device_node` checks `fwnode` before accessing `fwnode->ops`,
> + // and only compares it with the address of `acpi_device_fwnode_ops`.
> + if unsafe { bindings::is_acpi_device_node(fwnode) } {

As mentioned above, I think we don't need this check.

> + let id = Self::acpi_id_info(dev);
> +
> + if id.is_some() {
> + return id;
> + }
> + }
> +
> + // SAFETY: `bindings::is_of_node` checks `fwnode` before accessing `fwnode->ops`,
> + // and only compares it with the address of `of_fwnode_ops`.
> + if unsafe { bindings::is_of_node(fwnode) } {

Same here.

> + let id = Self::of_id_info(dev);
> +
> + if id.is_some() {
> + return id;
> + }
> }
>
> None
> diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs
> index fd4a494f30e8..3cc9fe6ccfcf 100644
> --- a/rust/kernel/platform.rs
> +++ b/rust/kernel/platform.rs
> @@ -5,6 +5,7 @@
> //! C header: [`include/linux/platform_device.h`](srctree/include/linux/platform_device.h)
>
> use crate::{
> + acpi,
> bindings, device, driver,
> error::{to_result, Result},
> of,
> @@ -95,6 +96,10 @@ impl<T: Driver + 'static> driver::Adapter for Adapter<T> {
> fn of_id_table() -> Option<of::IdTable<Self::IdInfo>> {
> T::OF_ID_TABLE
> }
> +
> + fn acpi_id_table() -> Option<acpi::IdTable<Self::IdInfo>> {
> + None
> + }
> }
>
> /// Declares a kernel module that exposes a single platform driver.
> --
> 2.43.0
>


Return-Path: <linux-kernel+bounces-675830-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DFB4741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:51:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2B92B1742FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:51:37 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EE3D128935D;
Fri, 6 Jun 2025 13:51:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g+XEJ6TL"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E7FE27F164
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:51:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217889; cv=none; b=hSxd+Mno5xzAYqUfM2mI9LaGSkr/qFm5Fj7OcY/GFUe954WAqjmGYzs++Z05OilR7qWgim/NBzebPT5G58ElUWgvjwHPfLvs5ztN9x+DvWQup9HfuLxyFrs/nL2+qqZoamzbHllFcCKQT31hHG3DZcFI8YF2xhv4AF0hTAzcaEg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217889; c=relaxed/simple;
bh=0EUhPJN/ej7dujrTSImae1IpfSVdM4lhwwyQXY3wRhg=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=MYE+OI3x9yfIxfAHjqnlsj25MrwKPo/AbUP3/aDWjlZSLoAgH/MTkX/X8XBAgD+5/DXQCSx8ATcIVDC+GxGnBfwqb4wbmhte29USWcFF8SHG+xviaLzJa/UCtMqFV45vMd8UkBScsIacrjjs1DaUheybDmGMpDY6nSQmZXInA7k=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g+XEJ6TL; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54388C4CEEB;
Fri, 6 Jun 2025 13:51:28 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749217888;
bh=0EUhPJN/ej7dujrTSImae1IpfSVdM4lhwwyQXY3wRhg=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=g+XEJ6TLd24xwY1scPWFxLNqHDO/czrYDZlcD/8CYc3S9WM9XHopq2GBGKozTqSi3
BvYlCkIOzj9oFBx3oJeeIwNWgzVfDKqVXtvNuOw/1KG9OAEZT2P11hu1XT4PYY1QoL
B//JwS60GfeCS10GehaNbHz1j91AofdBlN3bBpNikWHXnZF/EyGkGq5YQcENRGjjkT
Je1My1YqsKM6ma7T2DKgDNpXXE/rjusOydU7TF7aEvpPyh38wQKocG0LQeejaLtR7n
qitO0+dbSzI+VHuE4sVXhWX4X9L0BlvGFKoRCJESripKQ1nhmUHr/y/3HqOKh+SiGg
+QWNAOPwBa6SA==
From: Maxime Ripard <mripard@xxxxxxxxxx>
To: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
David Airlie <airlied@xxxxxxxxx>,
Simona Vetter <simona@xxxxxxxx>,
Andrzej Hajda <andrzej.hajda@xxxxxxxxx>,
Neil Armstrong <neil.armstrong@xxxxxxxxxx>,
Robert Foss <rfoss@xxxxxxxxxx>,
Laurent Pinchart <Laurent.pinchart@xxxxxxxxxxxxxxxx>,
Jonas Karlman <jonas@xxxxxxxxx>,
Jernej Skrabec <jernej.skrabec@xxxxxxxxx>,
Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>
Cc: Maxime Ripard <mripard@xxxxxxxxxx>,
Anusha Srivatsa <asrivats@xxxxxxxxxx>,
Paul Kocialkowski <paulk@xxxxxxxxxxx>,
Dmitry Baryshkov <lumag@xxxxxxxxxx>,
=?UTF-8?q?Herv=C3=A9=20Codina?= <herve.codina@xxxxxxxxxxx>,
Hui Pu <Hui.Pu@xxxxxxxxxxxxxxxx>,
Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxx>,
dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v9 0/3] drm/bridge: add kunit tests for devm_drm_bridge_alloc()
Date: Fri, 6 Jun 2025 15:51:24 +0200
Message-ID: <174921788251.1623225.5807110434824414840.b4-ty@xxxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250606-drm-bridge-alloc-doc-test-v9-0-b5bf7b43ed92@xxxxxxxxxxx>
References: <20250606-drm-bridge-alloc-doc-test-v9-0-b5bf7b43ed92@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 06 Jun 2025 10:41:18 +0200, Luca Ceresoli wrote:
> This small series adds a few kunit tests for the new DRM bridge allocation
> flow, based on the recently introduced devm_drm_bridge_alloc() [0].
>
> It is part of the work towards removal of bridges from a still existing DRM
> pipeline without use-after-free.
>
> The steps in the grand plan [1] are:
>
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime


Return-Path: <linux-kernel+bounces-675831-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 171C541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:51:58 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id DD85F3ABDBA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:51:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C6153289374;
Fri, 6 Jun 2025 13:51:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="bNUUVBqg"
Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2058.outbound.protection.outlook.com [40.107.236.58])
(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 DAD16289353;
Fri, 6 Jun 2025 13:51:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.58
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217906; cv=fail; b=c54alHFdFevbnVTK3xiZMPklx3pC8UfxT7vXRNktP9AND5T9lZDpWh3gUPYk2Ui2uVW5TnUehYw7HBOY+QTpHCajMnb9K8Pt66Wsd8Cz0PWordIos8ONmglUU7vy0309J/tblEzkItGPg9Tg9UP5L6WURkI2NDHOORDtXf3LlNM=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217906; c=relaxed/simple;
bh=K+LMfpcSHDSxdzRCgOhGsEHXIDiER1yOFin8F+AScKE=;
h=Message-ID:Date:Subject:To:References:From:In-Reply-To:
Content-Type:MIME-Version; b=qBJqgWdcxKGp6RhBCv0oHD8SX7NU1bSRxckldHb0dcFyDlz4jf6ZX6EfWxQbeX+sqSQrpLGNyZluMjWdFS1gi3px6y8Oab9r2phVsNRTutqciggEoA+yTxpKjG74Jn4hTDOEjbZBoUCaPeXZd/m09uOE+PMhgif9c3auGwcRQ9k=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=bNUUVBqg; arc=fail smtp.client-ip=40.107.236.58
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=DeN2PdKh3ul3w1ksgo2sqL9HcMcSPpGv/haGC1WI8EXMjQn4JO3lYeA73Mr+dfQ0z6nSrJFCe6x03knpfvCygAVxZKUI+XsFKM0vByyt513cdbGMBW2KzqkT0dYPJaeKtLuZm9BhsCK3SmhlDE3R/nf1pk60d+GkVvAxe88/8VodEHXny71FiE3gmfHfi+SlGES31LEAd4jHEt+3LApQI4XInjdNnUCsKj0IUImuhsQQmsf+bCMl7xDt5dsyY19btyTUSBSL+zziVr4SpUmKcc1Mnrt9hIb3OiV4xaDgVY17XoOBGPp/TioFhRa625rAQi5kaKw7UsRL0+/nWm9E6A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=l6F0mbkiQICMY3ysVesMWXnzk3+XRgvaUmICLsYgjho=;
b=hzh0StPHh1xea7sxyev3M4wNbW9QLVWh/qsYQVIxLiKozJDO0R/gpxKNKJ970nUM/KxqedFIVBQMtV4YXG+DBFHbwlIhUFjiDmdiagNT7THxLNJhwMislkfM8dzU/sw1LpFKLgtu4kRIMNT6LMqJM1HU7ZgRbLY/dFcWBYqq0so+OzHGo7QvTs9t3mUVA0bz9K1HwEjRxvGlXI1H+x0wQDd9LpxMqD80mAbeSejlnh0+6CrD21+pcjD5Kr1fFtKG20CBcePIB4y+i6vOM/3Sdtb7CvrBo/qYgZDiMGklP38iwtS5kkBfT9UNSmKdAQwtYgFLW5Llm0oEHsU15Fb72g==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass
header.d=amd.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=l6F0mbkiQICMY3ysVesMWXnzk3+XRgvaUmICLsYgjho=;
b=bNUUVBqgS8J2eU1FjmgelnzvBXVYJBJvgCusODJppo0m37oXh7G7j/tfvDdhLMcfmFaqoz2u48B7lblGBHdpuvSMQdNVqqrMgps4XlBhlO+sqap0hSb2xEdzikqCTYDUU5wdIDTrZlYpwOEwu44WbRuWtDEJjihrwgyVQ32Fap0=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=amd.com;
Received: from DS0PR12MB6390.namprd12.prod.outlook.com (2603:10b6:8:ce::7) by
SA1PR12MB8742.namprd12.prod.outlook.com (2603:10b6:806:373::6) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.8792.33; Fri, 6 Jun 2025 13:51:40 +0000
Received: from DS0PR12MB6390.namprd12.prod.outlook.com
([fe80::38ec:7496:1a35:599f]) by DS0PR12MB6390.namprd12.prod.outlook.com
([fe80::38ec:7496:1a35:599f%5]) with mapi id 15.20.8792.034; Fri, 6 Jun 2025
13:51:40 +0000
Message-ID: <d9971090-a609-4f7b-bbcc-2dd6aaf12bfe@xxxxxxx>
Date: Fri, 6 Jun 2025 08:51:36 -0500
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v9 16/16] CXL/PCI: Disable CXL protocol error interrupts
during CXL Port cleanup
To: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>,
PradeepVineshReddy.Kodamati@xxxxxxx, dave@xxxxxxxxxxxx,
jonathan.cameron@xxxxxxxxxx, dave.jiang@xxxxxxxxx,
alison.schofield@xxxxxxxxx, vishal.l.verma@xxxxxxxxx, ira.weiny@xxxxxxxxx,
dan.j.williams@xxxxxxxxx, bhelgaas@xxxxxxxxxx, bp@xxxxxxxxx,
ming.li@xxxxxxxxxxxx, shiju.jose@xxxxxxxxxx, dan.carpenter@xxxxxxxxxx,
Smita.KoralahalliChannabasappa@xxxxxxx, kobayashi.da-06@xxxxxxxxxxx,
yanfei.xu@xxxxxxxxx, rrichter@xxxxxxx, peterz@xxxxxxxxxxxxx, colyli@xxxxxxx,
uaisheng.ye@xxxxxxxxx, fabio.m.de.francesco@xxxxxxxxxxxxxxx,
ilpo.jarvinen@xxxxxxxxxxxxxxx, yazen.ghannam@xxxxxxx,
linux-cxl@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-pci@xxxxxxxxxxxxxxx
References: <20250603172239.159260-1-terry.bowman@xxxxxxx>
<20250603172239.159260-17-terry.bowman@xxxxxxx>
<a8d687e4-03d3-4d08-9149-757349704207@xxxxxxxxxxxxxxx>
Content-Language: en-US
From: "Bowman, Terry" <terry.bowman@xxxxxxx>
In-Reply-To: <a8d687e4-03d3-4d08-9149-757349704207@xxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: SA0PR11CA0205.namprd11.prod.outlook.com
(2603:10b6:806:1bc::30) To DS0PR12MB6390.namprd12.prod.outlook.com
(2603:10b6:8:ce::7)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS0PR12MB6390:EE_|SA1PR12MB8742:EE_
X-MS-Office365-Filtering-Correlation-Id: fa9acd47-8214-4bca-1925-08dda5014370
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|1800799024|376014|7416014|366016|7053199007|921020;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?clZHVUMyOGJtRlhGYjZrcmYzZjdBSlVmNFJEa2lZMkVydzB0RzZtcktveElN?=
=?utf-8?B?TlJUMjlPcGJId3FvMTdwR0I4R0dmSUI0WGY3RmpBb0V5TmY5MThuZ3o1RlVW?=
=?utf-8?B?OWtLNE1kSm1WdnJ6K1Y0eGgzZ3VoMDFyd2lmVkFYNkd6R1BIQ1ZtdHFOdnp1?=
=?utf-8?B?YlZReEhkWkxCUWJ5SWczRHdsdnlvS3N3M2Z0NnVZT0dGV1cvSk80cGVsZmh5?=
=?utf-8?B?VGJJbFBXa05WR09ZUUg0OVcwc0h1c0tZNVAwRThxbFJXU2s5bFlZNytsdHph?=
=?utf-8?B?dnQyMjlydUhBM2tNajFTN2JuK1VNb0NTelN4VTVCVnZBcmFrYzY5czdMMUl5?=
=?utf-8?B?RDArSzU5K1JwdWZKbUx6R2xFYXNLcjduWlVIamZ5bU1QZ09KWC9SYnpZdHY3?=
=?utf-8?B?elhmSHhYcmZ6TzhialVaODA4L0gzSUttbFlBczVONEhlWk9MTkxqaUpxa0dp?=
=?utf-8?B?OVUwY3FnN3djTDJCb0xINmZiak43a2diaTF3ZVhrVS96UUtCSzhiM0ltRnRB?=
=?utf-8?B?RDlPNlNQaEhHRjN0VXA1NjFYc2k2MlowQS9kempHRURTVXFXMjFCakxjWnNP?=
=?utf-8?B?TDRwdE1MYWJyalNERE5Idkdha2MyRVFzdU84NGlrRUtHTnNBZno5N2puYmFn?=
=?utf-8?B?clgwVGZtQ3hDVmZ0Rmt6RmQ2S3M0VXpteXBObkFVWHNONlAyaHZ4WVFJMzlO?=
=?utf-8?B?d0FkVGlLc3NBY2hoWkxDVHdWeVcxNjFheWtqRWZvOTRCV0Nxem12MFo4WWpw?=
=?utf-8?B?eFZtcVE5S2NLdEt0WVcwUWhGT1RIck44Ymh0RHBsVmF2ejJzSHZQTkE2c29T?=
=?utf-8?B?WTZYTmpMbDJrL212UDRzbkkzMUFsLzdOdVROZCtZZkxsRXo1Y2kybFY5N0Fv?=
=?utf-8?B?Q0lVKzE1aXU1YjdRRzZjdDFVdmR1cGhqaVhZRG04TjQzcUxSendHWG5Wd1p2?=
=?utf-8?B?WlQvK1hBVFU3SWp0NXNBbEg0b0ptUitmclU0MG5HNFN1eS9KWHNtYlcvRGFH?=
=?utf-8?B?T0JnR0I4NmF6bVBKV2Q2RkE3eEU0dFB2Q3BjWkMyUkZLWkJRcTJLZ0ZBckFH?=
=?utf-8?B?SW0wRTZVZG1WK2ovZ2dLUVRBNUI2SzFYa29aSXBsVHVFb2NsQTZmSW5BUEJI?=
=?utf-8?B?dFV1WnVPQkF3ZFRiUGVRVFo0RkZ2OHI0NDhpSmRhd2Q5WGIrVkNuQzlPNlhK?=
=?utf-8?B?VHpVQVNUR2UwNXNvYVQ4RWtybTVSMHlWaWovenprME5NdEJwL09sODNQREdX?=
=?utf-8?B?d2lGdlBDNGUxUkFaMElLUXNCV2RxVUtnM1NQQWFQTmRzckhjR1FWeDFTMS9H?=
=?utf-8?B?UGgwUUlHVEFXNjRKb0EvTXZUWGZTNFdJMVovMUMvdTlIWFpyYTNGWEV6dkRM?=
=?utf-8?B?R2FZV0JncjZEL2V6eGxMNEdDVzFIMkR6b1dMalM4QTlQNVhRdk5vRi9uWi9x?=
=?utf-8?B?WmVPQW5rcnc5ZitLWkUzRlpLckltck1HVWVJZFhiSG4xOHJ0Y25VQWZXVU1T?=
=?utf-8?B?aWEzTEJ5YmdGSkFleGZqYXAwRmhxWkNpMTdaQUJPVzhFa28rL1duWmx2dTFa?=
=?utf-8?B?STEyTzZzVUIzS1ZjOUhNRmlidUIvOG9FN3lvMzhYVzZEdEN2cU9JS2hhcDRX?=
=?utf-8?B?YmZaNDl1WXlaUFUvUGh0L3plTFVrWExDNjFZMUlwYU5HVFJDTS91UnBWellS?=
=?utf-8?B?MG9CMFJtaEtOUGlqOFRabW1FaXYvcEk2VHlxdmNEM2JiNTdBNThkcUZjVlVN?=
=?utf-8?B?bW91MDB0cHh2d1V4OHE4WFdRM0NDNlF6MUUxZWpCVTVUTitpNW9zSFZ6L0R3?=
=?utf-8?B?KzkvdGtlWjIwdHppUHN4MkdFVjQ5aEszWWxYaE5UTzlUY21WejdLdVFnZlJC?=
=?utf-8?B?Z3piS1Z3MHhIUEE5TVJTaFZsRHVydGFSN292Y1FPcUVBMU44cE5mUXN6eUt5?=
=?utf-8?B?ZGhiT2VqVmJ1OXBxQzhsUTRtRmtuL1J4azhzOGovVkhBRVM1SGsrMDlqMkpZ?=
=?utf-8?B?WUNPcmhpQ25nPT0=?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB6390.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016)(7053199007)(921020);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?Y2J5bnJ0TmNmRFVnRW1MSGRHbldGbllnWWJBQ1c2dHBWV1VETjdFM1gwYmha?=
=?utf-8?B?dzYxSkpxaER3YmtidURmMWRkeDY5WDZKSXdxbHZPTlR3OEtTbmNKZk0xYm5a?=
=?utf-8?B?bWJYZEJ5c2hxMkk2bTVPeEpiazRQNHJZOFdKZFdNbUNVTnNXUUNzZVFhQmFF?=
=?utf-8?B?M001eTBjamNmV1YzT0pQZjVpemRIdElmRHczWCtXRmxLRDVrNWhFTXNOd0ph?=
=?utf-8?B?MXJ5RkF4Zi9qV1NsZ2hJQmFTN0hUbVhBMlpOQnhaQWpVdy9wWnAzUW9BZHZD?=
=?utf-8?B?aGtmaGUwcjFUbzFrb1dZVjVyc3J4b00vbi8wRXY4ZFdIZmowaU03M0pRZ21y?=
=?utf-8?B?OUdwWi9QbCtWdFIxWFk4b3BwSXNhRWpoZzl2SFhrQklFWFdzZXN6Z3QrSERJ?=
=?utf-8?B?Smc1eWhQYWtCNlIwWFNJekxuQ1RjY1FuVk1UVVMzR2haN3dETWFxSVFBaEZv?=
=?utf-8?B?NnlDY28xU2dZRDlVMVRSdm9DNC9ORmdkMHVMOXgrTmRFSEtPdGNwbTVFeHFx?=
=?utf-8?B?RGNTTnRnQnJrOGltSHZBQmdCUVIwSDRPb0o3djY1VFA0SUJMdEowN1FtSHhN?=
=?utf-8?B?R0JZVGI1akY0eUVOeTE1Vi9SVWZNWlpuZXVjV3dSWWRpN3dRejNHclE2K2ZC?=
=?utf-8?B?UlJaaXVLUXBQUVJTbXUrQStSMXF3S1ZzZ0pYQ3hIcXUxQnpZT2Y1TFBiQXVO?=
=?utf-8?B?Z0Y2byt6SGFjUkFKbVJId1JvM1ZPMHgxaXN3ZDFSMU1mcCtLOHVlckhRZk8x?=
=?utf-8?B?YmFiemR1blNJdGpxL05lKzMwREFEbkk5dDdKbjk4UFlmaUxPbERuMVo2RmYx?=
=?utf-8?B?elo0UThmd25JWkNVOFNXcXlYTHE4VVJmOEhKOUpwTEZZWHNwQmZiRXhWOSs0?=
=?utf-8?B?OW14TGl5S0x0QXRacXlkVnR1elJyME5NeFFiSCtpOVZjcHA3MjlRT3dhQjM1?=
=?utf-8?B?QXlwYzFLMkF5R0NDNXZSM2NrSDk2bHFCd1g0cUFQM210YU55YndhL2Q2Slov?=
=?utf-8?B?czZkeVZIQmg0WWZra21PT1dDZENBNERJajhSZ3FjU3JlYTlYandSeTVJNkZZ?=
=?utf-8?B?VmQyTFZnN2FrQllSWm56eW44WGdyeHA4alFtNkZ3OVZKdHE2enBHVG1ZUTBG?=
=?utf-8?B?WEFXQUlZYTNqMUJqcjdBWVUxNnUycDFiaHhSUkJ0TXNFZHB4R1NLdDhqY1Zs?=
=?utf-8?B?UXpjK0V5OCtHVnRERU5iTTRNaXMrZWdIN25TeE9oTWJFLzhxeFk4T1FHZm5F?=
=?utf-8?B?UlFZdXpGdnVUUjlUOTV2SmJCbXFEN0Y2WFBXSjJYaEJRZFFRNzZBdmMrMXVS?=
=?utf-8?B?TlFUZ25PUlBPNjVZY1E3eVphL080OGRxaGFUa0FsOGNEam1pTTROSnJVL3A4?=
=?utf-8?B?Q1VEYmxrRnBCNmpQdXBOU3g1alFMU2VlOENlQ2drSzdGWnhia0Y5d0hvQW9C?=
=?utf-8?B?d0xxVzZHY21ONTFDMndYVjVBK0pJWlJ6c24rSmt3U3VRY2tzaTkyZTZJYTJW?=
=?utf-8?B?QUFpV0JBTW9pV2lUZVB4U3NCcHpHaG1UTklDYUdtRVFCWDIwV0lqdHo1U3lP?=
=?utf-8?B?OTJ0VGNUdGtJZklzZURqZGFaWkJTeDJGTFBVOUxQY0k1L0ZrZW9tMUc5NHVs?=
=?utf-8?B?dDFMbnloU3lnUkw2dHRwSkxubDhDZ2hGMngxYTUvM3ZtcUVwU0JuSGJ3NUw1?=
=?utf-8?B?SUZZS3NIMXZFZlB2SmVMbDYzaTJ1MlVkcHZmVEVCU3doSDFDNzF5T3RVVkkv?=
=?utf-8?B?a2xPbWlNaE5SelNSOE0zVlJwOXZwUVhSMXNhc3VOYm5RclVwN3FNdnFkaUdX?=
=?utf-8?B?Nm1lSzBscnlMcmVqS0lZaitBV0xpRWhyaGhLZFhxVk8ranJ0Sjlqc1cxSHVz?=
=?utf-8?B?TFVXZEN4eXl6ak5IL211clRIeFhRQks1RUF3amJWQ2JrWmlhQW5yRkhGVHlF?=
=?utf-8?B?d3F3emlPR0VxVms2Z01LbTFaWXNrQ3NzV1RRQXJDVlpTUVd2bmVNVithZzJ5?=
=?utf-8?B?bVQvbXRvQ2lSQ09RR3BRNnJIUW92azNYRXBOd2oyaFl1Ulc3em04L2hzSE54?=
=?utf-8?B?bnloOWRvV2hZRnVrMnlRU09tWDkyRUl3dEdRUjZEUWtkRFdnNStqQVlQeWRS?=
=?utf-8?Q?d5JOoxJm8C5ysSdVnLbIxxwQ0?=
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-Network-Message-Id: fa9acd47-8214-4bca-1925-08dda5014370
X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB6390.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 13:51:40.4198
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: X7wZeOV9uHCqqWJtpjQfxzjIhrprgYblPXI6Jzm/tJ2CGM3JftXlLystB9JsMetkZ+lIbQqHoaXS+uDBzG6qaQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8742
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/5/2025 7:52 PM, Sathyanarayanan Kuppuswamy wrote:
> On 6/3/25 10:22 AM, Terry Bowman wrote:
>> During CXL device cleanup the CXL PCIe Port device interrupts remain
>> enabled. This potentially allows unnecessary interrupt processing on
>> behalf of the CXL errors while the device is destroyed.
>>
>> Disable CXL protocol errors by setting the CXL devices' AER mask register.
>>
>> Introduce pci_aer_mask_internal_errors() similar to pci_aer_unmask_internal_errors().
>>
>> Introduce cxl_mask_prot_interrupts() to call pci_aer_mask_internal_errors().
>> Add calls to cxl_mask_prot_interrupts() within CXL Port teardown for CXL
>> Root Ports, CXL Downstream Switch Ports, CXL Upstream Switch Ports, and CXL
>> Endpoints. Follow the same "bottom-up" approach used during CXL Port
>> teardown.
>>
>> Implement cxl_mask_prot_interrupts() in a header file to avoid introducing
>> Kconfig ifdefs in cxl/core/port.c.
>>
>> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx>
>> ---
> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>

Kuppuswamy, thank you for the series patchset reviews and reviewed-by's. I

Regards,
Terry


>> drivers/cxl/core/port.c | 6 ++++++
>> drivers/cxl/cxl.h | 8 ++++++++
>> drivers/pci/pcie/aer.c | 21 +++++++++++++++++++++
>> include/linux/aer.h | 1 +
>> 4 files changed, 36 insertions(+)
>>
>> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
>> index 07b9bb0f601f..6aaaad002a7f 100644
>> --- a/drivers/cxl/core/port.c
>> +++ b/drivers/cxl/core/port.c
>> @@ -1433,6 +1433,9 @@ EXPORT_SYMBOL_NS_GPL(cxl_endpoint_autoremove, "CXL");
>> */
>> static void delete_switch_port(struct cxl_port *port)
>> {
>> + cxl_mask_prot_interrupts(port->uport_dev);
>> + cxl_mask_prot_interrupts(port->parent_dport->dport_dev);
>> +
>> devm_release_action(port->dev.parent, cxl_unlink_parent_dport, port);
>> devm_release_action(port->dev.parent, cxl_unlink_uport, port);
>> devm_release_action(port->dev.parent, unregister_port, port);
>> @@ -1446,6 +1449,7 @@ static void reap_dports(struct cxl_port *port)
>> device_lock_assert(&port->dev);
>>
>> xa_for_each(&port->dports, index, dport) {
>> + cxl_mask_prot_interrupts(dport->dport_dev);
>> devm_release_action(&port->dev, cxl_dport_unlink, dport);
>> devm_release_action(&port->dev, cxl_dport_remove, dport);
>> devm_kfree(&port->dev, dport);
>> @@ -1476,6 +1480,8 @@ static void cxl_detach_ep(void *data)
>> {
>> struct cxl_memdev *cxlmd = data;
>>
>> + cxl_mask_prot_interrupts(cxlmd->cxlds->dev);
>> +
>> for (int i = cxlmd->depth - 1; i >= 1; i--) {
>> struct cxl_port *port, *parent_port;
>> struct detach_ctx ctx = {
>> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
>> index 2c1c00466a25..2753db3d473e 100644
>> --- a/drivers/cxl/cxl.h
>> +++ b/drivers/cxl/cxl.h
>> @@ -12,6 +12,7 @@
>> #include <linux/node.h>
>> #include <linux/io.h>
>> #include <linux/pci.h>
>> +#include <linux/aer.h>
>>
>> extern const struct nvdimm_security_ops *cxl_security_ops;
>>
>> @@ -771,9 +772,16 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port,
>> #ifdef CONFIG_PCIEAER_CXL
>> void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport);
>> void cxl_dport_init_ras_reporting(struct cxl_dport *dport, struct device *host);
>> +static inline void cxl_mask_prot_interrupts(struct device *dev)
>> +{
>> + struct pci_dev *pdev __free(pci_dev_put) = pci_dev_get(to_pci_dev(dev));
>> +
>> + pci_aer_mask_internal_errors(pdev);
>> +}
>> #else
>> static inline void cxl_dport_init_ras_reporting(struct cxl_dport *dport,
>> struct device *host) { }
>> +static inline void cxl_mask_prot_interrupts(struct device *dev) { }
>> #endif
>>
>> struct cxl_decoder *to_cxl_decoder(struct device *dev);
>> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
>> index 2d202ad1453a..69230cf87d79 100644
>> --- a/drivers/pci/pcie/aer.c
>> +++ b/drivers/pci/pcie/aer.c
>> @@ -979,6 +979,27 @@ void pci_aer_unmask_internal_errors(struct pci_dev *dev)
>> }
>> EXPORT_SYMBOL_NS_GPL(pci_aer_unmask_internal_errors, "CXL");
>>
>> +/**
>> + * pci_aer_mask_internal_errors - mask internal errors
>> + * @dev: pointer to the pcie_dev data structure
>> + *
>> + * Masks internal errors in the Uncorrectable and Correctable Error
>> + * Mask registers.
>> + *
>> + * Note: AER must be enabled and supported by the device which must be
>> + * checked in advance, e.g. with pcie_aer_is_native().
>> + */
>> +void pci_aer_mask_internal_errors(struct pci_dev *dev)
>> +{
>> + int aer = dev->aer_cap;
>> +
>> + pci_clear_and_set_config_dword(dev, aer + PCI_ERR_UNCOR_MASK,
>> + 0, PCI_ERR_UNC_INTN);
>> + pci_clear_and_set_config_dword(dev, aer + PCI_ERR_COR_MASK,
>> + 0, PCI_ERR_COR_INTERNAL);
>> +}
>> +EXPORT_SYMBOL_NS_GPL(pci_aer_mask_internal_errors, "CXL");
>> +
>> static bool is_cxl_mem_dev(struct pci_dev *dev)
>> {
>> /*
>> diff --git a/include/linux/aer.h b/include/linux/aer.h
>> index 74600e75705f..41167ad3797a 100644
>> --- a/include/linux/aer.h
>> +++ b/include/linux/aer.h
>> @@ -108,5 +108,6 @@ int cper_severity_to_aer(int cper_severity);
>> void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
>> int severity, struct aer_capability_regs *aer_regs);
>> void pci_aer_unmask_internal_errors(struct pci_dev *dev);
>> +void pci_aer_mask_internal_errors(struct pci_dev *dev);
>> #endif //_AER_H_
>>



Return-Path: <linux-kernel+bounces-675832-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 24CA941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:52:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 1E107188F82D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:52:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5089F289809;
Fri, 6 Jun 2025 13:51:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZeKOrfe9"
Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A020289371
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:51:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217909; cv=none; b=soN965z828nEH/8HSfktzVH4nmKeUDvxo4us8mHdNb+Bn45sMpIUpwfCOQY14LPuprAHaV8Z0BZKMnnINJ9P3tfDhttqrlN8oGqHwVtXy2sL4FM3iTLfNUb7u0gbLZvoLlDw9/8tKoPZUtGwVDIeRljeZ00GmajYtRcp7RzRhCM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217909; c=relaxed/simple;
bh=1cXy0ycIoVFg/MhpMcFWn9S3JLlWV6ejpENRa6Q2LjM=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=UuK+AsedUgwYDxj2UiRvhZrK4AtnUPhSGBdYYes1b+k7cdGMxA4/qFBugvM4Dfzng4+sJB8wuGMiwvBQB5oSZNVDclEfZEcCp56OT1mX81y2wof47OYsuWKtO6GynA5zR3tB93ze6tIF3Th2dXVy0veYalLPRESR51gRbqfUK5o=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ZeKOrfe9; arc=none smtp.client-ip=209.85.208.44
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-60700a745e5so1106016a12.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 06:51:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749217906; x=1749822706; darn=vger.kernel.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=WWPSFukZBDHDG6pN288MbNxWFpqaNB01Y5FNmAhQ1fI=;
b=ZeKOrfe9WQHxD69vTnaqUfjtC2VAnbXwCwHRDA+cZkWgAbBs3DKwluDQRHoXfIy+U4
4JVP4THm/j6RbgXT/E6lZoi/IFVZFUQDoUtdZtO8dLYD8wAi8BDvdG7kTmWJXW1+PcO7
R9SkH8eYCnkgNHEyqzPDwzIFxErHA07ppUUvMkaHsMEwPPx5zuJEEQi4KaXhQa1E4ASS
2ek6EJSbM/uNjXUFwndp2nQPyVW5QWTO6uFHnfc27eXxf5yGv5h52yocwBVEVcQIxWL/
i3lCs2xtlVKYKr1QBmXS25TDcbnDCxe3Rne6SbbR3dkPsS72RPFI25u+LERmnbHN4f/5
6ing==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217906; x=1749822706;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=WWPSFukZBDHDG6pN288MbNxWFpqaNB01Y5FNmAhQ1fI=;
b=dPtiatO6fDJfGyyGVziC/a2aZRlyBYv7isf78FjAcJXRuU/R++andqH0o4zSZZgg8o
U/8Rw3w1FQCAxLpJIQbRPwrhF7IEBeLZXNrs962c8INpxiAc8UjkZewhQ1YLAnl6LMOU
0PXU7flmDFeL+BwtdbfkTaHeBUagLwFgPWCqOxw7NYvfjyA+NvuHFfMu8dlICZdWDrIL
DUvOv7alBpXA+eYnlinDBTzfk1R0Gyf1HfMCmoytcuNmjXx1fo7L2rcymHm5dKW8lXqK
nHqnGKn0uBYoUhImKwknewBmFk+NqUtF454Vv4TbmT/PSNTS8jVZmLeCwdQk6J6AAhaQ
Lr/w==
X-Forwarded-Encrypted: i=1; AJvYcCV38KuiFe6MeNjKgtU74ldLna+tYS2jT3AXLV5lYGveZka0Xxn1gxPB9pR++v6L6yzVtW8TIUj+xGNN+d0=@vger.kernel.org
X-Gm-Message-State: AOJu0YwQWoJKj7X/ZMpecyFZfDSfFlcqNd5BkKaPjCjuUC0oxPuICL9f
3iKbeg9/48s0tc4CtVHhqtm/XLP3w0sOHmYKgo63Dmyd8vzuNWrTv43ER5hfPyYXIOPHtSVdm29
kqgUUYHX0ZY5EIPCHC4XOX5OPkUi4ziqDUPVY0vUM3Q==
X-Gm-Gg: ASbGnctyuydyTWIOOVg4rxL9LFl36VXhFQeLxnSOWtaoLlygj7+gDWdVuviarb2jrJ1
7NBeXZbm3e6AGiMJId8CYPX3YxSJEsoZ7AMofa8REkYRZwBMTioB6gJ4BaXTcavQBMM9IPZKpD5
C+X3ZzDOqufiVfEwe9ww3ByF+GfRAQ5YaBKdfgZHcu3lCOLnMM6AKgQROUM1wsTIHwr6Qu8kmZ
X-Google-Smtp-Source: AGHT+IHX94roqFXROBXnIx9NhnT4WHs1dfm5kRkaVUWpbVA7IjPnQJNCvIuu9/hYbQzqnvhB5tF5GaD+bQPQk0biGIk=
X-Received: by 2002:a17:907:3f14:b0:ad8:8719:f6f3 with SMTP id
a640c23a62f3a-ade1a932e69mr291889366b.22.1749217905616; Fri, 06 Jun 2025
06:51:45 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250416035823.1846307-1-tim.c.chen@xxxxxxxxxxxxxxx>
In-Reply-To: <20250416035823.1846307-1-tim.c.chen@xxxxxxxxxxxxxxx>
From: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:51:34 +0200
X-Gm-Features: AX0GCFtQuZ3rgVRNeRNw_KLI4y7VY70dnK5LaR0i6JgbSOrS9GgzORh4iniXqSs
Message-ID: <CAKfTPtA7sLeddYsRU=uftcYt4RpEbWNHWx36tBDzGuPxu8oEmg@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] sched: Skip useless sched_balance_running acquisition if
load balance is not due
To: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>,
Chen Yu <yu.c.chen@xxxxxxxxx>, Doug Nelson <doug.nelson@xxxxxxxxx>,
Mohini Narkhede <mohini.narkhede@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, 16 Apr 2025 at 05:51, Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx> wrote:
>
> At load balance time, balance of last level cache domains and
> above needs to be serialized. The scheduler checks the atomic var
> sched_balance_running first and then see if time is due for a load
> balance. This is an expensive operation as multiple CPUs can attempt
> sched_balance_running acquisition at the same time.
>
> On a 2 socket Granite Rapid systems enabling sub-numa cluster and
> running OLTP workloads, 7.6% of cpu cycles are spent on cmpxchg of
> sched_balance_running. Most of the time, a balance attempt is aborted
> immediately after acquiring sched_balance_running as load balance time
> is not due.
>
> Instead, check balance due time first before acquiring
> sched_balance_running. This skips many useless acquisitions
> of sched_balance_running and knocks the 7.6% CPU overhead on
> sched_balance_domain() down to 0.05%. Throughput of the OLTP workload
> improved by 11%.
>
> Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
> Reported-by: Mohini Narkhede <mohini.narkhede@xxxxxxxxx>
> Tested-by: Mohini Narkhede <mohini.narkhede@xxxxxxxxx>

Reviewed-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>


> ---
> kernel/sched/fair.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index e43993a4e580..5e5f7a770b2f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -12220,13 +12220,13 @@ static void sched_balance_domains(struct rq *rq, enum cpu_idle_type idle)
>
> interval = get_sd_balance_interval(sd, busy);
>
> - need_serialize = sd->flags & SD_SERIALIZE;
> - if (need_serialize) {
> - if (atomic_cmpxchg_acquire(&sched_balance_running, 0, 1))
> - goto out;
> - }
> -
> if (time_after_eq(jiffies, sd->last_balance + interval)) {
> + need_serialize = sd->flags & SD_SERIALIZE;
> + if (need_serialize) {
> + if (atomic_cmpxchg_acquire(&sched_balance_running, 0, 1))
> + goto out;
> + }
> +
> if (sched_balance_rq(cpu, rq, sd, idle, &continue_balancing)) {
> /*
> * The LBF_DST_PINNED logic could have changed
> @@ -12238,9 +12238,9 @@ static void sched_balance_domains(struct rq *rq, enum cpu_idle_type idle)
> }
> sd->last_balance = jiffies;
> interval = get_sd_balance_interval(sd, busy);
> + if (need_serialize)
> + atomic_set_release(&sched_balance_running, 0);
> }
> - if (need_serialize)
> - atomic_set_release(&sched_balance_running, 0);
> out:
> if (time_after(next_balance, sd->last_balance + interval)) {
> next_balance = sd->last_balance + interval;
> --
> 2.32.0
>


Return-Path: <linux-kernel+bounces-675833-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 68A8141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:52:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B4B7C173F56
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:52:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 35876289838;
Fri, 6 Jun 2025 13:51:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y4by5+4S"
Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11D1328981B;
Fri, 6 Jun 2025 13:51:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749217912; cv=none; b=P1sfK6KgCE6Wj3w1FsgzhJqznbGc6qspEh3+VSaNX9/AprrL1ESv6onSlBXP+ffmH2Yh0HCokV9QxlbbdppA7M7vxPvH5yge14Y7/VGPEHgrfMXQuo+wpJfJaHU3I2bcr0MkJoMW0gsmzr6M4Hbfh2EQeO31DCtrms+8GRCEISI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749217912; c=relaxed/simple;
bh=IIrcHjOJF0WUmf3dP0J4tD5Xi1dZ+WzmtH3IV/CQrbY=;
h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:
Message-Id:References:To; b=E07AL849BQejg9mejPPsxMT6OsgXaEiZvcGybRhuxo6H5xCVChWReNt/F9VrkfYrQ8OBSCYrgqgDsXYY4ZdsTsBPo//U1gxG8Td3ACopK5cUSl7RfJkmJNkhYcXjLyroI0uBtC9n/iE2ftJ5YMrLsZHFIzTfO87XynpU9S/j9CA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y4by5+4S; arc=none smtp.client-ip=209.85.210.171
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-7482377b086so847443b3a.1;
Fri, 06 Jun 2025 06:51:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749217910; x=1749822710; darn=vger.kernel.org;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=IIrcHjOJF0WUmf3dP0J4tD5Xi1dZ+WzmtH3IV/CQrbY=;
b=Y4by5+4SqzjvREvK80VwpUn9C04PLcGI7p1SlVfvNn0DziG9WGqGhCSIbKFCSw4aNw
aQ1FzropuAZFXREBRQ57XfqeI2HL0Jco14cFs8mTLQ67klHXQ/M9C0mhjpfVyu5y16PA
ROrjMZa2MHNsvJ01uczrmyDZR0hnVnJWgqr2sEw7M0xhQFZfmPMKRsrmmx+r/4LF5sgf
ykO8Iqn8X/Gt9mTwYJPKjlmA0A6RihqC9YIT3Rct3wMYb4axv7jLe1z6y0vNP2McQSaz
hLp2qyIqPChJiaVy1EY+f5fuAeRYg7+JUshJoB+kz2GBYyLqR3z6XAW6Rq2V1cX6+9RZ
18yQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749217910; x=1749822710;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=IIrcHjOJF0WUmf3dP0J4tD5Xi1dZ+WzmtH3IV/CQrbY=;
b=Uw457F15KbEUEf81Afufv0KfaphMCYAbplpHD2lsIWd3nbH+FL5oNa/+DFjy1wjNLC
6RJltSUvy1X3wbHoo6cPXQO+Zak2NzwVsQ1tqUWHOQDep3HJXNVv1NPl2rumQVtD6Sow
C1S/aMZoAUDPnwRYbGtnWOQBaVOs2p1W4i1sH6nJIMjuQTL73Z4QIL1ZEFcFyk3mnF4X
fYrYvTzPzE24M6ZfN32w3gWAPT51q8ME4+AdxmX28mPwXVnHahV+nbYiAKZQWWpQ97WY
R3QZPIX2S/P13zFG9r14s3syHU5hjHOzvA9Sc0yqERsxqnE3D+CI9GADVrzaSPp8mDyS
sCCA==
X-Forwarded-Encrypted: i=1; AJvYcCUEKIaoX/wOFiqkNBLboHAdZNbtE8Iu+tMA5vNCqrmU+bXdfAV0M4yANTl7zPyNlapFc7M6yyQsOaRc68QB@xxxxxxxxxxxxxxx, AJvYcCVtdLx+AzUPpxfYiWd4DZZ3ZrUPHwlWYzIE4ccCaFnNJg0XktfxtJIVFrLBlVY7Xm9n7kwDwJcs@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yx5WXHDsXqepIFT6smOueg49hn94oU6ni97Uha6E0/w/8W3JmTQ
yWqbzuS/EblXtVT+EUp9MGthT1cSKnHMUfkZ5QYTfc/ySmOU3V0ZKLtK
X-Gm-Gg: ASbGnctIqylbLYIsIdb1lKC1Jdv72+TITtCiPR3KZMN/KZrk1bc43Vj+ZYAjcBm+Qxm
VesF9T7KxuF3zLBKM980EPNFVgALkUJV7gDCtFhqHAkUxO2dIvqNVtn3wEtq7AKfkh6/YntKuHi
U/n/oGg3sv1g6wZSPaLXvOkw8K8AdDvrCWn0S4OMQ0pFPx8yhPq5bQL2tq8mSLLFR0l14iGpwg4
I0Ly75p2uIvuzl0shx1lNaZHtTjXX51DqNMHQozNS+a+vj5I+39jZnWsq+4/44vmNOOIaZt/o9T
FO10MqQ9ShzwmpOe1DtuLDGDEtSS29gnQwJwp/ZB7UxNVYZgXMDdth13TpyUHUyraLERAuhx
X-Google-Smtp-Source: AGHT+IGhKffUcoovZoLmF4robbIk7xZYJEyrjgrjfdxA9yu1fAwpBy+RuF1KnZIN80fq3t/tsXzygw==
X-Received: by 2002:a05:6a21:e8c:b0:218:5954:128c with SMTP id adf61e73a8af0-21ee2532c61mr4608410637.21.1749217910233;
Fri, 06 Jun 2025 06:51:50 -0700 (PDT)
Received: from smtpclient.apple ([202.8.105.124])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482b084f60sm1315192b3a.101.2025.06.06.06.51.46
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Fri, 06 Jun 2025 06:51:49 -0700 (PDT)
Content-Type: text/plain;
charset=utf-8
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\))
Subject: Re: [PATCH v0] cgroup: Add lock guard support
From: Jemmy Wong <jemmywong512@xxxxxxxxx>
In-Reply-To: <fo5le4uonsrv24z5gikojq7hxwaqaidgco25pypnppk5h2czap@egdwx6yte4lf>
Date: Fri, 6 Jun 2025 21:51:34 +0800
Cc: Jemmy <jemmywong512@xxxxxxxxx>,
Tejun Heo <tj@xxxxxxxxxx>,
Johannes Weiner <hannes@xxxxxxxxxxx>,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
Alexei Starovoitov <ast@xxxxxxxxxx>,
Daniel Borkmann <daniel@xxxxxxxxxxxxx>,
Andrii Nakryiko <andrii@xxxxxxxxxx>,
Eduard Zingerman <eddyz87@xxxxxxxxx>,
Song Liu <song@xxxxxxxxxx>,
Yonghong Song <yonghong.song@xxxxxxxxx>,
John Fastabend <john.fastabend@xxxxxxxxx>,
KP Singh <kpsingh@xxxxxxxxxx>,
Stanislav Fomichev <sdf@xxxxxxxxxxx>,
Hao Luo <haoluo@xxxxxxxxxx>,
Jiri Olsa <jolsa@xxxxxxxxxx>,
cgroups@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Content-Transfer-Encoding: quoted-printable
Message-Id: <64D97068-D44C-4B29-9847-82F87A006D14@xxxxxxxxx>
References: <20250605211053.19200-1-jemmywong512@xxxxxxxxx>
<fo5le4uonsrv24z5gikojq7hxwaqaidgco25pypnppk5h2czap@egdwx6yte4lf>
To: =?utf-8?Q?Michal_Koutn=C3=BD?= <mkoutny@xxxxxxxx>
X-Mailer: Apple Mail (2.3826.600.51.1.1)
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Michal,

> On Jun 6, 2025, at 5:34=E2=80=AFPM, Michal Koutn=C3=BD =
<mkoutny@xxxxxxxx> wrote:
>=20
> Hello.
>=20
> On Fri, Jun 06, 2025 at 05:10:53AM +0800, Jemmy Wong =
<jemmywong512@xxxxxxxxx> wrote:
>> This change replaces manual lock acquisition and release with lock =
guards
>> to improve code robustness and reduce the risk of lock mismanagement.
>> No functional changes to the cgroup logic are introduced.
>=20
> I like this.
> Could you possible split it to individual commits to ease the review
> for: cgroup_mutex, css_set_lock, RCU and the rest?
>=20

Thanks for your support. I=E2=80=99ll split the patch into several =
parts.

> ...
>> --- a/include/linux/cgroup.h
>> +++ b/include/linux/cgroup.h
>> @@ -382,6 +382,10 @@ static inline void cgroup_put(struct cgroup =
*cgrp)
>>=20
>> extern struct mutex cgroup_mutex;
>>=20
>> +DEFINE_LOCK_GUARD_0(cgroup_mutex,
>> + mutex_lock(&cgroup_mutex),
>> + mutex_unlock(&cgroup_mutex))
>> +
>> static inline void cgroup_lock(void)
>> {
>> mutex_lock(&cgroup_mutex);
>> @@ -656,6 +660,9 @@ struct cgroup *cgroup_get_from_id(u64 id);
>> struct cgroup_subsys_state;
>> struct cgroup;
>>=20
>> +extern struct mutex cgroup_mutex;
>=20
> I assume this was because of the BPF code, which wouldn't be needed in
> the end.
>=20

Yeah, other modules also need cgroup_mutex, cgroup_lock/unlock must be =
retained.

> ...
>=20
> Thanks,
> Michal

Best,=20
Jemmy



Return-Path: <linux-kernel+bounces-675834-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 89E8841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:55:57 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id BAA801736C0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:55:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CF5D289373;
Fri, 6 Jun 2025 13:55:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="T5NhYSjd"
Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
(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 3F938288C23;
Fri, 6 Jun 2025 13:55:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218147; cv=none; b=OvygGauS/slV3QDhV37pSTzk55W3sktwT7wagLr0UcxaB1MLaqcBNyddko+NmjaFUW+PpQa7PKAf5aAZ5IPAHdrj3p3mLfEQG4KHJ5oZL1mcnNQ1TQ7oKkHfxfiq9ovnnIQLD+EQ158SPHK0qz+LF3/vI/4CATKBDfW5AU8aC5c=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218147; c=relaxed/simple;
bh=qKrYyKmHvECRvbUNso07tTqZkuOyB6ZTHzexI+wUNgU=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=L2z/ePelIQWk/4Ts/kzxwPFZoR9xUKsDyI6/OZqtImasU4vBo+1IVuUviJxmZvbUKmXoRakbPQpQOAn+sxC8WE0tZrrbD2RqcYHs12GroV6PA7x/BHs+8qFhSCc7TTzyLBR+RrrLcor3ugJSGJYnzhFIMi+WgzIB3js7E8RUFOE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=T5NhYSjd; arc=none smtp.client-ip=156.67.10.101
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch;
s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version:
References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject:
Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:
Content-ID:Content-Description:Content-Disposition:In-Reply-To:References;
bh=6dFmZYMvFnPKz7ElX5mkKo2Zv+TMRgVK23txlUfoVfY=; b=T5NhYSjd2nnhmPpsffbFUfP6uC
eAPdvN5/SN0+W8vn/INqTew/+ATLDf1rR3/RBPDbaRm6mjXIyOyP8HLGEvFR+3FQV+Vo9iFNGWN/h
QJmBgqQOEOoBeJ+/6okvzyJNd9Gu+bHs4IM1KDGCQ0ncCsGduFLMHl54xvqJ7OEgqzrM=;
Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
(envelope-from <andrew@xxxxxxx>)
id 1uNXXZ-00EuDg-89; Fri, 06 Jun 2025 15:55:25 +0200
Date: Fri, 6 Jun 2025 15:55:25 +0200
From: Andrew Lunn <andrew@xxxxxxx>
To: Bartlomiej Dziag <bartlomiejdziag@xxxxxxxxx>
Cc: Andrew Lunn <andrew+netdev@xxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>,
Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>,
Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>,
Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>,
Daniel Machon <daniel.machon@xxxxxxxxxxxxx>,
Wojciech Drewek <wojciech.drewek@xxxxxxxxx>,
Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>,
Alexis =?iso-8859-1?Q?Lothor=E9?= <alexis.lothore@xxxxxxxxxxx>,
netdev@xxxxxxxxxxxxxxx, linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] net: stmmac: Change the busy-wait loops timing
Message-ID: <9f5f87d6-c7c2-4288-8c02-e57b0d943881@xxxxxxx>
References: <20250606102100.12576-1-bartlomiejdziag@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606102100.12576-1-bartlomiejdziag@xxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 12:19:49PM +0200, Bartlomiej Dziag wrote:
> After writing a new value to the PTP_TAR or PTP_STSUR registers,
> the driver waits for the addend/adjust operations to complete.
> Sometimes, the first check operation fails, resulting in
> a 10 milliseconds busy-loop before performing the next check.
> Since updating the registers takes much less than 10 milliseconds,
> the kernel gets stuck unnecessarily. This may increase the CPU usage.
> Fix that with changing the busy-loop interval to 5 microseconds.
> The registers will be checked more often.
>
> Signed-off-by: Bartlomiej Dziag <bartlomiejdziag@xxxxxxxxx>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
> index e2840fa241f2..f8e1278a1837 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
> @@ -144,11 +144,11 @@ static int config_addend(void __iomem *ioaddr, u32 addend)
> writel(value, ioaddr + PTP_TCR);
>
> /* wait for present addend update to complete */
> - limit = 10;
> + limit = 10000;
> while (limit--) {
> if (!(readl(ioaddr + PTP_TCR) & PTP_TCR_TSADDREG))
> break;
> - mdelay(10);
> + udelay(5);

I would actually suggest rewriting this using the macros from iopoll.h.

Andrew

---
pw-bot: cr


Return-Path: <linux-kernel+bounces-675835-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7094441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:56:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5562E3A5F52
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:56:00 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ADF4328981D;
Fri, 6 Jun 2025 13:56:03 +0000 (UTC)
Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11])
(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 D4C1A289353;
Fri, 6 Jun 2025 13:56:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.11
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218163; cv=none; b=NrUYG/z2k0DiUhAsvscLKhpYunpGC9fOCUoNjBxObGZefApFsiVt2HzIAdWZYGHglmL+RCT5Ep+w/GpEZaIi6jFCS8IwcbQPwFkpfKfWHyW+n+IbpA+KkZf0hci7777/BGxZpEa7Fo7r4IBXDOnSrgI3iMUL3dx3Wb3X95PYk44=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218163; c=relaxed/simple;
bh=T+xV+4L5kYc18ASh5RZNYLy6c0+J111f8iQGQAuhVOM=;
h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type; b=apPhDatMOZbIzK7D9dTn8kt8+VjVAY2ElNEmOVeNyAi+MZsPADaTPjRHq/J5DbuOGbbX4vEwxjjDu/jhtDgZ65yqk2taEcjLgpGU4sgGlKhTzlJ1zf/Kzk65sffyqk/KlxeBqU2ZLgLBNsm22Xb3um4QoAi48yPNBrdz6C0UQNA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org; spf=pass smtp.mailfrom=goodmis.org; arc=none smtp.client-ip=216.40.44.11
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=goodmis.org
Received: from omf04.hostedemail.com (a10.router.float.18 [10.200.18.1])
by unirelay10.hostedemail.com (Postfix) with ESMTP id 9ADE0C03B6;
Fri, 6 Jun 2025 13:55:53 +0000 (UTC)
Received: from [HIDDEN] (Authenticated sender: rostedt@xxxxxxxxxxx) by omf04.hostedemail.com (Postfix) with ESMTPA id 908C82002B;
Fri, 6 Jun 2025 13:55:51 +0000 (UTC)
Date: Fri, 6 Jun 2025 09:57:12 -0400
From: Steven Rostedt <rostedt@xxxxxxxxxxx>
To: Bert Karwatzki <spasswolf@xxxxxx>
Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, linux-next@xxxxxxxxxxxxxxx,
bpf@xxxxxxxxxxxxxxx, linux-rt-users@xxxxxxxxxxxxxxx,
linux-rt-devel@xxxxxxxxxxxxxxx, Thomas Gleixner <tglx@xxxxxxxxxxxxx>,
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
Subject: Re: BUG: scheduling while atomic with PREEMPT_RT=y and bpf
selftests
Message-ID: <20250606095712.7287fa31@xxxxxxxxxxxxxxxxxx>
In-Reply-To: <b86bd98b23d1299981c4e95b593eb5a144fbf822.camel@xxxxxx>
References: <20250605091904.5853-1-spasswolf@xxxxxx>
<20250605084816.3e5d1af1@xxxxxxxxxxxxxxxxxx>
<b86bd98b23d1299981c4e95b593eb5a144fbf822.camel@xxxxxx>
X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Stat-Signature: gjpoyntgruu9ygjckensj914ib3c1f8u
X-Rspamd-Server: rspamout04
X-Rspamd-Queue-Id: 908C82002B
X-Session-Marker: 726F737465647440676F6F646D69732E6F7267
X-Session-ID: U2FsdGVkX18wYnWS6mag3f3tRHCDwUyD3HZnkmZJDHk=
X-HE-Tag: 1749218151-743164
X-HE-Meta: U2FsdGVkX1/TAoqV8oNEos9TrqNq41Y49RWqAr+8SwyGA/Uy8la/u8oAjQAmA5e4WoyryKetbdmbRDPXfaqTTnZnl25CcHILPiF0Q/7sQo2elCXM9IX4dQxLaE9HVOKlNpQFSOIUCe3vu+lLdwmPBCOffcKiaF7i7U8T12XpoK4Ujjue3e4UO74Szo3B2cRHZS5hzpRhdN4Kh6+KskN0XkuLgKwbb9t4h3SQngOkPgOHVw7jc6U8nHVPOIUHY+53Cvtxh8KHPHXQqsDYUk4cUrurNlTtCZcXoQqf0eavMvO6Nv3DAO+TbkN1sO9i1jGwDjo/IJDON0cfZ9P39tD8EZh52P/YkmUs3uopnfRu3sbH70V/3aR5Z1C3jqtfVQAhHujB6VdxESXZdQo/BnW0bQ==
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 06 Jun 2025 15:13:05 +0200
Bert Karwatzki <spasswolf@xxxxxx> wrote:

> I tried this and first thought my kernel did not have the right configura=
tion as
>=20
> # trace-cmd record -e preempt_disable -e preempt_enable
>=20
> seemed to do nothing in particular, but it turns out it takes a long time=
to start
> (~1min) when the kernel is compiled with CONFIG_LOCKDEP=3Dy. (on the stan=
dard debian

Yeah, that's a recent regression in the code which I'm currently testing a
fix for:

https://lore.kernel.org/linux-trace-kernel/20250605161701.35f7989a@ganda=
lf.local.home


> kernel starting to record takes less time, but it does not have CONFIG_PR=
EEMPT_TRACER.)
>=20
> So after the trace-cmd was running I ran the bpf example and got a trace.=
dat:
>=20
> # ls -lh trace.dat=20
> -rw-r--r-- 1 root root 152M 6. Jun 14:41 trace.dat
>=20
> turning this into a report with
>=20
> # trace-cmd report > preemp_trace.rep
>=20
> gives a rather unwieldly large file

Of course, it's recording every time preemption is enabled and disabled ;-)

I usually run it with a test:

# trace-cmd record -e preempt_disable -e preempt_enable ./myprog

Where it will stop when ./myprog is done.

>=20
> # ls -lh preempt_trace.rep=20
> -rw-rw-r-- 1 root root 7,4G 6. Jun 14:46 preempt_trace.rep
>=20
> This file has about 61 million lines
>=20
> # wc -l preempt_trace.rep
> 61627360 preempt_trace.rep
>=20
> but only 742104 corresponding to the bpf example program "test_progs"
>=20
> # grep test_progs preempt_trace.rep | wc -l
> 742104

# trace-cmd record -e preempt_disable -e preempt_enable -F ./test_progs

where "-F" means "follow" and will only record when "./test_progs" is runni=
ng.
Add "-c" to also trace its children.

>=20
> Is it possible to filter the preempt_{en,dis}able events by task name (i.=
e.
> get_current()->comm)?
>=20
> I tried this (from=C2=A0https://code.tools/man/1/trace-cmd-report/) but it
> fails with an error message:
> # trace-cmd record -e preempt_enable -F '.*:COMM =3D=3D "test_progs"' -e =
preempt_disable -F '.*:COMM =3D=3D "test_progs"'

-F means to execute. The -F in trace-cmd report is filter (that's because
-f was already taken :-p)

-- Steve

>=20
> ********************
> Unable to exec .*:COMM =3D=3D "test_progs"
> ********************
> trace-cmd: No such file or directory
> Failed to exec .*:COMM =3D=3D "test_progs"
> libtracecmd: No such file or directory
> can not stat 'trace.dat.cpu0'
>=20
>=20
> Bert Karwatzki



Return-Path: <linux-kernel+bounces-675836-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A41E541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:56:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 359521891678
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:56:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 93837289806;
Fri, 6 Jun 2025 13:56:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GJrGDiwm"
Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C46EE288509;
Fri, 6 Jun 2025 13:56:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218175; cv=none; b=aKEFGMtmFXm/9qGYyLhXwsWYCyGlLl3c4qCz5f4Zv298wW2W+q9f/Ek5mLi9s79DfjkpDjwdHkhXrC59wKSXGpR2Z5u2LZ8syyyUXKSJqwroes6Bxd+AiyvSk9sC1xiQBEUkpEBQhrKyPKIdHBFRBbaVnpKoWJZvaGACZvYYe1s=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218175; c=relaxed/simple;
bh=qN+pnPVxT4gL2Vpc8rdlce79GZAw4gPEct3l5HddHvM=;
h=From:Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:To:
References:In-Reply-To; b=cPAmAe4ipbr2rN2UOIdHdzml649/yybLKd7x3Dtpx+RgFO0Kl9YJPvTXcrYFf43p+xgQJp0/CLliIjUBl8K16gZmxAsdmemlvQ2g54CniNO96ud+ejyip4FWCJCLp5C8P8qcY7zx2lqd34scxoojFehxp1swuf7nlZtXUbbev0Q=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GJrGDiwm; arc=none smtp.client-ip=209.85.221.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3a522224582so1316835f8f.3;
Fri, 06 Jun 2025 06:56:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749218172; x=1749822972; darn=vger.kernel.org;
h=in-reply-to:references:to:subject:cc:message-id:date
:content-transfer-encoding:mime-version:from:from:to:cc:subject:date
:message-id:reply-to;
bh=D02VVevmOF3cQxFCCzf3uOD2IZ0DFegRFrqZJe6cxu4=;
b=GJrGDiwmI/jJFLi2Vx6vPmO6jV9AYnGaSS/6u7GiWShRmEd7quD1EjVbieAg7cM91J
p25iNtOeYZpdyOEP7PuDdxtLQ5C0f4nTb++qZInWzo9gvYTtuxiK+cGlP78GFMHXdsi2
gnmZsw6jk6UeaI6kCd9PEUPyxBFJVhg//QoD9t1mTYo7NWcpI3/NPtuvfh2MaQO11sp8
KeAK7PyeFo7dr5J0Xf5ZNpEsT4swbL+DoAfuSr0lJJ3IWd81EgQS9MNWOYGRfIZfkVf1
z4ob/PZnnVBI6cYo79emGsrEnjRqI5pmVQ1FwYow5pX78gK9hy4npLz4EhvyMOeL2DkV
WBAA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218172; x=1749822972;
h=in-reply-to:references:to:subject:cc:message-id:date
:content-transfer-encoding:mime-version:from:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to;
bh=D02VVevmOF3cQxFCCzf3uOD2IZ0DFegRFrqZJe6cxu4=;
b=TprQoFvNgfcOAfaGyvuF1isCAryoegyUieIuvypfovCECuebTkzIeEcADhSg3SqP3T
N4X5b7ZtI8RVXCDtCERus/Om2AOqpHPX830phHrVz4S+qIr6ye+SJs84rzvy4tRzgEr/
0iUOq3bLDl7ZDgJPqB04AkfMofXyWiHoqTe35BfyJA/Y9SJ2p1KCLQa2WFszzkbAjSCx
prjM3qsLyhV7TR/oiR5I6JEYzqPBSiSSw/4eNEqu2WEhtj1vid5IfbcnTCXHkqyDXrj7
1c5jTbrUC90kRZYRqHFJkCj8tJ8gWxQmBwSQjQFjeGjHuKobu3klILcA/0vRh6n/iQpZ
JCgA==
X-Forwarded-Encrypted: i=1; AJvYcCUkJQY1iYGIZUkP/43Mv1+48NWo2hlZGRzZqQgT2pe3Q65xh4MeEeasY+uPDIuDRD4C9kIylo155+OrhJw=@vger.kernel.org, AJvYcCV90iGaHxEplrLu74mQoIqvQBCH/foM6MXRORVUEL6JGmc+tly4S+RVuV1nKWkwDGUH1vjGenuL5bxiRoc=@vger.kernel.org
X-Gm-Message-State: AOJu0Yx0vTgM4JWvqUCYgkOczAo+PDp7VhLibbsmdrcncken7/K2xOS3
lJPi1FHPDA0kWtkGtDnBRXSw3Q8pk85oV4XRY/P1gron9rg6FCSbTlni
X-Gm-Gg: ASbGncsdetz/lsCbb5Q33l0zq4OzJn8T4TvkhVMZur6JFEHkd9jxNncpzAjN3VQkrNV
adfG/j798kp6mO5XlPoQbsNik3iwkLWDKoVXGEAR0Ed11QnOiqF9vfAx6BBkFNjmoOftujIxwx4
rf24v/NblmohDgV6TZcIF8p5gzK6/BmmemObovUq0nHRiw5KjUZ0Z5Q0ZVpw7E2m/jDjpi4lBrI
auSPTcUtGyqoXjlKDSbZ89Y+wz7OQp3385Wc7oAH77kSuMile7KyNUPidWFWhG9hJMe7+kQtTNc
0XAmFsd571dEQa8OrOuvzUrgxqHAqvbX0Rmmbz/ClFrdNwktNwJTq0Y5wny8xya1DDzMMBUCVzK
m4QqlpF9Sbs+IKA==
X-Google-Smtp-Source: AGHT+IH/4Dz7vdItmgmTlnNXWLY79bYjxG+RnGnF5b/cbxCPhJ2PE6r5VIZGSsEVJ0iX7xCVJcwFng==
X-Received: by 2002:a05:6000:18ac:b0:3a4:ee40:6c85 with SMTP id ffacd0b85a97d-3a531cba357mr3281306f8f.54.1749218171799;
Fri, 06 Jun 2025 06:56:11 -0700 (PDT)
Received: from localhost (a95-94-245-170.cpe.netcabo.pt. [95.94.245.170])
by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-452730d161csm21907155e9.37.2025.06.06.06.56.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:56:11 -0700 (PDT)
From: Rui Miguel Silva <rmfrfs@xxxxxxxxx>
X-Google-Original-From: "Rui Miguel Silva" <rui.silva@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
Mime-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Date: Fri, 06 Jun 2025 14:56:05 +0100
Message-Id: <DAFI37JD827I.KWPZ7XCTWPBD@xxxxxxxxxx>
Cc: <kieran.bingham@xxxxxxxxxxxxxxxx>, <rmfrfs@xxxxxxxxx>,
<martink@xxxxxxxxx>, <kernel@xxxxxxx>, <mchehab@xxxxxxxxxx>,
<shawnguo@xxxxxxxxxx>, <s.hauer@xxxxxxxxxxxxxx>, <kernel@xxxxxxxxxxxxxx>,
<festevam@xxxxxxxxx>, <linux-media@xxxxxxxxxxxxxxx>, <imx@xxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH 1/2] media: platform: Refactor interrupt status
registers
To: "Isaac Scott" <isaac.scott@xxxxxxxxxxxxxxxx>,
<laurent.pinchart@xxxxxxxxxxxxxxxx>
References: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
<20250606121403.498153-2-isaac.scott@xxxxxxxxxxxxxxxx>
In-Reply-To: <20250606121403.498153-2-isaac.scott@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hey Isaac,
Thanks for the patch.

On Fri Jun 6, 2025 at 1:14 PM WEST, Isaac Scott wrote:

> The NXP i.MX 8 MP CSI-2 receiver features multiple interrupt and debug
> status sources which span multiple registers. The driver currently
> supports two interrupt source registers, and attributes the
> mipi_csis_event event entries to those registers through a boolean debug
> field that indicate if the event relates to the main interrupt status
> (false) or debug interrupt status (true) register. To make it easier to
> add new event fields, replace the debug bool with a 'status index'
> integer than indicates the index of the corresponding status register.
>
> Signed-off-by: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
> ---
> drivers/media/platform/nxp/imx-mipi-csis.c | 64 +++++++++++-----------
> 1 file changed, 31 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/p=
latform/nxp/imx-mipi-csis.c
> index d060eadebc7a..bbc549c22aff 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -249,7 +249,7 @@
> #define MIPI_CSI2_DATA_TYPE_USER(x) (0x30 + (x))
> =20
> struct mipi_csis_event {
> - bool debug;
> + unsigned int status_index;
> u32 mask;
> const char * const name;
> unsigned int counter;
> @@ -257,30 +257,30 @@ struct mipi_csis_event {
> =20
> static const struct mipi_csis_event mipi_csis_events[] =3D {
> /* Errors */
> - { false, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO Overflow Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong Configuration Error" }=
,
> - { false, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error" },
> - { false, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type Not Supported=
" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type Ignored" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame Size Error" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early Frame End" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early Frame Start" },
> + { 0, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT Error"},

Maybe instead of 0,1,2 (magic indexes)... we could give a meaningful index
enums names, don't know, like: main, debug, user??? or something that
you think is better.

Cheers,
Rui

> + { 0, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO Overflow Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong Configuration Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error"},
> + { 0, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type Not Supported"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type Ignored"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame Size Error"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early Frame End"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early Frame Start"},
> /* Non-image data receive events */
> - { false, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even fr=
ame" },
> - { false, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image data after even fram=
e" },
> - { false, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image data before odd fram=
e" },
> - { false, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image data after odd frame"=
},
> + { 0, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even frame"=
},
> + { 0, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image data after even frame"},
> + { 0, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image data before odd frame"},
> + { 0, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image data after odd frame"},
> /* Frame start/end */
> - { false, MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start" },
> - { false, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge" },
> - { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge" },
> + { 0, MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start"},
> + { 0, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge"},
> + { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge"},
> };
> =20
> #define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
> @@ -765,32 +765,30 @@ static irqreturn_t mipi_csis_irq_handler(int irq, v=
oid *dev_id)
> struct mipi_csis_device *csis =3D dev_id;
> unsigned long flags;
> unsigned int i;
> - u32 status;
> - u32 dbg_status;
> + u32 status[2];
> =20
> - status =3D mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
> - dbg_status =3D mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
> + status[0] =3D mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
> + status[1] =3D mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
> =20
> spin_lock_irqsave(&csis->slock, flags);
> =20
> /* Update the event/error counters */
> - if ((status & MIPI_CSIS_INT_SRC_ERRORS) || csis->debug.enable) {
> + if ((status[0] & MIPI_CSIS_INT_SRC_ERRORS) || csis->debug.enable) {
> for (i =3D 0; i < MIPI_CSIS_NUM_EVENTS; i++) {
> struct mipi_csis_event *event =3D &csis->events[i];
> =20
> - if ((!event->debug && (status & event->mask)) ||
> - (event->debug && (dbg_status & event->mask)))
> + if (status[event->status_index] & event->mask)
> event->counter++;
> }
> }
> =20
> - if (status & MIPI_CSIS_INT_SRC_FRAME_START)
> + if (status[0] & MIPI_CSIS_INT_SRC_FRAME_START)
> mipi_csis_queue_event_sof(csis);
> =20
> spin_unlock_irqrestore(&csis->slock, flags);
> =20
> - mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status);
> - mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, dbg_status);
> + mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status[0]);
> + mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, status[1]);
> =20
> return IRQ_HANDLED;
> }
> --=20
> 2.43.0





Return-Path: <linux-kernel+bounces-675837-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 444FD41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:57:23 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3E3627AAC8B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:55:41 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F8CB289805;
Fri, 6 Jun 2025 13:56:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i43mJHS8"
Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFE851E377F;
Fri, 6 Jun 2025 13:56:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218207; cv=none; b=MY0I7upovlyUI2EqZ2JwIOvyI28fvBrrAmlEnTvz1k8OLh+BVSrNyLv5dzF1ha6Vy06MTit1o0D5cQ9f6EzqH9KL+H9AdjdDS9U6jddVNim/KPoZa9qTyKdA9PX1OWJlm3OjAYxDi4QJSiv9eobSu0VwsVhQ9CPDX+1osWup4u0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218207; c=relaxed/simple;
bh=f2qlTQ2FKcMWo5g25PTPNlS6DP8xIrL2O5cw4mtYuA0=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ixHvZy3rFRcySrT1RyEc+6eLIhEphpdvNdZHzTCtnRZVFO+XKaVng476WdYcPDv6bAzJQhkrilqDcVe5UL1JiAFwrH3G2jaI6joLAYMLSAKrCv/02u7YwNnXBkqh+5GyyCOU4JpkbO4/b9eIe7+WkIo/6pn6es19h79mCmb4ZAE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=i43mJHS8; arc=none smtp.client-ip=209.85.208.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-601f278369bso4249416a12.1;
Fri, 06 Jun 2025 06:56:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749218203; x=1749823003; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=Ai/BqRXBDTuvUKyO814cjzx4npUVyisZt8TkZV4iMuQ=;
b=i43mJHS85hvro1WnWzxjR5OnFub9mKX0F0jADbtE67c6LUbEio7KzO19n7XzYy6esu
2Hj86s1kQxFUDycJovtiAd7p13Rk3rUA5zicyhI73fCEcx4CUmtjzGR7XgxFZwYB9j4j
5uMprdp3lBd3fYp/G2A6SMzwpiM7QjMuyGiLKoWrq5/GFPXkxxzaUtgz/9nn0poHqnQV
dttk2xcx2+rqIx670cUdk5Y9z5aIrWKaWYoOhPsvV4OjgpvMz1r52g0ol1Pv10NxYWlA
tZfsv0c1W7xCQtnt9Ij4/ruGHJdCaztmA4+ujmFMOoxGpP1AHShOGRbcuvxdPLicUD9B
UWdg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218203; x=1749823003;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=Ai/BqRXBDTuvUKyO814cjzx4npUVyisZt8TkZV4iMuQ=;
b=vK8ATqGYypZrS9BxzJ7BhsNbhAKEvsrD+7y/Ii4x4nB1jXdAQrcpWUl8eEEx/6M6wx
8WQj/X1aEOUWluBcOYWe0/OuphuKOweAGdqskiYXVi2uwdJTSNDx9CPz6LJdfs4qAWO5
lmwSd+io5HelBxsCsv7B/Mk5ifhx3aMbWL4BmeKm25sNCQYpdv0WTCjr7wNQdOpiP8KL
jhg+e2uIJ8HzchHzgRdubtkapDRXfeN//hToRS0v0oPql36ydwM91tkE3ZOEXyGYwGhR
Rt8tuO1Y/EMbr2KSsTkprGCJlQsOzsRQ7Gn9o/8SkO5+gdZkztmq/vXLUZ4ACWHE35Au
Ptdw==
X-Forwarded-Encrypted: i=1; AJvYcCUj2OHfToO3MFWj89505bqKBS0Ci9DNiRyX9iWCx735cKx43gAiR0LPPn/QwfByzG3l6TA=@vger.kernel.org, AJvYcCW/BHGDj4I6WsinojuRg2GqrUilIqhhiL/FkMMMEpnkJhpTB9PIh/dn74h2H1Y69zMjN+5cshYDhv+DV6P0@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yzd/5A7+gNmfcF/wOLbeIviZ5CXYN7uqG8JPWnHq7DYD/3Yqwjs
+YwmpiDCIlzY9/7vdVNScXVnL56MEdokrjILjxgNJVfIBR1BfdyygTM18H+00g==
X-Gm-Gg: ASbGncuXLWbHsnft7Tlplff1XPFrh4elfV7ZEg/AjCRtMWiJGasYKNGu9+CcT0+BwFq
s9G/Tg+ZEr7531CrvzJuqJ+0kf01P04e/+cOVpCgBABePVUsonaxlMuFp7WJknnlq1fsTrUn4H7
WgJLRZhjrpGxyTWJWIuM4kPAwzRp130WdgsyRq39jb25yqBNagIz9zPo86n5JyzwFlw475difz1
+Xog9RhBb/I2UlTF/yIHjAP4TI+AvKHPDRd6bwyAvblwwoLhVKKhcINXmT8a/FyQcqiJcOWQc7A
WE1oI1ltBWyvgFkI0i6Ft2LzI3Cnr0/cm26arNEvd5p25g==
X-Google-Smtp-Source: AGHT+IEhR63MMEj7DNFl5prD+jv7i2jhBn6t3pwmamGFRcTbrgyqh3gprpxwZbwhCaImZoVIhyRu2A==
X-Received: by 2002:a17:907:1c07:b0:ad8:a115:d554 with SMTP id a640c23a62f3a-ade1ab5ec36mr270844966b.56.1749218203265;
Fri, 06 Jun 2025 06:56:43 -0700 (PDT)
Received: from 127.com ([2620:10d:c092:600::1:a199])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc379f6sm118026766b.110.2025.06.06.06.56.42
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:56:42 -0700 (PDT)
From: Pavel Begunkov <asml.silence@xxxxxxxxx>
To: io-uring@xxxxxxxxxxxxxxx
Cc: asml.silence@xxxxxxxxx,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [RFC v2 0/5] BPF controlled io_uring
Date: Fri, 6 Jun 2025 14:57:57 +0100
Message-ID: <cover.1749214572.git.asml.silence@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This series adds io_uring BPF struct_ops, which allows processing
events and submitting requests from BPF without returning to user.
There is only one callback for now, it's called from the io_uring
CQ waiting loop when there is an event to be processed. It also
has access to waiting parameters like batching and timeouts.

It's tested with a program that queues a nop request, waits for
its completion and then queues another request, repeating it N
times. The baseline to compare with is traditional io_uring
application doing same without BPF and using 2 requests links,
with the same total number of requests.

# ./link 0 100000000
type 2-LINK, requests to run 100000000
sec 20, total (ms) 20374
# ./link 1 100000000
type BPF, requests to run 100000000
sec 13, total (ms) 13700

The BPF version works ~50% faster on a mitigated kernel, while it's
not even a completely fair comparison as links are restrictive and
can't always be used. Without links the speedup reaches ~80%.

This allows arbitrary relations between requests including using
a result from one request to configure the following one. There are
other use cases in mind that need access to in-kernel resources and
can't be implemented from userspace. On top, it can be extended with
more callbacks to get finer control over task work batching.

It's a prototype, I intend to remake the kfunc helpers, enchance
program verification, and fix some mild io_uring waiting edge
cases.

Kernel branch:
https://github.com/isilence/linux/tree/io-uring-bpf/v2
git https://github.com/isilence/linux.git io-uring-bpf/v2

Liburing + bpf bootsrap examples:
https://github.com/isilence/liburing/tree/bpf-struct-ops-examples
git git@xxxxxxxxxx:isilence/liburing.git bpf-struct-ops-examples

Pavel Begunkov (5):
io_uring: add struct for state controlling cqwait
io_uring/bpf: add stubs for bpf struct_ops
io_uring/bpf: implement struct_ops registration
io_uring/bpf: add handle events callback
io_uring/bpf: add basic kfunc helpers

include/linux/io_uring_types.h | 4 +
io_uring/Kconfig | 5 +
io_uring/Makefile | 1 +
io_uring/bpf.c | 277 +++++++++++++++++++++++++++++++++
io_uring/bpf.h | 45 ++++++
io_uring/io_uring.c | 45 ++++--
io_uring/io_uring.h | 11 +-
io_uring/napi.c | 4 +-
8 files changed, 376 insertions(+), 16 deletions(-)
create mode 100644 io_uring/bpf.c
create mode 100644 io_uring/bpf.h

--
2.49.0



Return-Path: <linux-kernel+bounces-675839-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C1F0041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:57:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id EE5C33B2350
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:57:05 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C51D289E0E;
Fri, 6 Jun 2025 13:56:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GF/KB77s"
Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93409288C81;
Fri, 6 Jun 2025 13:56:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218209; cv=none; b=nCwDkRTcx7l5C7diEN4TujVmhr0QDbMpHLoQ7waVYYwYgaRUsbn1GvRRsoTFk3vzwd52eKoPs80VTiB5WVnDcrjBKF6tg1w8AYaIeNm373I9C++rMM6RwQOguCtZSF5HqB6jAtgTfnKBdBYgAx5mVaF6dzVfLA/WxrI1rMIV4D4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218209; c=relaxed/simple;
bh=ViC3IbHgyZt8fGF8lVTF8z4dPU4ffOy+7hz/L+RoQG4=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=icHSxpy/GXOSJU+hwBIzbtEF/57XUiL3FjjFOYesa6Eq+JpUADHryfS21Q+WL/eaioh+2SZJdVwGmW1Asa6hd8J0w7F9hxkLX9USUvdFvY6j2/cyXSb7oquhbOMcGxQp/t5YBI+MQiR3TaOmqv0NrVFy9qDyFLBaMUIw9uYHBpY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GF/KB77s; arc=none smtp.client-ip=209.85.208.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-60497d07279so3980611a12.3;
Fri, 06 Jun 2025 06:56:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749218205; x=1749823005; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=WR0oSDemJ8McuKWbT8yQkZjejC+oeGCjvdBXaJShshE=;
b=GF/KB77s810NczF6lb0xLkLkJn/E3qDQ1KuH8phAYUInIAhexh+6QNlYMjybl3Q5kS
GZRkPzzO+nqHRJ7DpdwLrrBK6HxQnbM4Q2EExc16HJ7/K0gxSWRWFHvOQbwCO0HzZeqm
+hgMHeQKoqgb7wmxHgyXHYSpcn0dnaEbgpw1bZIGMNq+PpQ/Tl7NJHMX3V/1TRueJvCa
RkjRs5+nWh/Y6Pnr+quD7UWmUi7mB2zsVR6VFBm0ieWAiHbJnbwh0g6ssSA7DHYkelHQ
XCsCIOYDjHZDM2yNN1r+NR/rAHeG3wB4H30Myru16OUpDtT4PZpCbY3OOwCJn7xR0WVj
Hq1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218205; x=1749823005;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=WR0oSDemJ8McuKWbT8yQkZjejC+oeGCjvdBXaJShshE=;
b=Dqq/DJ0gZiLIJ/UDLkQwHfa31RFdji0wpVUJKmh29hoyRzqrPeyy1HjHLRb0PdYgAp
+v+8PI+0f1//hj0pmFhFphXvUuqZwDXOEexJg8LrB/u4mC34RAf5XQ8fmKhauswA4TLE
BphNoPm6PV0t6y6/5OlYa9W0HsQW2YUFtXB+i6+6F8UAOU3Wo2Jk/WE8rsUrJJIpKmEv
T0WuQbHP2oUIv+qNVlXBCN3m7tHuimsiEDPkimQQFXImYdkoyW6DWuqkjvBNw7ovIKL3
/biv3fvXwSVQRNAs0PGO8xgy1r+CBfkFfOKxGVmqDbzUuGJKGGG1DbPFKrupShNCO7jc
C5Ig==
X-Forwarded-Encrypted: i=1; AJvYcCVlV9BySdA22FYoYYYJo2GOjRi6WJnQl3w0otbbJC4osKfr7ga6tcpsBGByV6Potp2SQ8K3iRTGHsYnFKR+@xxxxxxxxxxxxxxx, AJvYcCXBywf826u3s4xNyr5pGutz5AcL8CGxxEQEG39ZNH0nkSD3izqyzyPt5LzL6HjH4s4GGp8=@vger.kernel.org
X-Gm-Message-State: AOJu0YyllAm/kpVxg1sX8VljGgfnXF6GRoMJywquD4AKXzmCROs7pL9S
XYlUCpQVQV2ZRsBM87jkf1SbO02xFibATRNlE0Paxgg2MLPrLS6rFG3qugUzFg==
X-Gm-Gg: ASbGncv6TVSGrqLvgWWqMnL9BBgXrcSZdBb7WcDy208UOFXij+NVA5ITkWjGv/MJK/9
yjrmDu2OLwN/gcrXbWQ2PDzzcPWR7DSZJ32NHPdpROlrG+oD3/HRRy2DxLGhUUc6X3bn79AW8Qu
EuG6OGt+RZxKICey36lDbLgXPoMaH0DWo6/cr7fQgzreeKS8nlClybX84M10XSnSSwOLXsCMsDJ
NKZYXUzFFQFmO4VbyAzEKycGZMvyT1FFeJbRqKFw3KUIjZdsVxFw1IpTi3G8ZiOrnREdKdJyr7L
ZBCHsYr6undqGHYJH4hs+mEhAbUPe/cv374yXhnN4QMlTw==
X-Google-Smtp-Source: AGHT+IEl038+iTCO65fTXNrf0nnQgWPfEsmuWE98Gk6ylNubF4OzxPQhOmh+mxtWg0ptadhMSYcjSA==
X-Received: by 2002:a17:906:d54e:b0:ad5:1c28:3c4b with SMTP id a640c23a62f3a-ade1a9ee319mr292192966b.52.1749218205205;
Fri, 06 Jun 2025 06:56:45 -0700 (PDT)
Received: from 127.com ([2620:10d:c092:600::1:a199])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc379f6sm118026766b.110.2025.06.06.06.56.44
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:56:44 -0700 (PDT)
From: Pavel Begunkov <asml.silence@xxxxxxxxx>
To: io-uring@xxxxxxxxxxxxxxx
Cc: asml.silence@xxxxxxxxx,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [RFC v2 2/5] io_uring/bpf: add stubs for bpf struct_ops
Date: Fri, 6 Jun 2025 14:57:59 +0100
Message-ID: <e2cd83fa47ed6e7e6c4e9207e66204e97371a37c.1749214572.git.asml.silence@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <cover.1749214572.git.asml.silence@xxxxxxxxx>
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add some basic helpers and definitions for implementing bpf struct_ops.
There are no callbaack yet, and registration will always fail.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
include/linux/io_uring_types.h | 4 ++
io_uring/Kconfig | 5 ++
io_uring/Makefile | 1 +
io_uring/bpf.c | 93 ++++++++++++++++++++++++++++++++++
io_uring/bpf.h | 26 ++++++++++
io_uring/io_uring.c | 3 ++
6 files changed, 132 insertions(+)
create mode 100644 io_uring/bpf.c
create mode 100644 io_uring/bpf.h

diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
index 2922635986f5..26ee1a6f52e7 100644
--- a/include/linux/io_uring_types.h
+++ b/include/linux/io_uring_types.h
@@ -8,6 +8,8 @@
#include <linux/llist.h>
#include <uapi/linux/io_uring.h>

+struct io_uring_ops;
+
enum {
/*
* A hint to not wake right away but delay until there are enough of
@@ -344,6 +346,8 @@ struct io_ring_ctx {

void *cq_wait_arg;
size_t cq_wait_size;
+
+ struct io_uring_ops *bpf_ops;
} ____cacheline_aligned_in_smp;

/*
diff --git a/io_uring/Kconfig b/io_uring/Kconfig
index 4b949c42c0bf..b4dad9b74544 100644
--- a/io_uring/Kconfig
+++ b/io_uring/Kconfig
@@ -9,3 +9,8 @@ config IO_URING_ZCRX
depends on PAGE_POOL
depends on INET
depends on NET_RX_BUSY_POLL
+
+config IO_URING_BPF
+ def_bool y
+ depends on IO_URING
+ depends on BPF_SYSCALL && BPF_JIT && DEBUG_INFO_BTF
diff --git a/io_uring/Makefile b/io_uring/Makefile
index d97c6b51d584..58f46c0f9895 100644
--- a/io_uring/Makefile
+++ b/io_uring/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_EPOLL) += epoll.o
obj-$(CONFIG_NET_RX_BUSY_POLL) += napi.o
obj-$(CONFIG_NET) += net.o cmd_net.o
obj-$(CONFIG_PROC_FS) += fdinfo.o
+obj-$(CONFIG_IO_URING_BPF) += bpf.o
diff --git a/io_uring/bpf.c b/io_uring/bpf.c
new file mode 100644
index 000000000000..3096c54e4fb3
--- /dev/null
+++ b/io_uring/bpf.c
@@ -0,0 +1,93 @@
+#include <linux/mutex.h>
+
+#include "bpf.h"
+#include "register.h"
+
+static struct io_uring_ops io_bpf_ops_stubs = {
+};
+
+static bool bpf_io_is_valid_access(int off, int size,
+ enum bpf_access_type type,
+ const struct bpf_prog *prog,
+ struct bpf_insn_access_aux *info)
+{
+ if (type != BPF_READ)
+ return false;
+ if (off < 0 || off >= sizeof(__u64) * MAX_BPF_FUNC_ARGS)
+ return false;
+ if (off % size != 0)
+ return false;
+
+ return btf_ctx_access(off, size, type, prog, info);
+}
+
+static int bpf_io_btf_struct_access(struct bpf_verifier_log *log,
+ const struct bpf_reg_state *reg, int off,
+ int size)
+{
+ return -EACCES;
+}
+
+static const struct bpf_verifier_ops bpf_io_verifier_ops = {
+ .get_func_proto = bpf_base_func_proto,
+ .is_valid_access = bpf_io_is_valid_access,
+ .btf_struct_access = bpf_io_btf_struct_access,
+};
+
+static int bpf_io_init(struct btf *btf)
+{
+ return 0;
+}
+
+static int bpf_io_check_member(const struct btf_type *t,
+ const struct btf_member *member,
+ const struct bpf_prog *prog)
+{
+ return 0;
+}
+
+static int bpf_io_init_member(const struct btf_type *t,
+ const struct btf_member *member,
+ void *kdata, const void *udata)
+{
+ return 0;
+}
+
+static int bpf_io_reg(void *kdata, struct bpf_link *link)
+{
+ return -EOPNOTSUPP;
+}
+
+static void bpf_io_unreg(void *kdata, struct bpf_link *link)
+{
+}
+
+void io_unregister_bpf_ops(struct io_ring_ctx *ctx)
+{
+}
+
+static struct bpf_struct_ops bpf_io_uring_ops = {
+ .verifier_ops = &bpf_io_verifier_ops,
+ .reg = bpf_io_reg,
+ .unreg = bpf_io_unreg,
+ .check_member = bpf_io_check_member,
+ .init_member = bpf_io_init_member,
+ .init = bpf_io_init,
+ .cfi_stubs = &io_bpf_ops_stubs,
+ .name = "io_uring_ops",
+ .owner = THIS_MODULE,
+};
+
+static int __init io_uring_bpf_init(void)
+{
+ int ret;
+
+ ret = register_bpf_struct_ops(&bpf_io_uring_ops, io_uring_ops);
+ if (ret) {
+ pr_err("io_uring: Failed to register struct_ops (%d)\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+__initcall(io_uring_bpf_init);
diff --git a/io_uring/bpf.h b/io_uring/bpf.h
new file mode 100644
index 000000000000..a61c489d306b
--- /dev/null
+++ b/io_uring/bpf.h
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_BPF_H
+#define IOU_BPF_H
+
+#include <linux/io_uring_types.h>
+#include <linux/bpf.h>
+
+#include "io_uring.h"
+
+struct io_uring_ops {
+};
+
+static inline bool io_bpf_attached(struct io_ring_ctx *ctx)
+{
+ return IS_ENABLED(CONFIG_BPF) && ctx->bpf_ops != NULL;
+}
+
+#ifdef CONFIG_BPF
+void io_unregister_bpf_ops(struct io_ring_ctx *ctx);
+#else
+static inline void io_unregister_bpf_ops(struct io_ring_ctx *ctx)
+{
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 9cc4d8f335a1..8f68e898d60c 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -98,6 +98,7 @@
#include "msg_ring.h"
#include "memmap.h"
#include "zcrx.h"
+#include "bpf.h"

#include "timeout.h"
#include "poll.h"
@@ -2870,6 +2871,8 @@ static __cold void io_ring_exit_work(struct work_struct *work)
struct io_tctx_node *node;
int ret;

+ io_unregister_bpf_ops(ctx);
+
/*
* If we're doing polled IO and end up having requests being
* submitted async (out-of-line), then completions can come in while
--
2.49.0



Return-Path: <linux-kernel+bounces-675838-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E074841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:57:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id CC5297AAF84
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:56:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 75E76289E0D;
Fri, 6 Jun 2025 13:56:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WMJHFBxe"
Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E372288CA3;
Fri, 6 Jun 2025 13:56:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218209; cv=none; b=L2+Lie/h0t3xkFrjjtZrbztNc/Pd+8MBj8nnz02meyNPUCStWnVMPplcJGSUkChyzsahwBYVUVyTkaPW/VF+7FW+zDf+b7DzucExIrIL11Ki/TTaJDNgXOF5sma0ymHeWSVk1jPUwpswgKzVjOVTZ3XNTpbYTEhBod2Z3c4H894=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218209; c=relaxed/simple;
bh=i3124dRDrSgAJDr+S4wMhaq4i3Iio62CzkpMX/msx8I=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=g9spgI34xHbRYVYA1UVdtZFy/XycV0lI2ok2kPmVDkqoGNIpK+TrnJR1hr+PHPAhVm91IPAmbbQDtdrt8Miap9hGFcjGGscuehheY8Fjf2F0+1C+Yerf+f+rYU6flUO7DHzQAccIH9JX6aUe1+41IQ8x7NrSo+dmY+bVyrodov0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WMJHFBxe; arc=none smtp.client-ip=209.85.218.51
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-ad89333d603so380697066b.2;
Fri, 06 Jun 2025 06:56:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749218204; x=1749823004; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=nWMe+CPV752eWO5pJOHKZI3Zz5P7ROmouZdNiOUAjLg=;
b=WMJHFBxehjaW++XnXc+MrzQX12bULfmTAZpto2DdIz9Tvi6rV8Y1a+zeYNmL3j35LE
JIrRgIRZd0bT8DGH1+tQ0XTjfBogKb4ygTEyZcfx0v6ME5nhTn/dV0AaD92dOpFxgP0J
rSUQN2vQ1UA4KgzlNqyKSpspglkdrWBXA5zgRYDAtSdJG3vldSu0y5C7e9OLLaogWtBt
WBcB8RsFUHfKya7opXZW1XI+teKobt+FGZm97wlF38iTd7/y47pPwAvi8tQ0JDYGpkjA
eaqO+lDqdz2X36toXTe2b1BJ2yJDWYMtX086kXXwKoMDUdErOmOR6BND4x37+HdTzTaz
mBtA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218204; x=1749823004;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=nWMe+CPV752eWO5pJOHKZI3Zz5P7ROmouZdNiOUAjLg=;
b=kznFAIu631ZyUg4oUV9uh0I9EHSXf99YdAHI6d88AwhoQDncQLXTGO+1ejChrTwfHd
3RndVlUfEswnzE1mp9SwxqVq4VZ2fzBG/WTRrAMrFjDvLVpA+it80IM5qpM0FwcrJBy0
3yuBpfk1fY2asf81M78zuQ43VW6sUa0qEtsnF8CL6fVhG6dYxXtPPiwK8oJhGOy73ASn
6v46pxpQ5Sg642czfTVSQwWoZa3GYqLTHvSUZ6/9sQCmdz58ZxoOE27gbEdHOE/42pK2
/kDa5mhcbI7FVcDljVpwMUsLzFpR5iVm6IQj/G6c4gumyTaPqheyo/ZqAjVqyd0HGsNZ
dqHw==
X-Forwarded-Encrypted: i=1; AJvYcCXAQxkhLXQRLwiU3NEKYok0CI0FIAEPs1yu8NTWc7dytwxSGy4fvnW0XoXPKjVBg6eBRvb+PuEEAHDy3D14@xxxxxxxxxxxxxxx, AJvYcCXzYfK3J0SONxsvKrOdvg34+F2fOyjiAYsBPxE6TbSS1ztosV5tvrzbEAODz2TbjWL02rw=@vger.kernel.org
X-Gm-Message-State: AOJu0YxisZlZjLNUw2k6+uvuXTsFf+Cq8/+zCrBWBX4LJeutnD4R+SMu
BHQ0W+xav5hpV6NZAh1gq4txkOVfGWn9MGs0UJQ6wsdWXVU1wGnFtWLFHTXCcA==
X-Gm-Gg: ASbGncsq6g1599UWy/ZOUtRf0DGr3nOCKxY8Pyc0ZMf1CnENQ9lGCOfAPQUq+cH2FXj
VoV82OL7S6VfuL+FIOn0LIahs72xb5HHqPpmjF4704w9aTna30E7mXN1thtxUsG3F7zJxcLOeU7
cfnL2FwjmHhWLSWxfFk/GGM2CcCC8OQ9+AbPuDr6qpcpCWWz82EHZHOxYJ6qQsEs8RhxRKuLqnj
8ipeCZRHpieZXp4/VnbnbKY1ZYPYTj1kXMK6yXFdE3iRlHMWkTm4pGlD2pF0+mh/kHRDEVBo7Pw
LtKyEsCnZ1vqA/SPbFOEq2sbaSBVGI/nEdeSYgdv5L0tKQ==
X-Google-Smtp-Source: AGHT+IGTHo98cVWlTElkkwQOFkdLagcBVYC8pG8zXRDACYh8UdDhDdzYtg/jdxODl6/+g+QxBQfFvQ==
X-Received: by 2002:a17:907:7f2a:b0:ace:d710:a8d1 with SMTP id a640c23a62f3a-ade1a90a2f4mr306337766b.24.1749218204198;
Fri, 06 Jun 2025 06:56:44 -0700 (PDT)
Received: from 127.com ([2620:10d:c092:600::1:a199])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc379f6sm118026766b.110.2025.06.06.06.56.43
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:56:43 -0700 (PDT)
From: Pavel Begunkov <asml.silence@xxxxxxxxx>
To: io-uring@xxxxxxxxxxxxxxx
Cc: asml.silence@xxxxxxxxx,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [RFC v2 1/5] io_uring: add struct for state controlling cqwait
Date: Fri, 6 Jun 2025 14:57:58 +0100
Message-ID: <933217fc63d9f7753e0e3e8dc239ba1a3f15add4.1749214572.git.asml.silence@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <cover.1749214572.git.asml.silence@xxxxxxxxx>
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add struct iou_loop_state and place there parameter controlling the flow
of normal CQ waiting. It will be exposed to BPF for api of the helpers,
and while I could've used struct io_wait_queue, the name is not ideal,
and keeping only necessary bits makes further development a bit cleaner.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
io_uring/io_uring.c | 20 ++++++++++----------
io_uring/io_uring.h | 11 ++++++++---
io_uring/napi.c | 4 ++--
3 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 5cdccf65c652..9cc4d8f335a1 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2404,8 +2404,8 @@ static enum hrtimer_restart io_cqring_min_timer_wakeup(struct hrtimer *timer)
struct io_ring_ctx *ctx = iowq->ctx;

/* no general timeout, or shorter (or equal), we are done */
- if (iowq->timeout == KTIME_MAX ||
- ktime_compare(iowq->min_timeout, iowq->timeout) >= 0)
+ if (iowq->state.timeout == KTIME_MAX ||
+ ktime_compare(iowq->min_timeout, iowq->state.timeout) >= 0)
goto out_wake;
/* work we may need to run, wake function will see if we need to wake */
if (io_has_work(ctx))
@@ -2431,7 +2431,7 @@ static enum hrtimer_restart io_cqring_min_timer_wakeup(struct hrtimer *timer)
}

hrtimer_update_function(&iowq->t, io_cqring_timer_wakeup);
- hrtimer_set_expires(timer, iowq->timeout);
+ hrtimer_set_expires(timer, iowq->state.timeout);
return HRTIMER_RESTART;
out_wake:
return io_cqring_timer_wakeup(timer);
@@ -2447,7 +2447,7 @@ static int io_cqring_schedule_timeout(struct io_wait_queue *iowq,
hrtimer_setup_on_stack(&iowq->t, io_cqring_min_timer_wakeup, clock_id,
HRTIMER_MODE_ABS);
} else {
- timeout = iowq->timeout;
+ timeout = iowq->state.timeout;
hrtimer_setup_on_stack(&iowq->t, io_cqring_timer_wakeup, clock_id,
HRTIMER_MODE_ABS);
}
@@ -2488,7 +2488,7 @@ static int __io_cqring_wait_schedule(struct io_ring_ctx *ctx,
*/
if (ext_arg->iowait && current_pending_io())
current->in_iowait = 1;
- if (iowq->timeout != KTIME_MAX || iowq->min_timeout)
+ if (iowq->state.timeout != KTIME_MAX || iowq->min_timeout)
ret = io_cqring_schedule_timeout(iowq, ctx->clockid, start_time);
else
schedule();
@@ -2546,18 +2546,18 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, u32 flags,
iowq.wq.private = current;
INIT_LIST_HEAD(&iowq.wq.entry);
iowq.ctx = ctx;
- iowq.cq_tail = READ_ONCE(ctx->rings->cq.head) + min_events;
+ iowq.state.target_cq_tail = READ_ONCE(ctx->rings->cq.head) + min_events;
iowq.cq_min_tail = READ_ONCE(ctx->rings->cq.tail);
iowq.nr_timeouts = atomic_read(&ctx->cq_timeouts);
iowq.hit_timeout = 0;
iowq.min_timeout = ext_arg->min_time;
- iowq.timeout = KTIME_MAX;
+ iowq.state.timeout = KTIME_MAX;
start_time = io_get_time(ctx);

if (ext_arg->ts_set) {
- iowq.timeout = timespec64_to_ktime(ext_arg->ts);
+ iowq.state.timeout = timespec64_to_ktime(ext_arg->ts);
if (!(flags & IORING_ENTER_ABS_TIMER))
- iowq.timeout = ktime_add(iowq.timeout, start_time);
+ iowq.state.timeout = ktime_add(iowq.state.timeout, start_time);
}

if (ext_arg->sig) {
@@ -2582,7 +2582,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, u32 flags,

/* if min timeout has been hit, don't reset wait count */
if (!iowq.hit_timeout)
- nr_wait = (int) iowq.cq_tail -
+ nr_wait = (int) iowq.state.target_cq_tail -
READ_ONCE(ctx->rings->cq.tail);
else
nr_wait = 1;
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 0ea7a435d1de..edf698b81a95 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -39,15 +39,19 @@ enum {
IOU_REQUEUE = -3072,
};

+struct iou_loop_state {
+ __u32 target_cq_tail;
+ ktime_t timeout;
+};
+
struct io_wait_queue {
+ struct iou_loop_state state;
struct wait_queue_entry wq;
struct io_ring_ctx *ctx;
- unsigned cq_tail;
unsigned cq_min_tail;
unsigned nr_timeouts;
int hit_timeout;
ktime_t min_timeout;
- ktime_t timeout;
struct hrtimer t;

#ifdef CONFIG_NET_RX_BUSY_POLL
@@ -59,7 +63,8 @@ struct io_wait_queue {
static inline bool io_should_wake(struct io_wait_queue *iowq)
{
struct io_ring_ctx *ctx = iowq->ctx;
- int dist = READ_ONCE(ctx->rings->cq.tail) - (int) iowq->cq_tail;
+ u32 target = iowq->state.target_cq_tail;
+ int dist = READ_ONCE(ctx->rings->cq.tail) - target;

/*
* Wake up if we have enough events, or if a timeout occurred since we
diff --git a/io_uring/napi.c b/io_uring/napi.c
index 4a10de03e426..e08bddc1dbd2 100644
--- a/io_uring/napi.c
+++ b/io_uring/napi.c
@@ -360,8 +360,8 @@ void __io_napi_busy_loop(struct io_ring_ctx *ctx, struct io_wait_queue *iowq)
return;

iowq->napi_busy_poll_dt = READ_ONCE(ctx->napi_busy_poll_dt);
- if (iowq->timeout != KTIME_MAX) {
- ktime_t dt = ktime_sub(iowq->timeout, io_get_time(ctx));
+ if (iowq->state.timeout != KTIME_MAX) {
+ ktime_t dt = ktime_sub(iowq->state.timeout, io_get_time(ctx));

iowq->napi_busy_poll_dt = min_t(u64, iowq->napi_busy_poll_dt, dt);
}
--
2.49.0



Return-Path: <linux-kernel+bounces-675840-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9F48441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:58:06 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 015ED7A8B2E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:56:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 00131289E24;
Fri, 6 Jun 2025 13:56:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HI7e2Mbd"
Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60D4128937F;
Fri, 6 Jun 2025 13:56:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218210; cv=none; b=fxD+MPD6kenBIlVIU7Zs82rLxrHhgbdnMDG15Vyne1DPEkPaSfPMTlUGvlzEzATaBDzK66E52nO+LtxeCaNP781biFbyPF7Jhwyx2k+FeeSZrlqtlwYLn4PFYN8QlMbYpxnMkt1DAIysm/81KWZKhq9r4eeE6+2/oThr3SPhxBo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218210; c=relaxed/simple;
bh=5VMdPBhIyqMD1MmtIpltOSTRWEVW47+1088cj4tJ8pM=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=Kc7sPf/uyI2xCNg4QDnZ7W2UgU3rHrIiHmSTYIJLem3K4ZUdv7NfLQXVT3iVsKXi0qC5qwO+QnBG0k7/keIhtCBJS7SoMBrbvzfl5M+eMZFIDxIwskcJZPG8chzWkpYBdL4ujhdkqVji+rWoKolKBH6Lzr1smY7cC1fV81x7/Yk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HI7e2Mbd; arc=none smtp.client-ip=209.85.208.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-60497d07279so3980635a12.3;
Fri, 06 Jun 2025 06:56:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749218206; x=1749823006; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=Kq02ZXnReuZLLwrZBHg+lNbHT6a4SK/xczUYFbR7a/w=;
b=HI7e2Mbd4La1/kwJxp8sK9qRadhKdYQmaSUSsgucjwpsdp8Q/NmYuB+GYYZgvefCWK
xpgTeT1p/IHr8ahlbYVvpn8c+1OofvwvnFHX2VU299fOUKYDTK6qLac+sLrwkVHsize7
EfP8U7O7gtlVH0b4SRMbffN3rIWhFsL+tkutV5uetWWLVu1cgSi561YfMkXzXtPYQVwq
1pMJM0qnH4gBDfN036E4zMRpJZBgEl1E76nuTsiRUR7Jn4Hq8hYfyEk4Fs+7TJCwNOEy
7ZVmub4l9NfV2RzO/3dgft+sqJZQGaYRMGILxHkY36zISAx8nEcleRmZPU9xx8Gv2HiM
MvZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218206; x=1749823006;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=Kq02ZXnReuZLLwrZBHg+lNbHT6a4SK/xczUYFbR7a/w=;
b=FjtxfRkh2nqPYjM3hkEv5gJsDMyo1uVQiTf1BsN5qhFrirwgox9RyW+gVDUZ7+9h7i
eqYV2b+dRUfVGLM0bneeNszmnIoKEKP6DcauYWBcIWQw9b2pUbucWZItFeUWC4nSXuyZ
cTzr/7jfNuo7GuWk/lXcE/ODDlFNC+BAT5FvX0seUPOSUY6ugLNTEIjw7knxkETfcYK7
zBg++vmzGAHsGMN09p8f0isU/KAxj8E5D6sgVlDrt+Vk3qjxOD4n9bapqreciRZD78H8
0YqfQN1whFC4fgpMGNSKQLPsoNHW1M51RwtokZy09ZvgrTvdmwLN/pJybHVthhX4kkiV
HkuA==
X-Forwarded-Encrypted: i=1; AJvYcCWkS7JlAhmIS1gmC5QBElyFBPl+m20juJqew6J0pfzCULV1y4sG9qQGa1U/AQ22aFpfe14=@vger.kernel.org, AJvYcCX/1i7AEv32LCx6SvPVF9qUn6W+tm0pIAO7i3eQQlV7Jk/j2FJMmQTBjLiD25kacmii/sCOI9FxE+nVnzV4@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yz+EZlW9PA8qQTSxt23cTLM5r5JQg8IaDAwqYMy+Ctj52auakyJ
urtBsy7eMZTpXY+Ovb0LCyDQvQev9fpR/rc5GvOapcIavpdXptdBitQ4UKa5vQ==
X-Gm-Gg: ASbGncuY5dI0lIKWTt0H+tzsOrk8lkIdBItbd10aHJMA+b1pN8CdTa9nhwBTaWYYUqT
9LwgC6BgLmC+p+H5eBGtwpr5vsF9WVSDyFiqAFNHNobB9hlqb1dDV0f+Ek75jbLtIt/hwlyAmVS
KdFibufv1LaFpVtIoLg8cBYL75C1ysI7mt2Md+lpgf2sF8fXt7W+SE8vxkZA2HtjC9OMPh5ezKp
MAUp8YA9xiXmEnB3Eh5dRmPzONRlqR/SXFsCuQYinTGIolHEFKzyOCYvv5R2lv7fG8poCWuSUeB
ahLZFiUj8PCeSEE/k4Aq/66JWp0ON084gzk=
X-Google-Smtp-Source: AGHT+IGxiOsNefek1Bu4XB/BKFZspesjby3DK69VYtx8UdcH82CyMF+V+9+JJsat6eaOhAdeWfxkzQ==
X-Received: by 2002:a17:907:3c88:b0:ad8:96d2:f41 with SMTP id a640c23a62f3a-ade1a9229f0mr321862066b.33.1749218206122;
Fri, 06 Jun 2025 06:56:46 -0700 (PDT)
Received: from 127.com ([2620:10d:c092:600::1:a199])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc379f6sm118026766b.110.2025.06.06.06.56.45
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:56:45 -0700 (PDT)
From: Pavel Begunkov <asml.silence@xxxxxxxxx>
To: io-uring@xxxxxxxxxxxxxxx
Cc: asml.silence@xxxxxxxxx,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [RFC v2 3/5] io_uring/bpf: implement struct_ops registration
Date: Fri, 6 Jun 2025 14:58:00 +0100
Message-ID: <f43e5d4e5e1797312ef3ee7986f4447bddac1d3c.1749214572.git.asml.silence@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <cover.1749214572.git.asml.silence@xxxxxxxxx>
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add ring_fd to the struct_ops and implement [un]registration.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
io_uring/bpf.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++-
io_uring/bpf.h | 3 +++
2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/io_uring/bpf.c b/io_uring/bpf.c
index 3096c54e4fb3..0f82acf09959 100644
--- a/io_uring/bpf.c
+++ b/io_uring/bpf.c
@@ -3,6 +3,8 @@
#include "bpf.h"
#include "register.h"

+DEFINE_MUTEX(io_bpf_ctrl_mutex);
+
static struct io_uring_ops io_bpf_ops_stubs = {
};

@@ -50,20 +52,83 @@ static int bpf_io_init_member(const struct btf_type *t,
const struct btf_member *member,
void *kdata, const void *udata)
{
+ u32 moff = __btf_member_bit_offset(t, member) / 8;
+ const struct io_uring_ops *uops = udata;
+ struct io_uring_ops *ops = kdata;
+
+ switch (moff) {
+ case offsetof(struct io_uring_ops, ring_fd):
+ ops->ring_fd = uops->ring_fd;
+ return 1;
+ }
+ return 0;
+}
+
+static int io_register_bpf_ops(struct io_ring_ctx *ctx, struct io_uring_ops *ops)
+{
+ if (ctx->bpf_ops)
+ return -EBUSY;
+ if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
+ return -EOPNOTSUPP;
+
+ percpu_ref_get(&ctx->refs);
+ ops->ctx = ctx;
+ ctx->bpf_ops = ops;
return 0;
}

static int bpf_io_reg(void *kdata, struct bpf_link *link)
{
- return -EOPNOTSUPP;
+ struct io_uring_ops *ops = kdata;
+ struct io_ring_ctx *ctx;
+ struct file *file;
+ int ret;
+
+ file = io_uring_register_get_file(ops->ring_fd, false);
+ if (IS_ERR(file))
+ return PTR_ERR(file);
+
+ ctx = file->private_data;
+ scoped_guard(mutex, &ctx->uring_lock)
+ ret = io_register_bpf_ops(ctx, ops);
+
+ fput(file);
+ return ret;
}

static void bpf_io_unreg(void *kdata, struct bpf_link *link)
{
+ struct io_uring_ops *ops = kdata;
+ struct io_ring_ctx *ctx;
+
+ guard(mutex)(&io_bpf_ctrl_mutex);
+
+ ctx = ops->ctx;
+ ops->ctx = NULL;
+
+ if (ctx) {
+ scoped_guard(mutex, &ctx->uring_lock) {
+ if (ctx->bpf_ops == ops)
+ ctx->bpf_ops = NULL;
+ }
+ percpu_ref_put(&ctx->refs);
+ }
}

void io_unregister_bpf_ops(struct io_ring_ctx *ctx)
{
+ struct io_uring_ops *ops;
+
+ guard(mutex)(&io_bpf_ctrl_mutex);
+ guard(mutex)(&ctx->uring_lock);
+
+ ops = ctx->bpf_ops;
+ ctx->bpf_ops = NULL;
+
+ if (ops && ops->ctx) {
+ percpu_ref_put(&ctx->refs);
+ ops->ctx = NULL;
+ }
}

static struct bpf_struct_ops bpf_io_uring_ops = {
diff --git a/io_uring/bpf.h b/io_uring/bpf.h
index a61c489d306b..4b147540d006 100644
--- a/io_uring/bpf.h
+++ b/io_uring/bpf.h
@@ -8,6 +8,9 @@
#include "io_uring.h"

struct io_uring_ops {
+ __u32 ring_fd;
+
+ struct io_ring_ctx *ctx;
};

static inline bool io_bpf_attached(struct io_ring_ctx *ctx)
--
2.49.0



Return-Path: <linux-kernel+bounces-675842-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0D86A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:58:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 24817166AF5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:58:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7910D28A1F9;
Fri, 6 Jun 2025 13:56:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DnkOUMVy"
Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAAAE289E1B;
Fri, 6 Jun 2025 13:56:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218212; cv=none; b=X9ij/VJ43QFH85MJa42KqbBZyRcFIKnEen4Q7FxSHr+0wZ/42TzIC4fP+H/iGZUoGh5MYmgEntfSiPDERwTOZ2aeQnvAxP3kTZnZO5AEwhjmBC121zuPesggDuXTdVidEtqIBA1IiDXqjlvhqATfKT2xR7f/VAKf6o13a7/4V1g=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218212; c=relaxed/simple;
bh=6XuUXclfgoEKljVaIZCM2rGLK7pYyEG8d9ML+mCyG1I=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=c8sWQeZybx4SgeC5ivSoCFmT0aMIP5mPJ8lJP4NtOuVk5mDkHm3A2D0KOrYhDUzCFV+kPIKWtBrlY/LIB+xzFRJwVZ6Jp9KcuHaEDyR7YHe0RpECUbuyiUSTQgywD3oOY3CvtNYiytiOskKzt51rWB9K0ZgCyftyGl2ibuOVmAc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DnkOUMVy; arc=none smtp.client-ip=209.85.218.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-adb2bd27c7bso342193466b.2;
Fri, 06 Jun 2025 06:56:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749218209; x=1749823009; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=fvUd63Qr4Uj7TI50ZVFoqkRT4E5BfeemVFyk/+/NcyI=;
b=DnkOUMVyYh1qZ84LvYOqpK1J2zChMvMwTvckKYCvF1xYzdk+2FM8KhwbRpmlJ0qWvl
Vkj62lwzFc0TLLxgBgc/XTNmwqPPDgLobrQUbX9MqwgLSQeSNN7Sif9VhakHUbxg/lAw
iGU43ok02uwgcrehgtbzAUdq6A5u4CdBfYWZGDozPCYG8KfKHUmd+YXQYv3qusnBp8Fj
OMlBV6KViefJ4ksoW1xjC41Zq31MRLrNMbRgh35SZVjw1dHac8ixa/ChpyAPVA2XyQpy
m7XJtbbxHIk3Hzx2Yz2Flw4WHnjWjJjPDPKAq+InfTR+/FZuiiCX6fNFl0xgyJStSup4
Yf+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218209; x=1749823009;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=fvUd63Qr4Uj7TI50ZVFoqkRT4E5BfeemVFyk/+/NcyI=;
b=s3KQwRzx5/HLvFYNva5IZQN4dy27quNZojJWY/6XsnpmlhAOJ7UzHlmbI7VVnA1/CV
u5euLbPM3qdkMOVPzuRUn2sChmLvJESbPmJEA01eGOmV1yV9qBPqR+THcBMHbDWtc/rS
az4c5u3Nk7vqNO38xOOwEM3tl9adC0Luo1iBhU15nC6iCSpKSdppWFNU+Sad9LL8MY1x
VupuCgF89K7vdyoTgsRShlmStBqfsUXz83wNNG0guNGYHRqyle7ihXNKK8Y131L5y4N/
vleD0czanNdVRHXFG4WtXDAe8sLzDr6SrzPF+IKWT3r0hIvJpGL6m4LqNCN+tL0qmLEW
LBfA==
X-Forwarded-Encrypted: i=1; AJvYcCWr4eHgZFaUGz0CBfI3AQrc7qpbbw2Z64KOJCMI7TbeOZ6X0KSRMyAtcAJv9veUiHxTYe0=@vger.kernel.org, AJvYcCXDX++ZsAA7+Pss/HOnDRSFBjtcHbcwu9fBk/BBfo4T49cH0dLfk2YjcwvIJUhyUd27aKReOVEb7LMzmGwp@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yw4ZMCFQ58tiiu9inXW0GsNrzB//gggiClnhDHvtxjfMNhq295a
1Sj5wn8ixGQL4Su6cDvbFvJQnxD731ZN4InGr37yF6/ttFjOkZkwghEXpdl65w==
X-Gm-Gg: ASbGnctKo1l2EziC4vshnllekvOs1TCAgyrUWxWyLTAUhyVlBXa/xx2pRxLlZY1NspR
M3tVB3iWKYCQjWW64Ay1/VBuS2ASxo+hI6dX7nNB1N65a7Y5y/a/F8kCXVnG2xMCjNL98vbbsTj
laWpZ9EMn+W0ff7dscEWuVM+rcxAWTqGo8DjxjfA5XG0csvds/zQFOLvcSl4QBnVS9X9omz+Yie
2ZDqpR+fHiHQhP/7RBSpkjTB1x6vHtwu+Dn9Le+iDwSNS3E5pI7Qvn/0Y4769+n9dUWqdt+2fMv
kT0oxZlb+zIcLaPjDlNftwPW62ZhqJ5UY8XxuvwOCSVjyw==
X-Google-Smtp-Source: AGHT+IEsx3hUnaelYT0aEIVsQCZHO0xm/AdKQqvAEwfCIS6P16J6XswUGs8Rz+chBLEDz7p9hGnd/g==
X-Received: by 2002:a17:907:5ce:b0:adb:469d:223b with SMTP id a640c23a62f3a-ade1aa469bbmr277091866b.49.1749218208386;
Fri, 06 Jun 2025 06:56:48 -0700 (PDT)
Received: from 127.com ([2620:10d:c092:600::1:a199])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc379f6sm118026766b.110.2025.06.06.06.56.47
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:56:47 -0700 (PDT)
From: Pavel Begunkov <asml.silence@xxxxxxxxx>
To: io-uring@xxxxxxxxxxxxxxx
Cc: asml.silence@xxxxxxxxx,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [RFC v2 5/5] io_uring/bpf: add basic kfunc helpers
Date: Fri, 6 Jun 2025 14:58:02 +0100
Message-ID: <c4de7ed6e165f54e2166e84bc88632887d87cfdf.1749214572.git.asml.silence@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <cover.1749214572.git.asml.silence@xxxxxxxxx>
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

A handle_events program should be able to parse the CQ and submit new
requests, add kfuncs to cover that. The only essential kfunc here is
bpf_io_uring_submit_sqes, and the rest are likely be removed in a
non-RFC version in favour of a more general approach.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
io_uring/bpf.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)

diff --git a/io_uring/bpf.c b/io_uring/bpf.c
index f86b12f280e8..9494e4289605 100644
--- a/io_uring/bpf.c
+++ b/io_uring/bpf.c
@@ -1,12 +1,92 @@
#include <linux/mutex.h>
#include <linux/bpf_verifier.h>

+#include "io_uring.h"
#include "bpf.h"
#include "register.h"

static const struct btf_type *loop_state_type;
DEFINE_MUTEX(io_bpf_ctrl_mutex);

+__bpf_kfunc_start_defs();
+
+__bpf_kfunc int bpf_io_uring_submit_sqes(struct io_ring_ctx *ctx,
+ unsigned nr)
+{
+ return io_submit_sqes(ctx, nr);
+}
+
+__bpf_kfunc int bpf_io_uring_post_cqe(struct io_ring_ctx *ctx,
+ u64 data, u32 res, u32 cflags)
+{
+ bool posted;
+
+ posted = io_post_aux_cqe(ctx, data, res, cflags);
+ return posted ? 0 : -ENOMEM;
+}
+
+__bpf_kfunc int bpf_io_uring_queue_sqe(struct io_ring_ctx *ctx,
+ void *bpf_sqe, int mem__sz)
+{
+ unsigned tail = ctx->rings->sq.tail;
+ struct io_uring_sqe *sqe;
+
+ if (mem__sz != sizeof(*sqe))
+ return -EINVAL;
+
+ ctx->rings->sq.tail++;
+ tail &= (ctx->sq_entries - 1);
+ /* double index for 128-byte SQEs, twice as long */
+ if (ctx->flags & IORING_SETUP_SQE128)
+ tail <<= 1;
+ sqe = &ctx->sq_sqes[tail];
+ memcpy(sqe, bpf_sqe, sizeof(*sqe));
+ return 0;
+}
+
+__bpf_kfunc
+struct io_uring_cqe *bpf_io_uring_get_cqe(struct io_ring_ctx *ctx, u32 idx)
+{
+ unsigned max_entries = ctx->cq_entries;
+ struct io_uring_cqe *cqe_array = ctx->rings->cqes;
+
+ if (ctx->flags & IORING_SETUP_CQE32)
+ max_entries *= 2;
+ return &cqe_array[idx & (max_entries - 1)];
+}
+
+__bpf_kfunc
+struct io_uring_cqe *bpf_io_uring_extract_next_cqe(struct io_ring_ctx *ctx)
+{
+ struct io_rings *rings = ctx->rings;
+ unsigned int mask = ctx->cq_entries - 1;
+ unsigned head = rings->cq.head;
+ struct io_uring_cqe *cqe;
+
+ /* TODO CQE32 */
+ if (head == rings->cq.tail)
+ return NULL;
+
+ cqe = &rings->cqes[head & mask];
+ rings->cq.head++;
+ return cqe;
+}
+
+__bpf_kfunc_end_defs();
+
+BTF_KFUNCS_START(io_uring_kfunc_set)
+BTF_ID_FLAGS(func, bpf_io_uring_submit_sqes, KF_SLEEPABLE);
+BTF_ID_FLAGS(func, bpf_io_uring_post_cqe, KF_SLEEPABLE);
+BTF_ID_FLAGS(func, bpf_io_uring_queue_sqe, KF_SLEEPABLE);
+BTF_ID_FLAGS(func, bpf_io_uring_get_cqe, 0);
+BTF_ID_FLAGS(func, bpf_io_uring_extract_next_cqe, KF_RET_NULL);
+BTF_KFUNCS_END(io_uring_kfunc_set)
+
+static const struct btf_kfunc_id_set bpf_io_uring_kfunc_set = {
+ .owner = THIS_MODULE,
+ .set = &io_uring_kfunc_set,
+};
+
static int io_bpf_ops__handle_events(struct io_ring_ctx *ctx,
struct iou_loop_state *state)
{
@@ -186,6 +266,12 @@ static int __init io_uring_bpf_init(void)
return ret;
}

+ ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
+ &bpf_io_uring_kfunc_set);
+ if (ret) {
+ pr_err("io_uring: Failed to register kfuncs (%d)\n", ret);
+ return ret;
+ }
return 0;
}
__initcall(io_uring_bpf_init);
--
2.49.0



Return-Path: <linux-kernel+bounces-675841-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2B03741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:58:23 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4BA603A80D5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:57:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B24D328A1D3;
Fri, 6 Jun 2025 13:56:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B7pSYukq"
Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF6EB28982F;
Fri, 6 Jun 2025 13:56:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218211; cv=none; b=s1/ctQrInS2/oPXUZWH9fdPC2WkEca0p49kwcCORYwLmmf30EhPPnzdX+aR9saC2ZuCdE9GozREtoUcY1GE9OWzDdJ6FJWCBTDgBBQLTxnJ4w4Q2O0xAy12yfrcXjGz4ajbjGiwEbtWN7WavZz6YQzEPXqhGjW3dYsf1ZtYbCBA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218211; c=relaxed/simple;
bh=vyzsuUe/QoAXkeVTMOIyADJGcnKpwPxlUrNT3H0G/r4=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=IENpXJ8DQHVRmUTM7ts18oQcMSTNwaifQuE/55rX7sI8VMHoJZK7Lkyq230srCiPZQl/72odFjD4+2nAhdg+AyAMij684VKDCZEl9gqypn5kjGJw0H+tTlcOIF+nOJLIdvyhRJsuxw/VOavW55kmhzNfr/G4nqUV0sD/OBveXNU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=B7pSYukq; arc=none smtp.client-ip=209.85.218.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-ad574992fcaso345701866b.1;
Fri, 06 Jun 2025 06:56:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749218208; x=1749823008; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=ITjrjjEaCa6jkl2+7O9bYXssPOa5x6lyf9m6vXE7lKo=;
b=B7pSYukqGpPluOq0PQ5dnlDqae7bql+vv1OOoXfXN+2k81qDgVQYdVE9L4AcINhQkS
cspNpdnLiHa7MLIY4olsVKqWCDBk10/VTmK1Vq+wgOrLJnLHcjgK04QlgH3ru4VOieXy
kHftr/oeFZeRdSETsGTlplWgT47TC5EL7+9NJApkRUDEyknGc/k43brFUUjei9UqePkk
SAfgNplQtjtOrwC6YDEQ/UsFXA28V8ygWFvG+P790dKxERcbxTyWSBQsOqfLfquWA2d2
fNn3qMLefUhMHIlzXE7qvDc0NXBawLdkPYV1FqIjj7X8UaH2G57emQgu5ALCHlIe/dfE
IoQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218208; x=1749823008;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ITjrjjEaCa6jkl2+7O9bYXssPOa5x6lyf9m6vXE7lKo=;
b=Q7vOsKvxDwAiznNxzssR+ny/kYP354oWYTfNs0AcqFtqvvvovfSLUqC1ljvT/sDF+L
AYxb+nHwJ+TQS4t8x7dQ/SNwYbC3GFP6wYlHRqEEU/axsr/tBOnORnnrDQJhuzugsMCH
rbq7LJAKk5LKT4swmxIE9mkAz4yln2zv2vM90WXB2oPYA+m8sxShWmoIprIgY13p0BCX
eUGK12hS+83BM5quTNUZ/bdxYXYf8gJGCOgEL7sHicCZPGEVrAhGWXlqCPTpOFZeBS/O
0JlFIDK95ThrQNMEHNqnvdGewpJfC09vs9xCYtbisQvF3FBJYzjjt8F13UE6HhRI/7O3
nNcQ==
X-Forwarded-Encrypted: i=1; AJvYcCU/8Ym6YjxvtKAHBjX8zTeW5yroHnfAxdbXrFSBjQOEsS84guRTeYsXHaSH7HdViB0m/ykjF6EPkHOQRZUp@xxxxxxxxxxxxxxx, AJvYcCX2EWo2xQQCXQcNORL/d+GILxzEhJctQzAPsbRmS0CDAzmcwXf48DauAPG2I1Bi+NxFMYI=@vger.kernel.org
X-Gm-Message-State: AOJu0YwTx1jaLth27yH/pbiClktTpbi9XvrpgO7MMCOK8l9jafP5c8cl
IShGjYm7FojYyaQakDCxGyRaGyicRVVssJl8fNtxFpM0kKM7xbhDSzZHu8zQuA==
X-Gm-Gg: ASbGnctj6VCFcSyBRbrsni1fIQnyG5Wv7ficrErA+nHM5AV/yeT4CVU1caW6iSMsknT
YLSG7n92MxvTfowYXEUU7IAdHi3A9z2CHxk7AN1SB/onuCSGBOuksIDMpVXGy6Txs59XPmsWGrx
VUt95bhWZ+B8c60Ek7J2RFfM99v0HrcNFnTLU5vwqaQ3JjPunNWrvz3akZDasy3czPfX8DvX9J8
0lQcfvDOr4cHUEL/j+lD5pokGEaIjaIVe+FypIQWnGA6P3m2j6d6HD2MBsE36omSdO8x2gPQSHP
g44S4yezafMZaO8WChF8Pu0+1ZrkpRyYSqKE4XahDcvTlA==
X-Google-Smtp-Source: AGHT+IGsUtjamJY1/YfeofcK8ePS5kIlouljaSgzZkJheAWEKgdEXxo+ryEhnG2pmsRJYFP2dr341g==
X-Received: by 2002:a17:907:9813:b0:adb:2bb2:ee2 with SMTP id a640c23a62f3a-ade1aa0c2bfmr326963666b.41.1749218207331;
Fri, 06 Jun 2025 06:56:47 -0700 (PDT)
Received: from 127.com ([2620:10d:c092:600::1:a199])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc379f6sm118026766b.110.2025.06.06.06.56.46
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 06:56:46 -0700 (PDT)
From: Pavel Begunkov <asml.silence@xxxxxxxxx>
To: io-uring@xxxxxxxxxxxxxxx
Cc: asml.silence@xxxxxxxxx,
Martin KaFai Lau <martin.lau@xxxxxxxxx>,
bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [RFC v2 4/5] io_uring/bpf: add handle events callback
Date: Fri, 6 Jun 2025 14:58:01 +0100
Message-ID: <1c8fcadfb605269011618e285a4d9e066542dba2.1749214572.git.asml.silence@xxxxxxxxx>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <cover.1749214572.git.asml.silence@xxxxxxxxx>
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add a struct_ops callback called handle_events, which will be called
off the CQ waiting loop every time there is an event that might be
interesting to the program. The program takes the io_uring ctx and also
a loop state, which it can use to set the number of events it wants to
wait for as well as the timeout value.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
io_uring/bpf.c | 33 +++++++++++++++++++++++++++++++++
io_uring/bpf.h | 16 ++++++++++++++++
io_uring/io_uring.c | 22 +++++++++++++++++++++-
3 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/io_uring/bpf.c b/io_uring/bpf.c
index 0f82acf09959..f86b12f280e8 100644
--- a/io_uring/bpf.c
+++ b/io_uring/bpf.c
@@ -1,11 +1,20 @@
#include <linux/mutex.h>
+#include <linux/bpf_verifier.h>

#include "bpf.h"
#include "register.h"

+static const struct btf_type *loop_state_type;
DEFINE_MUTEX(io_bpf_ctrl_mutex);

+static int io_bpf_ops__handle_events(struct io_ring_ctx *ctx,
+ struct iou_loop_state *state)
+{
+ return IOU_EVENTS_STOP;
+}
+
static struct io_uring_ops io_bpf_ops_stubs = {
+ .handle_events = io_bpf_ops__handle_events,
};

static bool bpf_io_is_valid_access(int off, int size,
@@ -27,6 +36,16 @@ static int bpf_io_btf_struct_access(struct bpf_verifier_log *log,
const struct bpf_reg_state *reg, int off,
int size)
{
+ const struct btf_type *t = btf_type_by_id(reg->btf, reg->btf_id);
+
+ if (t == loop_state_type) {
+ if (off >= offsetof(struct iou_loop_state, target_cq_tail) &&
+ off + size <= offsetofend(struct iou_loop_state, target_cq_tail))
+ return SCALAR_VALUE;
+ if (off >= offsetof(struct iou_loop_state, timeout) &&
+ off + size <= offsetofend(struct iou_loop_state, timeout))
+ return SCALAR_VALUE;
+ }
return -EACCES;
}

@@ -36,8 +55,22 @@ static const struct bpf_verifier_ops bpf_io_verifier_ops = {
.btf_struct_access = bpf_io_btf_struct_access,
};

+static const struct btf_type *
+io_lookup_struct_type(struct btf *btf, const char *name)
+{
+ s32 type_id;
+
+ type_id = btf_find_by_name_kind(btf, name, BTF_KIND_STRUCT);
+ if (type_id < 0)
+ return NULL;
+ return btf_type_by_id(btf, type_id);
+}
+
static int bpf_io_init(struct btf *btf)
{
+ loop_state_type = io_lookup_struct_type(btf, "iou_loop_state");
+ if (!loop_state_type)
+ return -EINVAL;
return 0;
}

diff --git a/io_uring/bpf.h b/io_uring/bpf.h
index 4b147540d006..ac4a9361f9c7 100644
--- a/io_uring/bpf.h
+++ b/io_uring/bpf.h
@@ -7,12 +7,28 @@

#include "io_uring.h"

+enum {
+ IOU_EVENTS_WAIT,
+ IOU_EVENTS_STOP,
+};
+
struct io_uring_ops {
__u32 ring_fd;

+ int (*handle_events)(struct io_ring_ctx *ctx, struct iou_loop_state *state);
+
struct io_ring_ctx *ctx;
};

+static inline int io_run_bpf(struct io_ring_ctx *ctx, struct iou_loop_state *state)
+{
+ scoped_guard(mutex, &ctx->uring_lock) {
+ if (!ctx->bpf_ops)
+ return IOU_EVENTS_STOP;
+ return ctx->bpf_ops->handle_events(ctx, state);
+ }
+}
+
static inline bool io_bpf_attached(struct io_ring_ctx *ctx)
{
return IS_ENABLED(CONFIG_BPF) && ctx->bpf_ops != NULL;
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 8f68e898d60c..bf245be0844b 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2540,8 +2540,13 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, u32 flags,

if (unlikely(test_bit(IO_CHECK_CQ_OVERFLOW_BIT, &ctx->check_cq)))
io_cqring_do_overflow_flush(ctx);
- if (__io_cqring_events_user(ctx) >= min_events)
+
+ if (io_bpf_attached(ctx)) {
+ if (ext_arg->min_time)
+ return -EINVAL;
+ } else if (__io_cqring_events_user(ctx) >= min_events) {
return 0;
+ }

init_waitqueue_func_entry(&iowq.wq, io_wake_function);
iowq.wq.private = current;
@@ -2621,6 +2626,21 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, u32 flags,
if (ret < 0)
break;

+ if (io_bpf_attached(ctx)) {
+ ret = io_run_bpf(ctx, &iowq.state);
+ if (ret != IOU_EVENTS_WAIT)
+ break;
+
+ if (unlikely(read_thread_flags())) {
+ if (task_sigpending(current)) {
+ ret = -EINTR;
+ break;
+ }
+ cond_resched();
+ }
+ continue;
+ }
+
check_cq = READ_ONCE(ctx->check_cq);
if (unlikely(check_cq)) {
/* let the caller flush overflows, retry */
--
2.49.0



Return-Path: <linux-kernel+bounces-675843-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7C7C141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:59:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 167E73AAAB0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:58:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 17DDA28A419;
Fri, 6 Jun 2025 13:57:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=hansenpartnership.com header.i=@hansenpartnership.com header.b="sT56Obop"
Received: from lamorak.hansenpartnership.com (lamorak.hansenpartnership.com [198.37.111.173])
(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 C7019289377;
Fri, 6 Jun 2025 13:56:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.37.111.173
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218221; cv=none; b=JsNau9Rc1JqBj4RbJi5Sdo0jSyGH5zrX9PqYONpb6MUpNnYKDIat53S/FfGPsynbHxIVKnoQ0itwq9gMC624dreelnSzgxgR1X6rRaufSKynhU2/McQXKtIv6FBwDiMr+qg8Ip3x+LiP5+3IrziI/JKhvJwXcd+asQVXcs/uqGo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218221; c=relaxed/simple;
bh=/1A025lXNtz4EqacED2aEnZgxsk0Idtg7kLaIV43aFA=;
h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:MIME-Version; b=vDT6iMgzI1lVbdKZpgv1HZq7EnYjC/xBeuUyPMtsVS+zTHJlJDpES5/2sqm8e4RQGYQ4vAayqo2dlw6VAgLRImT8O3TgZtysHMaBO7RXKEkikDLLpwfJkOR1/2tX5w4D8W6gzsQAmWOS5tuoxD0b98VbWgDYRgg5pmTH48Jc+AE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=HansenPartnership.com; spf=pass smtp.mailfrom=HansenPartnership.com; dkim=pass (1024-bit key) header.d=hansenpartnership.com header.i=@hansenpartnership.com header.b=sT56Obop; arc=none smtp.client-ip=198.37.111.173
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=HansenPartnership.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=HansenPartnership.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=hansenpartnership.com; s=20151216; t=1749218217;
bh=/1A025lXNtz4EqacED2aEnZgxsk0Idtg7kLaIV43aFA=;
h=Message-ID:Subject:From:To:Date:In-Reply-To:References:From;
b=sT56ObopHbUV7yMYiPWo0KeJuG224Sgijnu8qpHxQ4P63Li9O0GTDitb95xkitJYP
/WYgTGywdlSdEMH5CRgEfbU92R07DfBKrlybwRMN95+vU90+8Ljuk6YxP9Uf3r1dUb
t3Bst9iTcCUoRX5RVq1UbJqRf/a5OAbKGUqtyGUY=
Received: from [IPv6:2601:5c4:4302:c21::a774] (unknown [IPv6:2601:5c4:4302:c21::a774])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by lamorak.hansenpartnership.com (Postfix) with ESMTPSA id AD67E1C034C;
Fri, 06 Jun 2025 09:56:56 -0400 (EDT)
Message-ID: <f8c39fe043d3548cffc376c7c014d45db70cd7af.camel@xxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Large modules with 6.15 [was: [PATCH v4 6/6] percpu/x86: Enable
strict percpu checks via named AS qualifiers]
From: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
To: Uros Bizjak <ubizjak@xxxxxxxxx>, Jiri Slaby <jirislaby@xxxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxx>, x86@xxxxxxxxxx, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-bcachefs@xxxxxxxxxxxxxxx,
linux-arch@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, Nadav Amit
<nadav.amit@xxxxxxxxx>, Dennis Zhou <dennis@xxxxxxxxxx>, Tejun Heo
<tj@xxxxxxxxxx>, Christoph Lameter <cl@xxxxxxxxx>, Thomas Gleixner
<tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov
<bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin"
<hpa@xxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Andy
Lutomirski <luto@xxxxxxxxxx>, Brian Gerst <brgerst@xxxxxxxxx>, Peter
Zijlstra <peterz@xxxxxxxxxxxxx>, Shung-Hsi Yu <shung-hsi.yu@xxxxxxxx>,
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
Date: Fri, 06 Jun 2025 09:56:56 -0400
In-Reply-To: <CAFULd4Zf4FOP-h0GVYo=frJ90tF07yvbuLbngnqUwyx9x+qz6w@xxxxxxxxxxxxxx>
References: <20250127160709.80604-1-ubizjak@xxxxxxxxx>
<20250127160709.80604-7-ubizjak@xxxxxxxxx>
<02c00acd-9518-4371-be2c-eb63e5d11d9c@xxxxxxxxxx>
<b27d96fc-b234-4406-8d6e-885cd97a87f3@xxxxxxxxx>
<CAFULd4Ygz8p8rD1=c-S2MjJniP6vjVNMsWG_B=OjCVpthk0fBg@xxxxxxxxxxxxxx>
<9767d411-81dc-491b-b6da-419240065ffe@xxxxxxxxxx>
<CAFULd4Zf4FOP-h0GVYo=frJ90tF07yvbuLbngnqUwyx9x+qz6w@xxxxxxxxxxxxxx>
Autocrypt: addr=James.Bottomley@xxxxxxxxxxxxxxxxxxxxx;
prefer-encrypt=mutual;
keydata=mQENBE58FlABCADPM714lRLxGmba4JFjkocqpj1/6/Cx+IXezcS22azZetzCXDpm2MfNElecY3qkFjfnoffQiw5rrOO0/oRSATOh8+2fmJ6el7naRbDuh+i8lVESfdlkoqX57H5R8h/UTIp6gn1mpNlxjQv6QSZbl551zQ1nmkSVRbA5TbEp4br5GZeJ58esmYDCBwxuFTsSsdzbOBNthLcudWpJZHURfMc0ew24By1nldL9F37AktNcCipKpC2U0NtGlJjYPNSVXrCd1izxKmO7te7BLP+7B4DNj1VRnaf8X9+VIApCi/l4Kdx+ZR3aLTqSuNsIMmXUJ3T8JRl+ag7kby/KBp+0OpotABEBAAG0N0phbWVzIEJvdHRvbWxleSA8SmFtZXMuQm90dG9tbGV5QEhhbnNlblBhcnRuZXJzaGlwLmNvbT6JAVgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAhkBFiEE1WBuc8i0YnG+rZrfgUrkfCFIVNYFAmBLmY0FCRs1hL0ACgkQgUrkfCFIVNaEiQgAg18F4G7PGWQ68xqnIrccke7Reh5thjUz6kQIii6Dh64BDW6/UvXn20UxK2uSs/0TBLO81k1mV4c6rNE+H8b7IEjieGR9frBsp/+Q01JpToJfzzMUY7ZTDV1IXQZ+AY9L7vRzyimnJHx0Ba4JTlAyHB+Ly5i4Ab2+uZcnNfBXquWrG3oPWz+qPK88LJLya5Jxse1m1QT6R/isDuPivBzntLOooxPk+Cwf5sFAAJND+idTAzWzslexr9j7rtQ1UW6FjO4CvK9yVNz7dgG6FvEZl6J/HOr1rivtGgpCZTBzKNF8jg034n49zGfKkkzWLuXbPUOp3/oGfsKv8pnEu1c2GbQpSmFtZXMgQm90dG9tbGV5IDxqZWpiQGxpbnV4LnZuZXQuaWJtLmNvbT6JAVYEEwEIAEACGwMHCwkIBwMCAQYVC
AIJCgsEFgIDAQIeAQIXgBYhBNVgbnPItGJxvq2a34FK5HwhSFTWBQJgS5mXBQkbNYS9AAoJEIFK5HwhSFTWEYEH/1YZpV+1uCI2MVz0wTRlnO/3OW/xnyigrw+K4cuO7MToo0tHJb/qL9CBJ2ddG6q+GTnF5kqUe87t7M7rSrIcAkIZMbJmtIbKk0j5EstyYqlE1HzvpmssGpg/8uJBBuWbU35af1ubKCjUs1+974mYXkfLmS0a6h+cG7atVLmyClIc2frd3o0zHF9+E7BaB+HQzT4lheQAXv9KI+63ksnbBpcZnS44t6mi1lzUE65+Am1z+1KJurF2Qbj4AkICzJjJa0bXa9DmFunjPhLbCU160LppaG3OksxuNOTkGCo/tEotDOotZNBYejWaXN2nr9WrH5hDfQ5zLayfKMtLSd33T9u0IUphbWVzIEJvdHRvbWxleSA8amVqYkBrZXJuZWwub3JnPokBVQQTAQgAPwIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AWIQTVYG5zyLRicb6tmt+BSuR8IUhU1gUCYEuZmAUJGzWEvQAKCRCBSuR8IUhU1gacCAC+QZN+RQd+FOoh5g884HQm8S07ON0/2EMiaXBiL6KQb5yP3w2PKEhug3+uPzugftUfgPEw6emRucrFFpwguhriGhB3pgWJIrTD4JUevrBgjEGOztJpbD73bLLyitSiPQZ6OFVOqIGhdqlc3n0qoNQ45n/w3LMVj6yP43SfBQeQGEdq4yHQxXPs0XQCbmr6Nf2p8mNsIKRYf90fCDmABH1lfZxoGJH/frQOBCJ9bMRNCNy+aFtjd5m8ka5M7gcDvM7TAsKhD5O5qFs4aJHGajF4gCGoWmXZGrISQvrNl9kWUhgsvoPqb2OTTeAQVRuV8C4FQamxzE3MRNH25j6s/qujtCRKYW1lcyBCb3R0b21sZXkgPGplamJAbGludXguaWJtLmNvbT6JAVQEEwEIAD
4CGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AWIQTVYG5zyLRicb6tmt+BSuR8IUhU1gUCYEuZmQUJGzWEvQAKCRCBSuR8IUhU1kyHB/9VIOkf8RapONUdZ+7FgEpDgESE/y3coDeeb8jrtJyeefWCA0sWU8GSc9KMcMoSUetUreB+fukeVTe/f2NcJ87Bkq5jUEWff4qsbqf5PPM+wlD873StFc6mP8koy8bb7QcH3asH9fDFXUz7Oz5ubI0sE8+qD+Pdlk5qmLY5IiZ4D98V239nrKIhDymcuL7VztyWfdFSnbVXmumIpi79Ox536P2aMe3/v+1jAsFQOIjThMo/2xmLkQiyacB2veMcBzBkcair5WC7SBgrz2YsMCbC37X7crDWmCI3xEuwRAeDNpmxhVCb7jEvigNfRWQ4TYQADdC4KsilPfuW8Edk/8tPtCVKYW1lcyBCb3R0b21sZXkgPEpCb3R0b21sZXlAT2Rpbi5jb20+iQEfBDABAgAJBQJXI+B0Ah0gAAoJEIFK5HwhSFTWzkwH+gOg1UG/oB2lc0DF3lAJPloSIDBW38D3rezXTUiJtAhenWrH2Cl/ejznjdTukxOcuR1bV8zxR9Zs9jhUin2tgCCxIbrdvFIoYilMMRKcue1q0IYQHaqjd7ko8BHn9UysuX8qltJFar0BOClIlH95gdKWJbK46mw7bsXeD66N9IhAsOMJt6mSJmUdIOMuKy4dD4X3adegKMmoTRvHOndZQClTZHiYt5ECRPO534Lb/gyKAKQkFiwirsgx11ZSx3zGlw28brco6ohSLMBylna/Pbbn5hII86cjrCXWtQ4mE0Y6ofeFjpmMdfSRUxy6LHYd3fxVq9PoAJTv7vQ6bLTDFNa0KkphbWVzIEJvdHRvbWxleSA8SkJvdHRvbWxleUBQYXJhbGxlbHMuY29tPokBHwQwAQIACQUCVyPgjAIdIAAKCRCBSuR8IUhU1tXiB/9D9OOU8qB
CZPxkxB6ofp0j0pbZppRe6iCJ+btWBhSURz25DQzQNu5GVBRQt1Us6v3PPGU1cEWi5WL935nw+1hXPIVB3x8hElvdCO2aU61bMcpFd138AFHMHJ+emboKHblnhuY5+L1OlA1QmPw6wQooCor1h113lZiBZGrPFxjRYbWYVQmVaM6zhkiGgIkzQw/g9v57nAzYuBhFjnVHgmmu6/B0N8z6xD5sSPCZSjYSS38UG9w189S8HVr4eg54jReIEvLPRaxqVEnsoKmLisryyaw3EpqZcYAWoX0Am+58CXq3j5OvrCvbyqQIWFElba3Ka/oT7CnTdo/SUL/jPNobtCxKYW1lcyBCb3R0b21sZXkgPGplamJAaGFuc2VucGFydG5lcnNoaXAuY29tPokBVwQTAQgAQRYhBNVgbnPItGJxvq2a34FK5HwhSFTWBQJjg2eQAhsDBQkbNYS9BQsJCAcCAiICBhUKCQgLAgQWAgMBAh4HAheAAAoJEIFK5HwhSFTWbtAH/087y9vzXYAHMPbjd8etB/I3OEFKteFacXBRBRDKXI9ZqK5F/xvd1fuehwQWl2Y/sivD4cSAP0iM/rFOwv9GLyrr82pD/GV/+1iXt9kjlLY36/1U2qoyAczY+jsS72aZjWwcO7Og8IYTaRzlqif9Zpfj7Q0Q1e9SAefMlakI6dcZTSlZWaaXCefdPBCc7BZ0SFY4kIg0iqKaagdgQomwW61nJZ+woljMjgv3HKOkiJ+rcB/n+/moryd8RnDhNmvYASheazYvUwaF/aMj5rIb/0w5p6IbFax+wGF5RmH2U5NeUlhIkTodUF/P7g/cJf4HCL+RA1KU/xS9o8zrAOeut2+4UgRaZ7bmEwgqhkjOPQMBBwIDBH4GsIgL0yQij5S5ISDZmlR7qDQPcWUxMVx6zVPsAoITdjKFjaDmUATkS+l5zmiCrUBcJ6MBavPiYQ4kqn4/xwaJAbMEGAEIACYCGwIWIQTVYG5zyLRi
cb6tmt+BSuR8IUhU1gUCZag0LwUJDwLkSQCBdiAEGRMIAB0WIQTnYEDbdso9F2cI+arnQslM7pishQUCWme25gAKCRDnQslM7pishdi9AQDyOvLYOBkylBqiTlJrMnGCCsWgGZwPpKq3e3s7JQ/xBAEAlx29pPY5z0RLyIDUsjf9mtkSNTaeaQ6TIjDrFa+8XH8JEIFK5HwhSFTWkasH/j7LL9WH9dRfwfTwuMMj1/KGzjU/4KFIu4uKxDaevKpGS7sDx4F56mafCdGD8u4+ri6bJr/3mmuzIdyger0vJdRlTrnpX3ONXvR57p1JHgCljehE1ZB0RCzIk0vKhdt8+CDBQWfKbbKBTmzA7wR68raMQb2D7nQ9d0KXXbtr7Hag29yj92aUAZ/sFoe9RhDOcRUptdYyPKU1JHgJyc0Z7HwNjRSJ4lKJSKP+Px0/XxT3gV3LaDLtHuHa2IujLEAKcPzTr5DOV+xsgA3iSwTYI6H5aEe+ZRv/rA4sdjqRiVpo2d044aCUFUNQ3PiIHPAZR3KK5O64m6+BJMDXBvgSsMy4VgRaZ7clEggqhkjOPQMBBwIDBMfuMuE+PECbOoYjkD0Teno7TDbcgxJNgPV7Y2lQbNBnexMLOEY6/xJzRi1Xm/o9mOyZ+VIj8h4G5V/eWSntNkwDAQgHiQE8BBgBCAAmAhsMFiEE1WBuc8i0YnG+rZrfgUrkfCFIVNYFAmWoNBwFCQ8C4/cACgkQgUrkfCFIVNZs4AgAnIjU1QEPLdpotiy3X01sKUO+hvcT3/Cd6g55sJyKJ5/U0o3f8fdSn6MWPhi1m62zbAxcLJFiTZ3OWNCZAMEvwHrXFb684Ey6yImQ9gm2dG2nVuCzr1+9gIaMSBeZ+4kUJqhdWSJjrNLQG38GbnBuYOJUD+x6oJ2AT10/mQfBVZ3qWDQXr/je2TSf0OIXaWyG6meG5yTqOEv0eaTH22yBb1nbodoZkmlMMb56jzRGZuorhFE06
N0Eb0kiGz5cCIrHZoH10dHWoa7/Z+AzfL0caOKjcmsnUPcmcrqmWzJTEibLA81z15GBCrldfQVt+dF7Us2kc0hKUgaWeI8Gv4CzwLkCDQRUdhaZARAApeF9gbNSBBudW8xeMQIiB/CZwK4VOEP7nGHZn3UsWemsvE9lvjbFzbqcIkbUp2V6ExM5tyEgzio2BavLe1ZJGHVaKkL3cKLABoYi/yBLEnogPFzzYfK2fdipm2G+GhLaqfDxtAQ7cqXeo1TCsZLSvjD+kLVV1TvKlaHS8tUCh2oUyR7fTbv6WHi5H8DLyR0Pnbt9E9/Gcs1j11JX+MWJ7jset2FVDsB5U1LM70AjhXiDiQCtNJzKaqKdMei8zazWS50iMKKeo4m/adWBjG/8ld3fQ7/Hcj6Opkh8xPaCnmgDZovYGavw4Am2tjRqE6G6rPQpS0we5I6lSsKNBP/2FhLmI9fnsBnZC1l1NrASRSX1BK0xf4LYB2Ww3fYQmbbApAUBbWZ/1aQoc2ECKbSK9iW0gfZ8rDggfMw8nzpmEEExl0hU6wtJLymyDV+QGoPx5KwYK/6qAUNJQInUYz8z2ERM/HOI09Zu3jiauFBDtouSIraX/2DDvTf7Lfe1+ihARFSlp64kEMAsjKutNBK2u5oj4H7hQ7zD+BvWLHxMgysOtYYtwggweOrM/k3RndsZ/z3nsGqF0ggct1VLuH2eznDksI+KkZ3Bg0WihQyJ7Z9omgaQAyRDFct+jnJsv2Iza+xIvPei+fpbGNAyFvj0e+TsZoQGcC34/ipGwze651UAEQEAAYkBHwQoAQIACQUCVT6BaAIdAwAKCRCBSuR8IUhU1p5QCAC7pgjOM17Hxwqz9mlGELilYqjzNPUoZt5xslcTFGxj/QWNzu0K8gEQPePnc5dTfumzWL077nxhdKYtoqwm2C6fOmXiJBZx6khBfRqctUvN2DlOB6dFf5I+1QT9TRBvceGzw01E4Gi0xjWKAB6OII
MAdnPcDVFzaXJdlAAJdjfg/lyJtAyxifflG8NnXJ3elwGqoBso84XBNWWzbc5VKmatzhYLOvXtfzDhu4mNPv/z7S1HTtRguI0NlH5RVBzSvfzybin9hysE3/+r3C0HJ2xiOHzucNAmG03aztzZYDMTbKQW4bQqeD5MJxT68vBYu8MtzfIe41lSLpb/qlwq1qg0iQElBBgBAgAPBQJUdhaZAhsMBQkA7U4AAAoJEIFK5HwhSFTW3YgH/AyJL2rlCvGrkLcas94ND9Pmn0cUlVrPl7wVGcIV+6I4nrw6u49TyqNMmsYam2YpjervJGgbvIbMzoHFCREi6R9XyUsw5w7GCRoWegw2blZYi5A52xe500+/RruG//MKfOtVUotu3N+u7FcXaYAg9gbYeGNZCV70vI+cnFgq0AEJRdjidzfCWVKPjafTo7jHeFxX7Q22kUfWOkMzzhoDbFg0jPhVYNiEXpNyXCwirzvKA7bvFwZPlRkbfihaiXDE7QKIUtQ10i5kw4C9rqDKwx8F0PaWDRF9gGaKd7/IJGHJaac/OcSJ36zxgkNgLsVX5GUroJ2GaZcR7W9Vppj5H+C4UgRkuRyTEwgqhkjOPQMBBwIDBOySomnsW2SkApXv1zUBaD38dFEj0LQeDEMdSE7bm1fnrdjAYt0f/CtbUUiDaPodQk2qeHzOP6wA/2K6rrjwNIWJAT0EGAEIACcDGyAEFiEE1WBuc8i0YnG+rZrfgUrkfCFIVNYFAmWoM/gFCQSxfmUACgkQgUrkfCFIVNZhTgf/VQxtQ5rgu2aoXh2KOH6naGzPKDkYDJ/K7XCJAq3nJYEpYN8G+F8mL/ql0hrihAsHfjmoDOlt+INa3AcG3v0jDZIMEzmcjAlu7g5NcXS3kntcMHgw3dCgE9eYDaKGipUCubdXvBaZWU6AUlTldaB8FE6u7It7+UO+IW4/L+KpLYKs8V5POInu2rqahlm7vgxY5iv4Txz4EvCW2e4dAlG
8mT2Eh9SkH+YVOmaKsajgZgrBxA7fWmGoxXswEVxJIFj3vW7yNc0C5HaUdYa5iGOMs4kg2ht4s7yy7NRQuh7BifWjo6BQ6k4S1H+6axZucxhSV1L6zN9d+lr3Xo/vy1unzA==
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.50.3
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 2025-06-06 at 11:27 +0200, Uros Bizjak wrote:
> On Fri, Jun 6, 2025 at 11:17=E2=80=AFAM Jiri Slaby <jirislaby@xxxxxxxxxx>
> wrote:
[...]
> > Given this is the second time I hit a bug with this, perhaps
> > introduce an EXPERIMENTAL CONFIG option, so that random users can
> > simply disable it if an issue occurs? Without the need of patching
> > random userspace and changing random kernel headers?
>=20
> In both cases, the patch *exposed* a bug in a related utility
> software, it is not that the patch itself is buggy. IMO, waving off
> the issue by disabling the feature you just risk the bug in the
> related software to hit even harder in some not too distant future.

Given the severity of the problem absent tools updates the usual way of
handling this is a (sometimes partial) revert for the estimated time to
fix the tool chain followed by a resend. This is exactly what we did
when an efivarfs bug fixe exposed a bug in the firmware update service:

https://lore.kernel.org/all/ffd953c76d3a0bc0f88aeb319589632e8da032dc.camel@=
HansenPartnership.com/

It only took about 3 months to get the update through the distros, what
would the estimate for this be?

Regards,

James



Return-Path: <linux-kernel+bounces-675844-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 40EC041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 09:59:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id E85893ABEA1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:58:47 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 39A7528981C;
Fri, 6 Jun 2025 13:57:12 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EE7D52882BE
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:57:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218231; cv=none; b=IYTtWUrqT3Rdcd+CNtFwfDef94GDgYPH9qrL1cJDTHoJJ+3NVIlfTQQay2UvMWR7kBbEENl5FFfCsDxedIpBWUnx3jiClI9fLzxZRcqpzjHqUW6SpzL3c6XS3BxPDlNDoJoGUUSqdiQiRCjZl48/5mMs2cU+dz98daaOVKdmTYk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218231; c=relaxed/simple;
bh=XB/UgigNUmGAZKktVNs+Fg1uDhJkrQLmbeVDMp4Gve8=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uDg4pKR1t4kpxQ0dpr6nF6xkiVNRGxpZNZIZtZY8iGsohzgo6RxPOzwhItCoQYG+kC7SU9xnXiQILE+bZ9vKdabj+a09rzuG6hSJpWEzOeNqGAtqdZetZt9+a9pa/vHQkk6JG2O4xKS4J5I/CA+Jc7UpLDs3hYGHh9BsyO4G3DY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA1F9152B;
Fri, 6 Jun 2025 06:56:44 -0700 (PDT)
Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B6CDD3F673;
Fri, 6 Jun 2025 06:57:01 -0700 (PDT)
From: Ryan Roberts <ryan.roberts@xxxxxxx>
To: Catalin Marinas <catalin.marinas@xxxxxxx>,
Will Deacon <will@xxxxxxxxxx>
Cc: Ryan Roberts <ryan.roberts@xxxxxxx>,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1] arm64/mm: Ensure lazy_mmu_mode never nests
Date: Fri, 6 Jun 2025 14:56:52 +0100
Message-ID: <20250606135654.178300-1-ryan.roberts@xxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Commit 1ef3095b1405 ("arm64/mm: Permit lazy_mmu_mode to be nested")
provided a quick fix to ensure that lazy_mmu_mode continues to work when
CONFIG_DEBUG_PAGEALLOC is enabled, which can cause lazy_mmu_mode to
nest.

The solution in that patch is the make the implementation tolerant to
nesting; when the inner nest exits lazy_mmu_mode, we exit then the outer
exit becomes a nop. But this sacrifices the optimization opportunity for
the remainder of the outer user.

So let's take a different approach and simply ensure the nesting never
happens in the first place. The nesting is caused when the page
allocator calls out to __kernel_map_pages() which then eventually calls
apply_to_page_range(), which calls arch_enter_lazy_mmu_mode(). So simply
notice if we are in lazy_mmu_mode in __kernel_map_pages() and
temporarily exit.

With that approach, we can effectively revert Commit 1ef3095b1405
("arm64/mm: Permit lazy_mmu_mode to be nested"), re-enabling the VM_WARN
if we ever detect nesting in future.

Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
---

I wonder if you might be willing to take this for v6.16? I think its a neater
solution then my first attempt - Commit 1ef3095b1405 ("arm64/mm: Permit
lazy_mmu_mode to be nested") - which is already in Linus's master.

To be clear, the current solution is safe, I just think this is much neater.

Applies on today's master branch (e271ed52b344).

Thanks,
Ryan

arch/arm64/include/asm/pgtable.h | 22 ++++++++++------------
arch/arm64/mm/pageattr.c | 23 +++++++++++++++++------
2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 88db8a0c0b37..9f387337ccc3 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -83,21 +83,11 @@ static inline void queue_pte_barriers(void)
#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
static inline void arch_enter_lazy_mmu_mode(void)
{
- /*
- * lazy_mmu_mode is not supposed to permit nesting. But in practice this
- * does happen with CONFIG_DEBUG_PAGEALLOC, where a page allocation
- * inside a lazy_mmu_mode section (such as zap_pte_range()) will change
- * permissions on the linear map with apply_to_page_range(), which
- * re-enters lazy_mmu_mode. So we tolerate nesting in our
- * implementation. The first call to arch_leave_lazy_mmu_mode() will
- * flush and clear the flag such that the remainder of the work in the
- * outer nest behaves as if outside of lazy mmu mode. This is safe and
- * keeps tracking simple.
- */
-
if (in_interrupt())
return;

+ VM_WARN_ON(test_thread_flag(TIF_LAZY_MMU));
+
set_thread_flag(TIF_LAZY_MMU);
}

@@ -119,6 +109,14 @@ static inline void arch_leave_lazy_mmu_mode(void)
clear_thread_flag(TIF_LAZY_MMU);
}

+static inline bool arch_in_lazy_mmu_mode(void)
+{
+ if (in_interrupt())
+ return false;
+
+ return test_thread_flag(TIF_LAZY_MMU);
+}
+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
#define __HAVE_ARCH_FLUSH_PMD_TLB_RANGE

diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
index 04d4a8f676db..4da7a847d5f3 100644
--- a/arch/arm64/mm/pageattr.c
+++ b/arch/arm64/mm/pageattr.c
@@ -293,18 +293,29 @@ int set_direct_map_valid_noflush(struct page *page, unsigned nr, bool valid)
}

#ifdef CONFIG_DEBUG_PAGEALLOC
-/*
- * This is - apart from the return value - doing the same
- * thing as the new set_direct_map_valid_noflush() function.
- *
- * Unify? Explain the conceptual differences?
- */
void __kernel_map_pages(struct page *page, int numpages, int enable)
{
+ bool lazy_mmu;
+
if (!can_set_direct_map())
return;

+ /*
+ * This is called during page alloc or free, and maybe called while in
+ * lazy mmu mode. Since set_memory_valid() may also enter lazy mmu mode,
+ * this would cause nesting which is not supported; the inner call to
+ * exit the mode would exit, meaning that the outer lazy mmu mode is no
+ * longer benefiting from the optimization. So temporarily leave lazy
+ * mmu mode for the duration of the call.
+ */
+ lazy_mmu = arch_in_lazy_mmu_mode();
+ if (lazy_mmu)
+ arch_leave_lazy_mmu_mode();
+
set_memory_valid((unsigned long)page_address(page), numpages, enable);
+
+ if (lazy_mmu)
+ arch_enter_lazy_mmu_mode();
}
#endif /* CONFIG_DEBUG_PAGEALLOC */

--
2.43.0



Return-Path: <linux-kernel+bounces-675846-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1F15241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:00:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 7B6481886A83
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:00:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B1861289374;
Fri, 6 Jun 2025 14:00:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="RPniiSvw";
dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="IO0LzPk6";
dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ajwWj5wR";
dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="KqtLDMWm"
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED528289362
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:59:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218399; cv=none; b=RoJN4CurB4D8u31iUs5l1+mFRvPD4b85xcqyb6REcj6lV1MT6tvOhFMmtX72stH4TkDyHt0/NQmDHbGBcmXcBPfyQekVPQ0QTFIaq5X6+wUTcJj3MnKovtQ5fzZlLeijw+r8eNXUFMmTBx0w/i45y52pKs3/8hBy6kjGID/GtPA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218399; c=relaxed/simple;
bh=LV8m1IqOpB2LBObXMZpR34Lyt37fiij8J4QaTlaQOVI=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=AQtYPpWqWJ6PvzJW1ZxU5UHVcmzmqzJzqN0S9LilG+tgK16OPNUPh7yi6dLC/e6UJWHKmMmTvnSpmYgn+o39PZ5Kdp/DKXKWZy0wnHr3MW9VrQQpkO1TX0gfBnUQL6A+C6fpfDAh6mBXcPBa/WVJCKCBcFkRTsX/URvgoqrIHx0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=RPniiSvw; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=IO0LzPk6; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=ajwWj5wR; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=KqtLDMWm; arc=none smtp.client-ip=195.135.223.130
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de
Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by smtp-out1.suse.de (Postfix) with ESMTPS id E95EF336A1;
Fri, 6 Jun 2025 13:59:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
t=1749218396; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=jo8YNOz40hlh2OYeYB2Ua7DhuadBgtsPAMk95xtqrbI=;
b=RPniiSvwXsID+Kbr15bqnDABhowfSWAmYHazHxAay+Ig59ZcJ4Ol0muvB3zF3B0q4dzK2W
5dBxCevc4D5TpUSDXDmGGg6rhcTTealpexHkcWNhCIGVn7BdxziDhQSqKb2Um4+lcB0SaN
skKWYYCMSS0Hs0zdxG9bZ08Aw77FpNc=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
s=susede2_ed25519; t=1749218396;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=jo8YNOz40hlh2OYeYB2Ua7DhuadBgtsPAMk95xtqrbI=;
b=IO0LzPk6DUAw2KgzeoxbMuKoYLWH1p/YOUuvkGtgvJ1HEZGxasBo8Br8cFqEMTdWnq5Wzk
XGWXE+aAEbavq4Dw==
Authentication-Results: smtp-out1.suse.de;
none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
t=1749218395; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=jo8YNOz40hlh2OYeYB2Ua7DhuadBgtsPAMk95xtqrbI=;
b=ajwWj5wRLrZSPt9Tyis80l3hrZfZ19XhM4xWUUVBDNnOZukzEknGdMclxtYuvkYd8b+ICe
FcvJbxpM1wpVmS7vEOuuvl3S7yhGNMdOtGs+cu77Rb5HZOm+yGA2LZ03Pj6CBlQGQCx9wA
Db1/dLYd0bnUFTQOQZyp2LKe72DMd0A=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
s=susede2_ed25519; t=1749218395;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=jo8YNOz40hlh2OYeYB2Ua7DhuadBgtsPAMk95xtqrbI=;
b=KqtLDMWmvtBL0jNGOYzzHMH4Qgyv/xouKGyRY4n7eyt0f/kYnIFcz5dtTJ9xHqwHfHcX3D
ewaGjhP9UVhIlGBg==
Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 723811336F;
Fri, 6 Jun 2025 13:59:55 +0000 (UTC)
Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
by imap1.dmz-prg2.suse.org with ESMTPSA
id k8PUGFv0Qmg6CwAAD6G6ig
(envelope-from <pfalcato@xxxxxxx>); Fri, 06 Jun 2025 13:59:55 +0000
Date: Fri, 6 Jun 2025 14:59:53 +0100
From: Pedro Falcato <pfalcato@xxxxxxx>
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
"Liam R . Howlett" <Liam.Howlett@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>,
linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] mm/vma: reset VMA iterator on commit_merge() OOM failure
Message-ID: <my6v4d5ytsivvw4yloyutafscahbctetvpkqok42flusbgklx4@ixm6kcgihkbv>
References: <20250606125032.164249-1-lorenzo.stoakes@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606125032.164249-1-lorenzo.stoakes@xxxxxxxxxx>
X-Spamd-Result: default: False [-3.80 / 50.00];
BAYES_HAM(-3.00)[100.00%];
NEURAL_HAM_LONG(-1.00)[-1.000];
MID_RHS_NOT_FQDN(0.50)[];
NEURAL_HAM_SHORT(-0.20)[-1.000];
MIME_GOOD(-0.10)[text/plain];
RCPT_COUNT_SEVEN(0.00)[7];
RCVD_VIA_SMTP_AUTH(0.00)[];
MISSING_XM_UA(0.00)[];
MIME_TRACE(0.00)[0:+];
ARC_NA(0.00)[];
RCVD_TLS_ALL(0.00)[];
DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];
FUZZY_BLOCKED(0.00)[rspamd.com];
FROM_HAS_DN(0.00)[];
TO_DN_SOME(0.00)[];
FROM_EQ_ENVFROM(0.00)[];
TO_MATCH_ENVRCPT_ALL(0.00)[];
RCVD_COUNT_TWO(0.00)[2];
DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]
X-Spam-Level:
X-Spam-Score: -3.80
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 01:50:32PM +0100, Lorenzo Stoakes wrote:
> While an OOM failure in commit_merge() isn't really feasible due to the
> allocation which might fail (a maple tree pre-allocation) being 'too small
> to fail', we do need to handle this case correctly regardless.
>
> In vma_merge_existing_range(), we can theoretically encounter failures
> which result in an OOM error in two ways - firstly dup_anon_vma() might
> fail with an OOM error, and secondly commit_merge() failing, ultimately, to
> pre-allocate a maple tree node.
>
> The abort logic for dup_anon_vma() resets the VMA iterator to the initial
> range, ensuring that any logic looping on this iterator will correctly
> proceed to the next VMA.
>
> However the commit_merge() abort logic does not do the same thing. This
> resulted in a syzbot report occurring because mlockall() iterates through
> VMAs, is tolerant of errors, but ended up with an incorrect previous VMA
> being specified due to incorrect iterator state.
>
> While making this change, it became apparent we are duplicating logic - the
> logic introduced in commit 41e6ddcaa0f1 ("mm/vma: add give_up_on_oom option
> on modify/merge, use in uffd release") duplicates the vmg->give_up_on_oom
> check in both abort branches.
>
> Additionally, we observe that we can perform the anon_dup check safely on
> dup_anon_vma() failure, as this will not be modified should this call fail.
>
> Finally, we need to reset the iterator in both cases, so now we can simply
> use the exact same code to abort for both.
>
> We remove the VM_WARN_ON(err != -ENOMEM) as it would be silly for this to
> be otherwise and it allows us to implement the abort check more neatly.
>
> Reported-by: syzbot+d16409ea9ecc16ed261a@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://lore.kernel.org/linux-mm/6842cc67.a00a0220.29ac89.003b.GAE@xxxxxxxxxx/
> Fixes: 47b16d0462a4 ("mm: abort vma_modify() on merge out of memory failure")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>

Reviewed-by: Pedro Falcato <pfalcato@xxxxxxx>

> ---
> mm/vma.c | 22 ++++------------------
> 1 file changed, 4 insertions(+), 18 deletions(-)

Neat cleanup, thanks!

--
Pedro


Return-Path: <linux-kernel+bounces-675845-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 712B041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:00:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id DC39A7A94E0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 13:58:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A91DC289839;
Fri, 6 Jun 2025 13:58:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="boD0tZeV"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D104D1A274;
Fri, 6 Jun 2025 13:58:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218313; cv=none; b=Mhj4gms/BeC6LHl7OSWoP3J+zrkhA4mcz38q/b3Uz2lPrYz7wee/rnjv3CfID2IVuz+PcK//OQ27aJYtyONlpztbGFLLxMjRx8sVLyjPKR59wSswL8PaPsdnQaUrzIHsnUAgxuhOxdLg69+qD9KWrLhiI41J7lWSE5Sr4Lv/qSg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218313; c=relaxed/simple;
bh=QyO94pd4hlnn9BKqJzgyhfcD8waNKskd+/HKP0CvpQg=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=Ww8mU6cV9K1o3AopT1xdtfxLqa/LzXlCfSYy6+BROokUDewQrjyEJcHpFTcxlXJsnUhwD6WcbSfnuh/AdO6NbImBS3VxLTYSeKTLJhZwzB0FFfbtPldyGNh8w5OEENiYXdTR65j4zGXchPV/oMdGRdrPFiE1LdRKMykwBDjaiTo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=boD0tZeV; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC28FC4CEEB;
Fri, 6 Jun 2025 13:58:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749218311;
bh=QyO94pd4hlnn9BKqJzgyhfcD8waNKskd+/HKP0CvpQg=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=boD0tZeVz5UtG9+im6UihIJ+Z3HQVXLzuovQCa76Atf/9RHJd0Xy0unwT4wwKsQ+U
IazlNovBJ4GSG7qM8+lXg86bB8VuD/12OnlxwVm1uCwbqBrW8OttMdBn3MyTyCX/+F
KsHnXp2ftgx8rT65KtGmXpExDfPqjsWx6xc3RgjumuBb/LaoUAk/zru1lJg7Qa6BH+
haVxJHJCz808MLSPhmGUjOeyNUDeirD4ekFhd9PA8NGB7Q8ySMFMP0l+yE63y4hZ92
tw7ECnLbyvsMHl7sAIwFFTQzZXWhDhNbR+/zRiPCYRTyi9x6oOfMNjL1liJCxEvdGs
fkfa4ID5MlTLA==
Date: Fri, 6 Jun 2025 15:58:24 +0200
From: Danilo Krummrich <dakr@xxxxxxxxxx>
To: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Cc: Miguel Ojeda <ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>,
"Rafael J . Wysocki" <rafael@xxxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
rust-for-linux@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-acpi@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?iso-8859-1?Q?Bj=F6rn?= Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>,
Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Len Brown <lenb@xxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>,
Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>,
Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
Subject: Re: [PATCH v2 5/5] samples: rust: add ACPI match table example to
platform driver
Message-ID: <aEL0AGBZqDp1lMFe@pollux>
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605165231.3663810-1-igor.korotin.linux@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250605165231.3663810-1-igor.korotin.linux@xxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 05:52:31PM +0100, Igor Korotin wrote:
> Extend the Rust sample platform driver to probe using device/driver name
> matching, OF ID table matching, or ACPI ID table matching.
>
> Signed-off-by: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
> ---
> samples/rust/rust_driver_platform.rs | 40 +++++++++++++++++++++++++++-
> 1 file changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/samples/rust/rust_driver_platform.rs b/samples/rust/rust_driver_platform.rs
> index e3992e7a71e9..ee0780c1d6ae 100644
> --- a/samples/rust/rust_driver_platform.rs
> +++ b/samples/rust/rust_driver_platform.rs
> @@ -17,10 +17,48 @@ struct SampleDriver {
> [(of::DeviceId::new(c_str!("test,rust-device")), Info(42))]
> );
>
> +kernel::acpi_device_table!(
> + ACPI_TABLE,
> + MODULE_ACPI_TABLE,
> + <SampleDriver as platform::Driver>::IdInfo,
> + [(acpi::DeviceId::new(c_str!("TEST4321")), Info(0))]

Can you please explain add a comment explaining how to make this probe? In the
cover letter you mention:

"Tested using QEMU with a custom SSDT that creates an ACPI device matching the
sample Rust platform driver."

> +);
> +
> +/// OF/ACPI match tables for Platform Driver implementation
> +///
> +/// The platform::Driver requires declaration of both OF_ID_TABLE and
> +/// ACPI_ID_TABLE, but if driver is not going to use either of them
> +/// it can implement one of them or both as None.
> +///
> +/// # Example:
> +///
> +///```
> +/// impl platform::Driver for SampleDriver {
> +/// type IdInfo = Info;
> +/// const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = None;
> +/// const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None;
> +///
> +/// fn probe(
> +/// pdev: &platform::Device<Core>,
> +/// info: Option<&Self::IdInfo>,
> +/// ) -> Result<Pin<KBox<Self>>> {
> +/// dev_dbg!(pdev.as_ref(), "Probe Rust Platform driver sample.\n");
> +///
> +/// if let Some(info) = info {
> +/// dev_info!(pdev.as_ref(), "Probed with info: '{}'.\n", info.0);
> +/// }
> +///
> +/// let drvdata = KBox::new(Self { pdev: pdev.into() }, GFP_KERNEL)?;
> +///
> +/// Ok(drvdata.into())
> +/// }
> +/// }
> +///```

I assume you want to make clear that both the ACPI and OF table are optional;
not sure of that's required given their type is Option<...>. But I'm fine having
this additional comment and example.

Please make sure that it compiles though and remove everything unnecessary from
probe() please.

> +
> impl platform::Driver for SampleDriver {
> type IdInfo = Info;
> const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
> - const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None;
> + const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);
>
> fn probe(
> pdev: &platform::Device<Core>,
> --
> 2.43.0
>


Return-Path: <linux-kernel+bounces-675847-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 882D141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:01:55 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 81BB33A9E1B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:01:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ADB5E288CB7;
Fri, 6 Jun 2025 14:01:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="SFxVmzhJ"
Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 580F4171C9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:01:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218506; cv=none; b=blZteHcGw+x/WvgFNd/C8+ykbLSydX4vEcGNXAg3eZ8ZELcEr7VfSmlApBbONC1TeHwTFZ8hM3WcmHK4LtmFgNfYK0CU3gEbDJlLV/vunJA9QvffIyeaJL/YAdXclJOD3A/4iB/E2mIeVi2jlEjkdbETIOXv1XjvZXxhnYa5LGQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218506; c=relaxed/simple;
bh=rj0vvaDgO/aLd5WsYbdQjAEEA10poNkIwgWWwzipZg8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=kBURZQPMQ4mAW04sbeD0qwcqlJcRwY6F5oJpUzWnBOKlvWy4682kS640DT3QtUE+G6UQKTkqEC6qAJlZoIY7biUslb97MgeDjddSjGDgmi/iSluxdYdvKYYsfLAmxqtkCyGhjUEbkp0wPAO+q3WZLTH3IJzilB8RYNdHUUB6vsw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=SFxVmzhJ; arc=none smtp.client-ip=209.85.167.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com
Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-54998f865b8so2106663e87.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:01:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=suse.com; s=google; t=1749218501; x=1749823301; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=4ePCtVwEHPRZGVKonS4M/PMlbdUQqiCFtEzUovEubhs=;
b=SFxVmzhJ5rvtsQ4RMfli9aoPt8UiBMOrUDanpbcer7CrFw4YIApN6BuFaFEMKkmt4A
K3iDzikQKLq4TLTK8HkoqS9oc0Uo9M2F5pGkhetvuyKqHEef3C33wc1609mN4oxFE30F
+cAY+T828NAq6VvvEedeVw6gfFiQVRYNR6ksHTNIRPwjeMUAftNxFEa+mWqmjBAFr3BJ
pWlLlQ0nRbWZsTNaSX/tZQqMM1zqOv2UTW2r/tInwIC7P+7uQhXIZKrsLuyH+Iv6qUpt
W17EsHfYO/11RNOu0bEYKI6nqFrUf5I/K0LJDRnXYY7tOvespyMB9bdRXMhkvVx9jnv6
NpAA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218501; x=1749823301;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=4ePCtVwEHPRZGVKonS4M/PMlbdUQqiCFtEzUovEubhs=;
b=tmhP+Lr16J2Aw5cQgQb7abaCl4SLXyxrih0lIsZhkurRTlAyrYQXjo9UZTdLRJOBM/
FcH1Y1rOVVWarRhrTXTcLCfimKe9zW+3JvUPGRsQ1iHnyiDgHYBB0ZPSTZUm9QYtI7BK
atdeCUD0kBU/1FQqiT4aH5DazvvmGLHI0w5n9po5c5XI1pfiZoGmncW4SEDs/qIFsAsi
+kHfp0uFu9aQbyJ4LX8VtJFancIth6q8sTk9kZQC7PXrBv+ufWZjErlU6+rzXB5fu0fK
lJrEC6UpjPm+kog1DgLUrXYFZPViZlPyQkXA4oj+DdYJEqnQgfESO05puMz5BLtYPQwT
seWw==
X-Forwarded-Encrypted: i=1; AJvYcCXxVVPGcRHt92r8jGT9+GCM1MjkLxq6m/Em2uTC3O3Dzmtv/EqCp/xe/RSat5HFbHhN0xYPOjdTkztLaXY=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzx+VdXtmotqlaZ39uxxqLrayv7JJ+Fi1zFY8o4ug2dkgHjqngU
pvfWiq5f0s3tG2ichDp+ToGGuY8k1OK6gsOAHcuJR/xfrTb29S1NAznYpl1TxWROXz4=
X-Gm-Gg: ASbGncvF4BZq41qgnCKm9KXIsmr1hap+GOQbtWEMpZGunjRoqX/YK5gAIM6PPGo4xhI
i3nCi8uQchX12DZxtNtaGlIyew2OlAjrS5lTFABJa1fWQbXTy7n41HJkdJDkjjP0if2eE5uaDxI
6awYLt/w80vuqHhGsfT77VU9A5SyUwzToqIkCAFigBQC/TJhzb3mxcKYUHBIEXDQU8lHUkAYnMV
PWiP/nEyN03G4GSD+nv4tDWi9koapc2xULESGILnG7PKKm/JshnMTQdVoWNZ4XcaEsUIo7tntY1
vLSejzHcG/r3T34tTimpwSAWQFems6WEDApA+7jWag80QRwSOWIqFQ==
X-Google-Smtp-Source: AGHT+IHwM29hXAlfVn1/kynbfpVzyXzOWId8Hf038RYt/WmxD1MOmRXvKQf7F3Df+vqxxDdGzL3yVQ==
X-Received: by 2002:a05:6512:39c4:b0:553:65bc:4243 with SMTP id 2adb3069b0e04-55366be6eddmr1129183e87.16.1749218499894;
Fri, 06 Jun 2025 07:01:39 -0700 (PDT)
Received: from pathway.suse.cz ([176.114.240.130])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-236034065edsm12491225ad.185.2025.06.06.07.01.32
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:01:39 -0700 (PDT)
Date: Fri, 6 Jun 2025 16:01:25 +0200
From: Petr Mladek <pmladek@xxxxxxxx>
To: John Ogness <john.ogness@xxxxxxxxxxxxx>
Cc: "Toshiyuki Sato (Fujitsu)" <fj6611ie@xxxxxxxxxxx>,
'Michael Kelley' <mhklinux@xxxxxxxxxxx>,
'Ryo Takakura' <ryotkkr98@xxxxxxxxx>,
Russell King <linux@xxxxxxxxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
Jiri Slaby <jirislaby@xxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,
"linux-serial@xxxxxxxxxxxxxxx" <linux-serial@xxxxxxxxxxxxxxx>,
"linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: Problem with nbcon console and amba-pl011 serial port
Message-ID: <aEL0tZgSEhsR9qbf@xxxxxxxxxxxxxxx>
References: <OS7PR01MB13775FE1A20762D1EA4A38D0ED76DA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<84y0u95e0j.fsf@xxxxxxxxxxxxxxxxxxxxx>
<84plfl5bf1.fsf@xxxxxxxxxxxxxxxxxxxxx>
<TY4PR01MB13777674C22721FCD8ACF4FCCD76CA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<aEApOPTqbVOR35F_@xxxxxxxxxxxxxxx>
<84o6v3ohdh.fsf@xxxxxxxxxxxxxxxxxxxxx>
<aEBNLMYVUOGzusuR@xxxxxxxxxxxxxxx>
<TY4PR01MB13777CC92C858572B9C19394FD76FA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<aEGeARVcCwqcoHb8@xxxxxxxxxxxxxxx>
<84frgdcgug.fsf@xxxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <84frgdcgug.fsf@xxxxxxxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri 2025-06-06 12:25:35, John Ogness wrote:
> On 2025-06-05, Petr Mladek <pmladek@xxxxxxxx> wrote:
> > The question is if it is worth it. Is the clean up really important?
>
> I must admit that I am not happy about encouraging the proposed solution
> so far

I am not super happy either. But let me play the devil advocate
for a bit longer ;-)

> (i.e. expecting driver authors to create special unsafe code in
> the panic situation).

The "usafe code" sounds too strong to me. The console driver is
supposed to "do nothing" and just leave when nbcon_reacquire() fails.


> It leads down the "hope and pray" path that nbcon
> was designed to fix.

My understanding is that we "hope and pray" to show the messages
on the console. And it should work because the ownership was
lost only in a safe state.

If the ownership was lost in the unsafe state then it might
be even bigger gamble to do anything in parallel.

Of course, another panic priority is to provide a crash dump
or reboot. But it hopefully should not depend on a console
driver clean up.

> What if during non-panic-CPU shutdown, we allow reacquires to succeed
> only for _direct_ acquires? The below diff shows how this could be
> implemented. Since it only supports direct acquires, it does not violate
> any state rules. And also, since it only involves the reacquire, there
> is no ugly battling for console printing between the panic and non-panic
> CPUs.

Interesting idea. I thought a lot about it, see below.


> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 5b462029d03c1..d58ebdc8170b3 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> diff --git a/kernel/panic.c b/kernel/panic.c
> index b0b9a8bf4560d..8f572630c9f7e 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -304,6 +310,8 @@ static void panic_other_cpus_shutdown(bool crash_kexec)
> smp_send_stop();
> else
> crash_smp_send_stop();
> +
> + nbcon_panic_allow_reacquire_set(false);
> }

I have two concerns here:

1. I wonder whether this is reliable enough. It seems that
smp_send_stop() waits at least 1 sec until the CPUs
get stopped. But is this enough on virtualized systems?

2. It might increase a risk when CPUs are stopped using NMI.
The change would allow a non-panic CPU to reacquire the ownership
and enter _unsafe_ section right before being stopped by NMI.


The 1st problem might be avoided by allowing the reacquire all
the time unless an "unsafe" takeover happened.

The 2nd problem is worse. But allowing the reacquire all the time
might actually help as well.

Note that the information about the "unsafe_takeover" is stored
in struct console so that we even won't need a new global
variable.


> /**
> diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
> index d60596777d278..d960cb8a05558 100644
> --- a/kernel/printk/nbcon.c
> +++ b/kernel/printk/nbcon.c
> @@ -235,7 +235,8 @@ static void nbcon_seq_try_update(struct nbcon_context *ctxt, u64 new_seq)
> * the handover acquire method.
> */
> static int nbcon_context_try_acquire_direct(struct nbcon_context *ctxt,
> - struct nbcon_state *cur)
> + struct nbcon_state *cur,
> + bool ignore_other_cpu_in_panic)
> {
> unsigned int cpu = smp_processor_id();
> struct console *con = ctxt->console;
> @@ -249,7 +250,7 @@ static int nbcon_context_try_acquire_direct(struct nbcon_context *ctxt,
> * nbcon_waiter_matches(). In particular, the assumption that
> * lower priorities are ignored during panic.
> */
> - if (other_cpu_in_panic())
> + if (other_cpu_in_panic() && !ignore_other_cpu_in_panic)

If you agree with allowing the reacquire all the time then I would
rename the parameter to @is_reacquire and do something like:

if (other_cpu_in_panic() &&
(!is_reacquire || cur->unsafe_takeover))

> return -EPERM;
>
> if (ctxt->prio <= cur->prio || ctxt->prio <= cur->req_prio)
> @@ -913,7 +920,7 @@ void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt)
> {
> struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt);
>
> - while (!nbcon_context_try_acquire(ctxt))
> + while (!nbcon_context_try_acquire(ctxt, READ_ONCE(nbcon_panic_allow_reacquire)))

And here it would be:

while (!nbcon_context_try_acquire(ctxt, true))

> cpu_relax();
>
> nbcon_write_context_set_buf(wctxt, NULL, 0);


Summary:

I open to give this alternative approach a chance when we allow the
reacquire all the time. It might work well. And it won't require
any special "panic" handling in all console drivers.

Best Regards,
Petr


Return-Path: <linux-kernel+bounces-675848-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4B4B141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:08:32 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id A96B81892E26
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:08:45 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E459C171C9;
Fri, 6 Jun 2025 14:08:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="OcDUG8+o"
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11])
(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 A1DC3288C23
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:08:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218898; cv=none; b=gV22M42Hh8U0KC44vCLuYkhWDO8crpIrfzS2W2rsDt5n6UUpv9XH0NKKA4WUzQAgD2ceoknWD74DogpdonGfr5LIVD6lw3UVlZc2Pm9JH3aKisfgOE4IcnZXaYPizNqbHgGtezAMoBiS800z7mQs3k7jPO1v9WMB8dHHGJY3OZE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218898; c=relaxed/simple;
bh=wthOag1sm5nU4GXRcSPL17HJQFHnh+gJbmk4KahBEjU=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To:
Content-Type:References; b=EsjT8pWLWacmY80PsprEHfv3Kpz04y1S3fK3AtkIAo639Ca5FH7C51GkBJz9b+fgLXtDjhe0NhHaWQd/NpVECqr/Unrxbd58heCgIwScKswh9WBV4NtFsjmJatvSGntVB56ng/NDlffvUN9WLhPf1cYrBVwhMStBD4fRGqh6t3U=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=OcDUG8+o; arc=none smtp.client-ip=210.118.77.11
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20250606140809euoutp014646b5b8912e2e5be235422d0824a865~GeU-Vfjkc3203932039euoutp01E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:08:09 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20250606140809euoutp014646b5b8912e2e5be235422d0824a865~GeU-Vfjkc3203932039euoutp01E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1749218889;
bh=bBhDO8zSdUXt9NYlkunjU4em2Hqfqu0XOindhBrcoTc=;
h=Date:Subject:To:Cc:From:In-Reply-To:References:From;
b=OcDUG8+oIpQoYcgz6PzSyiucceUr7OkxWSJFGw1xVsuPMIZA4GVtzcR4R40kAVapF
mcjdY/p+8DhvOvnQVQpSod96c/+HE5c90h6Lliy8cAZA07O8PmsKCSY7QQJhIJCGH7
dEhg4vi8UEuQR+gENWhHlBAnPlET672WYDjht+Po=
Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20250606140808eucas1p155936501c7e0d1da1b2ba7d85e71a18a~GeU_tgXBa0375003750eucas1p1C;
Fri, 6 Jun 2025 14:08:08 +0000 (GMT)
Received: from [192.168.1.44] (unknown [106.210.136.40]) by
eusmtip1.samsung.com (KnoxPortal) with ESMTPA id
20250606140807eusmtip16476b184f66b219739281a59673e9ff8~GeU9qr1yA2361423614eusmtip1c;
Fri, 6 Jun 2025 14:08:07 +0000 (GMT)
Message-ID: <b1c4792e-f997-4eba-a8ed-d2e3f76e3fdd@xxxxxxxxxxx>
Date: Fri, 6 Jun 2025 16:08:07 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH RFC 2/6] pwm: Add Rust driver for T-HEAD TH1520 SoC
To: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= <ukleinek@xxxxxxxxxx>, Miguel Ojeda
<ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>, Boqun Feng
<boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@xxxxxxxxxxxxxx>, Benno Lossin
<benno.lossin@xxxxxxxxx>, Andreas Hindborg <a.hindborg@xxxxxxxxxx>, Alice
Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>, Danilo
Krummrich <dakr@xxxxxxxxxx>
Cc: Miguel Ojeda <ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@xxxxxxxxxxxxxx>, Benno Lossin
<benno.lossin@xxxxxxxxx>, Andreas Hindborg <a.hindborg@xxxxxxxxxx>, Alice
Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>, Danilo
Krummrich <dakr@xxxxxxxxxx>, Drew Fustini <drew@xxxxxxxx>, Guo Ren
<guoren@xxxxxxxxxx>, Fu Wei <wefu@xxxxxxxxxx>, Rob Herring
<robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley
<conor+dt@xxxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Palmer
Dabbelt <palmer@xxxxxxxxxxx>, Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Alexandre
Ghiti <alex@xxxxxxxx>, Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, linux-pwm@xxxxxxxxxxxxxxx,
rust-for-linux@xxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx
Content-Language: en-US
From: Michal Wilczynski <m.wilczynski@xxxxxxxxxxx>
In-Reply-To: <q6dkihyfosi3k4mtrvyff54nbsjpovmujdbmoqhapo7daznpja@of2p5gtmcq2m>
Content-Transfer-Encoding: 8bit
X-CMS-MailID: 20250606140808eucas1p155936501c7e0d1da1b2ba7d85e71a18a
X-Msg-Generator: CA
Content-Type: text/plain; charset="utf-8"
X-RootMTR: 20250524211521eucas1p1929a51901c91d1a37e9f4c2da86ff7b0
X-EPHeader: CA
X-CMS-RootMailID: 20250524211521eucas1p1929a51901c91d1a37e9f4c2da86ff7b0
References: <20250524-rust-next-pwm-working-fan-for-sending-v1-0-bdd2d5094ff7@xxxxxxxxxxx>
<CGME20250524211521eucas1p1929a51901c91d1a37e9f4c2da86ff7b0@xxxxxxxxxxxxxxxxxxxx>
<20250524-rust-next-pwm-working-fan-for-sending-v1-2-bdd2d5094ff7@xxxxxxxxxxx>
<q6dkihyfosi3k4mtrvyff54nbsjpovmujdbmoqhapo7daznpja@of2p5gtmcq2m>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/5/25 12:39, Uwe Kleine-König wrote:
> Hello,
>
> I don't speak Rust, so please double-check all my feedback if it really
> applies.

No problem, appreciate your time and experience with PWM subsystem !

>
> On Sat, May 24, 2025 at 11:14:56PM +0200, Michal Wilczynski wrote:
>> Introduce a PWM driver for the T-HEAD TH1520 SoC written in Rust. It
>> utilizes the Rust PWM abstractions added in the previous commit.
>>
>> The driver implements the standard PwmOps for the PWM framework,
>> supporting configuration of period, duty cycle, and polarity for the
>> TH1520's PWM channels. It uses devm managed resources for the PWM chip
>> itself and Rust DevRes for I/O memory. Clock management is handled using
>> Rust's RAII pattern.
>>
>> Signed-off-by: Michal Wilczynski <m.wilczynski@xxxxxxxxxxx>
>> ---
>> MAINTAINERS | 1 +
>> drivers/pwm/Kconfig | 6 +
>> drivers/pwm/Makefile | 1 +
>> drivers/pwm/pwm_th1520.rs | 272 ++++++++++++++++++++++++++++++++++++++++++++++
>> 4 files changed, 280 insertions(+)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 2b080e8f3d873b1e401b3a2fe1207c224c4591fc..0cfac73aea65076c5ccb50a25ea686fb86b472b8 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -20986,6 +20986,7 @@ F: drivers/mailbox/mailbox-th1520.c
>> F: drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c
>> F: drivers/pinctrl/pinctrl-th1520.c
>> F: drivers/pmdomain/thead/
>> +F: drivers/pwm/pwm_th1520.rs
>> F: include/dt-bindings/clock/thead,th1520-clk-ap.h
>> F: include/dt-bindings/power/thead,th1520-power.h
>> F: include/linux/firmware/thead/thead,th1520-aon.h
>> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
>> index b5bd5c13b3a5e5a575a0fbfb2e285f5665b7a671..796fcd8343b7c8e30f62edc2e0fecf0e9b1ae20e 100644
>> --- a/drivers/pwm/Kconfig
>> +++ b/drivers/pwm/Kconfig
>> @@ -684,6 +684,12 @@ config PWM_TEGRA
>> To compile this driver as a module, choose M here: the module
>> will be called pwm-tegra.
>>
>> +config PWM_TH1520_RUST
>> + tristate "TH1520 PWM support (Rust)"
>> + depends on RUST_PWM_ABSTRACTIONS
>> + help
>> + Generic PWM framework driver for TH1520 SoC.
>> +
>> config PWM_TIECAP
>> tristate "ECAP PWM support"
>> depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
>> diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
>> index 539e0def3f82fcb866ab83a0346a15f7efdd7127..6890f860ada6f1a6ed43dd3a3a9584cd2fa877f3 100644
>> --- a/drivers/pwm/Makefile
>> +++ b/drivers/pwm/Makefile
>> @@ -70,3 +70,4 @@ obj-$(CONFIG_PWM_TWL_LED) += pwm-twl-led.o
>> obj-$(CONFIG_PWM_VISCONTI) += pwm-visconti.o
>> obj-$(CONFIG_PWM_VT8500) += pwm-vt8500.o
>> obj-$(CONFIG_PWM_XILINX) += pwm-xilinx.o
>> +obj-$(CONFIG_PWM_TH1520_RUST) += pwm_th1520.o
>> diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..4665e293e8d0bdc1a62a4e295cdaf4d47b3dd134
>> --- /dev/null
>> +++ b/drivers/pwm/pwm_th1520.rs
>> @@ -0,0 +1,272 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +// Copyright (c) 2025 Samsung Electronics Co., Ltd.
>> +// Author: Michal Wilczynski <m.wilczynski@xxxxxxxxxxx>
>> +
>> +//! Rust T-HEAD TH1520 PWM driver
>> +use kernel::{c_str, clk::Clk, device, io::mem::IoMem, of, platform, prelude::*, pwm, time};
>> +
>> +const MAX_PWM_NUM: u32 = 6;
>> +
>> +const fn th1520_pwm_chn_base(n: u32) -> u32 {
>> + n * 0x20
>> +}
>> +const fn th1520_pwm_ctrl(n: u32) -> u32 {
>> + th1520_pwm_chn_base(n) + 0x00
>> +}
>> +const fn th1520_pwm_per(n: u32) -> u32 {
>> + th1520_pwm_chn_base(n) + 0x08
>> +}
>> +const fn th1520_pwm_fp(n: u32) -> u32 {
>> + th1520_pwm_chn_base(n) + 0x0c
>> +}
>> +
>> +const PWM_START: u32 = 1 << 0;
>> +const PWM_CFG_UPDATE: u32 = 1 << 2;
>> +const PWM_CONTINUOUS_MODE: u32 = 1 << 5;
>> +const PWM_FPOUT: u32 = 1 << 8;
>> +const PWM_INFACTOUT: u32 = 1 << 9;
>> +
>> +struct Th1520PwmChipData {
>> + clk: Clk,
>> + iomem: kernel::devres::Devres<IoMem<0>>,
>> +}
>> +
>> +impl Th1520PwmChipData {
>> + fn _config(
>> + &self,
>> + hwpwm: u32,
>> + duty_ns: u64,
>> + period_ns: u64,
>> + target_polarity: pwm::Polarity,
>
> Why "target_polarity"? duty_ns and period_ns also don't contain
> "target_"?

You're right, that was an inconsistent name. I've since re-worked the
driver to use the modern waveform API as you suggested in the other
thread. In the new version, this function no longer exists, and the new
round_waveform_tohw op takes a &pwm::Waveform parameter, which resolves
this naming issue. Thank you for pointing it out.

>
>> + ) -> Result<u32> {
>> + let regs = self.iomem.try_access().ok_or_else(|| {
>> + pr_err!("PWM-{}: Failed to access I/O memory in _config\n", hwpwm);
>> + EBUSY
>> + })?;
>> +
>> + // Calculate cycle values
>> + let rate_hz_u64 = self.clk.rate().as_hz() as u64;
>> +
>> + if duty_ns > period_ns {
>> + pr_err!(
>> + "PWM-{}: Duty {}ns > period {}ns\n",
>> + hwpwm,
>> + duty_ns,
>> + period_ns
>> + );
>> + return Err(EINVAL);
>> + }
>> + if period_ns == 0 {
>> + pr_err!("PWM-{}: Period is zero\n", hwpwm);
>> + return Err(EINVAL);
>> + }
>
> You don't need to check for period_ns == 0 explicitly. This case then
> hits period_cycle == 0 below.
>
>> +
>> + let mut period_cycle = mul_div_u64(period_ns, rate_hz_u64, time::NSEC_PER_SEC as u64);
>
> if period_ns is big and rate_hz_u64 > NSEC_PER_SEC this might overflow.
>
> Typically refuse to probe if rate_hz_u64 > NSEC_PER_SEC and call
> clk_rate_exclusive_get().
>
>> + if period_cycle > u32::MAX as u64 {
>> + period_cycle = u32::MAX as u64;
>> + }
>> + if period_cycle == 0 {
>> + pr_err!(
>> + "PWM-{}: Calculated period_cycle is zero, not allowed by HW\n",
>> + hwpwm
>> + );
>> + return Err(EINVAL);
>> + }
>> +
>> + let mut duty_cycle = mul_div_u64(duty_ns, rate_hz_u64, time::NSEC_PER_SEC as u64);
>> + if duty_cycle > u32::MAX as u64 {
>> + duty_cycle = u32::MAX as u64;
>> + }
>> +
>> + let mut base_ctrl_val = PWM_INFACTOUT | PWM_CONTINUOUS_MODE;
>> + if target_polarity == pwm::Polarity::Normal {
>> + // FPOUT=1 for Normal
>> + base_ctrl_val |= PWM_FPOUT;
>> + } else {
>> + // Inversed, FPOUT=0
>> + base_ctrl_val &= !PWM_FPOUT;
>> + }
>> + regs.try_write32(base_ctrl_val, th1520_pwm_ctrl(hwpwm) as usize)?;
>> + pr_debug!(
>> + "PWM-{}: _config: Initial CTRL write (polarity, mode): 0x{:x}\n",
>> + hwpwm,
>> + base_ctrl_val
>> + );
>> +
>> + // Write period and duty registers
>> + regs.try_write32(period_cycle as u32, th1520_pwm_per(hwpwm) as usize)?;
>> + regs.try_write32(duty_cycle as u32, th1520_pwm_fp(hwpwm) as usize)?;
>> + pr_debug!(
>> + "PWM-{}: _config: Period_cyc={}, Duty_cyc={}\n",
>> + hwpwm,
>> + period_cycle,
>> + duty_cycle
>> + );
>> +
>> + // Apply period/duty by toggling CFG_UPDATE from 0 to 1.
>> + // The `base_ctrl_val` (just written to HW) has CFG_UPDATE=0. Now set it.
>> + let ctrl_val_for_update = base_ctrl_val | PWM_CFG_UPDATE;
>> + regs.try_write32(ctrl_val_for_update, th1520_pwm_ctrl(hwpwm) as usize)?;
>> + pr_debug!(
>> + "PWM-{}: _config: CTRL write with CFG_UPDATE: 0x{:x}\n",
>> + hwpwm,
>> + ctrl_val_for_update
>> + );
>> +
>> + Ok(ctrl_val_for_update)
>> + }
>> +
>> + fn _enable(&self, hwpwm: u32, ctrl_val_after_config: u32) -> Result {
>> + let regs = self.iomem.try_access().ok_or_else(|| {
>> + pr_err!("PWM-{}: Failed to access I/O memory in _enable\n", hwpwm);
>> + EBUSY
>> + })?;
>> +
>> + // ctrl_val_after_config already has mode, polarity, and CFG_UPDATE correctly set.
>> + // Now add the START bit. START bit auto-clears.
>> + let ctrl_to_start = ctrl_val_after_config | PWM_START;
>> + regs.try_write32(ctrl_to_start, th1520_pwm_ctrl(hwpwm) as usize)?;
>> + pr_debug!(
>> + "PWM-{}: _enable: CTRL write with START: 0x{:x}\n",
>> + hwpwm,
>> + ctrl_to_start
>> + );
>> + Ok(())
>> + }
>> +
>> + fn _disable(&self, hwpwm: u32) -> Result<()> {
>> + let regs = self.iomem.try_access().ok_or_else(|| {
>> + pr_err!("PWM-{}: Failed to access I/O memory in _disable\n", hwpwm);
>> + EINVAL
>> + })?;
>> +
>> + let mut ctrl_val = regs.try_read32(th1520_pwm_ctrl(hwpwm) as usize)?;
>> + pr_debug!("PWM-{}: _disable: Read CTRL: 0x{:x}\n", hwpwm, ctrl_val);
>> +
>> + // Ensure CFG_UPDATE is 0 before updating duty (Limitation #4)
>> + if (ctrl_val & PWM_CFG_UPDATE) != 0 {
>> + ctrl_val &= !PWM_CFG_UPDATE;
>> + regs.try_write32(ctrl_val, th1520_pwm_ctrl(hwpwm) as usize)?;
>> + pr_debug!(
>> + "PWM-{}: _disable: Cleared CFG_UPDATE, wrote CTRL: 0x{:x}\n",
>> + hwpwm,
>> + ctrl_val
>> + );
>> + }
>> +
>> + // Set duty cycle to 0
>> + regs.try_write32(0, th1520_pwm_fp(hwpwm) as usize)?;
>> + pr_debug!("PWM-{}: _disable: Wrote 0 to DUTY (FP) register\n", hwpwm);
>> +
>> + // Apply the 0% duty by toggling CFG_UPDATE from 0 to 1
>> + // Use the ctrl_val that has CFG_UPDATE cleared (or was already clear)
>> + ctrl_val |= PWM_CFG_UPDATE;
>> + regs.try_write32(ctrl_val, th1520_pwm_ctrl(hwpwm) as usize)?;
>> + pr_debug!(
>> + "PWM-{}: _disable: Set CFG_UPDATE, wrote CTRL: 0x{:x}\n",
>> + hwpwm,
>> + ctrl_val
>> + );
>> +
>> + Ok(())
>> + }
>> +}
>> +
>> +impl pwm::PwmOps for Th1520PwmChipData {
>> + // This driver implements get_state
>
> I don't spot the get_state implementation?!

That's a good catch, thank you. You are correct, the comment was ahead
of the implementation in this RFC version. My intention was to keep the
initial patch focused. I have now added the full get_state
implementation for v2.

>
>> + fn apply(
>> + pwm_chip_ref: &mut pwm::Chip,
>> + pwm_dev: &mut pwm::Device,
>> + target_state: &pwm::State,
>
> In C code I like these variables be called "chip", "pwm" and "state"
> respectively. Is that possible here, too?

Absolutely. That makes sense for consistency with the C codebase. In the
new waveform based version, I've ensured the PwmOps parameters are named
simply chip, pwm to align with standard practice.

>
>> + ) -> Result {
>> + let data: &Th1520PwmChipData = pwm_chip_ref.get_drvdata().ok_or(EINVAL)?;
>> + let hwpwm = pwm_dev.hwpwm();
>> +
>> + if !target_state.enabled() {
>> + if pwm_dev.state().enabled() {
>> + data._disable(hwpwm)?;
>> + }
>> +
>> + return Ok(());
>> + }
>> +
>> + // Configure period, duty, and polarity.
>> + // This function also latches period/duty with CFG_UPDATE.
>> + // It returns the control value that was written with CFG_UPDATE set.
>> + let ctrl_val_after_config = data._config(
>> + hwpwm,
>> + target_state.duty_cycle(),
>> + target_state.period(),
>> + target_state.polarity(),
>> + )?;
>> +
>> + // Enable by setting START bit if it wasn't enabled before this apply call
>> + if !pwm_dev.state().enabled() {
>> + data._enable(hwpwm, ctrl_val_after_config)?;
>> + }
>> +
>> + Ok(())
>> + }
>> +}
>> +
>> +impl Drop for Th1520PwmChipData {
>> + fn drop(&mut self) {
>> + self.clk.disable_unprepare();
>> + }
>> +}
>> +
>> +fn mul_div_u64(a: u64, b: u64, c: u64) -> u64 {
>> + if c == 0 {
>> + return 0;
>> + }
>> + a.wrapping_mul(b) / c
>> +}
>
> Is this save if a * b > U64_MAX? I would have expected such a function
> to already exist in generic code.

You're right, thank you. The wrapping_mul is unsafe due to the overflow
risk you pointed out.

The ideal solution would be to use the kernel's own mul_u64_u64_div_u64
helper function.

Rust maintainers: This binding doesn't seem to be available yet. Would a
preparatory patch introducing a minimal rust/kernel/math.rs with only
this binding be the best way to proceed? It seems like a useful utility
for more than just this driver.

>
>> +static TH1520_PWM_OPS: pwm::PwmOpsVTable = pwm::create_pwm_ops::<Th1520PwmChipData>();
>> +
>> +struct Th1520PwmPlatformDriver;
>> +
>> +kernel::of_device_table!(
>> + OF_TABLE,
>> + MODULE_OF_TABLE,
>> + <Th1520PwmPlatformDriver as platform::Driver>::IdInfo,
>> + [(of::DeviceId::new(c_str!("thead,th1520-pwm")), ())]
>> +);
>> +
>> +impl platform::Driver for Th1520PwmPlatformDriver {
>> + type IdInfo = ();
>> + const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
>> +
>> + fn probe(
>> + pdev: &platform::Device<device::Core>,
>> + _id_info: Option<&Self::IdInfo>,
>> + ) -> Result<Pin<KBox<Self>>> {
>> + let resource = pdev.resource(0).ok_or(ENODEV)?;
>> + let iomem = pdev.ioremap_resource(&resource)?;
>> +
>> + let clk = Clk::get(pdev.as_ref(), None)?;
>> +
>> + clk.prepare_enable()?;
>
> Is there something like devm_clk_get_enabled() such that the drop
> function becomes redundant?

I've reviewed the current clk.rs abstractions that were recently merged,
and while they provide Clk::get() (which is refcounted), a combined
devm_clk_get_enabled() doesn't exist yet. Because of this, the driver
must manually call enable and disable. I've achieved it through Rust
RAII.

>
>> + let driver_data = KBox::new(Th1520PwmChipData { clk, iomem }, GFP_KERNEL)?;
>> + let pwm_chip = pwm::devm_chip_alloc(pdev.as_ref(), MAX_PWM_NUM, 0)?;
>> +
>> + let result = pwm::devm_chip_add(pdev.as_ref(), pwm_chip, &TH1520_PWM_OPS);
>> + if result.is_err() {
>> + pr_err!("Failed to add PWM chip: {:?}\n", result);
>> + return Err(EIO);
>> + }
>> +
>> + pwm_chip.set_drvdata(driver_data);
>> + pr_info!("T-HEAD TH1520 PWM probed correctly\n");
>
> Please degrade to pr_debug. Each driver emitting a message is an
> annoyance.
>
>> + Ok(KBox::new(Self, GFP_KERNEL)?.into())
>> + }
>> +}
>> +
>> +kernel::module_platform_driver! {
>> + type: Th1520PwmPlatformDriver,
>> + name: "pwm_th1520",
>> + author: "Michal Wilczynski",
>> + description: "T-HEAD TH1520 PWM driver",
>> + license: "GPL v2",
>> +}
>
> Best regards
> Uwe

Best regards,
--
Michal Wilczynski <m.wilczynski@xxxxxxxxxxx>


Return-Path: <linux-kernel+bounces-675849-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0006641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:08:50 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 232A3174332
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:08:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E055288CB9;
Fri, 6 Jun 2025 14:08:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="U+y8U0zd"
Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB252171C9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:08:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749218923; cv=none; b=PprsfgCKMLYdZryQGMM/fqNER7STlGh4W7iiLsRYW7naiB4QIKEygmCahSY2D5npJ/CbGwW2HEUzLm9dVwe+Tm0BHLXgr/afX7rtV1qX0mnUGvVvUA9pwC6TuHmQIiQ2+BBc8GllHcRLXT4b5YjarxK/nGKFYmQPMlcKRQx9OIQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749218923; c=relaxed/simple;
bh=MTgQ3J9CV2Gj/FW9dW6d9onzwqf1Et96suAwCM3gXZw=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=l4KPZA+IC/2GgS6HdvpUJ2eMZDqMk0l3kYJJbBdW9iClkWqmXF/kcIlRYedCcIgtzs+WkL92s7tW+moBanD0YSSIqHXUHCu416JJA95ae3VLvUcDPq1GHCcKEU8xHbXSjHmpR8UeuJG41ZTb3oFevIMT1su8dK+BpzLxmnHdbr0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch; spf=none smtp.mailfrom=ffwll.ch; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b=U+y8U0zd; arc=none smtp.client-ip=209.85.208.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch
Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-606bbe60c01so3722713a12.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:08:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=ffwll.ch; s=google; t=1749218920; x=1749823720; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references
:mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc
:subject:date:message-id:reply-to;
bh=q+SrCl/f51Q6wsvIr87A5oDPDHuMVXDJpgKBq/CGFc8=;
b=U+y8U0zdtPEwUGeCmLxuRyzZYBBOx6RoHzYRsM5+jPLkVo2srDvaKLYViSo7drIw8p
QDEzMPK2wJKe+mzsKU1lBcARIDhGOkkzhReUgkiapWqKPT3wma68VaR6Ac3/nTq61r4B
tMVg1yRZ7u8DFsjqXICX8XByElDOm/O6IzF7s=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749218920; x=1749823720;
h=in-reply-to:content-disposition:mime-version:references
:mail-followup-to:message-id:subject:cc:to:from:date
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=q+SrCl/f51Q6wsvIr87A5oDPDHuMVXDJpgKBq/CGFc8=;
b=X+yVbJfNRFx2Q3LJSzW9tlarOiu0ymM8FrFEiqHmxm3R6m5PAlWN+s2UBNj6A9yO1a
SYX8U7RS7TaQ0a8FsYHxRgTermmLOn+X7MMSxbBPZ91KkctGh1eVFSwNl2DKH30JC5f2
kS1fH8xghSWwrgN3JGcI6t6DuFHdGVsgc7F4tIkPw8YqBfzPHMwyZ8ogWjsp+zWsqxLb
916A46z1NVFRBGvXZPo5pGyzOogkGwmu5nZvFXCNn79SkKBMZP3EsyfHnauMoH7rJwzx
XCu/4ar3w+13yf7bQF+Nl8qCTc/1wHgJkQvSiCnPTGctn5J7VxGo2z/x7nkfpvk//LK+
Ku9A==
X-Forwarded-Encrypted: i=1; AJvYcCW0e68c24GI5Kl2Tb9E2njxFTQ+wLAzl4uiSvlIdB4P0+ittM1G68V0gDDkgWM0gAowIORYafEMUCgJ/ec=@vger.kernel.org
X-Gm-Message-State: AOJu0YwAvtxbzwmTSmu2Bq3iGa++lKr3nbb/lrT0mSzUPKDRk7BF3f+S
yvIbEtYxCi6CFTKjhLwx/MjcGAB2TeS3Yf/2FnVzk8GwFGupr/bKrwqa39c5cIIoRqY=
X-Gm-Gg: ASbGncsVor3ycg1uwzp6ANQ5KTvsG7nwhqfe5yxojCO3DikNT8qFk2ihbUlJQ0GYrW+
6kw+HbPOlCqJFuQThRj3Zz1v0GRent8V+3rwrDzeG2bffcKN5vzWK5OKhr0eIDPyU1Dk12VNoY3
ERJtBY2+0tfVMDneAuEGY2fITU2/0DY2WJ6MIdn55aW35F9E1YgteEoFafhlZj3ouWPheFOM3Tt
Jb/PPwWmcEYDJ7jrGcv9aVe1M8rLnbJ3GrO9KMHe/mqcn38m49L7s7e8iq9Bv+anUnyezPXqJS9
5b3AHWPTE0VB5Z54kqoQnwtKbhkb+t2MxGfyudepsv0X5RetqPvTm4Irac45dd7r/1yOBID4gg=
=
X-Google-Smtp-Source: AGHT+IHFX0HnsPyTOdDAeUlo2hrNHElBrbc+CU9RgfvFeOrbV0ZvwQiJngadUTVgNhOy+/CArmmCcg==
X-Received: by 2002:a17:907:3da3:b0:ad8:a512:a9fc with SMTP id a640c23a62f3a-ade1a9fd897mr290273966b.42.1749218919860;
Fri, 06 Jun 2025 07:08:39 -0700 (PDT)
Received: from phenom.ffwll.local ([2a02:168:57f4:0:5485:d4b2:c087:b497])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc3abe0sm122443766b.146.2025.06.06.07.08.38
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:08:39 -0700 (PDT)
Date: Fri, 6 Jun 2025 16:08:37 +0200
From: Simona Vetter <simona.vetter@xxxxxxxx>
To: Matthew Brost <matthew.brost@xxxxxxxxx>
Cc: Danilo Krummrich <dakr@xxxxxxxxxx>,
Simona Vetter <simona.vetter@xxxxxxxx>,
Christian =?iso-8859-1?Q?K=F6nig?= <christian.koenig@xxxxxxx>,
Philipp Stanner <phasta@xxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>, Simona Vetter <simona@xxxxxxxx>,
dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] drm/sched: Discourage usage of separate workqueues
Message-ID: <aEL2Za28DVgbfiny@phenom.ffwll.local>
Mail-Followup-To: Matthew Brost <matthew.brost@xxxxxxxxx>,
Danilo Krummrich <dakr@xxxxxxxxxx>,
Christian =?iso-8859-1?Q?K=F6nig?= <christian.koenig@xxxxxxx>,
Philipp Stanner <phasta@xxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>, Simona Vetter <simona@xxxxxxxx>,
dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
References: <20250604081657.124453-2-phasta@xxxxxxxxxx>
<7a09c357-2d28-4dd6-b637-4387cc430938@xxxxxxx>
<aEBhIzccXBPyt_58@phenom.ffwll.local>
<aEB4DFFE2C7gElRL@xxxxxxxxxxxxxxxxxxxxxxxxx>
<aEB6GOTlC_Z_Rq8b@cassiopeiae>
<aEB9/VGHJGnY4+fP@xxxxxxxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aEB9/VGHJGnY4+fP@xxxxxxxxxxxxxxxxxxxxxxxxx>
X-Operating-System: Linux phenom 6.12.25-amd64
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, Jun 04, 2025 at 10:10:21AM -0700, Matthew Brost wrote:
> On Wed, Jun 04, 2025 at 06:53:44PM +0200, Danilo Krummrich wrote:
> > On Wed, Jun 04, 2025 at 09:45:00AM -0700, Matthew Brost wrote:
> > > On Wed, Jun 04, 2025 at 05:07:15PM +0200, Simona Vetter wrote:
> > > > We should definitely document this trick better though, I didn't find any
> > > > place where that was documented.
> > >
> > > This is a good idea.
> >
> > I think - and I also mentioned this a few times in the patch series that added
> > the workqueue support - we should also really document the pitfalls of this.
> >
> > If the scheduler shares a workqueue with the driver, the driver needs to take
> > special care when submitting work that it's not possible to prevent run_job and
> > free_job work from running by doing this.
> >
> > For instance, if it's a single threaded workqueue and the driver submits work
> > that allocates with GFP_KERNEL, this is a deadlock condition.
> >
> > More generally, if the driver submits N work that, for instance allocates with
> > GFP_KERNEL, it's also a deadlock condition if N == max_active.
>
> Can we prime lockdep on scheduler init? e.g.
>
> fs_reclaim_acquire(GFP_KERNEL);
> workqueue_lockdep_acquire();
> workqueue_lockdep_release();
> fs_reclaim_release(GFP_KERNEL);

+1, this should do the trick. Well strictly need GFP_NORECLAIM, so ideally
the one below for dma_fence.

> In addition to documentation, this would prevent workqueues from being
> used that allocate with GFP_KERNEL.
>
> Maybe we could use dma_fence_sigaling annotations instead of
> fs_reclaim_acquire, but at one point those gave Xe false lockdep
> positives so use fs_reclaim_acquire in similar cases. Maybe that has
> been fixed though.

Yeah the annotation is busted because it doesn't use the right recursive
version. I thought Thomas Hellstrom had a patch once, but it didn't land
yet.
-Sima
--
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Return-Path: <linux-kernel+bounces-675850-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0E97741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:12:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id D35B43B1181
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:12:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id F13BC289342;
Fri, 6 Jun 2025 14:12:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GcPr3RoF"
Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 496BE171C9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:12:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219154; cv=none; b=Ko9sLkrnJKYw/fxJsyMRwjrQL8YSe4tOKvCY3MzwdBbUAorcoQ5hExY/97BJ8VRjUCgCf83lDmPWnIrWg12zX5UOeyJnbavl6gjycjj1t9yDImfMn36YSdICC0DlvU/jagqSEPhJ45ktFCXlyXRoS9/UZFJ9/VzIB6sfN6m3MhU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219154; c=relaxed/simple;
bh=psuEFWdwVCBlkD1sMc3ALuCERUGXYguCnz+aPxq8QJA=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=JwIvjDSjsdSLdLTmec8CT3FDfWN+tY3Tgae0e0YTsM0ipc1uZdcqzPZbp2hLyboDqdR4GdPfeqp/XwCnyTEPn9fER3gKaRj7CLnCNyV3kUUes82dGVMRly60YHVjeDSMuuzPlRki7TCCV3LtDyYPoTB7xlTpJHnXz5Hv1Oxy5mA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GcPr3RoF; arc=none smtp.client-ip=209.85.208.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com
Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-6024087086dso10933a12.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:12:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749219150; x=1749823950; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=95I2iPBNFDgcO0wVMG4TI/l0yeqGP5Gpnj7ClCifN1c=;
b=GcPr3RoFjSIPRbSGNScLUHHKs9yJaTi34X7945jq1vsqD4xN5iJ6RMRFEc3NBLO6lR
vRbWf/6f+JcVUcKDodF2hD7FTAUipq/i60l6EmvecskG534mEc49juPieKLp5WNJMtyP
88Esaox22Trh5wSgGL1AtlZnqFkl5Y3Vl84GNp9HjpfctFcbM4DqFZ7QXNw5c7Ni7v0F
qhYWOLJ3wtUkYEICzoNvMlxqb0+13ZzGbLHXUWyHJ5KSyXNKxD1D7vqiJeR78TVYJD4J
0jBo2koy42V/PYnc/i07ks5vTZxEpEDTcTtES/pbglFsS4V6rNiCdIphZMy64JG7QDV5
ot1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219150; x=1749823950;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=95I2iPBNFDgcO0wVMG4TI/l0yeqGP5Gpnj7ClCifN1c=;
b=MblBM/kj7uzKa2/h7OfUIUg1fc1KlomB9Y+W+40PfUa3pZFYcha0DVJrOmJoVf8LYQ
FQE/j3JPrZ1thOOELk4uBFAOevfzK/aXGtR7T+Xax6ANW3ZuOFNGDE0+7Nj77ik3jAC1
vIPjz9ZxRL9Q+bCNwRmHILMj3pjC8lxbQTtNpXBa5Oe3sh+ZMAUldp6amDXqjvbDPjzD
p9qmWfar+jYpNGakFtEG7scY2vNQA2bCi4Hv+52xw7UvMvGi7D2KjXJ2FyFjpDC5t0/N
okAu/BgVUtMw1GR7kb+BEiqy72YEknpKp+FPehEeEZc1a+vBGId5RdqqwKxukAg/6cZS
eQRQ==
X-Forwarded-Encrypted: i=1; AJvYcCUPBo4v54WPhtdrfsveabDwZ4E5yFTmf3wVdA/MrpEyQ+R8NOhtbXds4K4NI8rLiINCaBfBNAIHK7ZBUDY=@vger.kernel.org
X-Gm-Message-State: AOJu0YyYfK3V+WepbxGvIF61YQnNoXHqE6Vw15bvfiSb8kQQ9zQoO1uL
3+aA5FDzdnUlWQlA3Qs8RsWqhvFue1JWSeWVWATxWPppazmTrIDoSFtIx1kTKVy5oBU2TtXcI03
lv2IWSXsb0uri+OQSuFJyEdaVrc4s1jJA3Rqv95Qd
X-Gm-Gg: ASbGnctZpmUrCNiYKwexS5VQ6fDpIjroUp0t6oMKR5k1L/YFOTmKHBd4jR9bzcENy7C
ipV+YFz0LgVuVJSgt5fN0cJ7V47EttPjqVF0Lt8M0Sp/E6pJ3ZUfdMJQtsAFYA04qOad1453XJl
mxvzk5nFHYY7ZP13xrOgIoSjyIFOdSvm7H3qy8f/86AiUj9vhjtz8qs2lzwsemJx6TzioLj2xY7
g8PQdjv
X-Google-Smtp-Source: AGHT+IHqIn3Jk3eP+7LQUPBbUcuYi6EVLf341pqFYrDCsWsDFahP9S44GqvjMWx6jpK+6TRzbqVNtgGTgqWj1KfH+Gs=
X-Received: by 2002:aa7:c712:0:b0:604:58e9:516c with SMTP id
4fb4d7f45d1cf-607793dc3b2mr70098a12.5.1749219150123; Fri, 06 Jun 2025
07:12:30 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250603-fork-tearing-v1-0-a7f64b7cfc96@xxxxxxxxxx>
<20250603-fork-tearing-v1-2-a7f64b7cfc96@xxxxxxxxxx> <aEB8fFEXKPR54LdA@x1.local>
<CAG48ez3cgG-PikyO7a84CFdPFvPY9BSNJOZ7wZVQ7Q9Qju_6Ng@xxxxxxxxxxxxxx> <aECoHDM3l2dKTfDw@x1.local>
In-Reply-To: <aECoHDM3l2dKTfDw@x1.local>
From: Jann Horn <jannh@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 16:11:52 +0200
X-Gm-Features: AX0GCFuBXCdcVqd_TM6eMNdkMpWfdvVC0xldynLZs4JJ3m7vYu5AacWJNNxBRAU
Message-ID: <CAG48ez1sYGEt9HaR4_sKiHNp6Ouo5egQe5-ZDCHRzMs+HhxBbw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH 2/2] mm/memory: Document how we make a coherent memory snapshot
To: Peter Xu <peterx@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>, "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>,
Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Michal Hocko <mhocko@xxxxxxxx>, linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, Jun 4, 2025 at 10:10=E2=80=AFPM Peter Xu <peterx@xxxxxxxxxx> wrote:
> On Wed, Jun 04, 2025 at 08:11:08PM +0200, Jann Horn wrote:
> > On Wed, Jun 4, 2025 at 7:04=E2=80=AFPM Peter Xu <peterx@xxxxxxxxxx> wro=
te:
> > > On Tue, Jun 03, 2025 at 08:21:03PM +0200, Jann Horn wrote:
> > > > It is not currently documented that the child of fork() should rece=
ive a
> > > > coherent snapshot of the parent's memory, or how we get such a snap=
shot.
> > > > Add a comment block to explain this.
> > > >
> > > > Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>
> > > > ---
> > > > kernel/fork.c | 34 ++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 34 insertions(+)
> > > >
> > > > diff --git a/kernel/fork.c b/kernel/fork.c
> > > > index 85afccfdf3b1..f78f5df596a9 100644
> > > > --- a/kernel/fork.c
> > > > +++ b/kernel/fork.c
> > > > @@ -604,6 +604,40 @@ static void dup_mm_exe_file(struct mm_struct *=
mm, struct mm_struct *oldmm)
> > > > }
> > > >
> > > > #ifdef CONFIG_MMU
> > > > +/*
> > > > + * Anonymous memory inherited by the child MM must, on success, co=
ntain a
> > > > + * coherent snapshot of corresponding anonymous memory in the pare=
nt MM.
> > >
> > > Should we better define what is a coherent snapshot? Or maybe avoid =
using
> > > this term which seems to apply to the whole mm?
> > >
> > > I think it's at least not a snapshot of whole mm at a specific time,
> > > because as long as there can be more than one concurrent writers (hen=
ce, it
> > > needs to be at least 3 threads in the parent process, 1 in charge of =
fork),
> > > this can happen:
> > >
> > > parent writer 1 parent writer 2 parent fork thr
> > > --------------- --------------- ---------------
> > > wr-protect P1
> > > write P1 <---- T1
> > > (trapped, didn't happen)
> > > write PN <---- T2
> > > (went through)
> > > ...
> > > wr-protect PN
> > >
> > > The result of above would be that child process will see a mixture of=
old
> > > P1 (at timestamp T1) but updated P2 (timestamp T2). I don't think it=
's
> > > impossible that the userapp could try to serialize "write P1" and "wr=
ite
> > > PN" operations in a way that it would also get a surprise seeing in t=
he
> > > child PN updated but P1 didn't.
> >
> > If the write at T1 hits a page fault, then it doesn't actually happen
> > at T1. The write instruction starts doing something at T1, but it does
> > not fully retire, and the architectural register state does not
> > change, and in particular the instruction pointer does not advance
> > past this instruction; just like when speculative execution is aborted
> > after a branch misprediction, except that the CPU raises an exception
> > and we enter the page fault handler. The write actually happens when
> > the instruction is executed a second time after page fault handling
> > has completed after the mmap lock is dropped. (Unless something during
> > page fault handling raises a signal, in which case the instruction
> > might never architecturally execute.)
>
> Fair enough. So maybe that's something like a best-effort whole mm
> snapshot anytime happened during the fork() but before releasing mmap wri=
te
> lock.
>
> Your comment did mention one exception on the kernel, is it still pretty
> easy to happen? I'm thinking this use case of trying to load some data
> from a O_DIRECT fd and then set the var to show it's loaded:
>
> bool data_read=3D0
> read(...);
> data_read=3D1;
>
> Then IIUC this can happen:
>
> parent thread 1 parent fork thr
> --------------- ---------------
> read(...)
> using O_DIRECT on priv-anon buffers P1
> pin_user_pages
> fork() happens
> Sees P1 pinned
> P1 early COW (child sees no =
data loaded)
> memcpy()
> set data_read=3D1
> (data_read can be a global private var on P2)
> P2 wr-protected (child sees =
data_read=3D1)
>
> Hence in child even if it sees data_read=3D1 it is possible the buffer ma=
y be
> uninitialized, or the buffer is partly loaded, still racing with the kern=
el
> early COW.

Urgh. True, I had not considered that case.

> I'm not sure if I understand it correct this time as you discussed in the
> comment. If so, should we still not emphasize too much on the kernel
> providing coherent mm snapshot, at least emphasize the best-effort part
> (both in comment of patch 2, but also in patch subjects)? After all, it
> seems it isn't straightforward for any userapp to see when that coherency
> will be violated.

Yeah, at least I should add a big caveat in this comment about how
O_DIRECT read buffers might be stale in such a case, and that we're
doing the best we can with a single-pass approach. Urgh.

> From that POV, maybe it's better we should still suggest the undefined
> behavior, even if it'll recover the old behavior some existing use case?


Return-Path: <linux-kernel+bounces-675851-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8FD6641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:13:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B408B174978
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:13:35 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EB4CC289353;
Fri, 6 Jun 2025 14:13:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LwmlL8kq"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 252DF171C9;
Fri, 6 Jun 2025 14:13:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219207; cv=none; b=P31Armb7HZxP/Pm/VH3/IHczmI8lLSz3YS7zRPsp9mTlGJPmOGmd10Gzf/ljh08ogTDy3sio2Mb4CVyAPc92bUouUTI8lcBFyP2TpcA1QD4K+RnqGO7giaLWl58nho26/pmwXMadrfwIMMlLZrNxyjPNh610S83u7VkNP375BjA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219207; c=relaxed/simple;
bh=2CRemaQRzdnJp55TZWtADRVFdUvEf7uS5vdHs8BSb8M=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=kHgpFnQrqPjUZ4+t6xync97S8464Cn3JjVigIpydfRKjsDjCUlTQAOdNtW9luyZDRayUj25FG8XxcZKhmsmaWHWxhcMpJewkJNKA1YNsJqn39Wje0e+dlHjJHyfy5xacPo5tWNwCWHdMiFMssb+LhQitsVLzzP87edvqI7juoXs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LwmlL8kq; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70785C4CEEB;
Fri, 6 Jun 2025 14:13:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749219206;
bh=2CRemaQRzdnJp55TZWtADRVFdUvEf7uS5vdHs8BSb8M=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=LwmlL8kqbyg7+7ya8q4toLANoaNbVjrKGPHd+DnIDpG5wU8C/H0wlKKqIXo0+Yxby
7b+T3mNkGNL5fEbvyk3OaUVUq0PIDHUCaKmDIjCRsf3l3sFonhB+elGwDDD3peTOWL
EuPUXqeAzEaCV5u8TAZ1WG+I5L2w1TwA/f7Le9d5zhNzE7bHhXWO2Fm28Kc/vxLRlw
es0xlqgsgRrz62E3HqhMMSehcLptNfF9D7Vs4FZRYd6jCUrhrtOkjQ49kStrp/UAYm
9N4NNWjGS5AZeU0r5XlPhNZwoqMg0A2+tbttWTsyM624Vun1lEYp2rEhIWE4BKbx7D
5haRNQFF3giOA==
Date: Fri, 6 Jun 2025 09:13:24 -0500
From: Rob Herring <robh@xxxxxxxxxx>
To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= <u.kleine-koenig@xxxxxxxxxxxx>
Cc: Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>,
Thomas Gleixner <tglx@xxxxxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Sean Anderson <sean.anderson@xxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, linux-pwm@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
Chris Packham <Chris.Packham@xxxxxxxxxxxxxxxxxxx>
Subject: Re: New default binding for PWM devices? [Was: Re: [PATCH]
dt-bindings: timer: xlnx,xps-timer: Make PWM in example usable]
Message-ID: <20250606141324.GA1383279-robh@xxxxxxxxxx>
References: <20250527171504.346696-2-u.kleine-koenig@xxxxxxxxxxxx>
<a14be34c-de2a-4bea-9282-1fac7780b9a4@xxxxxxxxxx>
<crk42dsypmbyqk7avldghjq32vslmalfmmouwxzgtdci4agfhz@rkbmxj5z22fx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <crk42dsypmbyqk7avldghjq32vslmalfmmouwxzgtdci4agfhz@rkbmxj5z22fx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Tue, Jun 03, 2025 at 07:41:28PM +0200, Uwe Kleine-König wrote:
> Hello,
>
> On Wed, May 28, 2025 at 09:43:48AM +0200, Krzysztof Kozlowski wrote:
> > On 27/05/2025 19:15, Uwe Kleine-König wrote:
> > > With #pwm-cells = <0> no usable reference to that PWM can be created.
> > > Even though a xlnx,xps-timer device only provides a single PWM line, Linux
> > > would fail to determine the right (pwmchip, pwmnumber) combination.
> > >
> > > Fix the example to use the recommended value 3 for #pwm-cells.
> > >
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>
> > > ---
> > > Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > And what about the binding itself? It allows any arbitrary value.
> > Setting it to const=3 would not break the ABI, as long as driver does
> > not care.
>
> Oh indeed. Now I wonder about myself that I didn't notice that without a
> hint.
>
> So with the intention to move all drivers to #pwm-cells = <3>, the patch
> to create here is:
>
> diff --git a/Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml b/Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml
> index b1597db04263..8d7a87fb2d35 100644
> --- a/Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml
> +++ b/Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml
> @@ -26,7 +26,8 @@ properties:
> reg:
> maxItems: 1
>
> - '#pwm-cells': true
> + '#pwm-cells':
> + const: 3
>
> xlnx,count-width:
> $ref: /schemas/types.yaml#/definitions/uint32
> @@ -82,7 +83,7 @@ examples:
> };
>
> timer@800f0000 {
> - #pwm-cells = <0>;
> + #pwm-cells = <3>;
> clock-names = "s_axi_aclk";
> clocks = <&zynqmp_clk 71>;
> compatible = "xlnx,xps-timer-1.00.a";
>
> There is however one concern that I want to get resolved first to
> prevent churn:
>
> In principle I think it's bad that a phandle to a PWM must contain a
> period and flags specifying the polarity. For some use cases the period
> might not matter or is implicitly given or more than one period length
> is relevant.

Why can't the period be 0 and no flags set if they aren't needed?


> So I wonder if instead of unifying all PWM bindings to #pwm-cells = <3>
> I should instead go to something like
>
> mypwm: pwm {
> compatible = "...."
> #pwm-cells = <1>;
> };
>
> fan {
> compatible = "pwm-fan";
> pwms = <&mypwm 1>;
> assigned-pwms = <&mypwm>;
> assigned-pwm-default-period-lengths-ns = <40000>;
> assigned-pwm-default-flags = <PWM_POLARITY_INVERTED>;
> };
>
> (where the single cell specifies the index of the PWM's output).

Sigh. You just changed everyone to 3 cells and now you want to change
again? Changing existing users to 3 was borderline churn. Changing again
I won't be receptive to.


> I already suggested that in
> https://lore.kernel.org/linux-pwm/jmxmxzzfyobuheqe75lj7qcq5rlt625wddb3rlhiernunjdodu@tgxghvfef4tl/.
> When I asked about that in #armlinux Rob said "no. We don't need a 2nd
> way to set period and flags." Is this still a bad idea if the
> traditional binding with 3 cells will be deprecated for all PWM
> devices? If this would be ok then, I'm also open for improvements to
> the new concept. Maybe something like:
>
> fan {
> compatible = "pwm-fan";
> pwms = <&mypwm 1>;
> pwm-default-period-lengths-ns = <40000>;
> pwm-default-flags = <PWM_POLARITY_INVERTED>;
> };
>
> ?

How is this any different than a slight name change?

What I also said there is that case looked like a property of the fan.
If you want a default fan speed, then you should express that in fan
terms (i.e. RPM or %) and then have a table to go from fan speeds to fan
control settings (i.e. PWM duty cycle in this case). Even if you need
something like minimum startup duty cycle, that's still a property of
the fan.

It's the same thing for LEDs. What we ultimately care about is
brightness, not current or PWM duty cycle. So express things where we
can derive PWM duty cycle starting from brightness. And that's what the
bindings do.

Rob


Return-Path: <linux-kernel+bounces-675852-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 366DF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:14:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 00FA13B12E6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:14:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C686E289371;
Fri, 6 Jun 2025 14:14:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CaKortSk"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07F222874F9;
Fri, 6 Jun 2025 14:14:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219285; cv=none; b=vC59m1P0JswO0g02WF+FeWhRu0eNgnp7BRoSPZyMxZ55s7GagPOr3X438kMXT0fKz2xGgllZJAmTTaXtlyS+O3qESrhmDLOIyJXOgnFVSpczmbNejI91k84IdAXnHrSf60zYMwcAaRi2sXPeOYSXjWllT8ez329cTLKie6mD0Ew=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219285; c=relaxed/simple;
bh=39pmQdxSkt0c2D+ArHLlW6gILLh7CUV7D7iGTD7hAkk=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=nvFIlSXDq6FTcBeoNl+YaxJVpkY+hqYikgzITZKHmdiIITG4cCJI+tyAfiHrFfCehC69L/s7ptddJOwZ9iyV6yzOLPoMqe5JpMElkcerSUne8a0fVSi+UL1TRFRWrGa7UMcqaDyefPUE1kAZeR298eo5P26xa9D6nqHUxxtF/5w=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CaKortSk; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BB6CC4CEEB;
Fri, 6 Jun 2025 14:14:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749219283;
bh=39pmQdxSkt0c2D+ArHLlW6gILLh7CUV7D7iGTD7hAkk=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=CaKortSkRTmhC6Us6hrpg+/9Ya1IpbUoxPtBDSVvmcitOIycuJoYEjZwyPadzcYmp
pOhAbADR15yqqgoqDo3BerzMZcTmCRuhTo0NARtpqaMfcr8pQakUIU7q/6A5NOFIjk
OZNbnkiEpjqaosVv66OY3u3vhoK18Pw/gr2dnLc7VDCMJD4Sr7IbDBJVdPm9J+W9my
wICy1VF+4Z2YfELiOMb1mMsUpQjkIkDj0evCrpVrn2sQsq5UX6E+jps0Yn/BKwtFee
q+uyJ+32pN6Ly8b7D25o9ugXc6dz7YffZ0si3eiNrvG75RWaumNJ0/wkbJphaVgms+
DlIiNdeuW83Xw==
Date: Fri, 6 Jun 2025 09:14:41 -0500
From: "Rob Herring (Arm)" <robh@xxxxxxxxxx>
To: Frank Li <Frank.Li@xxxxxxx>
Cc: Marek Vasut <marex@xxxxxxx>, imx@xxxxxxxxxxxxxxx,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Fabio Estevam <festevam@xxxxxxxxx>,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>,
Shawn Guo <shawnguo@xxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
linux-spi@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 1/1] spi: dt-bindings: mxs-spi: allow clocks properpty
Message-ID: <174921927901.1475063.16362852854822063618.robh@xxxxxxxxxx>
References: <20250528222821.728544-1-Frank.Li@xxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250528222821.728544-1-Frank.Li@xxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On Wed, 28 May 2025 18:28:20 -0400, Frank Li wrote:
> Allow clocks property to fix below CHECK_DTB warnings:
> arch/arm/boot/dts/nxp/mxs/imx28-btt3-0.dtb: spi@80014000 (fsl,imx28-spi): Unevaluated properties are not allowed ('clocks' was unexpected)
>
> Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
> ---
> Documentation/devicetree/bindings/spi/mxs-spi.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>

Acked-by: Rob Herring (Arm) <robh@xxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675853-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E844841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:19:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3992C178718
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:19:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F96F487BE;
Fri, 6 Jun 2025 14:19:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j1iVkK0L"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C47211863E;
Fri, 6 Jun 2025 14:18:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219539; cv=none; b=I+4hp1Zp9o+MQXQL45KNPum1YsytffTkWqhS73HaZDm7NlAZUXgjMyn9n6PBMnzhm8JZkhenFjfzrflEk0Ej5oKNOxGGOy5Kg+qlqOtNEwYqNdrInCIdA4uNhi2ZYDZBKIQfYq+S2t/AxP5EOaMMTrliz00PwgvoM41NMMhzDI0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219539; c=relaxed/simple;
bh=pkkL6mHI4nb2yOPPIzaWJ0j+YolfgGRBjMLR/Ejsq4c=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=M+VugrtaKAFgzc3sTh0xO2cWFWoIVac7TkBIxGboopEGAMwWmptYC1ydO3XU9iZKvW2FEFo0fd7ENVWAzwmyfo8vmzWiIA3ol3S7AskF75/idkktgcA5nATvP4httrxNbWk2aVpnAQeGod7frj/q82Fm/VkqAcm647y4npdoTqo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j1iVkK0L; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 189F6C4CEEB;
Fri, 6 Jun 2025 14:18:58 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749219539;
bh=pkkL6mHI4nb2yOPPIzaWJ0j+YolfgGRBjMLR/Ejsq4c=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=j1iVkK0L7Ccl0msF0tGTZuRrE0YFQXXe2rKPaZuw5DZ2YNA+a+kUq7Eq8qTdm+mnK
TUDRDRhqGdVRkT/3RGndJ+nau61as9MGRgXpagFiyu0+2LicgiTrZs3nM6GYd5d9rS
JBCIv4OXDINGrbCYKC44oGkzGCewPxGLzi1AfGAdSGS3WPvpeRImIgeJnWkEXoirVW
5djXzYxSQTlNAUt3/60Kg18rYdbzah5FShiuC+RQhD/npg/Uibembo3fxvM7OEVKh+
ucDO4f3PMzVzoPE88njq5syfEKtRFjeePyv1JshnTawAkYDSGkji3qKooQxlwWlGgK
et2VhhKkPV1Zg==
Date: Fri, 6 Jun 2025 09:18:57 -0500
From: Rob Herring <robh@xxxxxxxxxx>
To: Alireza Sanaee <alireza.sanaee@xxxxxxxxxx>
Cc: devicetree@xxxxxxxxxxxxxxx, jonathan.cameron@xxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linuxarm@xxxxxxxxxx, mark.rutland@xxxxxxx,
shameerali.kolothum.thodi@xxxxxxxxxx, krzk@xxxxxxxxxx,
dianders@xxxxxxxxxxxx, catalin.marinas@xxxxxxx,
suzuki.poulose@xxxxxxx, mike.leach@xxxxxxxxxx,
james.clark@xxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx,
coresight@xxxxxxxxxxxxxxxx, gshan@xxxxxxxxxx, ruanjinjie@xxxxxxxxxx,
saravanak@xxxxxxxxxx
Subject: Re: [PATCH v3 7/7] of: of_cpu_phandle_to_id to support SMT threads
Message-ID: <20250606141857.GA1476878-robh@xxxxxxxxxx>
References: <20250512080715.82-1-alireza.sanaee@xxxxxxxxxx>
<20250512080715.82-8-alireza.sanaee@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250512080715.82-8-alireza.sanaee@xxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Mon, May 12, 2025 at 09:07:15AM +0100, Alireza Sanaee wrote:
> Enhance the API to support SMT threads, this will allow sharing
> resources among multiple SMT threads.
>
> Enabled the sharing of resources, such as L1 Cache and clocks, between
> SMT threads. It introduces a fix that uses thread IDs to match each CPU
> thread in the register array within the cpu-node. This ensures that the
> cpu-map or any driver relying on this API is fine even when SMT threads
> share resources.
>
> Additionally, I have tested this for CPU based on the discussions in
> [1], I adopted the new cpu-map layout, where the first parameter is a
> phandle and the second is the local thread index, as shown below:
>
> core0 {
> thread0 {
> cpu = <&cpu0 0>;
> };
> thread1 {
> cpu = <&cpu0 1>;
> };

I think the thread nodes should be omitted in this case.

> };
>
> Also, there are devices such as below that are a bit different.
>
> arm_dsu@0 {
> compatible = "arm,dsu";
> cpus = <&cpu0 &cpu1 &cpu2 &cpu3>;
> }
>
> In these cases, we can also point to a CPU thread as well like the
> following:
>
> arm_dsu@0 {
> compatible = "arm,dsu";
> cpus = <&cpu0 5 &cpu1 9 &cpu2 1 &cpu3 0>;

The purpose of 'cpus' properties is to define CPU affinity. I don't
think the affinity could ever be different for threads in a core.

And cpu1 having 10 threads is nonsense.

Most cases of 'cpus' (and 'affinity') lookups and then callers of
of_cpu_node_to_id() ultimately just want to set a cpumask. So we should
provide that rather than opencoding the same loop everywhere.

> }
>
> It should be possible to know how many arguments a phandle might
> require, and this information is encoded in another variable in the dt
> called #cpu-cells in cpu node.
>
> Signed-off-by: Alireza Sanaee <alireza.sanaee@xxxxxxxxxx>
>
> [1] https://lore.kernel.org/devicetree-spec/CAL_JsqK1yqRLD9B+G7UUp=D8K++mXHq0Rmv=1i6DL_jXyZwXAw@xxxxxxxxxxxxxx/
> ---
> drivers/of/cpu.c | 41 +++++++++++++++++++++++++++++++++--------
> 1 file changed, 33 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/of/cpu.c b/drivers/of/cpu.c
> index fba17994fc20..cf54ef47f029 100644
> --- a/drivers/of/cpu.c
> +++ b/drivers/of/cpu.c
> @@ -189,16 +189,41 @@ int of_cpu_phandle_to_id(const struct device_node *node,
> struct device_node **cpu_np,
> uint8_t cpu_idx)
> {
> + bool found = false;
> + int cpu, ret = -1, i, j;
> + uint32_t local_thread, thread_index;
> + struct device_node *np;
> + struct of_phandle_args args;
> + static const char * const phandle_names[] = { "cpus", "cpu" };
> + static const char * const cpu_cells[] = { "#cpu-cells", NULL };
> +
> if (!node)
> - return -1;
> + return ret;
>
> - *cpu_np = of_parse_phandle(node, "cpu", 0);
> - if (!*cpu_np)
> - *cpu_np = of_parse_phandle(node, "cpus", cpu_idx);
> - if (!*cpu_np)
> - return -ENODEV;
> + for (i = 0; i < ARRAY_SIZE(phandle_names); i++) {
> + for (j = 0; j < ARRAY_SIZE(cpu_cells); j++) {
> + ret = of_parse_phandle_with_args(node, phandle_names[i],
> + cpu_cells[j], cpu_idx,
> + &args);
> + if (ret >= 0)
> + goto success;
> + }
> + }
>
> - return of_cpu_node_to_id(*cpu_np);
> + if (ret < 0)
> + return ret;
> +success:
> + *cpu_np = args.np;
> + thread_index = args.args_count == 1 ? args.args[0] : 0;
> + for_each_possible_cpu(cpu) {
> + np = of_get_cpu_node(cpu, &local_thread);
> + found = (*cpu_np == np) && (local_thread == thread_index);
> + of_node_put(np);
> + if (found)
> + return cpu;
> + }
> +
> + return -ENODEV;
> }
> EXPORT_SYMBOL(of_cpu_phandle_to_id);
>
> @@ -206,7 +231,7 @@ EXPORT_SYMBOL(of_cpu_phandle_to_id);
> * of_get_cpu_state_node - Get CPU's idle state node at the given index
> *
> * @cpu_node: The device node for the CPU
> - * @index: The index in the list of the idle states
> +g* @index: The index in the list of the idle states

Oops!

> *
> * Two generic methods can be used to describe a CPU's idle states, either via
> * a flattened description through the "cpu-idle-states" binding or via the
> --
> 2.34.1
>


Return-Path: <linux-kernel+bounces-675855-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D4CA941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:20:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1A58B1786F2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E1F621339A4;
Fri, 6 Jun 2025 14:20:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="UmOUUv44"
Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFF0527468
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219641; cv=none; b=bdy0P7oQ6W1jXSf0Xbvm+y+iMvWQf5YzrK7i7bepdEwV82fsLy1Lx2MDdAb0dI9J7e7x+9qMupPkkqy+zCk8BoUlBWVOb+AGBRTRjDwb3ZHT+WJJJ66cCo2KIf8jkEfp+y+b2yBOTFvCye2MpBNto0wGVQOOP83dpRwozJHGmyg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219641; c=relaxed/simple;
bh=OZrzbP1SbRGVb+WCBZuIR/Xx/XISjeOLbhSk+S2W58Y=;
h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=HhMGEgyowVXKFrM2tnqvnGUeCcnrgLG88LrxFUZT1x/yMmLD1nGmlDKVcVd0zGPt+BRP10ZnrSpNufBawFtHbLE66ZJetT6AaQ4BdTT++QS7EJkf5zsktXQaebdNA0ZqneSQOvKpbewrH4LDd/sdifdBYTwp3E7fCuPzRnAWn3o=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=UmOUUv44; arc=none smtp.client-ip=209.85.128.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-43ea40a6e98so28022495e9.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:20:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749219636; x=1749824436; darn=vger.kernel.org;
h=cc:to:content-transfer-encoding:mime-version:message-id:date
:subject:from:from:to:cc:subject:date:message-id:reply-to;
bh=JjGat8Y0B+/GQXbzYuSVj2PQ8u5SUEo0nANMq38jBNs=;
b=UmOUUv449ZyMaqDfiJp/kfQVa3KlZ4Mfm+GHWHmAg5mvwjEj6CPFOMgQ7nwKflJV30
nvzy6WzssR+1wytBI9Ox4PH+TT46Ai9Ro7yftLqORivvWTlRW1ne7g+Em6oF2y54weHD
124uvlTxfodVPb7kgI2hiISVNd8N6A98OIxnitemKBIztrFQZE3tPrGR2/wqoahSImrL
ZgbJ6F/aJvcM5pYGCxooGDfHbRDGm0Bh3IVjhZxGLvFZ9PiIqx9RRl/m4C3/+MwIkooQ
cnkPxmLeO37IzQrgUoUrAp4uOpGeuGJHdWNmAeDIrYz6Tus5Mz2fLI1a1lq27YmQsfDG
BWpQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219636; x=1749824436;
h=cc:to:content-transfer-encoding:mime-version:message-id:date
:subject:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=JjGat8Y0B+/GQXbzYuSVj2PQ8u5SUEo0nANMq38jBNs=;
b=b5CupFB7uG/j25p9qIhbgobgSsv+jsf/5LkVsiDrn7LDLAoH6biCFmlujIjcwXfWmV
12LlFh0SlPgz0pZziyN59Bu1Uta57NNQh5+54zRi3cvsriPpGkFZL4uvu/efzpZoq0e7
hzdBJEuzmU9mSR9QcN6oM+qnn7K5CyM8kZaHc2r/8ZibdAv5QO+baCgeHM653jsaGnMG
97oTsqGUwGtta7m5kAYQ859Kw80hZNQCz557rYcSNHXfhKnureTRevb+WA4YL5+CjmYl
EhQ8EUfYQywVw4zTn8dwISE3C/+izoUmQYzBOn+Z8fAdP6r4IQkF/OcotbTULwyUsyu+
BDJQ==
X-Forwarded-Encrypted: i=1; AJvYcCXTJAMp+HIx3QXOhi7sRjr9IIdYrJU+xOio/WT7heLnVB1uz2mB0ZO5ebzBY3TydhfQfJQrefPK7G9GH7I=@vger.kernel.org
X-Gm-Message-State: AOJu0Ywt3zNhiNuB/IDi1AHyvnyIBwJc5U29845OXA1KfABMvcFoddTf
c2HCZlHg+LGahDFFgXNmHye7duxaWCGZlgZTf8gviIQK8ZUtpgDV22v6BNtoiUr29ck=
X-Gm-Gg: ASbGncsU9fO7B49KT/uabI0jC4HU5fCCRwtAMB7BlMXAqZHbr0PnTDquz2mmBETKAuq
qH8mGkV4rZf8U35C3Jk7gEDPLogs1XQMPS3q1pK237Rk1wrFEM+y2spAorivAnoMP5xfOvSrBgo
UCyIRZ9uttyqF1HRDb5/96xnfhhdY/aW+uwg0R+/jF1rYm49VFXnqGmZhZpLQyyC2xDxg/Co8Ty
0gZTYpfztJjzWalWa/rBCaaS27IxTFVcSqXpNPov1t+VhAofhMCJQ/1CJ6Ok77hQ9yiRNXGPATH
GsLB724vsLzZWwqo01LCeZuiM8k/aINCGjONoKVtDUDYgyLCm8oVd7Koq27Y1E++XQJnMtRPjj+
FIG+QmI8XmYq6c1x6AZo8r4KMI6uIJmMQIJ9Z/ffmjQ==
X-Google-Smtp-Source: AGHT+IGAmJ6OQn+Rk5+zosv7byWwapXctFy1BWUaDJa55qiK+0N+TiLKkkIXrOnKe/WuXhNlWgKrQQ==
X-Received: by 2002:a05:600c:3492:b0:440:6852:5b31 with SMTP id 5b1f17b1804b1-45201391186mr44123055e9.10.1749219635948;
Fri, 06 Jun 2025 07:20:35 -0700 (PDT)
Received: from [192.168.0.2] (host-80-116-51-117.retail.telecomitalia.it. [80.116.51.117])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213754973sm25686345e9.35.2025.06.06.07.20.34
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:35 -0700 (PDT)
From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Google-Original-From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
Subject: [PATCH v9 0/7] iio: adc: add ad7606 calibration support
Date: Fri, 06 Jun 2025 16:19:15 +0200
Message-Id: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
X-B4-Tracking: v=1; b=H4sIAOP4QmgC/43SwWoDIRAG4FcJnmsZR9fRnPoepQd1tRHSbNgN2
4aQd+9sLlnKIj3+ynzKz9zElMeaJ7Hf3cSY5zrV4cTBv+xEOoTTZ5a15ywQsAODXn7Xs4xHGXq
yYGUKxxrHcOEpiRC0t8GC7lDw/HnMpf487PcPzoc6XYbx+nhqVsvpf9RZSZA5mt44VFERvsVwX
a7zaxq+xALP+MQ6wBaGjCkysYdQwKm4gek1ZluYZszmSNFmQg20gZk15lqYYcyroAs6Tdlu/ax
bYarZWceYgc6URMkX3W9gdoVhszO7YI6iB6N1H2ADozXW7IwYi6wBYsrK+w3MPTHepRbmGENNK
pMCV/Tf1bjf779NyXBC4AIAAA==
X-Change-ID: 20250429-wip-bl-ad7606-calibration-20a396a60352
To: Jonathan Cameron <jic23@xxxxxxxxxx>,
David Lechner <dlechner@xxxxxxxxxxxx>,
=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>,
Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Michael Hennerich <michael.hennerich@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Angelo Dureghello <adureghello@xxxxxxxxxxxx>,
Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=4039;
i=adureghello@xxxxxxxxxxxx; h=from:subject:message-id;
bh=OZrzbP1SbRGVb+WCBZuIR/Xx/XISjeOLbhSk+S2W58Y=;
b=owGbwMvMwCXGf3bn1e/btlsznlZLYshw+vHMaM/+/17cT3Xklqiwa3EGrC55kt28KidmzyQ3I
eOcUImsjlIWBjEuBlkxRZa6xAiT0NuhUsoLGGfDzGFlAhnCwMUpABN5uJqRoedd0cojHl2xb8oD
zpy4VH7L92pY0lr15JJI98ZoT+nPWYwMpwKDQx4KyniXHuR6eWb9os9lquLnxZ7Mzl3mb3w8Wle
XAQA=
X-Developer-Key: i=adureghello@xxxxxxxxxxxx; a=openpgp;
fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add gain, offset and phase (as a delay) calibration support, for
ad7606b, ad7606c16 and ad7606c18.

Calibration is available for devices with software mode capability.

Offset and phase calibration is configurable by sysfs attributes, while
gain calibration value in ohms must match the external RFilter value,
when an external RFilter is available, so implemented through a specific
devicetree "adi,rfilter-ohms" property.

This patchset depends on:
https://lore.kernel.org/linux-iio/20250505131544.0a7477a2@jic23-huawei/

Signed-off-by: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
---
Changes in v9:
- add patch 6/7 changing chan_scale to a more generic chan_info,
- parse gain fdt property in existing function, to reduce code.
- Link to v8: https://lore.kernel.org/r/20250603-wip-bl-ad7606-calibration-v8-0-2371e7108f32@xxxxxxxxxxxx

Changes in v8:
- fix bug related to wrong calib gain setup,
- fix return value on wrong "reg" read from fdt on calib setup,
- fix commit messages/titles,
- add new function to write calib gain on ADC registers after reset.
- Link to v7: https://lore.kernel.org/r/20250526-wip-bl-ad7606-calibration-v7-0-b487022ce199@xxxxxxxxxxxx

Changes in v7:
- Fix each wrong commit desc. occurence related to convdelay.
- Fix ABI documentation with better words.
- Fix wrong comments in driver source code.
- Add r_gain default before reading the fdt value.
- Link to v6: https://lore.kernel.org/r/20250522-wip-bl-ad7606-calibration-v6-0-487b90433da0@xxxxxxxxxxxx

Changes in v6:
- exit for error in case of fdt that breaks the dt_schema,
- add (5/6) patch to fix the above on older code too,
- Link to v5: https://lore.kernel.org/r/20250519-wip-bl-ad7606-calibration-v5-0-4054fc7c9f3d@xxxxxxxxxxxx

Changes in v5:
- fix tab/spaces wrong formatting on ABI doc (1/5),
- fix description in ABI doc (1/5),
- fix code multiline alignments (3/5),
- fix calibration offset calculation as oneliner expression (3/5),
- Link to v4: https://lore.kernel.org/r/20250508-wip-bl-ad7606-calibration-v4-0-91a3f2837e6b@xxxxxxxxxxxx

Changes in v4:
- fix ad7606_chan_calib_gain_setup appropriately to be called once.
- Link to v3: https://lore.kernel.org/r/20250506-wip-bl-ad7606-calibration-v3-0-6eb7b6e72307@xxxxxxxxxxxx

Changes in v3:
- fix dt_bindings,
- change sysfs calib_delay to convdelay,
- fix sysfs documentation accordingly,
- used u32 for reg and r_gain,
- used DIV_ROUND_CLOSEST for setting r_gain,
- minor syntax fixes,
- Link to v2: https://lore.kernel.org/r/20250502-wip-bl-ad7606-calibration-v2-0-174bd0af081b@xxxxxxxxxxxx

Changes in v2:
- change phase_delay to calib_delay,
- fix dt_bindings,
- fix gain calibarion fdt parsing,
- fix ad7606c-18 calib offset range,
- fix calib offset calculation,
- fix calib gain range,
- Link to v1: https://lore.kernel.org/r/20250429-wip-bl-ad7606-calibration-v1-0-eb4d4821b172@xxxxxxxxxxxx

---
Angelo Dureghello (7):
Documentation: ABI: IIO: add new convdelay documentation
iio: core: add ADC delay calibration definition
iio: adc: ad7606: add offset and phase calibration support
dt-bindings: iio: adc: adi,ad7606: add gain calibration support
iio: adc: ad7606: exit for invalid fdt dt_schema properties
iio: adc: ad7606: rename chan_scale to a more generic chan_info
iio: adc: ad7606: add gain calibration support

Documentation/ABI/testing/sysfs-bus-iio | 24 ++
.../devicetree/bindings/iio/adc/adi,ad7606.yaml | 29 ++
drivers/iio/adc/ad7606.c | 351 ++++++++++++++++-----
drivers/iio/adc/ad7606.h | 22 +-
drivers/iio/industrialio-core.c | 1 +
include/linux/iio/types.h | 1 +
6 files changed, 347 insertions(+), 81 deletions(-)
---
base-commit: 351e9e8549a49300e674fc562b4b2a7e4bd74a66
change-id: 20250429-wip-bl-ad7606-calibration-20a396a60352

Best regards,
--
Angelo Dureghello <adureghello@xxxxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675854-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7DE3941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:20:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id BCAF91899B0A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:21:07 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CC8012B9A5;
Fri, 6 Jun 2025 14:20:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="255GtuGk"
Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 216C3288A8
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219641; cv=none; b=A3TM+5impM8dt891gzaMnXfHwW+dPid+ERYYjwvbiUXnOG3Ok1MPRZqS+l09+D72LzWxU7ahqOcMBl1hvN/dQAg5aVDPG4gjS//ZvnE40CsEp8YD3MyK/KbqQZ49wys3XKBx6LmQMXqZXdp7PvY8eNvtmz7DFbayAEu9YcXJzb8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219641; c=relaxed/simple;
bh=3MDKCzcRqE17jpMODKflA/mPPIlcttinXXOo2OBAwAs=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=lPtIlxrwp7VhEgw9XhQm9zKRzqDOmHgLS9otEwGkUylHrgzZcekqfEAVPLWYNT0yspPfvgeLEFZs/irtTZ3IOzbf1sSgutbAANKrvnei2vTl4cfttBHrBsaXKMrgWb6jx9itbDB7nfFAON+Qenv+ULJ8XUh8cXQaXKO0gNhRXTM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=255GtuGk; arc=none smtp.client-ip=209.85.128.53
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-450dd065828so16526875e9.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:20:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749219637; x=1749824437; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=BCECvT2ZqaLSupqrgHoRYTITFIBrUFbkXozj6gpUIgI=;
b=255GtuGkBXlI2UOWybrmrBwbIHQffrjov0sFZNJKZ4dJiWV2B15jbwXmMuNSVgNMHk
MEFB4VLhH3JwSO/n1AEyHblJF9NXlmASdp1uj51a0FxJFojjwDg/K+f3Dg3tQGDyE5Uj
hyZx3lXNQ1Lfv5HaYGFDR4Aiab5ktwePsonZ5W7XSP5W8iJbkWmlbwkYe+IxKiFGimhN
xUS3nXrnNuLp+NNfk4F2cfOqPupCwMdulVRMHik1PKSL5C8I5H6M8EDNfR7z+17hm119
WVn2jqM7KHQtfYmvY/aHMs2LM2ioPTY+HD5z231YHjigiYzf8Xg3RYJkwSAjXDLC4Ctp
AghA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219637; x=1749824437;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=BCECvT2ZqaLSupqrgHoRYTITFIBrUFbkXozj6gpUIgI=;
b=A0Fo85if3hoTbEDYb79+Q0vnmTW0goN4Ct/KAbZeNsC9P60IFqKWo9m1XPXyA1Xymg
AN3vhZutvvxXTFv0B5Mkw/BayM/gszTo8v3A6R5tCGFK3g9DWjKjAr1WRiZi0xK3x1Mf
rhfAxS2KYLzeiourYbc8nDbcIo1CY9gAPlef37GMGkpZx4zbQSDjT4JxjFmzV1U+sHpN
goyYARpuSTKcGZGxgtHFyg2wCpNHslUfA2CYX1SdElUvjjCgA9yr5qhj6UE18opA1HT5
zwbZbhc4BE0uRByB28U7AdQgUFRHbce6aMK7cmbYbHnHkYfDyWg/WDDXn+OF/T9tIzEQ
KZJQ==
X-Forwarded-Encrypted: i=1; AJvYcCWImGam2iBBPzGfZ2nth0WdfviuWo+5q1MOcWZzWlhVJ3L670NWDQp5wDq6mVJmSDWZxrY2kObRCub400E=@vger.kernel.org
X-Gm-Message-State: AOJu0YxSCiYSdViYWbumDnVCTA8wX8u2XkdO9o9LlgbG4hPcbMF2Mj5W
CqvHNMeRUQr12gFYonH6IivnNdHKSNEjRMWMPCOvBZpdQrHRkX0tO/UF8oX6d5vX9jA=
X-Gm-Gg: ASbGncsGToVepfLRgkjsO5wDah5V3HgidVroSJlpKbAD7T/rC0ZzelxPK+mgu4whyqn
Lccna0lh5bFZzSrwLlfSD2pZEKuTOZckJHh82Ul0vrvW5Ft7tVg2Esgj6NP+1SoLUaGlhh4drum
R5pufUdh4lh7S9nPYNn5pf8OM1R3X/E0kBKCNTCwNR/QI4a0XYxlZ4Pcr9Tw/0n2O1swy6tVVQx
lO4tELs0ts3uy3XtCqKHxK/xra1IbDEtRI/R7LXU/YE8s36IeVAxcYZU5E/KaUgduAIYLbAkf6T
l3BtA6jsjgFiwkSBbOdCux6gjLMW9e0AUdrTM7HolSSMUw1BgvSdqYsVnmprNPG8ZFTpm6u++8Q
DnpBo6nt7wPdRT1+UBRdbdl9Uia/+pX4=
X-Google-Smtp-Source: AGHT+IH59aMsKf3hdHtSKVIfRUVq4kAbJbYNUCQzRJeoDhtgAosvkcg81rm88rY6ZYDHdAP4zhIZwQ==
X-Received: by 2002:a05:600c:83cf:b0:450:b9c0:c7d2 with SMTP id 5b1f17b1804b1-452014146bamr37850795e9.11.1749219637319;
Fri, 06 Jun 2025 07:20:37 -0700 (PDT)
Received: from [192.168.0.2] (host-80-116-51-117.retail.telecomitalia.it. [80.116.51.117])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213754973sm25686345e9.35.2025.06.06.07.20.36
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:36 -0700 (PDT)
From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Google-Original-From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:19:16 +0200
Subject: [PATCH v9 1/7] Documentation: ABI: IIO: add new convdelay
documentation
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-wip-bl-ad7606-calibration-v9-1-6e014a1f92a2@xxxxxxxxxxxx>
References: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
In-Reply-To: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
To: Jonathan Cameron <jic23@xxxxxxxxxx>,
David Lechner <dlechner@xxxxxxxxxxxx>,
=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>,
Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Michael Hennerich <michael.hennerich@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=1850;
i=adureghello@xxxxxxxxxxxx; h=from:subject:message-id;
bh=HL+KRQj9p0fzRWOWKu4itMjiQokyOUQbf/17jsDSPRk=;
b=owGbwMvMwCXGf3bn1e/btlsznlZLYshw+vEsMrwlT6QtiT/9adzuwK9LpP7aftApjC3T3F78t
4r7zcHdHaUsDGJcDLJiiix1iREmobdDpZQXMM6GmcPKBDKEgYtTACbiHsfwV9iXRbItQ+bak6zk
qAqt8zvrmLdqZXKabucRPPnj/Y9D3xn+Sr/y+8PxyzuBNSWTM1CF80HtAc3bwXqTMkVr7+Xr29/
gBQA=
X-Developer-Key: i=adureghello@xxxxxxxxxxxx; a=openpgp;
fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>

Add new IIO "convdelay" documentation.

The ad7606 implements a phase calibation feature, in nanoseconds.
Being this a time delay, using the convdelay suffix.

Signed-off-by: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
---
Documentation/ABI/testing/sysfs-bus-iio | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index ef52c427a015cf47bb9847782e13afbee01e9f31..3bc386995fb6ddf5fd0718587a84d703cb973d70 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -559,6 +559,30 @@ Description:
- a small discrete set of values like "0 2 4 6 8"
- a range specified as "[min step max]"

+What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_convdelay
+KernelVersion: 6.17
+Contact: linux-iio@xxxxxxxxxxxxxxx
+Description:
+ Delay of start of conversion from common reference point shared
+ by all channels. Can be writable when used to compensate for
+ delay variation introduced by external filters feeding a
+ simultaneous sampling ADC.
+
+ E.g., for the ad7606 ADC series, this value is intended as a
+ configurable time delay in seconds, to correct delay introduced
+ by an optional external filtering circuit.
+
+What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_convdelay_available
+KernelVersion: 6.16
+Contact: linux-iio@xxxxxxxxxxxxxxx
+Description:
+ Available values of convdelay. Maybe expressed as:
+
+ - a range specified as "[min step max]"
+
+ If shared across all channels, <type>_convdelay_available
+ is used.
+
What: /sys/bus/iio/devices/iio:deviceX/in_accel_x_calibscale
What: /sys/bus/iio/devices/iio:deviceX/in_accel_y_calibscale
What: /sys/bus/iio/devices/iio:deviceX/in_accel_z_calibscale

--
2.49.0



Return-Path: <linux-kernel+bounces-675856-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B562F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:21:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 708F73B1622
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:50 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F24E189B8C;
Fri, 6 Jun 2025 14:20:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="UG8149b9"
Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E43E43AA9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219643; cv=none; b=oLIbjVyJN6AsrEk3tLkmusogcDdyEcbfKTXOO4EDwhg7Jb+DG9NzWvnlXO+SBueKQoFPMGFBbr8DkXfV2G2tUGrpLGds5gkWoMqb5rSESYkAxT6Ge3rg22L6bbpiYvOUyKId/MiVWc0B1MS56ixomHM3FKxfyCBuhvy6cmXB/HY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219643; c=relaxed/simple;
bh=cBfFaDkjp8cn9ZsqfhZtThmlU0g1ewE4x6fWUwfuIqQ=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=VLvuhF/pq5JupQPwx8sZdzT7WkI/MU2y+CAUCao/7rlQ2CGThhemh0S1g+iMYTo0EFzs00ws0Avh3D3X5aus39Ty09XbfaLHfOYCWpCNqvBY3OF2x9shAp/pxDi7+9WDy5azzfhDPW72J43tx7KXvrXQ/I32dqhL9X/5sDi9TSM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=UG8149b9; arc=none smtp.client-ip=209.85.221.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3a5257748e1so1566326f8f.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:20:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749219639; x=1749824439; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=Wv6YLDN8CkaWn53LtM3+C3UNFVc2t/n3NaXm0d2EaQs=;
b=UG8149b9fNLK5R4KGiFmRknnZ6FzjNFeG66lQutYDTAOVR01SaRXfQO+DYTBhAXI88
DRMJ9gs7d30XCyTFG2raeI2hC0g5UhVEVN6I63XdnaABMxzXE9wkZIdO4pLWvuNNsPMG
aHqqAxzJPmb1GhpJ63DrPli9043LJvPyJn1LoV4FjnxEJsKcl/mHQZ2z5OWQiwSVv850
LG0fnQSk7m8oRwCpwUmNwdDjiCCKxYeDr4fi29wK3jqbWOwhrirKRfRdnhN8r4b01BlS
mugAeabCugtAgWboTHKQrZQqiKNFoCHusWgwa77ial02NiN45eH+xj7gpg8OonKAC83c
6zUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219639; x=1749824439;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=Wv6YLDN8CkaWn53LtM3+C3UNFVc2t/n3NaXm0d2EaQs=;
b=q7QvF7Y/N4GrPOSZgPebp8U6sxN42eT4lkSaqIdL7CN5tDBnGKAXhDVLq/cp5/Ijrl
Pwc1zmYb0zmjtnHa9MNJStTZmvqBw74SGXygvzgwq9P3c1IPAEeWrk/D2NajE5KtaYlA
jI5id6XT4+8mE2pTtXnFIdJgNAAG5vDtSzorA/sr8BNNc0O14dartRQfkyxFC0HMQS1T
rTEjCCW6zAIYmYkPgTviPwz80Ow5DWSY3lV++VFY/zGNvEpu4whiQ2siWnYOs3twq4t4
FdRsBf2ycHKCMqnvxIJ4goqDHeDvWMgyMy5vw8DohiXCXKnzzlv+wTVHqyE0RSr38uzy
4nwA==
X-Forwarded-Encrypted: i=1; AJvYcCWoLx5w5giPItAJrNxrObIwb2pVjRALWB4cVEb0cVZkNxKwpljqzVaX2GyC/BON6ILHpDkoKLK5wfpQYeM=@vger.kernel.org
X-Gm-Message-State: AOJu0Yyih0D9/cgSKdjyvEQt+9R5gGxDAG0vgaTTINcaCn8I211dNUtj
om1Ss4YXMv7Af97F4eZsw9DEs0Mm3TZk2UPOd0yzx/21sk53fJWElViOHkm2dNl5Bds=
X-Gm-Gg: ASbGncuQNpA2FtkvKDdhS+AMEUnsNAqulKfC7A+NwEsX7PB6PB9le/YmbgKL1ADNeun
Oe9oM0WFo5+5OtdjO4Jo4/mMNcSqIhNK2QQ/NFLJPpmh9orPS+yPHsgy9z7AjlXpCkDRmkOf288
W1cKRT92UnWknW5EfcvItwJ8ND+w8wcayp0hKTz0W8lI7Y/XyaVR4GuVh6d+Ebf613gHOB9XErN
48ElNTqETjFhWTB9EJrGHVaFq/asysAPFtd0jobKjVo5+B+EbvvJjgC1s301oUCxnpBrOkCmm6F
53iR0opClq2JgFmNDYYpe4y0390z8scDC/N5U2vFF3YGyhczGcOp9tG5TmQzDx0bwVN0YexFBXV
VMdk0M+Cn++nxJQS6tk7N+mET2QNOJlk=
X-Google-Smtp-Source: AGHT+IF37F/jINDH7H2db1udG2JDyKrV0755zPZUiYV6DkuZZCp3DPM5k1KeUHEdsmDsp87Q/GpBTA==
X-Received: by 2002:a05:6000:402c:b0:3a4:ef00:a7ac with SMTP id ffacd0b85a97d-3a5319a7ae1mr3050442f8f.45.1749219638714;
Fri, 06 Jun 2025 07:20:38 -0700 (PDT)
Received: from [192.168.0.2] (host-80-116-51-117.retail.telecomitalia.it. [80.116.51.117])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213754973sm25686345e9.35.2025.06.06.07.20.37
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:38 -0700 (PDT)
From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Google-Original-From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:19:17 +0200
Subject: [PATCH v9 2/7] iio: core: add ADC delay calibration definition
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-wip-bl-ad7606-calibration-v9-2-6e014a1f92a2@xxxxxxxxxxxx>
References: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
In-Reply-To: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
To: Jonathan Cameron <jic23@xxxxxxxxxx>,
David Lechner <dlechner@xxxxxxxxxxxx>,
=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>,
Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Michael Hennerich <michael.hennerich@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=1303;
i=adureghello@xxxxxxxxxxxx; h=from:subject:message-id;
bh=1bBjL7VlkgNBkqwPeVPqoUWRyRoNRlMdTRY5+MPjmRY=;
b=owGbwMvMwCXGf3bn1e/btlsznlZLYshw+vFsApPX851X8qwZrpmor1L946L5+tWTw3/7b70/O
U9H6Qz3hY5SFgYxLgZZMUWWusQIk9DboVLKCxhnw8xhZQIZwsDFKQATCdJgZFh/4nRgUMb+5VtC
v7Kw/y99EpjQ33j33YqJ+tWhbvqlNlMY/vDUf33NZZjpeqDu9JoQha+PfRLsjxk0HTnvP2OmSfa
2x3wA
X-Developer-Key: i=adureghello@xxxxxxxxxxxx; a=openpgp;
fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>

ADCs as ad7606 implement a phase calibration as a delay. Add such
definition, needed for ad7606.

Signed-off-by: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
---
drivers/iio/industrialio-core.c | 1 +
include/linux/iio/types.h | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 178e99b111debc59a247fcc3a6037e429db3bebf..f13c3aa470d774bfe655d6a9fb00c263789db637 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -188,6 +188,7 @@ static const char * const iio_chan_info_postfix[] = {
[IIO_CHAN_INFO_CALIBAMBIENT] = "calibambient",
[IIO_CHAN_INFO_ZEROPOINT] = "zeropoint",
[IIO_CHAN_INFO_TROUGH] = "trough_raw",
+ [IIO_CHAN_INFO_CONVDELAY] = "convdelay",
};
/**
* iio_device_id() - query the unique ID for the device
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index d89982c98368cf72c0fc30fa66ab001e48af4e8b..ad2761efcc8315e1f9907d2a7159447fb463333e 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -69,6 +69,7 @@ enum iio_chan_info_enum {
IIO_CHAN_INFO_CALIBAMBIENT,
IIO_CHAN_INFO_ZEROPOINT,
IIO_CHAN_INFO_TROUGH,
+ IIO_CHAN_INFO_CONVDELAY,
};

#endif /* _IIO_TYPES_H_ */

--
2.49.0



Return-Path: <linux-kernel+bounces-675857-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BF76E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:21:24 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 0D8481899462
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:21:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A250E1A9B3D;
Fri, 6 Jun 2025 14:20:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="knH6/L/8"
Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49A6413AA20
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219644; cv=none; b=M1ksz3/khZb1wTR6ZOcCOffaYCArJp5wojgaDZAdBiPZLrvezlvjZRtyZ4TSbJHTzhiBkXq3RS5H0jHyW0fD6WNnGIuS00yteadwvFakTluQcaP6v2g/Kf7N997CYwbihTmrHdVuBYqhJz6F6gSl8qrXcEGIB3JDcW2sdY8tLN4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219644; c=relaxed/simple;
bh=f+7ognlnkY6ABMgqMvYNANME2eJG1YvGoQid+4LAH8A=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=ueiALOFe7v3mqjNjUmEYZWmL8CxVfKUmUpW7AgnSiO6d2gtRvrAMtYeb1XeMNrjJmK5lAnkx2/Y35thQI9pR3v+0N6TOLcoBrNV+X4t8rf9791BzUS7wbUEn1398FQnYbiMCnce2ZuRuhHSJe9RPMmeXMKbEk0Hi8MfJBPaqbIw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=knH6/L/8; arc=none smtp.client-ip=209.85.221.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3a4f379662cso1863811f8f.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:20:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749219641; x=1749824441; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=jZ28Kx5QxbLsb0Rtfg5i9W4w8GmfQk90Ip8Fmjx54W8=;
b=knH6/L/8bKWQ70j8y//qGp7dOAkjMccbvAe9lvI4Yhl//4w9pIhx7ZBga5gYH6trZR
m8D1S0kijl0r8AJC1kAZzLvYSbSOvn6xATDVPRhoGFU0dXcLTSKbqjN5//7DFzmb6Mkw
/mg7EIIN2cvGa4m88jin4E6Emstq6AVCFAo5YvU9gi7vhfwQCoCt96DZEnuRC9JdtHMv
zxRvlB/wiN4fNfh/W98Np/4hBTR5nGkpBx/sab5phx/BRVNSjrxXP+T1c7UabSe/IRe4
aAZfAGJdzUbVvCBk/uzvPuyRFOkzY8h5qwxYE6CW04i9utvnc80DtHz35+8VOUwbmGKd
SLEw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219641; x=1749824441;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=jZ28Kx5QxbLsb0Rtfg5i9W4w8GmfQk90Ip8Fmjx54W8=;
b=pXUGs9WSmw4eB8ugENuYcyT6gQmwfdEcuLg1bb0WEnUR+oJX8I4lCiLASiGQZWZt4M
drHWtxvn6vwepCnjSA8fBdsmGMCLT2DLrQUOQgpxw3YrUXAG4EX9glBOZ8F0tdvAygL7
9gq5nPteuAThTtAZcsVw/HdK/c2VTNnEI5oif50pR1YnVGjKRFPDAxPVpdNTtjTsMfDE
kfCTY0RZ7weRlxxrwmisRiIvxvuF0pxg3Ld6mPIXzKlqPw+ovMV9OUB+hORg0fiTNmoA
8mfpnpSRNsxf1pcllhWyAbq04yqtygvadBqsvhEJMy/YsCErXO/xlK/eNUdUX3E6c4Gg
j5Mg==
X-Forwarded-Encrypted: i=1; AJvYcCWuQWfavPL6xJpw3ARAo1bKYSk0FwA/f9tbc6r9OLyULGkkyDoTJB0o6JVba6dViza4MvBXnjrxAhTEMjs=@vger.kernel.org
X-Gm-Message-State: AOJu0YzjoBOa3leFODzF4bYJAAgWcQFGLc/OG0p/+twkfQ3+4GOxJpbt
hGmjuv07MZrsbZrgNtOTRmMoW4rPryDP7iXRPCH8LhGv52IICGD70LAamv45XwxTsH4=
X-Gm-Gg: ASbGncvcXnlycgA+DcmytPFvE7Sqr29o18Y4KGMlXT7OGUj/NNYJ2qvRti7C0jQnL9b
ZCSHYJQw1lVQwL+nvwm+TNlPDTSbGr/tdDLgNvj2aKkT7iitRfSiZVhzqBO46WXnc1dHDtTjchg
KPHLz5C2DLP/UpcAQc0TJ19sOXfrqsn763K2lgWP5WoMv6UlA5k/Fsl7m2pheqabcrQWRFua5t7
ZOT3nYc7GIhg/ngyqpXNOoFh3tm5K6zu+/CbNgLst5eAj1HxPDmv7MNVgY18f/d/4AavYrQU1vW
WqQPhAxamri1ajDLRiK2gYgGwQMoHsbO8uOsDX8aobKsuYroZ+EM7NK2WZqYesYT6anwplbq7Xn
CSWxdN2Mpo5ngJI+vv+XF8lnAlF2vqAQK95S34dDCGg==
X-Google-Smtp-Source: AGHT+IHhCj/YwN7oQ3fXOgIifxbVNhKuGlY1eNZwPXPGmMH9lESTEdVKh5c3xerKbBD26znzRGWiQg==
X-Received: by 2002:a05:6000:290d:b0:3a4:fb7e:5fa6 with SMTP id ffacd0b85a97d-3a5319b6aa4mr2628159f8f.1.1749219640153;
Fri, 06 Jun 2025 07:20:40 -0700 (PDT)
Received: from [192.168.0.2] (host-80-116-51-117.retail.telecomitalia.it. [80.116.51.117])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213754973sm25686345e9.35.2025.06.06.07.20.38
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:39 -0700 (PDT)
From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Google-Original-From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:19:18 +0200
Subject: [PATCH v9 3/7] iio: adc: ad7606: add offset and phase calibration
support
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-wip-bl-ad7606-calibration-v9-3-6e014a1f92a2@xxxxxxxxxxxx>
References: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
In-Reply-To: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
To: Jonathan Cameron <jic23@xxxxxxxxxx>,
David Lechner <dlechner@xxxxxxxxxxxx>,
=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>,
Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Michael Hennerich <michael.hennerich@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=9455;
i=adureghello@xxxxxxxxxxxx; h=from:subject:message-id;
bh=fCW7hUH+4D7M4y8C5+DvPW92iP3q60SPzFCMbSrvenM=;
b=owGbwMvMwCXGf3bn1e/btlsznlZLYshw+vGsZbODt2Dz693a6lPZXN59TD/IIMNaaLV+s8Snf
yurG3i4O0pZGMS4GGTFFFnqEiNMQm+HSikvYJwNM4eVCWQIAxenAEzkYD7DP3WGSWwxLNYy5eqe
zWqarzr0G2eHTZTa/uGbXdKu4zM/yTMyNPhG2N8oLr0/T67Au1bXZvJV/mvB7O/rd9Wk10U3nYj
iAQA=
X-Developer-Key: i=adureghello@xxxxxxxxxxxx; a=openpgp;
fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>

Add support for offset and phase calibration, only for
devices that support software mode, that are:

ad7606b
ad7606c-16
ad7606c-18

Tested-by: David Lechner <dlechner@xxxxxxxxxxxx>
Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
Signed-off-by: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
---
drivers/iio/adc/ad7606.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++
drivers/iio/adc/ad7606.h | 9 +++
2 files changed, 169 insertions(+)

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index 9e489c05dea6f0a9fd144640fb0e23775eb4f3d8..f0c22365f23fa2bf00edddcdd7d608bd1393bf28 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -95,6 +95,22 @@ static const unsigned int ad7616_oversampling_avail[8] = {
1, 2, 4, 8, 16, 32, 64, 128,
};

+static const int ad7606_calib_offset_avail[3] = {
+ -128, 1, 127,
+};
+
+static const int ad7606c_18bit_calib_offset_avail[3] = {
+ -512, 4, 508,
+};
+
+static const int ad7606b_calib_phase_avail[][2] = {
+ { 0, 0 }, { 0, 1250 }, { 0, 318750 },
+};
+
+static const int ad7606c_calib_phase_avail[][2] = {
+ { 0, 0 }, { 0, 1000 }, { 0, 255000 },
+};
+
static int ad7606c_18bit_chan_scale_setup(struct iio_dev *indio_dev,
struct iio_chan_spec *chan);
static int ad7606c_16bit_chan_scale_setup(struct iio_dev *indio_dev,
@@ -164,6 +180,8 @@ const struct ad7606_chip_info ad7606b_info = {
.scale_setup_cb = ad7606_16bit_chan_scale_setup,
.sw_setup_cb = ad7606b_sw_mode_setup,
.offload_storagebits = 32,
+ .calib_offset_avail = ad7606_calib_offset_avail,
+ .calib_phase_avail = ad7606b_calib_phase_avail,
};
EXPORT_SYMBOL_NS_GPL(ad7606b_info, "IIO_AD7606");

@@ -177,6 +195,8 @@ const struct ad7606_chip_info ad7606c_16_info = {
.scale_setup_cb = ad7606c_16bit_chan_scale_setup,
.sw_setup_cb = ad7606b_sw_mode_setup,
.offload_storagebits = 32,
+ .calib_offset_avail = ad7606_calib_offset_avail,
+ .calib_phase_avail = ad7606c_calib_phase_avail,
};
EXPORT_SYMBOL_NS_GPL(ad7606c_16_info, "IIO_AD7606");

@@ -226,6 +246,8 @@ const struct ad7606_chip_info ad7606c_18_info = {
.scale_setup_cb = ad7606c_18bit_chan_scale_setup,
.sw_setup_cb = ad7606b_sw_mode_setup,
.offload_storagebits = 32,
+ .calib_offset_avail = ad7606c_18bit_calib_offset_avail,
+ .calib_phase_avail = ad7606c_calib_phase_avail,
};
EXPORT_SYMBOL_NS_GPL(ad7606c_18_info, "IIO_AD7606");

@@ -681,6 +703,40 @@ static int ad7606_scan_direct(struct iio_dev *indio_dev, unsigned int ch,
return ret;
}

+static int ad7606_get_calib_offset(struct ad7606_state *st, int ch, int *val)
+{
+ int ret;
+
+ ret = st->bops->reg_read(st, AD7606_CALIB_OFFSET(ch));
+ if (ret < 0)
+ return ret;
+
+ *val = st->chip_info->calib_offset_avail[0] +
+ ret * st->chip_info->calib_offset_avail[1];
+
+ return 0;
+}
+
+static int ad7606_get_calib_phase(struct ad7606_state *st, int ch, int *val,
+ int *val2)
+{
+ int ret;
+
+ ret = st->bops->reg_read(st, AD7606_CALIB_PHASE(ch));
+ if (ret < 0)
+ return ret;
+
+ *val = 0;
+
+ /*
+ * ad7606b: phase delay from 0 to 318.75 μs in steps of 1.25 μs.
+ * ad7606c-16/18: phase delay from 0 µs to 255 µs in steps of 1 µs.
+ */
+ *val2 = ret * st->chip_info->calib_phase_avail[1][1];
+
+ return 0;
+}
+
static int ad7606_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
@@ -715,6 +771,22 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
pwm_get_state(st->cnvst_pwm, &cnvst_pwm_state);
*val = DIV_ROUND_CLOSEST_ULL(NSEC_PER_SEC, cnvst_pwm_state.period);
return IIO_VAL_INT;
+ case IIO_CHAN_INFO_CALIBBIAS:
+ if (!iio_device_claim_direct(indio_dev))
+ return -EBUSY;
+ ret = ad7606_get_calib_offset(st, chan->scan_index, val);
+ iio_device_release_direct(indio_dev);
+ if (ret)
+ return ret;
+ return IIO_VAL_INT;
+ case IIO_CHAN_INFO_CONVDELAY:
+ if (!iio_device_claim_direct(indio_dev))
+ return -EBUSY;
+ ret = ad7606_get_calib_phase(st, chan->scan_index, val, val2);
+ iio_device_release_direct(indio_dev);
+ if (ret)
+ return ret;
+ return IIO_VAL_INT_PLUS_NANO;
}
return -EINVAL;
}
@@ -765,6 +837,64 @@ static int ad7606_write_os_hw(struct iio_dev *indio_dev, int val)
return 0;
}

+static int ad7606_set_calib_offset(struct ad7606_state *st, int ch, int val)
+{
+ int start_val, step_val, stop_val;
+ int offset;
+
+ start_val = st->chip_info->calib_offset_avail[0];
+ step_val = st->chip_info->calib_offset_avail[1];
+ stop_val = st->chip_info->calib_offset_avail[2];
+
+ if (val < start_val || val > stop_val)
+ return -EINVAL;
+
+ offset = (val - start_val) / step_val;
+
+ return st->bops->reg_write(st, AD7606_CALIB_OFFSET(ch), offset);
+}
+
+static int ad7606_set_calib_phase(struct ad7606_state *st, int ch, int val,
+ int val2)
+{
+ int wreg, start_ns, step_ns, stop_ns;
+
+ if (val != 0)
+ return -EINVAL;
+
+ start_ns = st->chip_info->calib_phase_avail[0][1];
+ step_ns = st->chip_info->calib_phase_avail[1][1];
+ stop_ns = st->chip_info->calib_phase_avail[2][1];
+
+ /*
+ * ad7606b: phase delay from 0 to 318.75 μs in steps of 1.25 μs.
+ * ad7606c-16/18: phase delay from 0 µs to 255 µs in steps of 1 µs.
+ */
+ if (val2 < start_ns || val2 > stop_ns)
+ return -EINVAL;
+
+ wreg = val2 / step_ns;
+
+ return st->bops->reg_write(st, AD7606_CALIB_PHASE(ch), wreg);
+}
+
+static int ad7606_write_raw_get_fmt(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan, long info)
+{
+ switch (info) {
+ case IIO_CHAN_INFO_SCALE:
+ return IIO_VAL_INT_PLUS_MICRO;
+ case IIO_CHAN_INFO_SAMP_FREQ:
+ case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
+ case IIO_CHAN_INFO_CALIBBIAS:
+ return IIO_VAL_INT;
+ case IIO_CHAN_INFO_CONVDELAY:
+ return IIO_VAL_INT_PLUS_NANO;
+ default:
+ return -EINVAL;
+ }
+}
+
static int ad7606_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val,
@@ -818,6 +948,18 @@ static int ad7606_write_raw(struct iio_dev *indio_dev,
if (val < 0 && val2 != 0)
return -EINVAL;
return ad7606_set_sampling_freq(st, val);
+ case IIO_CHAN_INFO_CALIBBIAS:
+ if (!iio_device_claim_direct(indio_dev))
+ return -EBUSY;
+ ret = ad7606_set_calib_offset(st, chan->scan_index, val);
+ iio_device_release_direct(indio_dev);
+ return ret;
+ case IIO_CHAN_INFO_CONVDELAY:
+ if (!iio_device_claim_direct(indio_dev))
+ return -EBUSY;
+ ret = ad7606_set_calib_phase(st, chan->scan_index, val, val2);
+ iio_device_release_direct(indio_dev);
+ return ret;
default:
return -EINVAL;
}
@@ -996,6 +1138,14 @@ static int ad7606_read_avail(struct iio_dev *indio_dev,
*type = IIO_VAL_INT_PLUS_MICRO;

return IIO_AVAIL_LIST;
+ case IIO_CHAN_INFO_CALIBBIAS:
+ *vals = st->chip_info->calib_offset_avail;
+ *type = IIO_VAL_INT;
+ return IIO_AVAIL_RANGE;
+ case IIO_CHAN_INFO_CONVDELAY:
+ *vals = (const int *)st->chip_info->calib_phase_avail;
+ *type = IIO_VAL_INT_PLUS_NANO;
+ return IIO_AVAIL_RANGE;
}
return -EINVAL;
}
@@ -1058,6 +1208,7 @@ static const struct iio_info ad7606_info_sw_mode = {
.read_raw = &ad7606_read_raw,
.write_raw = &ad7606_write_raw,
.read_avail = &ad7606_read_avail,
+ .write_raw_get_fmt = ad7606_write_raw_get_fmt,
.debugfs_reg_access = &ad7606_reg_access,
.validate_trigger = &ad7606_validate_trigger,
.update_scan_mode = &ad7606_update_scan_mode,
@@ -1250,6 +1401,15 @@ static int ad7606_probe_channels(struct iio_dev *indio_dev)
chan->info_mask_separate_available |=
BIT(IIO_CHAN_INFO_SCALE);

+ if (st->chip_info->calib_offset_avail) {
+ chan->info_mask_separate |=
+ BIT(IIO_CHAN_INFO_CALIBBIAS) |
+ BIT(IIO_CHAN_INFO_CONVDELAY);
+ chan->info_mask_separate_available |=
+ BIT(IIO_CHAN_INFO_CALIBBIAS) |
+ BIT(IIO_CHAN_INFO_CONVDELAY);
+ }
+
/*
* All chips with software mode support oversampling,
* so we skip the oversampling_available check. And the
diff --git a/drivers/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h
index 441e62c521bcbea69b4f70bb2d55f65334d22276..f613583a7fa4095115b0b28e3f8e51cd32b93524 100644
--- a/drivers/iio/adc/ad7606.h
+++ b/drivers/iio/adc/ad7606.h
@@ -40,6 +40,11 @@
#define AD7606_RANGE_CH_ADDR(ch) (0x03 + ((ch) >> 1))
#define AD7606_OS_MODE 0x08

+#define AD7606_CALIB_GAIN(ch) (0x09 + (ch))
+#define AD7606_CALIB_GAIN_MASK GENMASK(5, 0)
+#define AD7606_CALIB_OFFSET(ch) (0x11 + (ch))
+#define AD7606_CALIB_PHASE(ch) (0x19 + (ch))
+
struct ad7606_state;

typedef int (*ad7606_scale_setup_cb_t)(struct iio_dev *indio_dev,
@@ -61,6 +66,8 @@ typedef int (*ad7606_sw_setup_cb_t)(struct iio_dev *indio_dev);
* @init_delay_ms: required delay in milliseconds for initialization
* after a restart
* @offload_storagebits: storage bits used by the offload hw implementation
+ * @calib_offset_avail: pointer to offset calibration range/limits array
+ * @calib_phase_avail: pointer to phase calibration range/limits array
*/
struct ad7606_chip_info {
unsigned int max_samplerate;
@@ -74,6 +81,8 @@ struct ad7606_chip_info {
bool os_req_reset;
unsigned long init_delay_ms;
u8 offload_storagebits;
+ const int *calib_offset_avail;
+ const int (*calib_phase_avail)[2];
};

/**

--
2.49.0



Return-Path: <linux-kernel+bounces-675858-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 806D041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:21:37 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 41BAB1899F20
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:21:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A11D1C7009;
Fri, 6 Jun 2025 14:20:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="lLtuejX3"
Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FF9017B425
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219646; cv=none; b=CnOTRdmpbRbppow92S0NkKhPZpfdlXF6W+obSfNoCaPwjaQjxaH+fN03Po0peRORISw5iIFi9OUU+2Qa+O3V+yJ6fpg5GaktX6IV3OXZHIqmM2dHC7esidFwG4JH5AgogKBjU+Q2VEFiCg+ZoJtSOInk0UqpprA0cQoU4e44Yps=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219646; c=relaxed/simple;
bh=NtotUFQE861trIH/6KVUMJlh1RHFkSekY2PpGsDNTzs=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=bNrq3P9/ZhXQUxxb5gl5K9INAfyt9H5ypmMvMgT43a16QC6Q0ZHFSTuvWkgH6du6lsBi/fv2QrcLVLem0XCMg6Nip1ekzRadNVslF959wRprJ8RcrxQ6nzoHlrUtdXWYM58SwBsP3BKIm3rJg6opNy8l44lJvQHBtawG8GTEJXc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=lLtuejX3; arc=none smtp.client-ip=209.85.221.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3a4f71831abso2073682f8f.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:20:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749219642; x=1749824442; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=SSPYC82OHD2BI/YU/tjmuoLa3AQcRKZBypSGl/10x2A=;
b=lLtuejX3slvpCHU5i4svKXMgnvnLvKMSNrDwTfrfZr4seE5NN7DXsUvdXy8mAhg8zc
vLxQ5Z+RK7lcPCEH84kmRBoq1WU9PJHqXpVZVTqAAnGeb+Obw5hmv22WqkFDvfA3UtNh
+0xUY1Lxb1DWn4INjEkWAWYmkh5LF5BqaeUMGrH2tgaLfnEA1qoMIv6jszDUagmREmWp
BZ9ypARgXCHZ/5U2CMMJqRg8fXliJaMI+vMnAjwa1oo3r2ra7x+q5AlsCrVYF0venqFi
jW5Plgraw/5hXShlLZ0Zhjm4kBFG6psp6PxVhpn7RrfTcJcgDwfamj+FMtI+viXtjwsA
llmw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219642; x=1749824442;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=SSPYC82OHD2BI/YU/tjmuoLa3AQcRKZBypSGl/10x2A=;
b=lkGCiXoV4DHHsEhUfV58n+jBlyA4CoRbJ3yxmYP1Tg00qMTQAZAiWKaGgvVrIIlist
emQfg2ytbaRYNX8zSWUkzZ5j/M9XsQGy7y1TNSXD4E4Rq0nvTsTvJQl6l4IB3zUTwWP0
dvRGbkD5/h/ya4Y2it/DSPOQnzMEjNygQ2iehhEfGZsKUQxI9iMJEpQEZb6JUifaIJGj
h6bQYE2m4ahZ0e37X1wnrQMihZSiXImemYO/0IAKWqibG7Pn60rltWlBKszLfC96BJyO
ey+wYF1q16/U4ZCf7GM/QBFQrL43kkRIvC9qb8Qjx8u3z5X0Ex7ltjXT5P9aQm8TunbJ
qokQ==
X-Forwarded-Encrypted: i=1; AJvYcCVPvVu7+97xTgL8RI5uKF5ivOGaLe6jOpuYrGSy9vOfTs8KzwV3ZAeaQSXTa+TYxPMt+0ZnyPFrU3frvTA=@vger.kernel.org
X-Gm-Message-State: AOJu0YxJb+aExzHG9nufysL/zq41fSN5UOgf5wvuJ6/slEDj4SUVlYJA
QSCS5zD6zT8kKVX93md9y0X4mPIKBbGyPv94OjNMRLfEQKj4CvfZ2X4GEuQHZorG6ZM=
X-Gm-Gg: ASbGncvwBI3ICqC3NYPDCp4SgyOBTdC/LRn05jQP55LRoaazbFy9P/nU78fKsG4PtUM
KknZjKWfEmADdT3yH4XZv301f8KwLSgtibPMCMvEwaLy+EnK5ID0kP5QXSi8t0KYybmNY1sfHve
ttz5sQ0kiCnxvRcHTp04i7l/IIPbv7eGhuhjVOhoWaY0DslFvHY2kPfzXh6tprHiTseDv6294sq
/WRBAM7F/4QdAouHLbZzpDe6DNsXd6Z0scIedYzWqD35Iderlo6gZk9lyWyu+dCSu/KniCWwYHf
lwHLAKFhHWv/UKvkUEeWE66ql3pf/gLQq+TICTj6j7CYshvGFsZQXcLLcNTFBIMiOhNMuviA/T1
rciTmoBoQslilSHOwhFAQffEicAJDRqrPxHbi1YeBlQ==
X-Google-Smtp-Source: AGHT+IEPSADRuivjsBAwnxDwELX3J0cYKMrPAlNjoba2OLvJNlyJgJfrVNB7PQfFuEos6eyJm7zU2g==
X-Received: by 2002:a05:6000:22c4:b0:3a5:2f23:3789 with SMTP id ffacd0b85a97d-3a53188d5cfmr2988081f8f.15.1749219641589;
Fri, 06 Jun 2025 07:20:41 -0700 (PDT)
Received: from [192.168.0.2] (host-80-116-51-117.retail.telecomitalia.it. [80.116.51.117])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213754973sm25686345e9.35.2025.06.06.07.20.40
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:41 -0700 (PDT)
From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Google-Original-From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:19:19 +0200
Subject: [PATCH v9 4/7] dt-bindings: iio: adc: adi,ad7606: add gain
calibration support
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-wip-bl-ad7606-calibration-v9-4-6e014a1f92a2@xxxxxxxxxxxx>
References: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
In-Reply-To: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
To: Jonathan Cameron <jic23@xxxxxxxxxx>,
David Lechner <dlechner@xxxxxxxxxxxx>,
=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>,
Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Michael Hennerich <michael.hennerich@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Angelo Dureghello <adureghello@xxxxxxxxxxxx>,
Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=2030;
i=adureghello@xxxxxxxxxxxx; h=from:subject:message-id;
bh=mK1GoQiX2hS20/yC/1czrPjfc5t1uAwSltJDkMx72Mc=;
b=owGbwMvMwCXGf3bn1e/btlsznlZLYshw+vGszPKRm63gXMlsYU25p/+9pCYJzNvw3ZXJrWmy5
gVJ5oV7O0pZGMS4GGTFFFnqEiNMQm+HSikvYJwNM4eVCWQIAxenAEzE6jbDf8cJPqdERXo7/dob
1gZM6W+U/um4QMru1QcHV5v1Fr//xwJVuF/PW/jn7zF1he36bNKT+jU05/3ebmv1ZN1pB4UAVQ4
eAA==
X-Developer-Key: i=adureghello@xxxxxxxxxxxx; a=openpgp;
fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>

Add gain calibration support by a per-channel resistor value.

Acked-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
Signed-off-by: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
---
.../devicetree/bindings/iio/adc/adi,ad7606.yaml | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
index 29f12d650442b8ff2eb455306ce59a0e87867ddd..6926f5f090ad6bbbe7bfd9327dc5ae17dafcd1fd 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
@@ -204,6 +204,15 @@ patternProperties:
considered a bipolar differential channel. Otherwise it is bipolar
single-ended.

+ adi,rfilter-ohms:
+ description:
+ For ADCs that supports gain calibration, this property must be set to
+ the value of the external RFilter resistor. Proper gain error
+ correction is applied based on this value.
+ default: 0
+ minimum: 0
+ maximum: 64512
+
required:
- reg
- bipolar
@@ -256,6 +265,25 @@ allOf:
properties:
adi,oversampling-ratio-gpios: false

+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - adi,ad7605-4
+ - adi,ad7606-4
+ - adi,ad7606-6
+ - adi,ad7606-8
+ - adi,ad7607
+ - adi,ad7608
+ - adi,ad7609
+ - adi,ad7616
+ then:
+ patternProperties:
+ "^channel@[0-9a-f]+$":
+ properties:
+ adi,rfilter-ohms: false
+
- if:
properties:
compatible:
@@ -398,6 +426,7 @@ examples:
reg = <8>;
diff-channels = <8 8>;
bipolar;
+ adi,rfilter-ohms = <2048>;
};

};

--
2.49.0



Return-Path: <linux-kernel+bounces-675859-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C009041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:21:45 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2E6803A224A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:21:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 990D71C8610;
Fri, 6 Jun 2025 14:20:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="xl8zDuQg"
Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E863419D087
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219646; cv=none; b=bp1gJVIXf65Gi5KhjxYK32H3vEXyDiE34B0/+FF5Kni8xyNSTlEF7/CMtld0BaGnvaVGvuQyEpLb0823S88BZMf3OXmkItff8/smKzZnwFIO8pF07LDMR65nhzmbLEVqA2HBj8aUabzou8/K8dvx86HYS1ti8Ydip7DPw7/ikUo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219646; c=relaxed/simple;
bh=gYfEpf2B0eWfEeN9J0NWkVxgQeOXhE0vWQqSI1AdL6w=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=O0P9nBLBKlpH9gNj9Q4lf3lvL1kJ6dCOjzE+ccOz7cnimr2O3tWgsgAoen0s5+SCdhXzNT0DMDCROogobk3Y8zAEXSdBCX16DNN3PeJ8UQTrx50ZgUsrT3WWmXAZRWGxQGhJm7zd/+b6LsU6D0PCaXQgOJhVgIPcX0WFlk8lw70=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=xl8zDuQg; arc=none smtp.client-ip=209.85.221.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3a4f71831abso2073721f8f.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:20:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749219643; x=1749824443; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=G1WuSemWPuN4SdNDyJuKtWMwJnRcINbePcyuYFAeNSg=;
b=xl8zDuQgOcvXr26pndVTz9RWxSiJfigwaOWDjUCCUw52d27jJEQnYgTocxzmfC2Uwo
900ElBBmYlOzi8NeBJoHUsZ7w6mKaPDyJEDPJUaWgO1bOpm/oZRnoyC0WIlL7dLzQg9S
ZI1r+ZBKdT4QF1zAfNB8BOZLo/SfrqYpnvIdursH11lOLSDrmUYJXh25v12npT40okEE
A2WWcLv345N0PNBY62VpXLKN8ni4d8PHNHn4dsCr7KSjssjBp9UnKoCm5aKhDdH3bgjA
5V4Jj7xjRpYOcomRJj9A2o9EH9dYJmtWsFByvR8oqhW3ol0BhwCPW8Rej6B/xahn6Fy+
aPdg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219643; x=1749824443;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=G1WuSemWPuN4SdNDyJuKtWMwJnRcINbePcyuYFAeNSg=;
b=VoBFCUGUJGT8F3JgCpW6OKumoPA4HbcMSvX/Y4K/FtsAhpftCl6+3xlpGkUiWbRGdB
Pst1Dje8cEyAcuqi/dR3D+92s+qYPzD10m4IUfAhbml8lAk3+hucYUcDZBIDlGMrxpi7
ZtolWF2LODdno156jBZVRf7Yl5WQPiD1XT02wAmiKgl/2GN3RnVa86HpEZ24zH5tn7fS
+uQbeUejC6qvUe2rUWcweaYjSSQflfsz2HHCZ129whIYcqNDggcNrtV+Y5sWTzHZGF78
QYQVlvhDTT5fpKExnTDSmZaWzK2tNZ0eQGGEBa717H/e0WjuZivsR4ee7f6i1X46hP2t
M1eQ==
X-Forwarded-Encrypted: i=1; AJvYcCX5/MDvfu9HQZ+IOmWcrkX8HH1qfx3g1JdpKmV1Pylku89+0iCwDDDUOgxVegARDwwSEMsPIXnVepU1iWA=@vger.kernel.org
X-Gm-Message-State: AOJu0YxjrLCMuI8H3hCBDgfWqC8kcoaEzmhdt7mJDeicvgu8hxuvJyaM
9gt1kjk+K069a/io0KYT58yMV+78yuD3FKQZZu/NWisP7x/x8YfL4UiuTLcZ8diEwo8=
X-Gm-Gg: ASbGncsdIvBywYq0Z06wMHzo6dPUAPqioFye7cWSki1EN3alzxDN1GOU/sysvvkoJki
3urUMcOUgYZtCupTN/auMMLhiji0vzgkHA2ZfLnVZDE6WH7Jn0hl1cG+yClOCmSu4KutUBfNo54
Zhwbg6egbWEriu6nIzo2DHPLD+lSBvY9iLwJBNspnK43hHLCrg0bCuSBIvOSPczZOcWPSRXDswM
MNNoKvkarUOnNzsh442/9bJTvQR8CFPryTYhAAlF47UWH/HWsyWSBW5wqy3peX4nRxpztTYcSD+
TIcOeIN9j1gmrH6eqSHyDHI7hTQ9qM/z8kvnfAjnYgHWW9O7yIM5KqkHeMu7+157N5HjDwldfQL
1f40Hsv9Pe24S5RJVs+grk8xdv8Xz9yE=
X-Google-Smtp-Source: AGHT+IFtlzsfvKdrGidMqXsh4h0hFXBsNFDQ1/vkDgbyZn8qf/GpmYhHZbaV81p1vbt2rpfR/6BT2w==
X-Received: by 2002:a05:6000:2288:b0:3a4:f8fa:8a3a with SMTP id ffacd0b85a97d-3a53188d961mr2814047f8f.18.1749219643145;
Fri, 06 Jun 2025 07:20:43 -0700 (PDT)
Received: from [192.168.0.2] (host-80-116-51-117.retail.telecomitalia.it. [80.116.51.117])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213754973sm25686345e9.35.2025.06.06.07.20.41
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:42 -0700 (PDT)
From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Google-Original-From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:19:20 +0200
Subject: [PATCH v9 5/7] iio: adc: ad7606: exit for invalid fdt dt_schema
properties
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-wip-bl-ad7606-calibration-v9-5-6e014a1f92a2@xxxxxxxxxxxx>
References: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
In-Reply-To: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
To: Jonathan Cameron <jic23@xxxxxxxxxx>,
David Lechner <dlechner@xxxxxxxxxxxx>,
=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>,
Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Michael Hennerich <michael.hennerich@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=1153;
i=adureghello@xxxxxxxxxxxx; h=from:subject:message-id;
bh=RXow6w1uaNfMkBVbDyKeZVZMYqn8OBoe2df7BYhUk/U=;
b=owGbwMvMwCXGf3bn1e/btlsznlZLYshw+vHse9SpmdYf179kvjN5/seTMywr79gmJh3gnBwbK
pF668miZR2lLAxiXAyyYoosdYkRJqG3Q6WUFzDOhpnDygQyhIGLUwAm4uTIyDBpwyLzDUkNLtua
7j08+P22bl+43sTQnbIHNP4UZh+48bCf4a80x7GdF/Rj1i77ov0u/d6vGTIef2xfB5w48a9jU27
goxw+AA==
X-Developer-Key: i=adureghello@xxxxxxxxxxxx; a=openpgp;
fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>

Fix ad7606_get_chan_config() fdt parsing function to exit for error in
case of invalid dt_schema values.

Idea is to not proceed when there are values that are not allowed under
the dt_schema.

Signed-off-by: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
---
drivers/iio/adc/ad7606.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index f0c22365f23fa2bf00edddcdd7d608bd1393bf28..e5878974a28293664dd8dbded5fffcea6db31ef3 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -319,15 +319,13 @@ static int ad7606_get_chan_config(struct iio_dev *indio_dev, int ch,

ret = fwnode_property_read_u32(child, "reg", &reg);
if (ret)
- continue;
+ return ret;

/* channel number (here) is from 1 to num_channels */
- if (reg < 1 || reg > num_channels) {
- dev_warn(dev,
- "Invalid channel number (ignoring): %d\n", reg);
- continue;
- }
+ if (reg < 1 || reg > num_channels)
+ return -EINVAL;

+ /* Loop until we are in the right channel. */
if (reg != (ch + 1))
continue;


--
2.49.0



Return-Path: <linux-kernel+bounces-675860-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5E73941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:22:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id C7A4D189A763
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:22:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 266C81CB31D;
Fri, 6 Jun 2025 14:20:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="e+x/X77k"
Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FF5A1BBBE5
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219648; cv=none; b=OJKeQsDoYA0TvZXDgF9I0JfQxmqS9OJsUXvW1q2ledkudUKf3l0xYCT8coecF1QbP9xeQkbfHj9CVNvDvREncY8ciFz2XH5+KXhmg5TofPbiKWxRrxp6fC/buAZsC4MNIVugAcSgxYgO/jzv2PIishQO2E5/xAdKcBfLdDbpXv4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219648; c=relaxed/simple;
bh=FM/lNx/NoMUl4+HOYDoXqhqfqugSIVlZhiTKYzbPGF8=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=VM9A09mujWvhQqqiIr+wxa2rEPiwCIpsQkKAILeMN1gvuWk1P8inOY/0BYxZjHqqRKKr409sMA8QH/x+PvV5aXK+Yne+kHNAZOpKrAuF/oWU4Wdgn5dVCibMWD6s2t2T1Mm3xg5HHm5Ske+Cg0+/caLu06VgbikipW361lpTE/0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=e+x/X77k; arc=none smtp.client-ip=209.85.128.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-451d6ade159so19235595e9.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:20:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749219645; x=1749824445; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=FTuEafk7AJcKSXLfCGmDtVuPWJx1m3LaW+qyIuTb51M=;
b=e+x/X77kqpGTvnyR7HK6Jbsbh3OJewr2fDJEVVRvH3W20jj0ftX9FvhLXYPUsMd0aQ
zgSRELIjpigRwQdMzsy/qD9sFzs5do99njdIhIkZDvDtw7qW5zGRpLpnaIFud+aarJHa
RnzNGZbvXzYOoo/4DFe8OnWZLWuyYbsbWWvLM0q+Tjk/p01EjFqouvBu7HSw5iEEQn2x
UPO4t04dS5YGiaXdU8z0clptcEn0CohMJKtUfSxscOLtWQAwfaQFkJkoQtQF6AGlOWFA
QCgkmtzU31qZTSM5aE/z3B2W7lclFXIbm+cdgl/unTWYI89paGoWx8T/qmdrzYysZtOF
soyg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219645; x=1749824445;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=FTuEafk7AJcKSXLfCGmDtVuPWJx1m3LaW+qyIuTb51M=;
b=vn4Prs9wOgVaJ/7O8wjbTKLUkttbG665rZxJO1RffzWknBqh3g+t/8S6GbKeaaovYb
C6H+okiVEqHFhqzH37hQ8yUIlLN2tlLYmz0HMbhvjUp8ucHrlGvmcGaW4sc9Zm4DF5Of
432POCWo3RLnd1u8cnZyXE/EJOKzX/1OYeTV/6FJIgtCQlJTOafGJDbLeju4HvE4weUg
XoVQX8iZcGDE2UUU71lsP69B0+uPyQmEXRqh5a8XO+fYve2dZBsEPcCv9BrQ5t1jNksp
llGL1ez2Z5nxsQ9qT7bPWBOJB228X3MXftnXGLWduqiCAkhTpnZ5YBPybzHux04ElmaG
4PeA==
X-Forwarded-Encrypted: i=1; AJvYcCUV7DFqPlWjRK5hLH123ZtbUALOmY9YwU7RFaEaSoGXu1ycUCsQxDVjSkc/tnh7x6WSJYMmRpKc52sIspc=@vger.kernel.org
X-Gm-Message-State: AOJu0YxPE8B2yqsBS7myFskei+KjMy/ahR3P5Qp9ASC+47QpzKtFDuWu
hxZHLJvhnI8R4remNpCWUGAar3iKt6YnwvDWyo29gvHNqV6yTAD2v48ddyNeqy7JAKA=
X-Gm-Gg: ASbGnctzOGcWptUib1DhWPAOgUQ2rHbJqIynrWeFPc35EceuszZhVDaoV30YQFsEiXM
n+yzaBB6/0IKP7hy6cdWHG4wOpWVcPGB1RL+dd0iy5nnKX5ZSDle8nzKUcc+VbwvZIFAzTcjLkR
XAty2nrg5pSztaYpxBz2qlVURHY1KSCdwr6If9pUlj6w7PrNxIbRYyQ1S0zIfp2JXtzdYtq03Ru
SQA/64FOIufqCYvgOWsgiK0Ozw1FHcWTf4wLGQ53w3GDLocrgznZvYj0sTPHRuP2yXJDYUcDOEN
ZQFJ/zImlI+9LiRE2czcITjE+6B6eB0oykpQ4CMabKrHsEGjdG/WXGvPSdivEosk32zEkm9QX76
mxKSXXqr5E3+Cqy6iFNPTGYCy+sz9oZo=
X-Google-Smtp-Source: AGHT+IGEhI4sPI0wEudXZKJjhOjCtgvCYvzI5muZwgZmR7jg/VdiL3a8CyaHhrsgfABhSeDX0jmdGQ==
X-Received: by 2002:a05:600c:8b11:b0:43d:77c5:9c1a with SMTP id 5b1f17b1804b1-4520137401bmr37541965e9.4.1749219644593;
Fri, 06 Jun 2025 07:20:44 -0700 (PDT)
Received: from [192.168.0.2] (host-80-116-51-117.retail.telecomitalia.it. [80.116.51.117])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213754973sm25686345e9.35.2025.06.06.07.20.43
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:44 -0700 (PDT)
From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Google-Original-From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:19:21 +0200
Subject: [PATCH v9 6/7] iio: adc: ad7606: rename chan_scale to a more
generic chan_info
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-wip-bl-ad7606-calibration-v9-6-6e014a1f92a2@xxxxxxxxxxxx>
References: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
In-Reply-To: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
To: Jonathan Cameron <jic23@xxxxxxxxxx>,
David Lechner <dlechner@xxxxxxxxxxxx>,
=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>,
Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Michael Hennerich <michael.hennerich@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=13558;
i=adureghello@xxxxxxxxxxxx; h=from:subject:message-id;
bh=jM36RN95wuoXc1xpOLlSkdVG60WLPaOM5HAG18IsH9o=;
b=owGbwMvMwCXGf3bn1e/btlsznlZLYshw+vGs8PPbQ80BZb7CIq8rcouE3kbvW5dx+IYw09sft
jd3PM436ShlYRDjYpAVU2SpS4wwCb0dKqW8gHE2zBxWJpAhDFycAjCRmRmMDHtlstfnqiYXu0/9
N9NNNdDpsPyFzfP/fOuY+P/FsalbC7IZ/lelvJnvNmllYYTXvCjJ5U6LJicf0njW+3PvrDjHI09
UWDgA
X-Developer-Key: i=adureghello@xxxxxxxxxxxx; a=openpgp;
fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>

Non functional, renaming chan-related chan_scale structure to a more
generic chan_info, to host other chan specific settings, not just
scale-related.

Signed-off-by: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
---
drivers/iio/adc/ad7606.c | 142 +++++++++++++++++++++++------------------------
drivers/iio/adc/ad7606.h | 8 +--
2 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index e5878974a28293664dd8dbded5fffcea6db31ef3..d19682186e7cd73a60541f62adf08d987ba24ec3 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -283,21 +283,21 @@ static int ad7606_16bit_chan_scale_setup(struct iio_dev *indio_dev,
struct iio_chan_spec *chan)
{
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index];
+ struct ad7606_chan_info *ci = &st->chan_info[chan->scan_index];

if (!st->sw_mode_en) {
/* tied to logic low, analog input range is +/- 5V */
- cs->range = 0;
- cs->scale_avail = ad7606_16bit_hw_scale_avail;
- cs->num_scales = ARRAY_SIZE(ad7606_16bit_hw_scale_avail);
+ ci->range = 0;
+ ci->scale_avail = ad7606_16bit_hw_scale_avail;
+ ci->num_scales = ARRAY_SIZE(ad7606_16bit_hw_scale_avail);
return 0;
}

/* Scale of 0.076293 is only available in sw mode */
/* After reset, in software mode, ±10 V is set by default */
- cs->range = 2;
- cs->scale_avail = ad7606_16bit_sw_scale_avail;
- cs->num_scales = ARRAY_SIZE(ad7606_16bit_sw_scale_avail);
+ ci->range = 2;
+ ci->scale_avail = ad7606_16bit_sw_scale_avail;
+ ci->num_scales = ARRAY_SIZE(ad7606_16bit_sw_scale_avail);

return 0;
}
@@ -359,14 +359,14 @@ static int ad7606c_18bit_chan_scale_setup(struct iio_dev *indio_dev,
struct iio_chan_spec *chan)
{
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index];
+ struct ad7606_chan_info *ci = &st->chan_info[chan->scan_index];
bool bipolar, differential;
int ret;

if (!st->sw_mode_en) {
- cs->range = 0;
- cs->scale_avail = ad7606_18bit_hw_scale_avail;
- cs->num_scales = ARRAY_SIZE(ad7606_18bit_hw_scale_avail);
+ ci->range = 0;
+ ci->scale_avail = ad7606_18bit_hw_scale_avail;
+ ci->num_scales = ARRAY_SIZE(ad7606_18bit_hw_scale_avail);
return 0;
}

@@ -376,12 +376,12 @@ static int ad7606c_18bit_chan_scale_setup(struct iio_dev *indio_dev,
return ret;

if (differential) {
- cs->scale_avail = ad7606c_18bit_differential_bipolar_scale_avail;
- cs->num_scales =
+ ci->scale_avail = ad7606c_18bit_differential_bipolar_scale_avail;
+ ci->num_scales =
ARRAY_SIZE(ad7606c_18bit_differential_bipolar_scale_avail);
/* Bipolar differential ranges start at 8 (b1000) */
- cs->reg_offset = 8;
- cs->range = 1;
+ ci->reg_offset = 8;
+ ci->range = 1;
chan->differential = 1;
chan->channel2 = chan->channel;

@@ -391,23 +391,23 @@ static int ad7606c_18bit_chan_scale_setup(struct iio_dev *indio_dev,
chan->differential = 0;

if (bipolar) {
- cs->scale_avail = ad7606c_18bit_single_ended_bipolar_scale_avail;
- cs->num_scales =
+ ci->scale_avail = ad7606c_18bit_single_ended_bipolar_scale_avail;
+ ci->num_scales =
ARRAY_SIZE(ad7606c_18bit_single_ended_bipolar_scale_avail);
/* Bipolar single-ended ranges start at 0 (b0000) */
- cs->reg_offset = 0;
- cs->range = 3;
+ ci->reg_offset = 0;
+ ci->range = 3;
chan->scan_type.sign = 's';

return 0;
}

- cs->scale_avail = ad7606c_18bit_single_ended_unipolar_scale_avail;
- cs->num_scales =
+ ci->scale_avail = ad7606c_18bit_single_ended_unipolar_scale_avail;
+ ci->num_scales =
ARRAY_SIZE(ad7606c_18bit_single_ended_unipolar_scale_avail);
/* Unipolar single-ended ranges start at 5 (b0101) */
- cs->reg_offset = 5;
- cs->range = 1;
+ ci->reg_offset = 5;
+ ci->range = 1;
chan->scan_type.sign = 'u';

return 0;
@@ -417,14 +417,14 @@ static int ad7606c_16bit_chan_scale_setup(struct iio_dev *indio_dev,
struct iio_chan_spec *chan)
{
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index];
+ struct ad7606_chan_info *ci = &st->chan_info[chan->scan_index];
bool bipolar, differential;
int ret;

if (!st->sw_mode_en) {
- cs->range = 0;
- cs->scale_avail = ad7606_16bit_hw_scale_avail;
- cs->num_scales = ARRAY_SIZE(ad7606_16bit_hw_scale_avail);
+ ci->range = 0;
+ ci->scale_avail = ad7606_16bit_hw_scale_avail;
+ ci->num_scales = ARRAY_SIZE(ad7606_16bit_hw_scale_avail);
return 0;
}

@@ -434,12 +434,12 @@ static int ad7606c_16bit_chan_scale_setup(struct iio_dev *indio_dev,
return ret;

if (differential) {
- cs->scale_avail = ad7606c_16bit_differential_bipolar_scale_avail;
- cs->num_scales =
+ ci->scale_avail = ad7606c_16bit_differential_bipolar_scale_avail;
+ ci->num_scales =
ARRAY_SIZE(ad7606c_16bit_differential_bipolar_scale_avail);
/* Bipolar differential ranges start at 8 (b1000) */
- cs->reg_offset = 8;
- cs->range = 1;
+ ci->reg_offset = 8;
+ ci->range = 1;
chan->differential = 1;
chan->channel2 = chan->channel;
chan->scan_type.sign = 's';
@@ -450,23 +450,23 @@ static int ad7606c_16bit_chan_scale_setup(struct iio_dev *indio_dev,
chan->differential = 0;

if (bipolar) {
- cs->scale_avail = ad7606c_16bit_single_ended_bipolar_scale_avail;
- cs->num_scales =
+ ci->scale_avail = ad7606c_16bit_single_ended_bipolar_scale_avail;
+ ci->num_scales =
ARRAY_SIZE(ad7606c_16bit_single_ended_bipolar_scale_avail);
/* Bipolar single-ended ranges start at 0 (b0000) */
- cs->reg_offset = 0;
- cs->range = 3;
+ ci->reg_offset = 0;
+ ci->range = 3;
chan->scan_type.sign = 's';

return 0;
}

- cs->scale_avail = ad7606c_16bit_single_ended_unipolar_scale_avail;
- cs->num_scales =
+ ci->scale_avail = ad7606c_16bit_single_ended_unipolar_scale_avail;
+ ci->num_scales =
ARRAY_SIZE(ad7606c_16bit_single_ended_unipolar_scale_avail);
/* Unipolar single-ended ranges start at 5 (b0101) */
- cs->reg_offset = 5;
- cs->range = 1;
+ ci->reg_offset = 5;
+ ci->range = 1;
chan->scan_type.sign = 'u';

return 0;
@@ -476,11 +476,11 @@ static int ad7607_chan_scale_setup(struct iio_dev *indio_dev,
struct iio_chan_spec *chan)
{
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index];
+ struct ad7606_chan_info *ci = &st->chan_info[chan->scan_index];

- cs->range = 0;
- cs->scale_avail = ad7607_hw_scale_avail;
- cs->num_scales = ARRAY_SIZE(ad7607_hw_scale_avail);
+ ci->range = 0;
+ ci->scale_avail = ad7607_hw_scale_avail;
+ ci->num_scales = ARRAY_SIZE(ad7607_hw_scale_avail);
return 0;
}

@@ -488,11 +488,11 @@ static int ad7608_chan_scale_setup(struct iio_dev *indio_dev,
struct iio_chan_spec *chan)
{
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index];
+ struct ad7606_chan_info *ci = &st->chan_info[chan->scan_index];

- cs->range = 0;
- cs->scale_avail = ad7606_18bit_hw_scale_avail;
- cs->num_scales = ARRAY_SIZE(ad7606_18bit_hw_scale_avail);
+ ci->range = 0;
+ ci->scale_avail = ad7606_18bit_hw_scale_avail;
+ ci->num_scales = ARRAY_SIZE(ad7606_18bit_hw_scale_avail);
return 0;
}

@@ -500,11 +500,11 @@ static int ad7609_chan_scale_setup(struct iio_dev *indio_dev,
struct iio_chan_spec *chan)
{
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index];
+ struct ad7606_chan_info *ci = &st->chan_info[chan->scan_index];

- cs->range = 0;
- cs->scale_avail = ad7609_hw_scale_avail;
- cs->num_scales = ARRAY_SIZE(ad7609_hw_scale_avail);
+ ci->range = 0;
+ ci->scale_avail = ad7609_hw_scale_avail;
+ ci->num_scales = ARRAY_SIZE(ad7609_hw_scale_avail);
return 0;
}

@@ -743,7 +743,7 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
{
int ret, ch = 0;
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs;
+ struct ad7606_chan_info *ci;
struct pwm_state cnvst_pwm_state;

switch (m) {
@@ -758,9 +758,9 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SCALE:
if (st->sw_mode_en)
ch = chan->scan_index;
- cs = &st->chan_scales[ch];
- *val = cs->scale_avail[cs->range][0];
- *val2 = cs->scale_avail[cs->range][1];
+ ci = &st->chan_info[ch];
+ *val = ci->scale_avail[ci->range][0];
+ *val2 = ci->scale_avail[ci->range][1];
return IIO_VAL_INT_PLUS_MICRO;
case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
*val = st->oversampling;
@@ -795,12 +795,12 @@ static ssize_t in_voltage_scale_available_show(struct device *dev,
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs = &st->chan_scales[0];
- const unsigned int (*vals)[2] = cs->scale_avail;
+ struct ad7606_chan_info *ci = &st->chan_info[0];
+ const unsigned int (*vals)[2] = ci->scale_avail;
unsigned int i;
size_t len = 0;

- for (i = 0; i < cs->num_scales; i++)
+ for (i = 0; i < ci->num_scales; i++)
len += scnprintf(buf + len, PAGE_SIZE - len, "%u.%06u ",
vals[i][0], vals[i][1]);
buf[len - 1] = '\n';
@@ -901,7 +901,7 @@ static int ad7606_write_raw(struct iio_dev *indio_dev,
{
struct ad7606_state *st = iio_priv(indio_dev);
unsigned int scale_avail_uv[AD760X_MAX_SCALES];
- struct ad7606_chan_scale *cs;
+ struct ad7606_chan_info *ci;
int i, ret, ch = 0;

guard(mutex)(&st->lock);
@@ -910,21 +910,21 @@ static int ad7606_write_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SCALE:
if (st->sw_mode_en)
ch = chan->scan_index;
- cs = &st->chan_scales[ch];
- for (i = 0; i < cs->num_scales; i++) {
- scale_avail_uv[i] = cs->scale_avail[i][0] * MICRO +
- cs->scale_avail[i][1];
+ ci = &st->chan_info[ch];
+ for (i = 0; i < ci->num_scales; i++) {
+ scale_avail_uv[i] = ci->scale_avail[i][0] * MICRO +
+ ci->scale_avail[i][1];
}
val = (val * MICRO) + val2;
- i = find_closest(val, scale_avail_uv, cs->num_scales);
+ i = find_closest(val, scale_avail_uv, ci->num_scales);

if (!iio_device_claim_direct(indio_dev))
return -EBUSY;
- ret = st->write_scale(indio_dev, ch, i + cs->reg_offset);
+ ret = st->write_scale(indio_dev, ch, i + ci->reg_offset);
iio_device_release_direct(indio_dev);
if (ret < 0)
return ret;
- cs->range = i;
+ ci->range = i;

return 0;
case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
@@ -1115,7 +1115,7 @@ static int ad7606_read_avail(struct iio_dev *indio_dev,
long info)
{
struct ad7606_state *st = iio_priv(indio_dev);
- struct ad7606_chan_scale *cs;
+ struct ad7606_chan_info *ci;
unsigned int ch = 0;

switch (info) {
@@ -1130,9 +1130,9 @@ static int ad7606_read_avail(struct iio_dev *indio_dev,
if (st->sw_mode_en)
ch = chan->scan_index;

- cs = &st->chan_scales[ch];
- *vals = (int *)cs->scale_avail;
- *length = cs->num_scales * 2;
+ ci = &st->chan_info[ch];
+ *vals = (int *)ci->scale_avail;
+ *length = ci->num_scales * 2;
*type = IIO_VAL_INT_PLUS_MICRO;

return IIO_AVAIL_LIST;
@@ -1655,7 +1655,7 @@ static int ad7606_resume(struct device *dev)
struct ad7606_state *st = iio_priv(indio_dev);

if (st->gpio_standby) {
- gpiod_set_value(st->gpio_range, st->chan_scales[0].range);
+ gpiod_set_value(st->gpio_range, st->chan_info[0].range);
gpiod_set_value(st->gpio_standby, 1);
ad7606_reset(st);
}
diff --git a/drivers/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h
index f613583a7fa4095115b0b28e3f8e51cd32b93524..26db8e3c724f47f68b7d5323f5d1db75b3334540 100644
--- a/drivers/iio/adc/ad7606.h
+++ b/drivers/iio/adc/ad7606.h
@@ -86,14 +86,14 @@ struct ad7606_chip_info {
};

/**
- * struct ad7606_chan_scale - channel scale configuration
+ * struct ad7606_chan_info - channel configuration
* @scale_avail: pointer to the array which stores the available scales
* @num_scales: number of elements stored in the scale_avail array
* @range: voltage range selection, selects which scale to apply
* @reg_offset: offset for the register value, to be applied when
* writing the value of 'range' to the register value
*/
-struct ad7606_chan_scale {
+struct ad7606_chan_info {
#define AD760X_MAX_SCALES 16
const unsigned int (*scale_avail)[2];
unsigned int num_scales;
@@ -106,7 +106,7 @@ struct ad7606_chan_scale {
* @dev: pointer to kernel device
* @chip_info: entry in the table of chips that describes this device
* @bops: bus operations (SPI or parallel)
- * @chan_scales: scale configuration for channels
+ * @chan_info: scale configuration for channels
* @oversampling: oversampling selection
* @cnvst_pwm: pointer to the PWM device connected to the cnvst pin
* @base_address: address from where to read data in parallel operation
@@ -137,7 +137,7 @@ struct ad7606_state {
struct device *dev;
const struct ad7606_chip_info *chip_info;
const struct ad7606_bus_ops *bops;
- struct ad7606_chan_scale chan_scales[AD760X_MAX_CHANNELS];
+ struct ad7606_chan_info chan_info[AD760X_MAX_CHANNELS];
unsigned int oversampling;
struct pwm_device *cnvst_pwm;
void __iomem *base_address;

--
2.49.0



Return-Path: <linux-kernel+bounces-675862-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 15E3C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:22:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 5787D189A695
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:22:44 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A9BB045009;
Fri, 6 Jun 2025 14:21:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qr1QraNu"
Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 940B613A258;
Fri, 6 Jun 2025 14:21:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219662; cv=none; b=szEwgja8x8i44iBqOB9icFSGxc1iYcqHSfl52KbETzTmIMzOKqCA+ZhwD7CtMXUZfYaakpx0Au+/3bqTAPk72A4PVDDF792ZbraJLVY9hGohRA+u0Qo6t8v4nIEbaMm486RPe1LZn3CRLb2159l15WBFuCBrXr1fI6MgO5SbWWU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219662; c=relaxed/simple;
bh=rSP2F/Vp8pAf45QmfKMDtzuSXKBxupSWAhnZGVm31eo=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=Q17u/+7kvhY7Vg6/O0PjJ3EIE9HCrDpuhM8Bi7BGvS2W9J1A+/DOdSLnSf0o+Qoo34ewUKm1HWWMKndajTnFxc0XoQWcZ75lmnzIaWTRc82wA4lhFrXW1AYIjWT52HsxSk1bMj8tKI1Mc6BjMtC0zVRkdUOKdIHerNbAf4t4Au0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Qr1QraNu; arc=none smtp.client-ip=209.85.214.175
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-22c336fcdaaso18812955ad.3;
Fri, 06 Jun 2025 07:21:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749219660; x=1749824460; darn=vger.kernel.org;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date:from:to
:cc:subject:date:message-id:reply-to;
bh=7oHF+BaYEidVFkRjLgW1RNqKQ9NAKcb2cnOs0pZlOZI=;
b=Qr1QraNuxpm5zmQDlO6oHizRqfeUPmlK+VVtXg8liFA5qQOSKtcKMDRiyVrMPXs4kW
F11znNhLYVM/kNh6daLVfgCaqyUFOzi8wfoN4SMubeAS0QGVzc01265hDpWVFW5+evNx
CEqkNV5UPxHtc7QJrvxZeeSLajze3EwICA2o7e74+q3nEu1KAvce4B1Ypm4y4U8Nb4yg
0fPU43faciW8s/MbMklXf7kZuRAf/DUYk5PqpY+uZaM/eJst87cqGLUy+ZMnVpZhplZl
zLJi/J0gF2RiFJcQC2TYbBmiHheoPK6BFrDiMPXUPO5g3ilK8pdH1eaCEZ8/RB1OWa3t
GLeA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219660; x=1749824460;
h=in-reply-to:content-transfer-encoding:content-disposition
:mime-version:references:message-id:subject:cc:to:from:date
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=7oHF+BaYEidVFkRjLgW1RNqKQ9NAKcb2cnOs0pZlOZI=;
b=jfCibSwIRO+/bS79ASDI8Xvd2DIMnTCVEGJ7CFTulxppqNmu0v2PNXPAeQTYDhxBDA
uuziAWsNUHXiztWj5EYMdUDnBHysybXpAk83KMUim9pt1IFp70ic37gZpVeJNhLIjfv1
kI7/Jhzc6EamkFAGkNdCAkZu53EEqgYCMSQlzxBOt9COvBwxrw6guGCcqzeSrHwythw0
jJqYXXtlGLlsgX27/HIagjpNPJtJr2TY4/+VzBbsfCHKb5KjWyUj9EhOwgESdiuyj1tz
4/YJ7nuvYWdPnSuaLX0kYPpmaEuVFnrhuof/G2sbTESBL3C+3ixfJBMcCwYBIgPLWOM6
KpPg==
X-Forwarded-Encrypted: i=1; AJvYcCVxwdMOJUg6lKYqPa4qRDpgHmg6RBcBmXpRIyX+VdLfeSH5nEiLpCPCZJy0RpphdCmeXacC/LPBuyE13Uk=@vger.kernel.org, AJvYcCWo+ABnrM3dsLtTTCWGubU3Y2S96xBReSwvAOlL5zN6Co/YthV0DlCDpDIzDxCLhsoUWTWLUBbM@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzgiVXrNStN+68lr9hAdWLcy9y0QCxtycdjXphnC2ORRRujGO+i
z1bcX4KU5yQsflZEU3uptUm6/5Shu+s0FLCHnyroIHnWOFv3rtngaL1nLVFyDQ==
X-Gm-Gg: ASbGncsyCG336FjHkPzcXQ5pb2TEHI0lGpDGWMr5KA5K/mjfPE0ekGs7Hhqj1KeQcuf
O+g9F32H0pHAisqpQ6FgHJi+JW6cf159aLxCvyzfWqUArpjOcGD4cVEwGnEPpO1J2yOxFFM0cdk
CnQ2mNYiNHSJJToMjW6xVEAWNKm1R3owNnSZrLUbbtAF2oPW4Oizbk0N1L+5bRB+ip/RaFSz81K
AnTBCUAj5anLCEiy5nHPpIcHhx4kIwSuRndvOnDT/92nTL6VK7Edqjy/sWC0MdLE9yGY/PGespw
VdnW5T35mGvUd3bNVul4jZ5nMLyzoVn9urjSDlXkEG29SPtK0eQ=
X-Google-Smtp-Source: AGHT+IEV6Xg84XbMRZPliX18VduESPGpoHh056OZEWDuyhWAMYEW6h7oFD9MTeB4Fa5jUSxYd8HJdg==
X-Received: by 2002:a17:902:d48f:b0:234:b41e:37a4 with SMTP id d9443c01a7336-23601cf5aadmr37529615ad.6.1749219659719;
Fri, 06 Jun 2025 07:20:59 -0700 (PDT)
Received: from localhost ([216.228.127.129])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-236032fccc4sm12934765ad.127.2025.06.06.07.20.58
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:59 -0700 (PDT)
Date: Fri, 6 Jun 2025 10:20:56 -0400
From: Yury Norov <yury.norov@xxxxxxxxx>
To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= <thomas.weissschuh@xxxxxxxxxxxxx>
Cc: I Hsin Cheng <richard120310@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] uapi: bitops: use UAPI-safe variant of BITS_PER_LONG
again
Message-ID: <aEL5SIIMxmnrzbDA@yury>
References: <20250606-uapi-genmask-v1-1-e05cdc2e14c5@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20250606-uapi-genmask-v1-1-e05cdc2e14c5@xxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 10:23:57AM +0200, Thomas Weißschuh wrote:
> Commit 1e7933a575ed ("uapi: Revert "bitops: avoid integer overflow in GENMASK(_ULL)"")
> did not take in account that the usage of BITS_PER_LONG in __GENMASK() was
> changed to __BITS_PER_LONG for UAPI-safety in
> commit 3c7a8e190bc5 ("uapi: introduce uapi-friendly macros for GENMASK").
> BITS_PER_LONG can not be used in UAPI headers as it derives from the kernel
> configuration and not from the current compiler invocation.
> When building compat userspace code or a compat vDSO its value will be
> incorrect.
>
> Switch back to __BITS_PER_LONG.
>
> Fixes: 1e7933a575ed ("uapi: Revert "bitops: avoid integer overflow in GENMASK(_ULL)"")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>

Thanks Thomas. I applied it in bitmap-for-next. Is that issue critical
enough for you to send a pull request in -rc2?

Thanks,
Yury


Return-Path: <linux-kernel+bounces-675861-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 373D841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:22:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5D6A03B2F30
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:21:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CA5D8289370;
Fri, 6 Jun 2025 14:20:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="UZLVYr9z"
Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4BAE1CEAC2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:20:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219649; cv=none; b=UlcNmd4QY2M8mdzjEhYMiPFYBTOItbJdPtNtywP3Q5TAjNxI8mzTVyf6XYw3hOp416vXk2gbwLSMc1yAtRZ1vWJGdzpP/QwzwxffZLX6Moz1pGfZkEfVVJvFvEhvg5gL2MDPt+VKpl9CYRPISgA5RUIc2yi2rLNMRrUnaRpWo64=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219649; c=relaxed/simple;
bh=L/gwxvm6plajhtZUJBhnKB7CkU77xzODIZq6h41Wvi8=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=XGU+fam037Gs3yEFlhkxPFoQyYJf5/2CEf2YRh8Vd4Bv/2UXZt5zpbqbNdCFbgfm7Ape3NJvqCdK/nNx7G46COK2YN729w/m8YTaNfPqsKvMjlb9Inmz0do0FvtR4rjkn4k4CPy5dupKwdHxrlFpMjMy3IzLJrT6JB1VbazkVbA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=UZLVYr9z; arc=none smtp.client-ip=209.85.128.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-450cfb790f7so16998365e9.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:20:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749219646; x=1749824446; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=8HpQeVbRwMAK/HKOtbrEdsV8ikZIsnrbhJJIVEFRiLg=;
b=UZLVYr9ztQa6BVFfwr3aiSB10sy0axQE0a3TBQBgJdgvoOT01bcbF9w7lf5YJNChCI
94BCa6EsDFNQV5At+nHN9o4ATVXdI+lWKKeNcHchwliO/Gglu35YTAJVxLqnjySFxYiy
1q7emvStVxmdRoE0+0duHjKJ3a+Yotyif/yn3SVJoCzEyfN5HO9mdATCDwqJC42hdX0L
xMi0X0Z+NmYMVezqyVG0zLF2ZE0Q0DWZEbsUEN14CrMAmYWlhfZweuyNpBBrQqGvnJUB
3pIA7+epvNvhfWJWZlzfGlTiP8HH3VolCOsrn27dxWgBF7he3/LsAKt/lRXZU5ERtjjR
vQUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219646; x=1749824446;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=8HpQeVbRwMAK/HKOtbrEdsV8ikZIsnrbhJJIVEFRiLg=;
b=aXc3FYZ1O7pDZ1T7r+lhs6Q7gswNGXNBkAVO/+cxQjP7w1t3hzcfORjbEMIlJ0nuH5
W29LlKKZ4jczFHUUs8nja0ChH2T2FXlOdrAPT7Ejj2irj16ubVIJhhGUT7J1KiH8kdQu
fuVNz9PfF0vRkywAyXthB2s9tuKLUB0rpWu1pf25O8loglAISfDt/Wl0Fs41qurdBItQ
YPNiZe5+Udqjp1S1hQqLTFJMbkp9A4I8SVddaIeWpgLlxKvSbZJY4TSC05/TzYDGM9JI
Uf2tj/pb4m/l/OF8yWROrAh6Px/N+RyEjPBhNFu+8elRDbcQ8i7JPRB66qcfFjImXsJX
HL2A==
X-Forwarded-Encrypted: i=1; AJvYcCWRqjLrAG16F/GXC8c4wnJeVpuH+K6HBtnKO4+HQvVY+pHcuOxxtEjpxJhpNrL64GbSk1H/t/1k59Sbk8o=@vger.kernel.org
X-Gm-Message-State: AOJu0YzZ45HOF7muS1/mFpPZsCezGSnXImzlYQRLVWlG+yxLrgA8sNkQ
nOpH6W4Rj+T4498/gjTr6sUa9321qNqUQumWbdlQUiaMzaEyoF1erGQ2jMCOkxzOGCw=
X-Gm-Gg: ASbGncstaVH6uCN+gaX30YXvVJAWbl8SK1QsKdG64DvWxFduj0CbLRxlLQ8NM3gwczp
1avTH99DVvY1M3cYIQZzKQOSyOzPgF7gLcDKxaWtD/A847ndNCYbc/9jzjktSfJlGW5eFQGlJjv
b1FYJF85F6cZkia4W9wDdr1Jm5xGGyNThdEoGvGCeUZwkBmIkU9a8n0q4i+0kAqt+PyeSU+e6ul
MyRmqCc0K0HerYnaxGEgvUgxbibuvRtLHmIZMR+A26ztYPT5N6u3munFNgrnpMwK+9vPTD1xBAH
6uDLz6CE/hwalmv2AUpU+8wNlwaZbizrAy4e1b9kJ6n/DTTtDraV4PsH/jVMGU7j2T356MrLi2/
GSAcMVuNd6iyVpD/67D8yJWdtROGUvq8LYj624gkIIQ==
X-Google-Smtp-Source: AGHT+IFkrVts+bEEPUp4BBAtLVZPot/aA/9X0oPRBOSSiEtVNiKU2TRV736+tfIKnO29f0u+64AR8w==
X-Received: by 2002:a05:600c:a08e:b0:43c:fa24:873e with SMTP id 5b1f17b1804b1-45201391375mr39843995e9.13.1749219646003;
Fri, 06 Jun 2025 07:20:46 -0700 (PDT)
Received: from [192.168.0.2] (host-80-116-51-117.retail.telecomitalia.it. [80.116.51.117])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45213754973sm25686345e9.35.2025.06.06.07.20.44
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:20:45 -0700 (PDT)
From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Google-Original-From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:19:22 +0200
Subject: [PATCH v9 7/7] iio: adc: ad7606: add gain calibration support
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-wip-bl-ad7606-calibration-v9-7-6e014a1f92a2@xxxxxxxxxxxx>
References: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
In-Reply-To: <20250606-wip-bl-ad7606-calibration-v9-0-6e014a1f92a2@xxxxxxxxxxxx>
To: Jonathan Cameron <jic23@xxxxxxxxxx>,
David Lechner <dlechner@xxxxxxxxxxxx>,
=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@xxxxxxxxxx>,
Andy Shevchenko <andy@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>,
Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Michael Hennerich <michael.hennerich@xxxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Angelo Dureghello <adureghello@xxxxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=5283;
i=adureghello@xxxxxxxxxxxx; h=from:subject:message-id;
bh=IKWt2EvUAc6fFAR+GqaSzL5Mis4xCa3ugoUhm+8Psbg=;
b=owGbwMvMwCXGf3bn1e/btlsznlZLYshw+vHs2gXb+MPrOrytJjwNkI28X7Y0uLH1//aN7De9i
s4JPZvN1VHKwiDGxSArpshSlxhhEno7VEp5AeNsmDmsTCBDGLg4BWAiDy4zMtxgt1teuLT3rqGu
9Zrtq5u+T3mRsjCj5NCuAl824/A3Ux4w/NPRap+vuKLnh0zcy9Dv1YZKcTXu/Gdeiqr2VXotf5R
2kwMA
X-Developer-Key: i=adureghello@xxxxxxxxxxxx; a=openpgp;
fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>

Add gain calibration support, using resistor values set on devicetree,
values to be set accordingly with ADC external RFilter, as explained in
the ad7606c-16 datasheet, rev0, page 37.

Usage example in the fdt yaml documentation.

Signed-off-by: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
---
drivers/iio/adc/ad7606.c | 39 +++++++++++++++++++++++++++++++++++++++
drivers/iio/adc/ad7606.h | 5 +++++
2 files changed, 44 insertions(+)

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index d19682186e7cd73a60541f62adf08d987ba24ec3..d9271894f091a837d29197f7de892c022b7e4152 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -33,6 +33,10 @@

#include "ad7606.h"

+#define AD7606_CALIB_GAIN_MIN 0
+#define AD7606_CALIB_GAIN_STEP 1024
+#define AD7606_CALIB_GAIN_MAX (63 * AD7606_CALIB_GAIN_STEP)
+
/*
* Scales are computed as 5000/32768 and 10000/32768 respectively,
* so that when applied to the raw values they provide mV values.
@@ -180,6 +184,7 @@ const struct ad7606_chip_info ad7606b_info = {
.scale_setup_cb = ad7606_16bit_chan_scale_setup,
.sw_setup_cb = ad7606b_sw_mode_setup,
.offload_storagebits = 32,
+ .calib_gain_avail = true,
.calib_offset_avail = ad7606_calib_offset_avail,
.calib_phase_avail = ad7606b_calib_phase_avail,
};
@@ -195,6 +200,7 @@ const struct ad7606_chip_info ad7606c_16_info = {
.scale_setup_cb = ad7606c_16bit_chan_scale_setup,
.sw_setup_cb = ad7606b_sw_mode_setup,
.offload_storagebits = 32,
+ .calib_gain_avail = true,
.calib_offset_avail = ad7606_calib_offset_avail,
.calib_phase_avail = ad7606c_calib_phase_avail,
};
@@ -246,6 +252,7 @@ const struct ad7606_chip_info ad7606c_18_info = {
.scale_setup_cb = ad7606c_18bit_chan_scale_setup,
.sw_setup_cb = ad7606b_sw_mode_setup,
.offload_storagebits = 32,
+ .calib_gain_avail = true,
.calib_offset_avail = ad7606c_18bit_calib_offset_avail,
.calib_phase_avail = ad7606c_calib_phase_avail,
};
@@ -306,6 +313,7 @@ static int ad7606_get_chan_config(struct iio_dev *indio_dev, int ch,
bool *bipolar, bool *differential)
{
struct ad7606_state *st = iio_priv(indio_dev);
+ struct ad7606_chan_info *ci;
unsigned int num_channels = st->chip_info->num_adc_channels;
struct device *dev = st->dev;
int ret;
@@ -349,6 +357,14 @@ static int ad7606_get_chan_config(struct iio_dev *indio_dev, int ch,
return -EINVAL;
}

+ ci = &st->chan_info[reg - 1];
+
+ ci->r_gain = 0;
+ ret = fwnode_property_read_u32(child, "adi,rfilter-ohms",
+ &ci->r_gain);
+ if (ret == 0 && ci->r_gain > AD7606_CALIB_GAIN_MAX)
+ return -EINVAL;
+
return 0;
}

@@ -1352,6 +1368,23 @@ static int ad7606b_sw_mode_setup(struct iio_dev *indio_dev)
return st->bops->sw_mode_config(indio_dev);
}

+static int ad7606_set_gain_calib(struct ad7606_state *st)
+{
+ struct ad7606_chan_info *ci;
+ int i, ret;
+
+ for (i = 0; i < st->chip_info->num_adc_channels; i++) {
+ ci = &st->chan_info[i];
+ ret = st->bops->reg_write(st, AD7606_CALIB_GAIN(i),
+ DIV_ROUND_CLOSEST(ci->r_gain,
+ AD7606_CALIB_GAIN_STEP));
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
static int ad7606_probe_channels(struct iio_dev *indio_dev)
{
struct ad7606_state *st = iio_priv(indio_dev);
@@ -1630,6 +1663,12 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
st->chip_info->sw_setup_cb(indio_dev);
}

+ if (st->sw_mode_en && st->chip_info->calib_gain_avail) {
+ ret = ad7606_set_gain_calib(st);
+ if (ret)
+ return ret;
+ }
+
return devm_iio_device_register(dev, indio_dev);
}
EXPORT_SYMBOL_NS_GPL(ad7606_probe, "IIO_AD7606");
diff --git a/drivers/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h
index 26db8e3c724f47f68b7d5323f5d1db75b3334540..2951bb731354d64cbec6e8460b3d841a22bb17ec 100644
--- a/drivers/iio/adc/ad7606.h
+++ b/drivers/iio/adc/ad7606.h
@@ -66,6 +66,7 @@ typedef int (*ad7606_sw_setup_cb_t)(struct iio_dev *indio_dev);
* @init_delay_ms: required delay in milliseconds for initialization
* after a restart
* @offload_storagebits: storage bits used by the offload hw implementation
+ * @calib_gain_avail: chip supports gain calibration
* @calib_offset_avail: pointer to offset calibration range/limits array
* @calib_phase_avail: pointer to phase calibration range/limits array
*/
@@ -81,6 +82,7 @@ struct ad7606_chip_info {
bool os_req_reset;
unsigned long init_delay_ms;
u8 offload_storagebits;
+ bool calib_gain_avail;
const int *calib_offset_avail;
const int (*calib_phase_avail)[2];
};
@@ -92,6 +94,8 @@ struct ad7606_chip_info {
* @range: voltage range selection, selects which scale to apply
* @reg_offset: offset for the register value, to be applied when
* writing the value of 'range' to the register value
+ * @r_gain: gain resistor value in ohms, to be set to match the
+ * external r_filter value
*/
struct ad7606_chan_info {
#define AD760X_MAX_SCALES 16
@@ -99,6 +103,7 @@ struct ad7606_chan_info {
unsigned int num_scales;
unsigned int range;
unsigned int reg_offset;
+ unsigned int r_gain;
};

/**

--
2.49.0



Return-Path: <linux-kernel+bounces-675863-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DF56341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:25:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id C311F3A3909
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:24:47 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C21FD7260B;
Fri, 6 Jun 2025 14:25:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M1hOf06h"
Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C4C72B9A5;
Fri, 6 Jun 2025 14:25:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219902; cv=none; b=c7LfZzBreeVQvE8HsAJLaIl+W5XpukuC5f/wz3BuZKWByY7sgJfwn/0wCayGgZuJ0sfYIoxgokILr1rw9qtcxVIGyP8PzOM6Wlcu8Ia3VgAeCCoDU4+vTUquw1cOJqQlEZMj9DQ5zRLedQpghpYIgd64CAxGQ+C6wdIGKY7MBWQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219902; c=relaxed/simple;
bh=iqG/efhZVTgsxHipSyjybtPfHYZOrkqBqAApKV+b51A=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=hmWLOtkDIl8J5tXkpc0cknmnZ5gvO5pnmAzrGpWPgs4DUvG+wDDJHx5t0SsEr2k5yrHHRfq7a8pqqEqqwdj1W0itFy02xG7UwXOCX+3xKHr8RRwVhBsxFa//PoXueJ1H7aKuwBv20l0iIj08G3eOoo5PSfQq85bJP3HOaN+AU5U=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M1hOf06h; arc=none smtp.client-ip=209.85.128.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-450cf0025c0so15124105e9.3;
Fri, 06 Jun 2025 07:25:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749219899; x=1749824699; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=RU2KfMaJ2+9yanxW+f1dhdc9HAZcZembcLZ9Md0lK/k=;
b=M1hOf06hHLAgfJl/QcFGhhBrAYllBkimQJ4K6PxswiCFmDfqEDtTMM4L9xvI0AGm1K
l2ptklkz9PvQQncx7+nCaGiqzpSgjHgUwrObrnsqANj73VM9DWNewhfc910PbArk/aC4
H2JNOYvvhCo5LasFmF0SzPppbic9KOGSDsOnO99+0p64g/9SbPWZTSkdeK/mauxEfW6D
A74fqr59v5xnnR+WeAmbTsV+UUf5AaqmUA4b19T6scQkaqHkncTOqSTr803qMyY/3szh
TEcAvuyhMfC59LmrIo0WIqFd+6vZ0pr2SxpvOyFecaTkBVG8fD7I3J7l3ehTqXK9clXA
kKGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219899; x=1749824699;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=RU2KfMaJ2+9yanxW+f1dhdc9HAZcZembcLZ9Md0lK/k=;
b=OjaDcNC/R+spUJXlwyOVwZCmAhTLcZ4albWh4yQYH3gHPqu7oUNu7pFTBiNTV0DA1p
jx4WC1pgqhLEeHMaCNkxEIQ9OftpLZx2fx7dDFG76LPxuW8OP57Mc7Uk8cXPPvPutuya
LHzToaB1EZm6Y93HCua+mEXUgC71kDEsEWDI1cxrhZxDQHXltoiJz7FB1LCzfAav58xy
SQu6LMWO5oyTS6zqCryV7Q48OXmArCYutXw7QGfCTustAklPxEiPUfw+enm5Uni0yJ6q
PMgg5f+0UoGZqHAn9Q3MqvYCE+RC/+Ul6yrOicM474jnFTDj2/1zWXhK4S3GfMX0t/Hd
WcAA==
X-Forwarded-Encrypted: i=1; AJvYcCVvG5XECk4Qj2Bjputcu2LvrsqaKpmpI5FE8e4o+wge//KsA1EahK9WjzYJwGBUnaLNDghOwWTPksP5WE8m@xxxxxxxxxxxxxxx, AJvYcCXq/X08mLaOadQL62ox13fX7eMwZe+CfmeDfPBHc/YmGrT/UEIT1T4w/5+FLKBST0QFB7SBIiKDm4M+@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yyvr37TUGQh/HdMDWSPrZxpYlKtpVHDUa9NSqGPV9yKIA3dYlds
pGleM0PkllqrDu/jDy19f9EqeIJCD/8XkH7qG5qOQiqd3ZQ1otwhtZUs
X-Gm-Gg: ASbGncvupCoQCO+iDi4Xn30AKHN6Lt6EmVxlDOJKsp7wjcrT746eOrXfW5D90zqmRBP
xetkzTfyNFXHSmg+Kat6GlDp7dOyWkemm2onm1bBEGeuPdYoXzNWndRXG8Q0LUFEPwjul3AJoGq
ELchZjv/th3CQiUikmsVF4nXO4pvVUAlajRCw3ugo15UmJrWUWUQHEcexi1kAXcxh8nNcSvQL7t
jeFcXHZ27wVQeHusEm8/0XOu9d9khH+waakPl2H6anMhgL2/VK0ZptvIEV2FMLDQ07NO+D0z6iy
RO/yxiFanFWrLo58Fuml7JvdBLjOtVVgsAGoP2197mAEHBBIrVHzguvpZ8egl0YViWFAK0GfSxk
ol9eaDt00HzbOEwRSdQNe14gW
X-Google-Smtp-Source: AGHT+IEBJ4DoVvw/stlDOgi18RzfrOUTiRlKASLE2QkGIDx36kpF9qdd0AZsPbr8D1+OxjcNDNlTIQ==
X-Received: by 2002:a05:600c:83cf:b0:442:f4a3:9338 with SMTP id 5b1f17b1804b1-45201404993mr34463405e9.21.1749219898437;
Fri, 06 Jun 2025 07:24:58 -0700 (PDT)
Received: from masalkhi.. (ip-109-43-113-198.web.vodafone.de. [109.43.113.198])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-451f82878acsm33018475e9.0.2025.06.06.07.24.57
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:24:58 -0700 (PDT)
From: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
To: gregkh@xxxxxxxxxxxxxxxxxxx
Cc: abd.masalkhi@xxxxxxxxx,
arnd@xxxxxxxx,
conor+dt@xxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
robh@xxxxxxxxxx
Subject: Re: [PATCH v3 2/3] misc: add driver for ST M24LR series RFID/NFC EEPROM chips
Date: Fri, 6 Jun 2025 14:24:56 +0000
Message-ID: <20250606142456.3140225-1-abd.masalkhi@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <2025060650-tried-widen-4443@gregkh>
References: <2025060650-tried-widen-4443@gregkh>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi greg,

Thank you for the detailed feedback.

>> +// SPDX-License-Identifier: GPL-2.0-or-later
>
> Are you sure "or-later" is what you want? Sorry, I have to ask.
I will remove the or-later part, lol

>> +
>> +#define M24LR_PAGESIZE_DEFAULT 1u
>> +
>> +#define M24LR_WRITE_TIMEOUT 25u
>> +#define M24LR_READ_TIMEOUT (M24LR_WRITE_TIMEOUT)
>> +
>> +#define to_sys_entry(attrp) container_of(attrp, struct m24lr_sys_entry, attr)
>
> This shouldn't be needed, something seems odd...

I will remove the M24LR_PAGESIZE_DEFAULT, i do not needed any more
and about the to_sys_entry, i am using it in show and store callbacks

>> +static ssize_t m24lr_ctl_store(struct device *dev, struct device_attribute *attr,
>> + const char *buf, size_t count)
>> +{
>> + struct m24lr *m24lr = i2c_get_clientdata(to_i2c_client(dev));
>> + struct m24lr_sys_entry *entry = to_sys_entry(attr);
>
> Why isn't this just going off of the device? Are you using single
> show/store callbacks for multiple attribute types?
>
>> + unsigned int reg_size = entry->reg_size;
>> + unsigned int reg_addr = entry->reg_addr;

> Ah, you are. Are you sure you need/want to do that?

For registers that do not require any special processing, it's sufficient
to directly pass the value to the device. In such cases, a generic store
callback is appropriate. Other registers that require specific handling
have dedicated store callbacks. For example, the unlock attribute uses
its own specialized implementation.

>> + u8 output[8];
>> + int err = 0;
>> +
>> + if (unlikely(!count))
>
> likely/unlikely can ONLY be used when you can benchmark the difference
> in the speed of not having it. For a sysfs file, that's not needed at
> all, please remove all of these.

Alright, i will do that

>> + return -EINVAL;
>> +
>> + if (count > (reg_size << 1))
>> + return -EINVAL;
>> +
>> + if (unlikely(!is_power_of_2(reg_size) || reg_size > 8)) {
>> + dev_dbg(dev,
>> + "Invalid register size: must be a power of 2 and <= 8 bytes (%u)\n",
>> + reg_size);
>> + return -EIO;
>
> Not -EINVAL? This isn't an I/O error.

The last if statement is primarily for debugging purposes. The reg_size
value is specified internally by the driver (not user-controlled), so
this check helps catch potential mistakes in the driver's sysfs entry
definitions. That's why I used -EIO instead of -EINVAL, as it's not due
to invalid user input but rather an internal misconfiguration.

>> + n_sss = chip->n_sss_entries;
>> + if (n_sss) {
>> + sss = devm_kzalloc(dev, n_sss * sizeof(struct m24lr_sys_entry),
>> + GFP_KERNEL);
>> + if (!sss)
>> + return -ENOMEM;
>> +
>> + for (i = 0; i < n_sss; i++) {
>> + char *name = devm_kasprintf(dev, GFP_KERNEL, "sss%d", i);
>> +
>> + sss[i].reg_size = 1;
>> + sss[i].reg_addr = i;
>> + sss[i].attr.attr.name = name;
>> + sss[i].attr.attr.mode = 0600;
>> + sss[i].attr.show = m24lr_ctl_show;
>> + sss[i].attr.store = m24lr_ctl_store;
>> +
>> + err = device_create_file(dev, &sss[i].attr);
>
> You just raced with userspace and lost. This is not how to do this,
> please do not dynamically create attributes (hint, this should have
> errored out as you didn't correctly initialize them), but also:

I didn't fully understand where the race condition comes from. Is
the issue caused by calling device_create_file() from within the
probe() function, or is it due to the fact that the attributes
are being allocated dynamically rather than defined statically?

>
>> + if (err)
>> + dev_warn(dev,
>> + "Failed to create sysfs entry '%s'\n",
>> + name);
>
> You do not unwind properly if an error happens.
>
> Just use a default attribute group attached to the driver and the driver
> core will handle all of that logic for you automatically. Making the
> code smaller and even better yet, correct :)

Thanks for clarifying this point. I'll rework the implementation
to use a default attribute_group

Best regards,
Abd-Alrhman Masalkhi


Return-Path: <linux-kernel+bounces-675864-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7272441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:25:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5357D3A4F3B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:25:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 10C9B126C05;
Fri, 6 Jun 2025 14:25:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="XdRPICfS"
Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00DE870800
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:25:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219932; cv=none; b=kX4W0/PCtMlWZVE48T179rXVnMHswtbCABG7c0Hg1cuttWC17rNQVdG5qIP/9uQDBmUGhIfoOGj4axahslcwJbUWQIPNe3grKe3OdfA7T3OdTAmMiJpgwM5HMwx6FokBrwdfxk9W/tZ0eQayHIK25IMcpj3kxV3h180x4GY6VKo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219932; c=relaxed/simple;
bh=0/Xbc5DoXdOonGdb1FnWFrx7HW4T9hMU9U0+W+iph0U=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=loGzlILwL+9rEX4JL/+H22+0yIdPaGDcOkPIabAn3iVnWEGdYgQUXKo2Hw0MkvhlVzQBRnusZ7acvHk8x87RwrnW0Y4yWZX7G/1z6YtYV46FAhDuCGNvgOlIFZMHFSTg1hqzqW47h+SZlJMMAZ/shf1cUbr85Fi5YqCs69J0MCs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=XdRPICfS; arc=none smtp.client-ip=209.85.167.173
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk
Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-4034118aeb7so622754b6e.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:25:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1749219928; x=1749824728; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=RAaimuBfQTz1EHGQEWzx7YSWNC+FbUyMuJtQhEefSSo=;
b=XdRPICfSOhvpOxOyKQJpQ+zbmOT8qydVb6MreHYvTciFJ3SuzvzTPfh3t7srKLyp6/
EDrrxP/6Y+lzYIuBVxyJpfsrsTbC+uzgD2/yNiFofGuN7c7hIpNowl5xxTc0EfB0l5Va
pQVHO26DkptM7jMa+VLUCaw/J+xPvBjbGS5EN932RQkpdCCaGQhCO9JXYbi2fM+PHR+h
meyNsiz9cEPZdB+APSVLPWBYz2zvof8FTv3wOSE/UpcfJ2F6eAwFOruyAZrHbLieC/sd
H1u5kVRQo53kfMm4FWdXYWxBMTm/+jsPIpk66T4+Px9xWusSWxffuSJiWQm9ifAGnH6t
KPnQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219928; x=1749824728;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=RAaimuBfQTz1EHGQEWzx7YSWNC+FbUyMuJtQhEefSSo=;
b=GQOkzOmom4d/Z3slq4Uk2v7Hc8evssGU9+CNMwyzA6p5xOwKkxrmB0CJ2qd3OXgZbc
/S9666Kv+qVCIdrF9aX6Ue+aywg43emPg4AJZR5Gx9oA/SOUZX+97ubVP+HHdA4fB4TF
U03NdQtfD2DGEy9p6GvqV0ZrZT+eVT/2tI4+KuJiF41rMcyyV/c5gNaT9o6iyujU3JIl
SoXxs1mpl//QhiVh0gjUB/4rE/jcGSRgNoagJiAuZy9qVOvLXR605V4nTVxJmD8ffHu+
bY+1RfUqtcsepA04PXO+9y6RTdarawlqqRscihJmj4RE62gTFmAA/RfCk/TuiyWb0oEB
Wo0A==
X-Forwarded-Encrypted: i=1; AJvYcCWXVECtQg7as1WEMlwyCNScVi1gI/1bMEIlQ7qTCoUeFgnRdZKqSFlRYqP+gLeaopvRmuUsw8ey+2zxhFk=@vger.kernel.org
X-Gm-Message-State: AOJu0YxCWcgnqkjCipE3kPZ/VLH7cL1gbdH8Kz6uNHx65lCqL28f7b5Z
KewdxZpyIPBeVd4zPpfSssBGcFZ5laTEmsq/pv0gdlDlpXE0TuO4EfKdvqbGfBQxqwrS9AOjxdu
XlD5M
X-Gm-Gg: ASbGncvU031Qqy4+C8s2E/ILGc0srSTzrg0LuzHwiTEG6YZtI9LyPXHLCIQHwywPZiC
d6d76OUHqS5buJ9ZU3+PaWF5s7/qxfB5yvLnRpgO/5t5BymRnYTyXmVxcO98GI2cVXsonURtewa
7RVb3/4Xhe5Gt/mPpM7PFL38QG70k9YTYfKwgpUvBkqiRXRfpHd3yAzEV6xC7q5d69j1+UNoyC9
rDMlFE8JHMVrKWoG6j3jAJTjDEpxIty+p9/ohohTBIdcpXZ09JxZQMSD+drnH/InLm7KXP1IRur
mYYBQlKDQQFwy6yHR8ScnB4LTbgivEKbgBzzyv6zRXh8vXxG+nXclwrQIlmk0CYnN33i
X-Google-Smtp-Source: AGHT+IF5km4CtDvHDOVe+SIqNmRZERGMS28Qi8RaU8LfNaXvtlGLcevIJqxza9IXKdKeERufgQAQHg==
X-Received: by 2002:a05:6e02:3093:b0:3dd:cb92:f12f with SMTP id e9e14a558f8ab-3ddce4100demr44053855ab.12.1749219916570;
Fri, 06 Jun 2025 07:25:16 -0700 (PDT)
Received: from [192.168.1.116] ([96.43.243.2])
by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3ddcf253213sm4120495ab.51.2025.06.06.07.25.15
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 07:25:15 -0700 (PDT)
Message-ID: <783d14e8-0627-492d-b06f-f0adee2064d6@xxxxxxxxx>
Date: Fri, 6 Jun 2025 08:25:15 -0600
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [RFC v2 2/5] io_uring/bpf: add stubs for bpf struct_ops
To: Pavel Begunkov <asml.silence@xxxxxxxxx>, io-uring@xxxxxxxxxxxxxxx
Cc: Martin KaFai Lau <martin.lau@xxxxxxxxx>, bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
<e2cd83fa47ed6e7e6c4e9207e66204e97371a37c.1749214572.git.asml.silence@xxxxxxxxx>
Content-Language: en-US
From: Jens Axboe <axboe@xxxxxxxxx>
In-Reply-To: <e2cd83fa47ed6e7e6c4e9207e66204e97371a37c.1749214572.git.asml.silence@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 7:57 AM, Pavel Begunkov wrote:
> diff --git a/io_uring/bpf.h b/io_uring/bpf.h
> new file mode 100644
> index 000000000000..a61c489d306b
> --- /dev/null
> +++ b/io_uring/bpf.h
> @@ -0,0 +1,26 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#ifndef IOU_BPF_H
> +#define IOU_BPF_H
> +
> +#include <linux/io_uring_types.h>
> +#include <linux/bpf.h>
> +
> +#include "io_uring.h"
> +
> +struct io_uring_ops {
> +};
> +
> +static inline bool io_bpf_attached(struct io_ring_ctx *ctx)
> +{
> + return IS_ENABLED(CONFIG_BPF) && ctx->bpf_ops != NULL;
> +}
> +
> +#ifdef CONFIG_BPF
> +void io_unregister_bpf_ops(struct io_ring_ctx *ctx);
> +#else
> +static inline void io_unregister_bpf_ops(struct io_ring_ctx *ctx)
> +{
> +}
> +#endif

Should be

#ifdef IO_URING_BPF

here.

--
Jens Axboe


Return-Path: <linux-kernel+bounces-675865-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 67E1941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:26:39 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 704113A4EE7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:26:16 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B52E137932;
Fri, 6 Jun 2025 14:26:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g/YrrZDb"
Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 071A72B9A5;
Fri, 6 Jun 2025 14:26:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749219987; cv=none; b=OY/xVxivZpJZax4jSOP93uXiEwxqQamuIdh2cp6wxEfWULPJucBBbIzBP8UBK6Y2Q3vfG9XJt8zmz1K+n/Dr8bmq1nAoK/pdwKEOUG1DItPGlAqZQwp4rquGomMIChTq0t4XqsC+yw4JHEuFmNNbNZNgO9iz/RTX/LT8AvoeX2Q=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749219987; c=relaxed/simple;
bh=XfnyRTF9cyYzPGBVpgr2ODnE1deAYbYcyIcYxtMRycc=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=WD7ZZjuI2DbmFk3Bt3FocNVBDNNtvh3snpsLfRLcY5dOXt4dNHzYucLoTiDkX5kHNrjqbIYCEUMSwU58gzL4y/LSkApds5Xzu/lT1iY5Xlea2Ob0G1clZG1lIaeOEcjq1tzDtwkGxvfc+iS9SbDtTnXObahL0F+oPVQllcsBqCg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=g/YrrZDb; arc=none smtp.client-ip=209.85.217.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-vs1-f50.google.com with SMTP id ada2fe7eead31-4e59af1f0e7so619611137.0;
Fri, 06 Jun 2025 07:26:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749219985; x=1749824785; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=XfnyRTF9cyYzPGBVpgr2ODnE1deAYbYcyIcYxtMRycc=;
b=g/YrrZDbhdoEhU5yDdf8I9o5F/JxgFrDNT48SYbGo7t8mUs2AEAlFlrwapPiPi7o1n
WpAaKx9cC3Cz5/zXNrgXMl7HY8xIY28Ol5A1CZ1ZxYLqg3+r52z+SEhwoy+plVRFmstX
/XYEz3moccqwsCQfMwZ3GtY16AUysXW/qehDEOlraDl7k6Vr97V1rgAMVF4iepmhoV0F
2i+gZwfk5Nj4bNJey4q9w/pGV3TBC0Wve8K4gvBJlog42a/XKtNuR4pPokXSK1PCAuvo
o1E4YzdX4zUDypPDnC2IV5nM52IEC6VcKXj4wLAZXN0taRTxEMO6iHQlzV++k8lvXuTa
jjGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749219985; x=1749824785;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=XfnyRTF9cyYzPGBVpgr2ODnE1deAYbYcyIcYxtMRycc=;
b=ln0ZIzDyHTwPJxtLt1D14BVwoutn8QJBQKfPnzY9ysz/dLYk6pakDSnENWCrOZJUBw
aWsDgUbGKkLxO6C/Q5fhX9JIHzi0yrOEGd6lslN2x+EVU0iUeRMMPZbiQ+FiS3lDU41R
2+EVHDNjc3YXogojh+Sno6iDZ/ZNe7Xc+XDv6/TRF/BEme6BfnjM/24EWSzfGSQXBHyv
e8Vx/s92JLX7RGrojxgSxDzlX9U2ZlJ8SJkKmYVUzGEkRJb5bk+4wBHphA72J+qWEqHJ
nAzswUWgPTHm1aKyHfyi70iTc6dqfJtSwpK75qHFYctOKp0/ZMyUUmXFB0AmWMYgKEuV
nd1w==
X-Forwarded-Encrypted: i=1; AJvYcCV3ufsZnUPhlK1fwdI0Ya53N7ldX3AZ39u93CglBk5X+rxsT8eQ6YBdTvVpjzzwzm8la7ZArCLnusoXgu7/@vger.kernel.org, AJvYcCV49fTg5fEzQs/zwJLV3JSbkse9ja/OcttPKi0SgRV5Do0q7HioD0eD6pScwa+N4F5nmiuBejTL1vbcskEAjkA=@vger.kernel.org, AJvYcCXAlmIfUr6VaTqhKGyhoDzI0Z1BDx/IrMoaee9L9xYXtIStIQ14GGaMqiKOtfH0RKfsSD0nM1vWH6iZ@xxxxxxxxxxxxxxx, AJvYcCXnUNgl1HbDGsIeANovFiQgNzpXbpvHxzxxy3V+fg8Iy7k2XORsEQAtl3EQYYjTB4XlnrN4gnhOC7tQNQ==@vger.kernel.org
X-Gm-Message-State: AOJu0Yxd02TrfNahnt9Fc3vQGOwR6TdJGvbH6OpZAdwXmvggpVqMcnEV
UkQ8uRT2Qe8suE+x0VpR0pWH20eBbX1lWS7tCqUDEcLa2WnKj5DjgdLXEgvdY4kMM64Zizauyjq
gmyE31CS1hCd3TvTJ5gU1lnkKwDa/UOI=
X-Gm-Gg: ASbGncuqvagTs7Cl5XpKSVXirIRq1qNgQPPiQOBAFJYa/KU+H/O4AeNtX6OyWykpXZc
QqpONhIUYeJA+Z80LuRhzK8GRia9kJKviOGi9fyPhOdTkbW4k6S9bm3/N0Ebai8BfJpcCo1zTo+
jdFxBe82jEGGKTq1c1MC/6YStAS/wMuvoQ68SDY2BX
X-Google-Smtp-Source: AGHT+IHtfcCyCFZ6TdHUHESBhIqNCBUddX3O7P9LGH4zDo9p4z3LAVOg5NAYcVejVe51KzO/kmt6J7IoLoJyDzPVH/g=
X-Received: by 2002:a05:6122:2a45:b0:52f:2a3:4bd6 with SMTP id
71dfb90a1353d-530e47d7084mr3572334e0c.3.1749219984860; Fri, 06 Jun 2025
07:26:24 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605162726.3659792-1-igor.korotin@xxxxxxxxx> <aELyEqg0GrkC8oZY@pollux>
In-Reply-To: <aELyEqg0GrkC8oZY@pollux>
From: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Date: Fri, 6 Jun 2025 15:26:13 +0100
X-Gm-Features: AX0GCFtw9v0O2vZnp5UZfhE6lx1eLBBwkxj8gJtRKsSFion-e94P9ebf93MfPIQ
Message-ID: <CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v2 3/5] rust: driver: Add ACPI id table support to Adapter trait
To: Danilo Krummrich <dakr@xxxxxxxxxx>
Cc: Igor Korotin <igor.korotin@xxxxxxxxx>, Miguel Ojeda <ojeda@xxxxxxxxxx>,
Alex Gaynor <alex.gaynor@xxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>, "Rafael J . Wysocki" <rafael@xxxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, rust-for-linux@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, Boqun Feng <boqun.feng@xxxxxxxxx>,
Gary Guo <gary@xxxxxxxxxxx>, =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>, Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>,
Viresh Kumar <viresh.kumar@xxxxxxxxxx>, Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>, Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 2:50=E2=80=AFPM Danilo Krummrich <dakr@xxxxxxxxxx> w=
rote:
> However, I don't understand why we need this and the subsequent
> is_acpi_device_node() and is_of_node() checks.

The idea is to avoid unnecessary table lookups when both OF and ACPI
match tables are present. If we already know the fwnode type, these
simple pointer comparisons (is_acpi_device_node() / is_of_node()) let
us skip the irrelevant match function.

Those checks are cheap (just pointer comparisons), while
acpi_match_device() and of_match_device() iterate over tables.

So yeah, it=E2=80=99s a bit ugly, but it can save some CPU cycles during en=
umeration.

Thanks,
Igor


Return-Path: <linux-kernel+bounces-675866-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 467DE41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:04 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1474C16C2FE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:28:01 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C7F7137932;
Fri, 6 Jun 2025 14:27:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VuYiwzgT"
Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2072.outbound.protection.outlook.com [40.107.243.72])
(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 C59371805E;
Fri, 6 Jun 2025 14:27:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.72
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220069; cv=fail; b=sTugOvqjA6ETbpA0vKQLUjfRdx0iKpjOg0bd2WNHH73ZagqZcL8P2rqTimmansXoRlsNiHjLQwBcVJUDhSEnsspD4W0SGI8GTW6lSOvOFr0vNhlFUxKUL7mA/qB0/T/THeRKEQgh1pfT3Pa5S7mm3potX3t84ifwMQnapJJHr5c=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220069; c=relaxed/simple;
bh=Vj0t7ZE+4F0/p+N37nf9BVJzi9CeHG4JGgnGIl/qlGQ=;
h=Message-ID:Date:Subject:To:References:From:In-Reply-To:
Content-Type:MIME-Version; b=ISEGKGRK/wu/fUbc+S0sLpCoKHZGdCftNOkYmrF6VKbFra/ub5avNa38wr/qHVmmGIeRXXMVBpDYIzqwlirAGuSkd6R3c/W6cNCYUvlOVEgY3YvEMQI3BRxhv5XxUDSn8XDUSoQ10ocn5tz7sBivRG4JSlOipbb+1r/gEhezQ6Q=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=VuYiwzgT; arc=fail smtp.client-ip=40.107.243.72
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=SPSl2qNURD8KoIbg5sYrMC49rQxrbsMUygut73iOCjzJECDPVU5swXUulgEJivh6HdLIsx7DUgYNsUufRxq/LFFaCf9+bPtPSx2p602JLmYOjKwzzwsLZzD1Z4aVFtWkUyn7NSCryZUu9mWokIB6YwKOk45szBAoxS3Bec4vORZIS1303Yl2JH0Eu+dxlc/frIyYuoutu5ZJ5cj39b1yTfl0lq/eo+OQyxMmUT84ayRgpyXOdSZsEsY1DEzIrX3CMyK/27TxqeNsXIZ3122o09C0hfBZkKg7PxV1mYtckSCKk+3Ghg1m4XN1KL+WEsNgSoJwx/CeHXNiDyZYuskKKw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=aInr3UHkwzT81LywngyBOXH52U4TVJaT5ljIRK2aLbg=;
b=wptdTLBQQHTj1gAoro0PRRODfIB4BZSNjeZqT0vJt/CJkCkyu1tLd+1JxcfP4r8fMz3JpnVqHsGg7HzCY0u7Apz/dtwNjRbDytXR1ZR/tpQglQa9JrCv5skGlDHrQCmSnUpU/+EqR/gnLttb0tPFgmXk50+v5AXepiN1DJ8xroglgc/lLx9BTHPytZHhI9fXzE0Gal8wp6AOTLbxMxuS5Wr7ZYaXlHikfYghdqqtr+awKD5dM5lmkJlQpILxGrCP+Fr/G4xRBrJdLxgbaajZsrnvm58c950R1y7/wtfA/zIpRAZwvV25P7q9HeChZP9807+rUMnXMnc036vxTc3TXg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass
header.d=amd.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=aInr3UHkwzT81LywngyBOXH52U4TVJaT5ljIRK2aLbg=;
b=VuYiwzgTMXZV9oY6dmlpCnVNrqeuNP6i2i8VpM7J+k6z7w2ZyykhZ6frtt5eLcOlDQPf6BRsKOAuobTLlWHo5h2XfzQq4Vj/QeqZjEWHe6qi33dIOROd60kCVGrMdoz0UyWNnlXn3iejO+aAFQiA2ml6qisgHWqOHkEIZU/XACQ=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=amd.com;
Received: from DS0PR12MB6390.namprd12.prod.outlook.com (2603:10b6:8:ce::7) by
MN0PR12MB5762.namprd12.prod.outlook.com (2603:10b6:208:375::12) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8722.28; Fri, 6 Jun
2025 14:27:43 +0000
Received: from DS0PR12MB6390.namprd12.prod.outlook.com
([fe80::38ec:7496:1a35:599f]) by DS0PR12MB6390.namprd12.prod.outlook.com
([fe80::38ec:7496:1a35:599f%5]) with mapi id 15.20.8792.034; Fri, 6 Jun 2025
14:27:43 +0000
Message-ID: <af218185-3fdb-4e96-9f15-aa9d8bdcdda6@xxxxxxx>
Date: Fri, 6 Jun 2025 09:27:39 -0500
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v9 03/16] CXL/AER: Introduce kfifo for forwarding CXL
errors
To: Dave Jiang <dave.jiang@xxxxxxxxx>, PradeepVineshReddy.Kodamati@xxxxxxx,
dave@xxxxxxxxxxxx, jonathan.cameron@xxxxxxxxxx, alison.schofield@xxxxxxxxx,
vishal.l.verma@xxxxxxxxx, ira.weiny@xxxxxxxxx, dan.j.williams@xxxxxxxxx,
bhelgaas@xxxxxxxxxx, bp@xxxxxxxxx, ming.li@xxxxxxxxxxxx,
shiju.jose@xxxxxxxxxx, dan.carpenter@xxxxxxxxxx,
Smita.KoralahalliChannabasappa@xxxxxxx, kobayashi.da-06@xxxxxxxxxxx,
yanfei.xu@xxxxxxxxx, rrichter@xxxxxxx, peterz@xxxxxxxxxxxxx, colyli@xxxxxxx,
uaisheng.ye@xxxxxxxxx, fabio.m.de.francesco@xxxxxxxxxxxxxxx,
ilpo.jarvinen@xxxxxxxxxxxxxxx, yazen.ghannam@xxxxxxx,
linux-cxl@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-pci@xxxxxxxxxxxxxxx
References: <20250603172239.159260-1-terry.bowman@xxxxxxx>
<20250603172239.159260-4-terry.bowman@xxxxxxx>
<ced413e5-6a98-4d6a-9c49-1a0603a1bb98@xxxxxxxxx>
Content-Language: en-US
From: "Bowman, Terry" <terry.bowman@xxxxxxx>
In-Reply-To: <ced413e5-6a98-4d6a-9c49-1a0603a1bb98@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: SA9PR03CA0004.namprd03.prod.outlook.com
(2603:10b6:806:20::9) To DS0PR12MB6390.namprd12.prod.outlook.com
(2603:10b6:8:ce::7)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS0PR12MB6390:EE_|MN0PR12MB5762:EE_
X-MS-Office365-Filtering-Correlation-Id: 25d68ccc-92c2-4890-3953-08dda5064ce5
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|376014|1800799024|366016|7416014|921020;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?VUlVYnpBam5KNUtCMC8zTmpWdUxuY01DSU5XTU9zK0NHQnZod0YyY1FTbjRS?=
=?utf-8?B?RWFxTWYzMXR4TzNSend6THRjSTRyU2hsN1h6Syt0bTVBRHdBNFRvSmdFODhz?=
=?utf-8?B?WFNRS2tka2d3amgwWlpseXFXUkhURlZMVjZFZnVtVzVkWWtobUluMEh1Nml5?=
=?utf-8?B?ck1Ob1dFMXJZenZudUlldjlVd1p0VDhwOTFaU1JlVVJHV3pkSXg2RGNuNU5Y?=
=?utf-8?B?MUVMRjVVNktXc0Rmcm9IZU9wYWVQNEJ2dGdEZjF3OUFUK3FVS0dJK2NsZ2Zu?=
=?utf-8?B?RkRXbXNLQ0c4K0R3d1QwbEZxcmpXODJnUDFCMklrOGpSOEl3bHZNUEtuckdX?=
=?utf-8?B?WXdoRVVCUE5mQnlSUzdmUU9yOGlHcnNWOEdoMHNaN1MydkF5T0kxcW43ZW5s?=
=?utf-8?B?c2JqdnVJam1kVTVxT3BnbzZBYm03bjhLcTF1YVJTbldQdW0ydStQdFFnekF6?=
=?utf-8?B?dW9OZnFwUXZEYVUvMWpva0VINnR0UkFDV3YzSW02cHRSZ0c4cEptUmFzcnMr?=
=?utf-8?B?R2lIeURDekJyTW1uZUhkUlJSVitjT0ZoTnNBSGpwSXBWYUZMdUpYbHVGVm1W?=
=?utf-8?B?dnptMGNadVJYNVJSUzU3L0djQTNvZDJJRlY5SG40WGpjQzhqbUUwQmVpYmZv?=
=?utf-8?B?YVQ0OEVRRW5DSXlvTlBrMHQ3aVNxSG5vV3lFQ21ZOUNObmlmKy9tVndQcGZu?=
=?utf-8?B?SGxpcllPdnFaVnhucktGZnJURjkwcXFta3lJVVZjSVlOb296OFBEaWdCem1U?=
=?utf-8?B?RWI2L3N1TlhnTFhUV0hmVktnZVVGUGo0VWxVWWhJYmNEY2JaSldJNk5QTitr?=
=?utf-8?B?TjZOcytUcDNjYzl2VzZYWlVyeXVSK0NKeFBDNncwdFNyN3pESW1pUFJPMHIy?=
=?utf-8?B?aGJlWWdYNVB4QU53MUZiWWtpeDRwWDhMTGFiR1prc0J0ek1jc2hNdjN5OWMr?=
=?utf-8?B?WWRFdGVkclNQeVg5MFBhV05hUnNJcTBMSWhpVjZVTkVIN0MrdkNSaXRKSXZC?=
=?utf-8?B?eFltT3dLMVQ0emxjaUxNM0VCSXpyVDQxRDVOTlFVZ096Z1RvSFJTdUdJa3M3?=
=?utf-8?B?c0hLSVVIQWdsYVlkeVI2Tzd1MjFJQ2dZM016Z250VEZFa2ZJYjBBMzE4aGJs?=
=?utf-8?B?YmRvSzJMMWVGbXVlWDZjZlVUUEdxQXAreDk4eW91VllsQ2M2WjZLeHRiSDdU?=
=?utf-8?B?RXNhaE0rMk0rbVpwbHpZc0puNlZKenBCTjk0cHdkSTRKc0g1UnFVNUgyWTUy?=
=?utf-8?B?WWJyM2FyaDQzSFFpZWlZdDBHUEtUSU5RNThtbzk5VWlkaG82YVRldHNOdkRO?=
=?utf-8?B?SWkydEsvSjFUb0VwaVlDQllqU3FRUGVrWHpFeVI0NjNVdEc5VnFJMExZaSt6?=
=?utf-8?B?TDlVVUlXN0Fkb0tqajQwdUt0QkZma0VTS01Cek9IRjltZlJqRWpxSk1zR1JU?=
=?utf-8?B?Vi9hblNpTnYwSThwUXU2T0UrYVpEZ3V3VC9YOWhpZFU0cE8xeExRRDVxRzEr?=
=?utf-8?B?eDYySUJhQkxzeWplVG5QTFUxVlFFN2lIUGRCZ215Y3lvZHRleXFvOHhLRmJt?=
=?utf-8?B?Q1BIcnN2TStpUFZLcTdqcHVLZW9FNzE2cXZXOWZ2aktoN3NmemJsNk40NTZH?=
=?utf-8?B?RkFLQk1CQmJkK3gvaTdPc25KNU1NQkhZQ2RrbCtKNEVOUVU3U0FQaWRrTjBl?=
=?utf-8?B?QS9STWJEenlIOXoyQTBTZlRkOHVMZVhlVndpWmU2Unc0aTVkOWxaSUp3WG4x?=
=?utf-8?B?RnZDNk5CSTJLRkdoMXJZQXVtQ0FsQzB5MnFrUDgzTVVJWTRpNUI2N2NZRXdl?=
=?utf-8?B?MmxiWXk1MHVlR3ExLzdiRXdIczZkQ0JIaEJ3azhtclVQdHFnVnJOMjJKWW5F?=
=?utf-8?B?aDNzOEFZNisvUmNMZHp4SXRTdXdLN1ZtUWtCMGpZKzQ5ZWJpOEhHNU5qejVT?=
=?utf-8?B?NUFuSk5CRC9Jci9LRTNQY0JGbWR1bmNha3pBbHN1L3pRUCtOWUxhVHdLWWlt?=
=?utf-8?B?WnVEQ1dwS09BPT0=?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB6390.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016)(7416014)(921020);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?TzFGbTZDcUI3cDQ0c2RFaUxaNXlZUVBydExMWHBOSHBhZW5Lc29tUlRrVXh3?=
=?utf-8?B?blFackVibG5GWEMydHFYbU1lQlNQak00Rmx6QzcvbEpOSkN0V1Y4UDNaTlNE?=
=?utf-8?B?WjVUNzgzeFgwcGJEdzlQM1JGQmgvVlJpZFhhZU5BQkhsZzd3a3E5RnRBaklS?=
=?utf-8?B?U25xbUVYRVNseXVBeEt5NmRQQWpPY1dvOEIzK0hDSWFlWDc1Ukc0a1NVd0NC?=
=?utf-8?B?cjdmYndSbC85dk5rc3ZTQjU0cHQ1eFdNWVhDd0V4ZTMrWkF2Yy9Na0NqV3Iz?=
=?utf-8?B?Q0E0RFlkRjhvRlBCN3VFWlZac2tTMWVTUGcxdEd2TnE0TUJyd2J2VXNtazFm?=
=?utf-8?B?VXJXdlkrZXJUV1pyT2pTMjZtQXROVis0cmxBRjVNdit0ZzNkOFR1U3RxNnpa?=
=?utf-8?B?R2hYTFhnYWJpZlpUWHNXcGpGays5ZUgzUGJKdUFob0dCSUtDM0lYL3RLcXVS?=
=?utf-8?B?dlR2V0NiQzJPU2VtYWpYd25xSlIyQ3lUM0U0L2Q1am5sMk9kN2NhamVJRDZV?=
=?utf-8?B?NkR5a01mR1UvcnlmOVZPRE1hd1d4SVpybFNObEhEVU1hczJ0YXI0SHB4VXRT?=
=?utf-8?B?SGppUjR3Z3k0Tm92UEZjQ1RVcnAvMzFYa0tpQ1A0a3BQK3ZRdmJDTWYzMkZR?=
=?utf-8?B?bW5VTW9Cbm9EU0Q3aktqRjAwaSt3akVyTnBlSzIwMGZ1ZXhKV3AxVTRhem1M?=
=?utf-8?B?V0FNNGdVWVFQcnFiNHh4RjlFUHlyL09RL21FZE84dDhOZ1BJTGFJcVo1YlV1?=
=?utf-8?B?YUhFTFRLUjVpSDZ2SEdZRWlGWXM1QXMvcGJnMlBBS1F2V1R3TUZLOXpuY2FD?=
=?utf-8?B?ZFl6a0JPdGowOTNxOElZbUZ1QU4xY0Z6bytSOUV2NGJqNHRsa2RLYXRKSHhi?=
=?utf-8?B?WGlRbTRHUmh5a1N3UmNUOUtvME43WHVaOU1WUmZUN2RoeElGVllPRHN6LzFY?=
=?utf-8?B?Wm9VaWRLVjVaOCtOWXpoa0k3dmUxYnFXbW5SUTh4V0lmME9EVGJRdlZ1K0t6?=
=?utf-8?B?czZsVkx3WmkyNHk2NHlGZU1IV3BkbFlSbUNBREFETVUvZDhQaTQwaVd3SzVy?=
=?utf-8?B?NS93bEFncnU2TUlNV2tWNjRPUGs5Z0tmejJyRlV0azFsTTVSdmdlYllOSDgz?=
=?utf-8?B?UmE1WjR0YVUwVmJhUjZwZk1Bc1l5cmNEa2V6ZUtFMTFTeHRZanhPWnhYNG5h?=
=?utf-8?B?QUVjbzlldTZjNUZPRTJ3M0hpM2lzUHJMc2MvM3AwZWhRVHFQNUFRN0lVL3lU?=
=?utf-8?B?SUlmTjZzd0QrdmFCNDJLbUNkVlNHV1lLVUdMZzlHZjY5cUN4RXZOcWtHR3BQ?=
=?utf-8?B?a3A4LzRPSVl1QXAvc29Ua0RnSEltRFFZZjhIUzhCNEpocjV6UERoZ2ZtUThz?=
=?utf-8?B?RFdsOUxQem85NkNHc3p1SHhpenNkM2JxcDZDdzBrbzF0VnFkUmhtWW1RSDJi?=
=?utf-8?B?SnB1WExoRzhuSDFlNm5wdG9yamtpc2xVcVZYU0NmRGZmZUs5clFXOS9VbWYx?=
=?utf-8?B?dTMvTG1OMC85NGFKaU05clVxYmpVUDg2WTAzUDlTMHV1NUE0VHRlbHdaT0lZ?=
=?utf-8?B?UUxYTW53WHZHWUxqK2FqZklBR3ZOWS9EM3M0elNINTZFcE5pVElvTlNLTTR6?=
=?utf-8?B?elhCeWNYZklGOTdrYzV3OGdMZFhKUkF1ZjJ0R0dDYkhFTE56VHIwcHIwekJB?=
=?utf-8?B?YUlqL0FNeFZRdTFhcHQrNVlvaFhnSDExcnhCeFEzbEhtZmNFTTNQZG5Ld2Zl?=
=?utf-8?B?cGdFNWdNSUd6ekRjdkdwN2ZOVlZ3cXltMDR5c09zRnJVTTJXRkxHRm1VaE9l?=
=?utf-8?B?WHhaZU1acTN0dGJsWEJxanFpZ20xRG9FWEJ0YjRQQkVDaEZkOVhrWHErVGtm?=
=?utf-8?B?T3pmNjZWbmttSEllSmM5eWo5TW41eC9xZWJTNnhoR3ZUNTcyWmVTc0krVnZI?=
=?utf-8?B?d2hSRUNLRUxQRFBYeTVsNkhhQXZRYk83ODNwNnFKTFExaWFvUTV4WXd5Uytu?=
=?utf-8?B?TXNiS05HZnVHQTcxb3hqR1Q3dkxqbWhXTldkNk0yd1BHblZPWHRYc3E1dC9Q?=
=?utf-8?B?bno2VkxBdjdrVTYzT1dTTW9mNVhUWVE2aEwyTGdDMWYwQytCT3Z6WEp6U2VU?=
=?utf-8?Q?XRYIFIcagsuUKT3DJ+dXNMyEv?=
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 25d68ccc-92c2-4890-3953-08dda5064ce5
X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB6390.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 14:27:43.6838
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 73vvKrXuNOZaTw4+Pb6e9lQ36fU+9pZWOxKqAvhDTm5HKtCT753FJKTYx+f+p8J6C1UMNqcyIimO+3tG4BOMXg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5762
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/5/2025 7:27 PM, Dave Jiang wrote:
>
> On 6/3/25 10:22 AM, Terry Bowman wrote:
>> CXL error handling will soon be moved from the AER driver into the CXL
>> driver. This requires a notification mechanism for the AER driver to share
>> the AER interrupt with the CXL driver. The notification will be used
>> as an indication for the CXL drivers to handle and log the CXL RAS errors.
>>
>> Add a kfifo work queue to be used by the AER driver and CXL driver. The AER
>> driver will be the sole kfifo producer adding work and the cxl_core will be
>> the sole kfifo consumer removing work. Add the boilerplate kfifo support.
>>
>> Add CXL work queue handler registration functions in the AER driver. Export
>> the functions allowing CXL driver to access. Implement registration
>> functions for the CXL driver to assign or clear the work handler function.
>>
>> Introduce function cxl_create_prot_err_info() and 'struct cxl_prot_err_info'.
>> Implement cxl_create_prot_err_info() to populate a 'struct cxl_prot_err_info'
>> instance with the AER severity and the erring device's PCI SBDF. The SBDF
>> details will be used to rediscover the erring device after the CXL driver
>> dequeues the kfifo work. The device rediscovery will be introduced along
>> with the CXL handling in future patches.
>>
>> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx>
>> ---
>> drivers/cxl/core/ras.c | 31 +++++++++-
>> drivers/cxl/cxlpci.h | 1 +
>> drivers/pci/pcie/aer.c | 132 ++++++++++++++++++++++++++++-------------
>> include/linux/aer.h | 36 +++++++++++
>> 4 files changed, 157 insertions(+), 43 deletions(-)
>>
>> diff --git a/drivers/cxl/core/ras.c b/drivers/cxl/core/ras.c
>> index 485a831695c7..d35525e79e04 100644
>> --- a/drivers/cxl/core/ras.c
>> +++ b/drivers/cxl/core/ras.c
>> @@ -5,6 +5,7 @@
>> #include <linux/aer.h>
>> #include <cxl/event.h>
>> #include <cxlmem.h>
>> +#include <cxlpci.h>
>> #include "trace.h"
>>
>> static void cxl_cper_trace_corr_port_prot_err(struct pci_dev *pdev,
>> @@ -107,13 +108,41 @@ static void cxl_cper_prot_err_work_fn(struct work_struct *work)
>> }
>> static DECLARE_WORK(cxl_cper_prot_err_work, cxl_cper_prot_err_work_fn);
>>
>> +#ifdef CONFIG_PCIEAER_CXL
>> +
>> +static void cxl_prot_err_work_fn(struct work_struct *work)
>> +{
>> +}
>> +
>> +#else
>> +static void cxl_prot_err_work_fn(struct work_struct *work) { }
>> +#endif /* CONFIG_PCIEAER_CXL */
> I wonder instead of the ifdef block we can just do:
>
> static void cxl_prot_err_work_fn(...)
> {
> if (!IS_ENABLED(CONFIG_PCIEAER_CXL))
> return;
>
> ....
> }
I have a TODO request from Jonathan Cameron in the previous series iteration to address the
same #ifdef cleanup. Jonathan recommended introducing drivers/cxl/core/aer.c and moving the
CXL related AER logic to the new file. Are you OK with that solution?

> In general we want to avoid ifdefs in C files.
>
> Also, where is CONFIG_PCIEAER_CXL defined? I'm having trouble finding the Kconfig that declares it.
>
> $ git grep CONFIG_PCIEAER_CXL
> drivers/cxl/core/pci.c:#ifdef CONFIG_PCIEAER_CXL
> drivers/cxl/core/ras.c:#ifdef CONFIG_PCIEAER_CXL
> drivers/cxl/core/ras.c:#endif /* CONFIG_PCIEAER_CXL */
> drivers/cxl/cxl.h:#ifdef CONFIG_PCIEAER_CXL
> drivers/cxl/port.c:#ifdef CONFIG_PCIEAER_CXL
> drivers/cxl/port.c:#endif /* CONFIG_PCIEAER_CXL */
> drivers/pci/pcie/aer.c:#if defined(CONFIG_PCIEAER_CXL)
> drivers/pci/pcie/aer.c:#ifdef CONFIG_PCIEAER_CXL
> drivers/pci/pcie/aer.c:#if defined(CONFIG_PCIEAER_CXL)
> include/linux/aer.h:#if defined(CONFIG_PCIEAER_CXL)
>
CONFIG_PCIEAER_CXL is a Kconfig dependent on CONFIG_PCIEAER. When enabled the
#define is found in include/generated/autoconf.h

>> +
>> +static struct work_struct cxl_prot_err_work;
>> +static DECLARE_WORK(cxl_prot_err_work, cxl_prot_err_work_fn);
>> +
>> int cxl_ras_init(void)
>> {
>> - return cxl_cper_register_prot_err_work(&cxl_cper_prot_err_work);
>> + int rc;
>> +
>> + rc = cxl_cper_register_prot_err_work(&cxl_cper_prot_err_work);
>> + if (rc)
>> + pr_err("Failed to register CPER AER kfifo (%x)", rc);
>> +
>> + rc = cxl_register_prot_err_work(&cxl_prot_err_work);
>> + if (rc) {
>> + pr_err("Failed to register native AER kfifo (%x)", rc);
>> + return rc;
>> + }
>> +
>> + return 0;
>> }
>>
>> void cxl_ras_exit(void)
>> {
>> cxl_cper_unregister_prot_err_work(&cxl_cper_prot_err_work);
>> cancel_work_sync(&cxl_cper_prot_err_work);
>> +
>> + cxl_unregister_prot_err_work();
>> + cancel_work_sync(&cxl_prot_err_work);
>> }
>> diff --git a/drivers/cxl/cxlpci.h b/drivers/cxl/cxlpci.h
>> index 54e219b0049e..6f1396ef7b77 100644
>> --- a/drivers/cxl/cxlpci.h
>> +++ b/drivers/cxl/cxlpci.h
>> @@ -4,6 +4,7 @@
>> #define __CXL_PCI_H__
>> #include <linux/pci.h>
>> #include "cxl.h"
>> +#include "linux/aer.h"
>>
>> #define CXL_MEMORY_PROGIF 0x10
>>
>> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
>> index adb4b1123b9b..5350fa5be784 100644
>> --- a/drivers/pci/pcie/aer.c
>> +++ b/drivers/pci/pcie/aer.c
>> @@ -114,6 +114,14 @@ struct aer_stats {
>> static int pcie_aer_disable;
>> static pci_ers_result_t aer_root_reset(struct pci_dev *dev);
>>
>> +#if defined(CONFIG_PCIEAER_CXL)
> Would it make sense to move all the CXL bits to a cxl_aer.c instead of all the ifdefs in this C file?
>
> DJ

Yes, this is a good idea. I'll make the AER driver related change to separate the CXL logic.

Terry

>> +#define CXL_ERROR_SOURCES_MAX 128
>> +static DEFINE_KFIFO(cxl_prot_err_fifo, struct cxl_prot_err_work_data,
>> + CXL_ERROR_SOURCES_MAX);
>> +static DEFINE_SPINLOCK(cxl_prot_err_fifo_lock);
>> +struct work_struct *cxl_prot_err_work;
>> +#endif
>> +
>> void pci_no_aer(void)
>> {
>> pcie_aer_disable = 1;
>> @@ -1004,45 +1012,17 @@ static bool is_internal_error(struct aer_err_info *info)
>> return info->status & PCI_ERR_UNC_INTN;
>> }
>>
>> -static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data)
>> +static bool is_cxl_error(struct pci_dev *pdev, struct aer_err_info *info)
>> {
>> - struct aer_err_info *info = (struct aer_err_info *)data;
>> - const struct pci_error_handlers *err_handler;
>> + if (!info || !info->is_cxl)
>> + return false;
>>
>> - if (!is_cxl_mem_dev(dev) || !cxl_error_is_native(dev))
>> - return 0;
>> + /* Only CXL Endpoints are currently supported */
>> + if ((pci_pcie_type(pdev) != PCI_EXP_TYPE_ENDPOINT) &&
>> + (pci_pcie_type(pdev) != PCI_EXP_TYPE_RC_EC))
>> + return false;
>>
>> - /* Protect dev->driver */
>> - device_lock(&dev->dev);
>> -
>> - err_handler = dev->driver ? dev->driver->err_handler : NULL;
>> - if (!err_handler)
>> - goto out;
>> -
>> - if (info->severity == AER_CORRECTABLE) {
>> - if (err_handler->cor_error_detected)
>> - err_handler->cor_error_detected(dev);
>> - } else if (err_handler->error_detected) {
>> - if (info->severity == AER_NONFATAL)
>> - err_handler->error_detected(dev, pci_channel_io_normal);
>> - else if (info->severity == AER_FATAL)
>> - err_handler->error_detected(dev, pci_channel_io_frozen);
>> - }
>> -out:
>> - device_unlock(&dev->dev);
>> - return 0;
>> -}
>> -
>> -static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info)
>> -{
>> - /*
>> - * Internal errors of an RCEC indicate an AER error in an
>> - * RCH's downstream port. Check and handle them in the CXL.mem
>> - * device driver.
>> - */
>> - if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC &&
>> - is_internal_error(info))
>> - pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info);
>> + return is_internal_error(info);
>> }
>>
>> static int handles_cxl_error_iter(struct pci_dev *dev, void *data)
>> @@ -1056,13 +1036,17 @@ static int handles_cxl_error_iter(struct pci_dev *dev, void *data)
>> return *handles_cxl;
>> }
>>
>> -static bool handles_cxl_errors(struct pci_dev *rcec)
>> +static bool handles_cxl_errors(struct pci_dev *dev)
>> {
>> bool handles_cxl = false;
>>
>> - if (pci_pcie_type(rcec) == PCI_EXP_TYPE_RC_EC &&
>> - pcie_aer_is_native(rcec))
>> - pcie_walk_rcec(rcec, handles_cxl_error_iter, &handles_cxl);
>> + if (!pcie_aer_is_native(dev))
>> + return false;
>> +
>> + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC)
>> + pcie_walk_rcec(dev, handles_cxl_error_iter, &handles_cxl);
>> + else
>> + handles_cxl = pcie_is_cxl(dev);
>>
>> return handles_cxl;
>> }
>> @@ -1076,10 +1060,46 @@ static void cxl_rch_enable_rcec(struct pci_dev *rcec)
>> pci_info(rcec, "CXL: Internal errors unmasked");
>> }
>>
>> +static int cxl_create_prot_error_info(struct pci_dev *pdev,
>> + struct aer_err_info *aer_err_info,
>> + struct cxl_prot_error_info *cxl_err_info)
>> +{
>> + cxl_err_info->severity = aer_err_info->severity;
>> +
>> + cxl_err_info->function = PCI_FUNC(pdev->devfn);
>> + cxl_err_info->device = PCI_SLOT(pdev->devfn);
>> + cxl_err_info->bus = pdev->bus->number;
>> + cxl_err_info->segment = pci_domain_nr(pdev->bus);
>> +
>> + return 0;
>> +}
>> +
>> +static void forward_cxl_error(struct pci_dev *pdev, struct aer_err_info *aer_err_info)
>> +{
>> + struct cxl_prot_err_work_data wd;
>> + struct cxl_prot_error_info *cxl_err_info = &wd.err_info;
>> +
>> + cxl_create_prot_error_info(pdev, aer_err_info, cxl_err_info);
>> +
>> + if (!kfifo_put(&cxl_prot_err_fifo, wd)) {
>> + dev_err_ratelimited(&pdev->dev, "CXL kfifo overflow\n");
>> + return;
>> + }
>> +
>> + schedule_work(cxl_prot_err_work);
>> +}
>> +
>> #else
>> static inline void cxl_rch_enable_rcec(struct pci_dev *dev) { }
>> static inline void cxl_rch_handle_error(struct pci_dev *dev,
>> struct aer_err_info *info) { }
>> +static inline void forward_cxl_error(struct pci_dev *dev,
>> + struct aer_err_info *info) { }
>> +static inline bool handles_cxl_errors(struct pci_dev *dev)
>> +{
>> + return false;
>> +}
>> +static bool is_cxl_error(struct pci_dev *pdev, struct aer_err_info *info) { return 0; };
>> #endif
>>
>> /**
>> @@ -1117,8 +1137,11 @@ static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info)
>>
>> static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info)
>> {
>> - cxl_rch_handle_error(dev, info);
>> - pci_aer_handle_error(dev, info);
>> + if (is_cxl_error(dev, info))
>> + forward_cxl_error(dev, info);
>> + else
>> + pci_aer_handle_error(dev, info);
>> +
>> pci_dev_put(dev);
>> }
>>
>> @@ -1582,6 +1605,31 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
>> return rc ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
>> }
>>
>> +#if defined(CONFIG_PCIEAER_CXL)
>> +
>> +int cxl_register_prot_err_work(struct work_struct *work)
>> +{
>> + guard(spinlock)(&cxl_prot_err_fifo_lock);
>> + cxl_prot_err_work = work;
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_NS_GPL(cxl_register_prot_err_work, "CXL");
>> +
>> +int cxl_unregister_prot_err_work(void)
>> +{
>> + guard(spinlock)(&cxl_prot_err_fifo_lock);
>> + cxl_prot_err_work = NULL;
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_NS_GPL(cxl_unregister_prot_err_work, "CXL");
>> +
>> +int cxl_prot_err_kfifo_get(struct cxl_prot_err_work_data *wd)
>> +{
>> + return kfifo_get(&cxl_prot_err_fifo, wd);
>> +}
>> +EXPORT_SYMBOL_NS_GPL(cxl_prot_err_kfifo_get, "CXL");
>> +#endif
>> +
>> static struct pcie_port_service_driver aerdriver = {
>> .name = "aer",
>> .port_type = PCIE_ANY_PORT,
>> diff --git a/include/linux/aer.h b/include/linux/aer.h
>> index 02940be66324..550407240ab5 100644
>> --- a/include/linux/aer.h
>> +++ b/include/linux/aer.h
>> @@ -10,6 +10,7 @@
>>
>> #include <linux/errno.h>
>> #include <linux/types.h>
>> +#include <linux/workqueue_types.h>
>>
>> #define AER_NONFATAL 0
>> #define AER_FATAL 1
>> @@ -53,6 +54,27 @@ struct aer_capability_regs {
>> u16 uncor_err_source;
>> };
>>
>> +/**
>> + * struct cxl_prot_err_info - Error information used in CXL error handling
>> + * @severity: AER severity
>> + * @function: Device's PCI function
>> + * @device: Device's PCI device
>> + * @bus: Device's PCI bus
>> + * @segment: Device's PCI segment
>> + */
>> +struct cxl_prot_error_info {
>> + int severity;
>> +
>> + u8 function;
>> + u8 device;
>> + u8 bus;
>> + u16 segment;
>> +};
>> +
>> +struct cxl_prot_err_work_data {
>> + struct cxl_prot_error_info err_info;
>> +};
>> +
>> #if defined(CONFIG_PCIEAER)
>> int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
>> int pcie_aer_is_native(struct pci_dev *dev);
>> @@ -64,6 +86,20 @@ static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
>> static inline int pcie_aer_is_native(struct pci_dev *dev) { return 0; }
>> #endif
>>
>> +#if defined(CONFIG_PCIEAER_CXL)
>> +int cxl_register_prot_err_work(struct work_struct *work);
>> +int cxl_unregister_prot_err_work(void);
>> +int cxl_prot_err_kfifo_get(struct cxl_prot_err_work_data *wd);
>> +#else
>> +static inline int
>> +cxl_register_prot_err_work(struct work_struct *work)
>> +{
>> + return 0;
>> +}
>> +static inline int cxl_unregister_prot_err_work(void) { return 0; }
>> +static inline int cxl_prot_err_kfifo_get(struct cxl_prot_err_work_data *wd) { return 0; }
>> +#endif
>> +
>> void pci_print_aer(struct pci_dev *dev, int aer_severity,
>> struct aer_capability_regs *aer);
>> int cper_severity_to_aer(int cper_severity);



Return-Path: <linux-kernel+bounces-675867-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6A9F741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 992EC7AA864
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:27:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 23AB715B135;
Fri, 6 Jun 2025 14:28:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MkTDT8Zz"
Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8EC11805E;
Fri, 6 Jun 2025 14:28:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220096; cv=none; b=Pbi9DIfzCPmumo/DKwMupBSFT6tfCoVpf1O8vQfoTLNa5ZKbRWUKqZxXvOTuaNJUbqIxrQWq7kGoJJSF4WHBG8jrKCuCkVI5fZpwzr2zkIymytLcPSlpdtQ5gKPkTacx8VAr07kCNkJyHTVXx4XlYZaOwX2yUYzp0asno9FlrRo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220096; c=relaxed/simple;
bh=08Vq20uOgofu8CZCdNlOobGZcEnOMNCeL/M4vYUrAnE=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=uL0vrAtZ1wLF2gxv4f4t8QipxmJ+v4O0tlkEC8m6/Ur3+0RrRGlZOJpY6YWtK8bQGH9Luvs9t1qUqvpS+S5GXiGcAh6v618MOhTc81lvCZlqxaa31OiNjBptBYjYZg/9UlGZgWyAyf14maxBSTbhYhR3zaNhqA4ZaZcFMr7uHPA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MkTDT8Zz; arc=none smtp.client-ip=209.85.214.176
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-22e09f57ed4so30261815ad.0;
Fri, 06 Jun 2025 07:28:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749220094; x=1749824894; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=ralCqpmIy+3EJB5V6PR2/HbS8cHhfOSaQOQqHRr2GTw=;
b=MkTDT8Zz4ShzijTklDSj55uYiwgKoF8vuzNAH0YKxRyYA48/nNxmRXLYfMbmCCG2ko
wR+sdt4lpFjQv0TuLrJHKyIFoVvu0R1P6/cGlq3/frpGg8gAxqB6Vb1Uohz+YwirpC6v
5gRPd8s0rD0A0db/KRvYo4yRf57C8ja4w6OpmyEHzqsZ6dC3JHzHEEQeekKg+X7cQhOw
xXyUrYtgbPjMyeUQXDLebmV6DPIWiY7zNZYif/JX78Q1JS4cZTgzhZHwgSAuEsTfMg8r
gq7SLNnzCOTqTQLi3DgqFh+e7J7B2ClcWfJ6IrUz2Y0+8aQTADCafnY+LnP65/0Fqham
DaMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749220094; x=1749824894;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ralCqpmIy+3EJB5V6PR2/HbS8cHhfOSaQOQqHRr2GTw=;
b=PtJUT8tq6DdgQpQNEJJJ02nUuRg7grxfNdmx44w/jiL5ERcwwW5cV/PGS2J+/daeN1
Lk4NeqmpKp9uLeUGbQx2MGyuu3iz8V26PsLDb9CaRCBx1HAiOqtffK7i+UYqE7M87Ao6
wVZg9KcjyxMOwERUCalvkpn0McVYuIhh7g8zxEZAIJHI3WnPJuPNT1k1Jd1FUFBkAoQo
HtkuzaLjpKybYDf7VaSLQ95GqX4kJP4qLE1tBPZX8jlgWj7s29mcKebHiYGfFHMzrkbR
CBOlUHKBfa97NswnEvk0bU8deIFG/UhFW/HoH5rLjhhHjXgahlIrTXJcQSaiWw8I7QW8
pgnQ==
X-Forwarded-Encrypted: i=1; AJvYcCUN9xzj+FH2e8zaUjpNHxBneHuM1vFrH+Cp+I56ql3SkvtWAw/iJdzGV9n3Pwr9PY3Id7VOnupC@xxxxxxxxxxxxxxx, AJvYcCUUEfB3ygTJgVghtlnAj4X/gsvd/C0OExK3sjUBv8ZmEi3q51eOb1QWsR0ti7PlZYE38RXq6buleQ==@vger.kernel.org, AJvYcCW/mXwgQ6LuKo/vSHmqL9spSGgmpZaMfRtdPB6xf2prAQCo4ep1rwIyNkVCQ5mKQzQFzgyeZOwy35IoyzT9@xxxxxxxxxxxxxxx, AJvYcCWsv/wv0FrrkAb8nxsSVsnhG2Nda81lmrLm87i/fcoYVIjDrPbpVEaaIrhGmoCuUUymMlqZd03aU+BrokJb@xxxxxxxxxxxxxxx, AJvYcCXv+yrv1OIxAPS1QR9VE9MTYS+66R6BWCFJ2s5VCPvEPU+TE4UWssi6C55yQmCEzM1klqAMWwnvrdMN@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yw6ZQOtTUPCJb0eluKM2KkF2Xsfy26Z3n4zDPVMEFTmZRKnM/tj
oUgfKxMpUmtJaBo8/hrvoFGyNbeB4s0jtxUOoNrp4E0slkft2TmzXdzN0+9nUkChvv9ZgVwR64o
oiDj4/ywRcqzqTkx8CQj/aMvVoGO6R3g=
X-Gm-Gg: ASbGncvdRig4xkAKwFrqVa3KIcK/UqRMUQsm/mH3tm3i2JRHe/yGL/AKV63Lb1OkvQ0
apsIfOuqbDG6p+9e9E23cK7rpwmTRBdWOoXslvctKAqAmPZsUjVI4rofQHnR/E1gnlnBfXm37RX
+6HwO92GeruTBr1JMHq3nw2gDKGFhfsZVG98IIeHiPVLg=
X-Google-Smtp-Source: AGHT+IGHvaPfG0+HpV+ht/ZksV0or0KV3mn59t6Z00XO5UHbDk9SfQ3Vtr3w5WebYdPMjG8RFTO1SGBROVNg+vl67bY=
X-Received: by 2002:a17:902:da48:b0:233:d3e7:6fd6 with SMTP id
d9443c01a7336-23603a467eamr42749185ad.19.1749220094008; Fri, 06 Jun 2025
07:28:14 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250428195022.24587-2-stephen.smalley.work@xxxxxxxxx> <49730b18-605f-4194-8f93-86f832f4b8f8@xxxxxxxxx>
In-Reply-To: <49730b18-605f-4194-8f93-86f832f4b8f8@xxxxxxxxx>
From: Stephen Smalley <stephen.smalley.work@xxxxxxxxx>
Date: Fri, 6 Jun 2025 10:28:02 -0400
X-Gm-Features: AX0GCFt8v2wBKzn1NQGbVueq_d16kQDnTqZtsxchgiVnzbBvdY-HnKnaHyqWKgg
Message-ID: <CAEjxPJ5KoTBB18_7+fWL+GWY4N5Vp2=Kn=9FJR2GewFRcMgzPQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v2] security,fs,nfs,net: update security_inode_listsecurity()
interface
To: Konstantin Andreev <andreev@xxxxxxxxx>
Cc: linux-security-module@xxxxxxxxxxxxxxx, linux-nfs@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx, selinux@xxxxxxxxxxxxxxx,
Christian Brauner <brauner@xxxxxxxxxx>, Casey Schaufler <casey@xxxxxxxxxxxxxxxx>,
Paul Moore <paul@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 9:38=E2=80=AFAM Konstantin Andreev <andreev@swemel.r=
u> wrote:
>
> Stephen Smalley, 28/04/2025:
> > Update the security_inode_listsecurity() interface to allow
> > use of the xattr_list_one() helper and update the hook
> > implementations.
> >
> > Link: https://lore.kernel.org/selinux/20250424152822.2719-1-stephen.sma=
lley.work@xxxxxxxxx/
>
> Sorry for being late to the party.
>
> Your approach assumes that every fs-specific xattr lister
> called like
>
> | vfs_listxattr() {
> | if (inode->i_op->listxattr)
> | error =3D inode->i_op->listxattr(dentry, list, size)
> | ...
>
> must call LSM to integrate LSM's xattr(s) into fs-specific list.
> You did this for tmpfs:
>
> | simple_xattr_list() {
> | security_inode_listsecurity()
> | // iterate real xatts list
>
>
> Well, but what about other filesystems in the linux kernel?
> Should all of them also modify their xattr listers?
>
> To me, taking care of security xattrs is improper responsibility
> for filesystem code.
>
> May it be better to merge LSM xattrs
> and fs-backed xattrs at the vfs level (vfs_listxattr)?

This patch and the preceding one on which it depends were specifically
to address a regression in the handling of listxattr() for tmpfs/shmem
and similar filesystems.
Originally they had no xattr handler at the filesystem level and
vfs_listxattr() already has a fallback to ensure inclusion of the
security.* xattr for that case.
For filesystems like ext4 that have always (relative to first
introduction of security.* xattrs) provided handlers, they already
return the fs-backed xattr value and we don't need to ask the LSM for
it.
That said, you may be correct that it would be better to introduce
some additional handling in vfs_listxattr() but I would recommend
doing that as a follow-up.


Return-Path: <linux-kernel+bounces-675868-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5606941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:28:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 380C817A13C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:28:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FBA417BB35;
Fri, 6 Jun 2025 14:28:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="bECm3ooN"
Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B9DD12FF6F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:28:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.44
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220096; cv=none; b=Bb7tUZMcnpHQy5Uw67gPs+Bh2B0UQ6oBOWBX2cLnAmBRAA9LOLsnAIut7Ui/2Sy7mifeKC+KN74sSRGlZPrxCTwSsnLqcxit6mRcMtwwiD0WvP8w/IbeiPQR1k+EifL3nYuf7LeK7AP8/DrjFvF+4X6MyA6Q9WZO3J8/bgW0NmM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220096; c=relaxed/simple;
bh=yGw2KCsyMGQhD+cV7Xq0jX7AcZgSEZyRWrXunzclL1s=;
h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References:
In-Reply-To:Content-Type; b=HVUNRuFEkDFVkj6ktetDlcqWY8jhW4/1kM9yEkiIJYaUBhrEjy1ZdQXWecp1e5pmkmhZxkYlqHOOuDVKxyuoAkKp86gnPKjGwoZGm+wwWBHAJw0612bS3pLac+Hnaz/f4VVAVnkxycpUkgwC6XFGmwx51kdizfOIvK6jOrqqTo0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=bECm3ooN; arc=none smtp.client-ip=209.85.166.44
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk
Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-86d0c5981b3so68631039f.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:28:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1749220092; x=1749824892; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:content-language:references
:cc:to:from:subject:user-agent:mime-version:date:message-id:from:to
:cc:subject:date:message-id:reply-to;
bh=3O04NlGxiolO1CmbKy++35ARtom08d+p1GVLWa2NnfA=;
b=bECm3ooNqOr7ZBwPRk6qssZuPTq/SvT0mGTHY+CBUFRlVV/URBM25Vj9onOyrZrb+J
QYqenh/1eLUU/W0kUWtA51gkAlXsFMAoLQHz3rPKi27xp21OwpVr/J5IjVJU2sdG4G1z
blOw+eSjlymw2z6OjEQxCRUWNLmwst9+4wFxFIjr2bK8ZGezbr9So8eCSpEek0ql0MfF
o8uxFN5dh/t0jMwI2TWkjLDLHbezOWfr9nOzVEcgS3fhgsl6gvey9xB65c+bwBGA1iOq
vePUbVswkdHirTXLIYnjNH+bFtUDFiYUOZv1RyWjn3nXWiD95JmybEYWBY6H9jL2aygO
Mwpg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749220092; x=1749824892;
h=content-transfer-encoding:in-reply-to:content-language:references
:cc:to:from:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=3O04NlGxiolO1CmbKy++35ARtom08d+p1GVLWa2NnfA=;
b=M/OfvQlNzuYj6hjoFwpV/NrUyL7uF6W/uC/kQzr03fi5UiPiS7uDektjS5GJPH/aVK
xDbtrdv1rBieh/JS87iiNa9v/hjbUaJDX4SRQti5RjqaYJGcXKKzKfWfquwut+0bqOjd
gNY1YpwONhCQA5hrd3uJ2N1pjr8REH/rMHFGs1l3Yb+i5GS26q+oP8PxBNKHdGzs8RRB
XP0R0T7k2QZRQnPTvurz/ZDNnrYkxMZloeob7ItBCzonIplD68G5ScYGDYwjOKeo7W8n
jrm8RBfYkA/t5VEsGOMtCorZHMk5Ggh8BM56AMvOTOXtH7y+1h0fWiTYaiG73r8E8EeP
Z0ZA==
X-Forwarded-Encrypted: i=1; AJvYcCVdM2jQlJnosWK9p1djPCJ+HQxHsUhe8kHYhAf2KYcwWWbxr6XyS8JELxAP6CuEiyfkqpbTbwlXVs8EUhA=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzui6rLi2pyuCUYTc9e7J+5ETRSYVOb7FLc8laMUKeASjG0jZ9K
JwWz5ECf3zAMcaefeDC86JNsq5IksJ/EFXAxAoLJYp41WvbfG4gkvSqlDNtgJi4M82o=
X-Gm-Gg: ASbGncvK6Eh/gFsVuH5v4kLTmx/fsRH+Xw238upkbIXJmxqEF6IkeZSMru00I6IH91Q
Q3vtXVPGckCs7UrNn1BGd6Sv1/VFBCOA8C/4yzT9eZWrESzxLDjotVns8dhcpnpT0vFSfPrjn9d
3vnsjGS6Y3sTewZ54tAjcc1M6EV+LfSA6KYveDF07C3UT+D72CHbHIkhC9eXTQp1RPkm1hDOuVm
VUrizjWL42QySHtAI/wiNBe+Y7HNZWRirp/O5xf1DzJDVallrduqfPw4uLJKnT0HafZgDYn0+Wv
8mbX6/ZLFQgzPh7hluAQdGdDmwk3W0BNhp64PSNRnVJeEyYhv4CATTGjUA==
X-Google-Smtp-Source: AGHT+IEDaUVHOPyyhzFPamWfZwsvgI1rLw4PRNRY6eDRtYy1d7W/lfguqrkX0/AWabqTCYiFnyX3HA==
X-Received: by 2002:a05:6e02:16c8:b0:3dd:b726:cc52 with SMTP id e9e14a558f8ab-3ddce3cd206mr20550835ab.5.1749220092612;
Fri, 06 Jun 2025 07:28:12 -0700 (PDT)
Received: from [192.168.1.116] ([96.43.243.2])
by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3ddcf1582dfsm4388395ab.23.2025.06.06.07.28.11
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 07:28:12 -0700 (PDT)
Message-ID: <f6ae27ea-03b7-4fe9-bb6e-15b988f2a6b8@xxxxxxxxx>
Date: Fri, 6 Jun 2025 08:28:11 -0600
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [RFC v2 2/5] io_uring/bpf: add stubs for bpf struct_ops
From: Jens Axboe <axboe@xxxxxxxxx>
To: Pavel Begunkov <asml.silence@xxxxxxxxx>, io-uring@xxxxxxxxxxxxxxx
Cc: Martin KaFai Lau <martin.lau@xxxxxxxxx>, bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
<e2cd83fa47ed6e7e6c4e9207e66204e97371a37c.1749214572.git.asml.silence@xxxxxxxxx>
<783d14e8-0627-492d-b06f-f0adee2064d6@xxxxxxxxx>
Content-Language: en-US
In-Reply-To: <783d14e8-0627-492d-b06f-f0adee2064d6@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 8:25 AM, Jens Axboe wrote:
> On 6/6/25 7:57 AM, Pavel Begunkov wrote:
>> diff --git a/io_uring/bpf.h b/io_uring/bpf.h
>> new file mode 100644
>> index 000000000000..a61c489d306b
>> --- /dev/null
>> +++ b/io_uring/bpf.h
>> @@ -0,0 +1,26 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +#ifndef IOU_BPF_H
>> +#define IOU_BPF_H
>> +
>> +#include <linux/io_uring_types.h>
>> +#include <linux/bpf.h>
>> +
>> +#include "io_uring.h"
>> +
>> +struct io_uring_ops {
>> +};
>> +
>> +static inline bool io_bpf_attached(struct io_ring_ctx *ctx)
>> +{
>> + return IS_ENABLED(CONFIG_BPF) && ctx->bpf_ops != NULL;
>> +}
>> +
>> +#ifdef CONFIG_BPF
>> +void io_unregister_bpf_ops(struct io_ring_ctx *ctx);
>> +#else
>> +static inline void io_unregister_bpf_ops(struct io_ring_ctx *ctx)
>> +{
>> +}
>> +#endif
>
> Should be
>
> #ifdef IO_URING_BPF
>
> here.

CONFIG_IO_URING_BPF of course...

--
Jens Axboe



Return-Path: <linux-kernel+bounces-675869-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D050841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:29:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id D48973B1B4F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:28:35 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A52113D52F;
Fri, 6 Jun 2025 14:28:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gfDu4XLW"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 6DB851339A4
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:28:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220108; cv=none; b=HLPr8SwL9r4SQaXtgT4k1D6MvSJI5GUG/62C/f0tjFsPXzShPHwm3ywkIoKjAj18Vw+KyJ5LkJG2IoVlsCd/OSdmp6pp7/DsTyEnKWTspLqXsK+3WZOAOqo/iVjA6BudTOPY4x4pI5Jzdiwu7XCGMM4P665AZtpy7G8PYPFS2Ko=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220108; c=relaxed/simple;
bh=Li7ibbFp6IAWaPGC1mntaG/QZQpQuadYqbXM0mDxQQw=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=oh0DHUG6Z/+QkRTGVFwiVrhLK/kE3uAE3LHSGaiwwVW5twS35d04+kwcDYRtNxsTINlB98mQ90VRIUSzVcvxv0gUO6KGEKMITJIv1MM1DSs7aEURVv/PVmo2xoDCKOs1+p4otLQLWnWx5KQgz1WftvpNiFHAabbtjmJfKizEjn0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gfDu4XLW; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749220105;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=ALf2A6SSvV1hHGniFOaJAJDOmsxkAraK1tIfpQpNucs=;
b=gfDu4XLWLl0z4fMm/klMntI9JPTn/7LBJC6sswgmbonYWTCZytR6apJoYXnIUgpo7s+60r
VQTWJVapvsc5ZxoKROOi3mX25UJIt8WB3rkfa+LwmcaFy7QMgvuSsXBUYQ5/f4P4g7imT6
0HInieiFxiv4jZTOQNU3VSkeJFGNgKk=
Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com
[209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-86-d35b6AMVObyaxqtBs5WkEQ-1; Fri, 06 Jun 2025 10:28:24 -0400
X-MC-Unique: d35b6AMVObyaxqtBs5WkEQ-1
X-Mimecast-MFC-AGG-ID: d35b6AMVObyaxqtBs5WkEQ_1749220103
Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-47ae87b5182so36990871cf.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:28:24 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749220103; x=1749824903;
h=user-agent:in-reply-to:content-disposition:mime-version:references
:message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ALf2A6SSvV1hHGniFOaJAJDOmsxkAraK1tIfpQpNucs=;
b=vF3HnuB4pN+BgY8jIFj2ciuxQji1s4Gr45t8gocdgF5jmZPBwgD9p00h5Z1BkA4v23
mU44P7CHYtUv1j6Nz6mvT5rmfIKIVvpK72Cek4A52i7iboC5/Ni8r4KhIQKdHwzovUjP
JV9ZOL2RZRAoVHZoFLSkhr71sQ4U6gOP53OkOVHAN/FdN3nZCqvL7LMgvM8TdXSZjdO5
/mEGmT/TGRogG6VmKNwmxX9KwAgH953pV/oLbyG0Wl0K1DkHV2XtIREEVqS9YWiDMVmq
kt+vvN+/O974YFYrdMBkNriCZqlAtkxmsuOK1g8q+NIxDs+22PPrxBGFzxk1ERe34EIv
NjBQ==
X-Forwarded-Encrypted: i=1; AJvYcCUC9BOnyqqT2X6EdgoL7B3rT9xdwRlAEXWgZkVOaKBEddprMWc5qQcVUbhp71pjA7q/RoxIEuOAxvzgBCw=@vger.kernel.org
X-Gm-Message-State: AOJu0Ywz4uGKsNU3jSctcz7IUy9EETS2LjaTCdMfu4TsxyM3nBwtFRjS
VI88kA006Oe1UA6A9wjxsssmrzK47O1C99waTLGdzDHKZQ3tx14I/gPPbdeiDyo627Vh114YyTk
MlzWypAKKDRPYgZplKhlOoAnDp2SnoLYmBJyPMdjteGrZITuqsvRf2MA5ieza5Vo4Bu8QclRCCg
jx
X-Gm-Gg: ASbGncsegzR0gQPPltRlmeR6cTllYSUE/ag5nv7n+iIEP+on97bTI/0lOD616obd0Qw
Mr+XFLfbbKueXr2aedIwHoKPcOF17LDwRpcFhkFxwaoC01P6jf2yh0sbC3X3ltuBb+p0fhcKg/t
+7d9L2SW2m4ynKEtIE4tZrqgH1SIymTS5sXi2MFbtanfDTQ0YfQ8wmXv7TNhoqLf764yKgOd2Y5
Ajo84jpyNeZ5bC+hgVRLgYk61pjjDPevwtmak38sMAJRgP8o67hGNN9wvPzQy8Aqjgx/bzuorpd
Pa1+x/HDJNCL6KPYdEiTl+t0GdEk+CmHnkLWSLqB4GV2Ew==
X-Received: by 2002:a05:622a:5c95:b0:476:8f75:b885 with SMTP id d75a77b69052e-4a5b9ece0f5mr63062251cf.44.1749220103132;
Fri, 06 Jun 2025 07:28:23 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IGpf4O45y7/LqbcN4g1foJ8Kzb9sFSBSPTzamnMml1OhKOozVnoN1sS1mY/qb2zqIL8mkLT4Q==
X-Received: by 2002:a05:622a:5c95:b0:476:8f75:b885 with SMTP id d75a77b69052e-4a5b9ece0f5mr63061841cf.44.1749220102756;
Fri, 06 Jun 2025 07:28:22 -0700 (PDT)
Received: from x1 (c-73-183-52-120.hsd1.pa.comcast.net. [73.183.52.120])
by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a619852fddsm13548021cf.40.2025.06.06.07.28.21
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:28:21 -0700 (PDT)
Date: Fri, 6 Jun 2025 10:28:19 -0400
From: Brian Masney <bmasney@xxxxxxxxxx>
To: Maxime Ripard <mripard@xxxxxxxxxx>
Cc: Stephen Boyd <sboyd@xxxxxxxxxx>, linux-clk@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>,
Thomas Gleixner <tglx@xxxxxxxxxxxxx>,
Michael Turquette <mturquette@xxxxxxxxxxxx>,
Alberto Ruiz <aruiz@xxxxxxxxxx>
Subject: Re: [PATCH v2 03/10] clk: test: introduce a few specific rate
constants for mock testing
Message-ID: <aEL7A_YeC8b4Wj48@x1>
References: <20250528-clk-wip-v2-v2-0-0d2c2f220442@xxxxxxxxxx>
<20250528-clk-wip-v2-v2-3-0d2c2f220442@xxxxxxxxxx>
<20250606-fabulous-fortunate-chamois-ab4c98@houat>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606-fabulous-fortunate-chamois-ab4c98@houat>
User-Agent: Mutt/2.2.14 (2025-02-20)
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 10:56:57AM +0200, Maxime Ripard wrote:
> On Wed, May 28, 2025 at 07:16:49PM -0400, Brian Masney wrote:
> > Some of the mock tests care about the relationship between two
> > different rates, and the specific numbers are important, such as for
> > mocking a divider.
> >
> > Signed-off-by: Brian Masney <bmasney@xxxxxxxxxx>
>
> It's not obvious to me why they are important, actually. The relation
> between the two is, but a divider (and our tests) should work with any
> parent rate, so I guess we can expect it to be opaque.

I agree as well.

> Can you expand on why it's important?

I personally find that having specific numbers in some (but not) of the
tests make the tests clearer that specific functionality within the clk
core is exercised. For example, assume we have a parent that can do any
rate, and two children that are dividers. We could have a test like the
following:

clk_set_rate(ctx->child1_clk, DUMMY_CLOCK_RATE_1);
clk_set_rate(ctx->child2_clk, DUMMY_CLOCK_RATE_2);
KUNIT_EXPECT_EQ(test, clk_get_rate(ctx->child1_clk), DUMMY_CLOCK_RATE_1);
KUNIT_EXPECT_EQ(test, clk_get_rate(ctx->child2_clk), DUMMY_CLOCK_RATE_2);
/*
* Make something to figure out what the ideal parent rate should be
* and test that as well?
*/

So if we set child1 and child2 to 16 MHz and 32 MHz, then that exercises
one path through the clk core. However, it will currently fail if we set
the children to 32 MHz and 48 MHz. I have this working on a WIP branch
and one of my new tests looks similar to:

clk_set_rate(ctx->child1_clk, DUMMY_CLOCK_RATE_32_MHZ);
clk_set_rate(ctx->child2_clk, DUMMY_CLOCK_RATE_48_MHZ);
// This should test that it's a multiple of 96 MHz
KUNIT_EXPECT_EQ(test, clk_get_rate(ctx->parent_clk), DUMMY_CLOCK_RATE_96_MHZ);
KUNIT_EXPECT_EQ(test, clk_get_rate(ctx->child1_clk), DUMMY_CLOCK_RATE_32_MHZ);
KUNIT_EXPECT_EQ(test, clk_get_rate(ctx->child2_clk), DUMMY_CLOCK_RATE_48_MHZ);

Based on the work in my WIP branch, I think we need to make some of the
divider only clk tests parameterized, and have a table with various
specific frequencies so that various edge cases within the clk core are
tested by the frequency combinations.

I think that instead of having a list of DUMMY_CLOCK_RATE_XXX_MHZ
defines, a single define like this will suffice:

#define clk_dummy_rate_mhz(rate) ((rate) * 1000 * 1000)

Brian



Return-Path: <linux-kernel+bounces-675870-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 947B241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:29:27 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 44A0316D21B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:29:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A0BAF1A3029;
Fri, 6 Jun 2025 14:28:34 +0000 (UTC)
Received: from mail-il1-f208.google.com (mail-il1-f208.google.com [209.85.166.208])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 108741339A4
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:28:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.208
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220114; cv=none; b=ZAyZpWTBGxwtl9tpDzc8qoo0aob/LzFR97sgHUwWozV6LCGPf15lDA5Dg5q8OiHHTj3vwn/yEU2+03xIg0rrI1TzXSiwR9j4Cyuxpb4JRYTj4xOXf+ZhUUe0i+ScFXSDMVKT9kfsFn8qJh2FrxglttXDDDGWlCg/IqqOqxEXLTk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220114; c=relaxed/simple;
bh=biYcYaU5eBW9WP/dymTI+cSw8ql6koScbNr6aIjyULM=;
h=MIME-Version:Date:Message-ID:Subject:From:To:Content-Type; b=qKah19d2n/8kmD/LdOx7E1R5zsmhnQOUxVhQXN+0B+S3A6++XeMlr9NowEVm3n+X0fUvA5llqC84V4HZJ/SL4HCJIBuqaB9fVqI4Un2nWR6RXUhwYxpr2jHdCbbXM6xuH/Aftrc0iIDyPbzZavl+VUniJpgdnLj9wM1bboswS+I=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.208
Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com
Received: by mail-il1-f208.google.com with SMTP id e9e14a558f8ab-3ddc3f14171so29037295ab.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:28:31 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749220111; x=1749824911;
h=to:from:subject:message-id:date:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=p9O7Vw9hq24JSKUy5LWCCSKNu/YQohpnts9uAfWp4Yk=;
b=ETCjuqA0B1P/IvdDLv0RoNvkGeDucw6EIs0NAyH+YAuky/kNI23B6PV42z+sjbAl+a
8FnPurdVqywz5UM4nClIX3HrMRaPqfX2ACENNVVcKW30PplMFII9sHn8K10W0Dy2lVZ5
G+DTGuZL8LU+sfB1HXvwuEgPWSLQoxVoOiHLG5rRFmBlS/RHGmAb9KL47UG9w6nAm3mK
3krJa7kay/Ozy2WO+KnAys/scupr9VpUIeKsA0QK/crUe1Nrno05XR7fFw+DQfLFYYwk
QHnGSe2cEqciWxBE1hk4PCPjlxs7zSAaDRGfuzgOzHKWXZo7cOC7+XZWwonX8PzVoMuC
2RqQ==
X-Forwarded-Encrypted: i=1; AJvYcCWQvZOC0bh0UjRF7ir3oUf5ZFx+oIgtgxOpv4nKSjltFgU41pvDQEN2SSlkiu/WdTi0aqc77AS5R1tisv0=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzva1ComGtnYyHKv2O5a53WRTpCl7ncIDJ+zGSxWC59mc+wSUbn
mmB4BAViuGx1RyfXB9nDs/1hQZo3g5DrxR8cQmPU82o7U0rj1acqDx3mui41zr+7xh5C55Z+bBv
Iw6xIr6K/IqA0TXLbzuAtiPgRZ+pvdIc/yDBUONwwtG+6ea5Wev/S2bbW1M4=
X-Google-Smtp-Source: AGHT+IGl3VUXOeQZGwKedAVyHMmazJe0L0rP4hWudnpGDWFuFI6Fr2VW+cKwX5SSjX8EKM/SVw6ysE7DqQ76EX7zBnKXNp3k6WO9
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Received: by 2002:a05:6e02:380d:b0:3dc:868e:dae7 with SMTP id
e9e14a558f8ab-3ddce441589mr42066485ab.15.1749220111133; Fri, 06 Jun 2025
07:28:31 -0700 (PDT)
Date: Fri, 06 Jun 2025 07:28:31 -0700
X-Google-Appengine-App-Id: s~syzkaller
X-Google-Appengine-App-Id-Alias: syzkaller
Message-ID: <6842fb0f.a00a0220.29ac89.0042.GAE@xxxxxxxxxx>
Subject: [syzbot] [mm?] INFO: rcu detected stall in sys_unlinkat (3)
From: syzbot <syzbot+61ec37db8c428baeb677@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: akpm@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, pasha.tatashin@xxxxxxxxxx,
syzkaller-bugs@xxxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.0 required=5.0 tests=FROM_LOCAL_HEX,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello,

syzbot found the following issue on:

HEAD commit: 92a09c47464d Linux 6.15-rc5
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=143530f4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=91c351a0f6229e67
dashboard link: https://syzkaller.appspot.com/bug?extid=61ec37db8c428baeb677
compiler: Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1891731f8dec/disk-92a09c47.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d0de4fa2c8c2/vmlinux-92a09c47.xz
kernel image: https://storage.googleapis.com/syzbot-assets/53a4edfaecf1/bzImage-92a09c47.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+61ec37db8c428baeb677@xxxxxxxxxxxxxxxxxxxxxxxxx

sched: DL replenish lagged too much
rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
rcu: Tasks blocked on level-0 rcu_node (CPUs 0-1): P6265/1:b..l
rcu: (detected by 0, t=10503 jiffies, g=19425, q=859 ncpus=2)
task:syz-executor state:R running task stack:22008 pid:6265 tgid:6265 ppid:6251 task_flags:0x400140 flags:0x00004002
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5382 [inline]
__schedule+0x16e2/0x4cd0 kernel/sched/core.c:6767
preempt_schedule_irq+0xb5/0x150 kernel/sched/core.c:7090
irqentry_exit+0x6f/0x90 kernel/entry/common.c:354
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:arch_atomic_read arch/x86/include/asm/atomic.h:23 [inline]
RIP: 0010:raw_atomic_read include/linux/atomic/atomic-arch-fallback.h:457 [inline]
RIP: 0010:atomic_read include/linux/atomic/atomic-instrumented.h:33 [inline]
RIP: 0010:__page_table_check_zero+0x1f9/0x510 mm/page_table_check.c:142
Code: 89 ee e8 fa 26 93 ff 4c 39 ed 0f 84 6c 01 00 00 4c 8b 3d 5a 2c db 0b 4d 01 e7 4c 89 ff be 04 00 00 00 e8 7a 1b f5 ff 4c 89 f8 <48> c1 e8 03 48 b9 00 00 00 00 00 fc ff df 0f b6 04 08 84 c0 0f 85
RSP: 0018:ffffc9000b5ef790 EFLAGS: 00000256
RAX: ffff88801d1b29b8 RBX: 0000000000000000 RCX: ffffffff822cabd6
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff88801d1b29b8
RBP: 0000000000000008 R08: ffff88801d1b29bb R09: 1ffff11003a36537
R10: dffffc0000000000 R11: ffffed1003a36538 R12: ffff88801d1b2970
R13: 0000000000000003 R14: 000000000005d6e9 R15: ffff88801d1b29b8
page_table_check_free include/linux/page_table_check.h:41 [inline]
free_pages_prepare mm/page_alloc.c:1263 [inline]
__free_frozen_pages+0xb22/0xcd0 mm/page_alloc.c:2725
__slab_free+0x326/0x400 mm/slub.c:4553
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x9a/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
__kasan_kmalloc+0x22/0xb0 mm/kasan/common.c:385
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4327 [inline]
__kmalloc_noprof+0x27a/0x4f0 mm/slub.c:4339
kmalloc_noprof include/linux/slab.h:909 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
tomoyo_encode+0x28b/0x550 security/tomoyo/realpath.c:80
tomoyo_realpath_from_path+0x58d/0x5d0 security/tomoyo/realpath.c:283
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x213/0x4b0 security/tomoyo/file.c:822
tomoyo_path_rmdir+0xa2/0xe0 security/tomoyo/tomoyo.c:195
security_path_rmdir+0x167/0x360 security/security.c:1949
do_rmdir+0x219/0x630 fs/namei.c:4506
__do_sys_unlinkat fs/namei.c:4683 [inline]
__se_sys_unlinkat fs/namei.c:4677 [inline]
__x64_sys_unlinkat+0xc2/0xf0 fs/namei.c:4677
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f36e318df47
RSP: 002b:00007ffdf6aecb78 EFLAGS: 00000207 ORIG_RAX: 0000000000000107
RAX: ffffffffffffffda RBX: 0000000000000065 RCX: 00007f36e318df47
RDX: 0000000000000200 RSI: 00007ffdf6aedd20 RDI: 00000000ffffff9c
RBP: 00007f36e321089d R08: 000055555c96962b R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000207 R12: 00007ffdf6aedd20
R13: 00007f36e321089d R14: 0000000000033668 R15: 00007ffdf6aeedf0
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup


Return-Path: <linux-kernel+bounces-675871-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BFF3741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:29:30 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 960661899D20
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:29:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F2851C84C7;
Fri, 6 Jun 2025 14:28:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Mgv5Fpav"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20])
(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 D069E1534EC;
Fri, 6 Jun 2025 14:28:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220114; cv=none; b=ZASnx9XHrUNfhUrDNSgHX0JX2OoR0vAWBUBsnOnlo7Ut8hrZFtLYYRBg+aOWjM3wHvbV7IRwRKTcO21aL1WJwTnRsuCwSs9tS8XJYR3Owqx07Tb3wlVVectX9ZLhoqXKhWU7QppEmU0mY1XSIXSQpdJuvLQArhJzGsjO3uYorFM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220114; c=relaxed/simple;
bh=53Ex4c46jHWyz2mMEelxLlc4ZhhiL9qpn6AzizAK0oM=;
h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:MIME-Version; b=ILcAMW59K8Oilvv0/YFYx1GLSZOIkGnV6WlkmUqW6FdoppJ6uc/tXTOb2mOcWRKCxrHTy7SOdyyZLnA4bkV1es4dpB3XuZmEKPifeU2nxWjDmnLP8z0IdsNg1/1Dw32vjRL3PX64ARpHY3L6Sm4dlj0vUYhEOxry622AGmZvrNI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Mgv5Fpav; arc=none smtp.client-ip=198.175.65.20
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749220113; x=1780756113;
h=message-id:subject:from:to:cc:date:in-reply-to:
references:content-transfer-encoding:mime-version;
bh=53Ex4c46jHWyz2mMEelxLlc4ZhhiL9qpn6AzizAK0oM=;
b=Mgv5FpavyX0R7X45pnbCUQcgDXy07cK2Fn5r0367De7G1Ib+eLiZCO9o
ZvVMMR/We7Fr8y9udDirtMW5zjAtEXlMBkqu0TXVDqKiuW4Ir7DaClAZO
Imc7j7NaoM4dcVEEV/jrd0EC5lG4T6XKiIDQt2DvxW1alau7GlHAYA6w6
IqXN8igzYZvQ+8I5d0f9wZ4ru4bafOv1qOcv8MYJNlC0TWXfy3vGF2vXd
47bUie/X6RrRB6hW9jgsmFFwVaB2vgqTWq/5ovEc4tITXcIn9hGHmjMtM
dzhIqIAh+ncyFloQVXb9eT/yrTEzab/SBwZY3IL+jYWRv6VvY3GGOmp0D
Q==;
X-CSE-ConnectionGUID: CzJg8o+IRsC8cuwlGAvSNw==
X-CSE-MsgGUID: 5aTyCbw8QnOqnKPbKupagw==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="51076071"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="51076071"
Received: from orviesa004.jf.intel.com ([10.64.159.144])
by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 07:28:28 -0700
X-CSE-ConnectionGUID: /NzKoUHWRDua3ANvn/f/1w==
X-CSE-MsgGUID: wwcVO4s3SNqWDhf7i+2Ymg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="150851783"
Received: from spandruv-desk1.amr.corp.intel.com ([10.124.222.159])
by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 07:28:28 -0700
Message-ID: <67fea61ec40d0e54d4674ab83728e84120d9fb9d.camel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH] platform/x86/intel: power-domains: Fix error code in
tpmi_init()
From: srinivas pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
To: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Cc: Hans de Goede <hdegoede@xxxxxxxxxx>, Ilpo =?ISO-8859-1?Q?J=E4rvinen?=
<ilpo.jarvinen@xxxxxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>,
Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>,
platform-driver-x86@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
kernel-janitors@xxxxxxxxxxxxxxx
Date: Fri, 06 Jun 2025 07:28:26 -0700
In-Reply-To: <aEKvIGCt6d8Gcx4S@stanley.mountain>
References: <aEKvIGCt6d8Gcx4S@stanley.mountain>
Autocrypt: addr=srinivas.pandruvada@xxxxxxxxxxxxxxx; prefer-encrypt=mutual;
keydata=mQGNBGYHNAsBDAC7tv5u9cIsSDvdgBBEDG0/a/nTaC1GXOx5MFNEDL0LWia2p8Asl7igx
YrB68fyfPNLSIgtCmps0EbRUkPtoN5/HTbAEZeJUTL8Xdoe6sTywf8/6/DMheEUzprE4Qyjt0HheW
y1JGvdOA0f1lkxCnPXeiiDY4FUqQHr3U6X4FPqfrfGlrMmGvntpKzOTutlQl8eSAprtgZ+zm0Jiwq
NSiSBOt2SlbkGu9bBYx7mTsrGv+x7x4Ca6/BO9o5dIvwJOcfK/cXC/yxEkr1ajbIUYZFEzQyZQXrT
GUGn8j3/cXQgVvMYxrh3pGCq9Q0Q6PAwQYhm97ipXa86GcTpP5B2ip9xclPtDW99sihiL8euTWRfS
TUsEI+1YzCyz5DU32w3WiXr3ITicaMV090tMg9phIZsjfFbnR8hY03n0kRNWWFXi/ch2MsZCCqXIB
oY/SruNH9Y6mnFKW8HSH762C7On8GXBYJzH6giLGeSsbvis2ZmV/r+LmswwZ6ACcOKLlvvIukAEQE
AAbQ5U3Jpbml2YXMgUGFuZHJ1dmFkYSA8c3Jpbml2YXMucGFuZHJ1dmFkYUBsaW51eC5pbnRlbC5j
b20+iQHRBBMBCAA7FiEEdki2SeUi0wlk2xcjOqtdDMJyisMFAmYHNAsCGwMFCwkIBwICIgIGFQoJC
AsCBBYCAwECHgcCF4AACgkQOqtdDMJyisMobAv+LLYUSKNuWhRN3wS7WocRPCi3tWeBml+qivCwyv
oZbmE2LcxYFnkcj6YNoS4N1CHJCr7vwefWTzoKTTDYqz3Ma0D0SbR1p/dH0nDgN34y41HpIHf0tx0
UxGMgOWJAInq3A7/mNkoLQQ3D5siG39X3bh9Ecg0LhMpYwP/AYsd8X1ypCWgo8SE0J/6XX/HXop2a
ivimve15VklMhyuu2dNWDIyF2cWz6urHV4jmxT/wUGBdq5j87vrJhLXeosueRjGJb8/xzl34iYv08
wOB0fP+Ox5m0t9N5yZCbcaQug3hSlgp9hittYRgIK4GwZtNO11bOzeCEMk+xFYUoa5V8JWK9/vxrx
NZEn58vMJ/nxoJzkb++iV7KBtsqErbs5iDwFln/TRJAQDYrtHJKLLFB9BGUDuaBOmFummR70Rbo55
J9fvUHc2O70qteKOt5A0zv7G8uUdIaaUHrT+VOS7o+MrbPQcSk+bl81L2R7TfWViCmKQ60sD3M90Y
oOfCQxricddC
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.56.2 (3.56.2-1.fc42)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 2025-06-06 at 12:04 +0300, Dan Carpenter wrote:
> Return -ENOMEM instead of success if kcalloc() fails.
>=20
> Fixes: e37be5d85c60 ("platform/x86/intel: power-domains: Add
> interface to get Linux die ID")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Acked-by:Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>


> ---
> =C2=A0drivers/platform/x86/intel/tpmi_power_domains.c | 4 +++-
> =C2=A01 file changed, 3 insertions(+), 1 deletion(-)
>=20
> diff --git a/drivers/platform/x86/intel/tpmi_power_domains.c
> b/drivers/platform/x86/intel/tpmi_power_domains.c
> index 0c5c88eb7baf..9d8247bb9cfa 100644
> --- a/drivers/platform/x86/intel/tpmi_power_domains.c
> +++ b/drivers/platform/x86/intel/tpmi_power_domains.c
> @@ -228,8 +228,10 @@ static int __init tpmi_init(void)
> =C2=A0
> =C2=A0 domain_die_map =3D kcalloc(size_mul(topology_max_packages(),
> MAX_POWER_DOMAINS),
> =C2=A0 sizeof(*domain_die_map),
> GFP_KERNEL);
> - if (!domain_die_map)
> + if (!domain_die_map) {
> + ret =3D -ENOMEM;
> =C2=A0 goto free_domain_mask;
> + }
> =C2=A0
> =C2=A0 ret =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
> =C2=A0 "platform/x86/tpmi_power_domains:onl
> ine",


Return-Path: <linux-kernel+bounces-675872-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A358741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:32:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 094FA3B25E4
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:32:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D79AE155C88;
Fri, 6 Jun 2025 14:32:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nQN7Auo1"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15])
(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 F15E5748D;
Fri, 6 Jun 2025 14:32:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220338; cv=none; b=aQZ4aGhFxbvwMpandq/hpanH6okgNYhWNrKByi3RzDOHjY118VrqvYPTeEqv0LMIuokz+BG/Fs0W/c/W0lnYVy3JpC6T6yHy82iepCQ4kccva1gBh+6wzFgKZLJNVZ+HStxhcu3ogwnj+yp26e2RnINF/AJ7ZxJmz/ewwbbzJuM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220338; c=relaxed/simple;
bh=ujjYR9xxL8J9CFgOa4pOfa+CtQkNCvUXPnxd8JcMeME=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=gBlLRYskvp0hYHmIZdhQ7PO33JpqCTdDRWO4KqdOFCpqRuP62PjxIxnaclDGNwOEo8GxwBsjzcxTtpvUTFTVhaHCEm0kz6Pt0QLdV3AGYakjDbgD3I5kfNHW1uGWDiFehQd5JkvwhNM9HeZuExVZOaRQyDMlgR2vBEqScPzCMYc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nQN7Auo1; arc=none smtp.client-ip=192.198.163.15
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749220336; x=1780756336;
h=message-id:date:mime-version:subject:to:cc:references:
from:in-reply-to:content-transfer-encoding;
bh=ujjYR9xxL8J9CFgOa4pOfa+CtQkNCvUXPnxd8JcMeME=;
b=nQN7Auo1LaBlyy9vh/PFHJIbgJjXRiVQdc3/P1aruaCH75XX1fd5FGZv
HfAXD+d2HxbLMyowNaaEqagEfQXbA/zl8Ad7d0jpsT7+Z3rSAW8NFQj9n
lMGOpd0v6qARTGoXY3pevOKNEhMJdwcCE6sYxyVve96OaZJUtA3zZ2ulh
K2t5nlG8xYG3pzAwbaYHYMrKTRxI0IpKtXwpCzfXYY1o6oEu8bhuQ1tw6
u5DpQ/k/MOpLT2SddtyExwA97Ce0zuPvK6dMUSiLal0lWfiSSlkkhbz6b
v08lu5kpM25Yi8mHpvcwmqHL2ZUIvZk849nwrwmwtDi3ISYUW1nOGfOoE
A==;
X-CSE-ConnectionGUID: V+svJ6ePQ9eP0JrwXlwcLg==
X-CSE-MsgGUID: P0pf0j7rTq2acOf4T4hzDw==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="51517369"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="51517369"
Received: from fmviesa010.fm.intel.com ([10.60.135.150])
by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 07:32:15 -0700
X-CSE-ConnectionGUID: E7jL8DF+TDeFb63jZHiGBQ==
X-CSE-MsgGUID: 0Fmd48NeRdSDKaLtm5QG9A==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="146350542"
Received: from spandruv-desk1.amr.corp.intel.com (HELO [10.125.111.33]) ([10.125.111.33])
by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 07:32:12 -0700
Message-ID: <d4d61f9a-e73d-4689-bef2-7b9c583e1b32@xxxxxxxxx>
Date: Fri, 6 Jun 2025 07:32:10 -0700
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v1 1/2] dmaengine: idxd: Fix race condition between WQ
enable and reset paths
To: Shuai Xue <xueshuai@xxxxxxxxxxxxxxxxx>,
Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxx>, fenghuay@xxxxxxxxxx,
vkoul@xxxxxxxxxx
Cc: dmaengine@xxxxxxxxxxxxxxx, colin.i.king@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250522063329.51156-1-xueshuai@xxxxxxxxxxxxxxxxx>
<20250522063329.51156-2-xueshuai@xxxxxxxxxxxxxxxxx>
<a03e4f97-2289-4af7-8bfc-ad2d38ec8677@xxxxxxxxx>
<b2153756-a57e-4054-bde2-deb8865c9e59@xxxxxxxxxxxxxxxxx>
<4cd53b91-bd20-46a1-854c-9bf0950ea496@xxxxxxxxx>
<87234fab-081e-4e2e-9ef1-0414b23601ce@xxxxxxxxxxxxxxxxx>
<874ix5bhkz.fsf@xxxxxxxxx> <226ecbd8-af44-49e8-9d4c-1f2294832897@xxxxxxxxx>
<22b3a299-b148-46ec-804e-2f6cbb3d5de1@xxxxxxxxxxxxxxxxx>
<343f6719-598a-453b-9903-21632bc6b623@xxxxxxxxx>
<97e52eb0-d531-4464-bbb7-1dffa5d8d74e@xxxxxxxxxxxxxxxxx>
Content-Language: en-US
From: Dave Jiang <dave.jiang@xxxxxxxxx>
In-Reply-To: <97e52eb0-d531-4464-bbb7-1dffa5d8d74e@xxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/5/25 12:40 AM, Shuai Xue wrote:
>
>
> å?¨ 2025/6/4 22:19, Dave Jiang å??é??:
>>
>>
>> On 6/4/25 1:55 AM, Shuai Xue wrote:
>>>
>>>
>>> å?¨ 2025/6/3 22:32, Dave Jiang å??é??:
>>>>
>>>>
>>>> On 5/27/25 7:21 PM, Vinicius Costa Gomes wrote:
>>>>> Shuai Xue <xueshuai@xxxxxxxxxxxxxxxxx> writes:
>>>>>
>>>>>> å?¨ 2025/5/23 22:54, Dave Jiang å??é??:
>>>>>>>
>>>>>>>
>>>>>>> On 5/22/25 10:20 PM, Shuai Xue wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> å?¨ 2025/5/22 22:55, Dave Jiang å??é??:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 5/21/25 11:33 PM, Shuai Xue wrote:
>>>>>>>>>> A device reset command disables all WQs in hardware. If issued while a WQ
>>>>>>>>>> is being enabled, it can cause a mismatch between the software and hardware
>>>>>>>>>> states.
>>>>>>>>>>
>>>>>>>>>> When a hardware error occurs, the IDXD driver calls idxd_device_reset() to
>>>>>>>>>> send a reset command and clear the state (wq->state) of all WQs. It then
>>>>>>>>>> uses wq_enable_map (a bitmask tracking enabled WQs) to re-enable them and
>>>>>>>>>> ensure consistency between the software and hardware states.
>>>>>>>>>>
>>>>>>>>>> However, a race condition exists between the WQ enable path and the
>>>>>>>>>> reset/recovery path. For example:
>>>>>>>>>>
>>>>>>>>>> A: WQ enable path                   B: Reset and recovery path
>>>>>>>>>> ------------------                 ------------------------
>>>>>>>>>> a1. issue IDXD_CMD_ENABLE_WQ
>>>>>>>>>>                                        b1. issue IDXD_CMD_RESET_DEVICE
>>>>>>>>>>                                        b2. clear wq->state
>>>>>>>>>>                                        b3. check wq_enable_map bit, not set
>>>>>>>>>> a2. set wq->state = IDXD_WQ_ENABLED
>>>>>>>>>> a3. set wq_enable_map
>>>>>>>>>>
>>>>>>>>>> In this case, b1 issues a reset command that disables all WQs in hardware.
>>>>>>>>>> Since b3 checks wq_enable_map before a2, it doesn't re-enable the WQ,
>>>>>>>>>> leading to an inconsistency between wq->state (software) and the actual
>>>>>>>>>> hardware state (IDXD_WQ_DISABLED).
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Would it lessen the complication to just have wq enable path grab the device lock before proceeding?
>>>>>>>>>
>>>>>>>>> DJ
>>>>>>>>
>>>>>>>> Yep, how about add a spin lock to enable wq and reset device path.
>>>>>>>>
>>>>>>>> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
>>>>>>>> index 38633ec5b60e..c0dc904b2a94 100644
>>>>>>>> --- a/drivers/dma/idxd/device.c
>>>>>>>> +++ b/drivers/dma/idxd/device.c
>>>>>>>> @@ -203,6 +203,29 @@ int idxd_wq_enable(struct idxd_wq *wq)
>>>>>>>>     }
>>>>>>>>     EXPORT_SYMBOL_GPL(idxd_wq_enable);
>>>>>>>>     +/*
>>>>>>>> + * This function enables a WQ in hareware and updates the driver maintained
>>>>>>>> + * wq->state to IDXD_WQ_ENABLED. It should be called with the dev_lock held
>>>>>>>> + * to prevent race conditions with IDXD_CMD_RESET_DEVICE, which could
>>>>>>>> + * otherwise disable the WQ without the driver's state being properly
>>>>>>>> + * updated.
>>>>>>>> + *
>>>>>>>> + * For IDXD_CMD_DISABLE_DEVICE, this function is safe because it is only
>>>>>>>> + * called after the WQ has been explicitly disabled, so no concurrency
>>>>>>>> + * issues arise.
>>>>>>>> + */
>>>>>>>> +int idxd_wq_enable_locked(struct idxd_wq *wq)
>>>>>>>> +{
>>>>>>>> +       struct idxd_device *idxd = wq->idxd;
>>>>>>>> +       int ret;
>>>>>>>> +
>>>>>>>> +       spin_lock(&idxd->dev_lock);
>>>>>>>
>>>>>>> Let's start using the new cleanup macro going forward:
>>>>>>> guard(spinlock)(&idxd->dev_lock);
>>>>>>>
>>>>>>> On a side note, there's been a cleanup on my mind WRT this driver's locking. I think we can replace idxd->dev_lock with idxd_confdev(idxd) device lock. You can end up just do:
>>>>>>> guard(device)(idxd_confdev(idxd));
>>>>>>
>>>>>> Then we need to replace the lock from spinlock to mutex lock?
>>>>>
>>>>> We still need a (spin) lock that we could hold in interrupt contexts.
>>>>>
>>>>>>
>>>>>>>
>>>>>>> And also drop the wq->wq_lock and replace with wq_confdev(wq) device lock:
>>>>>>> guard(device)(wq_confdev(wq));
>>>>>>>
>>>>>>> If you are up for it that is.
>>>>>>
>>>>>> We creates a hierarchy: pdev -> idxd device -> wq device.
>>>>>> idxd_confdev(idxd) is the parent of wq_confdev(wq) because:
>>>>>>
>>>>>>        (wq_confdev(wq))->parent = idxd_confdev(idxd);
>>>>>>
>>>>>> Is it safe to grap lock of idxd_confdev(idxd) under hold
>>>>>> lock of wq_confdev(wq)?
>>>>>>
>>>>>> We have mounts of code use spinlock of idxd->dev_lock under
>>>>>> hold of wq->wq_lock.
>>>>>>
>>>>>
>>>>> I agree with Dave that the locking could be simplified, but I don't
>>>>> think that we should hold this series because of that. That
>>>>> simplification can be done later.
>>>>
>>>> I agree. Just passing musing on the current code.
>>>
>>> Got it, do I need to send a separate patch for Patch 2?
>>
>> Not sure what you mean. Do you mean if you need to send patch 2 again?
>
> Yep, the locking issue is more complicate and can be done later.
> (I could split patch 2 from this patch set if you prefer a new patch.)

Yes split it out and send it ahead if it can go independently.

>
>>>
>>> Thanks.
>>> Shuai
>
>



Return-Path: <linux-kernel+bounces-675873-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 14DB241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:32:37 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 09FC37A43A6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:31:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E39A11B043C;
Fri, 6 Jun 2025 14:32:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L7w6SezV"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DEBE169AE6;
Fri, 6 Jun 2025 14:32:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220339; cv=none; b=OKDB+0d9FR4znxpQ6weN+MWUV6sWTZ0JZ4+YZr0USjaSz4uJ9VYJj6bPA/+wlqpMdzE+HQCW/sK4GnZ0ejIW3BRFXjOS+4Ar+X4evJRZD4n9i/fpjMXPkpOJVabNBmbXRNFuaDf9FkJ+7iCeS1Zg58iCw5/G7fEhyhys1F0kwLQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220339; c=relaxed/simple;
bh=53+O3kAq0V9RNCKe7MDZ+MqWM/ZClvBlJnN6yVQgluo=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=ljuq7RVF3djR7sanVzxb1qzkiPNKCPxZieXjUdFuYT3+iOul4HN4vWRrVv2ZfrTJObp9k/biCEABBHskV/fbJEToMhc/gGLc+7GOozIGrypmHR/d0qWfF+adrr2VLvwEwBEeNweUT32nQWyuYqx9Nho6I2G6LY5LdeND8m/3ZwA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L7w6SezV; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B7EDC4CEEB;
Fri, 6 Jun 2025 14:32:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749220338;
bh=53+O3kAq0V9RNCKe7MDZ+MqWM/ZClvBlJnN6yVQgluo=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=L7w6SezVyd3D37kvIZoqN439faWdAdZcZAj4XdtfLm1Mof0dwl9tql7xG5f1KmsN4
8nOi6dAxPzh6nxrpdMfhbi8sheIDTGowEhKuDpjbteqTBvVaxat/n6Z1Zeer1pb6cS
mYMiZs+MfY7ulA0Rr8o0828ALp6HjqkHs3SVykjToz5Cf47vOkpww8NA7hRBap3yAL
gI9EgasiluDoKp+nL/oiklk1Y2lPvkhpey2V01DvbAXMlCEcExzS3tdhW/zRX29cr8
J4S8YemiLtIkK1kWNrc2XwzmtrrRgMEvgXGDDcOv1VfOU0bDaGS4bQ7CrvTGZfpWNV
eXPcjK+jdD8/w==
Date: Fri, 6 Jun 2025 16:32:10 +0200
From: Danilo Krummrich <dakr@xxxxxxxxxx>
To: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Cc: Igor Korotin <igor.korotin@xxxxxxxxx>, Miguel Ojeda <ojeda@xxxxxxxxxx>,
Alex Gaynor <alex.gaynor@xxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>,
"Rafael J . Wysocki" <rafael@xxxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
rust-for-linux@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-acpi@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?iso-8859-1?Q?Bj=F6rn?= Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>,
Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Len Brown <lenb@xxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>,
Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>,
Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
Subject: Re: [PATCH v2 3/5] rust: driver: Add ACPI id table support to
Adapter trait
Message-ID: <aEL76mgHSZG5idW8@pollux>
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605162726.3659792-1-igor.korotin@xxxxxxxxx>
<aELyEqg0GrkC8oZY@pollux>
<CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 03:26:13PM +0100, Igor Korotin wrote:
> On Fri, Jun 6, 2025 at 2:50â?¯PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
> > However, I don't understand why we need this and the subsequent
> > is_acpi_device_node() and is_of_node() checks.
>
> The idea is to avoid unnecessary table lookups when both OF and ACPI
> match tables are present.

Ok, that's fair -- let's build it on top of the FwNode abstractions though.


Return-Path: <linux-kernel+bounces-675874-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8B93941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:32:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 44F1B189C3B0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:33:05 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FF5A17333F;
Fri, 6 Jun 2025 14:32:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="o0fVCAu7";
dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QbV78xv/"
Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55])
(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 CB7C4273F9;
Fri, 6 Jun 2025 14:32:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220354; cv=none; b=XITcVk0APsgNr2EY22pg3/K42fQFv7r2NAnTRACrCFE/+bQU651WDc9b11rGW/Z0tq8pNxyDrfVxzufUJftgcPF60jTF2XjP0w5NAKJmAv4nZGfhpILpAKezVw+jNkOWBEvnZlCaUKmeEjDU5fbtW13yW0a1ksbLcVd/Ndca5eU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220354; c=relaxed/simple;
bh=Ff2Rp9j4NBOeFLfF7FQWEUQ0tr2Bnpij9zj/xPBTNaY=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=QL1EUA66U84dPvTR/mCuXd9xeD+FM3J8llcmJohRXv7lEEoM/yUwBZYc0+M8YQLabK1zyUSb9gFuvAGIzY2l4Z+DZuunWPMcUestpqlfbKnd/AEdVsYER7/mmIbWTjkOLIXdJpqnm6spSnV6mL7idw/WBfxBnX4wZgYabp2E3Fc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=o0fVCAu7; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QbV78xv/; arc=none smtp.client-ip=193.142.43.55
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de
Date: Fri, 6 Jun 2025 16:32:22 +0200
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de;
s=2020; t=1749220345;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=zjFrt4G8uoAeo7Wa/PFQ8eoCWB5B9E9DVZkb9jkc44U=;
b=o0fVCAu7QHaCC7m+aB1357sY8hTqaVddVEsjvNxq2YCRN7IWa5hVgN3ajW4tPiQNRuYT+1
s7h5+i0YPfc0SicEvzeos7MWGePfmIYdNzGXkX0NKXQObSNXrVZ2bint6wj+V0+w0pi385
gs6dxYnWWte5O6sNYpapjsTiRLiPDbn+Y9MUyyV8zmtvnNhogEO5kd2aUNDiIXAy7JvG2y
rmR8Gw9HE5QNnki9r5jbSw24qnymr1LEqersbR6zOdIehouBlFzIFg7OxxIdT99OIqBCCw
TL+hYant5VfUAunO3s3S3vVkTgTJQB5DAxQFY8cqvOJvIum1pJg6EwSwBD+FQw==
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
s=2020e; t=1749220345;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=zjFrt4G8uoAeo7Wa/PFQ8eoCWB5B9E9DVZkb9jkc44U=;
b=QbV78xv/UgaUJYdxqb3ih1uUXimLlSIT3Q/ugAXxiSE4y7abG8hTr3te1RU6pK0DH4wRHo
BYh0Rgm5ZZBLiFBA==
From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= <thomas.weissschuh@xxxxxxxxxxxxx>
To: Yury Norov <yury.norov@xxxxxxxxx>
Cc: I Hsin Cheng <richard120310@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] uapi: bitops: use UAPI-safe variant of BITS_PER_LONG
again
Message-ID: <20250606162758-f8393c93-0510-4d95-a5f8-caaf065b227a@xxxxxxxxxxxxx>
References: <20250606-uapi-genmask-v1-1-e05cdc2e14c5@xxxxxxxxxxxxx>
<aEL5SIIMxmnrzbDA@yury>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <aEL5SIIMxmnrzbDA@yury>
X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 10:20:56AM -0400, Yury Norov wrote:
> On Fri, Jun 06, 2025 at 10:23:57AM +0200, Thomas Weißschuh wrote:
> > Commit 1e7933a575ed ("uapi: Revert "bitops: avoid integer overflow in GENMASK(_ULL)"")
> > did not take in account that the usage of BITS_PER_LONG in __GENMASK() was
> > changed to __BITS_PER_LONG for UAPI-safety in
> > commit 3c7a8e190bc5 ("uapi: introduce uapi-friendly macros for GENMASK").
> > BITS_PER_LONG can not be used in UAPI headers as it derives from the kernel
> > configuration and not from the current compiler invocation.
> > When building compat userspace code or a compat vDSO its value will be
> > incorrect.
> >
> > Switch back to __BITS_PER_LONG.
> >
> > Fixes: 1e7933a575ed ("uapi: Revert "bitops: avoid integer overflow in GENMASK(_ULL)"")
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
>
> Thanks Thomas. I applied it in bitmap-for-next. Is that issue critical
> enough for you to send a pull request in -rc2?

I have some patches that depend on it. These will probably end up in linux-next
soonish and would then break there.

So having it in -rc2 would be nice.


Thanks


Return-Path: <linux-kernel+bounces-675875-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BE0A941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:35:10 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 644A33B268F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:34:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 68510194098;
Fri, 6 Jun 2025 14:35:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ndufresne-ca.20230601.gappssmtp.com header.i=@ndufresne-ca.20230601.gappssmtp.com header.b="RAUlMvKR"
Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E6F712C544
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:34:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220502; cv=none; b=T/Yp35MazCCqWCeTtd4y5fcaCa8zFh6/oxCVYTBNVz+pAEksu2psLHkHbxZjP64C9LFmKGGG4DtdKi3UK4990YkIQBYlOYIIi2lHi6TjReEY+ywq6Jp1xnfgRbMKq3DlefnhOHx29DDrzGSNNttoYBnxvdQ3h/02LqM+rQBc50Q=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220502; c=relaxed/simple;
bh=5TzqgGw2unsj6ioQQYQZki+vg6DcImrQstvVYIHTX+A=;
h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:MIME-Version; b=DF5bXO6M3HNX4EWPA3VhR/Oiz10xJUIIUkECOsXhwAS4+nZoxYoim0adRUkQ3RYgRnxq4OC2cK5o+K8WX+3zOc11a7QFt91WmDvnUrA0yBMTnYoSfhfLHAz181RDM4w7jYU/iWltGwXSsJPvcGf9mv9tsyIvm5sTbWgoKCWBMnU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ndufresne.ca; spf=pass smtp.mailfrom=ndufresne.ca; dkim=pass (2048-bit key) header.d=ndufresne-ca.20230601.gappssmtp.com header.i=@ndufresne-ca.20230601.gappssmtp.com header.b=RAUlMvKR; arc=none smtp.client-ip=209.85.160.176
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ndufresne.ca
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ndufresne.ca
Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-4a440a72584so20465151cf.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:34:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1749220498; x=1749825298; darn=vger.kernel.org;
h=mime-version:user-agent:content-transfer-encoding:references
:in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject
:date:message-id:reply-to;
bh=5TzqgGw2unsj6ioQQYQZki+vg6DcImrQstvVYIHTX+A=;
b=RAUlMvKRvifSoc25YjOvnezCv//O/3EaaxdGpS8rlRuKcU1crsVNY0IwDwpUMsfI+o
8RDfgcy7vuhlnFu4SV2QnWpFhME2wk5bWci96GOxIW/AwCcgaYNgCG5mf5BN1Vi/NEKx
p+VDUAyFTKr8Se5NWNiUvjCpEN4E51V1VUAGVZ0mAqRqLFRejsI4i6yUjApLf0ISN8zE
XPCVgpsvfoicWfI7Cto2Bu/6ZtwIsjMYXY9lqvLaTKTJF82Nr7el3U6KWQoEgfyh1vWr
j7rrehargy/BhC2Zwhz4WssPFPIWAHm1snUMXrEswKnXzjQLnmVzkcgqSYC4ZflzFgHN
QNsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749220498; x=1749825298;
h=mime-version:user-agent:content-transfer-encoding:references
:in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=5TzqgGw2unsj6ioQQYQZki+vg6DcImrQstvVYIHTX+A=;
b=gxZJ+dk9drnousgjBuvztGGi1nlpusmDQea3/mcJEDHjoc9xCvGaENWcx9XGZSaGdL
zgD01kOL/FktEizt0HG4/+TMA4mUbdRfAbccL2YZjZozQdZT3+LUpTF6wxgjJ9rowtjQ
r1hoT/QCRdfxzluMqzXCQOw82qa9kYBWGhhol45ne9X5KFdSZ3XpYK32mZYXmVmV1vac
W9Oydr3RqsT6f16j64WcLz4E4XIUJrdwAl0PduFUsxtCMXynBl1MMlJJEPFFcgMgUsR6
g+c7s2A3mRKxN9DnC/UPMRVphU3zpSSBO2g5EZOI0nMCowc9ISdDd2y38k0WXx1KpR8E
quvQ==
X-Forwarded-Encrypted: i=1; AJvYcCWaKv98Vipf2xb0AGSoOzCoYLvaX1AGo/R2WKIKUTYj3izB2knNLFJSk117FC73VsHxeuV6aRMI66mXbBE=@vger.kernel.org
X-Gm-Message-State: AOJu0YwVlSKAcvDMuovNB5SW1f4UmEU3N1PZvaapNlz+3pX6Xk/40CyF
NNndOwy9JujsGQ5kNIZWcyyla1KLGAzO9VwHrdSgF4+HgO+EMfLtxquyefnLMstnGB4=
X-Gm-Gg: ASbGncu+ovhopj1T8i4QLkRpXnr2D7wgTeDLwLkkcwsP0RU7M8IqnqfaRDTWXG2vHcW
cD+qc2lOEHr/C0FlsAg/plMu+EzNNvqhG7BNa6AeEbeJ9nnSgMr9jcv6eUd25yqgPKvSbSXYZr+
AAdAg8Vwu0BsuRnKwdmTfutYspkRBT49Ng7VtNOhUvmXTxtf9R4svZGcdCgMJ8eOUyggBRgJ6Za
npS4ZIfU7lVOIadzpTYNoL64G/zqMb2wq76DfOVIq1c1r20ZDiZEXzBVYO5vsYEYo6ik8WXrS+R
V0APh+Y13d6oIZULVsQ6g6vRfxswPz208ElNVtWbGpky3B7QsMTAI0a/8rwKPhX0srF8pZ0=
X-Google-Smtp-Source: AGHT+IEOgrxub3BrHmv/C1Ah/alzkHlimgB0TSoZWRFydqb5PJ/1vYoxBWKS8hME2MmvSylGN5l2Hg==
X-Received: by 2002:a05:622a:229c:b0:476:875e:516d with SMTP id d75a77b69052e-4a5b9d92ac2mr52875131cf.36.1749220498421;
Fri, 06 Jun 2025 07:34:58 -0700 (PDT)
Received: from [192.168.42.160] (mtl.collabora.ca. [66.171.169.34])
by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a619852d27sm13584561cf.42.2025.06.06.07.34.57
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:34:57 -0700 (PDT)
Message-ID: <b6e7e7ac054f107f97d47288b85cf35b45f58590.camel@xxxxxxxxxxxx>
Subject: Re: [PATCH v5 09/12] media: mediatek: jpeg: refactor multi-core clk
suspend and resume setting
From: Nicolas Dufresne <nicolas@xxxxxxxxxxxx>
To: Kyrie Wu =?UTF-8?Q?=28=E5=90=B4=E6=99=97=29?= <Kyrie.Wu@xxxxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx"
<linux-kernel@xxxxxxxxxxxxxxx>, "linux-mediatek@xxxxxxxxxxxxxxxxxxx"
<linux-mediatek@xxxxxxxxxxxxxxxxxxx>, "linux-media@xxxxxxxxxxxxxxx"
<linux-media@xxxxxxxxxxxxxxx>, "devicetree@xxxxxxxxxxxxxxx"
<devicetree@xxxxxxxxxxxxxxx>, "mchehab@xxxxxxxxxx" <mchehab@xxxxxxxxxx>,
"conor+dt@xxxxxxxxxx"
<conor+dt@xxxxxxxxxx>, "robh@xxxxxxxxxx" <robh@xxxxxxxxxx>,
"hverkuil-cisco@xxxxxxxxx"
<hverkuil-cisco@xxxxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx"
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, "matthias.bgg@xxxxxxxxx"
<matthias.bgg@xxxxxxxxx>, "krzk+dt@xxxxxxxxxx" <krzk+dt@xxxxxxxxxx>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
Cc: "srv_heupstream@xxxxxxxxxxxx" <srv_heupstream@xxxxxxxxxxxx>
Date: Fri, 06 Jun 2025 10:34:56 -0400
In-Reply-To: <83746dff5c252591f054732dafcfdd1900cd613c.camel@xxxxxxxxxxxx>
References: <20250530074537.26338-1-kyrie.wu@xxxxxxxxxxxx>
<20250530074537.26338-10-kyrie.wu@xxxxxxxxxxxx>
<8ab1b3166cbb972dbd5984fa591b42dbf984fc3b.camel@xxxxxxxxxxxx>
<83746dff5c252591f054732dafcfdd1900cd613c.camel@xxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: base64
User-Agent: Evolution 3.56.2 (3.56.2-1.fc42)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

SGkgS3lyaWUsCgpMZSB2ZW5kcmVkaSAwNiBqdWluIDIwMjUgw6AgMDM6MjMgKzAwMDAsIEt5cmll
IFd1ICjlkLTmmZcpIGEgw6ljcml0wqA6Cj4gT24gRnJpLCAyMDI1LTA1LTMwIGF0IDEzOjQzIC0w
NDAwLCBOaWNvbGFzIER1ZnJlc25lIHdyb3RlOgo+ID4gRXh0ZXJuYWwgZW1haWwgOiBQbGVhc2Ug
ZG8gbm90IGNsaWNrIGxpbmtzIG9yIG9wZW4gYXR0YWNobWVudHMgdW50aWwKPiA+IHlvdSBoYXZl
IHZlcmlmaWVkIHRoZSBzZW5kZXIgb3IgdGhlIGNvbnRlbnQuCj4gPiAKPiA+IAo+ID4gSGksCj4g
PiAKPiA+IExlIHZlbmRyZWRpIDMwIG1haSAyMDI1IMOgIDE1OjQ1ICswODAwLCBLeXJpZSBXdSBh
IMOpY3JpdCA6Cj4gPiA+IHJlZmFjdG9yIGpwZWcgY2xrIHN1c3BlbmQgYW5kIHJlc3VtZSBzZXR0
aW5nIGZvciBtdWx0aS1jb3JlCj4gPiAKPiA+IFlvdSdsbCBoYXZlIHRvIHdyaXRlIGEgbG90IG1v
cmUgdG8gc3VwcG9ydCBzdWNoIGEgbGFyZ2UgYW5kIEkKPiA+IG11c3Qgc2F5IHNsaWdodGx5IGNv
bnZvbHV0ZWQgY2hhbmdlLiBXaHkgZG8geW91IG5lZWQgYSBzcGVjaWFsCj4gPiBjYXNlIGZvciAx
IGNvcmUgaW4gdGhlIGZpcnN0IHBsYWNlID8gV2hhdCBhYm91dCBtdWx0aS1jb3JlCj4gPiBkZXNp
Z24gdGhhdCBzdXBwb3J0IGZyb20gMSB0byBOIGNvcmVzIHdpdGhvdXQgdXNpbmcgZGlmZmVyZW50
Cj4gPiBjb2RlIHBhdGggPwo+ID4gCj4gPiBOaWNvbGFzCj4gCj4gRGVhciBOaWNvbGFzLAo+IAo+
IEZvciBzaW5nbGUgY29yZSwgdGhlIGNsb2NrIGluZm9ybWF0aW9uIGlzIHBhcnNlZCBhbmQgc3Rv
cmVkIGluIHRoZQo+IHN0cnVjdCBvZiBtdGtfanBlZ19kZXYsIGJ1dCBtdWx0aS1jb3JlJ3MgYXJl
IGluIHRoZSBzdHJ1Y3Qgb2YKPiBtdGtfanBlZ2RlY19jb21wX2RldiwgaXQgY2FuIG5vdCB1c2Ug
YSBzYW1lIHNvZnR3YXJlIGludGVyZmFjZS4KPiAKPiBGb3IgYSBmdXJ0aGVyIHRoaW5raW5nLCBp
dCBpcyBhbHNvIGEgZml4ZXMgcGF0Y2ggcmF0aGVyIHRoYW4KPiByZWZhY3RvcmluZyBvbmUuIEkg
d2lsbCBvcHRpbWl6ZSB0aGlzIHBhdGNoIGluIHY2LgoKdGhhbmtzIGZvciB0aGUgZmVlZGJhY2sg
b24gdGhpcyBwYXRjaCBhbmQgb3RoZXIgcGF0Y2hlcy4gSSB3aWxsIGhhdmUKYSBmcmVzaCBsb29r
IG9uY2UgYSBuZXcgdmVyc2lvbiBpcyBzZW50LgoKdGhhbmtzIGZvciB5b3VyIHdvcmssCk5pY29s
YXMKCj4gCj4gVGhhbmtzLgo+IAo+IFJlZ2FyZHMsCj4ga3lyaWUuCj4gPiAKPiA+ID4gCj4gPiA+
IFNpZ25lZC1vZmYtYnk6IEt5cmllIFd1IDxreXJpZS53dUBtZWRpYXRlay5jb20+Cj4gPiA+IC0t
LQo+ID4gPiDCoC4uLi9wbGF0Zm9ybS9tZWRpYXRlay9qcGVnL210a19qcGVnX2NvcmUuY8KgwqDC
oCB8IDI4ICsrKy0tLS0KPiA+ID4gwqAuLi4vcGxhdGZvcm0vbWVkaWF0ZWsvanBlZy9tdGtfanBl
Z19kZWNfaHcuY8KgIHwgNzUKPiA+ID4gKysrKysrKysrKysrKysrKysrLQo+ID4gPiDCoC4uLi9w
bGF0Zm9ybS9tZWRpYXRlay9qcGVnL210a19qcGVnX2VuY19ody5jwqAgfCA3NQo+ID4gPiArKysr
KysrKysrKysrKysrKystCj4gPiA+IMKgMyBmaWxlcyBjaGFuZ2VkLCAxNTEgaW5zZXJ0aW9ucygr
KSwgMjcgZGVsZXRpb25zKC0pCj4gPiA+IAo+ID4gPiBkaWZmIC0tZ2l0IGEvZHJpdmVycy9tZWRp
YS9wbGF0Zm9ybS9tZWRpYXRlay9qcGVnL210a19qcGVnX2NvcmUuYwo+ID4gPiBiL2RyaXZlcnMv
bWVkaWEvcGxhdGZvcm0vbWVkaWF0ZWsvanBlZy9tdGtfanBlZ19jb3JlLmMKPiA+ID4gaW5kZXgg
MWQzZGYxMjMwMTkxLi5jMWQyZGU5MmYxMjUgMTAwNjQ0Cj4gPiA+IC0tLSBhL2RyaXZlcnMvbWVk
aWEvcGxhdGZvcm0vbWVkaWF0ZWsvanBlZy9tdGtfanBlZ19jb3JlLmMKPiA+ID4gKysrIGIvZHJp
dmVycy9tZWRpYS9wbGF0Zm9ybS9tZWRpYXRlay9qcGVnL210a19qcGVnX2NvcmUuYwo+ID4gPiBA
QCAtMTEyNiw2ICsxMTI2LDkgQEAgc3RhdGljIHZvaWQgbXRrX2pwZWdfY2xrX29uKHN0cnVjdAo+
ID4gPiBtdGtfanBlZ19kZXYgKmpwZWcpCj4gPiA+IMKgewo+ID4gPiDCoMKgwqDCoMKgIGludCBy
ZXQ7Cj4gPiA+IAo+ID4gPiArwqDCoMKgwqAgaWYgKGpwZWctPnZhcmlhbnQtPm11bHRpX2NvcmUp
Cj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgcmV0dXJuOwo+ID4gPiArCj4gPiA+IMKg
wqDCoMKgwqAgcmV0ID0gY2xrX2J1bGtfcHJlcGFyZV9lbmFibGUoanBlZy0+dmFyaWFudC0+bnVt
X2Nsa3MsCj4gPiA+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAganBlZy0+dmFyaWFudC0+Y2xrcyk7Cj4gPiA+IMKg
wqDCoMKgwqAgaWYgKHJldCkKPiA+ID4gQEAgLTExMzQsNiArMTEzNyw5IEBAIHN0YXRpYyB2b2lk
IG10a19qcGVnX2Nsa19vbihzdHJ1Y3QKPiA+ID4gbXRrX2pwZWdfZGV2ICpqcGVnKQo+ID4gPiAK
PiA+ID4gwqBzdGF0aWMgdm9pZCBtdGtfanBlZ19jbGtfb2ZmKHN0cnVjdCBtdGtfanBlZ19kZXYg
KmpwZWcpCj4gPiA+IMKgewo+ID4gPiArwqDCoMKgwqAgaWYgKGpwZWctPnZhcmlhbnQtPm11bHRp
X2NvcmUpCj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgcmV0dXJuOwo+ID4gPiArCj4g
PiA+IMKgwqDCoMKgwqAgY2xrX2J1bGtfZGlzYWJsZV91bnByZXBhcmUoanBlZy0+dmFyaWFudC0+
bnVtX2Nsa3MsCj4gPiA+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAganBlZy0+dmFyaWFudC0+Y2xrcyk7Cj4gPiA+IMKgfQo+
ID4gPiBAQCAtMTY3NywxMyArMTY4Myw2IEBAIHN0YXRpYyB2b2lkIG10a19qcGVnZW5jX3dvcmtl
cihzdHJ1Y3QKPiA+ID4gd29ya19zdHJ1Y3QgKndvcmspCj4gPiA+IMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgIGdvdG8gZW5jX2VuZDsKPiA+ID4gwqDCoMKgwqDCoCB9Cj4gPiA+IAo+ID4gPiAt
wqDCoMKgwqAgcmV0ID0gY2xrX3ByZXBhcmVfZW5hYmxlKGNvbXBfanBlZ1tod19pZF0tPnZlbmNf
Y2xrLmNsa3MtCj4gPiA+ID4gY2xrKTsKPiA+ID4gLcKgwqDCoMKgIGlmIChyZXQpIHsKPiA+ID4g
LcKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBkZXZfZXJyKGpwZWctPmRldiwgIiVzIDogJWQsIGpw
ZWdlbmMKPiA+ID4gY2xrX3ByZXBhcmVfZW5hYmxlIGZhaWxcbiIsCj4gPiA+IC3CoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIF9fZnVuY19fLCBfX0xJTkVfXyk7Cj4gPiA+
IC3CoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgZ290byBlbmNfZW5kOwo+ID4gPiAtwqDCoMKgwqAg
fQo+ID4gPiAtCj4gPiA+IMKgwqDCoMKgwqAgdjRsMl9tMm1fc3JjX2J1Zl9yZW1vdmUoY3R4LT5m
aC5tMm1fY3R4KTsKPiA+ID4gwqDCoMKgwqDCoCB2NGwyX20ybV9kc3RfYnVmX3JlbW92ZShjdHgt
PmZoLm0ybV9jdHgpOwo+ID4gPiAKPiA+ID4gQEAgLTE3OTgsMjAgKzE3OTcsMTMgQEAgc3RhdGlj
IHZvaWQgbXRrX2pwZWdkZWNfd29ya2VyKHN0cnVjdAo+ID4gPiB3b3JrX3N0cnVjdCAqd29yaykK
PiA+ID4gwqDCoMKgwqDCoCBqcGVnX2RzdF9idWYtPmZyYW1lX251bSA9IGN0eC0+dG90YWxfZnJh
bWVfbnVtOwo+ID4gPiAKPiA+ID4gwqDCoMKgwqDCoCBtdGtfanBlZ2RlY19zZXRfaHdfcGFyYW0o
Y3R4LCBod19pZCwgc3JjX2J1ZiwgZHN0X2J1Zik7Cj4gPiA+IC3CoMKgwqDCoCByZXQgPSBwbV9y
dW50aW1lX2dldF9zeW5jKGNvbXBfanBlZ1tod19pZF0tPmRldik7Cj4gPiA+ICvCoMKgwqDCoCBy
ZXQgPSBwbV9ydW50aW1lX3Jlc3VtZV9hbmRfZ2V0KGNvbXBfanBlZ1tod19pZF0tPmRldik7Cj4g
PiA+IMKgwqDCoMKgwqAgaWYgKHJldCA8IDApIHsKPiA+ID4gwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqAgZGV2X2VycihqcGVnLT5kZXYsICIlcyA6ICVkLCBwbV9ydW50aW1lX2dldF9zeW5jIGZh
aWwKPiA+ID4gISEhXG4iLAo+ID4gPiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqAgX19mdW5jX18sIF9fTElORV9fKTsKPiA+ID4gwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqAgZ290byBkZWNfZW5kOwo+ID4gPiDCoMKgwqDCoMKgIH0KPiA+ID4gCj4gPiA+IC3CoMKg
wqDCoCByZXQgPSBjbGtfcHJlcGFyZV9lbmFibGUoY29tcF9qcGVnW2h3X2lkXS0+amRlY19jbGsu
Y2xrcy0KPiA+ID4gPiBjbGspOwo+ID4gPiAtwqDCoMKgwqAgaWYgKHJldCkgewo+ID4gPiAtwqDC
oMKgwqDCoMKgwqDCoMKgwqDCoMKgIGRldl9lcnIoanBlZy0+ZGV2LCAiJXMgOiAlZCwganBlZ2Rl
Ywo+ID4gPiBjbGtfcHJlcGFyZV9lbmFibGUgZmFpbFxuIiwKPiA+ID4gLcKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgX19mdW5jX18sIF9fTElORV9fKTsKPiA+ID4gLcKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBnb3RvIGNsa19lbmQ7Cj4gPiA+IC3CoMKgwqDCoCB9Cj4g
PiA+IC0KPiA+ID4gwqDCoMKgwqDCoCB2NGwyX20ybV9zcmNfYnVmX3JlbW92ZShjdHgtPmZoLm0y
bV9jdHgpOwo+ID4gPiDCoMKgwqDCoMKgIHY0bDJfbTJtX2RzdF9idWZfcmVtb3ZlKGN0eC0+Zmgu
bTJtX2N0eCk7Cj4gPiA+IAo+ID4gPiBAQCAtMTgyMSw3ICsxODEzLDcgQEAgc3RhdGljIHZvaWQg
bXRrX2pwZWdkZWNfd29ya2VyKHN0cnVjdAo+ID4gPiB3b3JrX3N0cnVjdCAqd29yaykKPiA+ID4g
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgICZkc3RfYnVmLT52YjJfYnVmLCAmZmIpKSB7Cj4gPiA+IMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgIGRldl9lcnIoanBlZy0+ZGV2LCAiJXMgOiAlZCwgbXRrX2pwZWdfc2V0X2RlY19kc3QK
PiA+ID4gZmFpbFxuIiwKPiA+ID4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgIF9fZnVuY19fLCBfX0xJTkVfXyk7Cj4gPiA+IC3CoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqAgZ290byBzZXRkc3RfZW5kOwo+ID4gPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIGdvdG8g
c2V0X2RzdF9mYWlsOwo+ID4gPiDCoMKgwqDCoMKgIH0KPiA+ID4gCj4gPiA+IMKgwqDCoMKgwqAg
c2NoZWR1bGVfZGVsYXllZF93b3JrKCZjb21wX2pwZWdbaHdfaWRdLT5qb2JfdGltZW91dF93b3Jr
LAo+ID4gPiBAQCAtMTg0Niw5ICsxODM4LDcgQEAgc3RhdGljIHZvaWQgbXRrX2pwZWdkZWNfd29y
a2VyKHN0cnVjdAo+ID4gPiB3b3JrX3N0cnVjdCAqd29yaykKPiA+ID4gCj4gPiA+IMKgwqDCoMKg
wqAgcmV0dXJuOwo+ID4gPiAKPiA+ID4gLXNldGRzdF9lbmQ6Cj4gPiA+IC3CoMKgwqDCoCBjbGtf
ZGlzYWJsZV91bnByZXBhcmUoY29tcF9qcGVnW2h3X2lkXS0+amRlY19jbGsuY2xrcy0+Y2xrKTsK
PiA+ID4gLWNsa19lbmQ6Cj4gPiA+ICtzZXRfZHN0X2ZhaWw6Cj4gPiA+IMKgwqDCoMKgwqAgcG1f
cnVudGltZV9wdXQoY29tcF9qcGVnW2h3X2lkXS0+ZGV2KTsKPiA+ID4gwqBkZWNfZW5kOgo+ID4g
PiDCoMKgwqDCoMKgIHY0bDJfbTJtX3NyY19idWZfcmVtb3ZlKGN0eC0+ZmgubTJtX2N0eCk7Cj4g
PiA+IGRpZmYgLS1naXQgYS9kcml2ZXJzL21lZGlhL3BsYXRmb3JtL21lZGlhdGVrL2pwZWcvbXRr
X2pwZWdfZGVjX2h3LmMKPiA+ID4gYi9kcml2ZXJzL21lZGlhL3BsYXRmb3JtL21lZGlhdGVrL2pw
ZWcvbXRrX2pwZWdfZGVjX2h3LmMKPiA+ID4gaW5kZXggMmU2ZGE4NjE3NDg0Li5kYjJhZmM1MTUx
YWQgMTAwNjQ0Cj4gPiA+IC0tLSBhL2RyaXZlcnMvbWVkaWEvcGxhdGZvcm0vbWVkaWF0ZWsvanBl
Zy9tdGtfanBlZ19kZWNfaHcuYwo+ID4gPiArKysgYi9kcml2ZXJzL21lZGlhL3BsYXRmb3JtL21l
ZGlhdGVrL2pwZWcvbXRrX2pwZWdfZGVjX2h3LmMKPiA+ID4gQEAgLTU0MywxNCArNTQzLDEzIEBA
IHN0YXRpYyB2b2lkIG10a19qcGVnZGVjX3RpbWVvdXRfd29yayhzdHJ1Y3QKPiA+ID4gd29ya19z
dHJ1Y3QgKndvcmspCj4gPiA+IMKgwqDCoMKgwqAgdjRsMl9tMm1fYnVmX2NvcHlfbWV0YWRhdGEo
c3JjX2J1ZiwgZHN0X2J1ZiwgdHJ1ZSk7Cj4gPiA+IAo+ID4gPiDCoMKgwqDCoMKgIG10a19qcGVn
X2RlY19yZXNldChjanBlZy0+cmVnX2Jhc2UpOwo+ID4gPiAtwqDCoMKgwqAgY2xrX2Rpc2FibGVf
dW5wcmVwYXJlKGNqcGVnLT5qZGVjX2Nsay5jbGtzLT5jbGspOwo+ID4gPiAtwqDCoMKgwqAgcG1f
cnVudGltZV9wdXQoY2pwZWctPmRldik7Cj4gPiA+IMKgwqDCoMKgwqAgY2pwZWctPmh3X3N0YXRl
ID0gTVRLX0pQRUdfSFdfSURMRTsKPiA+ID4gwqDCoMKgwqDCoCBhdG9taWNfaW5jKCZtYXN0ZXJf
anBlZy0+aHdfcmR5KTsKPiA+ID4gwqDCoMKgwqDCoCB3YWtlX3VwKCZtYXN0ZXJfanBlZy0+aHdf
d3EpOwo+ID4gPiDCoMKgwqDCoMKgIHY0bDJfbTJtX2J1Zl9kb25lKHNyY19idWYsIGJ1Zl9zdGF0
ZSk7Cj4gPiA+IMKgwqDCoMKgwqAgbXRrX2pwZWdkZWNfcHV0X2J1ZihjanBlZyk7Cj4gPiA+IMKg
wqDCoMKgwqAganBlZ19idWZfcXVldWVfZGVjKGN0eCk7Cj4gPiA+ICvCoMKgwqDCoCBwbV9ydW50
aW1lX3B1dChjanBlZy0+ZGV2KTsKPiA+ID4gwqB9Cj4gPiA+IAo+ID4gPiDCoHN0YXRpYyBpcnFy
ZXR1cm5fdCBtdGtfanBlZ2RlY19od19pcnFfaGFuZGxlcihpbnQgaXJxLCB2b2lkICpwcml2KQo+
ID4gPiBAQCAtNTkyLDEyICs1OTEsMTEgQEAgc3RhdGljIGlycXJldHVybl90Cj4gPiA+IG10a19q
cGVnZGVjX2h3X2lycV9oYW5kbGVyKGludCBpcnEsIHZvaWQgKnByaXYpCj4gPiA+IMKgwqDCoMKg
wqAgdjRsMl9tMm1fYnVmX2RvbmUoc3JjX2J1ZiwgYnVmX3N0YXRlKTsKPiA+ID4gwqDCoMKgwqDC
oCBtdGtfanBlZ2RlY19wdXRfYnVmKGpwZWcpOwo+ID4gPiDCoMKgwqDCoMKgIGpwZWdfYnVmX3F1
ZXVlX2RlYyhjdHgpOwo+ID4gPiAtwqDCoMKgwqAgcG1fcnVudGltZV9wdXQoY3R4LT5qcGVnLT5k
ZXYpOwo+ID4gPiAtwqDCoMKgwqAgY2xrX2Rpc2FibGVfdW5wcmVwYXJlKGpwZWctPmpkZWNfY2xr
LmNsa3MtPmNsayk7Cj4gPiA+IAo+ID4gPiDCoMKgwqDCoMKgIGpwZWctPmh3X3N0YXRlID0gTVRL
X0pQRUdfSFdfSURMRTsKPiA+ID4gwqDCoMKgwqDCoCB3YWtlX3VwKCZtYXN0ZXJfanBlZy0+aHdf
d3EpOwo+ID4gPiDCoMKgwqDCoMKgIGF0b21pY19pbmMoJm1hc3Rlcl9qcGVnLT5od19yZHkpOwo+
ID4gPiArwqDCoMKgwqAgcG1fcnVudGltZV9wdXQoanBlZy0+ZGV2KTsKPiA+ID4gCj4gPiA+IMKg
wqDCoMKgwqAgcmV0dXJuIElSUV9IQU5ETEVEOwo+ID4gPiDCoH0KPiA+ID4gQEAgLTcwMywxNSAr
NzAxLDg0IEBAIHN0YXRpYyBpbnQgbXRrX2pwZWdkZWNfaHdfcHJvYmUoc3RydWN0Cj4gPiA+IHBs
YXRmb3JtX2RldmljZSAqcGRldikKPiA+ID4gCj4gPiA+IMKgwqDCoMKgwqAgcGxhdGZvcm1fc2V0
X2RydmRhdGEocGRldiwgZGV2KTsKPiA+ID4gwqDCoMKgwqDCoCBwbV9ydW50aW1lX2VuYWJsZSgm
cGRldi0+ZGV2KTsKPiA+ID4gK8KgwqDCoMKgIHJldCA9IGRldm1fY2xrX2J1bGtfZ2V0KGRldi0+
ZGV2LAo+ID4gPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqAganBlZ2RlY19jbGstPmNsa19udW0sCj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBqcGVnZGVjX2Nsay0+Y2xr
cyk7Cj4gPiA+ICvCoMKgwqDCoCBpZiAocmV0KSB7Cj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqAgZGV2X2VycigmcGRldi0+ZGV2LCAiRmFpbGVkIHRvIGluaXQgY2xrXG4iKTsKPiA+ID4g
K8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCByZXR1cm4gcmV0Owo+ID4gPiArwqDCoMKgwqAgfQo+
ID4gPiArCj4gPiA+ICvCoMKgwqDCoCByZXR1cm4gMDsKPiA+ID4gK30KPiA+ID4gKwo+ID4gPiAr
c3RhdGljIHZvaWQgbXRrX2pwZWdfY2xrX29uKHN0cnVjdCBtdGtfanBlZ2RlY19jb21wX2RldiAq
anBlZykKPiA+ID4gK3sKPiA+ID4gK8KgwqDCoMKgIGludCByZXQ7Cj4gPiA+ICsKPiA+ID4gK8Kg
wqDCoMKgIHJldCA9IGNsa19idWxrX3ByZXBhcmVfZW5hYmxlKGpwZWctPmpkZWNfY2xrLmNsa19u
dW0sCj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBqcGVnLT5qZGVjX2Nsay5jbGtzKTsKPiA+ID4gK8KgwqDC
oMKgIGlmIChyZXQpCj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgZGV2X2VycihqcGVn
LT5kZXYsICIlcyA6ICVkLCBqcGVnZGVjCj4gPiA+IGNsa19wcmVwYXJlX2VuYWJsZSBmYWlsXG4i
LAo+ID4gPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBfX2Z1bmNf
XywgX19MSU5FX18pOwo+ID4gPiArfQo+ID4gPiArCj4gPiA+ICtzdGF0aWMgdm9pZCBtdGtfanBl
Z19jbGtfb2ZmKHN0cnVjdCBtdGtfanBlZ2RlY19jb21wX2RldiAqanBlZykKPiA+ID4gK3sKPiA+
ID4gK8KgwqDCoMKgIGNsa19idWxrX2Rpc2FibGVfdW5wcmVwYXJlKGpwZWctPmpkZWNfY2xrLmNs
a19udW0sCj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqDCoMKgwqDCoCBqcGVnLT5qZGVjX2Nsay5jbGtzKTsKPiA+ID4gK30KPiA+ID4g
Kwo+ID4gPiArc3RhdGljIF9fbWF5YmVfdW51c2VkIGludCBtdGtfanBlZ2RlY19wbV9zdXNwZW5k
KHN0cnVjdCBkZXZpY2UKPiA+ID4gKmRldikKPiA+ID4gK3sKPiA+ID4gK8KgwqDCoMKgIHN0cnVj
dCBtdGtfanBlZ2RlY19jb21wX2RldiAqanBlZyA9IGRldl9nZXRfZHJ2ZGF0YShkZXYpOwo+ID4g
PiArCj4gPiA+ICvCoMKgwqDCoCBtdGtfanBlZ19jbGtfb2ZmKGpwZWcpOwo+ID4gPiAKPiA+ID4g
wqDCoMKgwqDCoCByZXR1cm4gMDsKPiA+ID4gwqB9Cj4gPiA+IAo+ID4gPiArc3RhdGljIF9fbWF5
YmVfdW51c2VkIGludCBtdGtfanBlZ2RlY19wbV9yZXN1bWUoc3RydWN0IGRldmljZQo+ID4gPiAq
ZGV2KQo+ID4gPiArewo+ID4gPiArwqDCoMKgwqAgc3RydWN0IG10a19qcGVnZGVjX2NvbXBfZGV2
ICpqcGVnID0gZGV2X2dldF9kcnZkYXRhKGRldik7Cj4gPiA+ICsKPiA+ID4gK8KgwqDCoMKgIG10
a19qcGVnX2Nsa19vbihqcGVnKTsKPiA+ID4gKwo+ID4gPiArwqDCoMKgwqAgcmV0dXJuIDA7Cj4g
PiA+ICt9Cj4gPiA+ICsKPiA+ID4gK3N0YXRpYyBfX21heWJlX3VudXNlZCBpbnQgbXRrX2pwZWdk
ZWNfc3VzcGVuZChzdHJ1Y3QgZGV2aWNlICpkZXYpCj4gPiA+ICt7Cj4gPiA+ICvCoMKgwqDCoCBz
dHJ1Y3QgbXRrX2pwZWdkZWNfY29tcF9kZXYgKmpwZWcgPSBkZXZfZ2V0X2RydmRhdGEoZGV2KTsK
PiA+ID4gKwo+ID4gPiArwqDCoMKgwqAgdjRsMl9tMm1fc3VzcGVuZChqcGVnLT5tYXN0ZXJfZGV2
LT5tMm1fZGV2KTsKPiA+ID4gK8KgwqDCoMKgIHJldHVybiBwbV9ydW50aW1lX2ZvcmNlX3N1c3Bl
bmQoZGV2KTsKPiA+ID4gK30KPiA+ID4gKwo+ID4gPiArc3RhdGljIF9fbWF5YmVfdW51c2VkIGlu
dCBtdGtfanBlZ2RlY19yZXN1bWUoc3RydWN0IGRldmljZSAqZGV2KQo+ID4gPiArewo+ID4gPiAr
wqDCoMKgwqAgc3RydWN0IG10a19qcGVnZGVjX2NvbXBfZGV2ICpqcGVnID0gZGV2X2dldF9kcnZk
YXRhKGRldik7Cj4gPiA+ICvCoMKgwqDCoCBpbnQgcmV0Owo+ID4gPiArCj4gPiA+ICvCoMKgwqDC
oCByZXQgPSBwbV9ydW50aW1lX2ZvcmNlX3Jlc3VtZShkZXYpOwo+ID4gPiArwqDCoMKgwqAgaWYg
KHJldCA8IDApCj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgcmV0dXJuIHJldDsKPiA+
ID4gKwo+ID4gPiArwqDCoMKgwqAgdjRsMl9tMm1fcmVzdW1lKGpwZWctPm1hc3Rlcl9kZXYtPm0y
bV9kZXYpOwo+ID4gPiArwqDCoMKgwqAgcmV0dXJuIHJldDsKPiA+ID4gK30KPiA+ID4gKwo+ID4g
PiArc3RhdGljIGNvbnN0IHN0cnVjdCBkZXZfcG1fb3BzIG10a19qcGVnZGVjX3BtX29wcyA9IHsK
PiA+ID4gK8KgwqDCoMKgIFNFVF9TWVNURU1fU0xFRVBfUE1fT1BTKG10a19qcGVnZGVjX3N1c3Bl
bmQsCj4gPiA+IG10a19qcGVnZGVjX3Jlc3VtZSkKPiA+ID4gK8KgwqDCoMKgIFNFVF9SVU5USU1F
X1BNX09QUyhtdGtfanBlZ2RlY19wbV9zdXNwZW5kLAo+ID4gPiBtdGtfanBlZ2RlY19wbV9yZXN1
bWUsIE5VTEwpCj4gPiA+ICt9Owo+ID4gPiArCj4gPiA+IMKgc3RhdGljIHN0cnVjdCBwbGF0Zm9y
bV9kcml2ZXIgbXRrX2pwZWdkZWNfaHdfZHJpdmVyID0gewo+ID4gPiDCoMKgwqDCoMKgIC5wcm9i
ZSA9IG10a19qcGVnZGVjX2h3X3Byb2JlLAo+ID4gPiDCoMKgwqDCoMKgIC5kcml2ZXIgPSB7Cj4g
PiA+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIC5uYW1lID0gIm10ay1qcGVnZGVjLWh3IiwK
PiA+ID4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgLm9mX21hdGNoX3RhYmxlID0gbXRrX2pw
ZWdkZWNfaHdfaWRzLAo+ID4gPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIC5wbcKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoCA9ICZtdGtfanBlZ2RlY19wbV9vcHMsCj4gPiA+IMKgwqDCoMKgwqAg
fSwKPiA+ID4gwqB9Owo+ID4gPiAKPiA+ID4gZGlmZiAtLWdpdCBhL2RyaXZlcnMvbWVkaWEvcGxh
dGZvcm0vbWVkaWF0ZWsvanBlZy9tdGtfanBlZ19lbmNfaHcuYwo+ID4gPiBiL2RyaXZlcnMvbWVk
aWEvcGxhdGZvcm0vbWVkaWF0ZWsvanBlZy9tdGtfanBlZ19lbmNfaHcuYwo+ID4gPiBpbmRleCBm
ZjczMzkzYTI0MTcuLjI3ZGEyYTk5MjJhNiAxMDA2NDQKPiA+ID4gLS0tIGEvZHJpdmVycy9tZWRp
YS9wbGF0Zm9ybS9tZWRpYXRlay9qcGVnL210a19qcGVnX2VuY19ody5jCj4gPiA+ICsrKyBiL2Ry
aXZlcnMvbWVkaWEvcGxhdGZvcm0vbWVkaWF0ZWsvanBlZy9tdGtfanBlZ19lbmNfaHcuYwo+ID4g
PiBAQCAtMjc0LDE0ICsyNzQsMTMgQEAgc3RhdGljIHZvaWQgbXRrX2pwZWdlbmNfdGltZW91dF93
b3JrKHN0cnVjdAo+ID4gPiB3b3JrX3N0cnVjdCAqd29yaykKPiA+ID4gwqDCoMKgwqDCoCB2NGwy
X20ybV9idWZfY29weV9tZXRhZGF0YShzcmNfYnVmLCBkc3RfYnVmLCB0cnVlKTsKPiA+ID4gCj4g
PiA+IMKgwqDCoMKgwqAgbXRrX2pwZWdfZW5jX3Jlc2V0KGNqcGVnLT5yZWdfYmFzZSk7Cj4gPiA+
IC3CoMKgwqDCoCBjbGtfZGlzYWJsZV91bnByZXBhcmUoY2pwZWctPnZlbmNfY2xrLmNsa3MtPmNs
ayk7Cj4gPiA+IC3CoMKgwqDCoCBwbV9ydW50aW1lX3B1dChjanBlZy0+ZGV2KTsKPiA+ID4gwqDC
oMKgwqDCoCBjanBlZy0+aHdfc3RhdGUgPSBNVEtfSlBFR19IV19JRExFOwo+ID4gPiDCoMKgwqDC
oMKgIGF0b21pY19pbmMoJm1hc3Rlcl9qcGVnLT5od19yZHkpOwo+ID4gPiDCoMKgwqDCoMKgIHdh
a2VfdXAoJm1hc3Rlcl9qcGVnLT5od193cSk7Cj4gPiA+IMKgwqDCoMKgwqAgdjRsMl9tMm1fYnVm
X2RvbmUoc3JjX2J1ZiwgYnVmX3N0YXRlKTsKPiA+ID4gwqDCoMKgwqDCoCBtdGtfanBlZ2VuY19w
dXRfYnVmKGNqcGVnKTsKPiA+ID4gwqDCoMKgwqDCoCBqcGVnX2J1Zl9xdWV1ZV9kZWMoY3R4KTsK
PiA+ID4gK8KgwqDCoMKgIHBtX3J1bnRpbWVfcHV0KGNqcGVnLT5kZXYpOwo+ID4gPiDCoH0KPiA+
ID4gCj4gPiA+IMKgc3RhdGljIGlycXJldHVybl90IG10a19qcGVnZW5jX2h3X2lycV9oYW5kbGVy
KGludCBpcnEsIHZvaWQgKnByaXYpCj4gPiA+IEBAIC0zMTYsMTIgKzMxNSwxMSBAQCBzdGF0aWMg
aXJxcmV0dXJuX3QKPiA+ID4gbXRrX2pwZWdlbmNfaHdfaXJxX2hhbmRsZXIoaW50IGlycSwgdm9p
ZCAqcHJpdikKPiA+ID4gwqDCoMKgwqDCoCB2NGwyX20ybV9idWZfZG9uZShzcmNfYnVmLCBidWZf
c3RhdGUpOwo+ID4gPiDCoMKgwqDCoMKgIG10a19qcGVnZW5jX3B1dF9idWYoanBlZyk7Cj4gPiA+
IMKgwqDCoMKgwqAganBlZ19idWZfcXVldWVfZGVjKGN0eCk7Cj4gPiA+IC3CoMKgwqDCoCBwbV9y
dW50aW1lX3B1dChjdHgtPmpwZWctPmRldik7Cj4gPiA+IC3CoMKgwqDCoCBjbGtfZGlzYWJsZV91
bnByZXBhcmUoanBlZy0+dmVuY19jbGsuY2xrcy0+Y2xrKTsKPiA+ID4gCj4gPiA+IMKgwqDCoMKg
wqAganBlZy0+aHdfc3RhdGUgPSBNVEtfSlBFR19IV19JRExFOwo+ID4gPiDCoMKgwqDCoMKgIHdh
a2VfdXAoJm1hc3Rlcl9qcGVnLT5od193cSk7Cj4gPiA+IMKgwqDCoMKgwqAgYXRvbWljX2luYygm
bWFzdGVyX2pwZWctPmh3X3JkeSk7Cj4gPiA+ICvCoMKgwqDCoCBwbV9ydW50aW1lX3B1dChqcGVn
LT5kZXYpOwo+ID4gPiAKPiA+ID4gwqDCoMKgwqDCoCByZXR1cm4gSVJRX0hBTkRMRUQ7Cj4gPiA+
IMKgfQo+ID4gPiBAQCAtNDI1LDE1ICs0MjMsODQgQEAgc3RhdGljIGludCBtdGtfanBlZ2VuY19o
d19wcm9iZShzdHJ1Y3QKPiA+ID4gcGxhdGZvcm1fZGV2aWNlICpwZGV2KQo+ID4gPiAKPiA+ID4g
wqDCoMKgwqDCoCBwbGF0Zm9ybV9zZXRfZHJ2ZGF0YShwZGV2LCBkZXYpOwo+ID4gPiDCoMKgwqDC
oMKgIHBtX3J1bnRpbWVfZW5hYmxlKCZwZGV2LT5kZXYpOwo+ID4gPiArwqDCoMKgwqAgcmV0ID0g
ZGV2bV9jbGtfYnVsa19nZXQoZGV2LT5kZXYsCj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBqcGVnZW5jX2Nsay0+Y2xrX251bSwK
PiA+ID4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgIGpwZWdlbmNfY2xrLT5jbGtzKTsKPiA+ID4gK8KgwqDCoMKgIGlmIChyZXQpIHsKPiA+
ID4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBkZXZfZXJyKCZwZGV2LT5kZXYsICJGYWlsZWQg
dG8gaW5pdCBjbGtcbiIpOwo+ID4gPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIHJldHVybiBy
ZXQ7Cj4gPiA+ICvCoMKgwqDCoCB9Cj4gPiA+ICsKPiA+ID4gK8KgwqDCoMKgIHJldHVybiAwOwo+
ID4gPiArfQo+ID4gPiArCj4gPiA+ICtzdGF0aWMgdm9pZCBtdGtfanBlZ19jbGtfb24oc3RydWN0
IG10a19qcGVnZW5jX2NvbXBfZGV2ICpqcGVnKQo+ID4gPiArewo+ID4gPiArwqDCoMKgwqAgaW50
IHJldDsKPiA+ID4gKwo+ID4gPiArwqDCoMKgwqAgcmV0ID0gY2xrX2J1bGtfcHJlcGFyZV9lbmFi
bGUoanBlZy0+dmVuY19jbGsuY2xrX251bSwKPiA+ID4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIGpwZWctPnZlbmNf
Y2xrLmNsa3MpOwo+ID4gPiArwqDCoMKgwqAgaWYgKHJldCkKPiA+ID4gK8KgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoCBkZXZfZXJyKGpwZWctPmRldiwgIiVzIDogJWQsIGpwZWdlbmMKPiA+ID4gY2xr
X3ByZXBhcmVfZW5hYmxlIGZhaWxcbiIsCj4gPiA+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqDCoMKgIF9fZnVuY19fLCBfX0xJTkVfXyk7Cj4gPiA+ICt9Cj4gPiA+ICsKPiA+
ID4gK3N0YXRpYyB2b2lkIG10a19qcGVnX2Nsa19vZmYoc3RydWN0IG10a19qcGVnZW5jX2NvbXBf
ZGV2ICpqcGVnKQo+ID4gPiArewo+ID4gPiArwqDCoMKgwqAgY2xrX2J1bGtfZGlzYWJsZV91bnBy
ZXBhcmUoanBlZy0+dmVuY19jbGsuY2xrX251bSwKPiA+ID4gK8KgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIGpwZWctPnZlbmNfY2xr
LmNsa3MpOwo+ID4gPiArfQo+ID4gPiArCj4gPiA+ICtzdGF0aWMgX19tYXliZV91bnVzZWQgaW50
IG10a19qcGVnZW5jX3BtX3N1c3BlbmQoc3RydWN0IGRldmljZQo+ID4gPiAqZGV2KQo+ID4gPiAr
ewo+ID4gPiArwqDCoMKgwqAgc3RydWN0IG10a19qcGVnZW5jX2NvbXBfZGV2ICpqcGVnID0gZGV2
X2dldF9kcnZkYXRhKGRldik7Cj4gPiA+ICsKPiA+ID4gK8KgwqDCoMKgIG10a19qcGVnX2Nsa19v
ZmYoanBlZyk7Cj4gPiA+IAo+ID4gPiDCoMKgwqDCoMKgIHJldHVybiAwOwo+ID4gPiDCoH0KPiA+
ID4gCj4gPiA+ICtzdGF0aWMgX19tYXliZV91bnVzZWQgaW50IG10a19qcGVnZW5jX3BtX3Jlc3Vt
ZShzdHJ1Y3QgZGV2aWNlCj4gPiA+ICpkZXYpCj4gPiA+ICt7Cj4gPiA+ICvCoMKgwqDCoCBzdHJ1
Y3QgbXRrX2pwZWdlbmNfY29tcF9kZXYgKmpwZWcgPSBkZXZfZ2V0X2RydmRhdGEoZGV2KTsKPiA+
ID4gKwo+ID4gPiArwqDCoMKgwqAgbXRrX2pwZWdfY2xrX29uKGpwZWcpOwo+ID4gPiArCj4gPiA+
ICvCoMKgwqDCoCByZXR1cm4gMDsKPiA+ID4gK30KPiA+ID4gKwo+ID4gPiArc3RhdGljIF9fbWF5
YmVfdW51c2VkIGludCBtdGtfanBlZ2VuY19zdXNwZW5kKHN0cnVjdCBkZXZpY2UgKmRldikKPiA+
ID4gK3sKPiA+ID4gK8KgwqDCoMKgIHN0cnVjdCBtdGtfanBlZ2VuY19jb21wX2RldiAqanBlZyA9
IGRldl9nZXRfZHJ2ZGF0YShkZXYpOwo+ID4gPiArCj4gPiA+ICvCoMKgwqDCoCB2NGwyX20ybV9z
dXNwZW5kKGpwZWctPm1hc3Rlcl9kZXYtPm0ybV9kZXYpOwo+ID4gPiArwqDCoMKgwqAgcmV0dXJu
IHBtX3J1bnRpbWVfZm9yY2Vfc3VzcGVuZChkZXYpOwo+ID4gPiArfQo+ID4gPiArCj4gPiA+ICtz
dGF0aWMgX19tYXliZV91bnVzZWQgaW50IG10a19qcGVnZW5jX3Jlc3VtZShzdHJ1Y3QgZGV2aWNl
ICpkZXYpCj4gPiA+ICt7Cj4gPiA+ICvCoMKgwqDCoCBzdHJ1Y3QgbXRrX2pwZWdlbmNfY29tcF9k
ZXYgKmpwZWcgPSBkZXZfZ2V0X2RydmRhdGEoZGV2KTsKPiA+ID4gK8KgwqDCoMKgIGludCByZXQ7
Cj4gPiA+ICsKPiA+ID4gK8KgwqDCoMKgIHJldCA9IHBtX3J1bnRpbWVfZm9yY2VfcmVzdW1lKGRl
dik7Cj4gPiA+ICvCoMKgwqDCoCBpZiAocmV0IDwgMCkKPiA+ID4gK8KgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoCByZXR1cm4gcmV0Owo+ID4gPiArCj4gPiA+ICvCoMKgwqDCoCB2NGwyX20ybV9yZXN1
bWUoanBlZy0+bWFzdGVyX2Rldi0+bTJtX2Rldik7Cj4gPiA+ICvCoMKgwqDCoCByZXR1cm4gcmV0
Owo+ID4gPiArfQo+ID4gPiArCj4gPiA+ICtzdGF0aWMgY29uc3Qgc3RydWN0IGRldl9wbV9vcHMg
bXRrX2pwZWdlbmNfcG1fb3BzID0gewo+ID4gPiArwqDCoMKgwqAgU0VUX1NZU1RFTV9TTEVFUF9Q
TV9PUFMobXRrX2pwZWdlbmNfc3VzcGVuZCwKPiA+ID4gbXRrX2pwZWdlbmNfcmVzdW1lKQo+ID4g
PiArwqDCoMKgwqAgU0VUX1JVTlRJTUVfUE1fT1BTKG10a19qcGVnZW5jX3BtX3N1c3BlbmQsCj4g
PiA+IG10a19qcGVnZW5jX3BtX3Jlc3VtZSwgTlVMTCkKPiA+ID4gK307Cj4gPiA+ICsKPiA+ID4g
wqBzdGF0aWMgc3RydWN0IHBsYXRmb3JtX2RyaXZlciBtdGtfanBlZ2VuY19od19kcml2ZXIgPSB7
Cj4gPiA+IMKgwqDCoMKgwqAgLnByb2JlID0gbXRrX2pwZWdlbmNfaHdfcHJvYmUsCj4gPiA+IMKg
wqDCoMKgwqAgLmRyaXZlciA9IHsKPiA+ID4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgLm5h
bWUgPSAibXRrLWpwZWdlbmMtaHciLAo+ID4gPiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAu
b2ZfbWF0Y2hfdGFibGUgPSBtdGtfanBlZ2VuY19kcnZfaWRzLAo+ID4gPiArwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgIC5wbSA9ICZtdGtfanBlZ2VuY19wbV9vcHMsCj4gPiA+IMKgwqDCoMKgwqAg
fSwKPiA+ID4gwqB9Owo+ID4gPiAK



Return-Path: <linux-kernel+bounces-675876-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E7C1041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:37:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 183161694E2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:37:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B2CE51922F4;
Fri, 6 Jun 2025 14:37:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cphJBHLT"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7])
(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 826DD2AD22;
Fri, 6 Jun 2025 14:37:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220623; cv=none; b=Lgq1TwIZWPNH1fPQKaM+UnqdKXvqmttdsAlQ596Thh2ocRtBxg6Zvbp2HiW9MGIa41jWCrRADlo/Q/IYJYt8pNEM6lzUp+JEYnhTkHigoqCyXhRt35B/8I0Fl3zXmp0dbkWozgJXrgmeMtC00W0tcvgDc3YXaFk0OLwY3W4VK3o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220623; c=relaxed/simple;
bh=WmBdqY8X0I01vgd79BxmAXAzoCva9rXmfgpaDgMy+lw=;
h=Message-ID:Date:MIME-Version:Subject:To:References:From:
In-Reply-To:Content-Type; b=mtR8AibNqiuEaazslH6W4rycjenvMuc2CV9shan/m83orCO/KfKi2TkaCyN8VGFbFeD2LQyt9+pj3cqk/1NYk8IBHnVx38khlukm4iWDTHF4kp58gXDaJbXpjy5ro2beFUpc0EoTRCDhMFXS7oWOeQtr/AKXq7R3SEchX2/qfWI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cphJBHLT; arc=none smtp.client-ip=192.198.163.7
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749220621; x=1780756621;
h=message-id:date:mime-version:subject:to:references:from:
in-reply-to:content-transfer-encoding;
bh=WmBdqY8X0I01vgd79BxmAXAzoCva9rXmfgpaDgMy+lw=;
b=cphJBHLTICYwbadwFAtZdnjaGSZAdtRs5VZQxtlAtN93uJttKbGm3kZT
8ffejOKy4qz5hv3N92nhbNzSmnpL2ecYRjbBWOxPVHhBSMO0YL6baHdQ0
99sgSG/rLp0rj0uw17ZNGqTwBEmBP93tEpK6PGSsee+E+c5mW6CtiOAal
Ee7q0zAck4CHa/2sd/ruN+cCbJplkSFcyqXLBU5DzsB3IqCcEVvFel6hj
NQZrkGfslmEG2BF+gVAAHh38SooR/6sTY653/44zynmvCQ0AKCdJk6jw3
b+y2VqcC/q8IodDwyeviDD9kR5PDg5IJ/ZtTotUZaffw7Wj/hZbgY8V6z
A==;
X-CSE-ConnectionGUID: 9vyj9JbCRbOormfWR8uo9Q==
X-CSE-MsgGUID: GLTUTHyFRGaqe3geLhTRhA==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="76770373"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="76770373"
Received: from fmviesa002.fm.intel.com ([10.60.135.142])
by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 07:37:00 -0700
X-CSE-ConnectionGUID: QEVMcjwfQxuYQMspHjoOLg==
X-CSE-MsgGUID: DvUglTc0TmubIRysapZXog==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="169030812"
Received: from spandruv-desk1.amr.corp.intel.com (HELO [10.125.111.33]) ([10.125.111.33])
by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 07:36:48 -0700
Message-ID: <a6c1a18b-59bc-4cfb-9329-c4ffbedc1e10@xxxxxxxxx>
Date: Fri, 6 Jun 2025 07:36:46 -0700
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v9 03/16] CXL/AER: Introduce kfifo for forwarding CXL
errors
To: "Bowman, Terry" <terry.bowman@xxxxxxx>,
PradeepVineshReddy.Kodamati@xxxxxxx, dave@xxxxxxxxxxxx,
jonathan.cameron@xxxxxxxxxx, alison.schofield@xxxxxxxxx,
vishal.l.verma@xxxxxxxxx, ira.weiny@xxxxxxxxx, dan.j.williams@xxxxxxxxx,
bhelgaas@xxxxxxxxxx, bp@xxxxxxxxx, ming.li@xxxxxxxxxxxx,
shiju.jose@xxxxxxxxxx, dan.carpenter@xxxxxxxxxx,
Smita.KoralahalliChannabasappa@xxxxxxx, kobayashi.da-06@xxxxxxxxxxx,
yanfei.xu@xxxxxxxxx, rrichter@xxxxxxx, peterz@xxxxxxxxxxxxx, colyli@xxxxxxx,
uaisheng.ye@xxxxxxxxx, fabio.m.de.francesco@xxxxxxxxxxxxxxx,
ilpo.jarvinen@xxxxxxxxxxxxxxx, yazen.ghannam@xxxxxxx,
linux-cxl@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-pci@xxxxxxxxxxxxxxx
References: <20250603172239.159260-1-terry.bowman@xxxxxxx>
<20250603172239.159260-4-terry.bowman@xxxxxxx>
<ced413e5-6a98-4d6a-9c49-1a0603a1bb98@xxxxxxxxx>
<af218185-3fdb-4e96-9f15-aa9d8bdcdda6@xxxxxxx>
Content-Language: en-US
From: Dave Jiang <dave.jiang@xxxxxxxxx>
In-Reply-To: <af218185-3fdb-4e96-9f15-aa9d8bdcdda6@xxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/6/25 7:27 AM, Bowman, Terry wrote:
>
>
> On 6/5/2025 7:27 PM, Dave Jiang wrote:
>>
>> On 6/3/25 10:22 AM, Terry Bowman wrote:
>>> CXL error handling will soon be moved from the AER driver into the CXL
>>> driver. This requires a notification mechanism for the AER driver to share
>>> the AER interrupt with the CXL driver. The notification will be used
>>> as an indication for the CXL drivers to handle and log the CXL RAS errors.
>>>
>>> Add a kfifo work queue to be used by the AER driver and CXL driver. The AER
>>> driver will be the sole kfifo producer adding work and the cxl_core will be
>>> the sole kfifo consumer removing work. Add the boilerplate kfifo support.
>>>
>>> Add CXL work queue handler registration functions in the AER driver. Export
>>> the functions allowing CXL driver to access. Implement registration
>>> functions for the CXL driver to assign or clear the work handler function.
>>>
>>> Introduce function cxl_create_prot_err_info() and 'struct cxl_prot_err_info'.
>>> Implement cxl_create_prot_err_info() to populate a 'struct cxl_prot_err_info'
>>> instance with the AER severity and the erring device's PCI SBDF. The SBDF
>>> details will be used to rediscover the erring device after the CXL driver
>>> dequeues the kfifo work. The device rediscovery will be introduced along
>>> with the CXL handling in future patches.
>>>
>>> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx>
>>> ---
>>> drivers/cxl/core/ras.c | 31 +++++++++-
>>> drivers/cxl/cxlpci.h | 1 +
>>> drivers/pci/pcie/aer.c | 132 ++++++++++++++++++++++++++++-------------
>>> include/linux/aer.h | 36 +++++++++++
>>> 4 files changed, 157 insertions(+), 43 deletions(-)
>>>
>>> diff --git a/drivers/cxl/core/ras.c b/drivers/cxl/core/ras.c
>>> index 485a831695c7..d35525e79e04 100644
>>> --- a/drivers/cxl/core/ras.c
>>> +++ b/drivers/cxl/core/ras.c
>>> @@ -5,6 +5,7 @@
>>> #include <linux/aer.h>
>>> #include <cxl/event.h>
>>> #include <cxlmem.h>
>>> +#include <cxlpci.h>
>>> #include "trace.h"
>>>
>>> static void cxl_cper_trace_corr_port_prot_err(struct pci_dev *pdev,
>>> @@ -107,13 +108,41 @@ static void cxl_cper_prot_err_work_fn(struct work_struct *work)
>>> }
>>> static DECLARE_WORK(cxl_cper_prot_err_work, cxl_cper_prot_err_work_fn);
>>>
>>> +#ifdef CONFIG_PCIEAER_CXL
>>> +
>>> +static void cxl_prot_err_work_fn(struct work_struct *work)
>>> +{
>>> +}
>>> +
>>> +#else
>>> +static void cxl_prot_err_work_fn(struct work_struct *work) { }
>>> +#endif /* CONFIG_PCIEAER_CXL */
>> I wonder instead of the ifdef block we can just do:
>>
>> static void cxl_prot_err_work_fn(...)
>> {
>> if (!IS_ENABLED(CONFIG_PCIEAER_CXL))
>> return;
>>
>> ....
>> }
> I have a TODO request from Jonathan Cameron in the previous series iteration to address the
> same #ifdef cleanup. Jonathan recommended introducing drivers/cxl/core/aer.c and moving the
> CXL related AER logic to the new file. Are you OK with that solution?

Yes that works. Thanks!

DJ

>
>> In general we want to avoid ifdefs in C files.
>>
>> Also, where is CONFIG_PCIEAER_CXL defined? I'm having trouble finding the Kconfig that declares it.
>>
>> $ git grep CONFIG_PCIEAER_CXL
>> drivers/cxl/core/pci.c:#ifdef CONFIG_PCIEAER_CXL
>> drivers/cxl/core/ras.c:#ifdef CONFIG_PCIEAER_CXL
>> drivers/cxl/core/ras.c:#endif /* CONFIG_PCIEAER_CXL */
>> drivers/cxl/cxl.h:#ifdef CONFIG_PCIEAER_CXL
>> drivers/cxl/port.c:#ifdef CONFIG_PCIEAER_CXL
>> drivers/cxl/port.c:#endif /* CONFIG_PCIEAER_CXL */
>> drivers/pci/pcie/aer.c:#if defined(CONFIG_PCIEAER_CXL)
>> drivers/pci/pcie/aer.c:#ifdef CONFIG_PCIEAER_CXL
>> drivers/pci/pcie/aer.c:#if defined(CONFIG_PCIEAER_CXL)
>> include/linux/aer.h:#if defined(CONFIG_PCIEAER_CXL)
>>
> CONFIG_PCIEAER_CXL is a Kconfig dependent on CONFIG_PCIEAER. When enabled the
> #define is found in include/generated/autoconf.h
>
>>> +
>>> +static struct work_struct cxl_prot_err_work;
>>> +static DECLARE_WORK(cxl_prot_err_work, cxl_prot_err_work_fn);
>>> +
>>> int cxl_ras_init(void)
>>> {
>>> - return cxl_cper_register_prot_err_work(&cxl_cper_prot_err_work);
>>> + int rc;
>>> +
>>> + rc = cxl_cper_register_prot_err_work(&cxl_cper_prot_err_work);
>>> + if (rc)
>>> + pr_err("Failed to register CPER AER kfifo (%x)", rc);
>>> +
>>> + rc = cxl_register_prot_err_work(&cxl_prot_err_work);
>>> + if (rc) {
>>> + pr_err("Failed to register native AER kfifo (%x)", rc);
>>> + return rc;
>>> + }
>>> +
>>> + return 0;
>>> }
>>>
>>> void cxl_ras_exit(void)
>>> {
>>> cxl_cper_unregister_prot_err_work(&cxl_cper_prot_err_work);
>>> cancel_work_sync(&cxl_cper_prot_err_work);
>>> +
>>> + cxl_unregister_prot_err_work();
>>> + cancel_work_sync(&cxl_prot_err_work);
>>> }
>>> diff --git a/drivers/cxl/cxlpci.h b/drivers/cxl/cxlpci.h
>>> index 54e219b0049e..6f1396ef7b77 100644
>>> --- a/drivers/cxl/cxlpci.h
>>> +++ b/drivers/cxl/cxlpci.h
>>> @@ -4,6 +4,7 @@
>>> #define __CXL_PCI_H__
>>> #include <linux/pci.h>
>>> #include "cxl.h"
>>> +#include "linux/aer.h"
>>>
>>> #define CXL_MEMORY_PROGIF 0x10
>>>
>>> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
>>> index adb4b1123b9b..5350fa5be784 100644
>>> --- a/drivers/pci/pcie/aer.c
>>> +++ b/drivers/pci/pcie/aer.c
>>> @@ -114,6 +114,14 @@ struct aer_stats {
>>> static int pcie_aer_disable;
>>> static pci_ers_result_t aer_root_reset(struct pci_dev *dev);
>>>
>>> +#if defined(CONFIG_PCIEAER_CXL)
>> Would it make sense to move all the CXL bits to a cxl_aer.c instead of all the ifdefs in this C file?
>>
>> DJ
>
> Yes, this is a good idea. I'll make the AER driver related change to separate the CXL logic.
>
> Terry
>
>>> +#define CXL_ERROR_SOURCES_MAX 128
>>> +static DEFINE_KFIFO(cxl_prot_err_fifo, struct cxl_prot_err_work_data,
>>> + CXL_ERROR_SOURCES_MAX);
>>> +static DEFINE_SPINLOCK(cxl_prot_err_fifo_lock);
>>> +struct work_struct *cxl_prot_err_work;
>>> +#endif
>>> +
>>> void pci_no_aer(void)
>>> {
>>> pcie_aer_disable = 1;
>>> @@ -1004,45 +1012,17 @@ static bool is_internal_error(struct aer_err_info *info)
>>> return info->status & PCI_ERR_UNC_INTN;
>>> }
>>>
>>> -static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data)
>>> +static bool is_cxl_error(struct pci_dev *pdev, struct aer_err_info *info)
>>> {
>>> - struct aer_err_info *info = (struct aer_err_info *)data;
>>> - const struct pci_error_handlers *err_handler;
>>> + if (!info || !info->is_cxl)
>>> + return false;
>>>
>>> - if (!is_cxl_mem_dev(dev) || !cxl_error_is_native(dev))
>>> - return 0;
>>> + /* Only CXL Endpoints are currently supported */
>>> + if ((pci_pcie_type(pdev) != PCI_EXP_TYPE_ENDPOINT) &&
>>> + (pci_pcie_type(pdev) != PCI_EXP_TYPE_RC_EC))
>>> + return false;
>>>
>>> - /* Protect dev->driver */
>>> - device_lock(&dev->dev);
>>> -
>>> - err_handler = dev->driver ? dev->driver->err_handler : NULL;
>>> - if (!err_handler)
>>> - goto out;
>>> -
>>> - if (info->severity == AER_CORRECTABLE) {
>>> - if (err_handler->cor_error_detected)
>>> - err_handler->cor_error_detected(dev);
>>> - } else if (err_handler->error_detected) {
>>> - if (info->severity == AER_NONFATAL)
>>> - err_handler->error_detected(dev, pci_channel_io_normal);
>>> - else if (info->severity == AER_FATAL)
>>> - err_handler->error_detected(dev, pci_channel_io_frozen);
>>> - }
>>> -out:
>>> - device_unlock(&dev->dev);
>>> - return 0;
>>> -}
>>> -
>>> -static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info)
>>> -{
>>> - /*
>>> - * Internal errors of an RCEC indicate an AER error in an
>>> - * RCH's downstream port. Check and handle them in the CXL.mem
>>> - * device driver.
>>> - */
>>> - if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC &&
>>> - is_internal_error(info))
>>> - pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info);
>>> + return is_internal_error(info);
>>> }
>>>
>>> static int handles_cxl_error_iter(struct pci_dev *dev, void *data)
>>> @@ -1056,13 +1036,17 @@ static int handles_cxl_error_iter(struct pci_dev *dev, void *data)
>>> return *handles_cxl;
>>> }
>>>
>>> -static bool handles_cxl_errors(struct pci_dev *rcec)
>>> +static bool handles_cxl_errors(struct pci_dev *dev)
>>> {
>>> bool handles_cxl = false;
>>>
>>> - if (pci_pcie_type(rcec) == PCI_EXP_TYPE_RC_EC &&
>>> - pcie_aer_is_native(rcec))
>>> - pcie_walk_rcec(rcec, handles_cxl_error_iter, &handles_cxl);
>>> + if (!pcie_aer_is_native(dev))
>>> + return false;
>>> +
>>> + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC)
>>> + pcie_walk_rcec(dev, handles_cxl_error_iter, &handles_cxl);
>>> + else
>>> + handles_cxl = pcie_is_cxl(dev);
>>>
>>> return handles_cxl;
>>> }
>>> @@ -1076,10 +1060,46 @@ static void cxl_rch_enable_rcec(struct pci_dev *rcec)
>>> pci_info(rcec, "CXL: Internal errors unmasked");
>>> }
>>>
>>> +static int cxl_create_prot_error_info(struct pci_dev *pdev,
>>> + struct aer_err_info *aer_err_info,
>>> + struct cxl_prot_error_info *cxl_err_info)
>>> +{
>>> + cxl_err_info->severity = aer_err_info->severity;
>>> +
>>> + cxl_err_info->function = PCI_FUNC(pdev->devfn);
>>> + cxl_err_info->device = PCI_SLOT(pdev->devfn);
>>> + cxl_err_info->bus = pdev->bus->number;
>>> + cxl_err_info->segment = pci_domain_nr(pdev->bus);
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +static void forward_cxl_error(struct pci_dev *pdev, struct aer_err_info *aer_err_info)
>>> +{
>>> + struct cxl_prot_err_work_data wd;
>>> + struct cxl_prot_error_info *cxl_err_info = &wd.err_info;
>>> +
>>> + cxl_create_prot_error_info(pdev, aer_err_info, cxl_err_info);
>>> +
>>> + if (!kfifo_put(&cxl_prot_err_fifo, wd)) {
>>> + dev_err_ratelimited(&pdev->dev, "CXL kfifo overflow\n");
>>> + return;
>>> + }
>>> +
>>> + schedule_work(cxl_prot_err_work);
>>> +}
>>> +
>>> #else
>>> static inline void cxl_rch_enable_rcec(struct pci_dev *dev) { }
>>> static inline void cxl_rch_handle_error(struct pci_dev *dev,
>>> struct aer_err_info *info) { }
>>> +static inline void forward_cxl_error(struct pci_dev *dev,
>>> + struct aer_err_info *info) { }
>>> +static inline bool handles_cxl_errors(struct pci_dev *dev)
>>> +{
>>> + return false;
>>> +}
>>> +static bool is_cxl_error(struct pci_dev *pdev, struct aer_err_info *info) { return 0; };
>>> #endif
>>>
>>> /**
>>> @@ -1117,8 +1137,11 @@ static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info)
>>>
>>> static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info)
>>> {
>>> - cxl_rch_handle_error(dev, info);
>>> - pci_aer_handle_error(dev, info);
>>> + if (is_cxl_error(dev, info))
>>> + forward_cxl_error(dev, info);
>>> + else
>>> + pci_aer_handle_error(dev, info);
>>> +
>>> pci_dev_put(dev);
>>> }
>>>
>>> @@ -1582,6 +1605,31 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
>>> return rc ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
>>> }
>>>
>>> +#if defined(CONFIG_PCIEAER_CXL)
>>> +
>>> +int cxl_register_prot_err_work(struct work_struct *work)
>>> +{
>>> + guard(spinlock)(&cxl_prot_err_fifo_lock);
>>> + cxl_prot_err_work = work;
>>> + return 0;
>>> +}
>>> +EXPORT_SYMBOL_NS_GPL(cxl_register_prot_err_work, "CXL");
>>> +
>>> +int cxl_unregister_prot_err_work(void)
>>> +{
>>> + guard(spinlock)(&cxl_prot_err_fifo_lock);
>>> + cxl_prot_err_work = NULL;
>>> + return 0;
>>> +}
>>> +EXPORT_SYMBOL_NS_GPL(cxl_unregister_prot_err_work, "CXL");
>>> +
>>> +int cxl_prot_err_kfifo_get(struct cxl_prot_err_work_data *wd)
>>> +{
>>> + return kfifo_get(&cxl_prot_err_fifo, wd);
>>> +}
>>> +EXPORT_SYMBOL_NS_GPL(cxl_prot_err_kfifo_get, "CXL");
>>> +#endif
>>> +
>>> static struct pcie_port_service_driver aerdriver = {
>>> .name = "aer",
>>> .port_type = PCIE_ANY_PORT,
>>> diff --git a/include/linux/aer.h b/include/linux/aer.h
>>> index 02940be66324..550407240ab5 100644
>>> --- a/include/linux/aer.h
>>> +++ b/include/linux/aer.h
>>> @@ -10,6 +10,7 @@
>>>
>>> #include <linux/errno.h>
>>> #include <linux/types.h>
>>> +#include <linux/workqueue_types.h>
>>>
>>> #define AER_NONFATAL 0
>>> #define AER_FATAL 1
>>> @@ -53,6 +54,27 @@ struct aer_capability_regs {
>>> u16 uncor_err_source;
>>> };
>>>
>>> +/**
>>> + * struct cxl_prot_err_info - Error information used in CXL error handling
>>> + * @severity: AER severity
>>> + * @function: Device's PCI function
>>> + * @device: Device's PCI device
>>> + * @bus: Device's PCI bus
>>> + * @segment: Device's PCI segment
>>> + */
>>> +struct cxl_prot_error_info {
>>> + int severity;
>>> +
>>> + u8 function;
>>> + u8 device;
>>> + u8 bus;
>>> + u16 segment;
>>> +};
>>> +
>>> +struct cxl_prot_err_work_data {
>>> + struct cxl_prot_error_info err_info;
>>> +};
>>> +
>>> #if defined(CONFIG_PCIEAER)
>>> int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
>>> int pcie_aer_is_native(struct pci_dev *dev);
>>> @@ -64,6 +86,20 @@ static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
>>> static inline int pcie_aer_is_native(struct pci_dev *dev) { return 0; }
>>> #endif
>>>
>>> +#if defined(CONFIG_PCIEAER_CXL)
>>> +int cxl_register_prot_err_work(struct work_struct *work);
>>> +int cxl_unregister_prot_err_work(void);
>>> +int cxl_prot_err_kfifo_get(struct cxl_prot_err_work_data *wd);
>>> +#else
>>> +static inline int
>>> +cxl_register_prot_err_work(struct work_struct *work)
>>> +{
>>> + return 0;
>>> +}
>>> +static inline int cxl_unregister_prot_err_work(void) { return 0; }
>>> +static inline int cxl_prot_err_kfifo_get(struct cxl_prot_err_work_data *wd) { return 0; }
>>> +#endif
>>> +
>>> void pci_print_aer(struct pci_dev *dev, int aer_severity,
>>> struct aer_capability_regs *aer);
>>> int cper_severity_to_aer(int cper_severity);
>



Return-Path: <linux-kernel+bounces-675877-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DFA2E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:37:28 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3482F3B2C8F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:37:00 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CBABD155C88;
Fri, 6 Jun 2025 14:37:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OU2ckOIv"
Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EE0A1B042E;
Fri, 6 Jun 2025 14:37:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.51
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220629; cv=none; b=II9DhLD3bYBQ/8wp1jkc9FpDUnAv0VFA2fl7LG8Oq4rltT/1lzPt6BV7ypQYzOHsWYXZDOxA4gFZFYEqdNieKah5xhpDCa8EfxlSZA+nxOPEaAqjYpi7jz0lTJRUAyCwunZ7Mf9wmTJJJt84p2z0LlGUJ+/NVDE1uYyM0ZqtLwY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220629; c=relaxed/simple;
bh=Coej6v2A4pdxAijinrBKdR581+xkqF9c8/CwSsr5axc=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=PKGiMf8Wa3WNEpKz26v3Xeo7MWNE+AuiQOFk+5lvCaAuVvZ6YR7GJucHDqMc+UO9KjgTf71ltc0ljNpE1CmcccpUOmWEqy6cOvvVfYZ/Hyhzmv7uwAH+kCEZmk0H429WOZ0ZLYyPJRZwU79PEc/4o5Xd1mardsOc/5qhoE+83vA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OU2ckOIv; arc=none smtp.client-ip=209.85.219.51
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-6f0ad744811so15575366d6.1;
Fri, 06 Jun 2025 07:37:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749220627; x=1749825427; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=AaEwI0xQjMrdshuvrU/B5Cob4sYuRWx9gxQZpiMO6so=;
b=OU2ckOIvHeKo8G6h+WkeI2RB/bE+hI6KoX6HjrXDckMi9d8LGl85KOj4uX+dTl30cf
a+3/W2Agiz672Q/+5z9Y1mG924dGzjsgez9w4OPXiphksGVzL4IlQWnBhda9zVvR6m3s
NrjMAB9+AhL1f2T0SMriB56ZIaj9XcP3DPuLnKOalrwICNrxQu4xL5IcGc6R0gYyA5t1
TDu1KdTLJZE3DAcypmsyCti805lyOud1MwylVfwgckWCTMzzKupbDmxq/83VIaN6P5Bf
kDzyNYQp4sDzJmbh9AUFo0rI2Ix49k0Tt0JZoy+umLrtBGSFVuKM1gKaHBboEEVpS9nx
BG3g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749220627; x=1749825427;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=AaEwI0xQjMrdshuvrU/B5Cob4sYuRWx9gxQZpiMO6so=;
b=uQ+t1XQRzN8daNzSmC3mxk/pi2FJmxskUEkDuyQvqWKdIBBmkymvYuq9ibHcWJCy9D
tF0D/klrO/A+VG+JARSvYsr3T2g9cPJ+aguUtQDtx5QZEUQi/BHVzELtRyCVPL6L6RYl
ii6yYQIyMYQQ2VZW+FGjEPvnXn/6a+xkTnkQ0B5OAK3fJzxWuf1zW+bGscu0JaT395X9
uT2PEtA7vO1OWuGXvJLIZZ6JycXKmHoRHqhcm18G/tgZEB4e+bPePMQF32F5EpdpNxiz
ofVYmM+L5yYBngM3Ui0NVCdRjhSv4KJV/LTKTtxvPQ2zkUdB4xTBQwC3f6z+rMyclNsk
+NKA==
X-Forwarded-Encrypted: i=1; AJvYcCVuurcmNgk4VKbPGDW4765IRu6oMvp/kwMHH+MXAH46UkDIAasZiuH4xxy+RqwApzZqpaRVVh5n3ArWD5M+@xxxxxxxxxxxxxxx, AJvYcCXvadtSojyp05FT4EFw4Te5x5ZbTlrbE+UDAI7RglzfqP+pTGeBahGSqZshSNz9sd6WqZxv4SS5Uug=@vger.kernel.org
X-Gm-Message-State: AOJu0YxQh/wgdwO2aNo4D/J5xs1nbJew3GXKmZm7llIGR23VsuXc/wli
/IhN/06U8oUTzjowkc06UfJSynkt7QKwBfIzqbJaSNXkt60A6aCHQnqO
X-Gm-Gg: ASbGncvR8eHEqqLWz7g4DPb7xUi/879ll0sk/BcQ+YD1cT+NaRp8DymCUls5Bo+aLIy
GFmfyJcOUpntRgl5wMozH9Cvb1EFserl4B8/A2/YAmobZTaPX46YeHixJrhfSpO5JL3D8iQkzYC
UTvkL2dt68G6voWUka806kUoSEtnGSdc41fWs0V8I+wFIi7x8BBjCSOqTAUtNGy7GpJM3/re13V
Fd4udNbeLZbQ3PurJmmDu6PXtGbi35jEUnVu9asPPUsh1SsrmmUxha5eRMU8yW6CN6V7STzxJG2
Gvb2LWAB4kd/v/tNNYO+W5PneRmC9HakvjqnPT4s59zN3uyWMcggEx7HDjc=
X-Google-Smtp-Source: AGHT+IFR13sAgZh2AfNd6UskGQ4hRF6QlKjuipPT65vrhMI6mbut6Ono5sI0auy2R1DSgPK/Ap9C0w==
X-Received: by 2002:a05:6214:1d2c:b0:6fa:cbe8:b873 with SMTP id 6a1803df08f44-6fb08f54d0fmr55768976d6.14.1749220626725;
Fri, 06 Jun 2025 07:37:06 -0700 (PDT)
Received: from localhost ([2a03:2880:20ff:1::])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fb09b366easm11829636d6.114.2025.06.06.07.37.05
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:37:06 -0700 (PDT)
From: Usama Arif <usamaarif642@xxxxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
david@xxxxxxxxxx,
linux-mm@xxxxxxxxx
Cc: hannes@xxxxxxxxxxx,
shakeel.butt@xxxxxxxxx,
riel@xxxxxxxxxxx,
ziy@xxxxxxxxxx,
baolin.wang@xxxxxxxxxxxxxxxxx,
lorenzo.stoakes@xxxxxxxxxx,
Liam.Howlett@xxxxxxxxxx,
npache@xxxxxxxxxx,
ryan.roberts@xxxxxxx,
dev.jain@xxxxxxx,
hughd@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
linux-doc@xxxxxxxxxxxxxxx,
kernel-team@xxxxxxxx,
Usama Arif <usamaarif642@xxxxxxxxx>
Subject: [RFC] mm: khugepaged: use largest enabled hugepage order for min_free_kbytes
Date: Fri, 6 Jun 2025 15:37:00 +0100
Message-ID: <20250606143700.3256414-1-usamaarif642@xxxxxxxxx>
X-Mailer: git-send-email 2.47.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On arm64 machines with 64K PAGE_SIZE, the min_free_kbytes and hence the
watermarks are evaluated to extremely high values, for e.g. a server with
480G of memory, only 2M mTHP hugepage size set to madvise, with the rest
of the sizes set to never, the min, low and high watermarks evaluate to
11.2G, 14G and 16.8G respectively.
In contrast for 4K PAGE_SIZE of the same machine, with only 2M THP hugepage
size set to madvise, the min, low and high watermarks evaluate to 86M, 566M
and 1G respectively.
This is because set_recommended_min_free_kbytes is designed for PMD
hugepages (pageblock_order = min(HPAGE_PMD_ORDER, PAGE_BLOCK_ORDER)).
Such high watermark values can cause performance and latency issues in
memory bound applications on arm servers that use 64K PAGE_SIZE, eventhough
most of them would never actually use a 512M PMD THP.

Instead of using HPAGE_PMD_ORDER for pageblock_order use the highest large
folio order enabled in set_recommended_min_free_kbytes.
With this patch, when only 2M THP hugepage size is set to madvise for the
same machine with 64K page size, with the rest of the sizes set to never,
the min, low and high watermarks evaluate to 2.08G, 2.6G and 3.1G
respectively. When 512M THP hugepage size is set to madvise for the same
machine with 64K page size, the min, low and high watermarks evaluate to
11.2G, 14G and 16.8G respectively, the same as without this patch.

An alternative solution would be to change PAGE_BLOCK_ORDER by changing
ARCH_FORCE_MAX_ORDER to a lower value for ARM64_64K_PAGES. However, this
is not dynamic with hugepage size, will need different kernel builds for
different hugepage sizes and most users won't know that this needs to be
done as it can be difficult to detmermine that the performance and latency
issues are coming from the high watermark values.

All watermark numbers are for zones of nodes that had the highest number
of pages, i.e. the value for min size for 4K is obtained using:
cat /proc/zoneinfo | grep -i min | awk '{print $2}' | sort -n | tail -n 1 | awk '{print $1 * 4096 / 1024 / 1024}';
and for 64K using:
cat /proc/zoneinfo | grep -i min | awk '{print $2}' | sort -n | tail -n 1 | awk '{print $1 * 65536 / 1024 / 1024}';

An arbirtary min of 128 pages is used for when no hugepage sizes are set
enabled.

Signed-off-by: Usama Arif <usamaarif642@xxxxxxxxx>
---
include/linux/huge_mm.h | 25 +++++++++++++++++++++++++
mm/khugepaged.c | 32 ++++++++++++++++++++++++++++----
mm/shmem.c | 29 +++++------------------------
3 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 2f190c90192d..fb4e51ef0acb 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -170,6 +170,25 @@ static inline void count_mthp_stat(int order, enum mthp_stat_item item)
}
#endif

+/*
+ * Definitions for "huge tmpfs": tmpfs mounted with the huge= option
+ *
+ * SHMEM_HUGE_NEVER:
+ * disables huge pages for the mount;
+ * SHMEM_HUGE_ALWAYS:
+ * enables huge pages for the mount;
+ * SHMEM_HUGE_WITHIN_SIZE:
+ * only allocate huge pages if the page will be fully within i_size,
+ * also respect madvise() hints;
+ * SHMEM_HUGE_ADVISE:
+ * only allocate huge pages if requested with madvise();
+ */
+
+ #define SHMEM_HUGE_NEVER 0
+ #define SHMEM_HUGE_ALWAYS 1
+ #define SHMEM_HUGE_WITHIN_SIZE 2
+ #define SHMEM_HUGE_ADVISE 3
+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE

extern unsigned long transparent_hugepage_flags;
@@ -177,6 +196,12 @@ extern unsigned long huge_anon_orders_always;
extern unsigned long huge_anon_orders_madvise;
extern unsigned long huge_anon_orders_inherit;

+extern int shmem_huge __read_mostly;
+extern unsigned long huge_shmem_orders_always;
+extern unsigned long huge_shmem_orders_madvise;
+extern unsigned long huge_shmem_orders_inherit;
+extern unsigned long huge_shmem_orders_within_size;
+
static inline bool hugepage_global_enabled(void)
{
return transparent_hugepage_flags &
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 15203ea7d007..e64cba74eb2a 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2607,6 +2607,26 @@ static int khugepaged(void *none)
return 0;
}

+static int thp_highest_allowable_order(void)
+{
+ unsigned long orders = READ_ONCE(huge_anon_orders_always)
+ | READ_ONCE(huge_anon_orders_madvise)
+ | READ_ONCE(huge_shmem_orders_always)
+ | READ_ONCE(huge_shmem_orders_madvise)
+ | READ_ONCE(huge_shmem_orders_within_size);
+ if (hugepage_global_enabled())
+ orders |= READ_ONCE(huge_anon_orders_inherit);
+ if (shmem_huge != SHMEM_HUGE_NEVER)
+ orders |= READ_ONCE(huge_shmem_orders_inherit);
+
+ return orders == 0 ? 0 : fls(orders) - 1;
+}
+
+static unsigned long min_thp_pageblock_nr_pages(void)
+{
+ return (1UL << min(thp_highest_allowable_order(), PAGE_BLOCK_ORDER));
+}
+
static void set_recommended_min_free_kbytes(void)
{
struct zone *zone;
@@ -2638,12 +2658,16 @@ static void set_recommended_min_free_kbytes(void)
* second to avoid subsequent fallbacks of other types There are 3
* MIGRATE_TYPES we care about.
*/
- recommended_min += pageblock_nr_pages * nr_zones *
+ recommended_min += min_thp_pageblock_nr_pages() * nr_zones *
MIGRATE_PCPTYPES * MIGRATE_PCPTYPES;

- /* don't ever allow to reserve more than 5% of the lowmem */
- recommended_min = min(recommended_min,
- (unsigned long) nr_free_buffer_pages() / 20);
+ /*
+ * Don't ever allow to reserve more than 5% of the lowmem.
+ * Use a min of 128 pages when all THP orders are set to never.
+ */
+ recommended_min = clamp(recommended_min, 128,
+ (unsigned long) nr_free_buffer_pages() / 20);
+
recommended_min <<= (PAGE_SHIFT-10);

if (recommended_min > min_free_kbytes) {
diff --git a/mm/shmem.c b/mm/shmem.c
index 0c5fb4ffa03a..8e92678d1175 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -136,10 +136,10 @@ struct shmem_options {
};

#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-static unsigned long huge_shmem_orders_always __read_mostly;
-static unsigned long huge_shmem_orders_madvise __read_mostly;
-static unsigned long huge_shmem_orders_inherit __read_mostly;
-static unsigned long huge_shmem_orders_within_size __read_mostly;
+unsigned long huge_shmem_orders_always __read_mostly;
+unsigned long huge_shmem_orders_madvise __read_mostly;
+unsigned long huge_shmem_orders_inherit __read_mostly;
+unsigned long huge_shmem_orders_within_size __read_mostly;
static bool shmem_orders_configured __initdata;
#endif

@@ -516,25 +516,6 @@ static bool shmem_confirm_swap(struct address_space *mapping,
return xa_load(&mapping->i_pages, index) == swp_to_radix_entry(swap);
}

-/*
- * Definitions for "huge tmpfs": tmpfs mounted with the huge= option
- *
- * SHMEM_HUGE_NEVER:
- * disables huge pages for the mount;
- * SHMEM_HUGE_ALWAYS:
- * enables huge pages for the mount;
- * SHMEM_HUGE_WITHIN_SIZE:
- * only allocate huge pages if the page will be fully within i_size,
- * also respect madvise() hints;
- * SHMEM_HUGE_ADVISE:
- * only allocate huge pages if requested with madvise();
- */
-
-#define SHMEM_HUGE_NEVER 0
-#define SHMEM_HUGE_ALWAYS 1
-#define SHMEM_HUGE_WITHIN_SIZE 2
-#define SHMEM_HUGE_ADVISE 3
-
/*
* Special values.
* Only can be set via /sys/kernel/mm/transparent_hugepage/shmem_enabled:
@@ -551,7 +532,7 @@ static bool shmem_confirm_swap(struct address_space *mapping,
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
/* ifdef here to avoid bloating shmem.o when not necessary */

-static int shmem_huge __read_mostly = SHMEM_HUGE_NEVER;
+int shmem_huge __read_mostly = SHMEM_HUGE_NEVER;
static int tmpfs_huge __read_mostly = SHMEM_HUGE_NEVER;

/**
--
2.47.1



Return-Path: <linux-kernel+bounces-675878-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F216441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:39:15 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id A809117A3CD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:39:16 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B3B61A0BDB;
Fri, 6 Jun 2025 14:39:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="mKTa0PeW"
Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 393C784D08
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:39:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.49
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220747; cv=none; b=LZVCmKN1Nu8lWG4wNBaIUy7aUwVaQFNNpzsDkfbDebnm0U22RT9jZtzUapcq8Csqg346Gc3tmDHiPJY34cvZhVfyvwgkht6MH/UN7bPPmeUU7QOvQ5oUscTN0RWwfR5t/jIy+hO0GzxxT6lgrEfXzVBTHUFfdgzcwWfjQriXT+w=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220747; c=relaxed/simple;
bh=3RlpGtfRa9bewFOs6MV3+PiSEYjbIEuBcgpZrywD4S4=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=aArurpCC/fJKQvH5LhhNAfLRz8k++OzaFDVKjzooBUk3YYj8v39qRLGvNDL8gwiVRodbTq+zQwRM3bUQNV9ceWHwMVI1YUYVM2b0xepOvj5HiDup3cmMyZcdGMrpaw2GEew7Fw0OyaMXnTZiLUvcl4xsPl4tpH/GD8cvFnJwXkM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=mKTa0PeW; arc=none smtp.client-ip=209.85.166.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk
Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-86cdb330b48so182850839f.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:39:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1749220744; x=1749825544; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=ePD8mbSyxWI7tOm3mJrlzLEJipoLjaxPhCQo9r49Cf8=;
b=mKTa0PeWjWcSVDM40+YtAJTOsOyqfMH3pmtRTzzSXlYGNVzR5A+RRsh/5jHgdp1GyD
BK8zRWQdR40sbK/CLNWaZJaPf6X8yaGIlPHcZ5pOtiap1nCJFaEwmAksugXxqoiXIMu9
Q/4W8fAXCwfYifhochJ97Z6to/ZVSJ3fuPezfwI+KTh8aZIvKEJyTFeDQL+Heycmtug/
loT9Elme0eFcTstWi/gDI7BqIXlgQkp7d4esNhpd6JYUKYMhPd9LniOJD99kri7OgMxo
WLUG2Hw+wyHLI77rNiPQmYpufxdQGEHDAjWEFhjFUbd/lEQ8OdlEe7W1WD+vh+qIw6Tu
8gVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749220744; x=1749825544;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=ePD8mbSyxWI7tOm3mJrlzLEJipoLjaxPhCQo9r49Cf8=;
b=G1ND77cfiGTdfdcbQqhm0VrSudIijgiuUk5lrFn9ZQl4ZbBPJ30ipaDNRhSy/E8a/J
G+4LCvQVvoRx4xzN+w/a9/C5mR6WSvN88AEYlpSj+SA830xwVtfEKW+Ds7oIJZhsOOTx
WSEXu/I8yrjDeLC9LSsJpBn1Qj1GbkEswTdLw6DQaGGLH5mg4jSblZHD5SaavpgfxX1k
THlNrgnwSElZVki4/Z9+4Cf5Wu98Iabe0JqTIBFsE/lrHqiLi+MQOndQ/88oZKF6EWzq
QlYJh9Kl1X6JcNCExRGH9CZDwBsT9eHwmHu41TukfE7vJgxyWNPqKJR18SUia0dgCqIh
P3vw==
X-Forwarded-Encrypted: i=1; AJvYcCV7nRrfEziuf8FdH/K9TrVWvnvx/GJza2Xb12O3fj00deo3SOMdeghDopcA1KpUl7zHMHNE/mVptM1oeDU=@vger.kernel.org
X-Gm-Message-State: AOJu0YycNejabEPZK2xPKrwQf/EgflmJvpvr0MP4UkNFkYu9BDYVXBgB
q2l0P62Y5YvErIGsSWleRwVXVqOvig1uzeD63IOdLSrVA5kU5iGhJnWbBYs98PnSRjIu0X8pNnL
rugNW
X-Gm-Gg: ASbGncusZPjsCp2sugMXWQQzhwPq9f2WEesbMmNn3PO9tp+YPOAXwmFuwx9Z/7D61oM
tWelVGMWRVb2d+WbACfIJrBimEZhYEuENmqNILI9bblBbGye0q4qm1NwowTcd+9Y5e7/9lXRh/L
7VE4DC0O337HjFcYjwvRPznbUEjmDnq/6/x8CiCDIPa2xxVXohiWWiogfgUH9pZr7/YQMY3D0HV
ONOEMPcF4+eoHSzk66LvmSXMvl7L7O4S4JzAqNkGH0QhX36raFBYITRmOX92glsvfjSTdTCywth
tjw1EDBgBzLKwceUNxvbM4mAhgJ4Uf+Cisf9YBb654ACZ+h8GSV+mpvM9A==
X-Google-Smtp-Source: AGHT+IEYIIwpMH1limnRPkyPHzVPpLRFlfL43w/MdnkURpLFcO0uzBblUbS83KbIhEnSklhOW03Jog==
X-Received: by 2002:a05:6602:4807:b0:86c:fea7:6b83 with SMTP id ca18e2360f4ac-8733665b1d9mr492040539f.6.1749220732743;
Fri, 06 Jun 2025 07:38:52 -0700 (PDT)
Received: from [192.168.1.116] ([96.43.243.2])
by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-873387843b3sm34217239f.8.2025.06.06.07.38.51
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 07:38:52 -0700 (PDT)
Message-ID: <36c0c06e-26fa-4395-a4cf-2a7520520187@xxxxxxxxx>
Date: Fri, 6 Jun 2025 08:38:51 -0600
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [RFC v2 0/5] BPF controlled io_uring
To: Pavel Begunkov <asml.silence@xxxxxxxxx>, io-uring@xxxxxxxxxxxxxxx
Cc: Martin KaFai Lau <martin.lau@xxxxxxxxx>, bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
Content-Language: en-US
From: Jens Axboe <axboe@xxxxxxxxx>
In-Reply-To: <cover.1749214572.git.asml.silence@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 7:57 AM, Pavel Begunkov wrote:
> This series adds io_uring BPF struct_ops, which allows processing
> events and submitting requests from BPF without returning to user.
> There is only one callback for now, it's called from the io_uring
> CQ waiting loop when there is an event to be processed. It also
> has access to waiting parameters like batching and timeouts.
>
> It's tested with a program that queues a nop request, waits for
> its completion and then queues another request, repeating it N
> times. The baseline to compare with is traditional io_uring
> application doing same without BPF and using 2 requests links,
> with the same total number of requests.
>
> # ./link 0 100000000
> type 2-LINK, requests to run 100000000
> sec 20, total (ms) 20374
> # ./link 1 100000000
> type BPF, requests to run 100000000
> sec 13, total (ms) 13700
>
> The BPF version works ~50% faster on a mitigated kernel, while it's
> not even a completely fair comparison as links are restrictive and
> can't always be used. Without links the speedup reaches ~80%.

Nifty! Great to see the BPF side taking shape, I can think of many cool
things we could do with that. Out of curiosity, tested this on my usual
arm64 vm on the laptop:

axboe@m2max-kvm ~/g/l/examples-bpf (bpf) [1]> ./link 0 100000000
type 2-LINK, requests to run 100000000
sec 13, total (ms) 13868

axboe@m2max-kvm ~/g/l/examples-bpf (bpf)> sudo ./link 1 100000000
type BPF, requests to run 100000000
sec 4, total (ms) 4929

No mitigations or anything configured in this kernel.

I'll take a closer look at the patches.

--
Jens Axboe


Return-Path: <linux-kernel+bounces-675879-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 34AC441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:41:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 864EF3A99D9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:40:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CB4E1B040D;
Fri, 6 Jun 2025 14:41:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="vEgwYKXW"
Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173])
(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 1AC9E12C544;
Fri, 6 Jun 2025 14:41:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220864; cv=none; b=FtVm5q8xnxIISyUMdVISYJo6+pH5Dh3Daq94aOxrHzVtOWfUN2b5tx6naKjv4353McB6qfI8AeCqrQvRaTqkjgCearloPzhxG6adYufldmxtduscBNrUM++W5MdBa/EPGjHrny6hTivo1Yya9UDmQT1hvC6DF0GLBpBwuBNA3VQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220864; c=relaxed/simple;
bh=i6yRDhrgT2/zq3iSXDElxzAsOnMwawV20rQ7HStxa3M=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=MlhEage/+ho0C29RRaCbgYNSDfNXDI2H8k5qq+RlRt+KxcTEkTdEeRSu7pM2nXUVYiW1yerD7KHHuuqDmSqQJ7+a8HfwBNNw8+ux9whjvcIV0kK7nYA/Hl0UMZOhgZd0PZrq8NRMM6KxtWiRnRdnx8gI3Detvjpvr1dilYgRKJ0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=vEgwYKXW; arc=none smtp.client-ip=62.89.141.173
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type:
MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To:
Content-Transfer-Encoding:Content-ID:Content-Description;
bh=BUMSe0tFWJRLz9VwcNCfytngVWsj4oVCG4RF0FGla5Y=; b=vEgwYKXWIxvqi2qfBNwslK5vx9
VsPxPYEQeWsRX5tCPp3P5OFJxKugVlpqYPEFHnzLNTOKVEBcYfIYdwZ0BrM6RYJECMp9T8jN3lO4+
Jsl6UzNw/pudNpkER7f6ou//01Wf16scHrGG1fChyR4eUJnVC0U3gIMew+NcR9Ab6zh2f2STtFwFt
F87GCBGHHwS8dTqGei+wOgXnT6Q8DCvLPuVgW6wgUncgyHXcf6ASCgolmOMJoCmXEeBQmmmGsuojL
wX/aYEHk8mYjsJQE7NIDj3oWM3g5GZLWQh7SXZgrygHk/5mFP7McpL1BN6do31ucnXBs7Sb5XBz8L
hjZcZM/A==;
Received: from viro by zeniv.linux.org.uk with local (Exim 4.98.2 #2 (Red Hat Linux))
id 1uNYFe-0000000HDKS-17Ib;
Fri, 06 Jun 2025 14:40:58 +0000
Date: Fri, 6 Jun 2025 15:40:58 +0100
From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
To: Song Liu <song@xxxxxxxxxx>
Cc: bpf@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx,
kernel-team@xxxxxxxx, andrii@xxxxxxxxxx, eddyz87@xxxxxxxxx,
ast@xxxxxxxxxx, daniel@xxxxxxxxxxxxx, martin.lau@xxxxxxxxx,
brauner@xxxxxxxxxx, jack@xxxxxxx, kpsingh@xxxxxxxxxx,
mattbobrowski@xxxxxxxxxx, amir73il@xxxxxxxxx, repnop@xxxxxxxxxx,
jlayton@xxxxxxxxxx, josef@xxxxxxxxxxxxxx, mic@xxxxxxxxxxx,
gnoack@xxxxxxxxxx, m@xxxxxxxxxx
Subject: Re: [PATCH v2 bpf-next 1/4] namei: Introduce new helper function
path_walk_parent()
Message-ID: <20250606144058.GW299672@ZenIV>
References: <20250603065920.3404510-1-song@xxxxxxxxxx>
<20250603065920.3404510-2-song@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250603065920.3404510-2-song@xxxxxxxxxx>
Sender: Al Viro <viro@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Mon, Jun 02, 2025 at 11:59:17PM -0700, Song Liu wrote:
> This helper walks an input path to its parent. Logic are added to handle
> walking across mount tree.
>
> This will be used by landlock, and BPF LSM.

Unless I'm misreading that, it does *NOT* walk to parent - it treats
step into mountpoint as a separate step. NAK in that form - it's
simply a wrong primitive.


Return-Path: <linux-kernel+bounces-675880-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 04A7B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:41:57 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7CAC33AA22A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:41:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B30391A76BC;
Fri, 6 Jun 2025 14:41:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="mA+R/3SJ"
Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2076.outbound.protection.outlook.com [40.107.236.76])
(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 23B1E199931;
Fri, 6 Jun 2025 14:41:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.76
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220897; cv=fail; b=To7BVL+e8iIJFzv0VP+VpgL2M27dyVj29T/hfscZQ1o7u2hwINWKpFuunxAeQxIoxMg0YZpNjjT5k+wt5uO4vS/Fr1R+GjV1hXJz0EMo3y4CeyJpouT0YBFK4I+7gXh67USwNESE3HyVk6+5XRfqqTmxbP8A4dnIljJpTXbcGA4=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220897; c=relaxed/simple;
bh=IhzdR4Cog/rwAXoM9UnVtTmzBGXYX37lWXfAe7ie0X8=;
h=Message-ID:Date:Subject:To:References:From:In-Reply-To:
Content-Type:MIME-Version; b=htWKnOaHNPII0f5Uk/QoLQpiSHerMV9HEZF9MtOqFubeBF/QvznKOBqxwu3s7uGNgP8Tr9YaJGYD1kUkupk/+Kqi9E+G03rtK72J3Rl2oXPesOQ/DeSx3nMlW61UOj3or7HYOHDXhc3Jd+U5RwTMVsW691VsZizo5I2ceNNx7VY=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=mA+R/3SJ; arc=fail smtp.client-ip=40.107.236.76
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=SJyt/gU5R72rVUrxFI1AxEEdp7jZAT5+Btu4wHnFD6hKKCu3lVuWfAHRgN1ETwMw3nZlHqZ9+Vh+sppmDFILpOnEql+MDEMzOjGcTNGv9n2wz32Su5SmGMzEScGuRGDqBm1Vt9wA+36PMpwjZEPzUqlmAl2cN5HEEP3CYLJ9kMW12UrdaC70V9Ry1tHOqNgYwr4f8rYLTzzPffZl9PGrSoEkBs/TIk18K+td3UaYosP9SOBaWHvjGg9vIQ/wbakagtyWLgQGlhCXeGzqdaTfTgvjXAlGwwrRWDqAWLJ8MZs/W5vwOm5rq34oxgMT3jJjHvJAywKmyIYCKBo/pTezHA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=SLUbPqwG8qoL4f2BszTyZOEW6ywf65c6kofBmw6T9s8=;
b=optUcTg9DKD718F21HvxR28UgaZwVdiPlb4NMM4QiEwBgZwv0TvPeULUyh7kPZQ5ObAwQXDYNoqoz0jrE6sGtjp5mA5OvupTdZGvzePgG9RcDCOeYNz91Qez/GxW3igehMZ4tneDXATcmzaACfZil38ExI9CZaurKn94GurKnLGcJXozXh91rdpOMRospqxF3XY/NgVoVnldwuWQOodLXcgPd9fSdisb5jFlHQIJVtk+spxXYvgygb+cMNMCCtL3WK2LEdagkd4t3cVg26XlhPSOW9V8KimsC95aeYIm5Sf2hkgLH82EQRmcfPYgSRA8otj8r+9sNLyh0+h3Xflc+w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass
header.d=amd.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=SLUbPqwG8qoL4f2BszTyZOEW6ywf65c6kofBmw6T9s8=;
b=mA+R/3SJOuXjtKd8Jio753l3p6lOjdl6g5WayKpBxEy/updpM20vxAxSFxn+Rgp4JAOfrqGqKibNUndz7g8BvmaQdVXOOpx8y+AzMaPtbAdToPFj3U/BXhTI0o/UwjKjNDZT3jF2yqBOdmZ4Nr91AEAFddBB8V5W/q7OrhYbbjw=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=amd.com;
Received: from DS0PR12MB6390.namprd12.prod.outlook.com (2603:10b6:8:ce::7) by
CH1PPF4C9628624.namprd12.prod.outlook.com (2603:10b6:61f:fc00::60d) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8699.24; Fri, 6 Jun
2025 14:41:32 +0000
Received: from DS0PR12MB6390.namprd12.prod.outlook.com
([fe80::38ec:7496:1a35:599f]) by DS0PR12MB6390.namprd12.prod.outlook.com
([fe80::38ec:7496:1a35:599f%5]) with mapi id 15.20.8792.034; Fri, 6 Jun 2025
14:41:32 +0000
Message-ID: <3e022f34-ad65-4caa-9321-c181bb8ae676@xxxxxxx>
Date: Fri, 6 Jun 2025 09:41:26 -0500
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v9 10/16] cxl/pci: Unify CXL trace logging for CXL
Endpoints and CXL Ports
To: Shiju Jose <shiju.jose@xxxxxxxxxx>,
"PradeepVineshReddy.Kodamati@xxxxxxx" <PradeepVineshReddy.Kodamati@xxxxxxx>,
"dave@xxxxxxxxxxxx" <dave@xxxxxxxxxxxx>,
Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>,
"dave.jiang@xxxxxxxxx" <dave.jiang@xxxxxxxxx>,
"alison.schofield@xxxxxxxxx" <alison.schofield@xxxxxxxxx>,
"vishal.l.verma@xxxxxxxxx" <vishal.l.verma@xxxxxxxxx>,
"ira.weiny@xxxxxxxxx" <ira.weiny@xxxxxxxxx>,
"dan.j.williams@xxxxxxxxx" <dan.j.williams@xxxxxxxxx>,
"bhelgaas@xxxxxxxxxx" <bhelgaas@xxxxxxxxxx>, "bp@xxxxxxxxx" <bp@xxxxxxxxx>,
"ming.li@xxxxxxxxxxxx" <ming.li@xxxxxxxxxxxx>,
"dan.carpenter@xxxxxxxxxx" <dan.carpenter@xxxxxxxxxx>,
"Smita.KoralahalliChannabasappa@xxxxxxx"
<Smita.KoralahalliChannabasappa@xxxxxxx>,
"kobayashi.da-06@xxxxxxxxxxx" <kobayashi.da-06@xxxxxxxxxxx>,
"yanfei.xu@xxxxxxxxx" <yanfei.xu@xxxxxxxxx>,
"rrichter@xxxxxxx" <rrichter@xxxxxxx>,
"peterz@xxxxxxxxxxxxx" <peterz@xxxxxxxxxxxxx>,
"colyli@xxxxxxx" <colyli@xxxxxxx>,
"uaisheng.ye@xxxxxxxxx" <uaisheng.ye@xxxxxxxxx>,
"fabio.m.de.francesco@xxxxxxxxxxxxxxx"
<fabio.m.de.francesco@xxxxxxxxxxxxxxx>,
"ilpo.jarvinen@xxxxxxxxxxxxxxx" <ilpo.jarvinen@xxxxxxxxxxxxxxx>,
"yazen.ghannam@xxxxxxx" <yazen.ghannam@xxxxxxx>,
"linux-cxl@xxxxxxxxxxxxxxx" <linux-cxl@xxxxxxxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,
"linux-pci@xxxxxxxxxxxxxxx" <linux-pci@xxxxxxxxxxxxxxx>
References: <20250603172239.159260-1-terry.bowman@xxxxxxx>
<20250603172239.159260-11-terry.bowman@xxxxxxx>
<959acc682e6e4b52ac0283b37ee21026@xxxxxxxxxx>
Content-Language: en-US
From: "Bowman, Terry" <terry.bowman@xxxxxxx>
In-Reply-To: <959acc682e6e4b52ac0283b37ee21026@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: YT3PR01CA0149.CANPRD01.PROD.OUTLOOK.COM
(2603:10b6:b01:83::35) To DS0PR12MB6390.namprd12.prod.outlook.com
(2603:10b6:8:ce::7)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS0PR12MB6390:EE_|CH1PPF4C9628624:EE_
X-MS-Office365-Filtering-Correlation-Id: 6d38829b-1424-4dd4-77aa-08dda5083ac0
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|376014|366016|7416014|1800799024|7053199007|921020;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?TVh1V21vNnJGUVlYZ2c4RUwrYWxkaUFLV1NBSm9uWjd3NmY2Q0pzRWxrZjhi?=
=?utf-8?B?UHlud2NXTHVYQTNIRjRDSURKMFpWZ0MvbXl3YlY4VzBneUI2cWIzcVBadlda?=
=?utf-8?B?K3BzVzZSVkwzRlh2anhpVXpuRVJRZHdIUmM0cWZ4QXNYWFlIeFBtMWYxQlZB?=
=?utf-8?B?M1h1WkYrNXdleENxRTNzY0haRis4bDFFYWlNUThTMVdrcTYydE9NaHZ2VnFi?=
=?utf-8?B?MWhDOGxTbEwxbEtIR3YvUEpHSUR3R3ZGdTNSczFnaEo2V3hPamNtOC8wMWh5?=
=?utf-8?B?Z2FoUWp1R041MHMxeGptdVhDbFlQM0NxWFIrejI2TnZjc3JrMHVLejljeUE0?=
=?utf-8?B?cEk4VTBYZjkzVDBtY0lKbHZ3RmY0MlcrWTR4KzFiMmh6Zkg3WFNpclh5LzVU?=
=?utf-8?B?VDBVRnVZa0tQVUt1bzdrVjhhWDZiNVg3L1pTQjRPQTFLd0pHL3ZnSnZJcXFJ?=
=?utf-8?B?OFFRbi83ZzhFYU5vazdRNWg4TFJNTlM3MUYzMjlYdDgra04ydCtmaWtsS2xZ?=
=?utf-8?B?Z3pUNk5SOFlIbDRHN2tWTldtanlqYzBQbXNqNytTMW1BZ1dGTXROU3MyMXpp?=
=?utf-8?B?VzBJYmRQbExrYXVlcnpCemdMSmFBRWZnR2hHNjJBdXVPbWUwWDFHdTBMbGpQ?=
=?utf-8?B?R0RKTGxaQTBPY3pSNVhMV3dUREpRNmZVMllPY0d0anlCY2FiYmJpM1lpOGhM?=
=?utf-8?B?VWNPQnM1VE5NY0hham5PZUlsbWF0TE1Lc21rVzdIUEtLUVBtc2x1VGp5a1FJ?=
=?utf-8?B?eFNyQ1JsV0EweGUzd1B5b3lrNW5mTlZ0VWFnTDEwa0RNVFhrZWwzaHFuM1FB?=
=?utf-8?B?cm51THVXVXNOOXQvYWZPZUVzVzlKR2Y3WTVENFFQaGhRUEQrdGFqUnEzRngz?=
=?utf-8?B?akNIYm95S1dHM1MwWklJcUZWSkk3c043WEhVd3NFVnd5S0pyV3gxTjRBVXAx?=
=?utf-8?B?YlIxdHY5RUc0bWE1MUVSOHFmWTlaZStraW1YT1h0UjNCbEZENkFnM3BMclpj?=
=?utf-8?B?Q1I2Wm0yUkNpMmhqR21rRlZZYU9qT096cGtGU3lrZTNDcXRGUGwvNDJPNExv?=
=?utf-8?B?Q3ErN3BQb2Nrc1hrelRVdVkvV2ovSk91TDF0dHJKdnAzVlFWMEFWRDZtckNK?=
=?utf-8?B?c3hsUlExU3ExM0tXdWNXd0lFWlZwbkd2MUZjT1REa3lTVGljMXFrOUE3VXpL?=
=?utf-8?B?VjBhQ0JLbkxpdVpZajdaSVZrOFJENmRjdGthU3QwTHBUODBySUdRR0M3Zk9H?=
=?utf-8?B?OTJKQXY5dVF2UUdaeStjaHBZd3lidlBCdkFQME5oeUVzbVUxa1ZacDVQMGw2?=
=?utf-8?B?VEk4UnZRYzhpUjRkK3NzRUgxd3RsLzVmVVB1SVlLL0svQjhWWC9FSVlaWE9S?=
=?utf-8?B?V2JGeG9YQy9oelNRbzBFaW51eHlCVEk0aTgrcVdPVWxpMzVZRkw2UytDTml1?=
=?utf-8?B?S2RqbDF6U3pVRmdTUFJqOXI0WVV3QXBvS2N6RWFxQm9tZ3ZObkxpUDN3Mmhy?=
=?utf-8?B?TUZ4bHV3QlUxS0hLS1hsZ2Q3dkZ5S0R1Wk9YaUQ2c2phUjM0eHdjS2daL29r?=
=?utf-8?B?eTF4Sk8rSnZHUi9SMmhBbU45NUJpcWdyVW51T0J4VXp6ZnlIa0U4d1Y3V0Iz?=
=?utf-8?B?MzVvMXl0cGdZdE9lTkpXcUZydjM2MFJVZXVsU0FVOS9rYnpxSGZ3a2pueVYr?=
=?utf-8?B?RnhnTHFvNnd5UFRaUnZIL2dISGFKZ0M4eXhDSFN6NTJQWDJSY3pBeVU1U2pT?=
=?utf-8?B?TzVrYWVNQzFIWjFwUWliUmtNcnRuMjdsanRtNDAwbGRtcnZsVTFlNitTZk9L?=
=?utf-8?B?NERCbW1QU2U5RzJ6WHgweDY3RTE5OWVESmEzWFJkOGIzN1d4L2hGNnpyRlZE?=
=?utf-8?B?VlFDd2tqTkRocmR0dXV5bVNvVU9nSUtIekl1NUNzWitnV2pUd0FmMzhOSEVr?=
=?utf-8?B?RG1FRVlCemcrbEVpVUgyWDBrNGZzYUJsMnZoZCtIcEJMa3Q2Rm9nZlp1TUZX?=
=?utf-8?B?TkxYVDFRMUd3PT0=?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB6390.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(7416014)(1800799024)(7053199007)(921020);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?a3RYbDJvbFpIZFByRzJKVW15VGFHMk9xZ2YyQi9KN0IxbGFnYXhySWtxcHUw?=
=?utf-8?B?TU5aT2lZYkplSzlwcDAwY3ZOVXdVcW9DMTE3U0NPR1d3MTBFaFloTmJXNEFE?=
=?utf-8?B?a2I0UWdPYis2WFdDNk9yUERKU1VvYitoYmpBdzdUdzgzMll4eS9IdUtFaVZj?=
=?utf-8?B?OG5HdTVEME01RGtVak9ZcHNkTXM2OFBjenJGKy9oV3hQQzNuQzVpN2tCKzJO?=
=?utf-8?B?S3lXNjF1VkpJQ240RU96RnM3blJ1NTZ3U3VuT1hLZUNTTXB4TUkzcUMvbVlS?=
=?utf-8?B?bFVxSTJWbUQ5anArTmVwaUh2dUd1Q3ZFMFFkaHR0aTJKOE1UbXRYQnY5dEd5?=
=?utf-8?B?QWtsUk50MCtUVE1tQjNxK09QZ1grYTQrRXcrdDRlaGE5L0RmUmVnM1RwTGhX?=
=?utf-8?B?amJyWlgrSzFjTklaSU1JNkVMUHFaaGtuY3lJWnRXS3hlTERIVlBPZGZBMlRS?=
=?utf-8?B?Wmt0bkxpODNSM1pTVUQ3Qk1acTRaVHY1TFpGNXJ6WW5rblNRNmRrRmN2R1JX?=
=?utf-8?B?TTcxQU4xc1FrUThSSEludFViRy9qM3pPZEh6V2tYckJLaXFIQjVKQS96YWpN?=
=?utf-8?B?dFdrbUVMNGZkc3Z6d1B4WTVXK3lraVYvTFp1Q01BM3JZK3hubUZlZXBBME9N?=
=?utf-8?B?YTVScmtXc2dEMnRhSnBlQ21ORndWZ2c0Q1kvMlFMcGoxUEU2cTNEZmRHNjlO?=
=?utf-8?B?SnFTS2x6aU9NTmErd2t1dXU2ZDYreXhiVXdWNExhUkFRK0pzakRrWm14T1hF?=
=?utf-8?B?bElNaTBFQ0hqWVdTSlVTWUtjUzE4d2NFK2NFU0Q4c2hCSUpiaG1ZY0cwK1Qw?=
=?utf-8?B?ajVFVHg0NXVERzJMaHZLR3R1UkU1QVpDZWVmVUovNkhDMWJZVm4xNWw0aXRt?=
=?utf-8?B?ZStVZkxMWm9TZjkzY0NHcUpmc244K2Ntdi9ZTVkyNjB6M29YaGprOSsyZGNF?=
=?utf-8?B?UDk4WjREdGplaTJidlFsVGhyVkU3OWljSFErSmtvRFhPblhuRTdRVjBtbFlJ?=
=?utf-8?B?T041Nm9SUSt0V1NkZ1hIS3cwelEzZE9iWnhhMzZGK01kN1g1UlBkS3VRKzV6?=
=?utf-8?B?MldHbWZwaHMwMXlJY1R4VkJGOXZNZXltSTBmZ0R6U2JHQUp2K1ZiMm9zek9Q?=
=?utf-8?B?UVd1ZEFzRERsVjJsWkdCN3NJVERWQVdsdWl4aS9YNUdMRG5zb1VORkxsNXBV?=
=?utf-8?B?emtHQzA3cHFHTFdRdnlUenEyZy9CTVZ1b3pWUWhIaU12T1YzVStFTVh3TkVY?=
=?utf-8?B?anZocHBucXRKZGdWTENRRmEzb2ROa2RqdEpNR2RHT2RrakZhRW8vSHZUVG1O?=
=?utf-8?B?cndyTEFyM3ZNZVU5VTNkc2J4c0x1aitRVDFRbnVGb2N6SUdWUEVqekNCQjNY?=
=?utf-8?B?SHY4ZzR3OEVVaVV4bjIyU3lXMnp6alBxbi81bHFTYkIyVFpBczZDblRUa2lN?=
=?utf-8?B?cjdXd2czOGpmaHlnRjlic1F2eXhydXZwaUdCVTA2MVdVK2FDc0drMlA2VUlC?=
=?utf-8?B?aGxsb1JqblU4WkxGdFAwTnE4WUM4SFpIVnVaWFJzSHFRTkNQMW9IQ3p0ZktD?=
=?utf-8?B?VWp1c2FHaWhsM3BMN3BKQTFia2xZNE1kcytaNW9xYzVrVW9MTmZ2dnBmUDBO?=
=?utf-8?B?V3kwS200M291N3cyc1NOVm5HWk83dGdIRElmWTF4OFhDZlcvNU9lNXZYTHEy?=
=?utf-8?B?aXhhZzRYUi9VeGJtUTNPSnlsdmJYV1o1SDZKcGY3N2ZiM0V1cmFaQlgzYUhq?=
=?utf-8?B?R1krQkJOemhxcHpGaEcxc0ZWRzBVZ1ViK3lpVm15WWtqN1liNHlIbW1zcVdG?=
=?utf-8?B?d21QS0pPM1JVaGwzQUxudGVzQ29uYkRPdkw5Y0plQkV6T3dzcGw5QVVqQTVu?=
=?utf-8?B?Yy9ndktmYnI1emxIQ2FpT2JORGJEOXVQYUMxczdBN2lKRVQ5YW16WUpwU2Qv?=
=?utf-8?B?ZUtFTFppdG4rbzcwQmxjVnRJSDRmOExEeUV1VWpPdDlHdDdvd3N6Z2ZFWnMv?=
=?utf-8?B?SVNOY2NkYThhd2JVdTdwbEtxa2RBQ3FQNmZHcGViTk1zY21URGh2NllsQUxG?=
=?utf-8?B?N3VsT2ppUzlDRUcrRytCb3VuZzZqTVZqc0EyRzVOakgzOFdXLzVodVpIdm43?=
=?utf-8?Q?iZj/wkjDKpuTYYkJ9lVvwxRar?=
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 6d38829b-1424-4dd4-77aa-08dda5083ac0
X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB6390.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 14:41:32.2185
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: QzssbnIBj8I7PC1CQfPBreho6enpVfJ1+riUKwGDI2JylIHycn1UoRSD3tV5nJ14aRY2H+nTes0ZXpzbiLP5EQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH1PPF4C9628624
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/6/2025 4:08 AM, Shiju Jose wrote:
>> -----Original Message-----
>> From: Terry Bowman <terry.bowman@xxxxxxx>
>> Sent: 03 June 2025 18:23
>> To: PradeepVineshReddy.Kodamati@xxxxxxx; dave@xxxxxxxxxxxx; Jonathan
>> Cameron <jonathan.cameron@xxxxxxxxxx>; dave.jiang@xxxxxxxxx;
>> alison.schofield@xxxxxxxxx; vishal.l.verma@xxxxxxxxx; ira.weiny@xxxxxxxxx;
>> dan.j.williams@xxxxxxxxx; bhelgaas@xxxxxxxxxx; bp@xxxxxxxxx;
>> ming.li@xxxxxxxxxxxx; Shiju Jose <shiju.jose@xxxxxxxxxx>;
>> dan.carpenter@xxxxxxxxxx; Smita.KoralahalliChannabasappa@xxxxxxx;
>> kobayashi.da-06@xxxxxxxxxxx; terry.bowman@xxxxxxx; yanfei.xu@xxxxxxxxx;
>> rrichter@xxxxxxx; peterz@xxxxxxxxxxxxx; colyli@xxxxxxx;
>> uaisheng.ye@xxxxxxxxx; fabio.m.de.francesco@xxxxxxxxxxxxxxx;
>> ilpo.jarvinen@xxxxxxxxxxxxxxx; yazen.ghannam@xxxxxxx; linux-
>> cxl@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-pci@xxxxxxxxxxxxxxx
>> Subject: [PATCH v9 10/16] cxl/pci: Unify CXL trace logging for CXL Endpoints and
>> CXL Ports
>>
>> CXL currently has separate trace routines for CXL Port errors and CXL Endpoint
>> errors. This is inconvenient for the user because they must enable
>> 2 sets of trace routines. Make updates to the trace logging such that a single
>> trace routine logs both CXL Endpoint and CXL Port protocol errors.
>>
>> Rename the 'host' field from the CXL Endpoint trace to 'parent' in the unified
>> trace routines. 'host' does not correctly apply to CXL Port devices. Parent is more
>> general and applies to CXL Port devices and CXL Endpoints.
>>
>> Add serial number parameter to the trace logging. This is used for EPs and 0 is
>> provided for CXL port devices without a serial number.
>>
>> Below is output of correctable and uncorrectable protocol error logging.
>> CXL Root Port and CXL Endpoint examples are included below.
>>
>> Root Port:
>> cxl_aer_correctable_error: device=0000:0c:00.0 parent=pci0000:0c serial: 0
>> status='CRC Threshold Hit'
>> cxl_aer_uncorrectable_error: device=0000:0c:00.0 parent=pci0000:0c serial: 0
>> status: 'Cache Byte Enable Parity Error' first_error: 'Cache Byte Enable Parity
>> Error'
>>
>> Endpoint:
>> cxl_aer_correctable_error: device=mem3 parent=0000:0f:00.0 serial=0
>> status='CRC Threshold Hit'
>> cxl_aer_uncorrectable_error: device=mem3 parent=0000:0f:00.0 serial: 0
>> status: 'Cache Byte Enable Parity Error' first_error: 'Cache Byte Enable Parity
>> Error'
>>
>> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx>
>> ---
>> drivers/cxl/core/pci.c | 18 +++++----
>> drivers/cxl/core/ras.c | 14 ++++---
>> drivers/cxl/core/trace.h | 84 +++++++++-------------------------------
>> 3 files changed, 37 insertions(+), 79 deletions(-)
>>
>> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index
>> 186a5a20b951..0f4c07fd64a5 100644
>> --- a/drivers/cxl/core/pci.c
>> +++ b/drivers/cxl/core/pci.c
>> @@ -664,7 +664,7 @@ void read_cdat_data(struct cxl_port *port) }
>> EXPORT_SYMBOL_NS_GPL(read_cdat_data, "CXL");
>>
> [...]
>> static void cxl_cper_handle_prot_err(struct cxl_cper_prot_err_work_data
>> *data) diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h index
>> 25ebfbc1616c..8c91b0f3d165 100644
>> --- a/drivers/cxl/core/trace.h
>> +++ b/drivers/cxl/core/trace.h
>> @@ -48,49 +48,22 @@
>> { CXL_RAS_UC_IDE_RX_ERR, "IDE Rx Error" } \
>> )
>>
>> -TRACE_EVENT(cxl_port_aer_uncorrectable_error,
>> - TP_PROTO(struct device *dev, u32 status, u32 fe, u32 *hl),
>> - TP_ARGS(dev, status, fe, hl),
>> - TP_STRUCT__entry(
>> - __string(device, dev_name(dev))
>> - __string(host, dev_name(dev->parent))
>> - __field(u32, status)
>> - __field(u32, first_error)
>> - __array(u32, header_log, CXL_HEADERLOG_SIZE_U32)
>> - ),
>> - TP_fast_assign(
>> - __assign_str(device);
>> - __assign_str(host);
>> - __entry->status = status;
>> - __entry->first_error = fe;
>> - /*
>> - * Embed the 512B headerlog data for user app retrieval and
>> - * parsing, but no need to print this in the trace buffer.
>> - */
>> - memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE);
>> - ),
>> - TP_printk("device=%s host=%s status: '%s' first_error: '%s'",
>> - __get_str(device), __get_str(host),
>> - show_uc_errs(__entry->status),
>> - show_uc_errs(__entry->first_error)
>> - )
>> -);
>> -
>> TRACE_EVENT(cxl_aer_uncorrectable_error,
>> - TP_PROTO(const struct cxl_memdev *cxlmd, u32 status, u32 fe, u32
>> *hl),
>> - TP_ARGS(cxlmd, status, fe, hl),
>> + TP_PROTO(struct device *dev, u64 serial, u32 status, u32 fe,
>> + u32 *hl),
>> + TP_ARGS(dev, serial, status, fe, hl),
>> TP_STRUCT__entry(
>> - __string(memdev, dev_name(&cxlmd->dev))
>> - __string(host, dev_name(cxlmd->dev.parent))
>> + __string(name, dev_name(dev))
>> + __string(parent, dev_name(dev->parent))
> Hi Terry,
>
> As we pointed out in v8, renaming the fields "memdev" to "name" and "host" to "parent"
> causes issues and failures in userspace rasdaemon while parsing the trace event data.
> Additionally, we can't rename these fields in rasdaemon due to backward compatibility.
Yes, I remember but didn't understand why other SW couldn't be updated to handle. I will
change as you request but many people will be confused why a port device's name is labeled
as a memdev. memdev is only correct for EPs and does not correctly reflect *any* of the
other CXL device types (RP, USP, DSP).

>> __field(u64, serial)
>> __field(u32, status)
>> __field(u32, first_error)
>> __array(u32, header_log, CXL_HEADERLOG_SIZE_U32)
>> ),
>> TP_fast_assign(
>> - __assign_str(memdev);
>> - __assign_str(host);
>> - __entry->serial = cxlmd->cxlds->serial;
>> + __assign_str(name);
>> + __assign_str(parent);
>> + __entry->serial = serial;
>> __entry->status = status;
>> __entry->first_error = fe;
>> /*
>> @@ -99,8 +72,8 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
>> */
>> memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE);
>> ),
>> - TP_printk("memdev=%s host=%s serial=%lld: status: '%s' first_error:
>> '%s'",
>> - __get_str(memdev), __get_str(host), __entry->serial,
>> + TP_printk("device=%s parent=%s serial=%lld status='%s'
>> first_error='%s'",
>> + __get_str(name), __get_str(parent), __entry->serial,
>> show_uc_errs(__entry->status),
>> show_uc_errs(__entry->first_error)
>> )
>> @@ -124,42 +97,23 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
>> { CXL_RAS_CE_PHYS_LAYER_ERR, "Received Error From Physical Layer"
>> } \
>> )
>>
>> -TRACE_EVENT(cxl_port_aer_correctable_error,
>> - TP_PROTO(struct device *dev, u32 status),
>> - TP_ARGS(dev, status),
>> - TP_STRUCT__entry(
>> - __string(device, dev_name(dev))
>> - __string(host, dev_name(dev->parent))
>> - __field(u32, status)
>> - ),
>> - TP_fast_assign(
>> - __assign_str(device);
>> - __assign_str(host);
>> - __entry->status = status;
>> - ),
>> - TP_printk("device=%s host=%s status='%s'",
>> - __get_str(device), __get_str(host),
>> - show_ce_errs(__entry->status)
>> - )
>> -);
>> -
>> TRACE_EVENT(cxl_aer_correctable_error,
>> - TP_PROTO(const struct cxl_memdev *cxlmd, u32 status),
>> - TP_ARGS(cxlmd, status),
>> + TP_PROTO(struct device *dev, u64 serial, u32 status),
>> + TP_ARGS(dev, serial, status),
>> TP_STRUCT__entry(
>> - __string(memdev, dev_name(&cxlmd->dev))
>> - __string(host, dev_name(cxlmd->dev.parent))
>> + __string(name, dev_name(dev))
>> + __string(parent, dev_name(dev->parent))
> Renaming these fields is an issue for userspace as mentioned above
> in cxl_aer_uncorrectable_error.
I understand, I'll revert as you request.

Terry
>> __field(u64, serial)
>> __field(u32, status)
>> ),
>> TP_fast_assign(
>> - __assign_str(memdev);
>> - __assign_str(host);
>> - __entry->serial = cxlmd->cxlds->serial;
>> + __assign_str(name);
>> + __assign_str(parent);
>> + __entry->serial = serial;
>> __entry->status = status;
>> ),
>> - TP_printk("memdev=%s host=%s serial=%lld: status: '%s'",
>> - __get_str(memdev), __get_str(host), __entry->serial,
>> + TP_printk("device=%s parent=%s serial=%lld status='%s'",
>> + __get_str(name), __get_str(parent), __entry->serial,
>> show_ce_errs(__entry->status)
>> )
>> );
>> --
>> 2.34.1
>
> Thanks,
> Shiju



Return-Path: <linux-kernel+bounces-675881-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A8D5B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:43:20 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6FFE47A45AD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:41:59 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F9431B040D;
Fri, 6 Jun 2025 14:43:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cwoObaS4"
Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4C3DA927
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:43:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749220985; cv=none; b=QkjrKq65zBMz2JcOdeiuLwhz3KJEMcPm7nVqQc4K1yyFt1d8EofqGl8pOeoG0mo/L/dXsZmCzOWhQGqkWOUUyv8nUoRLypREzcj45GIRrsLHHbPSrHUsXLDg0bNQfqEJQNQfPcSKhSc9yNH8C8jgqDozHWelr/p+srf5Z/0ZgKw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749220985; c=relaxed/simple;
bh=MRHAloECyV7awIn1pBF28oHNT8VJoNKSlHgGIP6nbFQ=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=bIwlDKRKIbNPldE7Z2EpRJqdR8YjJrX1b7MrkX+GEYYhFD7qpFxOYlyvUWjRR4NVQpU3wGcZ6IeTLerYMJpvMz2opiF6dmcGGTcRB/A4sbtFjqinz7q4KeorM3aIpTxWu42zr+kpp7qkPPtHHee5AISo6CuhtLB21M2Fctz5FOk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cwoObaS4; arc=none smtp.client-ip=209.85.221.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3a5123c1533so1239534f8f.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:43:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749220982; x=1749825782; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=jkwyvK78VqUgKCW7wfISBRdrqwzf1Kodzs7ruamvtIU=;
b=cwoObaS4BzQehWQumYqgocJlbTJAEpXMJa53n5GnofXR4emR1zCbH6SNhnT0hPNZUS
11Xw1kw0Tp6Gr7RTHif21ygLkuzP8K4YWE611IrJi2JRnwP5buDhj+4lEz4i0oYXsK0J
vhgnRzRLZ+4yLjz6MYVTF2ClHoxMiNWb2dfq8HRq/r+CMty9v3jLMOsc9/0Tq6tny9e4
MYBAUb5vfUQtFwVl5LmmWpMof0SmVv4Eq872qTePhyyGS4YSPiZ16bYSUuhUMe9/U/rF
pR1+enHWoRRsBpeHomOZmCLFlo7hRx+iuhInNWtcO2+4ismsXKNCjHi5w8xaW+g/II7M
cW8Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749220982; x=1749825782;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=jkwyvK78VqUgKCW7wfISBRdrqwzf1Kodzs7ruamvtIU=;
b=D5Ru9hGyjhBS53B37ljXqrmWLaB3v5X3SVhg2x4ETeouBF6YS+/h1URaZHx2uFVCiE
6/mfOdeYNgRNJPt0vl4lbE2gdQ3oafFb/zQ7HDvq1RriB74XHkvOqer7lZmk/d0vAkh0
ak3h/jr6gOh12ONpCjkxX7bYIg7ktmoGI1RPql1SkVdkj1AFxfbK9ms8mDvul67SwnbI
lJVwuDQtSX8kGwSVBMODwniS0GA+lxQWOmfXZrSEtxcGO6eRNgfVG/gdGFpRy6xOP6YJ
44xG+8AgSf10V8GaJ0BDkIat2ftmYt3zqNH365Vv1mm5AS/Mu2KtVGlwlp6+sQMDh9oN
gC0g==
X-Forwarded-Encrypted: i=1; AJvYcCXqYn+svvLGbWy1qDeVzpBk9RPEf/LAsmdN/rzIqzt/+QL2UntJ/WeZyQkrip0WlBo+54IF0hIguCJbVXU=@vger.kernel.org
X-Gm-Message-State: AOJu0Yz9qwOLi8Z9umR81rFYXY77YmmKEGw25aQSxPJsaafp9MgXLHay
pBWvehtZywUZ3SddxkfCodrxLyIQIHhPTtjnbMjZcDuVZRirp7j2NENzLKgch1vifCQ=
X-Gm-Gg: ASbGncuwu1/V8PhdLXkuqe8ftC5ZKAWfms4ruAsCQ3DIE1j/9fktXdSl5z3yFgEAi/b
0BKGMzArSu2mGZ61E9FXIOcajvrbUmUxPRbhBVQd7Kqvw3Auk/Ml1706BXrPzN0Ju0p9WZsjo7H
sKMlYaOd+tgoPKO04ZTQ8kSsoCbKzGtWbv4uAm66Vf06oHOkUMP7qLyOheYvrjGIw4YKM9gFZN9
X/lx1EG4xsRLh963k7nxex9KTbfwwpKAjpSxMAa0OYVTDIAPnrr8eIan2+BrHu9hXV0OsKBuIeB
nkku/FDgUofXcEGS4Ij6SRtn5s1VmEl45MT5UXTZbsRpG5y36FbspCRTKDvOqcB/i/4TPN8aD+w
vlSzoHDC3oSrYBq7rure7yjXlNi46m68HzfMrCw==
X-Google-Smtp-Source: AGHT+IGS7Wybf+10qczHDb+s/ZW1EOGQH6Fn273BtwmHQS/UKM1PO+aqhbN+skEAkwby7IIV0ZcOkw==
X-Received: by 2002:a05:6000:26cc:b0:3a5:2ec5:35b8 with SMTP id ffacd0b85a97d-3a5319ba427mr2457378f8f.11.1749220982107;
Fri, 06 Jun 2025 07:43:02 -0700 (PDT)
Received: from [192.168.0.35] (188-141-3-146.dynamic.upc.ie. [188.141.3.146])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53229df09sm2085274f8f.6.2025.06.06.07.43.01
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 07:43:01 -0700 (PDT)
Message-ID: <2ce9f14e-b0cf-41f4-84f0-6e80749b9504@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:43:00 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCHv2] media: venus: protect against spurious interrupts
during probe
To: Jorge Ramirez-Ortiz <jorge.ramirez@xxxxxxxxxxxxxxxx>,
quic_vgarodia@xxxxxxxxxxx, quic_dikshita@xxxxxxxxxxx, mchehab@xxxxxxxxxx
Cc: linux-media@xxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250606123334.4114123-1-jorge.ramirez@xxxxxxxxxxxxxxxx>
Content-Language: en-US
From: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
In-Reply-To: <20250606123334.4114123-1-jorge.ramirez@xxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 13:33, Jorge Ramirez-Ortiz wrote:
> Make sure the interrupt handler is initialized before the interrupt is
> registered.
>
> If the IRQ is registered before hfi_create(), it's possible that an
> interrupt fires before the handler setup is complete, leading to a NULL
> dereference.
>
> This error condition has been observed during system boot on Rb3Gen2.
>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@xxxxxxxxxxxxxxxx>
> ---
> v2: fix authorship
> fix spelling mistake
>
> drivers/media/platform/qcom/venus/core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index d305d74bb152..5bd99d0aafe4 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
> INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
> init_waitqueue_head(&core->sys_err_done);
>
> - ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
> - IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> - "venus", core);
> + ret = hfi_create(core, &venus_core_ops);
> if (ret)
> goto err_core_put;
>
> - ret = hfi_create(core, &venus_core_ops);
> + ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
> + IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> + "venus", core);
> if (ret)
> goto err_core_put;
>

Please add a Fixes: tag.

---
bod


Return-Path: <linux-kernel+bounces-675882-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F078A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:45:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D6AF178649
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:45:53 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 227FD189B84;
Fri, 6 Jun 2025 14:45:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UalTHr08"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 609BC80C02
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:45:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221144; cv=none; b=V9fmehOQfMCptoX6XDyI01nQAFx/zVVrPJ6GXNMc1tY4aYEeY37khAPnOe3pYD4xWicQr2AyJSUiM3OlXPrBe3Qse4byQLG4E0WASoqsnP23H1H1TOUS9U0yrGYam6JHRuxwwreDlwRIYeIhGfEGSHOvRViTsWWy2VZNEsBTsIE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221144; c=relaxed/simple;
bh=EzUrF4o3M+u++YM1SlV6GN9apz/wW+3pWpuP8/sA3sE=;
h=Message-ID:From:To:Cc:Subject:Date; b=OgQQpl4U8D0kYRpQbvRNdNtMB/VvZR4xqYXSbgDU4SPM93gwyvJHqP/LcCAcOjfNXY3F44pMXtF2qj1bMancxpvegCgWKGgda8gngCm7rdm5nk2WLQFScZQYYScG8y/Kbu48nXGQS1Cp7+TsQKBkOvcsK1Zp3GN+OaajAgenmLE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UalTHr08; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BF6DC4CEEB;
Fri, 6 Jun 2025 14:45:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749221143;
bh=EzUrF4o3M+u++YM1SlV6GN9apz/wW+3pWpuP8/sA3sE=;
h=From:To:Cc:Subject:Date:From;
b=UalTHr084XZdgxDpF255f4FPjaW8pAftZab2ek/GqrVyWXVAoyY+dc7aFaE0306YZ
3+fN1E2wYLIaaBdWp5Y1229shVuZuwc9XBSV0fb2VvmjO/QhP4lwzNpBfe4y0zUN8r
dYqO0nr4S+YMyCcqh93tz4TUNJOzcGwBEMz5XU83Hoct003iodSduXhtrrOJCSN1Wb
wILSBovT/t2e38xUaq4GLfkndB2ALxerMawdskCeSXH6tpbqnmp2R808ImDTng/hEI
kU5ghJoWSxop9Wp1vDdCPnRFLbhUopdM+aJ0/Ih5PAHhe7NjCLVNgizTqxCSYdzAvk
eXi5tgn+ZCaiA==
Message-ID: <8d81a11b97b3aa5a588cc136f37bcf25.broonie@xxxxxxxxxx>
From: Mark Brown <broonie@xxxxxxxxxx>
To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Liam Girdwood <lgirdwood@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Mark Brown <broonie@xxxxxxxxxx>
Subject: [GIT PULL] regulator fixes for v6.16-merge-window
Date: Fri, 06 Jun 2025 15:45:34 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The following changes since commit dcd711021389c4d19b3310cc37f09813659dfee2:

fix: Correct Samsung 'Electronics' spelling in (2025-05-20 10:34:15 +0100)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git tags/regulator-fix-v6.16-merge-window

for you to fetch changes up to 65271f868cb1dca709ff69e45939bbef8d6d0b70:

regulator: max14577: Add error check for max14577_read_reg() (2025-05-26 14:01:29 +0100)

----------------------------------------------------------------
regulator: Fix for v6.16

A very minor fix that came in during the merge window, checking for I/O
errors in the MAX14577 driver.

----------------------------------------------------------------
Wentao Liang (1):
regulator: max14577: Add error check for max14577_read_reg()

drivers/regulator/max14577-regulator.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)


Return-Path: <linux-kernel+bounces-675883-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6552441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:46:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4B0C33AB7AB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:45:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 878421A5B84;
Fri, 6 Jun 2025 14:45:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lLSoODYy"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C987C154C15;
Fri, 6 Jun 2025 14:45:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221157; cv=none; b=XrNwtcBOE9IVyXl9MxXoa9JsLYkpS6JON4ibvNluum7eAaabCSi6TIcptGLgJq6E4hNlNe5piQp7Do4zGBzhlPncMUbaZLubED+5FVOMZn2FBOlBH9NuSvIuX1AX0ET90ySp4oSXq0S/Ozst8axBFQ/ThJdDpNbsrNUSeq8GYGU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221157; c=relaxed/simple;
bh=Txq8jZISiD417d1zn4QS/b/3RuXK6f39JxVjGQCMMzw=;
h=Message-ID:From:To:Cc:Subject:Date; b=d0IsVljV4HrD0l6SLGt99hkn5jQw0PVSHNMTW9Nbxj4pT6wM963gzwKzibtAwIUVf3TovKCACLm/yWJ+8MtrxcLny98X3Xei54mIbYSvu/B+Nxf/cB9qazCL2WwLFSWsTR40mmYGbiBgIezsLKHW0RoKKhQrgvHtFvNZV2dnTJM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lLSoODYy; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEA19C4CEEB;
Fri, 6 Jun 2025 14:45:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749221157;
bh=Txq8jZISiD417d1zn4QS/b/3RuXK6f39JxVjGQCMMzw=;
h=From:To:Cc:Subject:Date:From;
b=lLSoODYyUWOjbIT/MJaSXDFdj/X8T2IQeyfUj4kuXvC+xGkqxyGtRn3xejGQu3Yob
WgJxnL89yynfl0UKQRZCplV1GVDKR72WAMWjPBiH3orZQJtLTORpuUDvg7DCx8+D43
xozmngCgTPGWKxosO4YI+kkokSw2HhwfldfNQZAeL4d4Xa7tuEeVB8wRoFpkgDUyZN
2ZeOtuBXRhR2eS8OVSyElmPoh7TuhkmosGzckobKX3n79afmvqTslKcDIZGJe5RBfl
KBvNZBq5WHPPgon0gbVHfS9ObugpUElgvVyZ1KmefFdccsBUIpSm8xF/xkiMlTkP5h
oo4Gfn3txAyUQ==
Message-ID: <6cc76c26f4d4cca79b1f6fa9c7152f91.broonie@xxxxxxxxxx>
From: Mark Brown <broonie@xxxxxxxxxx>
To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: linux-spi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Mark Brown <broonie@xxxxxxxxxx>
Subject: [GIT PULL] SPI updates for v6.16-merge-window
Date: Fri, 06 Jun 2025 15:45:47 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
PP_MIME_FAKE_ASCII_TEXT,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The following changes since commit b00d6864a4c948529dc6ddd2df76bf175bf27c63:

spi: spi-qpic-snand: extend bitmasks usage (2025-05-23 16:51:35 +0100)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git tags/spi-v6.16-merge-window

for you to fetch changes up to 57cf46cd1fe351846e1b065ca9546eef66675ecd:

spi: spi-qpic-snand: document the limited bit error reporting capability (2025-06-02 12:27:51 +0100)

----------------------------------------------------------------
spi: Updates for v6.16

A small set of updates that came in during the merge window, we've got:

- Some small fixes for the Broadcom and spi-pci1xxxx drivers
- A change to the QPIC SNAND driver to flag that the error correction
features are less useful than people might be expecting.
- A new device ID for the SOPHGO SG2042.
- The addition of Yang Shen as a Huawei maintainer.

----------------------------------------------------------------
Gabor Juhos (1):
spi: spi-qpic-snand: document the limited bit error reporting capability

Thangaraj Samynathan (1):
spi: spi-pci1xxxx: Fix Probe failure with Dual SPI instance with INTx interrupts

Yang Shen (2):
MAINTAINERS: Update HiSilicon SPI Controller driver maintainer
MAINTAINERS: Update HiSilicon SFC driver maintainer

Zixian Zeng (1):
spi: dt-bindings: spi-sg2044-nor: Add SOPHGO SG2042

�lvaro Fernández Rojas (2):
spi: bcm63xx-spi: fix shared reset
spi: bcm63xx-hsspi: fix shared reset

.../devicetree/bindings/spi/spi-sg2044-nor.yaml | 7 +++-
MAINTAINERS | 4 +-
drivers/spi/spi-bcm63xx-hsspi.c | 2 +-
drivers/spi/spi-bcm63xx.c | 2 +-
drivers/spi/spi-pci1xxxx.c | 48 +++++++++++++++-------
drivers/spi/spi-qpic-snand.c | 14 +++++++
6 files changed, 58 insertions(+), 19 deletions(-)


Return-Path: <linux-kernel+bounces-675884-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 84B6D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:47:12 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id C2EB617AC39
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:47:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A4FD119D087;
Fri, 6 Jun 2025 14:47:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="drIWyQ+q"
Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 387FB45945;
Fri, 6 Jun 2025 14:47:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221222; cv=none; b=DxMOhanXqlor67beLQ1XPqkSfaGNCksZvFFUVkXUu2V5T90udqF9LYxM3aOQrAdc5i7pnWL0k07MjXWyzXToiFiJJfC9JQ/8VhMz29jwqYw5VSxbI152yDOdgsAyKls5uf2FaOd0Gh5R/nc8fvyNoQBsFuyniMPXlcreSTd0O8s=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221222; c=relaxed/simple;
bh=SpqQZtxYSGSrQiPzmi2CGEM5uyDqqyc0FKFBMT4zdfw=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=ldX5Vi1w4+LDCd/LsaRfiTxSimftltO+GOFxBkTSyYO/Fo6CWU0BHQvyVO6RkeiuyJBpEmWiJjWQE2DJVAjaqYxdOfTXVcy2ydm9RwJyQTKylIpbiGw+zmrYu8SItBJagubC7ogwHvRTkrZym0Mmqb2KbhrhzFjy154haibFLHo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=drIWyQ+q; arc=none smtp.client-ip=209.85.221.43
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-3a507e88b0aso2019907f8f.1;
Fri, 06 Jun 2025 07:47:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749221219; x=1749826019; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=VWfDD2dEf8PJavEnPu/pXfDOZiD1JAykowbebqUXmnI=;
b=drIWyQ+qfMrcbT2jpbjZO8bGumzFqhglxawBfTIDHgRuJ7+ak2cgCNFTDBtGwrQghm
deTGAYjWJNjsDI09jXiUudh6PIGPgRFu3+CQCn0K80ByIWSnZOA8D/39hzA/F3Hk3Ryz
3PL8Zz6BknarIXxkWR8mvqTEfA7m5nO35lSKH+qESTzXDCNzqfpkL0LoeYB60Qr6ZNtn
9GKtzdRlgepRhi5IJp20QPuS5JFhgye5GDyADc2h3jsMvfwVQw+wRTB8EjXr8tQsMVVk
I1qy2mXGmkDU5lTlgXij/8OfEIMKYmTaxBj/2P0lSZNPgJdBfZus8q0U/IbUTQ8T4XaQ
oyQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749221219; x=1749826019;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=VWfDD2dEf8PJavEnPu/pXfDOZiD1JAykowbebqUXmnI=;
b=oBNMTKSX0njyCMigQNSynZyfqiIEIwKTyW3BcuzUMamu6ZhU72zNBOUzRKDJX7yjtb
i2ny2hYwEgm5UgGn4G7Xvra9fHhOgQgcrYfXK0tFShNzk33s9PVeUyGNrSqWZLg8qepO
A6ksuS4p5MqBNKxDYODIJXvcojc9moXsIsQZE4gNsoBP+WRhRsIG0twseSIYhAmS9N/Q
Wcx6QRti7F0OhNoMEGW6jGjLUA4XQj0TrKGa0MFP4JbYsO3Te/qwLhsWAXBuvQqabqvE
HMSXGfSBASsOEBjvC/Qx64942D7KszZNBVOounK5sYtR1iR0Rl9D0QfA7l6dK8pVfSlr
iRWQ==
X-Forwarded-Encrypted: i=1; AJvYcCWepWLoMLqx0D0siRzww467PIQ6zTn1EDpnVx+aqBHuCTpAj+yIJWok7kEI8UY1DE03t+qfcHzbaD+7@xxxxxxxxxxxxxxx, AJvYcCWkgmGkaIsCqFvVpYpbqJMFsz9oCAO3RcJCy2D8Tu3CZaLbyuXJDJVohNexwSvpsSYCGT/rtUWJgJd3lM45@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YyMcCvskdTmLZde0LifriPXnsfLXn00e7siunJlQp5hil6f97s1
ebK4TNhnbDw3zG8B/tXpjl5tBSRU4YUh0jCqJ/j6XBUOwqfoDB3rq5ZM
X-Gm-Gg: ASbGncuX0OHv5KKhS+PdqUhopy3OQaAn6ANN4kbJiaABmrCKJJEo6Zc6YjCmKPxB8QH
Fv/GauRM+cZdLLs+LzhasgMOAyIijrpMwJFcyvzWWfy42s25n7oN05tjLm0Jq6HAaZ0nGIcI4zp
cv56NIItSkK94oSGbR5T/n7hzniIrt6MbEKrM3DHPPUrdlEIEOTWBEPNZrT/FBp0PnLJ14BaDIG
uoaYaBYchqeaYMI+iqMjI2TWAI8tkWERPsUnoab+2iCqZ5kvGoQ0oHN0XPYrGfGvAjlAgkZWH+K
FzhdsBg6NUQJyESUEEkGnMZMH4OprU4unQ3EF8Du0L/dUsllZbn7ZAl5ZppVk8jyKjt0FPpiXhm
1ygr/ESrkoklw37WF4wJsOYGerBf+h8872ac=
X-Google-Smtp-Source: AGHT+IHFZfm7/jlQzgkdQ83hBRHRmGcLyOvphH61w+zpaQfg9JXlMcucPHHvwrU97yp0xV68gJM/VA==
X-Received: by 2002:a5d:588f:0:b0:3a4:eeb5:21cb with SMTP id ffacd0b85a97d-3a53189ec50mr3200568f8f.26.1749221219172;
Fri, 06 Jun 2025 07:46:59 -0700 (PDT)
Received: from masalkhi.. (ip-109-43-113-198.web.vodafone.de. [109.43.113.198])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5323b653dsm2098932f8f.39.2025.06.06.07.46.58
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:46:58 -0700 (PDT)
From: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
To: gregkh@xxxxxxxxxxxxxxxxxxx
Cc: abd.masalkhi@xxxxxxxxx,
arnd@xxxxxxxx,
conor+dt@xxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
robh@xxxxxxxxxx
Subject: Re: [PATCH v3 3/3] ABI: sysfs: add documentation for ST M24LR EEPROM and control interface
Date: Fri, 6 Jun 2025 14:46:57 +0000
Message-ID: <20250606144657.3140262-1-abd.masalkhi@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <2025060632-luridness-carpool-bf90@gregkh>
References: <2025060632-luridness-carpool-bf90@gregkh>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi greg,

Thanks for the feedback.

>> + Behavior:
>> + - If the password matches the internal stored value,
>> + access to protected memory/configuration is granted
>> + - If the password does not match the internally stored value,
>> + it will fail silently
>
> Why is the kernel in the business of adding passwords to devices? That
> feels wrong, and a way to just flood the device with a "try all the
> values" attempt if needed.

You're absolutely right, implementing password-based access in kernel
space isn't ideal. However, this behavior is defined by the hardware
itself. The M24LR chips require the user to "unlock" the device by writing
a password before certain registers become writable (such as the Sector
Security Status registors) and unfortunately, the chip does not provide
any status or feedback to indicate whether the unlock was successful,
which limits what the driver can safely report or validate.

>> +What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/sss<N>
>> +Date: 2025-05-31
>> +KernelVersion: 6.16
>> +Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
>> +Description:
>> + Read/write attribute representing the Sector Security Status
>> + (SSS) byte for EEPROM sector <N> in the M24LR chips. Each sector
>> + has one SSS byte, which defines I2c and RF access control via a
>> + combination of protection and password settings.
>> + Format:
>> + - Read: returns a 8-bit hexadecimal value followed by a
>> + newline
>> + - Write: requires exactly one or two hexadecimal digits
>> + - No "0x" prefix, whitespace, or trailing newline
>> + - Case-insensitive
>> +
>> + Notes:
>> + - Refer to the M24LR chip datasheet for full bit definitions
>> + and usage
>> + - Write access requires prior password authentication in I2C
>> + mode
>
> How "deep" does this sysfs tree get here? This feels like the wrong api
> for read/write to the device, just do it with a single binary file if
> you really want a "passthrough" way to get to the hardware.

The depth of the sysfs tree depends on the M24LR variant. For example,
the M24LR04E-R has 4 sectors, resulting in 4 entries: sss0 through sss3.

I understand the concern about exposing multiple sysfs entries. The
reason for this design is that each sector has its own SSS byte, and
separating them helps reflect the per-sector nature of the access
control. That said, I'm open to refactoring this to expose the SSS
area via a single binary file if that's more in line with expected
kernel interfaces.

Best regards,
Abd-Alrhman Masalkhi


Return-Path: <linux-kernel+bounces-675885-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A30A541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:53:20 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 0478E189DBCC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:53:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E60841AA7A6;
Fri, 6 Jun 2025 14:53:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dI+0Ye+A"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E62F45945;
Fri, 6 Jun 2025 14:53:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221589; cv=none; b=cRTSzoMEBWXkAK/IbMXjrHY2sI8ZIImf6KDT61qxG5ggrnk42gvddYuI+js2N0aY5Uvt+8K6JyhJs+mHGfw1AiPVWpwiBfIqlSLT5HdJuy9Ut90jeh4G8g5Y1Ptvx+YZ0Xv1WE3uIU1yLdDKKJo2lKtV0z07611NLlzOQc5S5+4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221589; c=relaxed/simple;
bh=TcHbFteQOmLGBTjvX6qik4ZH9aSmoF2gCaV1qnEzHEs=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=eqNtqRYh+56WpqTG1RrKJdU9RTqC6qWPKqYkZmYSpJOu/UQbjRfhxUpmOpQQ+5/IIiDJtoT4jmFfkV9e/igIepn743YU/G67FynLDVptQ1nX5UCjIijXvyH+crl8RbTVTz0gl3nZRlRxTdBKRn/jH386gEfa6gj5P6KBK0KqjKI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dI+0Ye+A; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ED27C4CEEB;
Fri, 6 Jun 2025 14:53:08 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749221588;
bh=TcHbFteQOmLGBTjvX6qik4ZH9aSmoF2gCaV1qnEzHEs=;
h=From:Date:Subject:To:Cc:From;
b=dI+0Ye+AGlZIaH/LY1u7ma22xgJn7KvgemittR6jP5yziMo9nnkajES+zuH79aYo+
gpVnmRjPOgcWmWHPYwNZLY49I9zzd40rSPJ/m5qyMCHAabaxWfsE0qsO9rhgFh7zJ7
8gv+WuKNH7svThgQ/GeAWVvt2IqakwIkIV/Ucz6lX9XxEwQL1W0BUWkm+jTLmvYmd/
hyopqgm+mrSl28br7RKDPRBjt/D4F80WrPG75l938RoJuGq2sy0t/ljYiXof/G60hH
MLlNBTky/+Ro44yqw3expGOKqchH1DXLImcKd1EdadqUOj6IGplLMe3A6hz6on8onz
N0lrSXJAVki/w==
From: Maxime Ripard <mripard@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:53:03 +0200
Subject: [PATCH] media: bcm2835-unicam: Remove RGB24 support
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-rpi-unicam-rgb-bgr-fix-v1-1-9930b963f3eb@xxxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIAM4AQ2gC/x2MSQqAMAwAvyI5G2hFK/gV8dAl1hyskqIIxb9bP
M7ATIFMwpRhagoI3Zz5SBV024DfbIqEHCpDp7pBGWVQTsYrsbc7SnToouDKDwbtzNobOw42QI1
Poar/8by87wcQphAQaAAAAA==
X-Change-ID: 20250606-rpi-unicam-rgb-bgr-fix-d1b6f46a75ad
To: Raspberry Pi Kernel Maintenance <kernel-list@xxxxxxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>,
Ray Jui <rjui@xxxxxxxxxxxx>, Scott Branden <sbranden@xxxxxxxxxxxx>,
Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>,
Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>,
Hans Verkuil <hverkuil@xxxxxxxxx>,
Jean-Michel Hautbois <jeanmichel.hautbois@xxxxxxxxxx>,
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
Cc: Naushir Patuck <naush@xxxxxxxxxxxxxxx>, linux-media@xxxxxxxxxxxxxxx,
linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, Maxime Ripard <mripard@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=1907; i=mripard@xxxxxxxxxx;
h=from:subject:message-id; bh=TcHbFteQOmLGBTjvX6qik4ZH9aSmoF2gCaV1qnEzHEs=;
b=owGbwMvMwCmsHn9OcpHtvjLG02pJDBnODBcdQnQ+MO74st7wm4N2jPGUE8frxWuEpXdsn7D88
bbGp2xXOqawMAhzMsiKKbI8kQk7vbx9cZWD/cofMHNYmUCGMHBxCsBECl4yNhxzmWem2pHb0W8z
8X/Ay9isuX6arzVjHykLq+0vjZTk423b9+R2ndlZueavVzgfCi6fyVim9C7/7AT/d99+ySU92mx
mEPD+kpbb9gZPJY5VXTsVLismFtk9q1ooNbnhLH+6hY6cAgA=
X-Developer-Key: i=mripard@xxxxxxxxxx; a=openpgp;
fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The RGB24 V4L2 format is defined as a pixel format with 8 bits per
components, with the components being in the red, green, and blue order
from left to right.

The RGB MIPI-CSI2 is defined in the specification (Section 11.3.1,
RGB888) with blue coming first, then green, then red. So the opposite of
what V4L2 means by RGB.

Since the hardware cannot reorder the components, this means that when
selecting the RGB24 format, you get inverted red and blue components
compared to what you'd expect.

The driver already supports BGR24, so we can simply remove the RGB24
format from the driver.

Fixes: 392cd78d495f ("media: bcm2835-unicam: Add support for CCP2/CSI2 camera interface")
Signed-off-by: Maxime Ripard <mripard@xxxxxxxxxx>
---
drivers/media/platform/broadcom/bcm2835-unicam.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
index f10064107d543caf867249d0566a0f42d6d8c4c6..1f549019efd53c9aae83193e74f1a3601ebf274d 100644
--- a/drivers/media/platform/broadcom/bcm2835-unicam.c
+++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
@@ -338,15 +338,10 @@ static const struct unicam_format_info unicam_image_formats[] = {
/* RGB Formats */
.fourcc = V4L2_PIX_FMT_RGB565, /* gggbbbbb rrrrrggg */
.code = MEDIA_BUS_FMT_RGB565_1X16,
.depth = 16,
.csi_dt = MIPI_CSI2_DT_RGB565,
- }, {
- .fourcc = V4L2_PIX_FMT_RGB24, /* rgb */
- .code = MEDIA_BUS_FMT_RGB888_1X24,
- .depth = 24,
- .csi_dt = MIPI_CSI2_DT_RGB888,
}, {
.fourcc = V4L2_PIX_FMT_BGR24, /* bgr */
.code = MEDIA_BUS_FMT_BGR888_1X24,
.depth = 24,
.csi_dt = MIPI_CSI2_DT_RGB888,

---
base-commit: 0ff41df1cb268fc69e703a08a57ee14ae967d0ca
change-id: 20250606-rpi-unicam-rgb-bgr-fix-d1b6f46a75ad

Best regards,
--
Maxime Ripard <mripard@xxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675886-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 876E141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:53:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B559817833C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:53:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 30F1A1CEAC2;
Fri, 6 Jun 2025 14:53:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="K5tFHyqy"
Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86FB81B042E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:53:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221615; cv=none; b=mA3M1/Tl3adGrvVqqnAZfRQ5p/LAmOdgv+J0zY/YDzT0cyisaJsAg4u7MjGUns7ZX85lNjRdoXk9I9z4JYriV8rdinnDAZETWluZxJo1JyC5QWgJuEzzjS+H/LE4PwXTnCXBtOS+GhO2VSl7BGNF7KQDTsa+LTtDwx3nRhqbmbE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221615; c=relaxed/simple;
bh=w+Omoq+vlVHzV4IfFXuuzmED1zDs8T0KXnjptRaXDI0=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=D1EfnNujaxdS2iiy2bxaWfEZIEymWF83+Xr3g4DZiWU/Mpf7liJiQ4sgeA5FttGXxcERmwVzpuRRcRWKIhe/Ya0oRnP7vHLr+cWR1PfaFJMf5kVq1iXUKhj8OlZ0roskAcUPDritDExmeX2+UPiXROK5GhMEFjggbtOci+Rilbg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=K5tFHyqy; arc=none smtp.client-ip=209.85.221.44
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3a4fd1ba177so1632348f8f.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:53:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749221612; x=1749826412; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=kuzIRk+RYz/0vZCl8riGldIGv+a0bdZGEeVS47CS15M=;
b=K5tFHyqyz+Li74bh7idNremcXgPsTTUyBe+sOReCL+i/RLieixawvXkeMkYNcKZLJr
4J/fusH1Js21c4jc6NHAwX6jZRtFM66/58X9AioEjIzX8CacYfj2BUz8nIkWzkzTUURf
9k/L9iCUO8GqOJ0AIuXpn2K0erbw+Ikqj6fWkBOW8q7/Lw6ngVCbR6q6WTUghOogXRCl
w+lA+GrBbNN2Igm3ZJXS0L2UxF+Y1s7+QgMSE3vvG5beCl1/FwUhcGNQNPxuITd0qu4r
4NooCi1TPZMi9Wj5zyWsLMwboQnzGKwlnYoEME/Ri13j0Y7q95E6wz83TYGBJZLlbEmI
RCjg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749221612; x=1749826412;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=kuzIRk+RYz/0vZCl8riGldIGv+a0bdZGEeVS47CS15M=;
b=I3f3iB7GQGLc/sY4imRtcfRP2Sff2Pu0NkAO6buYr+LCaxGOYjTA1BzSE70UzoX62a
HAq6vxnWo7JBW98deam5m4teHySarWmEAHWSBdX+IsjH8JZeEi+WjvyNHnRihcN5A0NL
i/kUIBUt44RJnGbU2meA6BARMzHRtAJMz8or/+Mr0bCYytgTzQrMxURWBm8M0EQbidwC
yu0pApKxeBSaTw7riQ3rkKAz9t4/lOh9tNFCEc2zsKMyQordJteh7APFTyqDZrs3wReq
BNtnA49qeKUcKBxo4DKQdkI/sxT33GNzuaC9xyXzFIJMoJsLOXSt1CQBz5GSn1fBizfQ
FP8Q==
X-Forwarded-Encrypted: i=1; AJvYcCUqhd88JCFC9I0W76ds0Ixw5LfIini/+RHuYkPavACTdw3NI3/wfO4YiffeyfJa8ffTOXVQBgLaIAYR0dI=@vger.kernel.org
X-Gm-Message-State: AOJu0YwMhC+4vMgd1hkQM/EXrub+60r1HSoFq4hCwctPE8CupD2uBomk
8nHmLjx2yNpJnMRKCRCUfD/jVTPjwKs1lyhpcCFAKSvKcISeOL5hA8c+/g8r6qY4isY=
X-Gm-Gg: ASbGncs3sa763Jkmw/qTLUpFuS3Y6sOlY3JpWfVJfPJsREPaeIWbBO2xZsbdKizQWFF
SIyuzhegD+mOAENqsDOVxgwgL/KePEfYerPPaJ637cHD8OCAq34d/hsJ/HGHlJWRUyLr67SVyYv
6UImil0ZxSpELe32OSCSaBqobCvs4KmToKBlOGE06k7puRVmBPyutiLZoM1pkZz+2T2xW/ESAUo
xkPlJrp0xPvynfd2MG+cvuw+69LWgeMrYkRD+STjIa1YuYldpstDPrUChH2d0gwc0lzVuG2jHm2
S34XXkOSUTfTqlGqjzqyBRW+ve92bfNKr9qnmJkWp1d/4bzSUnwAYU6LY+kA/8/xKVyg0+aM58p
Q+jw8q7KoUkkA9Yon
X-Google-Smtp-Source: AGHT+IHJ08jeEQm4SYRJvPv9bX9J+DzKe5Je/h7iSbK4gB1S4kbI0xJWpsKEGlbxxh3EeBz1RwbNiw==
X-Received: by 2002:a05:6000:2203:b0:3a4:da0e:517a with SMTP id ffacd0b85a97d-3a526e0cfa0mr7685880f8f.23.1749221611820;
Fri, 06 Jun 2025 07:53:31 -0700 (PDT)
Received: from [192.168.0.35] (188-141-3-146.dynamic.upc.ie. [188.141.3.146])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5323bee86sm2058411f8f.43.2025.06.06.07.53.30
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 07:53:31 -0700 (PDT)
Message-ID: <fa6a7983-27bf-40db-9843-0891bdadf523@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 15:53:29 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 0/3] media: venus: enable venus on qcs615
To: Renjiang Han <quic_renjiang@xxxxxxxxxxx>,
Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Cc: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>,
Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio <konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley
<conor+dt@xxxxxxxxxx>, linux-media@xxxxxxxxxxxxxxx,
linux-arm-msm@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>
References: <20250530-add-venus-for-qcs615-v8-0-c0092ac616d0@xxxxxxxxxxx>
<wmri66tkksq6i3hfyoveedq5slghnnpozjzx6gck5r3zsiwsg6@xevgh54rnlqd>
<285cae4a-219c-4514-818f-34c8225529de@xxxxxxxxxxx>
<5854a587-aba7-4e71-87f8-249ba00cbc59@xxxxxxxxxx>
<996c9a39-5520-4b43-adfa-06ce29223ba0@xxxxxxxxxxx>
<713b87cb-0003-4ee3-a599-9cd41629bb42@xxxxxxxxxx>
<7aa36a0f-6741-40c2-93f4-036823d245fd@xxxxxxxxxxx>
<247002c0-ee68-4d0d-857a-768bf68bce75@xxxxxxxxxx>
<d5aee491-3ba2-4beb-8b8f-4ba8372e6d16@xxxxxxxxxxx>
Content-Language: en-US
From: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
In-Reply-To: <d5aee491-3ba2-4beb-8b8f-4ba8372e6d16@xxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 06/06/2025 14:32, Renjiang Han wrote:
>
> On 6/6/2025 8:56 PM, Krzysztof Kozlowski wrote:
>> On 06/06/2025 14:51, Renjiang Han wrote:
>>> On 6/6/2025 8:44 PM, Krzysztof Kozlowski wrote:
>>>> On 06/06/2025 14:37, Renjiang Han wrote:
>>>>> On 6/5/2025 8:34 PM, Bryan O'Donoghue wrote:
>>>>>> On 31/05/2025 01:05, Renjiang Han wrote:
>>>>>>>>> Note:
>>>>>>>>> This series consist of DT patches and a venus driver patch. The
>>>>>>>>> patch
>>>>>>>>> 1/3, which is venus driver patch, can be picked independently
>>>>>>>>> without
>>>>>>>>> having any functional dependency. But patch 2/3 & patch 3/3,
>>>>>>>>> which are
>>>>>>>>> DT patches, still depend on [1].
>>>>>>>> I'd say 2/3 and 3/3 still depend on 1/3, otherwise we can get video
>>>>>>>> core
>>>>>>>> on QCS615 over(?)clocked.
>>>>>>> Agree, so we need to make sure that the driver patch is not picked
>>>>>>> after the DT patch.
>>>>>> This statement is confusing.
>>>>>>
>>>>>> 1/3 states that there will be a fallback if there is no OPP table
>>>>>> present.
>>>>>>
>>>>>> Giving the code a glance, I believe that is so, freq_table should be
>>>>>> used if there is no OPP specified in the DT.
>>>>>>
>>>>>> I think we are having a hard time here understanding what you are
>>>>>> saying.
>>>>>>
>>>>>> My understanding:
>>>>>>
>>>>>> - venus modification is standalone 1/3
>>>>>>     Qcs615 will fallback if no OPP is present
>>>>>>
>>>>>> - dt modification 2/3 3/3 is therefore also independent of driver
>>>>>>
>>>>>> ---
>>>>>> bod
>>>>> yes, let me re-spin this with driver patch alone. Once that gets in,
>>>>> will bring in the DT patches.
>>>> Did you read my feedback? There is no "once that gets in". DTS is an
>>>> independent hardware description and your patchset claiming there is
>>>> dependency is just broken.
>>>>
>>>> I am repeating this since few emails, so shall I NAK it that you will
>>>> address the main issue you have?
>>>>
>>>> Best regards,
>>>> Krzysztof
>>> Hi Krzysztof
>>>
>>> SC7180 and QCS615 use the same video core. Only difference lies in the
>>> freq_table for the video. Freq_table is generally determined at SOC
>>> level.
>>> The Venus driver does not currently handle freq_table compatibility well
>>> across platforms. This patch enables the driver to use the OPP-table
>>> from
>>> the DT, addressing the frequency compatibility issue.
>> This does not resolve the main problem at all. If SW cannot use the
>> fallback alone, your fallback has no meaning and is not only confusing
>> but actually incorrect. And based on previous statements like
>> "overclocking" it is not only incorrect, but even harmful.
>>
>> Best regards,
>> Krzysztof
> The fallback is only triggered when there is no OPP table in the DT.
> Since the QCS615 DT will include an OPP table, the fallback logic will
> not be used.
>
> Also, if the freq from the freq_table and the OPP table are the same,
> would it be acceptable to drop the freq_table from the driver?

If you drop the freq_table, you will need to apply OPPs for the sc7180
to DTS first before venus or you'll break sc7180.

I think TBH you should add a freq_tbl for QCS615 and make it so the
order of patch application doesn't matter wrt adding OPP support.

- Add QCS freq_tbl
- Add OPP support

Then do whatever in DTS, nothing can break in this case.

As we've established the fallback isn't a fallback because it falls back
to wrong data, so lets fix that.

---
bod


Return-Path: <linux-kernel+bounces-675887-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6AE8741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:54:29 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1AD7B3B0113
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:54:07 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C07B21C5D44;
Fri, 6 Jun 2025 14:54:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VWYoKYaw"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18])
(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 C9D1F17B50A;
Fri, 6 Jun 2025 14:54:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.18
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221656; cv=fail; b=pp56++FE4g/d4lBo6kusVX2yriEYgWyrFci9eiqQ2ZzkVSGJWVbX94DBu4aGwhVbDxGH748QlCocb4JhkySQaMxUxIm3dwcqo8Ju0SBvVfee0Yje+knRI5guDAi6BKkQTojA8DIXY/BieOiFc4Qq3hr+5sGyqsLID6LjeYNHK78=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221656; c=relaxed/simple;
bh=Ar96aFkUDG1FlAGaPEoh+H4OCJUv53jQ0kzRtxaX8kk=;
h=Message-ID:Date:Subject:From:To:CC:References:In-Reply-To:
Content-Type:MIME-Version; b=uvrGyvCA8DitShFxRX2Ni2Qm2Yx0C+7BxIFURIW1MGT7wUh3Z+iCTO/vzgyLaYHA4Kg+t1c/IDfTC7wPq29uq9/BMUdNbac7fGz2Wv939piN7Wa0PRkH4Gq9+xyLuQHUpBBLI5jzrc8altHZJk6OF5HID4PDzn3YiRZndF0dixw=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VWYoKYaw; arc=fail smtp.client-ip=192.198.163.18
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749221655; x=1780757655;
h=message-id:date:subject:from:to:cc:references:
in-reply-to:content-transfer-encoding:mime-version;
bh=Ar96aFkUDG1FlAGaPEoh+H4OCJUv53jQ0kzRtxaX8kk=;
b=VWYoKYawiy4LBj27B/PFLpog8RmmifeadhPM8GSzLLygX6hfFPUJJWbD
1mrCheqR96UaF0hUA+xH2GFaP4XwO+3jimwZl5/qBETF1qhn8svaCd15Z
Y8WPHGq+zSOJqi0TeHjj6yMp0VUO6wwpRCkRTH1DZEcfeFQRUApkDJE7n
BtK1nfA4vlvsdWcFOojz4qijWHpQxQtcZO5T77yQt3zCt64NDj1YhS0Zq
8voT8blauSoVaUmoZIwFHIIdsMLcjyXVkqjOHFDT5JOcLe7BdUlxLTM/i
vru0yn0gPMjLGgGpP7yBc83w3XGazfRl4BJc2hMdavrciX438exkQBUUN
A==;
X-CSE-ConnectionGUID: 7i7nDbEeTcqTcP35aOOK7Q==
X-CSE-MsgGUID: 6QLGK9RITumBkE8qM1cyDw==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="50603167"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="50603167"
Received: from orviesa004.jf.intel.com ([10.64.159.144])
by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 07:54:14 -0700
X-CSE-ConnectionGUID: +RP9AxKHRy6I1Ul77lTPNA==
X-CSE-MsgGUID: 7pJp6GfPT+W0H4zJInSGnQ==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="150855865"
Received: from orsmsx902.amr.corp.intel.com ([10.22.229.24])
by orviesa004.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 07:54:14 -0700
Received: from ORSMSX901.amr.corp.intel.com (10.22.229.23) by
ORSMSX902.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1544.25; Fri, 6 Jun 2025 07:54:13 -0700
Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by
ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1544.25 via Frontend Transport; Fri, 6 Jun 2025 07:54:13 -0700
Received: from NAM10-DM6-obe.outbound.protection.outlook.com (40.107.93.66) by
edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.1.2507.55; Fri, 6 Jun 2025 07:54:12 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=JlrlAcNP1ZNKB4b2oasNskPbrGze4NpHxyoPMJeRSLRc7dIaVXIodRft+hqXk9FRMycajGxLXntjKEsbH0iqJuAFXFQzRoOv3Mtxhl0q06RSLQ2G/RKu9rFm9SgMb9GY4nfu5ykPE1x5e4w+f8uFaDE6hdMko8s94lZ7mHdTJejfKJzn5//9D7HNykNWFPOqs9KGIBwdRp9JuGTzeCPQETJ1MclUtfMnsjXUWfEnzQ/m804pH8fBIA2R+jkTUM34KCiTb6uxGyRGfK+QQY50sVojfQqKmkPd+AfaL12iMYDTdO/L1rkQ+8oc8gxHkKC3dhH4XSMqUOLL3UfBo0EghQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=Qhm0Ab8mMGAvMqyE/X3kpNNa6NJmiMerokqfdQgZVpk=;
b=Kh67tJQ85Ed2KTci96KkMt2WOg8JJ+BoRo2J9eOPeSbPva1ONq9n9l9Li/YRh2MhjSHLYeE0xmj1IXdSy1dqN4URsV8BXuCrNZzDHewyPZh2UR7ByavJaJyT4OvxjIXTfen6cxzLTJMLIhjlOHWyER2OYI4CFl1b2MwVnU5F3lttPkDHBCqVL8d/qd4r33VyqQFr28wcW8LJv4xTmJpFca9qUCQ3XbvjBawenOio8P96CpcyPkBIxK9sIXPffYtJo6MCZSVAIzFglUIbjVF+yovXEqSWd/aavZ0a22BMNiqDWk5SzKzli4D2gmviQXt0wboDErzQTdDdgPH8BeJtDQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
dkim=pass header.d=intel.com; arc=none
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=intel.com;
Received: from PH7PR11MB6054.namprd11.prod.outlook.com (2603:10b6:510:1d2::8)
by IA3PR11MB9447.namprd11.prod.outlook.com (2603:10b6:208:571::6) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8769.37; Fri, 6 Jun
2025 14:53:57 +0000
Received: from PH7PR11MB6054.namprd11.prod.outlook.com
([fe80::a255:8692:8575:1301]) by PH7PR11MB6054.namprd11.prod.outlook.com
([fe80::a255:8692:8575:1301%6]) with mapi id 15.20.8813.021; Fri, 6 Jun 2025
14:53:57 +0000
Message-ID: <5ad4a1c1-e04d-4773-a739-c21b1df41aed@xxxxxxxxx>
Date: Fri, 6 Jun 2025 17:53:50 +0300
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH V3 1/1] KVM: TDX: Add sub-ioctl KVM_TDX_TERMINATE_VM
From: Adrian Hunter <adrian.hunter@xxxxxxxxx>
To: <pbonzini@xxxxxxxxxx>, <seanjc@xxxxxxxxxx>
CC: <mlevitsk@xxxxxxxxxx>, <kvm@xxxxxxxxxxxxxxx>,
<rick.p.edgecombe@xxxxxxxxx>, <kirill.shutemov@xxxxxxxxxxxxxxx>,
<kai.huang@xxxxxxxxx>, <reinette.chatre@xxxxxxxxx>, <xiaoyao.li@xxxxxxxxx>,
<tony.lindgren@xxxxxxxxxxxxxxx>, <binbin.wu@xxxxxxxxxxxxxxx>,
<isaku.yamahata@xxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<yan.y.zhao@xxxxxxxxx>, <chao.gao@xxxxxxxxx>
References: <20250425075756.14545-1-adrian.hunter@xxxxxxxxx>
<20250425075756.14545-2-adrian.hunter@xxxxxxxxx>
<e5ede906-0dd2-4f41-86e1-1364c8321774@xxxxxxxxx>
Content-Language: en-US
Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki,
Business Identity Code: 0357606 - 4, Domiciled in Helsinki
In-Reply-To: <e5ede906-0dd2-4f41-86e1-1364c8321774@xxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: DU7PR01CA0010.eurprd01.prod.exchangelabs.com
(2603:10a6:10:50f::23) To PH7PR11MB6054.namprd11.prod.outlook.com
(2603:10b6:510:1d2::8)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PH7PR11MB6054:EE_|IA3PR11MB9447:EE_
X-MS-Office365-Filtering-Correlation-Id: e89336d0-1cc9-4ca1-428f-08dda509f694
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024;
X-Microsoft-Antispam-Message-Info: =?utf-8?B?R2V0YUR0WU8yUXdyR0ltaWJKakN0bStNQlo2VFNXb2RXNEc3ejkrQ2NTcENS?=
=?utf-8?B?MXBNOUlLYVJrN28xNEp2N09EV0RpdWZNVG15QWQ4T2EvVlNBOWY1WENvZEg3?=
=?utf-8?B?d1B3amhLNnBxVlNmOGNHUmpaeUFpZ1RKdkNoQi9zdG9zYXFZSkU3OTZncHJk?=
=?utf-8?B?eEJXVEVvdkFMK1Q2Q1BaL21CQnA1bzdlWnBXTE9NOFkxdTZweDBzdzAwaTV0?=
=?utf-8?B?YnREb1Rra05tTGxjK0ZBdDdOZmlMQ05kQ2tTdGFxNnU2bVRvNzI4ejBzWGY1?=
=?utf-8?B?clB4Q245VEoyd2xWWVNaU2pzNDhHd0l0L2o3cFI3QVMxTkVBWTJBT2pZZ2p6?=
=?utf-8?B?ZDJLT29JMXhTUkpMbUhUZFdWdHkyK2YzNlFZR3l4MFh6MUJsN2lQQjFQU3lH?=
=?utf-8?B?dlM5L0lJcDJoZ2kxN3FDOTVtUjY4djErdW5sbTdaWHU2OEpxUlhwaWdra2d3?=
=?utf-8?B?MFAwSVpqRExxemVTZG1DN09WakJUZkpQS3UvREZpdGhjMzhpMzRTV1AwRzhF?=
=?utf-8?B?VE9PZUJHZjJ4ckcrUzJQTXovRE03YjQ1NW5Zb0VudHVIVlpqcmZibTA1cVlK?=
=?utf-8?B?RFcwYjhXV1ZCWCt2NE5CZjNISXdqQlpCU21EUDBnRVdveGIwK1JMSmkxM082?=
=?utf-8?B?eU1POGdTZVJoL3Z0ZTlkMnFjRWUxWGNncVdBTEVxRUYvS0E2RzZBTjlpOGoz?=
=?utf-8?B?U255UjNubE1tL1ZWSmFXTzBQSStHRFFOK1gvK3laS3BGWmZ3eXM2RitESExL?=
=?utf-8?B?Y1JaWkx2d2FxK1piU1gvTzRQOFJTYTdjaGMwdEhGdThUb2MyazlITFNkREtn?=
=?utf-8?B?N040NHRBNG52UWxLNHFWRWYzaWlibUtKL1Fxa3BHcGZJcnI5aGlXRUJvNjdO?=
=?utf-8?B?Ulg3UWpWd3lEbVdXWVhyVERYenpaOGdqdWdrVXY4VGtQV3N5QXIycVRLUDJp?=
=?utf-8?B?QXJiRnM1cS8ySno5YmZLRlluZ0hkcGJYL2h0ZUQxUUFoM1kwUWJiOGN3RkR1?=
=?utf-8?B?UUVzTWtqbjRPMjZwL1VGRWpwMTYwZll2RE5Ud2lXMHpONjNpUzdnTE5uU2Iv?=
=?utf-8?B?WGZGaG0xWVJTSVgrblBGWEI0cWNFR0xISmZYeDNjaUpvbzlRaHBwRlI5bDhU?=
=?utf-8?B?RHJrYVh1ZHFlYnhzTnZqVzN5RlpqQlgvV1h2ajVIUmRpbHphVEZ6MVR6UjRV?=
=?utf-8?B?OVNNT1l5Z0UycWxERjNQSUsrWGpyWHF6K2h0RCtBU2daWVIyNmVYMnlmYzZv?=
=?utf-8?B?bXZpZlNIVEEzOG9ZSnJpRHhyeG9ORFltTG9jQytENnlaa3NUaGxJdlRKb3JC?=
=?utf-8?B?d3gwZFlFTENzdFlaaFFDOGp2V1B5UzE1NGNvb3BRejFjSEgycWJoVXpNbjhD?=
=?utf-8?B?OHd3N2ZUbVE3U1FFK28zV2tXVGl4c2JrenJ3bGhGaGhkL1FWRVhjQWkzcStJ?=
=?utf-8?B?RmZWRDhpRmlCZkg3bTNpZXRIY2hxUVkyYml6WEdSVm04L0ZnOStvTC9vK0Qx?=
=?utf-8?B?cTR1Z1dNaDg0Vm5KN0x6Z3o1TjdnQmFRNHk2SnRKdTk2aG1qbk9jMnU4YzNE?=
=?utf-8?B?YzZ2YytGNlQvMFV1bDFyQUQyVkxKUEJkM0I4ZURORllsSkppbkszejBCMkNk?=
=?utf-8?B?eGNQSU54UUkvOGNKeUVoSXRYL1YwcjF5TlZaNTRVQ1ZzcHBSQ1pkb2RQM0hX?=
=?utf-8?B?aitEWDhINkZnZ2tUb3k2RmxzU2Z0alRyYzlmSVYwQU1XdldJeDBiSXpKc0Rt?=
=?utf-8?B?ckUrSm1lTnlPbXhVSTFwVSs2RDNOd0d0ZGI2Vll3eGExQlpTaE9lYUxWVDhT?=
=?utf-8?B?Q2x0d0gwQU5WdVJQbElmR1FiS1gzLzFuV0l2dXV5elVEbGpqUTZwWXlOYTBz?=
=?utf-8?B?R2hxUjVsTzdnalZDNThWTDZnbXpKdnJ5RWZkNS85eDJVc2J5cWNJNzNObUZX?=
=?utf-8?Q?H9audyxvsLE=3D?=
X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR11MB6054.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MkdObmxKUHd1UC9xbGRTdFdsMTFuRWp6ZFMwS1dlZTJlVTBzcTBFUkxwK2NM?=
=?utf-8?B?NW5ZNEcrc05aazhkQ25HeXNBaXlQWU96VmIrOVYxUEFGSDFjMmJuUUxvOXo1?=
=?utf-8?B?V3RsT1AwUkFKNXpaYzVTOFRhZmZteU1nY0ZVV1pUdGcrYUdkVTRGZjAxVGV3?=
=?utf-8?B?U0V4dmhNVkJ3d0REbTdqNGtvZXNhZWxsSFloM1oyK0ZGaW9zczI5SitvWjNL?=
=?utf-8?B?ZWcrTm1UeEYxT09Gb3pUOFd6dWZraXBsdUpvbllCMU96Y2hsbnVtQUFxeSta?=
=?utf-8?B?bW9DMFRweUczYlhSeGNRWmt6V3JKOWdMTXNWVVpPa0RpOTdtczdhYi81Szky?=
=?utf-8?B?UXhTVkdLMTBsV3ViVEFZajM1eUVmUm9GSDYxVEFmWnZhK1RKQ0E0ODQzTVQ5?=
=?utf-8?B?Y21teUxIenJzdjZPalQ1cmU5NXZTcW05Qjk2cmhCcFd5Y3JFVkRZVDJqVU9B?=
=?utf-8?B?eEhWQ05qTUhXdDlvRmpZZFRvR1pTRTFDTE5GZFM4cURuYW43ejBGOXcrQkl2?=
=?utf-8?B?R25DWDM0VkxXdHg5TXBydWc4SS9xUzFnY2xGekNyUXRuOUpwa3hUMlROTlQy?=
=?utf-8?B?TG9NRU1LdHArYVZEZFVIRXZTSlBGQjdqK0wxK0kwM1Vjck85c3hGQVBvd1Bz?=
=?utf-8?B?QXhZejNtOVZSbTVwaDFSUTRHT0ZSajhKYm0vdDVYbm9vNkQxajRocmxoMkdP?=
=?utf-8?B?M1NQck5EM2xSYkxnSzNkUnk1ZHduVm56SS92dTVHTU9nYXF5OTM0bXRSWjg3?=
=?utf-8?B?UzdGRGk3K1VjTzJKZGR2S2FCUEtJNkdNaTZDc2VHaENNd2gxeVdkbmtrMkNq?=
=?utf-8?B?YmhRWVdMOUVPRlRHMzFETzdPamVNc2tPNWJSSzA3MjhBZzNKNUdCZ09qQ1BI?=
=?utf-8?B?M29RWHlxSCtWNTZsR1dYZWZKZTFrMGhVUnFHRW44K3RERlZpVktOTWpKSlEw?=
=?utf-8?B?dmJ5R21nV0JkcHpIQkdpTTZlU1RZbEZvUTRkR2pId1E1VDcyNUQzMXBrdm9o?=
=?utf-8?B?eTlBVmFRK3p5NG03T2JOVlByQ2RMcGJJV2Nwb2l2Qm9lbTNML24yTDNieW52?=
=?utf-8?B?N2w3d0pGM2lFS0tUeGdPOWx0SlVXWkJ5K3pWNjhXK0dVa0E0UTIzV01yQTQ4?=
=?utf-8?B?cVZvZXk5MEt5VUF1QUprcVRBOWdKUlc4a2U3cnJkdVI0U3FURExIdDQxU016?=
=?utf-8?B?aUw5cGE5d2EzUlBzV2xpOXZpMjJtOFVmSjJHdHF1MTRwRHNtM3k2ejhvSi9B?=
=?utf-8?B?NmNzODB2ejQ0WDdZUmJHSm5UQkkxUzJYQTF5Y2kySWJUT2gzaTBNM2JnNjhh?=
=?utf-8?B?MHlyM0R2dXpYK3Q3TWdVWlhUSTRUR3ZKbE5MTVMrWTA2QUpmWGJlQlZUclkx?=
=?utf-8?B?VjY4WVVNVk92dVIrYit0b2UzZDcxdmEyd3ZMaE5iNG5Pb1R4TDNvQTNweWhS?=
=?utf-8?B?QTNNTlJkY0xOZ3Yva05oTXQ0OWJuSXR4MHpqUkFSdU9SL2RScVBWRW1XNThS?=
=?utf-8?B?b254dEpXWldPYUFuUGYvclBYSlFnbG5nNzU3RWtnb1puWEVkMGZnRGprSDc2?=
=?utf-8?B?bncrdHJucmlmbnVnUTFxZXdDTFB4NGZSZnNGcVlaaE5iOFZKZmlxS3BQaVd6?=
=?utf-8?B?ZlFEdkNxVmpacnhUK011Sm45ZThjbXVkdE9mWFd2VmUxczU3aExZTGdDb3ha?=
=?utf-8?B?MFpFL2s4NnoweEdLTWU1WFlPVHZ0OUlyUXhmc2xuMnllMGJyckFwL1Ixdkxz?=
=?utf-8?B?TGFnOWt3MXZOYzU1L3BMRHFicVVXN3NCcTA0S1dRdzhRUFZNU25PSVNGaEV6?=
=?utf-8?B?VUFZVUlXRkRNRDM5NDErWE92dzVSYWk1OUFlR1dETE1pcVQyZzFweEFmb3RH?=
=?utf-8?B?VTQwWE5UTFo0UEYvN3BoeWhWWS9NN2hHSEdzN05FaHdXUWQwTmRsd0RBc3U4?=
=?utf-8?B?U1RMVlk1VVRaTU1GVmVxK2UzODVpSkpOVWdweDVnV2thaTE0Ykk1MlpqT1F1?=
=?utf-8?B?ZnFaMU5iRVhJblY1VkYvbkZaWVVTbWIxMDZxMlJ3MHlDdUJVYkMxRzRDZjhY?=
=?utf-8?B?d2dZampLRUlLbmJzeEN1RlRKWEdpdktEQVJFVlJXWkp0SlNSeWhiMWZjV0d6?=
=?utf-8?B?cTc5SnBlSnlveDl0cExPM3Q2K0VKdXFNQ3Z0akhsNDA0RGttVHZqQ1RQVDRB?=
=?utf-8?B?SXc9PQ==?=
X-MS-Exchange-CrossTenant-Network-Message-Id: e89336d0-1cc9-4ca1-428f-08dda509f694
X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB6054.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 14:53:56.9613
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: xdPAHbJ2DA3DCb8Ssxw4BHz7DcoSiD3k/HJtJZTRmFOqAHDqfFLCJTJycofHqzJle+qfNKYGpUA1Fl5vi+F5BA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR11MB9447
X-OriginatorOrg: intel.com
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 11/05/2025 11:57, Adrian Hunter wrote:
> On 25/04/2025 10:57, Adrian Hunter wrote:
>> +static int tdx_terminate_vm(struct kvm *kvm)
>> +{
>> + if (!kvm_trylock_all_vcpus(kvm))
>
> Introduction of kvm_trylock_all_vcpus() is still in progress:
>
> https://lore.kernel.org/r/20250430203013.366479-3-mlevitsk@xxxxxxxxxx/
>
> but it has kvm_trylock_all_vcpus(kvm) return value the other way around, so
> this will instead need to be:
>
> if (kvm_trylock_all_vcpus(kvm))
>

Sean, do you have any comments on this patch? Should I send out a new version
with the change above?

Note kvm_trylock_all_vcpus() now in Linus' tree:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e4a454ced74c0ac97c8bd32f086ee3ad74528780



Return-Path: <linux-kernel+bounces-675888-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C147B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:56:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1A1287AB371
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:54:41 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C96B01C5D44;
Fri, 6 Jun 2025 14:55:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S0y/zdVS"
Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2980F17B50A;
Fri, 6 Jun 2025 14:55:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221745; cv=none; b=k4JrfnuDkrIu0WbKVJKUB9LlW8FVvbR5+rhboc1jRtQ0mLCbDqhazomgodoyBREzvK7/VB5mz/rMzMSXd0qf5/wzkseLWtFBimjGZHDgxDuyOzpfqzPDWMnV3lrjyAHGX4/lomJVNTjnzcxSaaj6ibiIvhSJyN7YKI0tQgvX1ps=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221745; c=relaxed/simple;
bh=L9/yg7FYVpcvI0YfTkdkZgBobhQMILGK8egVK8yFG2w=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=SDlYwq+KtvPYjv64x5T8cK2uiV0FPZUoCwhdc5WlSrVwtX9uW5aYEYARIka6BNeQJZDtl4dV5vq2Bk7FKhh7MnSGu+mDZ0u6QlKS0+tyEgbRGw9kau7ww5ja6amdzzwqb5MVLTxOzEp3H+Y2oM479RiiIwqqdvJ2w6HNrE3Sid4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=S0y/zdVS; arc=none smtp.client-ip=209.85.167.53
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-551efd86048so2345950e87.3;
Fri, 06 Jun 2025 07:55:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749221740; x=1749826540; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=9vEqxDPn0ZUq7X1FTJtTDzBWFl7WShO2WerhdN2+vTs=;
b=S0y/zdVSsX+BIuiw04KolyZlTKAsgnxYFkl35jzQ5QrVOO3bfTWvGyeIR0MVmQZylK
oFnWx+fNUVZEhk+O7PKWE7cGxqR0HgHXVvBM/dnBIyltDQg/WVJLc/JCxkHwH2iRgpCs
kP0V4oxn+xZvzPK2rixvgctkF4n4HHONK3e/r3JYo4a7KV4u4f7ADT2tkhDtbuWxLbTE
/HNqZ7eJ8vVXaD+1h+5ftCbOe0dt4TQme14TyXOEiQQHYV9gXpOroMvQs68G3zYLQy23
+e8NQylRgQm9AwUMaYKLQcpENx7QQ0506Qts2SX3iWeV+MGdfDZJKbaU8vIh+VqYR75U
aNHQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749221740; x=1749826540;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=9vEqxDPn0ZUq7X1FTJtTDzBWFl7WShO2WerhdN2+vTs=;
b=kkn1ZeYNjuTplWzEiUvXaUbNYkRyX3/hI1RVVITprm78nh50QA2mjzX/SiNpBbahqQ
okCpM51ZOnOJkoIYhJcp/v7nXM4yLlxg+ciTIxqfHOMKSGldLQBsJtGbYV/MuO4XzaL7
mNYF/GurFXf5C/puIKDZPESuaobYAX+Pn+rwfKZPxwKsOZp9HZvaBICI/g6lcpfMh7xE
dFzF95gUHxjFXeJrPsdz1Hcv+CAMLUhQrC2r5nu0zStSn6/6HNVHsJgAOq+6Nfc60l9K
zfDe+segjFVcjxghfKkNUiMZGfTyycbJZ+6luifeLqF+6eQPJjT+xPGwrN67xgsD2YFx
Qq/Q==
X-Forwarded-Encrypted: i=1; AJvYcCVtMviv861IjmvtbkcOXZNtt6n/W8keTs27BrSPIQEunoYnUYAvrGkXwdvTWgVCQIG8WBRytPOOI6YotJU=@vger.kernel.org, AJvYcCXd5LBw0kQ4u2hmhaqKFClJ2mBe7vMTMj/XsFk7b0jHbxRdO5H3hNizVlcUnDECg2G+fpcnfMK5@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yw/CdToSSWgL1iHoTe43zDYoGL+a0yoIVmy3INaeVHmPumLrHec
/xiSxV86RGJWyWd+hFIGDHimtvtUD3RgNXnTw/RR3ctD+hXxRufIHbpuy8XDxyNlsZfaxWtBBMp
QcHVmpUzq489zpoo3RXOKedy5nizebRQ=
X-Gm-Gg: ASbGncseSBvfc8cDDy52AqcjTP7fwdhr8wCjour/qtI//8yLeBi1R0AVG2bQT0EVx3w
XKDFfqm47RaSp1DP6Rnfpo+QMoyA88voT9lAHV2imfZCzXEMtNJlU/xHHRmjagtbCpa0VJu5lr5
N7SaNzh+RRTFDq0U7t+ue5C6cfR37iuFt4Nstems0iGmDviWwmuKzXcWyM3bS3B+Ehko7S4WiiA
dPvNA==
X-Google-Smtp-Source: AGHT+IFZWOEBNtk6rAy+hlSFXTHbia35W3Eb5q7wIpwrt+5TKHTVOh1XTS2ghbuZ6plcpgQrnD1VoNRTQQ+B8Al5/mQ=
X-Received: by 2002:a05:651c:1545:b0:32a:6c39:8938 with SMTP id
38308e7fff4ca-32adfc821acmr9118621fa.13.1749221740202; Fri, 06 Jun 2025
07:55:40 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250602135932.464194-1-pranav.tyagi03@xxxxxxxxx>
<053507e4-14dc-48db-9464-f73f98c16b46@xxxxxxx> <202506021057.3AB03F705@keescook>
<25d96fc0-c54b-4f24-a62b-cf68bf6da1a9@xxxxxxx>
In-Reply-To: <25d96fc0-c54b-4f24-a62b-cf68bf6da1a9@xxxxxxx>
From: Pranav Tyagi <pranav.tyagi03@xxxxxxxxx>
Date: Fri, 6 Jun 2025 20:25:27 +0530
X-Gm-Features: AX0GCFvWsxNzpeHQ-45krsT9OQBs0Twpqds55CAANGDSlgC7gQxq8HsNVzgkPKQ
Message-ID: <CAH4c4jJRkeiCaRji9s1dXxWL538X=vXRyKgwcuAOLPNd-jv4VQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] net: randomize layout of struct net_device
To: Andrew Lunn <andrew@xxxxxxx>
Cc: Kees Cook <kees@xxxxxxxxxx>, andrew+netdev@xxxxxxx, davem@xxxxxxxxxxxxx,
edumazet@xxxxxxxxxx, kuba@xxxxxxxxxx, pabeni@xxxxxxxxxx, horms@xxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
skhan@xxxxxxxxxxxxxxxxxxx, linux-kernel-mentees@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Tue, Jun 3, 2025 at 12:36=E2=80=AFAM Andrew Lunn <andrew@xxxxxxx> wrote:
>
> On Mon, Jun 02, 2025 at 11:03:18AM -0700, Kees Cook wrote:
> > On Mon, Jun 02, 2025 at 04:46:14PM +0200, Andrew Lunn wrote:
> > > On Mon, Jun 02, 2025 at 07:29:32PM +0530, Pranav Tyagi wrote:
> > > > Add __randomize_layout to struct net_device to support structure la=
yout
> > > > randomization if CONFIG_RANDSTRUCT is enabled else the macro expand=
s to
> > > > do nothing. This enhances kernel protection by making it harder to
> > > > predict the memory layout of this structure.
> > > >
> > > > Link: https://github.com/KSPP/linux/issues/188
> >
> > I would note that the TODO item in this Issue is "evaluate struct
> > net_device".
> >
> > > A dumb question i hope.
> > >
> > > As you can see from this comment, some time and effort has been put
> > > into the order of members in this structure so that those which are
> > > accessed on the TX fast path are in the same cache line, and those on
> > > the RX fast path are in the same cache line, and RX and TX fast paths
> > > are in different cache lines, etc.
> >
> > This is pretty well exactly one of the right questions to ask, and
> > should be detailed in the commit message. Mainly: a) how do we know it
> > will not break anything? b) why is net_device a struct that is likely
> > to be targeted by an attacker?
>
> For a), i doubt anything will break. The fact the structure has been
> optimised for performance implies that members have been moved around,
> and there are no comments in the structure saying don't move this,
> otherwise bad things will happen.
>
> There is a:
>
> u8 priv[] ____cacheline_aligned
> __counted_by(priv_len);
>
> at the end, but i assume RANDSTRUCT knows about them and won't move it.
>
> As for b), i've no idea, not my area. There are a number of pointers
> to structures contains ops. Maybe if you can take over those pointers,
> point to something you can control, you can take control of the
> Program Counter?
>
> > > Does CONFIG_RANDSTRUCT understand this? It is safe to move members
> > > around within a cache line. And it is safe to move whole cache lines
> > > around. But it would be bad if the randomisation moved members betwee=
n
> > > cache lines, mixing up RX and TX fast path members, or spreading fast
> > > path members over more cache lines, etc.
> >
> > No, it'll move stuff all around. It's very much a security vs
> > performance trade-off, but the systems being built with it are happy to
> > take the hit.
>
> It would be interesting to look back at the work optimising this
> stricture to get a ball park figure how big a hit this is?
>
> I also think some benchmark numbers would be interesting. I would
> consider two different systems:
>
> 1) A small ARM/MIPS/RISC-V with 1G interfaces. The low amount of L1
> cache on these systems mean that cache misses are important. So
> spreading out the fast path members will be bad.
>
> 2) Desktop/Server class hardware, lots of cores, lots of cache, 10G,
> 40G or 100G interfaces. For these systems, i expect cache line
> bouncing is more of an issue, so Rx and Tx fast path members want to
> be kept in separate cache lines.
>
> > The basic details are in security/Kconfig.hardening in the "choice" fol=
lowing
> > the CC_HAS_RANDSTRUCT entry.
>
> So i see two settings here. It looks like RANDSTRUCT_PERFORMANCE
> should have minimal performance impact, so maybe this should be
> mentioned in the commit message, and the benchmarks performed both on
> full randomisation and with the performance setting.
>
> I would also suggest a comment is added to the top of
> Documentation/networking/net_cachelines/net_device.rst pointing out
> this assumed RANDSTRUCT is disabled, and the existing comment in
> struct net_device is also updated.
>
> Andrew

Resending to the list=E2=80=94my previous reply was accidentally sent off-l=
ist.

Apologies for the delayed response, and thank you
all for the detailed feedback.

Regarding the concern about breaking functionality,
I did compile and boot the kernel successfully with
this change, and everything appeared to work as
expected during basic testing. However, I agree
that this is not a substitute for thorough
benchmarking.

You're absolutely right that applying
__randomize_layout to net_device will shuffle
structure fields and likely incur a performance
penalty. As mentioned, this is a trade-off that
targets hardening over performance. It's worth
noting that CONFIG_RANDSTRUCT has two options:
RANDSTRUCT_FULL and RANDSTRUCT_PERFORMANCE, with
the latter aiming to minimize the impact by only
shuffling less performance-critical members.

I=E2=80=99d appreciate guidance on which specific
benchmarking tests would be most appropriate to
quantify the performance impact. Based on your
suggestions, I plan to run benchmarks on a small
SoC (ARM/MIPS/RISC-V) with 1G NICs. However, I
currently don=E2=80=99t have access to high-end server
hardware with 10G/40G+ NICs, so I=E2=80=99ll start with the
systems I have and clearly note the limitations in
the revised commit message.

I=E2=80=99ll also update the commit message to reflect the
security vs performance trade-offs, mention
RANDSTRUCT_PERFORMANCE, and add a reference to
net_cachelines/net_device.rst to document the
assumption of structure layout.

Thanks again for the thoughtful review=E2=80=94I=E2=80=99ll revise
the patch accordingly.

Regards
Pranav Tyagi


Return-Path: <linux-kernel+bounces-675889-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 26FA541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:56:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id C1C627A2E95
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:55:28 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C1AD01C4A24;
Fri, 6 Jun 2025 14:56:34 +0000 (UTC)
Received: from mail-il1-f207.google.com (mail-il1-f207.google.com [209.85.166.207])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFAD617BEBF
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:56:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.207
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221794; cv=none; b=aVaectKMGReCGL2i1Ck750NlwAD7e2v/DLrPO11FBeAZ3sO2eP264tpBqHGv+WpUi7y53ckDBlJwlkWjHeqkPsd3rA6tvukRxkbOXgysSMCmwU8f1QYgNUh5xO5WUsaZ3Q5ufWVyssKlu7p2OrRvAr7SmnPdpztQUWCdBm//RhA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221794; c=relaxed/simple;
bh=Un6/u1lqCJMKeoiAiYXzAp6NLdokv78xP3NcfhlOiFM=;
h=MIME-Version:Date:Message-ID:Subject:From:To:Content-Type; b=tfjEegry8jZX25c+gYGK1QwT8AbK0LksDTO16jg4BEVMD52wYclXm28AZjrFFbmZqs8ZZ3pNQSJtdV24r4FFqJfI4UftQO65GVu8AJ6eGifLOrIX3Su+KTOpRMD3LMLz2S2AuhkglUMQObDjLbLHlflftwUYL0eEVUqb8kKHBCg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.207
Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com
Received: by mail-il1-f207.google.com with SMTP id e9e14a558f8ab-3da6fe2a552so41685945ab.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:56:32 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749221792; x=1749826592;
h=to:from:subject:message-id:date:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=YF+eXovpI+BPFHViBf5OAfiZKlMj7V/t4795WnL00rU=;
b=cUrNa8hHanuPROXZOXk1Y3YLzROvTk8wnr00Fd69zLPGsS/Sse1qxmxXvbNIvHFVbQ
hHYeex4pZoj7ToEgGuoIdxIfxWdWnBfukpqMpOHO5A25RGeogVh1uhNgJ2a+ncHPfA4a
rAOmA+pM8ZyLeXBExOqtvDO67AAZY+maF+1vXNghbvg1bX7ODMqgCl4wk8gT3hsDA/wG
6p1DUM+0xSmAk4xfE1QXljNbU3pWZipSvcAZ2aPHHzxUWPBS5BfdnoXL2XVm7iydcEda
RdaeZswHpatwu5xpRsPH38j2QbayyaXvT9j/6Ol1YWOoCDYMeCCy9LruIJi300pC3rjf
ZW/Q==
X-Forwarded-Encrypted: i=1; AJvYcCX6rQUAoz52zB44jd8RqU57I/xhE1ONBvhku+BK2gwH8WPViGBLr08Nmjq9sCaeKRQDnlq0qLMvguaf1vQ=@vger.kernel.org
X-Gm-Message-State: AOJu0Ywq01Bi3nFt/oJWXuPy61XPT5md3sYE1HgrSVnTIFAb6+lb5L4t
0zsW9E5pHzjRxUN3OERUGlWSH3ayCt1ku9OT30OOO4vLoPh/rJtGsn3eGNZtYHo9Pjhz4sGApAs
wMDluR/XzQgzZR25QUgo/1HyzIMVba+C9RVyR79GHG6gwtaUEd1T6/IHLsHw=
X-Google-Smtp-Source: AGHT+IFoFrrAmYlUpTD7FdSKQo72bN7Yrvawlqt2K4lsdzd6TpbdcCvkEx3s0/p4fEZWZ1kM1Nfeko7FkjTGgW4lQtakoFYCEXF7
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Received: by 2002:a05:6e02:4416:10b0:3dd:d348:715a with SMTP id
e9e14a558f8ab-3ddd3487186mr12124125ab.8.1749221791701; Fri, 06 Jun 2025
07:56:31 -0700 (PDT)
Date: Fri, 06 Jun 2025 07:56:31 -0700
X-Google-Appengine-App-Id: s~syzkaller
X-Google-Appengine-App-Id-Alias: syzkaller
Message-ID: <6843019f.a00a0220.29ac89.0044.GAE@xxxxxxxxxx>
Subject: [syzbot] [net?] WARNING: refcount bug in gro_cleanup
From: syzbot <syzbot+9de2587cce48f5642f16@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: davem@xxxxxxxxxxxxx, edumazet@xxxxxxxxxx, horms@xxxxxxxxxx,
kuba@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx,
pabeni@xxxxxxxxxx, syzkaller-bugs@xxxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-0.5 required=5.0 tests=FROM_LOCAL_HEX,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no
version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hello,

syzbot found the following issue on:

HEAD commit: d0c22de9995b Merge tag 'input-for-v6.15-rc7' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1745b5f4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=9fd1c9848687d742
dashboard link: https://syzkaller.appspot.com/bug?extid=9de2587cce48f5642f16
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b862906e9f4b/disk-d0c22de9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c0d716f15db2/vmlinux-d0c22de9.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7ffe8e4af4ec/bzImage-d0c22de9.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9de2587cce48f5642f16@xxxxxxxxxxxxxxxxxxxxxxxxx

------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 1 PID: 8170 at lib/refcount.c:28 refcount_warn_saturate+0x11a/0x1d0 lib/refcount.c:28
Modules linked in:
CPU: 1 UID: 0 PID: 8170 Comm: syz.4.605 Not tainted 6.15.0-rc7-syzkaller-00152-gd0c22de9995b #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
RIP: 0010:refcount_warn_saturate+0x11a/0x1d0 lib/refcount.c:28
Code: 80 aa c1 8b e8 e7 52 cb fc 90 0f 0b 90 90 eb d7 e8 4b f6 06 fd c6 05 67 3c b0 0a 01 90 48 c7 c7 e0 aa c1 8b e8 c7 52 cb fc 90 <0f> 0b 90 90 eb b7 e8 2b f6 06 fd c6 05 44 3c b0 0a 01 90 48 c7 c7
RSP: 0018:ffffc9000419f628 EFLAGS: 00010246
RAX: b3f3c577eef85a00 RBX: 0000000000000003 RCX: 0000000000080000
RDX: ffffc9001071e000 RSI: 000000000007ffff RDI: 0000000000080000
RBP: 0000000000000000 R08: ffffffff8f7f3577 R09: 1ffffffff1efe6ae
R10: dffffc0000000000 R11: fffffbfff1efe6af R12: dffffc0000000000
R13: 4888ffffe8ffffc8 R14: ffffe8ffffc8496e R15: ffffe8ffffc8488a
FS: 00007f92701cb6c0(0000) GS:ffff8881261c2000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f0f5af71440 CR3: 00000000262e0000 CR4: 0000000000350ef0
Call Trace:
<TASK>
kfree_skb_reason include/linux/skbuff.h:1279 [inline]
kfree_skb include/linux/skbuff.h:1288 [inline]
gro_cleanup+0x300/0x640 net/core/gro.c:815
__netif_napi_del_locked+0x2e0/0x3c0 net/core/dev.c:7301
__netif_napi_del include/linux/netdevice.h:2876 [inline]
gro_cells_destroy+0x16a/0x430 net/core/gro_cells.c:117
ip_tunnel_dev_free+0x19/0x30 net/ipv4/ip_tunnel.c:1102
netdev_run_todo+0xcd7/0xea0 net/core/dev.c:11300
setup_net+0x5db/0x830 net/core/net_namespace.c:392
copy_net_ns+0x32e/0x590 net/core/net_namespace.c:518
create_new_namespaces+0x3d3/0x700 kernel/nsproxy.c:110
copy_namespaces+0x438/0x4b0 kernel/nsproxy.c:179
copy_process+0x1700/0x3b80 kernel/fork.c:2433
kernel_clone+0x21e/0x870 kernel/fork.c:2845
__do_sys_clone kernel/fork.c:2988 [inline]
__se_sys_clone kernel/fork.c:2972 [inline]
__x64_sys_clone+0x18b/0x1e0 kernel/fork.c:2972
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f926f38e969
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f92701cafe8 EFLAGS: 00000206 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007f926f5b6160 RCX: 00007f926f38e969
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000042000000
RBP: 00007f926f410ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f926f5b6160 R15: 00007fff8df30f78
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup


Return-Path: <linux-kernel+bounces-675890-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AEA2E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:57:23 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 85F3E3B235C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:57:01 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D1251C84BF;
Fri, 6 Jun 2025 14:57:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="hMtKoXXh"
Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B71A01B4F09
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:57:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221831; cv=none; b=ixYNdskl2OWIOswlkxcVgA2yNsr8f3mJG/nK+zN95BTWiYHam8jYnX8eQu8X0wtgt2qgF1wjiJ7IolcKdne70hof825e9DY1I8CagfjCbD+yLKB7dSl4sH/oR2sXxDKq8pvKLMNHEB+qx6C2gNMsReKdjr1MMf3Wdy4lP/UL/ZU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221831; c=relaxed/simple;
bh=5rLk0Y1o9Yqu936oDGAf+guTBOuXSZ/KP5hY7VpGzCQ=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=X8x7Z87GkYHCV+5JEhopNr1r4wsUX/IbY0TXBx8Y8B6QlsX+FaIaxI6ItcIFqG9GuMg7XWi2UXnoIm2zLhMSwJ6pPhtcEpHeMUq3I66A0CemrD81GSpTOgnIX+gox87XRRNFCynVDxzzvJnNXlHyeCtsiA8RUay4+M+2zLOG4FI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=hMtKoXXh; arc=none smtp.client-ip=209.85.166.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk
Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-86cfc1b6dcaso61531739f.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:57:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1749221828; x=1749826628; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=y4SilW7Kz/GqOrsdyu9o99hQfeO+kZMJ6kTTI3SZL88=;
b=hMtKoXXh8+5SC4d//xyI/YsWQof1pTyJgp8PvZMRjJEr+ZXGQDP6PiKucpYcvXxhgt
R/v1olg0Jg27bs2vAvbXLvE45rYoG68EZ58vWZtBT+YKvSE/Y61EG6Jgsuv5c7j7Q4CT
N/ZaM/yXxUEhAabGOWU23a3e2mAqusOZvhacUnQPB8HTsuTR9UlfgAN8gIV3ssAnmWfq
YqQLiPlal2Hv22VEolt+uyoxborkDCIxNRXuov18yx2KNRy3TAqCcSFxGpvuQVV8gXia
HlbkOMQthwezDppKAreITxg5uCk6PNvrqFLM4Aw9kHo6ObeJR3xcgVGqd6O2DVHzEjiY
Txdg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749221828; x=1749826628;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=y4SilW7Kz/GqOrsdyu9o99hQfeO+kZMJ6kTTI3SZL88=;
b=oA0yVaaof9dK0oQo3Xi91XoDeskidWb4+XIEiN0wVBFPNPJuaufo/cjFFwfnOOrmKK
I0Ij2Nky2Tqsv4BEPstORu/ak+m2waDEf5isPYlH13b6+pURb8kxz0tedchT4WUEJmpl
WM/AyCcYbUJ9D1GhrDqxw+6k2ZAguXK/VXjaF4YGijBhBFraE6mDabuC9e9rR655T165
xxOYdoaeYtuRER4CmFV925+Vv0Gy1P0q/JpoQ6+tTJXMEUy8qqA7jJz7Vpxb8LiY3uiW
Ejti0M2hx5ndv7xBOxI9Wm1oLGjrCbTB4DxdA2H6NZZMoL/OffClWYuTBIkb1C8j/xoy
yHdA==
X-Forwarded-Encrypted: i=1; AJvYcCW/YvLPwq4qY0BRbBl71LkN50j9gEMzSwUqA5yMsVURMF99TMmiOFO3oHWiDrJOt9l5xUfydHbE+yJ3vJo=@vger.kernel.org
X-Gm-Message-State: AOJu0YyAh0HiwwjU+X6RIAQ/URHUrIaGKNaOZOX+kkWhLsR9icei8AkG
nqNdydU8gOY24vsCOvq0LF8vUszatNZ910NvWgymFIvryRRACN0x1sh2jtNOtJa/eOg=
X-Gm-Gg: ASbGncvboXQlNoAzzUreDqqpgCxNQ92Ect7Nk0/NaI5vEo4bY9u7ZiGpRfIOSseuY3F
rQ9qC1ePMLDai0J3+9W8C3CjJ5mIUxQyOyPx78epPu0aBuOtZdvFapD1tPUft8RhR/J/dwq2+pu
003Q5KytD6r6MOTEio81GMyfpckWiVAIUL7xLaOgGZj+T8Qi0NTtk997cxYsMl42CFPIgVKcsBf
Cu/mPcEUMhaIom2ipBgdObrSOLBLmvJxGP/vsqa275HfVG3UbsNWuyZh8BoHFGk6/vrIJPurwAb
wpOorwMJflojoMwA1c77rEbHdaSO+7yH2EOQnaa455NaP+NHLdmADYoIrg==
X-Google-Smtp-Source: AGHT+IHCqdvcPc2EHD8OF2SGiY28FRz5VxV/iMut9sL/Iq4G5xTeNxhhacKuQVTKYCyvf5H+SS82Sg==
X-Received: by 2002:a05:6602:4c03:b0:86c:fa3a:fe97 with SMTP id ca18e2360f4ac-873366c4eb2mr364557439f.10.1749221827729;
Fri, 06 Jun 2025 07:57:07 -0700 (PDT)
Received: from [192.168.1.116] ([96.43.243.2])
by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87338782c7dsm37099439f.2.2025.06.06.07.57.06
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 07:57:07 -0700 (PDT)
Message-ID: <9b9199f0-347b-42fb-984a-761f0e738837@xxxxxxxxx>
Date: Fri, 6 Jun 2025 08:57:06 -0600
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [RFC v2 3/5] io_uring/bpf: implement struct_ops registration
To: Pavel Begunkov <asml.silence@xxxxxxxxx>, io-uring@xxxxxxxxxxxxxxx
Cc: Martin KaFai Lau <martin.lau@xxxxxxxxx>, bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <cover.1749214572.git.asml.silence@xxxxxxxxx>
<f43e5d4e5e1797312ef3ee7986f4447bddac1d3c.1749214572.git.asml.silence@xxxxxxxxx>
Content-Language: en-US
From: Jens Axboe <axboe@xxxxxxxxx>
In-Reply-To: <f43e5d4e5e1797312ef3ee7986f4447bddac1d3c.1749214572.git.asml.silence@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 7:58 AM, Pavel Begunkov wrote:
> Add ring_fd to the struct_ops and implement [un]registration.
>
> Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
> ---
> io_uring/bpf.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++-
> io_uring/bpf.h | 3 +++
> 2 files changed, 69 insertions(+), 1 deletion(-)
>
> diff --git a/io_uring/bpf.c b/io_uring/bpf.c
> index 3096c54e4fb3..0f82acf09959 100644
> --- a/io_uring/bpf.c
> +++ b/io_uring/bpf.c
> @@ -3,6 +3,8 @@
> #include "bpf.h"
> #include "register.h"
>
> +DEFINE_MUTEX(io_bpf_ctrl_mutex);
> +
> static struct io_uring_ops io_bpf_ops_stubs = {
> };
>
> @@ -50,20 +52,83 @@ static int bpf_io_init_member(const struct btf_type *t,
> const struct btf_member *member,
> void *kdata, const void *udata)
> {
> + u32 moff = __btf_member_bit_offset(t, member) / 8;
> + const struct io_uring_ops *uops = udata;
> + struct io_uring_ops *ops = kdata;
> +
> + switch (moff) {
> + case offsetof(struct io_uring_ops, ring_fd):
> + ops->ring_fd = uops->ring_fd;
> + return 1;
> + }
> + return 0;

Possible to pass in here whether the ring fd is registered or not? Such
that it can be used in bpf_io_reg() as well.

> +static int io_register_bpf_ops(struct io_ring_ctx *ctx, struct io_uring_ops *ops)
> +{
> + if (ctx->bpf_ops)
> + return -EBUSY;
> + if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
> + return -EOPNOTSUPP;
> +
> + percpu_ref_get(&ctx->refs);
> + ops->ctx = ctx;
> + ctx->bpf_ops = ops;
> return 0;
> }

Haven't looked too deeply yet, but what's the dependency with
DEFER_TASKRUN?

--
Jens Axboe


Return-Path: <linux-kernel+bounces-675891-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3651D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:57:40 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 6A8A1189DCB2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:57:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D5C011E501C;
Fri, 6 Jun 2025 14:57:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="Ji+tBwGY"
Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B02D1CEAC2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:57:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221836; cv=none; b=Z199GBTwy73jCAACB28Mo7ndwO//UtkkSZBiqacxtPp6PvJ1EnCKMKWYRIXF2vRe4zLVBtKOkV3PY7b1oZlDp+Eb4wSh2b8cmf75J+awiUJ9tJOQTiPlDnGl4h1QiFK9xWXuy7/e9tEnfEKUZwHpD6VvoZZYRZnD4jkW/8Sba7Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221836; c=relaxed/simple;
bh=ia7pnAGyVV1EpMWakQwBtxjI3bEZOeCvt8bf0l4HQIg=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=N3BfIZ7KBqJq0dBZy7XSfLvLWz1Ib1wdEPgMarwjzQKqnk56YMt507lgXug6esxAHhk2n5ZFt+xuRB0y5B8t4bebF1waTPQIwdZz+bkFovT6Q2GYLelJvhd4xzdM/nK5qJo33eQy5x921l3OUI5ZBIuBzauaoCBC1G7tYGp/eoI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=Ji+tBwGY; arc=none smtp.client-ip=209.85.128.52
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-450ccda1a6eso20619075e9.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 07:57:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749221832; x=1749826632; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=Ybeh6r8IJ9MMaBfEPZurC85ycYwc4zI6taH+XBEB7iM=;
b=Ji+tBwGYkavoDMO2lvr8lzuKAde/GcNvyhsdvCc7YKkXSjig9iG67tFKvktaWtZBn2
T7mCDqAZ6U/+1BKCqd9rDB9bOIxlFWSfOVifoMs4oZpfxLjy7FG+BYVr66OIG0Szrg7W
a4vB934BQzNaw5DZeH86zO8SPDoPSJK7lUrdpDMtzn0stPutv2tFFN5GuMaePUTRX3vG
qYFbWgUbtJSyvOqF99X5tvsOpwCO2Y3dKtSh27EgxILr7LROSDFiVhCIany08F0uKbfL
No1jRCDMM/YVZrQz78c/Kso8fbr3t9WjvZe79kTIdyAbQqppe06i70kCYc7r4lIIXNN6
z2Yg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749221832; x=1749826632;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=Ybeh6r8IJ9MMaBfEPZurC85ycYwc4zI6taH+XBEB7iM=;
b=tV2Bgj/BBFbOjr+DJROsB59cXImQ3YmCaTpO+7yJ3IRvOCXtEhvSlZ8ZY0DdakBozc
ILFbxxwL9JhoTadKs4sLbwpHlAhIy60uxq+SJrd66T3l7HdJ0alOmJvJumlszDFspAiD
QzIyy613/yKoXCIJjJJQ4Xx2GN9eYg5HQUVlbbQWTLSDmQp+ADtCMmbd0CoaS8XrIrEp
Kx0KmTGTMQDqYE8zPCRqTEIaVXI7FGmDpYZcjn5AjioZ08b+cI541/DzxG5qyzTWFiww
eqAZlkpaiu7MxaOedxwI3GeOpwl+EyWZcVrb6fd9b1VcXBxOJBvxMZlQg0sc7D9/C76Z
EBdQ==
X-Forwarded-Encrypted: i=1; AJvYcCX0/PBpCg98zDJ+5UhdTbUJ5RpC8kO9gWTRx/3jM9Q3I55JVkVM8rf6ezx5X5rdTkJa2ayqnghadgTgUFQ=@vger.kernel.org
X-Gm-Message-State: AOJu0Yy1pKFcpLrLImZIdhKbwD/6v83hJBPVQ0zlSxXkan9cALHpZviZ
hb0B6SV+W0hJwAbyEHjgK/eurt0F7sHO2Pgfmxjo+UgwI/STbPWD4KL+ihyJVQgVq1I=
X-Gm-Gg: ASbGnctjr53WTTN5PgcbSv4XWCxSGOpkGtGRNV2VtgURqZCtpegdCgx/mJzhiM+Vh9s
sGzRHBw2WImRjKL+ggZ+gGgpryWJvkCehul0/yvyofcUm+Z6269QuoNZQhaiV8utYqda1cVXZhP
S8cYJYrLShAfuwqztzyOntXufmrCz9AKsuM2nNXeC6qPazj/8bN+lR4tl6GNIazSG3gIoL7dWBy
O23pNQmuK7dc2C1mMnZCfnQVjR2EY+RZhLRbAteo5XLuWcjD+0Itn2OdzSfsNLo3Eb+IiPj5kKY
vQeDHptG0m9aGP+66t6yNhwOjYDU7Jy4OUwWj1YJ6jSLtmFvLQYaSizCQxM8eLZRSgFypWM9SNe
c97vqaE0CHZJg6+3mhdCtTjQWWOpk
X-Google-Smtp-Source: AGHT+IEtcBbSWQ+OKjv58Suw5c1swP9aEvffhR8eHp0ff4ePqLrLdMPX0D2MvWAAWZPqN7jMkQVkmg==
X-Received: by 2002:a05:600c:458a:b0:450:cabd:b4a9 with SMTP id 5b1f17b1804b1-452014ea1ebmr35514085e9.29.1749221832308;
Fri, 06 Jun 2025 07:57:12 -0700 (PDT)
Received: from localhost (p200300f65f13c80400000000000001b9.dip0.t-ipconnect.de. [2003:f6:5f13:c804::1b9])
by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-45213754973sm26847055e9.35.2025.06.06.07.57.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 07:57:11 -0700 (PDT)
Date: Fri, 6 Jun 2025 16:57:10 +0200
From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= <u.kleine-koenig@xxxxxxxxxxxx>
To: Rob Herring <robh@xxxxxxxxxx>
Cc: Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>,
Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Sean Anderson <sean.anderson@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-pwm@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, Chris Packham <Chris.Packham@xxxxxxxxxxxxxxxxxxx>
Subject: Re: New default binding for PWM devices? [Was: Re: [PATCH]
dt-bindings: timer: xlnx,xps-timer: Make PWM in example usable]
Message-ID: <erst43cabswj3cwnszssolgyoh4dsgrlnjjxhb7luk3qkqhyay@6zyoixljvwwg>
References: <20250527171504.346696-2-u.kleine-koenig@xxxxxxxxxxxx>
<a14be34c-de2a-4bea-9282-1fac7780b9a4@xxxxxxxxxx>
<crk42dsypmbyqk7avldghjq32vslmalfmmouwxzgtdci4agfhz@rkbmxj5z22fx>
<20250606141324.GA1383279-robh@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="53f32hgy6vknjdpf"
Content-Disposition: inline
In-Reply-To: <20250606141324.GA1383279-robh@xxxxxxxxxx>
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--53f32hgy6vknjdpf
Content-Type: text/plain; protected-headers=v1; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: New default binding for PWM devices? [Was: Re: [PATCH]
dt-bindings: timer: xlnx,xps-timer: Make PWM in example usable]
MIME-Version: 1.0

Hello Rob,

On Fri, Jun 06, 2025 at 09:13:24AM -0500, Rob Herring wrote:
> reg:
> > maxItems: 1
> > =20
> > - '#pwm-cells': true
> > + '#pwm-cells':
> > + const: 3
> > =20
> > xlnx,count-width:
> > $ref: /schemas/types.yaml#/definitions/uint32
> > @@ -82,7 +83,7 @@ examples:
> > };
> > =20
> > timer@800f0000 {
> > - #pwm-cells =3D <0>;
> > + #pwm-cells =3D <3>;
> > clock-names =3D "s_axi_aclk";
> > clocks =3D <&zynqmp_clk 71>;
> > compatible =3D "xlnx,xps-timer-1.00.a";
> >=20
> > There is however one concern that I want to get resolved first to
> > prevent churn:
> >=20
> > In principle I think it's bad that a phandle to a PWM must contain a
> > period and flags specifying the polarity. For some use cases the period
> > might not matter or is implicitly given or more than one period length
> > is relevant.
>=20
> Why can't the period be 0 and no flags set if they aren't needed?

I don't say they cannot, and probably that's the most sane option if
there is no fixed default period and flags and we're sticking to 3
cells.

> > So I wonder if instead of unifying all PWM bindings to #pwm-cells =3D <=
3>
> > I should instead go to something like
> >=20
> > mypwm: pwm {
> > compatible =3D "...."
> > #pwm-cells =3D <1>;
> > };
> >=20
> > fan {
> > compatible =3D "pwm-fan";
> > pwms =3D <&mypwm 1>;
> > assigned-pwms =3D <&mypwm>;
> > assigned-pwm-default-period-lengths-ns =3D <40000>;
> > assigned-pwm-default-flags =3D <PWM_POLARITY_INVERTED>;
> > };
> >=20
> > (where the single cell specifies the index of the PWM's output).
>=20
> Sigh. You just changed everyone to 3 cells and now you want to change=20
> again?

I did? I admit that I intended to, but before starting to modify the
bindings I thought about if #pwm-cells =3D <3> is really the best way
forward.

> Changing existing users to 3 was borderline churn. Changing again=20
> I won't be receptive to.=20

I'm puzzled about what you mean.

There is 2bb369ab50e107a7de6df060a1ece2f33a6a0b9e but this is hardly
churn? And I prepared switching to 3 cells in
895fe4537cc8586f51abb5c66524efaa42c29883 but didn't touch the bindings
yet.
=20
> > I already suggested that in
> > https://lore.kernel.org/linux-pwm/jmxmxzzfyobuheqe75lj7qcq5rlt625wddb3r=
lhiernunjdodu@tgxghvfef4tl/.
> > When I asked about that in #armlinux Rob said "no. We don't need a 2nd
> > way to set period and flags." Is this still a bad idea if the
> > traditional binding with 3 cells will be deprecated for all PWM
> > devices? If this would be ok then, I'm also open for improvements to
> > the new concept. Maybe something like:
> >=20
> > fan {
> > compatible =3D "pwm-fan";
> > pwms =3D <&mypwm 1>;
> > pwm-default-period-lengths-ns =3D <40000>;
> > pwm-default-flags =3D <PWM_POLARITY_INVERTED>;
> > };
> >=20
> > ?
>=20
> How is this any different than a slight name change?

Compared to the suggestion with assigned-pwms it's mostly just a name
change, but dropping assigned-pwms is a relevant change. Compared to
what we have now (i.e. #pwm-cells =3D <3> for most bindings) the
specification of flags and period is optional which is IMHO a nicer
design pattern.

> What I also said there is that case looked like a property of the fan.=20
> If you want a default fan speed, then you should express that in fan=20
> terms (i.e. RPM or %) and then have a table to go from fan speeds to fan=
=20
> control settings (i.e. PWM duty cycle in this case). Even if you need=20
> something like minimum startup duty cycle, that's still a property of=20
> the fan.

I fully agree and want to fix the #pwm-cells =3D <4> case. In that context
it's also relevant if the change should go to <3> or <1>.

Best regards
Uwe

--53f32hgy6vknjdpf
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmhDAcMACgkQj4D7WH0S
/k7Zrwf/e3pkjRqHFV7Lk3vsWkmBLVvNzXJD7lFWLaL48eo49cz+xEVS1hg2NH2x
OdS0bPOu1kOSTdJcpWCThTsJUL0IignJx5D+SXMlcSj+VfeEpfTj2ooi7MhnZEK7
hSlIT/VfKcrlOh5SQw+uslH6VDNW7jEWfrimh90vEcqYCJqm56kyalzdI6Gj0XS9
YRmmjvxWu4hU73H2LB04Ha5VAtWSI2E1o/2Bm81jL6dQfqyVQDIjO+fAK90QNGnT
Fv7OM+bluN1LiMZRzy3TLv1wyNTFAZ1Vv93Xb+ZuSPC6SrJB+C082J+vQtXT20f6
8KapgO98QZsotPXAGWN7LPxr3fkCmg==
=fwHN
-----END PGP SIGNATURE-----

--53f32hgy6vknjdpf--


Return-Path: <linux-kernel+bounces-675892-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 45AFC41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:57:57 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id EE74B7A4D84
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:56:35 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 97F9E1C8610;
Fri, 6 Jun 2025 14:57:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Nwd4M0rx"
Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2048.outbound.protection.outlook.com [40.107.223.48])
(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 DAD68171C9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:57:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.48
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221869; cv=fail; b=HObFmvupSaxBOdvBxQ31iXeY3zB7cBwD7cbHYiEVl3tytgEabDPdtqDXN2a6bwC7kTTwqhOveMnLj7Fw0NHka89TD+VezosCaAJ2rjCubn/hNNJp9Z83Yv3dQhjKAgFaTizMKgLDefnG+OBzNVwRCRVAQmZP7pCqgGOJNblThfE=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221869; c=relaxed/simple;
bh=kj8mr1xtL/5m3vA/lw1nPHzAfYSCtZTMvjhcAKV9b+Y=;
h=Message-ID:Date:Subject:To:References:From:In-Reply-To:
Content-Type:MIME-Version; b=NDMMEsKL77Lq2i9sVnZiRxJm4wLMHPq2/CGP4OWEVosGChU/+7POQ2g7KlSqUJrejQazl4E6FR7ZBZep0KuQMJBuCZ6qQGxhsHDPQbFN7AziId32ruaZo22rWyE5CpaQR+MY2gLt+vLotVSa2m1RAee+dhkDF6V23dGPSH9m/Ws=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Nwd4M0rx; arc=fail smtp.client-ip=40.107.223.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=MEBRQHdyEylNtdD/ogQSkp0KIuOzThoMlIoxNctL6/hO0yJk6/62/kKTuUwHN5CDMcmc4wvonxjGF7sZm8nru2rHvuqCEc7jYbCOyGLm9LcsD1Odi83EAcc0X8V4J+84u+2upgZgliP3RwZHXbT9Bz9s/gU70upuEP+4tYmPw85hJQhTVsMqmx5Y6e0fdByMAT2wVoL2sX9Ng1yL7BDjMixrmc1FN5BsBgAjmMR1vBVtQcFyUEXLF0zsGlEX1sIZaIY8Go57uURfJjfZboc+S14sB6NQvGPXVzvqbtucVMM9WKMQmMW+vQ/U4IKmjLv3kiPZWOfW4ilBL+/OXOk/jQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=BQcIp+09qq/oG+Lqkcv4qvTHvgnr1G3PgBCBMHhest8=;
b=Yuc/mJTc970Uh13vYGrIFiapoorIFGTCZCE82FXrVIpSV+X0JVXEUPoOIv6FgocAw2Xr4x3H6r3I/6fSz1ynHxpBdYv/59pu1X2R8lHCGnr1AGkPbETg594rJJ/TsVO3erMEysaAAxPTB7qahKnIhBmuySlWGKZf4im5dhEffGXI3nQeAFbO3kHpm2pdcHMy592kcEHFf5mDYRSGVFjASBHAHakTaBHtf67r2GfENuF+O1uOmzMYOSnt3msOUMdG6FzamRqgbrxmtZeSymi61SzEEZJxaVtLr4PocBzs1MB32yai/db7lqG22snhL4wlVqsY31sByVlDRyH1PPabLw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass
header.d=amd.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=BQcIp+09qq/oG+Lqkcv4qvTHvgnr1G3PgBCBMHhest8=;
b=Nwd4M0rx4ZSD/ik3AU3dP7OVHciXCI7KAjQ01OabKdWS9YmCVtMs4LccakBnHATBWP52ZZ6OFbNJ2EtZgldtv7B7khvcg07i5d4pC4GZIxJG7r+zKvbMOQ9pAEkFUBvhUjpBpjAO7MkZmDUXg0Dcj/ouce7HzZu8o8RXHQJ8BrU=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=amd.com;
Received: from PH7PR12MB5685.namprd12.prod.outlook.com (2603:10b6:510:13c::22)
by DS7PR12MB5741.namprd12.prod.outlook.com (2603:10b6:8:70::7) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.8769.34; Fri, 6 Jun 2025 14:57:45 +0000
Received: from PH7PR12MB5685.namprd12.prod.outlook.com
([fe80::46fb:96f2:7667:7ca5]) by PH7PR12MB5685.namprd12.prod.outlook.com
([fe80::46fb:96f2:7667:7ca5%7]) with mapi id 15.20.8722.031; Fri, 6 Jun 2025
14:57:44 +0000
Message-ID: <d443719b-cf74-437b-8049-5f7a130350b9@xxxxxxx>
Date: Fri, 6 Jun 2025 16:57:37 +0200
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v8 4/9] drm/ttm: Add ttm_bo_kmap_try_from_panic()
To: Jocelyn Falempe <jfalempe@xxxxxxxxxx>,
Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>,
Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>,
Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>,
Tvrtko Ursulin <tursulin@xxxxxxxxxxx>,
=?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= <ville.syrjala@xxxxxxxxxxxxxxx>,
David Airlie <airlied@xxxxxxxxx>, Simona Vetter <simona@xxxxxxxx>,
Huang Rui <ray.huang@xxxxxxx>, Matthew Auld <matthew.auld@xxxxxxxxx>,
Matthew Brost <matthew.brost@xxxxxxxxx>, Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>, intel-gfx@xxxxxxxxxxxxxxxxxxxxx,
intel-xe@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250606120519.753928-1-jfalempe@xxxxxxxxxx>
<20250606120519.753928-5-jfalempe@xxxxxxxxxx>
<dd0532a2-4011-41ec-896d-ec066dc23cbc@xxxxxxx>
<8ed62378-269f-4385-bf05-eda28098fc1f@xxxxxxxxxx>
Content-Language: en-US
From: =?UTF-8?Q?Christian_K=C3=B6nig?= <christian.koenig@xxxxxxx>
In-Reply-To: <8ed62378-269f-4385-bf05-eda28098fc1f@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: BL0PR02CA0005.namprd02.prod.outlook.com
(2603:10b6:207:3c::18) To PH7PR12MB5685.namprd12.prod.outlook.com
(2603:10b6:510:13c::22)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PH7PR12MB5685:EE_|DS7PR12MB5741:EE_
X-MS-Office365-Filtering-Correlation-Id: c39a04d6-7bb9-4f0d-06c7-08dda50a7e62
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|1800799024|376014|7416014|366016|921020|7053199007;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?MWtvUUEyQ1VpK3ZaVjJsc0UycHZYN1RpSzFvL0EwLyszcGtua3ZpeXBXYUc4?=
=?utf-8?B?WUtBU3FHKzVuR0JiRjlQTVhBQlNSQTdKbXpjUWVoVWxPcnZlT3Y2SHA1VTJ6?=
=?utf-8?B?QWlqNkRick4xL1FNQTA2RmUrQUpDN2g5VFJ2THBkdmpRSE9zR045R0xuUGJS?=
=?utf-8?B?MHd0L0hyejhtbi9GQjhJMVhCRmtZZnhETlRXUzBsK3Y0L21VcHlRS1NzUHIz?=
=?utf-8?B?ME5tcDJpZUdUYk9wRENwV3pyTk4yWUlvRFY5RlYyaUhqLzRxdTRJK3Y0dXdr?=
=?utf-8?B?M1plMmh1ZGxnNkRwWDVQMjc1VXY4VThXYm5ySHBWd1R3Y2c1T29jdEc2c3k0?=
=?utf-8?B?bVRPekthaVVrWld1bk1UVHZUdm9tVERCSjU0UWN0UlY2bENiM3FBTG5nWHk2?=
=?utf-8?B?cUpERW9VTVZBZmxxbkdwMm4xeWIrTjlYbU04bU14U3p6S216K3VOc0Y3TzF4?=
=?utf-8?B?ODZyZzZNekZlenpYQjFuc09aMHN2SlVqcG9tcDNwaDhWZ1ZtYkpTSHdrbWQx?=
=?utf-8?B?cFJwNUlRSS9NSTNtYVY2ZDFuR0R5WTU4RlhOQVEyY1RmdENxZ2NjREpxa1pu?=
=?utf-8?B?UmYxd2kyTkxnWTlKb2xzSlVaeFovU3ZwTmI4czIvYXZteGJNdE4zUUQzRmxW?=
=?utf-8?B?TkE2Rjc5K3A5YndTeDUySnJ3b25KUkJ5QlN3aXptNE5GUUVLTitvRlJWbXI2?=
=?utf-8?B?M0dOYkk3Qk9qM2wrWHlEU01GbmJ3YVJhUGdIdjFQOUJKMzdLRFFzU29YZW00?=
=?utf-8?B?ZjI2UWhiNkpVV0w5VUh4ekJwVjdxVHV5Sno4dzZGcnQ1RFJmb0ZPQUFsRUl6?=
=?utf-8?B?UDIzVXF6d05Md01nbW1zQ0JmN01DZjdTYTdUbVk4S3dlVVN5Rm8xUko1YmRY?=
=?utf-8?B?UEdveDJLQkE3WTNBMDlhczlBc2tnV1JIOU9XNVhpTWo4QUFnQmx2dTA1VUNa?=
=?utf-8?B?K2k1QVF5WHNxV3NlVXNKNkRkS0NaNkNCTmVpM2M5R1RtWER3dHNYb0poVk9u?=
=?utf-8?B?K1NwMmZhRnR5Z3JrcEc1TUtyMXhFTElGQ1R0UlNrYmxjdUVYelNDTnBNUjlZ?=
=?utf-8?B?WlZKRGJQdS9kOXY1LzBzR0xodlBWby9yVDBKUFFuNEpKZzAxZ1JuRkFDTkh5?=
=?utf-8?B?eEVObkw3eVBxM3oySjl4S1FOcHBqQXpNbHM5V0xBNUhZRkZlck53eEovbFJN?=
=?utf-8?B?OVlaOVh6aDR2VFRreGJMYitXNnpNZk9rOVc5QktYeDJ1b3c3UTlMTFpjZC8z?=
=?utf-8?B?aUxtRUFuVVgvTXJDQjRWdWFwTExMR1pQWEN4TzNtbzZVcFc3L01hdWtWcmEz?=
=?utf-8?B?M0ZJaFowL3M2dmZnSHlqTUJPNXo2d1UzS3R2cmV0Rks0MERmMjEwWHV1Q3Zh?=
=?utf-8?B?aFhXby9iZ1Z6MU1OS0xjaEl1Q2NRQStjWEY0UlpOZjNlcHA0S3lGRG15WnA1?=
=?utf-8?B?T0hMSkRLOWlsdUs3NXN0UFlvd1d5aVpRZDJFTDlFUVdhY2lVNStGcnNSZThI?=
=?utf-8?B?U0FnQU1OamZXUmpJNVhYc1RCUDYwRER5VWtmekI5T1ZmNDI3ZnhMakk1WWwv?=
=?utf-8?B?VlM3WVBQVmJONkZlN2xqOEROOXRPN3UvTmIrQWh2N3czaGZJeTR2NHVQL0xX?=
=?utf-8?B?RGFCTXY2N1lsS1RJejkwZ0VCekdzMUZSSHNVR0pyQjhqZnRhc2pWVkNJTjF5?=
=?utf-8?B?YldnWWhaczdZUXZhZEpScmNhNmkzbW1ucDFsbldYS3ZHeXdhYy9jdnIvSUw3?=
=?utf-8?B?RU02OWJ6K2RVSk5BdEt1eUVDNXZ6ZllZdWx2NFZIZSs3N0tUQWNlcmlrdWZH?=
=?utf-8?B?bk9VczJWdHp3YWFxQ3YzemNVeTBuZjJQZmlPQUtRTS8vam9mRTJzMkIwZGhw?=
=?utf-8?B?YWZiQ3MwVW1VMEErQjNqWWpxVG8zMVAwOWxmRTZOcDJ0SmNSL1l4S0hteTEx?=
=?utf-8?Q?bxNAt1LVCSc=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB5685.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016)(921020)(7053199007);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?SDVmUVZMaDhSSjR0Q3JSRzNpamFxSXNUZkhUTWVDN1MrZnZ3ZE5HcFZUMm9O?=
=?utf-8?B?eTRjQnFPRnZVQTcwbGZGSVlsOWZmRmxDWWhoMjNGL1FtUjJ1SWkranVURG5X?=
=?utf-8?B?RHBMWkxseGl4NC9wdlZOL3ZQbFZ1MytlejB4TjdZNzBTZENaWkYxTmU1NzRS?=
=?utf-8?B?cmFNL0s2YWo3RDNLTmxWTFdvMHZ0N1Q0Wi9GelJlUGw2SnBicEpTdVpjSldr?=
=?utf-8?B?cUljTGs1ZlpNekJsUkVsL0FjY3FHUEZ1bmptbTFaMWJQbmdqK3ZhZmlmQklK?=
=?utf-8?B?eDJxL2VDRW1laXliV0FRNVBuVWN3SnEwQzNjdFJKdlMzNEdmcmpBSXdMSVEr?=
=?utf-8?B?dW9qcWxOM29PZ09rZXNjc0lnb0VwMXozNzlJaXp3eUdqMU5iWTExK09wYXZV?=
=?utf-8?B?Zldmc3hId3gxOEJQUEF0b0JPN3Uyb1N2VU44cHdqQ1BBSXZZUklZMUFGVHpG?=
=?utf-8?B?cEs2cjEvdXRZbTJSQjV5YTBOdUw4QVhiV0ZEblhXMEl2czVkcGFUb1hEZFlD?=
=?utf-8?B?aGpmMXh2YkxUZjBTTzV1ZjI2LzEwc25TZGVtYXhqZk9JNVgxRXRySUtsYXFm?=
=?utf-8?B?a1EyLy94VkQ3Ukw1d0U5Zk5iR3F0Rk05ZDIvMUJkcmh5a3FrN1h1VXl1OW96?=
=?utf-8?B?cTdCTGt5dlZWSzRtaXNJNTFOZzlRNlp1UklXQjZpZlF3cnRuSUxEd3NoVDFF?=
=?utf-8?B?SXJ6ZnBKZmpxb04vZklmb2J1YVJxangzRTMyRDFIQUVXZHJPeC83dEY3Mzd2?=
=?utf-8?B?UDNWdlNWeUZrWDltdTNkNCtNbVhaTHdsbFc2eHpVa0ZOS1FFTU9WQ2NBK0Jj?=
=?utf-8?B?bmdBVFhscHpiRUd3NFFPa2dLTkIvQ2s5SEY4MzhxdktkQkp5NkZPSmpLcS8v?=
=?utf-8?B?ajRzemdYaVZubU1xZm5hR05RcG1MamwzUGNGTi80R0huNUNQY3gycnZCeFVQ?=
=?utf-8?B?UDNXZHhjTkR4Vy9QaFdrUHhac3QrTzNPbkc1ZlZ6UkVjK0wzZWV6Mjc5Rlpu?=
=?utf-8?B?V3F4bUJkY0RGcmxHZzlCL0c5cytXbkJia1lHb2ptcXkzOC9QaFRrQXFZbi91?=
=?utf-8?B?RncrWFJOK1huWTJ0cG12SkxJSWRGYjJQc011bHlNcEJhNDVHSGJQVHdESjFi?=
=?utf-8?B?NXprYSt5L3U3YnRpcWI3ZUtkUWRDYlFDR2NPM1VDNVJaU1o3b1hLQ0dMQlZi?=
=?utf-8?B?QU9HMVJ2VC9oVnlPWkRqa3NWYkthNllvQy92QUNKckxMaHhNRVFFREFkYVRt?=
=?utf-8?B?L0lSV2o5N2swbnQ5YTA3alZxSUp2UlVTUm95S25kS3ZwWkl0SzNkbVNvZ1Vl?=
=?utf-8?B?V2FHZHlWV3lZTStuM3VsS1Z3RUJaUVRCRVVJNHpnVE91d01wODI1OE5QRnVK?=
=?utf-8?B?L3MvRVBORkhRYW9sYUZKT2UxVkZ1bDcwUU9rbTMzZk1XVm9WRlJ4cHZiclZQ?=
=?utf-8?B?SVJaajFuTk1HWTlhazk1N1BXTk9mTXlyM3pwNXN4TnlCWDNnc1NiS0I2TEZw?=
=?utf-8?B?Q2VTcThyeXhEQUFTelY3ZXhUM2dlbDFHejdmb0lrSk1Qb1RHQ3gvYVJGUXNI?=
=?utf-8?B?UFZSNTlTdlluR2xsRU5zejNOOHc2TXQ5d3N4cWpadTkvdXUyWW1nWEZncTVO?=
=?utf-8?B?QmpwYy9JTkcvZkhJbUUyRUZzb1FPeWpSVjRUVjY0Yk5KNERsTFNxdkhuT0lL?=
=?utf-8?B?MWprSjNYb1NVQVdTU2hqaGc1WXF2K3AzbzZ0Si9QNU1YMzdpSVh5NmdKcUJF?=
=?utf-8?B?aUx0RWVpVU1EdjU5WG12RVpGYW16LzBvSk5RWll2SEQvbUZ3QmNWQVpRQUw1?=
=?utf-8?B?SXJIelF6QzMvcFN2aWxjY3VhS1NzWkxKb0VDTzVncGZEVUx1ekVNRTZ6ZGFr?=
=?utf-8?B?b1FLYkFWelRIU2ZIaDFJTDFPUWZiTnJyK0RMdzVqWHBSdnF5dHNRVlA5TzNE?=
=?utf-8?B?M1VneHV6UVpkT1FubE5DYU55RGYxSEd2ZjdvUlIydXlEZW95WE5oUFhWUWFw?=
=?utf-8?B?cXI2YW5MbnlYenFLaDF6Rlo1eVY2WFp5cjdGdWgvTmEyVUU0L3lRTnpBamR1?=
=?utf-8?B?cm9IQzNFL2ZuWGtYSldxb1BpZm5SZDZMblZtUTFzMm45ZFlXMUhIZHJ4ZFNy?=
=?utf-8?Q?jVyUGqHQ7514LvMzgCACBlVky?=
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-Network-Message-Id: c39a04d6-7bb9-4f0d-06c7-08dda50a7e62
X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB5685.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 14:57:44.7414
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 06NZgiaVjAZti9rNgZNg8HiO4/uqSeUpFaXxOyRo4BxU2NrAxpT12O4q0oK56bvu
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5741
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 15:14, Jocelyn Falempe wrote:
> On 06/06/2025 14:28, Christian König wrote:
>> On 6/6/25 13:48, Jocelyn Falempe wrote:
>>> If the ttm bo is backed by pages, then it's possible to safely kmap
>>> one page at a time, using kmap_try_from_panic().
>>
>> I strongly assume that we don't care about locking anything in this case, don't we?
>
> Yes, normally it's called for the current framebuffer, so I assume it's properly allocated, and isn't growing/shrinking while being displayed.
>
>>
>>> Unfortunately there is no way to do the same with ioremap, so it
>>> only supports the kmap case.
>>
>> Oh, there actually is on most modern systems.
>>
>> At least on 64bit systems amdgpu maps the whole VRAM BAR into kernel address space on driver load.
>>
>> So as long as you have a large BAR system you can trivially have access to the MMIO memory.
>
> For amdgpu, I used the indirect MMIO access, so I didn't need to ioremap
> https://elixir.bootlin.com/linux/v6.15/source/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c#L1800

Good point. That is probably quite slow, but works under really all circumstances as long as the device hasn't fallen of the bus.

> For the xe driver, I only tested on integrated GPU, using system RAM, so this first approach is good enough.
> But I'm still interested to find a solution, is there a way to get the current io-mapping if it exists?

You need to ask that the XE guys. There is TTMs bdev->funcs->access_memory() callback which should allow doing that, but I have no idea how that is implemented for XE.

Regards,
Christian.

>
>
>>
>>> This is needed for proper drm_panic support with xe driver.
>>>
>>> Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
>>> ---
>>>
>>> v8:
>>>   * Added in v8
>>>
>>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 27 +++++++++++++++++++++++++++
>>>   include/drm/ttm/ttm_bo.h          |  1 +
>>>   2 files changed, 28 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> index 15cab9bda17f..9c3f3b379c2a 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> @@ -377,6 +377,33 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,
>>>       return (!map->virtual) ? -ENOMEM : 0;
>>>   }
>>>   +/**
>>> + *
>>> + * ttm_bo_kmap_try_from_panic
>>> + *
>>> + * @bo: The buffer object
>>> + * @page: The page to map
>>> + *
>>> + * Sets up a kernel virtual mapping using kmap_local_page_try_from_panic().
>>> + * This can safely be called from the panic handler, if you make sure the bo
>>
>> "This can *only* be called from the panic handler..."
>
> Yes, I will fix that, it shouldn't be called for normal operations.
>
>>
>> Apart from those open questions, looks sane to me.
>>
>> Regards,
>> Christian.
>>
>>> + * is the one being displayed, so is properly allocated, and won't be modified.
>>> + *
>>> + * Returns the vaddr, that you can use to write to the bo, and that you should
>>> + * pass to kunmap_local() when you're done with this page, or NULL if the bo
>>> + * is in iomem.
>>> + */
>>> +void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page)
>>> +{
>>> +    if (page + 1 > PFN_UP(bo->resource->size))
>>> +        return NULL;
>>> +
>>> +    if (!bo->resource->bus.is_iomem && bo->ttm->pages && bo->ttm->pages[page])
>>> +        return kmap_local_page_try_from_panic(bo->ttm->pages[page]);
>>> +
>>> +    return NULL;
>>> +}
>>> +EXPORT_SYMBOL(ttm_bo_kmap_try_from_panic);
>>> +
>>>   /**
>>>    * ttm_bo_kmap
>>>    *
>>> diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
>>> index cf027558b6db..8c0ce3fa077f 100644
>>> --- a/include/drm/ttm/ttm_bo.h
>>> +++ b/include/drm/ttm/ttm_bo.h
>>> @@ -429,6 +429,7 @@ int ttm_bo_init_validate(struct ttm_device *bdev, struct ttm_buffer_object *bo,
>>>   int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
>>>           unsigned long num_pages, struct ttm_bo_kmap_obj *map);
>>>   void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
>>> +void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page);
>>>   int ttm_bo_vmap(struct ttm_buffer_object *bo, struct iosys_map *map);
>>>   void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct iosys_map *map);
>>>   int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo);
>>
>



Return-Path: <linux-kernel+bounces-675893-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C830341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 10:58:38 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id C74C3163C14
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 14:58:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 07979288CA0;
Fri, 6 Jun 2025 14:58:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WEsSPpjR"
Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA7AB27E7CF;
Fri, 6 Jun 2025 14:58:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749221905; cv=none; b=FdnS56CusMUy/ARFj3jPUjzfwCoMczpR1QQtEXdZvZ8/Gp0J80ormYaJfbTf9/wnHLu9kcy6K0ScZZdS1QWEGNUedgTIlnb5V2oMcz6eGosx2Sfi7ahJYMw0dXYPD564hqaVthdPM3vAfUxSZ2TIuzudW510BFD2F9HbfFtlqY4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749221905; c=relaxed/simple;
bh=L3ansMab82uYiup2PPPtsuZ7QMMlqwUdIbnuDaDUGZQ=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=RXubPFqMUQwaoO1rmthG6lawk97Iqjt562IYH50EA6TpZfJLXqBvcotqlL62am7uJOLOzPL1nGdX+JJdmwGHzfz1SQq8MXWdcaEQ3nxC4tbcyWXvTS50xkRlPEgQPYrYMp2gPby9/HBHxA2vY5wJM7g0Nf7DGQlBTrHATduiEXA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WEsSPpjR; arc=none smtp.client-ip=209.85.222.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ua1-f50.google.com with SMTP id a1e0cc1a2514c-87ead500f9aso1193276241.3;
Fri, 06 Jun 2025 07:58:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749221902; x=1749826702; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=L3ansMab82uYiup2PPPtsuZ7QMMlqwUdIbnuDaDUGZQ=;
b=WEsSPpjRro+OtSr5TZInS5YlqrDfteWA0XAJBquWoMwUE2K//mT5NUOC46JIaSM2DL
eb1wMM5WspZ/r3bFpKuNVqSMJzuMgBu1l9FVlPr+yZ0MO0SqmX9SUpX6CPkuzAWvDCG+
HollNWQRqCVZA197KkKyiUx2zEUf4i0G2LZ2euHa8WLNPQCOrymzdqFmVTrdS1OLYhat
61142HwcsOp/bDbpuYKLe78FtF7jW/EuIIwz6r0vpOVAyJQWgQpFb6LFwLCd7AgE05wo
rD7rVhGZcVOB/P9tsqNuNxk/V+tuCOFR226jqa3s+BZj/ueXg+fBJQtbjLrNFbC5TZbM
uk4w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749221902; x=1749826702;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=L3ansMab82uYiup2PPPtsuZ7QMMlqwUdIbnuDaDUGZQ=;
b=HmMtmTFb3cgt3UbM+LzV27ltfol1ZdEFpMH+ffj2S/89Pl8STx65DYk7FEwo+58r6c
6j1icaY+MSF1t32DCdKONeyhfyph5O9yCIw8HqOsM40vopf1y0FN9HcaO7PI4ewye2n9
iOvN6DTENk3zj4yBPJlH0CvWbk/b8actDB4T4g/3NLE8p2QwEGPvFfkWlLMI3Vy6fADR
+QJKETBrJ9EBpQt9AJVQqTnsIB3wb/+4J57darYJO/g6hyMmyVCiYzHM3GqFKSEKy8iT
VvmQGaATYGEinALoeDC07Wbv0HndD3J8WYe9c3If8RZkFx51q1Ql3SY0eF2z/DweZriU
2UKQ==
X-Forwarded-Encrypted: i=1; AJvYcCUaeiQZyG5rvSu07rf/xIv3dxQm7ySzhEuJJGeNsXng+MFlSIYXjHG5aXQxSF6JLnisOchQKQQRRBnxkQMlouI=@vger.kernel.org, AJvYcCVej/gwuRpmkYo2r1FQRCHFq7OKpUR/65C0XnDvtNpdNpUC5cK+ydzeiypQ34XWT6anIHlaPcOTYIm1YRia@xxxxxxxxxxxxxxx, AJvYcCWSefYTXR3qdDkDgg7NuBZMDxDSZ3p7+8bmPrm02ttqdp5oH1G83gd8bDc0kd8mWJJkr6pEQ7GB0FaQ@xxxxxxxxxxxxxxx, AJvYcCXVmfFCyRNO+iQNBt6UAj4bF56ZNPfMWMHLSwvyT/D7pYxcKQ+69VMUZZ9kRvxYs7I6PRfZhRsHK6Zf3w==@vger.kernel.org
X-Gm-Message-State: AOJu0Yzsh+sux3dYqMQu4VZUY+3spTLr1qYvMGej7fuIo3iSvcEbHa8O
r7l13tt4f+Wrz0yXAxNJhNETOBM0XR0GCVdYRmTjPeiDZz46bF4etbTMzCBJqy/kovqsQAZdCag
n+bn/GB3++K6xpk4fquL3KIfovDW2sbo=
X-Gm-Gg: ASbGnctsE3TAmDI+ujJJ3SL4TNQjUEMvwnqzUu3JXQwTBgDDUSRJ4oGCaANKyO7w81V
JfnU3w7DIxMrUB2PvYloXKXCgubYAB0y3cV03bf9NpUJ9kp83RwHijm2R5fVmdnGHGGaok/QZJR
EOma+dUG1IsKe3lcWkI8s4OrYdXAz5K2fH08iQGFeP
X-Google-Smtp-Source: AGHT+IGEngtE5dWaklnsqQU6Ig0UmMfAlJowM3JqRrbcvQtEtfvISuLc4Jr4sWBXQ4ZCf8k92OHmpc46xgu8moJvcw4=
X-Received: by 2002:a05:6122:2193:b0:529:1a6a:cc2f with SMTP id
71dfb90a1353d-530e48876e6mr3854370e0c.7.1749221902592; Fri, 06 Jun 2025
07:58:22 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605162726.3659792-1-igor.korotin@xxxxxxxxx> <aELyEqg0GrkC8oZY@pollux>
<CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx> <aEL76mgHSZG5idW8@pollux>
In-Reply-To: <aEL76mgHSZG5idW8@pollux>
From: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Date: Fri, 6 Jun 2025 15:58:11 +0100
X-Gm-Features: AX0GCFuTvai9XMEtyC_KYBdO9EciOGTan2CvJLh680Tl9vtdtqAjm7YLmxzKx0Q
Message-ID: <CAG7QV91kkVqE2BgB5VpmX7QST25VDCqr+9zNx1Nt0-fuwp9t=A@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v2 3/5] rust: driver: Add ACPI id table support to Adapter trait
To: Danilo Krummrich <dakr@xxxxxxxxxx>
Cc: Igor Korotin <igor.korotin@xxxxxxxxx>, Miguel Ojeda <ojeda@xxxxxxxxxx>,
Alex Gaynor <alex.gaynor@xxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>, "Rafael J . Wysocki" <rafael@xxxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, rust-for-linux@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, Boqun Feng <boqun.feng@xxxxxxxxx>,
Gary Guo <gary@xxxxxxxxxxx>, =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>, Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>,
Viresh Kumar <viresh.kumar@xxxxxxxxxx>, Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>, Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 3:32=E2=80=AFPM Danilo Krummrich <dakr@xxxxxxxxxx> w=
rote:
>
> On Fri, Jun 06, 2025 at 03:26:13PM +0100, Igor Korotin wrote:
> > On Fri, Jun 6, 2025 at 2:50=E2=80=AFPM Danilo Krummrich <dakr@xxxxxxxxx=
g> wrote:
> > > However, I don't understand why we need this and the subsequent
> > > is_acpi_device_node() and is_of_node() checks.
> >
> > The idea is to avoid unnecessary table lookups when both OF and ACPI
> > match tables are present.
>
> Ok, that's fair -- let's build it on top of the FwNode abstractions thoug=
h.

I'm ok with the FwNode abstractions. Just to make sure I understood
you correctly:
I'll need to wait until these FwNode abstractions are pushed to the
rust-next branch, reimplement what is necessary and send v3. Is this
the course of actions?

Thanks
Igor


Return-Path: <linux-kernel+bounces-675894-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B870241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:01:47 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 3299118885C4
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:02:01 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8754D170826;
Fri, 6 Jun 2025 15:01:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cgL4adfy"
Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FE268460;
Fri, 6 Jun 2025 15:01:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222096; cv=none; b=OAKWORWs3tZcfsmqtxGfc3oupn5biXfytz+dMmHRX+CaMQUq0TZP2r1/5ysIEQMFTprJm9npaezrtih5gHDL3S8zlJRwldpryXFeeuyz3/HroygqiQrNFpBLD9MZ3L4pOTTL63bKHPKdjeDBcWh2X4S1hSZvw6W+9M3Ltzmb4GY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222096; c=relaxed/simple;
bh=yUUhB1V4P3vMF52b0JssHYCOLC3ksdnfcLgsPK4tb8I=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=VQBu3KfD3iQAshKYQoLGSy4sIZIqmrcyNxcxYdEVPbLosYLbJSGKU626N4RmfLEpttYQ4w/poKOk9X/YoXkNgsFWbd6tJF3+iWU1O59z8Sw20aelqkDwkZvLq7WGEz7tfrxrhFri09PDMRDWflHyUsJKFDUEbVZODGoentJG2i8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cgL4adfy; arc=none smtp.client-ip=209.85.128.43
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-43edecbfb94so25484705e9.1;
Fri, 06 Jun 2025 08:01:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749222092; x=1749826892; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=XhE/4kgP6Fj+Sk1yGpIDfKiYEXxDvnVhFRdNE9ODL7c=;
b=cgL4adfyWXgCRWpv68FR8aNVux6r7CeKCFyXaCIi73oWOCNhBHFGbJzDM5bl8yxRED
B5gjXwz6ORzE3tha/oGb5Y+I3AmbM0k9/P0CRLCVdArqoou69pNcO3xTszZhOGnmn3vT
qC1VJyCGLoMruTFOB/AVpYhV73IQsbT2J7bdOr9l8LnBpPzTM59aoDsLE1RSufgI2Wh6
MMq5esi+mDm7GpKVuqLXh0B3hOBXwiJe0eSex4EhIAAuGcMsz9w3OQ71bJ4jF6DbVpT1
5QgOQ+tqt3D2e1GdQiJ126G+23bnKzDhd21P738HihJc8ZOsyHwJ1RkmP7gh5bvXXYiW
ipww==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222092; x=1749826892;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=XhE/4kgP6Fj+Sk1yGpIDfKiYEXxDvnVhFRdNE9ODL7c=;
b=UFjpDOWHlWDFrJF25yV2FCQWfMWhIuxN3WFg5SP/NhdXMa6X8PyPDvQWRXi0WLJuW/
OtdyTxbfM9hqY05EB2yeSkB6piIyEFi8ys3BUUGBhyCsYxFZ2Fcsqd0WOI/ITkBWr4AX
e2P5oO3WLccZcZ+9zaIb364EeqeX5lGJLzqo32+69v/wqV+KYe3RYAbGmg8kAfe0v7+6
2+Mcztf7k7A2wT71+cocGGhtv+DJzJ/U2rDsd0WINER2u0FbyS9FZ228VWxafdg5/lKj
HAo0UBs2lwHBoAxAr+mgfkELtND/JksQ7/YI6N6wDytcEYByGRnlT8O++xzl5e9LA88K
Txqg==
X-Forwarded-Encrypted: i=1; AJvYcCUskQacVXBxdrdEyWFxrq9ooqaspplMZbpAEsQLSy7v9rQH86qZopogmUT01Su0EPh3JroXuZRR8/s=@vger.kernel.org, AJvYcCXfW9ys3BMtrCJDfXf+SFZOoos8+O8sCgOFdd1VFGmAaTjCiT8W6Z39kKq+5uemgMJ9Cxy/eJZNYY2CPeBI@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzFt5jdQpRWTIZVVOEiMvE3osO+maEfIPRjh7oyvedaVkpDgQuF
NysuFMJCoBs8UiXyF9nuessOcAkAO68IfQxHlLbRpY1cEOPwmOrv7ZWe
X-Gm-Gg: ASbGncvYJDsmV/vkkYS/Aggwfj044tZq75qRkSIa1BYV1QSQ13+zoM2i5P5X+r7pMAx
IrzWPdw6hIQQ/DOM4BR/miwBCLHhNUVyjvi0tdQBy4b2HwbL+JHUdRWP3fjmWLNAUqgJtBNKgAq
AU9evENSklh8bt9grM1FFUMZxzrQKMpKTL+hULYO+xtMrDXQyZu1Sa/ncn8lKkkfSjBmU+qNmSB
pjLsDI4xAbCv9dNVE1ppBaITr4jBSNi5WxcBkcnA7n821VuuPiBTwtYTYUBtg3YknXPtbHE7/yR
hxL3nn5/hiIH9w35u9m70JMHQF1J3wet9Z2RoFmtmRWdndfyGOwF0+NEa8OTe8HHzTBeNyrOLHr
LbjX+PSJHvSSegY4WlWC6rphaUmeZwludcTpvitgnIDHiihg=
X-Google-Smtp-Source: AGHT+IGht4L4AYrqtRi/DYoLhXywqrxJl5BXrMudsXr/8v6ZxPuIrlGuqilGoY0sNyJ/JMif5N4S6g==
X-Received: by 2002:a05:600c:1ca9:b0:43c:fbbf:7bf1 with SMTP id 5b1f17b1804b1-452013fb5d4mr44245585e9.30.1749222090165;
Fri, 06 Jun 2025 08:01:30 -0700 (PDT)
Received: from ?IPV6:2a02:6b6f:e750:f900:146f:2c4f:d96e:4241? ([2a02:6b6f:e750:f900:146f:2c4f:d96e:4241])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45203e6e424sm27286955e9.0.2025.06.06.08.01.29
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 08:01:29 -0700 (PDT)
Message-ID: <a179fd65-dc3f-4769-9916-3033497188ba@xxxxxxxxx>
Date: Fri, 6 Jun 2025 16:01:28 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [RFC] mm: khugepaged: use largest enabled hugepage order for
min_free_kbytes
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, david@xxxxxxxxxx,
linux-mm@xxxxxxxxx
Cc: hannes@xxxxxxxxxxx, shakeel.butt@xxxxxxxxx, riel@xxxxxxxxxxx,
ziy@xxxxxxxxxx, baolin.wang@xxxxxxxxxxxxxxxxx, lorenzo.stoakes@xxxxxxxxxx,
Liam.Howlett@xxxxxxxxxx, npache@xxxxxxxxxx, ryan.roberts@xxxxxxx,
dev.jain@xxxxxxx, hughd@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-doc@xxxxxxxxxxxxxxx, kernel-team@xxxxxxxx,
Breno Leitao <leitao@xxxxxxxxxx>
References: <20250606143700.3256414-1-usamaarif642@xxxxxxxxx>
Content-Language: en-US
From: Usama Arif <usamaarif642@xxxxxxxxx>
In-Reply-To: <20250606143700.3256414-1-usamaarif642@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 06/06/2025 15:37, Usama Arif wrote:
> On arm64 machines with 64K PAGE_SIZE, the min_free_kbytes and hence the
> watermarks are evaluated to extremely high values, for e.g. a server with
> 480G of memory, only 2M mTHP hugepage size set to madvise, with the rest
> of the sizes set to never, the min, low and high watermarks evaluate to
> 11.2G, 14G and 16.8G respectively.
> In contrast for 4K PAGE_SIZE of the same machine, with only 2M THP hugepage
> size set to madvise, the min, low and high watermarks evaluate to 86M, 566M
> and 1G respectively.
> This is because set_recommended_min_free_kbytes is designed for PMD
> hugepages (pageblock_order = min(HPAGE_PMD_ORDER, PAGE_BLOCK_ORDER)).
> Such high watermark values can cause performance and latency issues in
> memory bound applications on arm servers that use 64K PAGE_SIZE, eventhough
> most of them would never actually use a 512M PMD THP.
>
> Instead of using HPAGE_PMD_ORDER for pageblock_order use the highest large
> folio order enabled in set_recommended_min_free_kbytes.
> With this patch, when only 2M THP hugepage size is set to madvise for the
> same machine with 64K page size, with the rest of the sizes set to never,
> the min, low and high watermarks evaluate to 2.08G, 2.6G and 3.1G

I forgot to change the other pageblock_nr_pages instance, the patch
will need the below fixlet as well. The watermark numbers will then be
the same as when 4K PAGE_SIZE is used.

commit 0c6bb4e5b3aa078949d712ab9c35e7b2a33cd8a4 (HEAD)
Author: Usama Arif <usamaarif642@xxxxxxxxx>
Date: Fri Jun 6 15:43:25 2025 +0100

[fixlet] mm: khugepaged: replace all instances of pageblock_nr_pages

This will change the 64K page size, 2M THP hugepage madvise min, low
and high watermarks to 87M, 575M and 1G.

Signed-off-by: Usama Arif <usamaarif642@xxxxxxxxx>

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index e64cba74eb2a..1c643f13135e 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2650,7 +2650,7 @@ static void set_recommended_min_free_kbytes(void)
}

/* Ensure 2 pageblocks are free to assist fragmentation avoidance */
- recommended_min = pageblock_nr_pages * nr_zones * 2;
+ recommended_min = min_thp_pageblock_nr_pages() * nr_zones * 2;

/*
* Make sure that on average at least two pageblocks are almost free


Return-Path: <linux-kernel+bounces-675895-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C463C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:02:13 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0BE9E168B54
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:02:15 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3235D1A841F;
Fri, 6 Jun 2025 15:02:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dkev1l3U"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63D9413EFF3;
Fri, 6 Jun 2025 15:02:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222124; cv=none; b=LCMtJdAo0kwEwe+SC2o8NWEvER7Aji4GS++L8HY7EkldteICS6k+pmbXJxIBz9bULcDlMb2y2AdPOqhy2HbvxOmn0OoD0vuhqavWqctQOPgOeIQSJWzloPn80mldsmLWkne0gohLKJeuWgDZG/2xTmMc/oKYWbyqp7zV7bxGQHQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222124; c=relaxed/simple;
bh=O8kB7jya7MJUklWdBDfGyAbIfXaS0eU41lUunp/mlxs=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=IXk/GtOXcNTtB31+7yfdDAJBz62e3BeJ16K2GMI+CIwzMdlG1UdL+uqAFeO2Rg//+fOXRnPOyeDrji97EqAvx55rjM+zlKt3wfMbupZYf0hkIuwTXXD3A2buvRpjT809/3VcqMAEM+QuBMos1O44xDk5sQQHVbQmLbt+E0u52OA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dkev1l3U; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E514C4CEEB;
Fri, 6 Jun 2025 15:02:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749222124;
bh=O8kB7jya7MJUklWdBDfGyAbIfXaS0eU41lUunp/mlxs=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=Dkev1l3UmZlruTsci+pGK3iQ5QRzp0CffMyW+Xyk3TGHFzHNIQikq3gt4ohBsBHy2
ROTsG6QrCKXMRqkPC+5/isMlCadCLeL/DnbC9R6Z6EFlT5+e+KzGg2/n9ExCaGs+Zo
J66aQr4SEwJBkCBD/U6BMQjvRctm/MnhKHejdZj0YF0oCtvghT098E6S8ceSujM+yQ
fXT50Ri7ASBflKYQPVX9ntx6q+5l7oncvV/0GuqTfMPKu4FbYAd/5Xk9NzYWnJrnv3
sbFftXbjfEHBjSuBUvetFF6HcUrxteovFUwjzWd/SY2oBhOH/0qUXKesjwCw+cVFZg
boKBnkDbBe2eA==
Date: Fri, 6 Jun 2025 12:02:01 -0300
From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
To: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>,
Ian Rogers <irogers@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>,
James Clark <james.clark@xxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>,
Kan Liang <kan.liang@xxxxxxxxxxxxxxx>,
Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>,
linux-perf-users@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 1/1] perf top/report TUI: Provide visual cue when
starting annotation
Message-ID: <aEMC6a3BCbSWfcuz@x1>
References: <aEIJJIiuRTVjPaPT@x1>
<aEJdAs9P8m2ZiY5Y@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aEJdAs9P8m2ZiY5Y@xxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 05, 2025 at 08:14:10PM -0700, Namhyung Kim wrote:
> On Thu, Jun 05, 2025 at 06:16:20PM -0300, Arnaldo Carvalho de Melo wrote:
> > Sometimes it takes a while for the annotation to be presented after
> > pressing 'a' in the 'perf top'/'report' TUI, provide a visual cue
> > informing that the annotation has started for that symbol.

> It's probably because objdump takes long to process DWARF. I think I
> need to update this.

> https://lore.kernel.org/linux-perf-users/Z_gunJ9C3H25Uo9Q@xxxxxxxxxx/

Humm, in this case I had explicitely asked for using objdump:

root@number:~# cat ~/.perfconfig
# this file is auto-generated.
[annotate]
disassemblers = objdump
root@number:~#

So, yeah, its objdump running but in my case there was no DWARF
involved, it was just a big C++ app, so the ELF files were big and
objdump takes a long time even without DWARF.

One way or the other, your patch switching to use objdump when 's' is
pressed is a good one, please update it :-)

- Arnaldo

> Thanks,
> Namhyung
>
> >
> > This is the quick and most of the time improvement, but for some cases
> > its better to improve on it by having a cancellable progress bar, which
> > is now in my TODO list.
> >
> > Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> > Cc: Ian Rogers <irogers@xxxxxxxxxx>
> > Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> > Cc: James Clark <james.clark@xxxxxxxxxx>
> > Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> > Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
> > Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > ---
> > tools/perf/ui/browsers/annotate.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
> > index cd1d452035a265d3..66ffeb96db29532c 100644
> > --- a/tools/perf/ui/browsers/annotate.c
> > +++ b/tools/perf/ui/browsers/annotate.c
> > @@ -2,6 +2,7 @@
> > #include "../browser.h"
> > #include "../helpline.h"
> > #include "../ui.h"
> > +#include "../util.h"
> > #include "../../util/annotate.h"
> > #include "../../util/debug.h"
> > #include "../../util/debuginfo.h"
> > @@ -1016,6 +1017,7 @@ int __hist_entry__tui_annotate(struct hist_entry *he, struct map_symbol *ms,
> > return -1;
> >
> > if (not_annotated || !sym->annotate2) {
> > + ui__info_window("Annotating", sym->name);
> > err = symbol__annotate2(ms, evsel, &browser.arch);
> > if (err) {
> > char msg[BUFSIZ];
> > --
> > 2.49.0
> >


Return-Path: <linux-kernel+bounces-675896-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0751241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:03:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0AF3517116F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FFFA28981F;
Fri, 6 Jun 2025 15:03:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XEyjJYcC"
Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE523158218
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222195; cv=none; b=BiWRFeVc0A3B5fbYufbi3Cgr3qp3AlYWHQBlQ6ECTfVN5vqWGkMzUyFt2+JlyUrl3h4vHjF0hHUpahMOl9kSVVm2SvRknP98mj614igGYU9aLW6qPPocXG97FmeMgQl+mmTk1cwza1oIfe9Xtnh2eZrECyFWzTE1X9Q3fSWx1so=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222195; c=relaxed/simple;
bh=7zSaIBi9uiibHWNuWKSeAbF5KYAWL6vX77slfEv5hbA=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=V17tB0f4ebTEks5atPaxQ9ViGHu3tX5Wjv2sWoVmEQnpZprui1oQF6ZdRqizsmJO1Wt+a1TVGJFXRzdHWBkYmisSXPblwM6WI+PTRfIGkEmOQ41bKArKHEmZxsyKpJ6/BtJJGg1lixRc363L1YxDIwy80ZR/iXV7D+COs7VI8ms=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XEyjJYcC; arc=none smtp.client-ip=209.85.218.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-ad891bb0957so354238266b.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222192; x=1749826992; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=RCcZVL4U6ihTDzJ3VSPWudzlRqrxb23wPEKhLKoBA2s=;
b=XEyjJYcCTUYSK6t2VRjMkTZj4v/Fg387qtOZ1N0NIpeHij3ULMSdoqfDpS/OxhfY5X
crpQrHELA/1N0LZNfPkutklv1QgDvl9qVKupzTTbqV3qppWeWlvMlgnpVGbUvsh/r0Z6
9FxjgyyAvdgWIHZ8nZWUVP4HhS2aGiCYUJopyRuSbtW2AL/Sueat+vEkJMQJUj1pYGs7
+KT9zkK9pbIYa2oRgC/fcoaX3ty1JClXJPbGCZ658+dFz0xl+1+3RRgZ5eCkfpVu6NW+
0WgUcOqLL+sPdZppvBCyH0PQUQOmsMrhy6vQUXcALK+BLb7JpKRCuhFD//QaaRCBX2fY
di1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222192; x=1749826992;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=RCcZVL4U6ihTDzJ3VSPWudzlRqrxb23wPEKhLKoBA2s=;
b=Q2p9A0m9pzyM654c0EAJdzkaoDFPe0DejFnqohfkT8ktVCkOIpY/ALKnwtvAKdc9uR
PmQTqDUW5R6+UcNrD/cQs7nBuyLCoi/yk4hBytPtwOjjNz8B5zQsuCY2yW9hAPl/PkaX
jD88l+5uZ+JOzuBn1CEUzLolW2zD0ZYU1aeJxtaTSQ9EFZpy4R2GovxdI38NKJPsvtqV
oD/wEBp2AdFzBWZfzahMSsdYnnVReR908yhaaQ4g6eKnsmEA3oyUvql9qa9mscEX4J6o
0x8eQoigZIb0DDYlGugF17QwazDETr907skg2q4umfqDslIaQt49emD+pEg99sJ9tGlp
bSug==
X-Forwarded-Encrypted: i=1; AJvYcCW1g0N2GPcKtTCMYITTrS7Dh7y/+XiF8MuBL1FQcEQGEiz/5iui2ibDHlxziSLukBDts1IaHjcohQx6+m0=@vger.kernel.org
X-Gm-Message-State: AOJu0YxPM34NU1NsghRxBc3ljNvP59kj7cG9ro3L4bL5JdIYvEsiFME/
AxSwQ4cJ9HDVA3782iqstY5NhLW3uKdrSvNtwOBHNkoKWB2G6c9w3k4P0SEQY2e9eBM=
X-Gm-Gg: ASbGncvTRU1mOWvb43kF64P5BhLGwf/Wtm2IERZZbEAomUc/r8+qPtFSuBjt0KeLY3e
1BrE+EfkqzokT5teNch5tZowbO1uLWath1NHC+U2SJeb9Kabx6WNHe9wx/bRYZPLmHucAKcBVtv
IhZ+oKRDyN5ZlxIE9UpbseqX8pUpTZEMfOCqvNL76ScXIQdE6KQScoWFK+sPxgWsIcacDfFA0G6
+n23ecc7+SqgKoD+FQQkBUojGPcSWKwxAMsrGQ232ORNN8A9JZaKQsD42SLpJA3UrcQMQacvH2e
13I5j9bPTvI/IUuczS93GxzNXZEBX0qQ7tUx4BR0Qhzby26lOr6TfdkfCEwOEYLfzAs22rSpBkZ
NOpE7FW400GUKWBlh8BSwEcRZdHFTeXPI6FOk/wdz1mhhrQ==
X-Google-Smtp-Source: AGHT+IF9JL8hjME8iUOhCNN7DFMjh4zd0yx4XgWB3wO5GrjhD+ZZ+DAVbctjpCTTiSCGzDKTRCksCg==
X-Received: by 2002:a17:906:c113:b0:ad8:8364:d4ab with SMTP id a640c23a62f3a-ade1aaf4eb4mr352597966b.49.1749222192110;
Fri, 06 Jun 2025 08:03:12 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:11 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:02:57 +0100
Subject: [PATCH v2 01/17] dt-bindings: firmware: google,gs101-acpm-ipc:
convert regulators to lowercase
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-1-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Using lowercase for the buck and ldo nodenames is preferred, as
evidenced e.g. in [1].

Convert the example here to lowercase before we add any bindings
describing the s2mpg1x regulators that will enforce the spelling.

Link: https://lore.kernel.org/all/20250223-mysterious-infrared-civet-e5bcbf@krzk-bin/ [1]
Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml
index 9785aac3b5f34955bbfe2718eec48581d050954f..62a3a7dac5bd250a7f216c72f3315cd9632d93e1 100644
--- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml
+++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml
@@ -64,7 +64,7 @@ examples:
interrupts-extended = <&gpa0 6 IRQ_TYPE_LEVEL_LOW>;

regulators {
- LDO1 {
+ ldo1m {
regulator-name = "vdd_ldo1";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1300000>;
@@ -73,7 +73,7 @@ examples:

// ...

- BUCK1 {
+ buck8m {
regulator-name = "vdd_mif";
regulator-min-microvolt = <450000>;
regulator-max-microvolt = <1300000>;

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675897-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 18C5D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:04:00 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id A8DE27A6A84
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:02:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 50AFF289838;
Fri, 6 Jun 2025 15:03:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tCeyoXrr"
Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60E12126C17
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222196; cv=none; b=TfiUqbiR3iTUenPsXNSfs9gIlie3tNQO66cYIb+DDrn1yxGiMippmE7SJ6f7iNiZQCyg3dI0nPIypBhrEXoplAlNQPspXgVR2iLVEbpFhfiDtFGD6ZfWo5cZtJI9eAwBlR230JueRx6imehXrFcu/O6jIkYBoe78L/SeiZBCUHY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222196; c=relaxed/simple;
bh=btkf0lCvrMjyzHz74N96le8Cu3zc6t3SCGCylfXW8Bk=;
h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=QfQi0DTkgzr+1GZ0z4gzG9qZyUX2RyPJI8U+/iDOBYPKetBgPoV3P91K4x2lhzkwvKVHggwGWULRsGhJGGoVrIZelVj1VYPTumwJyGsbEkc2n93oHoygugpMpvxS2Te7EmxbsLNlsMbnOgXmlG3N/5mKXTJ893pmoBKtO64UtcQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=tCeyoXrr; arc=none smtp.client-ip=209.85.218.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-adb2bb25105so348912666b.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222192; x=1749826992; darn=vger.kernel.org;
h=cc:to:content-transfer-encoding:mime-version:message-id:date
:subject:from:from:to:cc:subject:date:message-id:reply-to;
bh=sL0NPPUOpjJueDAk+KZ2ucVSf7x+fRKCj5Y9NG8Z/P0=;
b=tCeyoXrrvQsHnaGmrgWunswmPMUNSvKXs+DbsBan7pKmJP2RMiwao219plNXr5L1yo
P1+i7AcJaXdyI6ZWqkdcV0vLVVT+YQxBtIMGx1uML+V/tgNdUC0UfhBIpIY9aj5Dv30I
wmg+ZnGHiwY1uSoQn7E4ATH4yYnsdwY1m6prYOxpKcWXRHVV24oX8NhRzbJVJn3mvDTG
CM4AlTumkUCifj5Asn/Cuha4J4V1yiCK8KydqtrF9DAVI/6guH4YAj3ifHsESs0tbXYT
Yv/mBIaXgY9IzVErOct/m6MCeYxL9yGkZk/hY3I+JJP6Rew3nVGMEReKUFrr7HXMHKEc
t11w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222192; x=1749826992;
h=cc:to:content-transfer-encoding:mime-version:message-id:date
:subject:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=sL0NPPUOpjJueDAk+KZ2ucVSf7x+fRKCj5Y9NG8Z/P0=;
b=s1Hhw2yEoF8b7YtTJDr0NgfJOIPEzz1kl/f8+jyBj/EF5jCTYO55s3KQscnJ6riEsf
6TWTDH2Fd3GcBzEbWHLCN6TfWEPgP2lVIaIQ34QE4HReewX1E0RFY9qudrZHfJaUUu73
1ddVPsDR2koJjykjol7plumawIl6TVYJ4Wl03xgy1gT3AyzDz8yu5CzvdBoqEBuDvypn
spiOM9Y4HtEzyq/cDs88u43OH+H9duxZHaBweTtlAF5UGvMdEJ1b4o8E9wAyS05lr3zl
e3gLXY21KCf/GfuchR0KMQR7ajtRffO3z6ebuPo8aqk2n55D5IZp+FfpA3FDdzI3IvXX
tkzg==
X-Forwarded-Encrypted: i=1; AJvYcCVaUjqdWRwfz/VwaqY3JM+XMwRtkfcc+rKCIc/O2kPr7PXwOIVfIT/8ev+9jcBpPCT3BIPnbhzQJX+dlK8=@vger.kernel.org
X-Gm-Message-State: AOJu0Yx6W4/JYJcv6VXTs7hYAmszwOgkjHbF8+WBKYVPjLb9vOhIQKi/
Mgy39KwJR1k6HoaJCIaP3Jhg3VPPoYIBOFCmfwWCH/2114GfrgL0SYLVlKdkwFmBPRE=
X-Gm-Gg: ASbGnctdiIA9r2YOwwk9LpWUBF42dfGPjo9lxVbUqyp+ckSH9RG/ffO2dq4cGDW+3pV
fH9F08U/HeOgwj5pc1yYdNaYZdbGEsDkKKgKs7uqFotM6TYy0hYV28enI8q/F6JmF9X0u2EpVsR
cyI9UHSI/yuE9Cc7j2loS6dhdeQ1b732zETAt9JzOEL4Rq9YPksc0T3OyU9Puai1fqY/SQnHHhz
G3aqRIbv+/Dpk4MB3pVaKvvwPqc1CSnYwGL4DJPdDLn3zXHRFn0tvp7f/8qK6AlJES6KmIrwxqf
IfwStX+t8fN7vp5WBCvCpy4s2nBUAqt7CzXWIcI4bCcI5OgznBMmNLXC5sdXvjjBFVYZ4sQtlVC
OCwbjKc7IubpvSIBFidi9cB0Sbw35QAuhuUU=
X-Google-Smtp-Source: AGHT+IFckBTXxQmRXFaz18J/Im2r+F4pi9FIGkM2uCqEUErwgGltAH9DjE5QEFZD5wDsBrpHlrpCLw==
X-Received: by 2002:a17:907:940d:b0:ad2:3f54:1834 with SMTP id a640c23a62f3a-ade1ab87bfcmr336793766b.40.1749222191503;
Fri, 06 Jun 2025 08:03:11 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:11 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Subject: [PATCH v2 00/17] Samsung S2MPG10 regulator and S2MPG11 PMIC
drivers
Date: Fri, 06 Jun 2025 16:02:56 +0100
Message-Id: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-B4-Tracking: v=1; b=H4sIACADQ2gC/22NzQ6CMBCEX4Xs2Zq2VPk5+R6GQ8Vt2QQp2SrBk
L67lcSbx28y880GEZkwQltswLhQpDBl0IcC+sFOHgXdM4OW+iTPshRRP2avVsHoX6N9Bo6iskb
1ddk09uYgD2dGR+suvXaZB4q5994/FvVNfzrzT7coIUW+qisjnWksXkaaLIdjYA9dSukDeyQFE
LUAAAA=
X-Change-ID: 20250603-s2mpg1x-regulators-7a41c8399abf
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,LOTS_OF_MONEY,
MAILING_LIST_MULTI,MONEY_NOHTML,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This series extends the existing S2MPG10 PMIC driver to add support for
the regulators, and adds new S2MPG11 core and regulator drivers.

This series must be applied in-order, due to the regulator drivers
depending on headers & definitions added by the bindings and core
drivers. I would expect them all to go via the MFD tree.

The patches are kept together in one series, due to S2MPG11 and its
regulators being very similar to S2MPG10.

The Samsung S2MPG11 PMIC is a Power Management IC for mobile
applications with buck converters, various LDOs, power meters, and
additional GPIO interfaces. It typically complements an S2MPG10 PMIC in
a main/sub configuration as the sub-PMIC and both are used on the
Google Pixel 6 and 6 Pro (oriole / raven).

A DT update for Oriole / Raven to enable these is required which I will
send out separately once bindings have been OK'd.

Cheers,
Andre'

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
Changes in v2:
- s2mpg11 also exposes additional GPIOs, update all relevant commit
messages (nevertheless, GPIOs are out of scope in this series)
- fix some commit message typos: s2mp1 -> s2mpg1
- patch2: drop | (literal style mark) from samsung,ext-control-gpios
- patch5: add | to vinb*-supply description for better formatting
- patch13: update ::of_parse_cb assignment
- patch15: drop duplicated ::of_parse_cb assignment
- Link to v1: https://lore.kernel.org/r/20250604-s2mpg1x-regulators-v1-0-6038740f49ae@xxxxxxxxxx

---
André Draszik (17):
dt-bindings: firmware: google,gs101-acpm-ipc: convert regulators to lowercase
regulator: dt-bindings: add s2mpg10-pmic regulators
regulator: dt-bindings: add s2mpg11-pmic regulators
dt-bindings: mfd: samsung,s2mps11: add s2mpg10-pmic regulators
dt-bindings: mfd: samsung,s2mps11: add s2mpg11-pmic
dt-bindings: firmware: google,gs101-acpm-ipc: update PMIC examples
mfd: sec-common: Instantiate s2mpg10 bucks and ldos separately
mfd: sec: Add support for S2MPG11 PMIC via ACPM
regulator: s2mps11: drop two needless variable initialisations
regulator: s2mps11: use dev_err_probe() where appropriate
regulator: s2mps11: update node parsing (allow -supply properties)
regulator: s2mps11: refactor handling of external rail control
regulator: s2mps11: add S2MPG10 regulator
regulator: s2mps11: refactor S2MPG10 ::set_voltage_time() for S2MPG11 reuse
regulator: s2mps11: refactor S2MPG10 regulator macros for S2MPG11 reuse
regulator: s2mps11: add S2MPG11 regulator
regulator: s2mps11: more descriptive gpio consumer name

.../bindings/firmware/google,gs101-acpm-ipc.yaml | 44 +-
.../devicetree/bindings/mfd/samsung,s2mps11.yaml | 87 +-
.../regulator/samsung,s2mpg10-regulator.yaml | 147 +++
.../regulator/samsung,s2mpg11-regulator.yaml | 150 +++
MAINTAINERS | 1 +
drivers/mfd/sec-acpm.c | 213 +++-
drivers/mfd/sec-common.c | 22 +-
drivers/mfd/sec-irq.c | 67 +-
drivers/regulator/s2mps11.c | 1143 ++++++++++++++++++--
.../regulator/samsung,s2mpg10-regulator.h | 66 ++
include/linux/mfd/samsung/core.h | 1 +
include/linux/mfd/samsung/irq.h | 99 ++
include/linux/mfd/samsung/s2mpg10.h | 8 +
include/linux/mfd/samsung/s2mpg11.h | 420 +++++++
14 files changed, 2338 insertions(+), 130 deletions(-)
---
base-commit: a0bea9e39035edc56a994630e6048c8a191a99d8
change-id: 20250603-s2mpg1x-regulators-7a41c8399abf

Best regards,
--
André Draszik <andre.draszik@xxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675898-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B96AA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:04:05 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 094EF17B10B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 77203289E1C;
Fri, 6 Jun 2025 15:03:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MsUquoKD"
Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E7E5288C3A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222197; cv=none; b=Q7TTqBbIrquEdrWNAqM3XIrJRSKeN/OWXnGg6sxwcMHma0Fd1vMDROyUTjfpW2olD+VduQ4d3FuUqyaGKrdEfBm2ObDvvUvRENJ3B4r49g5k8WszwzSzhuJWDB3U4Ty4fs0uujHUnZwseHxchIUO7RlvxS82vD3y+uOTHOmYNFI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222197; c=relaxed/simple;
bh=SV1YEZhjghdwhLBj1UwFLLk2JQcneGTldmvPx/Nj0n4=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=Vyt7kXnS/Leyk9+6KGmGU1kHLmnnKU8oI8Dx8EW9dcoVJArPfgpg48re/nFjU9FZH1iEmpkY8qXbVmCeKZgbvi+FxROFo64cV18AYMkvJPzeTRKFkNqpZmqEHTjJsUoEVZ6Hzy+4m7AaG3k3kRAbY4FQ9e+X/DDzyG6CbRLDmqQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MsUquoKD; arc=none smtp.client-ip=209.85.208.46
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-60700a745e5so1243616a12.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222194; x=1749826994; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=5a0iQ1Zgu99ffy4hMTjSX982sJBmFY9Vv0OH16Bj8Kw=;
b=MsUquoKDSChE6v4iYJ1C/y0x44SRRNsjprg/xNm+tN8JzJBp/U/vX6wqcrpPFyiZyB
zWaZugr1OL5FGB7qvby5QH3+ukBtDOhyxWidarXgn6Pi+dSqUOwaIwJCQ8iZE2eAXH0f
SzOCflzLsx1qlydb55YiRYRtZXWhjni1TX0yIfnPDdkcjIy6eGwEgX+57VIPCjey2FB9
iWjNt+cFxmYyH8eDO9w2fGcAA4BNQ6amOFv4VuBCLK9SZdcLLkRXT+cZsu0YdO2plFNL
5w3ZwVJ6MADfaBPSB3Ch7N0ZP4zpF03EewBObF6/ujq3+4slONlSy4ZTFksp9Eaapzqh
X/wQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222194; x=1749826994;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=5a0iQ1Zgu99ffy4hMTjSX982sJBmFY9Vv0OH16Bj8Kw=;
b=Cy97axUuby+sYrDpP+u2xfq6DcRTt4TCx0HVJ04g+XmXjke0SSg+3Gj4QdyYYu15/V
OEIGsQ5V8liYg+CoTkIsTzVYouLNeAwS1uEnDJ5327aFeKJh54rFfUgPIvq8C9ueAkzM
sOQgNLfkhoL3sy+cC/GfebD+Wd0+ALYbuus45wajXsnieOHhgX5ANob1rl0sasDGbqTF
uAOeVh1Blbz07fqNWG6C3HTRjyntIMQSF7+Vtm1LXtG8p661HkCotySGpEwmvJjQUUBg
naCc72xQTT76aWuypiLjGaT6hF9/0XdLJbinGO1A9n/Vv/n9nMisOoUtgSOtEeKfzMTU
FY0w==
X-Forwarded-Encrypted: i=1; AJvYcCU4x80m0z3hkGXiVz0H6cM21m8+++U9/EyDIvfvFLmO8HTBb4ShteFh0UObhxoqmcx+J50e1SF8vrD9+C4=@vger.kernel.org
X-Gm-Message-State: AOJu0Yy2S/zdsmfoCXNwV0rXETeR5yZ9LrEcyiO/gd3UWELoDOQvjkvK
M6cI/NogtsdEo2UnNvDLioRxLO65XBssuYJIV/fFI/lPp7vTxhAR5DchdxjGX/fXWCOCsNbRBQ3
7R8S4/vc=
X-Gm-Gg: ASbGncuDANJWOT3ytW67Xin0SzbVGbuyFWTH6sUFDTbeA5IuEfAoQMnpucxzeu1jpo2
UzPTMn9g0CwIROtIyHz/3dUvNJ+MeFxv52TdH74R0o83tka6gN+2dQqDeMyihRuzRu/9P3Tjg9Y
fTR4L66er2b9KevlTOOci40bvO42eqcoZg2JJX8ewfOSdrLrj6Qe+mlDIWQ2M2O82wnZGJLCuZT
uo10RIavlCEYK5EMwLdO+lghU+SPRmSBrypl95LIc3AgigYglYDqgEpUGCA5lQ2b6AYgzYvY4aC
gU92Shby2XDqqtmxSmy9djg84Xq3MtPEsGFskO8yperfdw3CvCh6iKVRnjfz+6Bsioai39t8+Pb
pTpdEgUeGUH0OzojcdhwOTmHWOW7MYlhkkUGdnvAfuCMs6w==
X-Google-Smtp-Source: AGHT+IFD0H7/bKqCGgjIWLRQSHdueyqkrNyxVEdxUASVzNc/Gd4FBNci113q+7Q9jH8HWKk/Y0thnw==
X-Received: by 2002:a17:907:3e0f:b0:ad9:16c8:9fee with SMTP id a640c23a62f3a-ade1a9160d7mr369309066b.3.1749222193726;
Fri, 06 Jun 2025 08:03:13 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.13
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:13 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:00 +0100
Subject: [PATCH v2 04/17] dt-bindings: mfd: samsung,s2mps11: add
s2mpg10-pmic regulators
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-4-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add a regulators node to the s2mpg10-pmic to describe the regulators
available on this PMIC.

Additionally, describe the supply inputs of the regulator rails, with
the supply names matching the datasheet.

Note 1: S2MPG10 is typically used as the main-PMIC together with an
S2MPG11 PMIC in a main/sub configuration, hence the datasheet and the
binding both suffix the supplies with an 'm'.

Note 2: The binding needs to switch from 'additionalProperties' to
'unevaluatedProperties', to allow adding the specific -supply
properties for S2MPG10 only, as otherwise we'd have to resort to a
global wildcard with negating inside each of the compatible matches.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
.../devicetree/bindings/mfd/samsung,s2mps11.yaml | 33 +++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
index d6b9e29147965b6d8eef786b0fb5b5f198ab69ab..0b834a02368f7867a2d093cbb3a9f374bb2acf41 100644
--- a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
+++ b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
@@ -67,7 +67,7 @@ required:
- compatible
- regulators

-additionalProperties: false
+unevaluatedProperties: false

allOf:
- if:
@@ -78,9 +78,40 @@ allOf:
then:
properties:
reg: false
+
+ regulators:
+ $ref: /schemas/regulator/samsung,s2mpg10-regulator.yaml
+
samsung,s2mps11-acokb-ground: false
samsung,s2mps11-wrstbi-ground: false

+ patternProperties:
+ "^vinb([1-9]|10)m-supply$":
+ description:
+ Phandle to the power supply for each buck rail of this PMIC. There
+ is a 1:1 mapping of supply to rail, e.g. vinb1m-supply supplies
+ buck1m.
+
+ "^vinl([1-9]|1[0-5])m-supply$":
+ description: |
+ Phandle to the power supply for one or multiple LDO rails of this
+ PMIC. The mapping of supply to rail(s) is as follows
+ vinl1m - ldo13m
+ vinl2m - ldo15m
+ vinl3m - ldo1m, ldo5m, ldo7m
+ vinl4m - ldo3m, ldo8m
+ vinl5m - ldo16m
+ vinl6m - ldo17m
+ vinl7m - ldo6m, ldo11m, ldo24m, ldo28m
+ vinl8m - ldo12m
+ vinl9m - ldo2m, ldo4m
+ vinl10m - ldo9m, ldo14m, ldo18m, 19m, ldo20m, ldo25m
+ vinl11m - ldo23m, ldo31m
+ vinl12m - ldo29m
+ vinl13m - ldo30m
+ vinl14m - ldo21m
+ vinl15m - ldo10m, ldo22m, ldo26m, ldo27m
+
oneOf:
- required: [interrupts]
- required: [interrupts-extended]

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675899-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CD89641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:04:28 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id CA70917B02B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:04:16 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 06FE528A1E0;
Fri, 6 Jun 2025 15:03:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eM1g3U1O"
Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68A3C289801
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222199; cv=none; b=q39WTtjczFVeJk6bX7x7DAqi06BivOTh6wKD9jLzCsINtVViOhzyyrdGqIZaC9303fg5L3cPY/iXOblHDH+xaDSc2fbzOEPlW1je/EZ/8XLzHkQuY5dfx3HQ10/SL5jEQs/K5C3t5A60wBAuIs/7zhMXQ3kDsjbD032+o3MX9v8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222199; c=relaxed/simple;
bh=s3mSTfiKouX/DXZqGMbD6vxo0PP5K4YwGopbgIII0PU=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=QmE7apSHx31x0rJ4eQ7aVh2yWf5HY0uIhexou9gvhQd9I8vs3jzb3kzqSS38RGzl6D2UnsNyDQW2U1jnkkaDJgsP0Fo3j4gSzn/RuG7oTjZTuBCZVteWJBflzpvR6mhTBkVcs9/D4ndk26tpl85c8lgrCeN+1VPjJMof03bk8ow=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=eM1g3U1O; arc=none smtp.client-ip=209.85.208.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-607434e1821so1822380a12.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222195; x=1749826995; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=hw33Rl+thTuvgJB34fURNPMx+D4YtoSUdiE6dWyoZ50=;
b=eM1g3U1O2uzDpXS0/4K/PxaAesbUbaOYOCP2bw8bYazgOjdO3oSklAXWmk9eCgEr1W
b5b9+gImP13hu7YPBbSDv3DhROwop/cV9fvw0puMyIfuhAUVUiYuupeEf/fKmCANLxfB
eJ4c57MBOu9ALKTSOCg4ay9mkKE5w/RHsh03gBAUi1Q9SHhVXktLB7f0iI1auIJK+SfA
K56hwa7gu1nyM6bxbEwNjNdXlrt8nUJt4yeNC5Rnt4v5oHyavUouMRZbaUxYbsHSFZgs
0p8K0xPhubPD8D5CoILpexugJ5bwfZqbso26IWTxI2BtXAFtIlWEKZxGx0ClHIaTqrAw
wthw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222195; x=1749826995;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=hw33Rl+thTuvgJB34fURNPMx+D4YtoSUdiE6dWyoZ50=;
b=vQ4z5lYGqwnGBzcqyKujaXJB/jgKJV13us5gTjdlg16TuH4tTKSaGlMBIhId6tMF4K
dvJBVz4VMy9TvIMTuLrNgQ8fOY2HOOya2KY/GDw1hXPtY97UF//TSmAxwBmsQXNAGKfD
p7oa1XVnW1B8yeKQHjzBhulvY4KRvd4YvmyXYlcYxpwWJz+h4J0/ipuerWNaf/HJDfC8
2AocPMeVZElFJEFQIUQnqXDy0fQxL6FLpuFP8YjZmTjwR6KYefyuPGcoeqde3V+BLmKB
K44ISYmzCDZz3Yue+pjpGcSwN/DH9MQDc+NUz5zNGD9g+Xf83lsItKg8B7X2mcWnBPvD
xiJw==
X-Forwarded-Encrypted: i=1; AJvYcCV8+Zr3LKhKi18RbeO3wxDaJRGEWVJrrwNdkyJPTUXnUcU9Cwb4Axlj2yilaqxb7xvLxvaO8nurWzSRbjk=@vger.kernel.org
X-Gm-Message-State: AOJu0Ywhd6/pdIPcOP5y+jzPD0dIK9DkT3+EgM28+dAg3USaEqaDbVNx
6KHkTFEWuB5ADaUizQaO1sZ8AYe1ffN5UfKXEPNDOhJ0CyTO+0ebBZK/bwB7Dc6f648=
X-Gm-Gg: ASbGncs/P0vpokABn/MwYDdaAIUurJpD5D8iLFzuhXcUIyhueNpzKPXq6y7JTZSqoJp
HbaxaC9unjwJhG0QTnRJYxvoP4/VpCmQJuxe7De1VJK1R2f1KU2DRrNh8TtshCIrkeya8zamHTh
po8/9jeYGWXn1UUy2UCAjQKBBv7c2mBof55QsAGJ87+dHMVSmEA8KRMyE5E/CkMzcb0n3pFt6Yp
0ycMnrv7YojPVfGdBVGfCPOB62tutv8jD9Un614fTlrmvYxkZ4H9NEVKS/AHgdON8r5ZhIYupCi
HN9y+UHqdwcohgysq6nlzLnEo6mH22S1OyNOl8X//XjPZY4PVKQpTgZHyIpL3yRUHaThGzyLxe5
0/rrGRbO84vN1d5BPUcOJnBj7xPzsg9hGwXOYJLTD2zikIw==
X-Google-Smtp-Source: AGHT+IHbWi8jsL6tIHBW7of/W9kUs+W2SnVGPOjs734Ix0yZ3GKT9YaBdqKy5cjONZI5b7CnH58irQ==
X-Received: by 2002:a17:907:5c1:b0:ad8:8efe:31fb with SMTP id a640c23a62f3a-ade1abc5eb0mr323702866b.54.1749222194282;
Fri, 06 Jun 2025 08:03:14 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.13
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:13 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:01 +0100
Subject: [PATCH v2 05/17] dt-bindings: mfd: samsung,s2mps11: add
s2mpg11-pmic
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-5-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The Samsung S2MPG11 PMIC is similar to the existing S2MPG10 PMIC
supported by this binding.

It is a Power Management IC for mobile applications with buck
converters, various LDOs, power meters, and additional GPIO interfaces
and typically complements an S2MPG10 PMIC in a main/sub configuration
as the sub-PMIC.

Like S2MPG10, communication is not via I2C, but via the Samsung ACPM
firmware, it therefore doesn't need a 'reg' property but needs to be a
child of the ACPM firmware node instead.

Add the PMIC, the regulators node, and the supply inputs of the
regulator rails, with the supply names matching the datasheet.

Note: S2MPG11 is typically used as the sub-PMIC together with an
S2MPG10 PMIC in a main/sub configuration, hence the datasheet and the
binding both suffix the supplies with an 's'.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
v2:
- add | to vinb*-supply description for better formatting to mark as
literal style
- mention GPIOs in commit message
---
.../devicetree/bindings/mfd/samsung,s2mps11.yaml | 70 ++++++++++++++++++----
1 file changed, 58 insertions(+), 12 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
index 0b834a02368f7867a2d093cbb3a9f374bb2acf41..a6a10d23a480b460c66be2df5bfdef5ea3024ce1 100644
--- a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
+++ b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
@@ -21,6 +21,7 @@ properties:
compatible:
enum:
- samsung,s2mpg10-pmic
+ - samsung,s2mpg11-pmic
- samsung,s2mps11-pmic
- samsung,s2mps13-pmic
- samsung,s2mps14-pmic
@@ -70,21 +71,46 @@ required:
unevaluatedProperties: false

allOf:
+ - if:
+ not:
+ properties:
+ compatible:
+ const: samsung,s2mpg10-pmic
+ then:
+ properties:
+ system-power-controller: false
+
- if:
properties:
compatible:
contains:
- const: samsung,s2mpg10-pmic
+ enum:
+ - samsung,s2mpg10-pmic
+ - samsung,s2mpg11-pmic
then:
properties:
reg: false
+ samsung,s2mps11-acokb-ground: false
+ samsung,s2mps11-wrstbi-ground: false
+
+ oneOf:
+ - required: [interrupts]
+ - required: [interrupts-extended]
+
+ else:
+ required:
+ - reg

+ - if:
+ properties:
+ compatible:
+ contains:
+ const: samsung,s2mpg10-pmic
+ then:
+ properties:
regulators:
$ref: /schemas/regulator/samsung,s2mpg10-regulator.yaml

- samsung,s2mps11-acokb-ground: false
- samsung,s2mps11-wrstbi-ground: false
-
patternProperties:
"^vinb([1-9]|10)m-supply$":
description:
@@ -112,16 +138,36 @@ allOf:
vinl14m - ldo21m
vinl15m - ldo10m, ldo22m, ldo26m, ldo27m

- oneOf:
- - required: [interrupts]
- - required: [interrupts-extended]
-
- else:
+ - if:
properties:
- system-power-controller: false
+ compatible:
+ contains:
+ const: samsung,s2mpg11-pmic
+ then:
+ properties:
+ regulators:
+ $ref: /schemas/regulator/samsung,s2mpg11-regulator.yaml

- required:
- - reg
+ patternProperties:
+ "^vinb(([1-9]|10)s|[abd])-supply$":
+ description: |
+ Phandle to the power supply for each buck rail of this PMIC. There
+ is a 1:1 mapping of numbered supply to rail, e.g. vinb1s-supply
+ supplies buck1s. The remaining mapping is as follows
+ vinba - bucka
+ vinbb - buck boost
+ vinbd - buckd
+
+ "^vinl[1-6]s-supply$":
+ description: |
+ Phandle to the power supply for one or multiple LDO rails of this
+ PMIC. The mapping of supply to rail(s) is as follows
+ vinl1s - ldo1s, ldo2s
+ vinl2s - ldo8s, ldo9s
+ vinl3s - ldo3s, ldo5s, ldo7s, ldo15s
+ vinl4s - ldo10s, ldo11s, ldo12s, ldo14s
+ vinl5s - ldo4s, ldo6s
+ vinl6s - ldo13s

- if:
properties:

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675900-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 27E3F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:04:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2475817AE8A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:04:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B12E289825;
Fri, 6 Jun 2025 15:03:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yGSvk6RC"
Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39C8528936C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222199; cv=none; b=fRV+PosisYOOHgH0NMDDcbRaFfnOdBagh+cm/gKOIzdwtPHA+WoXHzzWnN8TrczWOZDLug/ZhJ7Gujb/2FAmnf6vTAdMJ8tI37gbECbBPYNk/41c4DnZwXd/HioAxrowIqs4fa+mVWmNwCepgcEAe1RCTZAlX/CRlxluD5IXhDw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222199; c=relaxed/simple;
bh=NrvhaelaffQkNWXehP7/rQznmZjjqC81kfB6W0U7Z5s=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=Y1WloDMu8cG/oEyJO1MoItYsqkfy8wDBSYDL2AqPth/n+DqGw9JOHFfp3NBh+PQg9RoDE1QTJn44QzEjOmDBHcra+pssJ6lgvJGYtTcklSQVXAqtOFnHlJYXWKzEpXUlxMHKBrPMzIj9yM33yfF0knrXjo3HkEZXlcJvrzF4vu8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=yGSvk6RC; arc=none smtp.client-ip=209.85.208.53
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-60768f080d8so1974272a12.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222193; x=1749826993; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=u6Q9Kcia6p8/L4cvfCFfuz2cptFMCP1QrB8rbp/NCAY=;
b=yGSvk6RCO6NlVU99AirfrBD1onJwkdr99Qd1mlAHcudwZ9ae4pCH1KsbvhKT/XXf9E
tAe7OJ/H6IX3QQCfClxiOEO1IeUu7YsJJsS9WjyVCl85UkqV0I+eyLd8PpWxRQdeXSbd
ogKFPK0zAy185pTflATQcNNNsiu2kLkXfwZojRuelllD2p3yLcyrfpnAW7Sptb0Mx4TY
YQiPFq1FYeWPwTq1FLbm1vxm26E3S64Tghbq9LfYPo4ig3DdMdhzlCDzhgnTuRMOqTKv
NdIJrmRIFHx6REMnVm8kWp7ncK4eSlInOvym9FV3HMNETUHKFH7ZV22NC50ubZnHPCLy
W6Vw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222193; x=1749826993;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=u6Q9Kcia6p8/L4cvfCFfuz2cptFMCP1QrB8rbp/NCAY=;
b=RGvRtLGFEHQL5dIlm7fq0LuLB+iFSEdePz+FRbT4qqnJExoMXmT9+0JAwXUori1vJB
DvCjO9C9eWNE5ZwA9pqOoKrSn812Zk8b8y4fDt8XAO0H9HUhqaLobnDoOLya02HZW4s9
3oq6hiq5w+y38SAqDzDkQJsuGEwzV4W68zvLw/3VEGzOmI2+Ho+E/jjiwB/sqmzxhq4l
X/tjeYcXZl5XKE1KVtCDHESqO1p6TztL5lboYVDoV++JdMdMLEiWUAUDIFo32kSB3lwR
fkdCjBR92K6LWC+1LE5bYK4DSJFOmmByR+ApBAIZgeVG1QrdRR8vHv75i32R/tWsMzj8
CMJw==
X-Forwarded-Encrypted: i=1; AJvYcCVGlha3X+OsfA6cOPeaokQELbXKCmjMs2577Iq1eYLbEWua1VCXAfIYiPUCP8WALjoxvimV6gkt8tATHM0=@vger.kernel.org
X-Gm-Message-State: AOJu0YzOJAuCfzKGlBOTzC0ZQDnP8omC/cvi7+IyLSXPDB1oECrPGqQ6
Nv1D7Oxs41D+A7/6oD3GCm/AvYKWi30JLdMjS4V/6PbdgmfywkArt9nM9v4Gyr99brI=
X-Gm-Gg: ASbGnctt3OXAEI+F1NcTomQiubYtE6u2XVY8Iw1Kq9e6hCnNBOBkzXPaxgGaH/850aN
JDiRo8pza5wQymyWNPgvIC134OSbc9ASaM4ksJQVJNEkMobwZJVKQqZu2ZYCMJLp1Q9d/8vJG7U
rhumKpfW0qWskhfJLycIUlYN9WPHWRo2UMnhstUVrvKdGe4+tS72gLRnWuYQoyl4LCl4qo8xaDW
gnz26TX9LIZ94ed25pHO27OujcfoKYJD2yNTWQ++fwAwZXkiGCajzDEZ/xkHXvZCL6wI5gvgUzG
FT8Y/3zvoR61EVLx+RIRLu7R2j6NnY1m4Rcn4XRAtFxY7Ohoy5MgMzZUGJlPU1xA6kdad6PbAlF
u5HGFZHoLtH1dlLF0ArookSPpxrEyTfD6Q/7CWWTgObAJ2Q==
X-Google-Smtp-Source: AGHT+IGyl/lJzchfJ2skPsCGUli0VUF4l3MAyFYs1v7or+qo9zmqJmfA5AFatFoi+gPZUcmP4XN9nA==
X-Received: by 2002:a17:906:6a0e:b0:ad2:24e5:27c9 with SMTP id a640c23a62f3a-ade1a9c8039mr336406466b.44.1749222192643;
Fri, 06 Jun 2025 08:03:12 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.12
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:12 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:02:58 +0100
Subject: [PATCH v2 02/17] regulator: dt-bindings: add s2mpg10-pmic
regulators
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-2-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The S2MPG10 PMIC is a Power Management IC for mobile applications with
buck converters, various LDOs, power meters, RTC, clock outputs, and
additional GPIO interfaces.

It has 10 buck and 31 LDO rails. Several of these can either be
controlled via software or via external signals, e.g. input pins
connected to a main processor's GPIO pins.

Add documentation related to the regulator (buck & ldo) parts like
devicetree definitions, regulator naming patterns, and additional
properties.

S2MPG10 is typically used as the main-PMIC together with an S2MPG11
PMIC in a main/sub configuration, hence the datasheet and the binding
both suffix the rails with an 'm'.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
v2:
- drop | (literal style mark) from samsung,ext-control-gpios
description
---
.../regulator/samsung,s2mpg10-regulator.yaml | 147 +++++++++++++++++++++
MAINTAINERS | 1 +
.../regulator/samsung,s2mpg10-regulator.h | 48 +++++++
3 files changed, 196 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mpg10-regulator.yaml b/Documentation/devicetree/bindings/regulator/samsung,s2mpg10-regulator.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..82f2b06205e9bdb15cf90b1e896fe52c335c52c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/samsung,s2mpg10-regulator.yaml
@@ -0,0 +1,147 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/samsung,s2mpg10-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S2MPG10 Power Management IC regulators
+
+maintainers:
+ - André Draszik <andre.draszik@xxxxxxxxxx>
+
+description: |
+ This is part of the device tree bindings for the S2MG10 Power Management IC
+ (PMIC).
+
+ The S2MPG10 PMIC provides 10 buck and 31 LDO regulators.
+
+ See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
+ additional information and example.
+
+definitions:
+ s2mpg10-ext-control:
+ properties:
+ samsung,ext-control:
+ description: |
+ These rails can be controlled via one of several possible external
+ (hardware) signals. If so, this property configures the signal the PMIC
+ should monitor. For S2MPG10 rails where external control is possible other
+ than ldo20m, the following values generally corresponding to the
+ respective on-chip pin are valid:
+ - 0 # S2MPG10_PCTRLSEL_ON - always on
+ - 1 # S2MPG10_PCTRLSEL_PWREN - PWREN pin
+ - 2 # S2MPG10_PCTRLSEL_PWREN_TRG - PWREN_TRG bit in MIMICKING_CTRL
+ - 3 # S2MPG10_PCTRLSEL_PWREN_MIF - PWREN_MIF pin
+ - 4 # S2MPG10_PCTRLSEL_PWREN_MIF_TRG - PWREN_MIF_TRG bit in MIMICKING_CTRL
+ - 5 # S2MPG10_PCTRLSEL_AP_ACTIVE_N - ~AP_ACTIVE_N pin
+ - 6 # S2MPG10_PCTRLSEL_AP_ACTIVE_N_TRG - ~AP_ACTIVE_N_TRG bit in MIMICKING_CTRL
+ - 7 # S2MPG10_PCTRLSEL_CPUCL1_EN - CPUCL1_EN pin
+ - 8 # S2MPG10_PCTRLSEL_CPUCL1_EN2 - CPUCL1_EN & PWREN pins
+ - 9 # S2MPG10_PCTRLSEL_CPUCL2_EN - CPUCL2_EN pin
+ - 10 # S2MPG10_PCTRLSEL_CPUCL2_EN2 - CPUCL2_E2 & PWREN pins
+ - 11 # S2MPG10_PCTRLSEL_TPU_EN - TPU_EN pin
+ - 12 # S2MPG10_PCTRLSEL_TPU_EN2 - TPU_EN & ~AP_ACTIVE_N pins
+ - 13 # S2MPG10_PCTRLSEL_TCXO_ON - TCXO_ON pin
+ - 14 # S2MPG10_PCTRLSEL_TCXO_ON2 - TCXO_ON & ~AP_ACTIVE_N pins
+
+ For S2MPG10 ldo20m, the following values are valid
+ - 0 # S2MPG10_PCTRLSEL_LDO20M_ON - always on
+ - 1 # S2MPG10_PCTRLSEL_LDO20M_EN_SFR - VLDO20M_EN & LDO20M_SFR
+ - 2 # S2MPG10_PCTRLSEL_LDO20M_EN - VLDO20M_EN pin
+ - 3 # S2MPG10_PCTRLSEL_LDO20M_SFR - LDO20M_SFR in LDO_CTRL1 register
+ - 4 # S2MPG10_PCTRLSEL_LDO20M_OFF - disable
+
+ $ref: /schemas/types.yaml#/definitions/uint32
+ minimum: 0
+ maximum: 14
+
+ samsung,ext-control-gpios:
+ description:
+ For rails where external control is done via a GPIO, this optional
+ property describes the GPIO line used.
+
+ maxItems: 1
+
+ dependentRequired:
+ samsung,ext-control-gpios: [ "samsung,ext-control" ]
+
+patternProperties:
+ # 10 bucks
+ "^buck([1-9]|10)m$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for a single buck regulator.
+
+ properties:
+ regulator-ramp-delay:
+ enum: [6250, 12500, 25000]
+ default: 6250
+
+ allOf:
+ - $ref: "#/definitions/s2mpg10-ext-control"
+
+ # 13 standard LDOs
+ "^ldo([12]|2[1-9]|3[0-1])m$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for single LDO regulator.
+
+ properties:
+ regulator-ramp-delay: false
+
+ # 14 LDOs with possible external control
+ "^ldo([3-9]|1[046-9]|20)m$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for a single LDO regulator.
+
+ properties:
+ regulator-ramp-delay: false
+
+ allOf:
+ - $ref: "#/definitions/s2mpg10-ext-control"
+
+ # 4 LDOs with ramp support and possible external control
+ "^ldo1[1235]m$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for a single LDO regulator.
+
+ properties:
+ regulator-ramp-delay:
+ enum: [6250, 12500]
+ default: 6250
+
+ allOf:
+ - $ref: "#/definitions/s2mpg10-ext-control"
+
+additionalProperties: false
+
+allOf:
+ - if:
+ anyOf:
+ - required: [buck8m]
+ - required: [buck9m]
+ then:
+ patternProperties:
+ "^buck[8-9]m$":
+ properties:
+ samsung,ext-control: false
+
+ - if:
+ required:
+ - ldo20m
+ then:
+ properties:
+ ldo20m:
+ properties:
+ samsung,ext-control:
+ maximum: 4
diff --git a/MAINTAINERS b/MAINTAINERS
index 1615a93528bdfffa421eb8cad259fecd1488fc51..3fc6bd0dd15a504c498e56d425731b5234dce63a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22006,6 +22006,7 @@ F: drivers/mfd/sec*.[ch]
F: drivers/regulator/s2m*.c
F: drivers/regulator/s5m*.c
F: drivers/rtc/rtc-s5m.c
+F: include/dt-bindings/regulator/samsung,s2m*.h
F: include/linux/mfd/samsung/

SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER
diff --git a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h b/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d4e34a756efa46afeb9f018c3e8644ebc373b07
--- /dev/null
+++ b/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright 2021 Google LLC
+ * Copyright 2025 Linaro Ltd.
+ *
+ * Device Tree binding constants for the Samsung S2MPG1x PMIC regulators
+ */
+
+#ifndef _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H
+#define _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H
+
+/*
+ * Several regulators may be controlled via external signals instead of via
+ * software. These constants describe the possible signals for such regulators
+ * and generally correspond to the respecitve on-chip pins. The constants
+ * suffixed with _TRG enable control using the respective bits in the
+ * MIMICKING_CTRL register instead.
+ *
+ * S2MPG10 regulators supporting these are:
+ * - buck1m .. buck7m buck10m
+ * - ldo3m .. ldo19m
+ *
+ * ldo20m supports external control, but using a different set of control
+ * signals.
+ */
+#define S2MPG10_PCTRLSEL_ON 0x0 /* always on */
+#define S2MPG10_PCTRLSEL_PWREN 0x1 /* PWREN pin */
+#define S2MPG10_PCTRLSEL_PWREN_TRG 0x2 /* PWREN_TRG bit in MIMICKING_CTRL */
+#define S2MPG10_PCTRLSEL_PWREN_MIF 0x3 /* PWREN_MIF pin */
+#define S2MPG10_PCTRLSEL_PWREN_MIF_TRG 0x4 /* PWREN_MIF_TRG bit in MIMICKING_CTRL */
+#define S2MPG10_PCTRLSEL_AP_ACTIVE_N 0x5 /* ~AP_ACTIVE_N pin */
+#define S2MPG10_PCTRLSEL_AP_ACTIVE_N_TRG 0x6 /* ~AP_ACTIVE_N_TRG bit in MIMICKING_CTRL */
+#define S2MPG10_PCTRLSEL_CPUCL1_EN 0x7 /* CPUCL1_EN pin */
+#define S2MPG10_PCTRLSEL_CPUCL1_EN2 0x8 /* CPUCL1_EN & PWREN pins */
+#define S2MPG10_PCTRLSEL_CPUCL2_EN 0x9 /* CPUCL2_EN pin */
+#define S2MPG10_PCTRLSEL_CPUCL2_EN2 0xa /* CPUCL2_E2 & PWREN pins */
+#define S2MPG10_PCTRLSEL_TPU_EN 0xb /* TPU_EN pin */
+#define S2MPG10_PCTRLSEL_TPU_EN2 0xc /* TPU_EN & ~AP_ACTIVE_N pins */
+#define S2MPG10_PCTRLSEL_TCXO_ON 0xd /* TCXO_ON pin */
+#define S2MPG10_PCTRLSEL_TCXO_ON2 0xe /* TCXO_ON & ~AP_ACTIVE_N pins */
+
+#define S2MPG10_PCTRLSEL_LDO20M_ON 0x0 /* always on */
+#define S2MPG10_PCTRLSEL_LDO20M_EN_SFR 0x1 /* LDO20M_EN & LDO20M_SFR */
+#define S2MPG10_PCTRLSEL_LDO20M_EN 0x2 /* VLDO20M_EN pin */
+#define S2MPG10_PCTRLSEL_LDO20M_SFR 0x3 /* LDO20M_SFR bit in LDO_CTRL1 register */
+#define S2MPG10_PCTRLSEL_LDO20M_OFF 0x4 /* disable */
+
+#endif /* _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H */

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675902-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6804141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:05:00 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 570643B2637
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:04:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 75E0F28A731;
Fri, 6 Jun 2025 15:03:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ec1L5vsC"
Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B2DC28980E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222200; cv=none; b=gGmgEq3yOpFy21irB+nWwrnyAyJHK/B9I6DHu1iL8b76H1q2ZgLpwA6oGMkHasc/xlKIpUnOHLtQHQ5D7zbCmeSpjoOUhIQdOX0xyWO6acty8ggEO/8bWlmaPgX+Ji4D2VuzSrPyYHbLoIAQpBBGU2aMvM0NULGlvT+BGeuwpkc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222200; c=relaxed/simple;
bh=m6C+4e8MF9g9uyaiWWf0DHMTRnXGKt+eaez/jyh0Jb8=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=MzpUtT6K/Jp3BvE0O49+W8MJ40BcQQyPMRGMhAYw5zwlLWvjvFbyiI2dLCNUXPE9kI0wOyI9UiBmZLfkUAdDW8ndP23SKEOOVT9Y2xnapWqqrMUwB5b3HHTLGiYdhu6IkXlFUkY3O8L5cOJ5pX+u9BpmYyXLzB9N3NT3XNAxUi8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ec1L5vsC; arc=none smtp.client-ip=209.85.208.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-604bff84741so4353615a12.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222195; x=1749826995; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=KcdkpDlPLd/iSFNV2Kj6M/PjoKJqD05ckr9tkCHHeGY=;
b=ec1L5vsC4FwYLCU6CodPUPMVj9fbeo7x+WlOFJiS9TpWpW8isRG/iNqRobRNxLaWHu
BcjW2WEAWxhzlKTLOjrx2BgsO2c2zXf4hW+iIt/es7ijylZSFKEzJlnuSPFVqYYt0EFX
XP1JEPaRxp/J0Vx4BPyRl2JEbb+Ml5dr2aH1RclyW3/Zt6wRQcAfIgpsM0lABvyjHEps
/RxDZeLhnJMCKbg38CSAfSEiMQRGqBSZK9elGB2Osd+VItvqLi8/SwK2CvwuePm7W5Ni
K2BLMOXgtJgQHGd+nvkSlyEvsYcJ6HAN+N/rw6u5GktiWud69jKAgZpkhTf6e+jQQ7O4
qiwA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222195; x=1749826995;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=KcdkpDlPLd/iSFNV2Kj6M/PjoKJqD05ckr9tkCHHeGY=;
b=PwzRpps7iAWix3YCbMS1/x35lgwc+fV8zPcNu6lpPW//X5VQHWV1cnrqIcO3ebIXhP
e7hvbtzPuN5oJUhsv8QIQYDFbMrojT8zPhhYFhaULlDyKOY+opaG9IGHFkO09fphEQxI
ZsN6klyG/C9rr8vUd+hB5tWxMWubrY5STuWhpNmshCFKjTHunMv6W4UC6A95TgHoCBax
Rhd0iFhTo2Wroi/ZF6j4/VLRz8lLOQbGbOsssVTKLJS7ZpVl5mUwQUIGP/Cei1O7xUlE
lRBqOc6hfcGISVuWsxyv/9jEoTlVlJTy2CXfoorUmL7vfUPGeVznE2CUIYk60lIZ/iXR
aEfw==
X-Forwarded-Encrypted: i=1; AJvYcCWyoVVlylcJN2uv1KkmDzX3t3+L0tNPQWRCS86JMNlGLl1Qqm2sWwAOhJ9o5hcdFkHV94Ac74p68UpA3eU=@vger.kernel.org
X-Gm-Message-State: AOJu0YyyLOVPsBpgXnR/MuS72kyNoPtKLsH+3oqIhox81h8TZhfk+Axu
kRyPJ7vH5nssGlwTsE06wouQ6ihCuIaYy6bJn2NB5m66L8pKOI0qa954o9IQV4VGc7U=
X-Gm-Gg: ASbGncvS7e9Lv1ibafXT3qgHhM2S/f0U+lpcXu76YD3H1Ge7vmhgshDUU7RuNJOgIC7
9/ibfzIkQGMwh3ttcOLVR2A/U6MTQQn15+TgEGUcQvObMXhFHL6RLHbDTGbK62uicbwI+c7pqOw
BFUooh/EI//9lEyefJtiRggPsLm2LOgKlBpyB2rg4W+kj0SaM4Im6YUgyN4BJEUaN1SgSh6VXDW
ns9+Cjxs6EX3XJp1t9xSv7A/pihtYfxj/xk2nJATFBv02quh6S3FCgF0zAEvQ2sODo2TgBT7TCj
S8uq41myN6/XtaHxkpq6OAN/b1kvlunJjjfHPXPw0sn66RijMLMjUD22gIxAN/xekIKH8tBB4fp
kDFw9qim5JmZoKZ0Jo/qsKDFVhTsrAAPbruw=
X-Google-Smtp-Source: AGHT+IGi995dmBrb/2Bf+v4TOAYVLEzAcRx6/H11eC1SAEVv/9wy2tgK9WC20nkFydysTHvJuQz9Ug==
X-Received: by 2002:a17:907:7295:b0:ad2:2dc9:e3d3 with SMTP id a640c23a62f3a-ade1ab32464mr349066166b.57.1749222194843;
Fri, 06 Jun 2025 08:03:14 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.14
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:14 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:02 +0100
Subject: [PATCH v2 06/17] dt-bindings: firmware: google,gs101-acpm-ipc:
update PMIC examples
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-6-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

In a typical system using the Samsung S2MPG10 PMIC, an S2MPG11 is used
as a sub-PMIC.

The interface for both is the ACPM firmware protocol, so update the
example here to describe the connection for both.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
.../bindings/firmware/google,gs101-acpm-ipc.yaml | 40 ++++++++++++++++++++--
1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml
index 62a3a7dac5bd250a7f216c72f3315cd9632d93e1..408cf84e426b80b6c06e69fda87d0f8bfc61498d 100644
--- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml
+++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml
@@ -36,6 +36,15 @@ properties:
compatible:
const: samsung,s2mpg10-pmic

+ pmic2:
+ description: Child node describing the sub PMIC.
+ type: object
+ additionalProperties: true
+
+ properties:
+ compatible:
+ const: samsung,s2mpg11-pmic
+
shmem:
description:
List of phandle pointing to the shared memory (SHM) area. The memory
@@ -52,7 +61,9 @@ additionalProperties: false

examples:
- |
+ #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/regulator/samsung,s2mpg10-regulator.h>

power-management {
compatible = "google,gs101-acpm-ipc";
@@ -63,12 +74,20 @@ examples:
compatible = "samsung,s2mpg10-pmic";
interrupts-extended = <&gpa0 6 IRQ_TYPE_LEVEL_LOW>;

+ vinl3m-supply = <&buck8m>;
+
regulators {
ldo1m {
regulator-name = "vdd_ldo1";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1300000>;
- regulator-always-on;
+ };
+
+ ldo20m {
+ regulator-name = "vdd_ldo1";
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <1300000>;
+ samsung,ext-control = <S2MPG10_PCTRLSEL_LDO20M_EN>;
};

// ...
@@ -77,8 +96,23 @@ examples:
regulator-name = "vdd_mif";
regulator-min-microvolt = <450000>;
regulator-max-microvolt = <1300000>;
- regulator-always-on;
- regulator-boot-on;
+ regulator-ramp-delay = <6250>;
+ };
+ };
+ };
+
+ pmic2 {
+ compatible = "samsung,s2mpg11-pmic";
+ interrupts-extended = <&gpa0 7 IRQ_TYPE_LEVEL_LOW>;
+
+ vinl1s-supply = <&buck8m>;
+ vinl2s-supply = <&buck6s>;
+
+ regulators {
+ buckd {
+ regulator-ramp-delay = <6250>;
+ samsung,ext-control = <S2MPG11_PCTRLSEL_UFS_EN>;
+ samsung,ext-control-gpios = <&gpp0 1 GPIO_ACTIVE_HIGH>;
};
};
};

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675901-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F077241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:05:13 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3BC8417AA9A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:05:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 89F5328AAE3;
Fri, 6 Jun 2025 15:03:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dXMTKTwf"
Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E2CB289377
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222199; cv=none; b=jqQ3GImejlDj0t4JVT6GAS9izGNhVqwPgMZXQylhg3F66zFDtJMoNuliQNXO7/kdK/Uo+CAR9UNBhy7Nek6RQ0YUi0zCDgQD8gh/TrsOSDR4jJ3LyJ3oJaRhVL3X/+cAgxwBulNXGY0UvXEChXv4B2thUHL16pmo8tkvMZThN7E=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222199; c=relaxed/simple;
bh=nqYvSxLbxspWt++Xrxgq0PEDBK7Jn5rjeP8qdwlSXUs=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=F/0qOgfPbpWgwmxqU4+LtTsT/yNbkr6wbISnaChVkiGPgIJTSXpcJMJoQL1+79csdwTx/C2q0NoEC7nZ2TGR1tZzlWqsNG2hKdmcaMnjfeK0LemIKuhAND7iTtkZTuL6E9iY/kqqF+77nxE/U7AVA1r+zqN2FfAqt5XSywuMDyM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dXMTKTwf; arc=none smtp.client-ip=209.85.218.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-ade326e366dso60763866b.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222194; x=1749826994; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=clSuqSGJymcXhnXlvpUM+fwFTnc01D7rUNDs4ZhqNgo=;
b=dXMTKTwfu4umIXd61N6nIT3Mv3aTAGnlvIBNsrR0uJDYsDZ+kdMPD2/WFpBMaLBNLj
NYzSYwK489wnNZaJBtsoOZOT5fXmT7InQo99Asd3gAkOAeTWtK4AAn710WbXOSAmQPGL
UTLln/izBmxaMktmWvMiGu3dsGGE2TmieRekvsW+Bd1Bbu+56HRZ5E2R2ZmX3F3nWqiS
vkwKcAcAylFi8Ur7SM0fnNIPhoiYjLeWLHN2A/OOWm8ACi9YCmM7j9hf+/dmDUjVlnnj
9QZOIgg2nB/mtmwgMInkEKxNd1Q7RqmrGKpYwaJ4y8nhMq3QCk6W9BQ2xNoMeqI4Bf+Q
KhYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222194; x=1749826994;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=clSuqSGJymcXhnXlvpUM+fwFTnc01D7rUNDs4ZhqNgo=;
b=sx3JPC2BSYGAfLvhbsIVWv/6IQaj5ZYJwIt2qQ5hvX8ynyRF6FloWajYOBnhFdL4WG
c4l2BuEIgYzC40fy9Bb/mjJizTXybFxB4kp/TirZm5snFJvTFurRVr9kb2XA0Ue5L0QI
1qw4A4Vgf1YpM3kjBrwtNAEobgCRCHu9SZmZUIkhoUOqWVNlCaXq1mzWLcLqbi+q/yV9
D12GC8uuzRgPu1EezEA7apkbxz1DWTFRBlR27OsHhqktLPUHtB/8AHjFLbZlOxcspH3b
brETaE8+1PuBu709lFGHZuZONEX8epjHqQ8GWwYPMkd14/FFl2AdxlXvE8aZEBYXo+/1
ts/A==
X-Forwarded-Encrypted: i=1; AJvYcCXonFA6n49+rD07tpV0el4TzRGPwjOU3C94CwqjiVgWSMaCitnQJwfmO1fDZj33PFRRhfkUwYEiCf7vW4o=@vger.kernel.org
X-Gm-Message-State: AOJu0YzL2rSOsSoWpguD2QDO9ycXLibinnNrY5iHeVFBTQ3Cb6t0wg4M
ixrz8brjtsbP1Ft8S8pJpGTcgUqouPVsrxUhwKk3rXDgpeIcsR/r1uxrNEpJdNe1hSA=
X-Gm-Gg: ASbGnctH/qEKxTFqvgsDt7YwNK0F4q5+S4lonoJfqqSEw2PHW+qt2soa1FZI+j2ShtK
4pA+jYTbmyODGSFaGJ53psxkmjMF4NYHX1PVeMK6r8ptQ5HRnuz2+72ezeXLWUpaffOYoHm1Q00
lC7MQ+18/vOgnDZvOoW9hq+G0ocHiEIGMAS2EmoYRWfGwlNxgnN+8rrbx3sHwQh7Epwx32gh14M
CXIvelqZKW/b7KinAmUwUve87hMI7VaB/TsmgjA5p3PNwo2kyLIxjs7RmSAHtbJXe38N17a5qjL
uDEzxj6HmdmE2lE7Vbl0YOsILx4pLKdW1cnW/gAbJU2TK0Wm9KwmBVQ0S3zMN2M/whZ3dC1yn02
c9YS/BKQSwvsDMf1GnApxW9JFyreugCus8mU=
X-Google-Smtp-Source: AGHT+IHUsw1dG4JGmXr3/k6P0lK8nbHfmv2qAgr1gcXf+rrG8tGGj/IJBY+Ndvvt8b5hjZMLJEouGQ==
X-Received: by 2002:a17:907:3da3:b0:ad8:a512:a9fc with SMTP id a640c23a62f3a-ade1a9fd897mr306201166b.42.1749222193199;
Fri, 06 Jun 2025 08:03:13 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.12
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:12 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:02:59 +0100
Subject: [PATCH v2 03/17] regulator: dt-bindings: add s2mpg11-pmic
regulators
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-3-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The S2MPG11 PMIC is a Power Management IC for mobile applications with
buck converters, various LDOs, power meters, and additional GPIO
interfaces. It typically complements an S2MPG10 PMIC in a main/sub
configuration as the sub-PMIC.

S2MPG11 has 12 buck, 1 buck-boost, and 15 LDO rails. Several of these
can either be controlled via software or via external signals, e.g.
input pins connected to a main processor's GPIO pins.

Add documentation related to the regulator (buck & ldo) parts like
devicetree definitions, regulator naming patterns, and additional
properties.

Since S2MPG11 is typically used as the sub-PMIC together with an
S2MPG10 as the main-PMIC, the datasheet and the binding both suffix the
rails with an 's'.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
Note: checkpatch suggests to update MAINTAINERS, but the new file is
covered already due to using a wildcard.

v2:
- fix commit message typos: s2mp1 -> s2mpg1
- mention GPIOs in commit message
---
.../regulator/samsung,s2mpg11-regulator.yaml | 150 +++++++++++++++++++++
.../regulator/samsung,s2mpg10-regulator.h | 18 +++
2 files changed, 168 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-regulator.yaml b/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-regulator.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..f2d596642501c197e2911ee3b9caac189cf541a4
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/samsung,s2mpg11-regulator.yaml
@@ -0,0 +1,150 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/samsung,s2mpg11-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S2MPG11 Power Management IC regulators
+
+maintainers:
+ - André Draszik <andre.draszik@xxxxxxxxxx>
+
+description: |
+ This is part of the device tree bindings for the S2MG11 Power Management IC
+ (PMIC).
+
+ The S2MPG11 PMIC provides 12 buck, 1 buck-boost, and 15 LDO regulators.
+
+ See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
+ additional information and example.
+
+definitions:
+ s2mpg11-ext-control:
+ properties:
+ samsung,ext-control:
+ description: |
+ These rails can be controlled via one of several possible external
+ (hardware) signals. If so, this property configures the signal the PMIC
+ should monitor. The following values generally corresponding to the
+ respective on-chip pin are valid:
+ - 0 # S2MPG11_PCTRLSEL_ON - always on
+ - 1 # S2MPG11_PCTRLSEL_PWREN - PWREN pin
+ - 2 # S2MPG11_PCTRLSEL_PWREN_TRG - PWREN_TRG bit in MIMICKING_CTRL
+ - 3 # S2MPG11_PCTRLSEL_PWREN_MIF - PWREN_MIF pin
+ - 4 # S2MPG11_PCTRLSEL_PWREN_MIF_TRG - PWREN_MIF_TRG bit in MIMICKING_CTRL
+ - 5 # S2MPG11_PCTRLSEL_AP_ACTIVE_N - ~AP_ACTIVE_N pin
+ - 6 # S2MPG11_PCTRLSEL_AP_ACTIVE_N_TRG - ~AP_ACTIVE_N_TRG bit in MIMICKING_CTRL
+ - 7 # S2MPG11_PCTRLSEL_G3D_EN - G3D_EN pin
+ - 8 # S2MPG11_PCTRLSEL_G3D_EN2 - G3D_EN & ~AP_ACTIVE_N pins
+ - 9 # S2MPG11_PCTRLSEL_AOC_VDD - AOC_VDD pin
+ - 10 # S2MPG11_PCTRLSEL_AOC_RET - AOC_RET pin
+ - 11 # S2MPG11_PCTRLSEL_UFS_EN - UFS_EN pin
+ - 12 # S2MPG11_PCTRLSEL_LDO13S_EN - VLDO13S_EN pin
+
+ $ref: /schemas/types.yaml#/definitions/uint32
+ minimum: 0
+ maximum: 12
+
+ samsung,ext-control-gpios:
+ description: |
+ For rails where external control is done via a GPIO, this optional
+ property describes the GPIO line used.
+
+ maxItems: 1
+
+ dependentRequired:
+ samsung,ext-control-gpios: [ "samsung,ext-control" ]
+
+properties:
+ buckboost:
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for the buck-boost regulator.
+
+ properties:
+ regulator-ramp-delay: false
+
+patternProperties:
+ # 12 bucks
+ "^buck(([1-9]|10)s|[ad])$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for a single buck regulator.
+
+ properties:
+ regulator-ramp-delay:
+ enum: [6250, 12500, 25000]
+ default: 6250
+
+ allOf:
+ - $ref: "#/definitions/s2mpg11-ext-control"
+
+ # 11 standard LDOs
+ "^ldo([3-79]|1[01245])s$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for a single LDO regulator.
+
+ properties:
+ regulator-ramp-delay: false
+
+ # 2 LDOs with possible external control
+ "^ldo(8|13)s$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for single LDO regulator.
+
+ properties:
+ regulator-ramp-delay: false
+
+ allOf:
+ - $ref: "#/definitions/s2mpg11-ext-control"
+
+ # 2 LDOs with ramp support and possible external control
+ "^ldo[12]s$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for a single LDO regulator.
+
+ properties:
+ regulator-ramp-delay:
+ enum: [6250, 12500]
+ default: 6250
+
+ allOf:
+ - $ref: "#/definitions/s2mpg11-ext-control"
+
+additionalProperties: false
+
+allOf:
+ - if:
+ anyOf:
+ - required: [buck4s]
+ - required: [buck6s]
+ - required: [buck7s]
+ - required: [buck10s]
+ - required: [buckboost]
+ then:
+ patternProperties:
+ "^buck([467]|10|boost)s$":
+ properties:
+ samsung,ext-control: false
+
+ - if:
+ required:
+ - buckboost
+ then:
+ properties:
+ buckboost:
+ properties:
+ regulator-ramp-delay: false
diff --git a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h b/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h
index 1d4e34a756efa46afeb9f018c3e8644ebc373b07..0203946b7215eca615c27482be906c3100b899ee 100644
--- a/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h
+++ b/include/dt-bindings/regulator/samsung,s2mpg10-regulator.h
@@ -22,6 +22,10 @@
*
* ldo20m supports external control, but using a different set of control
* signals.
+ *
+ * S2MPG11 regulators supporting these are:
+ * - buck1s .. buck3s buck5s buck8s buck9s bucka buckd
+ * - ldo1s ldo2s ldo8s ldo13s
*/
#define S2MPG10_PCTRLSEL_ON 0x0 /* always on */
#define S2MPG10_PCTRLSEL_PWREN 0x1 /* PWREN pin */
@@ -45,4 +49,18 @@
#define S2MPG10_PCTRLSEL_LDO20M_SFR 0x3 /* LDO20M_SFR bit in LDO_CTRL1 register */
#define S2MPG10_PCTRLSEL_LDO20M_OFF 0x4 /* disable */

+#define S2MPG11_PCTRLSEL_ON 0x0 /* always on */
+#define S2MPG11_PCTRLSEL_PWREN 0x1 /* PWREN pin */
+#define S2MPG11_PCTRLSEL_PWREN_TRG 0x2 /* PWREN_TRG bit in MIMICKING_CTRL */
+#define S2MPG11_PCTRLSEL_PWREN_MIF 0x3 /* PWREN_MIF pin */
+#define S2MPG11_PCTRLSEL_PWREN_MIF_TRG 0x4 /* PWREN_MIF_TRG bit in MIMICKING_CTRL */
+#define S2MPG11_PCTRLSEL_AP_ACTIVE_N 0x5 /* ~AP_ACTIVE_N pin */
+#define S2MPG11_PCTRLSEL_AP_ACTIVE_N_TRG 0x6 /* ~AP_ACTIVE_N_TRG bit in MIMICKING_CTRL */
+#define S2MPG11_PCTRLSEL_G3D_EN 0x7 /* G3D_EN pin */
+#define S2MPG11_PCTRLSEL_G3D_EN2 0x8 /* G3D_EN & ~AP_ACTIVE_N pins */
+#define S2MPG11_PCTRLSEL_AOC_VDD 0x9 /* AOC_VDD pin */
+#define S2MPG11_PCTRLSEL_AOC_RET 0xa /* AOC_RET pin */
+#define S2MPG11_PCTRLSEL_UFS_EN 0xb /* UFS_EN pin */
+#define S2MPG11_PCTRLSEL_LDO13S_EN 0xc /* VLDO13S_EN pin */
+
#endif /* _DT_BINDINGS_REGULATOR_SAMSUNG_S2MPG10_H */

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675903-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 93B2D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:05:27 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4D941170E73
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:05:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 45E3228A737;
Fri, 6 Jun 2025 15:03:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y0TfzwoK"
Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B5B01A841F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222201; cv=none; b=uYSWnLX4FuxFBH3rojYN4SsHxsRpJj4AkYh/6y0uhODz5/rIwPw4rYk8QmXli6DlfT4pKwPp96ai9z2ywFfN0R3TKA5ZqVvHpLSupkfvlWCYLgKRg7AeXP+P6mjQwjxlGaczf2xopmkpVj76ZeEyDeBjphnoRJMNE6qQ566SY2Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222201; c=relaxed/simple;
bh=8hBWejyp6d3TxDVLSnvfJrpHg53/OBQTJQ3IoXt6F80=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=L+SoGfHhuAckcCCQjklDIemGOKQUgp5pmtc9zwG2OJMhuFj6CgWOdsNCI02e0YkCQtlOu8B67wRH9wb8G5sTBV4WTcX0Sl8ZShO+PiOWZgTmiEDZ8KC2iR3IVt07r973vzFand9M+i9PrRzt3iDYzJbMwI4tkg2+LufOtdUBb8c=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=y0TfzwoK; arc=none smtp.client-ip=209.85.218.43
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-acacb8743a7so375837966b.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222195; x=1749826995; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=V5o+Jwofv+O6NsaE5r2rO6FVmX4rnlZXl8n1NzB2gfs=;
b=y0TfzwoK2KgKRpYRirJwxoPtYOAl2zfWMOTZgixEtSfwbTgu8oSFxhIH5uoYUDdUIT
l1+Y9bEOG5c6UB95nVVgbbMnAszGAYoFZOUwPcSo18B8HON86KmkagUJJyrJnqSguc+j
zNPp5Gwq4+sVgxwVIgTAs1ez5GlwWcBrysF0WiqpwqE809J1NvXoc9LsUH2s+POGLLto
rHaPo2bJEeW0qScOfG2LwY19tn+F6lE0WqQqsR6vUXckQtQecNff1KotXiA6IXrq/pa7
YwiVJDD+KOKt5SNi5LcpM2RXiYOu8/eVl/7abCOeYpHOaO97e4sLsAIlsv1U7SZKrRqP
6Smw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222195; x=1749826995;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=V5o+Jwofv+O6NsaE5r2rO6FVmX4rnlZXl8n1NzB2gfs=;
b=US+IvpLtF88drbiX3Ab+CWif9zvnyBMWXWBzChCgfQs8Z5dHjt9ceivVWuPl/QGYVC
fEjOkPs9NWPI3Kzsvl6FTYcedFGdT0iX24+NQZxIs7OCoU+yteMyhwpVitTB0aLfa4Dn
5x/JeOexJBW/TnxytCnrfNIz+AhhdYCPUzUURqoYrAF7EVMWiyLLCHqW3euWo1erRYv8
PT/NZKQ3zdivdOF9X2tYUymrFT8VfCDTKdM7Aad4GnP7LHrgf3h96GmyYz4mmL/wVRpa
Mysfm6QjhcHz+QxbzwO7vPllbq6Sg473lcUuWP3rk0vcsbK8ct+uv77f3SmCdbW4vLrU
pxmA==
X-Forwarded-Encrypted: i=1; AJvYcCVI+1GwFOIonFU8x/8pUKaZlEAziAUdYZta71DRIREsnQPRM8YrTM52DIbwJxwZB/KMfMtyZxeNbiBE+wQ=@vger.kernel.org
X-Gm-Message-State: AOJu0YwtyD9bZTcndy6iZcMQegLQHDsRjsWVhFHDu5QdRwBENgqkWlBS
8zAfM1sYAk3MDUcbT582ACgF8lybS2ws0dm62ZCiSFsPu9RrbamVQ3nmkaWAu2gPUNg=
X-Gm-Gg: ASbGncu+WOz1sw65yjOPk2kgWqqlVrQE31ck08glabYlFMTqkO7E15oaBC5nZPqsNlY
QOQS+Pvlewg0v31GqPApzgDedvSoVxSaObza6ii1EJn2VmwkIhE39g85PcQ6uZqpUSp1IwDuXW2
LS6LIaz1muWDwpehtM8/Cg8cX2y8u6cEYtFoIDRnyhNRb7pvnL0LkjNqez6PbYRXVGZbAUAO6a+
wUoYVdKG5IHyZG6s3RKzt2cGMd0UlYmGApHSFyW6ruwVzv83i1KbHp10nAr9WWYCB7u8Zgr0nSe
IqL72isCzdNx9uu4dOxE5iHJSfHS+n6X97zDapEIpR6qAOcu/++ICyBkamhkfZbOHGmVce33C+A
F8owQM1TV6uC8aE/kIQekNKZ4++8hg8Bl25txfg0f8oUKPQ==
X-Google-Smtp-Source: AGHT+IFSVbkX5a/4o2KAe1Uk19F/3cil9Il8krcQUMRLrfjoeTE792Rwh1ewllGslz419fdT8y8DaQ==
X-Received: by 2002:a17:907:db16:b0:ad5:5a7e:bcd with SMTP id a640c23a62f3a-ade07606aedmr768199366b.8.1749222195317;
Fri, 06 Jun 2025 08:03:15 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.14
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:14 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:03 +0100
Subject: [PATCH v2 07/17] mfd: sec-common: Instantiate s2mpg10 bucks and
ldos separately
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-7-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,LOTS_OF_MONEY,
MAILING_LIST_MULTI,MONEY_NOHTML,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Bucks can conceivably be used as supplies for LDOs, which means we need
to instantiate them separately from each other so that the supply-
consumer links can be resolved successfully at probe time.

By doing so, the kernel will defer and retry instantiating the LDOs
once BUCKs have been created while without this change, it can be
impossible to mark BUCKs as LDO supplies. This becomes particularly
an issue with the upcoming support for the S2MPG11 PMIC, where
typically certain S2MPG10/11 buck rails supply certain S2MGP11/10 LDO
rails.

The platform_device's ::id field is used to inform the regulator driver
which type of regulators (buck or ldo) to instantiate.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
v2:
- fix commit message typos: s2mp1 -> s2mpg1
---
drivers/mfd/sec-common.c | 4 +++-
include/linux/mfd/samsung/s2mpg10.h | 5 +++++
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/sec-common.c b/drivers/mfd/sec-common.c
index 42d55e70e34c8d7cd68cddaecc88017e259365b4..8a1694c6ed8708397a51ebd4a49c22387d7e3495 100644
--- a/drivers/mfd/sec-common.c
+++ b/drivers/mfd/sec-common.c
@@ -14,6 +14,7 @@
#include <linux/mfd/core.h>
#include <linux/mfd/samsung/core.h>
#include <linux/mfd/samsung/irq.h>
+#include <linux/mfd/samsung/s2mpg10.h>
#include <linux/mfd/samsung/s2mps11.h>
#include <linux/mfd/samsung/s2mps13.h>
#include <linux/module.h>
@@ -35,7 +36,8 @@ static const struct mfd_cell s2dos05_devs[] = {

static const struct mfd_cell s2mpg10_devs[] = {
MFD_CELL_NAME("s2mpg10-meter"),
- MFD_CELL_NAME("s2mpg10-regulator"),
+ MFD_CELL_BASIC("s2mpg10-regulator", NULL, NULL, 0, S2MPG10_REGULATOR_CELL_ID_BUCKS),
+ MFD_CELL_BASIC("s2mpg10-regulator", NULL, NULL, 0, S2MPG10_REGULATOR_CELL_ID_LDOS),
MFD_CELL_NAME("s2mpg10-rtc"),
MFD_CELL_OF("s2mpg10-clk", NULL, NULL, 0, 0, "samsung,s2mpg10-clk"),
MFD_CELL_OF("s2mpg10-gpio", NULL, NULL, 0, 0, "samsung,s2mpg10-gpio"),
diff --git a/include/linux/mfd/samsung/s2mpg10.h b/include/linux/mfd/samsung/s2mpg10.h
index 9f5919b89a3c286bf1cd6b3ef0e74bc993bff01a..3e8bc65078472518c5e77f8bd199ee403eda18ea 100644
--- a/include/linux/mfd/samsung/s2mpg10.h
+++ b/include/linux/mfd/samsung/s2mpg10.h
@@ -8,6 +8,11 @@
#ifndef __LINUX_MFD_S2MPG10_H
#define __LINUX_MFD_S2MPG10_H

+enum s2mpg10_regulator_mfd_cell_id {
+ S2MPG10_REGULATOR_CELL_ID_BUCKS = 1,
+ S2MPG10_REGULATOR_CELL_ID_LDOS = 2,
+};
+
/* Common registers (type 0x000) */
enum s2mpg10_common_reg {
S2MPG10_COMMON_CHIPID,

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675905-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 650FB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:05:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0194417AE87
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:05:47 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D10328B50E;
Fri, 6 Jun 2025 15:03:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="voew/uOS"
Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85BC4289E25
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222203; cv=none; b=hq3MvFJ5xsgD5mUy3Lg31G+CqFz9nbeJ4hLbjXO9NNAEUcsDt8ZNsOW7HK89uy6UTJhkhKjvtnDk6N8oGvZnrTclEOO1uI2s9uU69otsCAs7iP7BV1pjso/OeFBqcKR7C6jVdxnb9FUwKBupe7Ao7PCNNlPaFs70yRvXBP2lQf8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222203; c=relaxed/simple;
bh=XW6upis7ywUBB7dA4Zx7cA15c1x+GH83X1v6QRh5Bzw=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=hsVZE7uh4MwndyCoRa6Vz5QdYPzeePsbBYD0WFXE6wG09N41ZkOkBaQ/oAhbu+qgB38s5WmGn8fPbCuwm8S+HRJ2GDF2YGKmLOtNzXNSl2PDIgw0w2crZUcXvahtP4bO/RbzK+omBdq29FSsj3EWkfBT+lIRzOrxRWClMUNFNwU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=voew/uOS; arc=none smtp.client-ip=209.85.218.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-ade326e366dso60773966b.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222197; x=1749826997; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=ZrVXOODskeO9o6lbylcxPdrCt1GmYzprp7c50qP9sE0=;
b=voew/uOS/S86vPm+lRnM0Xy3aMJDz9+Ttpt/ILp1QlCCT5WgQAYUw2a9fc9jaPGmBS
6qY9C/hjTZY8GAWCXOYrSFL5cLNpFDJRTZzmkvAyMTKRPP8XAuvVzl/j1nzvfbQBeDfh
Wa7p98fMk/ddvrnvrUXfDOi03pGFEIi1BtlTffYqfba1Pxl87Ez2se+5SEDGrIQVNr6A
6z51QIc2SLv6qnEzx+z4yfJ4EN1AFVvmlBKMMSCXdqG4OosdmwsqbfCK/HmdDWDc5OSD
EKPMZHaeONeY4jj0DeyawjqaCKQTTFIz2ozRJ/P703Fr9jZnzukJ0u5JvUlOCYkgsAAa
Af3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222197; x=1749826997;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ZrVXOODskeO9o6lbylcxPdrCt1GmYzprp7c50qP9sE0=;
b=tdqArZi0yWh4YnxaW2FzcAkuy4K8ko9j1bWyHTJ1xNE6JH13IpIfyT4oiM7Jy7WhEG
2RwEzIvAD38grDsSZaPnZl1qzKKYsLBa44enQ/W4ZSdAsKYve56KoZIaXXnopSj9ZD85
DL0+UQSQYSdjnNMmil8O92ktJROUmv0aEyDAUh8/Pmnvgw2A+kUw9lmeNEx56SAuEKSt
qvn7d7aJzJxP26MWcGXMUDAQCJ+fSXmBbEdy+zNlT/LKkUViXgvGxItigD2aA9QbnGP/
c2AS0TQVWmPsHklpwQJJVw/4ugZGG/RLEurFK0g3gKsAx99SiPbSKoOUXZtykstwJoj+
9c1A==
X-Forwarded-Encrypted: i=1; AJvYcCXa4GKGsIo3v2Hr+hWuoeBe1UXpUscvPCqAGC7qUqp6HUp6nBdj33U0IbY+3AuMF5qv2s/p2buHOk5HQ3U=@vger.kernel.org
X-Gm-Message-State: AOJu0YxS7iK4TdQ0WhU1IFf4c3Q8ha/9Xdq8qZB2mN8WLf3nb2DuS7OW
ub/DQsBiuW9VQK+mjcHy63hgR+4a6qUzHmUD26mzUjT9U/t+HwJEM2Ru8eYoN8R4NZM=
X-Gm-Gg: ASbGnctnqnEc5JSZekxc18YLasj0zb5c7HRvicFHnOxH7wZ4gd+UAUBfUZMCVxrZhQJ
VXRAtfof0Ai956Cqx3gwygkXy4AnvM4PCOZmhwpdA581RbiWGWt+VCi2LJEdx0NKQhY7I5f5CDb
Bf3ktp5AxHMlM7Fh0QoOqM1QPQfGia7ph++eDTyuT7ZvNK+Fw7M/bXaEmQvc5O/vBI/Xv9tXWuh
D6TrwVby3wNXDLYiK/HGDGvfpB10Z7kZhNa+o5cnRqO2v33AtxMNb/LfO6vWFXOmGRz3urX7B2e
bqNKEvnqcCaCwBEnViMflBQFwnLTJUthrMISB5z8y1JFFuXYBwtUllaXEtd9cNVueZlO8o/QCos
GfiJo04op5VGE/OKD0PNNorEEYiFiMkiIYYowW4qeF9yEWA==
X-Google-Smtp-Source: AGHT+IFPnRXvPeosibDEAxvwHPrDNR/Agw7oG0bKI7jl5+GdDejJiSgSnw2j3hTsx9Z3U15SN2WC4g==
X-Received: by 2002:a17:906:ee87:b0:adb:23e0:9290 with SMTP id a640c23a62f3a-ade1a916fe3mr332115566b.4.1749222197197;
Fri, 06 Jun 2025 08:03:17 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:16 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:06 +0100
Subject: [PATCH v2 10/17] regulator: s2mps11: use dev_err_probe() where
appropriate
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-10-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

dev_err_probe() exists to simplify code and harmonise error messages,
there's no reason not to use it here.

While at it, harmonise some error messages to add regulator name and ID
like in other messages in this driver, and update messages to be more
similar to other child-drivers of this PMIC (e.g. RTC).

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
drivers/regulator/s2mps11.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 1f51fbc6c7b6e158f9707c04d9f030b9eee5e842..30586e9884bfb998ff07e3148813344b307506c0 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1249,9 +1249,9 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu05_regulators));
break;
default:
- dev_err(&pdev->dev, "Invalid device type: %u\n",
- s2mps11->dev_type);
- return -EINVAL;
+ return dev_err_probe(&pdev->dev, -ENODEV,
+ "Unsupported device type %d\n",
+ s2mps11->dev_type);
}

s2mps11->ext_control_gpiod = devm_kcalloc(&pdev->dev, rdev_num,
@@ -1290,21 +1290,20 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod);
regulator = devm_regulator_register(&pdev->dev,
&regulators[i], &config);
- if (IS_ERR(regulator)) {
- dev_err(&pdev->dev, "regulator init failed for %d\n",
- i);
- return PTR_ERR(regulator);
- }
+ if (IS_ERR(regulator))
+ return dev_err_probe(&pdev->dev, PTR_ERR(regulator),
+ "regulator init failed for %d/%s\n",
+ regulators[i].id,
+ regulators[i].name);

if (config.ena_gpiod) {
ret = s2mps14_pmic_enable_ext_control(s2mps11,
- regulator);
- if (ret < 0) {
- dev_err(&pdev->dev,
- "failed to enable GPIO control over %s: %d\n",
- regulator->desc->name, ret);
- return ret;
- }
+ regulator);
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret,
+ "failed to enable GPIO control over %d/%s\n",
+ regulator->desc->id,
+ regulator->desc->name);
}
}


--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675904-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 33A4D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:06:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2D1997A7455
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:56 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1959528AB0B;
Fri, 6 Jun 2025 15:03:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="o9ePEAzT"
Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 096BD289E0F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222201; cv=none; b=FGdqiJ5QYORpl3huc0WfDdH7fNRBu/LLy3Zqv3UaSZy1Vw2b3YFCIOYQ1FvDzgIAnThbyus3mPf5ieJ+BOPM/Wj2tqH7oPsTD4fXV07nUKZ83akhDv5Qqhv+8lrWGQYq9HNU+ggLdmJRGhMevSfH7K7OhVm3FM/B7uHKjO3s+8o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222201; c=relaxed/simple;
bh=8YhlHBum+GMkpxcfSNF6Fsr5CtES7Gq7MKq60ULoi6A=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=kXWac2fZSNDgTPpWc2CDOFGgpl3febTL7teG14JlsUm2UvfVEbJQzBPqgVbfDClm3QdukCJlpfm7qMbBUHXtGzpf2LXEHgUbA9gAcEjZIzRodLyqR36wX0j5bTCEsKL4etrHVAZF/+JSYahkWRKpaWdJULdoH6N4/5VCcuazoiE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=o9ePEAzT; arc=none smtp.client-ip=209.85.218.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-ad89c32a7b5so355245366b.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222197; x=1749826997; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=86/sdIvo6lqhOQlCC6J1qPyFFkh630x60KJMH3jfrKw=;
b=o9ePEAzT7/z1ZCjcl4w44NvBa55hiT0AUGH78eEXeygoTZaBbbb+ziG5EmJh+2GP/3
0vhe+3pMmVcaX11kozQLRhBQhHyntljs1yPwHYGXjmWcDxdVgYbNiaS3LjE8bEmQkNp5
TZH2jjANbcJSJ9dQt++o1kGo0CXHvJhPLG+wVh1bKgw/hkfnfcl4UKQZUijAK2sHwS4C
PkdAfMytoRKD8SfdwVtTm75/Vzg38GQnnILxMsxpOjZHvFbSSAmQkU8Swkb/zEqNr5Rt
4v+yxMdbg4k1O06XpiN+Mec8mxhwGu+02Et7BDtWOSqYw0wRwIVYSKedmgFoHLdXCb7T
ku6g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222197; x=1749826997;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=86/sdIvo6lqhOQlCC6J1qPyFFkh630x60KJMH3jfrKw=;
b=qU8TMVwGfe0yDQ+PUYTlpkjAip7T3PlklIqcUT12r8PlmqOrSrd7OkNoU3gVdWW6SA
2a0H8fnHHdZuEuRnjVyayrfKLN02gkUGtNxWIGnUMpd0dXdCktpmKCd5eGDcpSulWlDL
rnU1nRO6zVGAKfdZgrjvW4D2ykIAwnI5QpQV00TeRmeSzczUJRGudacz+aytEfw+SIx1
WG19y7bCr6zXMUr2XUbiJmNfKvThzXgVGhi4L+pxnwQVNCFAl1AqCfbsotCbYX2vwJn+
ckUNU2LbVxzoMkDxKImN1bNr0NrNh7h6MP8+20wbTM8sI5Z5BDW5yyHIubv5FpohN2jn
WauQ==
X-Forwarded-Encrypted: i=1; AJvYcCUCSLTYKY4rC5QCfqzebBjkjavd0qnxsVRoqCxArRFx4P62i5fBij7UPtFK2L6074A6Fm3evYXnZU6r1yQ=@vger.kernel.org
X-Gm-Message-State: AOJu0Yx8O1vD9Q2Gbxgh5esqU3zx5Nn3OqR8aVb4pJIYa+LaMeottsfJ
95qU/cuBQJ8MAW81D78OiAHA6jANtCcWVfKxjxyojFxvgbTBkzrjGobRZBH1jwjhwak=
X-Gm-Gg: ASbGncvpCmRQx1De+U1kvixWNmFotEusqrJ4qKYoLljGQEpwBPlcWZ6jnVE/dEGQyb1
dxHEVr3kUt6E3JSjvBRVilYQOAN2wMZArTkoKxfjhchM7pC19cDZA80MQGBk4i7m1kMfVYMdaWx
dGIA1SauPTXsDXqos57R6gT8D6hP/tY/WEaRpixmYED/s5OkCrF8WRHM5fnNAm14uVAGdYyGhH3
+klcBgS9951ZyBKWwM+7jxLRHa1yIRJSJFkDnTJKF7vr4WWiRLnKIIo4yePmzMSmYCEWx/KneQ0
eNgiijnUdWIwzCfPx6Lmm1JT6lo7U+Xy9gC0j0+6wVj0Aszw8SKHIspnlRh3HrY8xbIuC4PyUvw
MV3NFn1rK/bWivwiCKewbl5JQpzAbjxR94jE=
X-Google-Smtp-Source: AGHT+IFqXf9+Um6DWXqgz7nJCFTyJ4x+s9ENYnuEsI/OTxzyyQL/fitGdfmm5vxFgTyc5juu03zvqw==
X-Received: by 2002:a17:907:94c8:b0:ad8:8a46:f156 with SMTP id a640c23a62f3a-ade1a9c825emr352106266b.6.1749222196713;
Fri, 06 Jun 2025 08:03:16 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:16 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:05 +0100
Subject: [PATCH v2 09/17] regulator: s2mps11: drop two needless variable
initialisations
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-9-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The initialisations being removed are needless, as both variables are
being assigned values unconditionally further down. Additionally, doing
this eager init here might lead to preventing the compiler from issuing
a warning if a future code change actually forgets to assign a useful
value in some code path.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
drivers/regulator/s2mps11.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 04ae9c6150bd5ae9dba47b9b3cfcfb62e4698b6d..1f51fbc6c7b6e158f9707c04d9f030b9eee5e842 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1207,8 +1207,8 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct regulator_config config = { };
struct s2mps11_info *s2mps11;
- unsigned int rdev_num = 0;
- int i, ret = 0;
+ unsigned int rdev_num;
+ int i, ret;
const struct regulator_desc *regulators;

s2mps11 = devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info),

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675909-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C05BC41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:06:28 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id C9F1B3B2811
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:06:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 37DA128BAAC;
Fri, 6 Jun 2025 15:03:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZNELT6dG"
Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39CE628A3E2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222206; cv=none; b=qrzgZT8el5AGQghuDshLRud7JoaIhy1c0wPDG2A23EVxMeBufOnT+pHEW0mm9uSwdEmcXyPPxs0Yb9Gv0lnXSk2hdMRzYll7IabhufZ3oOO31YNkixlCw7SHTtxcQr+T7LEkkiQ4BDg0CpvbRgOgGl0Bmpq/ll6gEYIbv1VsLm4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222206; c=relaxed/simple;
bh=UkmPjqPD2ja28jTmADLGGV15eCDj30NAA5f5X22ywHE=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=idGZH3qO1QCjjQkpIMA3H5dVvv4tw3FR321ZJ9/ogIlm6WPRge0QwwK/RJGbyGKD44GVcfoiOszCJ4qkcf/2xyFeAzeBI1jIRVM301xN0vdd0hUfVLe/ycxzpcm0z0d1pRzDrXVOY66fwYAWSJBTYiAwcuJqU184MTrlyF+lzw8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ZNELT6dG; arc=none smtp.client-ip=209.85.218.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-ac3eb3fdd2eso414505066b.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222200; x=1749827000; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=ys3kqVqTp9K6q45SE1ON1/ZwbM9Akoxhc6x7rkQEUjM=;
b=ZNELT6dGH4MEKX8Lso9zMyg8/9pHXaehN1jqaSqekZI8HLkWqnhCtVYHwTjHjR1dUC
lgs3+7hp6x7lvgPx8cIUOUSQ0WckoPjcJb6k+152ukJpIrwfw9P875YBJwUnMRNw1or0
N8VyEWmyc8V3qi0DctWnvuV9CrDjLb9/ffH4p7kLRJDaIffDpdqaxAXyobh6lU1ySctK
lb446zEDSFPRo5WvIuYpynwjy2gXkU53FoY+8fnrLNv+bTHFfP1D9Qthb8PQRN5tLs6u
PHSASXpFZzHZJuqn5vCa/JTi0y7GhkRpzr6ykpBG+jLDeRoFJSfHVtdE0x2KFagXl8xb
UsNQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222200; x=1749827000;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ys3kqVqTp9K6q45SE1ON1/ZwbM9Akoxhc6x7rkQEUjM=;
b=jiWBsIXc9HyIVQ8LeATdNDcmrjXLi5M5EL1jcd01sEWi6i8dTzkJA3One/4yVDJ2vb
m7fozPQ6qHKeZejNJBkvpW4QcwnHGL4Y3GV2lvzxwYHF6ojeGuLD/yGd7o4Wnnfk0iHk
fGx1DBx5SDWsb8caAbZ7T8wBQfAk3nmGrGtiD+Ji80/VpERKf03C7q4D62BYimQ5gmAh
etwH4yj8yZVEjLMEQCHcwzd9ytP6iEWhlP7UuS/T++iQ0iEOvu454QnkGsl9HWOBufCJ
JH2SJi83Swrsj8Wfpwa0IL067PybfliGYAx2hYP6I86kQmYUMmW4Dk5SAAe990oyKRRp
OJRQ==
X-Forwarded-Encrypted: i=1; AJvYcCVixHdm+pQgaijAeZBk72eDQcE3HsTul7HLFrPFlfY22caVNFbYtfbhIBD+2sNO/IfQhqWrDz4hv/gl1LA=@vger.kernel.org
X-Gm-Message-State: AOJu0YwOVYDBbHhZWHw/tLk+dwIcXVVkFp93t48/6FjRMJV15INtP4nI
THqaPHOgEyLNEixKH4fGenBEXVbYXx09N/Z6lEClKSePhLtl8+zbrVV8fBkLJvcAJg4=
X-Gm-Gg: ASbGncvj54bgLlt6Jcl0cqIpUhFdyzrLRKeVM+bWdaJqJLZF9F/a7ByUmb2iy6kzwdJ
U9+0GnfSE1lrEu671pcHvj3NsfwEXbbuzPIlJYzqD46M68QpoYzxTnGTNgsPwHaj1MwTgTGYCcH
2mdNGJrekZtbG3KZ7zr/X1/7boRT4pkASKAdtg2WWSp87q5gr/psaE5kjCHe44fGqr74UqbdmE3
Nalg9ZEFJ4xXDGKRgMQLdl7j8kn8kSf/SWlsmD8awpQIxKF2mN9yGyvvJtHPCmj+STQzhHlJ5zh
mh/3D412CZShFFD4rwTdSvNUwwvfQivPivs9X0BeYGtFhxIfKPfrOx/FAaXoGC/7AE5UW8H339h
6mqxxyE8r2p2IzVStAoGogbLvU5JH9J3SvD2oxDmNEmkqZA==
X-Google-Smtp-Source: AGHT+IFB2fXv9eKwQsioE6nBfEWNtn8Pkzr0cPTJwuvdsg2LJK8eHn/pbU2R1NwRJWe6FpnOQNACdg==
X-Received: by 2002:a17:907:fdc1:b0:ad5:74cd:1824 with SMTP id a640c23a62f3a-ade1ab20872mr314707866b.38.1749222199966;
Fri, 06 Jun 2025 08:03:19 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.19
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:19 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:11 +0100
Subject: [PATCH v2 15/17] regulator: s2mps11: refactor S2MPG10 regulator
macros for S2MPG11 reuse
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-15-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Rails in the S2MPG11 share a very similar set of properties with
S2MPG10 with slight differences. Update the existing macros to allow
reuse by the upcoming S2MPG11 driver.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
Note: checkpatch complains about unused macro arguments _r_mask,
_r_table, and _r_table_sz, but these are false-positives due to patch
context.

v2:
- fix commit message typos: s2mp1 -> s2mpg1
- drop duplicated assignment of ::of_parse_cb in
regulator_desc_s2mpg1x_buck_cmn() macro
---
drivers/regulator/s2mps11.c | 69 +++++++++++++++++++++++++++------------------
1 file changed, 42 insertions(+), 27 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 76be81c75c898fddc9570a62a64da787bacad7d7..2829062c54a49a17911cd091cf0ffb7950393787 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -638,24 +638,24 @@ static const struct regulator_ops s2mpg10_reg_buck_ops[] = {
}
};

-#define regulator_desc_s2mpg10_ldo_cmn(_num, _supply, _ops, _vrange, \
- _vsel_reg_sfx, _vsel_mask, _en_reg, _en_mask, \
+#define regulator_desc_s2mpg1x_ldo_cmn(_name, _id, _supply, _ops, \
+ _vrange, _vsel_reg, _vsel_mask, _en_reg, _en_mask, \
_ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz) { \
- .name = "ldo"#_num"m", \
+ .name = "ldo"_name, \
.supply_name = _supply, \
- .of_match = of_match_ptr("ldo"#_num"m"), \
+ .of_match = of_match_ptr("ldo"_name), \
.regulators_node = of_match_ptr("regulators"), \
.of_parse_cb = s2mpg10_of_parse_cb, \
- .id = S2MPG10_LDO##_num, \
+ .id = _id, \
.ops = &_ops[0], \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.linear_ranges = _vrange, \
.n_linear_ranges = ARRAY_SIZE(_vrange), \
.n_voltages = _vrange##_count, \
- .vsel_reg = S2MPG10_PMIC_L##_num##M_##_vsel_reg_sfx, \
+ .vsel_reg = _vsel_reg, \
.vsel_mask = _vsel_mask, \
- .enable_reg = S2MPG10_PMIC_##_en_reg, \
+ .enable_reg = _en_reg, \
.enable_mask = _en_mask, \
.ramp_delay = _ramp_delay, \
.ramp_reg = _r_reg, \
@@ -670,10 +670,12 @@ static const struct regulator_ops s2mpg10_reg_buck_ops[] = {
_ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz, \
_pc_reg, _pc_mask) \
{ \
- .desc = regulator_desc_s2mpg10_ldo_cmn(_num, _supply, \
- _ops, \
- _vrange, _vsel_reg_sfx, _vsel_mask, \
- _en_reg, _en_mask, \
+ .desc = regulator_desc_s2mpg1x_ldo_cmn(#_num"m", \
+ S2MPG10_LDO##_num, _supply, _ops, \
+ _vrange, \
+ S2MPG10_PMIC_L##_num##M_##_vsel_reg_sfx, \
+ _vsel_mask, \
+ S2MPG10_PMIC_##_en_reg, _en_mask, \
_ramp_delay, _r_reg, _r_mask, _r_table, \
_r_table_sz), \
.pctrlsel_reg = _pc_reg, \
@@ -728,31 +730,44 @@ static const struct regulator_ops s2mpg10_reg_buck_ops[] = {
* (12.5mV/μs) while our ::set_voltage_time() takes the value in ramp_reg
* into account.
*/
-#define regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg) { \
- .name = "buck"#_num"m", \
- .supply_name = "vinb"#_num"m", \
- .of_match = of_match_ptr("buck"#_num"m"), \
+#define regulator_desc_s2mpg1x_buck_cmn(_name, _id, _supply, _ops, \
+ _vrange, _vsel_reg, _vsel_mask, _en_reg, _en_mask, \
+ _r_reg, _r_mask, _r_table, _r_table_sz, \
+ _en_time) { \
+ .name = "buck"_name, \
+ .supply_name = _supply, \
+ .of_match = of_match_ptr("buck"_name), \
.regulators_node = of_match_ptr("regulators"), \
.of_parse_cb = s2mpg10_of_parse_cb, \
- .id = S2MPG10_BUCK##_num, \
- .ops = &s2mpg10_reg_buck_ops[0], \
+ .id = _id, \
+ .ops = &_ops[0], \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.linear_ranges = _vrange, \
.n_linear_ranges = ARRAY_SIZE(_vrange), \
.n_voltages = _vrange##_count, \
- .vsel_reg = S2MPG10_PMIC_B##_num##M_OUT1, \
- .vsel_mask = 0xff, \
- .enable_reg = S2MPG10_PMIC_B##_num##M_CTRL, \
- .enable_mask = GENMASK(7, 6), \
- .ramp_reg = S2MPG10_PMIC_##_r_reg, \
- .ramp_mask = s2mpg10_buck_to_ramp_mask(S2MPG10_BUCK##_num \
- - S2MPG10_BUCK1), \
- .ramp_delay_table = s2mpg10_buck_ramp_table, \
- .n_ramp_values = ARRAY_SIZE(s2mpg10_buck_ramp_table), \
- .enable_time = 30, /* + V/enable_ramp_rate */ \
+ .vsel_reg = _vsel_reg, \
+ .vsel_mask = _vsel_mask, \
+ .enable_reg = _en_reg, \
+ .enable_mask = _en_mask, \
+ .ramp_reg = _r_reg, \
+ .ramp_mask = _r_mask, \
+ .ramp_delay_table = _r_table, \
+ .n_ramp_values = _r_table_sz, \
+ .enable_time = _en_time, /* + V/enable_ramp_rate */ \
}

+#define regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg) \
+ regulator_desc_s2mpg1x_buck_cmn(#_num"m", S2MPG10_BUCK##_num, \
+ "vinb"#_num"m", s2mpg10_reg_buck_ops, _vrange, \
+ S2MPG10_PMIC_B##_num##M_OUT1, GENMASK(7, 0), \
+ S2MPG10_PMIC_B##_num##M_CTRL, GENMASK(7, 6), \
+ S2MPG10_PMIC_##_r_reg, \
+ s2mpg10_buck_to_ramp_mask(S2MPG10_BUCK##_num \
+ - S2MPG10_BUCK1), \
+ s2mpg10_buck_ramp_table, \
+ ARRAY_SIZE(s2mpg10_buck_ramp_table), 30)
+
#define s2mpg10_regulator_desc_buck_cm(_num, _vrange, _r_reg) \
.desc = regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg), \
.enable_ramp_rate = 12500

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675907-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6E84D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:06:39 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7AF283B2D59
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:06:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A397289E0F;
Fri, 6 Jun 2025 15:03:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Q/E0ok1O"
Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id F314528A1E1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222206; cv=none; b=LT40IHkPoM0M0iwlR1JFbdUZWw6TWQMmhnv+L8QoB/I/ADkY5kWMe+JYJd1g/Nkn+YHDN5ZEmbnCzNalIIoUDGnrXGx2I6ehB8bpOcat5/N3Ptz9uQs88ORvhYrdYuLzkk1WzrdghhZl/TyipLIHX8PFa/T9R5TJrRjFJl6PI4I=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222206; c=relaxed/simple;
bh=i6QXnSiteLIUPBjVIav8k0ILi207/7CCIjQjoaDN3aQ=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=tIeKr8rjo5h5LarTvpSsOCyJaJud97xlvOIMCXR865azJjIKdwofr2haFJrVGf2iu/qAAxkOUfUwQ03DeoCpFnuIokwyseB5ZyMIFIPcQcwWeX3SxipcyxK5uqcVLX23PdHxdkCx65fAemB8P01jHdcDj2MirBhMOtE9rERbgK8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Q/E0ok1O; arc=none smtp.client-ip=209.85.208.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-60700a745e5so1243822a12.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222199; x=1749826999; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=kqxgbhEUW2aPqS16pDRoTw9isctia083M7RJw6SkJXc=;
b=Q/E0ok1OQB0mkpBg9xX+nNN40dUVDjOJgXKphVKierwsey5IBPTq2x4QUsr/1XQF15
wgbx/y79LR98BrfiLQtKWBY/7vCT6Yz1Jf2dkIQMmWpFHcjdYZ+ZGg9mTIGV+Cs3C2FT
A6tsInPr8aIUc0Rnfempq9xiP5eav5RuqrCu+n4QIUmAw4vyt2CssGkkPC+FlTvMql4S
q/KHuCAw12Jvj9rPc0S1oefv6EUdIqA+3WCrAQdvqDigtiXKOFXk689DyYuqnV9D/qUn
YIkzWzpm3mytd0jF02w6AopWpFaeLCuDu8OyBe3iRG9sA+UdYmLfkuu2VSoeLQQLLnqZ
q8+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222199; x=1749826999;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=kqxgbhEUW2aPqS16pDRoTw9isctia083M7RJw6SkJXc=;
b=X6DTbD2CXYOYF043wpDhOAUq4INaxs1QOX1SvpgS+9NY8gdpe0oRm6nq/clOWX/ZGo
1af9VgGE8ECJmM5bHz5/3ihuPntkUlaEy5rKhBFypHxfkDwIbOHM2tHC28ZAdr9z9jpR
VcZYdKzn4ojkZNBPYKA/GGvXt+LFOMLL0LjZ0rUIEofPBgvEjEZVue1vN7prFptg/R3e
rsFZkpz8rmFeGajEVIr3umEcRkqcHsMv/CP+h9Bqul+Mc3F3F7KB50aOAIYmebSFaEQh
8QNTjMIHMMzkEtDH5jpYeYvtVf4FElVm9qYEYpLlzQIljaoHiKYVEwFXq/AqOarSN4Yz
DmmQ==
X-Forwarded-Encrypted: i=1; AJvYcCVWXZZ/XvhxK1QFPFCHQMwxvSZUQxt9Gph0Kz5fC8RNtMPnqp/h1S0f7Cw2+AqCtCPkJB0fTg8tMwIJtFg=@vger.kernel.org
X-Gm-Message-State: AOJu0YyNsft96ViJFUmT/UBQFHnQtJ2k80bLMz844FHiuJACz+cjpfol
FjVp+HTqO2tFACpYS9D+bxY9+5TBTabUTXaL20p+hlSJI0X0AskcNNq3RDdVT0MyaNA=
X-Gm-Gg: ASbGncsRER7ezkRoOFW4nNcT0NSfAfeG2eNye0267C1IizRcpOf+T9V+rj07yADxCyx
dPfB49JiLiOnZb3pXzl0yk1dMJkk6kk+g9QJ32kVrdXSdXq83NGKsX7B+mcdqr/9EDBqM1ttJcg
X5hq+rwybiHQrc4+0SuBmFbNp/P3PxUfv2DieRn/Mrj+V4YVHLYZdpkE9cI7I23HBDAUxM246ll
wNL2yKu2ZUK3XtTHJsMzZUUBA+3KDtzmeW8lV/LC+IPuOTWpQSnoWLVz/QqVS68ZXtNTpoE+RlF
+cVfM/Huj9XKhDj/UBfQ+GmyKJSuTG2ouCzJrnb4edxN4RD7RRjaou8zFUCH/L+J5YwlKiymjKF
/NbPtVMEFYl6aSB8aTvCUBMA5H6vw90FCG4jr0/AOmz2mbQ==
X-Google-Smtp-Source: AGHT+IEEWvXQDp4Z8aQYKW7jE1ugyWPX7Vb2fc4HmfXzwlZ9jNJDrzGCqaBfn/QhjgrsiaPRZYfKfA==
X-Received: by 2002:a17:907:3e0f:b0:ad9:16c8:9fee with SMTP id a640c23a62f3a-ade1a9160d7mr369371766b.3.1749222198976;
Fri, 06 Jun 2025 08:03:18 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.18
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:18 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:09 +0100
Subject: [PATCH v2 13/17] regulator: s2mps11: add S2MPG10 regulator
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-13-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,LOTS_OF_MONEY,
MAILING_LIST_MULTI,MONEY_NOHTML,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The S2MPG10 PMIC is a Power Management IC for mobile applications with
buck converters, various LDOs, power meters, RTC, clock outputs, and
additional GPIO interfaces.

It has 10 buck and 31 LDO rails. Several of these can either be
controlled via software or via external signals, e.g. input pins
connected to a main processor's GPIO pins.

This commit implements support for these rails.

Additional data needs to be stored for each regulator, e.g. the input
pin for external control, or a rail-specific ramp-rate for when
enabling a buck-rail. Therefore, probe() is updated slightly to make
that possible.

The rails are instantiated as separate driver instances for bucks and
LDOs, because S2MPG10 is typically used with an S2MPG11 sub-PMIC where
some bucks of one typically supply at least some of the LDOs of the
other.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
v2:
- move assignment of ::of_parse_cb in regulator_desc_s2mpg10_buck() to
match order of struct definition
---
drivers/regulator/s2mps11.c | 561 +++++++++++++++++++++++++++++++++++-
include/linux/mfd/samsung/s2mpg10.h | 3 +
2 files changed, 561 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index ff9124c998c685d9c598570148dca074e671a99b..3f2993b96c3e54427f5c0af7bb045e2278daa671 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -3,6 +3,7 @@
// Copyright (c) 2012-2014 Samsung Electronics Co., Ltd
// http://www.samsung.com

+#include <dt-bindings/regulator/samsung,s2mpg10-regulator.h>
#include <linux/bug.h>
#include <linux/cleanup.h>
#include <linux/err.h>
@@ -16,6 +17,7 @@
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/mfd/samsung/core.h>
+#include <linux/mfd/samsung/s2mpg10.h>
#include <linux/mfd/samsung/s2mps11.h>
#include <linux/mfd/samsung/s2mps13.h>
#include <linux/mfd/samsung/s2mps14.h>
@@ -42,6 +44,21 @@ struct s2mps11_info {
DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX);
};

+#define to_s2mpg10_regulator_desc(x) container_of((x), struct s2mpg10_regulator_desc, desc)
+
+struct s2mpg10_regulator_desc {
+ struct regulator_desc desc;
+
+ /* Ramp rate during enable, valid for bucks only. */
+ unsigned int enable_ramp_rate;
+
+ /* Registers for external control of rail. */
+ unsigned int pctrlsel_reg;
+ unsigned int pctrlsel_mask;
+ /* Populated from DT. */
+ unsigned int pctrlsel_val;
+};
+
static int get_ramp_delay(int ramp_delay)
{
unsigned char cnt = 0;
@@ -388,6 +405,492 @@ static int s2mps11_of_parse_cb(struct device_node *np,
return s2mps11_of_parse_gpiod(np, desc, config);
}

+static int s2mpg10_of_parse_cb(struct device_node *np,
+ const struct regulator_desc *desc,
+ struct regulator_config *config)
+{
+ const struct s2mps11_info *s2mps11 = config->driver_data;
+ struct s2mpg10_regulator_desc *s2mpg10_desc = to_s2mpg10_regulator_desc(desc);
+ u32 ext_control;
+
+ if (s2mps11->dev_type != S2MPG10)
+ return 0;
+
+ if (of_property_read_u32(np, "samsung,ext-control", &ext_control))
+ return 0;
+
+ switch (s2mps11->dev_type) {
+ case S2MPG10:
+ switch (desc->id) {
+ case S2MPG10_BUCK1 ... S2MPG10_BUCK7:
+ case S2MPG10_BUCK10:
+ case S2MPG10_LDO3 ... S2MPG10_LDO19:
+ if (ext_control > S2MPG10_PCTRLSEL_TCXO_ON2)
+ return -EINVAL;
+ break;
+
+ case S2MPG10_LDO20:
+ if (ext_control > S2MPG10_PCTRLSEL_LDO20M_OFF)
+ return -EINVAL;
+ break;
+
+ default:
+ return -EINVAL;
+ }
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ /*
+ * If the regulator should be configured for external control, then:
+ * 1) the PCTRLSELx register needs to be set accordingly
+ * 2) regulator_desc::enable_val needs to be:
+ * a) updated and
+ * b) written to the hardware
+ * 3) we switch to the ::ops that don't provide ::enable() and
+ * ::disable() implementations
+ *
+ * Points 1) and 2b) will be handled in _probe(), after
+ * devm_regulator_register() returns, so that we can properly act on
+ * failures, since the regulator core ignores most return values from
+ * this parse callback.
+ */
+ s2mpg10_desc->pctrlsel_val = ext_control;
+ s2mpg10_desc->pctrlsel_val <<= (ffs(s2mpg10_desc->pctrlsel_mask) - 1);
+
+ s2mpg10_desc->desc.enable_val = S2MPG10_PMIC_CTRL_ENABLE_EXT;
+ s2mpg10_desc->desc.enable_val <<= (ffs(desc->enable_mask) - 1);
+
+ ++s2mpg10_desc->desc.ops;
+
+ return s2mps11_of_parse_gpiod(np, desc, config);
+}
+
+static int s2mpg10_enable_ext_control(struct s2mps11_info *s2mps11,
+ struct regulator_dev *rdev)
+{
+ const struct s2mpg10_regulator_desc *s2mpg10_desc;
+ int ret;
+
+ switch (s2mps11->dev_type) {
+ case S2MPG10:
+ s2mpg10_desc = to_s2mpg10_regulator_desc(rdev->desc);
+ break;
+
+ default:
+ return 0;
+ }
+
+ ret = regmap_update_bits(rdev_get_regmap(rdev),
+ s2mpg10_desc->pctrlsel_reg,
+ s2mpg10_desc->pctrlsel_mask,
+ s2mpg10_desc->pctrlsel_val);
+ if (ret)
+ return dev_err_probe(rdev_get_dev(rdev), ret,
+ "failed to configure pctrlsel for %s\n",
+ rdev->desc->name);
+
+ ret = regulator_enable_regmap(rdev);
+ if (ret)
+ return dev_err_probe(rdev_get_dev(rdev), ret,
+ "failed to enable regulator %s\n",
+ rdev->desc->name);
+
+ return 0;
+}
+
+/* ops for regulators without ramp control */
+static const struct regulator_ops s2mpg10_reg_ldo_ops[] = {
+ {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .is_enabled = regulator_is_enabled_regmap,
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ }, {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ }
+};
+
+/* ops for regulators that have ramp control */
+static const struct regulator_ops s2mpg10_reg_ldo_ramp_ops[] = {
+ {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .is_enabled = regulator_is_enabled_regmap,
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ .set_ramp_delay = regulator_set_ramp_delay_regmap,
+ }, {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ .set_ramp_delay = regulator_set_ramp_delay_regmap,
+ }
+};
+
+static int s2mpg10_regulator_buck_enable_time(struct regulator_dev *rdev)
+{
+ const struct s2mpg10_regulator_desc * const s2mpg10_desc =
+ to_s2mpg10_regulator_desc(rdev->desc);
+ const struct regulator_ops * const ops = rdev->desc->ops;
+ int vsel, curr_uV;
+
+ vsel = ops->get_voltage_sel(rdev);
+ if (vsel < 0)
+ return vsel;
+
+ curr_uV = ops->list_voltage(rdev, vsel);
+ if (curr_uV < 0)
+ return curr_uV;
+
+ return (rdev->desc->enable_time
+ + DIV_ROUND_UP(curr_uV, s2mpg10_desc->enable_ramp_rate));
+}
+
+static int s2mpg10_regulator_buck_set_voltage_time(struct regulator_dev *rdev,
+ int old_uV, int new_uV)
+{
+ unsigned int ramp_reg, ramp_sel, ramp_rate;
+ int ret;
+
+ if (old_uV == new_uV)
+ return 0;
+
+ ramp_reg = rdev->desc->ramp_reg;
+ if (old_uV > new_uV)
+ /* The downwards ramp is at a different offset. */
+ ramp_reg += S2MPG10_PMIC_DVS_RAMP4 - S2MPG10_PMIC_DVS_RAMP1;
+
+ ret = regmap_read(rdev->regmap, ramp_reg, &ramp_sel);
+ if (ret)
+ return ret;
+
+ ramp_sel &= rdev->desc->ramp_mask;
+ ramp_sel >>= ffs(rdev->desc->ramp_mask) - 1;
+ if (ramp_sel >= rdev->desc->n_ramp_values ||
+ !rdev->desc->ramp_delay_table)
+ return -EINVAL;
+
+ ramp_rate = rdev->desc->ramp_delay_table[ramp_sel];
+
+ return DIV_ROUND_UP(abs(new_uV - old_uV), ramp_rate);
+}
+
+/*
+ * We assign both, ::set_voltage_time() and ::set_voltage_time_sel(), because
+ * only if the latter is != NULL, the regulator core will call neither during
+ * DVS if the regulator is disabled. If the latter is NULL, the core always
+ * calls the ::set_voltage_time() callback, which would give incorrect results
+ * if the regulator is off.
+ * At the same time, we do need ::set_voltage_time() due to differing upwards
+ * and downwards ramps and we can not make that code dependent on the regulator
+ * enable state, as that would break regulator_set_voltage_time() which
+ * expects a correct result no matter the enable state.
+ */
+static const struct regulator_ops s2mpg10_reg_buck_ops[] = {
+ {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .is_enabled = regulator_is_enabled_regmap,
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .enable_time = s2mpg10_regulator_buck_enable_time,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time = s2mpg10_regulator_buck_set_voltage_time,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ .set_ramp_delay = regulator_set_ramp_delay_regmap,
+ }, {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time = s2mpg10_regulator_buck_set_voltage_time,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ .set_ramp_delay = regulator_set_ramp_delay_regmap,
+ }
+};
+
+#define regulator_desc_s2mpg10_ldo_cmn(_num, _supply, _ops, _vrange, \
+ _vsel_reg_sfx, _vsel_mask, _en_reg, _en_mask, \
+ _ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz) { \
+ .name = "ldo"#_num"m", \
+ .supply_name = _supply, \
+ .of_match = of_match_ptr("ldo"#_num"m"), \
+ .regulators_node = of_match_ptr("regulators"), \
+ .of_parse_cb = s2mpg10_of_parse_cb, \
+ .id = S2MPG10_LDO##_num, \
+ .ops = &_ops[0], \
+ .type = REGULATOR_VOLTAGE, \
+ .owner = THIS_MODULE, \
+ .linear_ranges = _vrange, \
+ .n_linear_ranges = ARRAY_SIZE(_vrange), \
+ .n_voltages = _vrange##_count, \
+ .vsel_reg = S2MPG10_PMIC_L##_num##M_##_vsel_reg_sfx, \
+ .vsel_mask = _vsel_mask, \
+ .enable_reg = S2MPG10_PMIC_##_en_reg, \
+ .enable_mask = _en_mask, \
+ .ramp_delay = _ramp_delay, \
+ .ramp_reg = _r_reg, \
+ .ramp_mask = _r_mask, \
+ .ramp_delay_table = _r_table, \
+ .n_ramp_values = _r_table_sz, \
+ .enable_time = 130, /* startup 20+-10 + ramp 30..100μs */ \
+}
+
+#define s2mpg10_regulator_desc_ldo_cmn(_num, _supply, _vrange, _ops, \
+ _vsel_reg_sfx, _vsel_mask, _en_reg, _en_mask, \
+ _ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz, \
+ _pc_reg, _pc_mask) \
+ { \
+ .desc = regulator_desc_s2mpg10_ldo_cmn(_num, _supply, \
+ _ops, \
+ _vrange, _vsel_reg_sfx, _vsel_mask, \
+ _en_reg, _en_mask, \
+ _ramp_delay, _r_reg, _r_mask, _r_table, \
+ _r_table_sz), \
+ .pctrlsel_reg = _pc_reg, \
+ .pctrlsel_mask = _pc_mask, \
+ }
+
+/* standard LDO via LxM_CTRL */
+#define s2mpg10_regulator_desc_ldo(_num, _supply, _vrange) \
+ s2mpg10_regulator_desc_ldo_cmn(_num, _supply, _vrange, \
+ s2mpg10_reg_ldo_ops, CTRL, GENMASK(5, 0), \
+ L##_num##M_CTRL, BIT(7), \
+ 0, 0, 0, NULL, 0, \
+ 0, 0) \
+
+/* standard LDO via LxM_CTRL but non-standard vsel mask */
+#define s2mpg10_regulator_desc_ldo_vmsk(_num, _supply, _vrange, \
+ _vsel_mask) \
+ s2mpg10_regulator_desc_ldo_cmn(_num, _supply, _vrange, \
+ s2mpg10_reg_ldo_ops, CTRL, _vsel_mask, \
+ L##_num##M_CTRL, BIT(7), \
+ 0, 0, 0, NULL, 0, \
+ 0, 0)
+
+/* standard LDO but possibly GPIO controlled */
+#define s2mpg10_regulator_desc_ldo_gpio(_num, _supply, _vrange, \
+ _pc_reg, _pc_mask) \
+ s2mpg10_regulator_desc_ldo_cmn(_num, _supply, _vrange, \
+ s2mpg10_reg_ldo_ops, CTRL, GENMASK(5, 0), \
+ L##_num##M_CTRL, GENMASK(7, 6), \
+ 0, 0, 0, NULL, 0, \
+ S2MPG10_PMIC_##_pc_reg, _pc_mask)
+
+/* LDO with ramp support and possibly GPIO controlled */
+#define s2mpg10_regulator_desc_ldo_ramp(_num, _supply, _vrange, \
+ _en_mask, _r_reg_sfx, _pc_reg, _pc_mask) \
+ s2mpg10_regulator_desc_ldo_cmn(_num, _supply, _vrange, \
+ s2mpg10_reg_ldo_ramp_ops, CTRL1, GENMASK(6, 0), \
+ LDO_CTRL2, _en_mask, \
+ 6250, S2MPG10_PMIC_##_r_reg_sfx, GENMASK(1, 0), \
+ s2mpg10_ldo_ramp_table, \
+ ARRAY_SIZE(s2mpg10_ldo_ramp_table), \
+ S2MPG10_PMIC_##_pc_reg, _pc_mask)
+
+#define s2mpg10_buck_to_ramp_mask(n) (GENMASK(1, 0) << (((n) % 4) * 2))
+
+/*
+ * The ramp_delay during enable is fixed (12.5mV/μs), while the ramp during
+ * DVS can be adjusted. Linux can adjust the ramp delay via DT, in which case
+ * the regulator core will modify the regulator's constraints and call our
+ * .set_ramp_delay() which updates the DVS ramp in ramp_reg.
+ * For enable, our .enable_time() unconditionally uses enable_ramp_rate
+ * (12.5mV/μs) while our ::set_voltage_time() takes the value in ramp_reg
+ * into account.
+ */
+#define regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg) { \
+ .name = "buck"#_num"m", \
+ .supply_name = "vinb"#_num"m", \
+ .of_match = of_match_ptr("buck"#_num"m"), \
+ .regulators_node = of_match_ptr("regulators"), \
+ .of_parse_cb = s2mpg10_of_parse_cb, \
+ .id = S2MPG10_BUCK##_num, \
+ .ops = &s2mpg10_reg_buck_ops[0], \
+ .type = REGULATOR_VOLTAGE, \
+ .owner = THIS_MODULE, \
+ .linear_ranges = _vrange, \
+ .n_linear_ranges = ARRAY_SIZE(_vrange), \
+ .n_voltages = _vrange##_count, \
+ .vsel_reg = S2MPG10_PMIC_B##_num##M_OUT1, \
+ .vsel_mask = 0xff, \
+ .enable_reg = S2MPG10_PMIC_B##_num##M_CTRL, \
+ .enable_mask = GENMASK(7, 6), \
+ .ramp_reg = S2MPG10_PMIC_##_r_reg, \
+ .ramp_mask = s2mpg10_buck_to_ramp_mask(S2MPG10_BUCK##_num \
+ - S2MPG10_BUCK1), \
+ .ramp_delay_table = s2mpg10_buck_ramp_table, \
+ .n_ramp_values = ARRAY_SIZE(s2mpg10_buck_ramp_table), \
+ .enable_time = 30, /* + V/enable_ramp_rate */ \
+}
+
+#define s2mpg10_regulator_desc_buck_cm(_num, _vrange, _r_reg) \
+ .desc = regulator_desc_s2mpg10_buck(_num, _vrange, _r_reg), \
+ .enable_ramp_rate = 12500
+
+#define s2mpg10_regulator_desc_buck_gpio(_num, _vrange, _r_reg, \
+ _pc_reg, _pc_mask) \
+ { \
+ s2mpg10_regulator_desc_buck_cm(_num, _vrange, _r_reg), \
+ .pctrlsel_reg = S2MPG10_PMIC_##_pc_reg, \
+ .pctrlsel_mask = _pc_mask, \
+ }
+
+#define s2mpg10_regulator_desc_buck(_num, _vrange, _r_reg) \
+ { \
+ s2mpg10_regulator_desc_buck_cm(_num, _vrange, _r_reg), \
+ }
+
+#define S2MPG10_VOLTAGE_RANGE(_prefix, _idx, _start_uV, _min_uV, \
+ _max_uV, _step_uV) \
+static const struct linear_range _prefix##_vranges##_idx[] = { \
+ REGULATOR_LINEAR_RANGE(_min_uV, \
+ ((_min_uV) - (_start_uV)) / (_step_uV), \
+ ((_max_uV) - (_start_uV)) / (_step_uV), \
+ _step_uV) \
+}; \
+static const unsigned int _prefix##_vranges##_idx##_count = \
+ ((((_max_uV) - (_start_uV)) / (_step_uV)) + 1)
+
+/* voltage range for s2mpg10 LDO 1, 11, 12 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 1, 300000, 700000, 1300000, STEP_12_5_MV);
+
+/* voltage range for s2mpg10 LDO 2, 4, 9, 14, 18, 19, 20, 23, 25, 29, 30, 31 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 2, 700000, 1600000, 1950000, STEP_25_MV);
+
+/* voltage range for s2mpg10 LDO 3, 5, 6, 8, 16, 17, 24, 28 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 3, 725000, 725000, 1300000, STEP_12_5_MV);
+
+/* voltage range for s2mpg10 LDO 7 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 7, 300000, 450000, 1300000, STEP_12_5_MV);
+
+/* voltage range for s2mpg10 13, 15 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 13, 300000, 450000, 950000, STEP_12_5_MV);
+
+/* voltage range for s2mpg10 LDO 10 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 10, 1800000, 1800000, 3350000, STEP_25_MV);
+
+/* voltage range for s2mpg10 LDO 21, 22, 26, 27 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_ldo, 21, 1800000, 2500000, 3300000, STEP_25_MV);
+
+/* possible ramp values for s2mpg10 LDO 11, 12, 13, 15 */
+static const unsigned int s2mpg10_ldo_ramp_table[] = {
+ STEP_6_25_MV, STEP_12_5_MV
+};
+
+/* voltage range for s2mpg10 BUCK 1, 2, 3, 4, 5, 7, 8, 9, 10 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_buck, 1, 200000, 450000, 1300000, STEP_6_25_MV);
+
+/* voltage range for s2mpg10 BUCK 6 */
+S2MPG10_VOLTAGE_RANGE(s2mpg10_buck, 6, 200000, 450000, 1350000, STEP_6_25_MV);
+
+static const unsigned int s2mpg10_buck_ramp_table[] = {
+ STEP_6_25_MV, STEP_12_5_MV, STEP_25_MV
+};
+
+static const struct s2mpg10_regulator_desc s2mpg10_regulators_ldos[] = {
+ s2mpg10_regulator_desc_ldo_vmsk(1, "vinl3m", s2mpg10_ldo_vranges1,
+ GENMASK(6, 0)),
+ s2mpg10_regulator_desc_ldo(2, "vinl9m", s2mpg10_ldo_vranges2),
+ s2mpg10_regulator_desc_ldo_gpio(3, "vinl4m", s2mpg10_ldo_vranges3,
+ PCTRLSEL5, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_gpio(4, "vinl9m", s2mpg10_ldo_vranges2,
+ PCTRLSEL5, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_ldo_gpio(5, "vinl3m", s2mpg10_ldo_vranges3,
+ PCTRLSEL6, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_gpio(6, "vinl7m", s2mpg10_ldo_vranges3,
+ PCTRLSEL6, GENMASK(7, 4)),
+ /*
+ * Possibly GPIO controlled, but non-standard (greater) V-range and
+ * enable reg & mask.
+ */
+ s2mpg10_regulator_desc_ldo_cmn(7, "vinl3m", s2mpg10_ldo_vranges7,
+ s2mpg10_reg_ldo_ops,
+ CTRL, GENMASK(6, 0),
+ LDO_CTRL1, GENMASK(4, 3),
+ 0, 0, 0, NULL, 0,
+ S2MPG10_PMIC_PCTRLSEL7, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_gpio(8, "vinl4m", s2mpg10_ldo_vranges3,
+ PCTRLSEL7, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_ldo_gpio(9, "vinl10m", s2mpg10_ldo_vranges2,
+ PCTRLSEL8, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_gpio(10, "vinl15m", s2mpg10_ldo_vranges10,
+ PCTRLSEL8, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_ldo_ramp(11, "vinl7m", s2mpg10_ldo_vranges1,
+ GENMASK(1, 0), DVS_SYNC_CTRL3,
+ PCTRLSEL9, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_ramp(12, "vinl8m", s2mpg10_ldo_vranges1,
+ GENMASK(3, 2), DVS_SYNC_CTRL4,
+ PCTRLSEL9, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_ldo_ramp(13, "vinl1m", s2mpg10_ldo_vranges13,
+ GENMASK(5, 4), DVS_SYNC_CTRL5,
+ PCTRLSEL10, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_gpio(14, "vinl10m", s2mpg10_ldo_vranges2,
+ PCTRLSEL10, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_ldo_ramp(15, "vinl2m", s2mpg10_ldo_vranges13,
+ GENMASK(7, 6), DVS_SYNC_CTRL6,
+ PCTRLSEL11, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_gpio(16, "vinl5m", s2mpg10_ldo_vranges3,
+ PCTRLSEL11, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_ldo_gpio(17, "vinl6m", s2mpg10_ldo_vranges3,
+ PCTRLSEL12, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_gpio(18, "vinl10m", s2mpg10_ldo_vranges2,
+ PCTRLSEL12, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_ldo_gpio(19, "vinl10m", s2mpg10_ldo_vranges2,
+ PCTRLSEL13, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_ldo_gpio(20, "vinl10m", s2mpg10_ldo_vranges2,
+ PCTRLSEL13, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_ldo(21, "vinl14m", s2mpg10_ldo_vranges21),
+ s2mpg10_regulator_desc_ldo(22, "vinl15m", s2mpg10_ldo_vranges21),
+ s2mpg10_regulator_desc_ldo(23, "vinl11m", s2mpg10_ldo_vranges2),
+ s2mpg10_regulator_desc_ldo(24, "vinl7m", s2mpg10_ldo_vranges3),
+ s2mpg10_regulator_desc_ldo(25, "vinl10m", s2mpg10_ldo_vranges2),
+ s2mpg10_regulator_desc_ldo(26, "vinl15m", s2mpg10_ldo_vranges21),
+ s2mpg10_regulator_desc_ldo(27, "vinl15m", s2mpg10_ldo_vranges21),
+ s2mpg10_regulator_desc_ldo(28, "vinl7m", s2mpg10_ldo_vranges3),
+ s2mpg10_regulator_desc_ldo(29, "vinl12m", s2mpg10_ldo_vranges2),
+ s2mpg10_regulator_desc_ldo(30, "vinl13m", s2mpg10_ldo_vranges2),
+ s2mpg10_regulator_desc_ldo(31, "vinl11m", s2mpg10_ldo_vranges2)
+};
+
+static const struct s2mpg10_regulator_desc s2mpg10_regulators_bucks[] = {
+ s2mpg10_regulator_desc_buck_gpio(1, s2mpg10_buck_vranges1, DVS_RAMP1,
+ PCTRLSEL1, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_buck_gpio(2, s2mpg10_buck_vranges1, DVS_RAMP1,
+ PCTRLSEL1, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_buck_gpio(3, s2mpg10_buck_vranges1, DVS_RAMP1,
+ PCTRLSEL2, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_buck_gpio(4, s2mpg10_buck_vranges1, DVS_RAMP1,
+ PCTRLSEL2, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_buck_gpio(5, s2mpg10_buck_vranges1, DVS_RAMP2,
+ PCTRLSEL3, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_buck_gpio(6, s2mpg10_buck_vranges6, DVS_RAMP2,
+ PCTRLSEL3, GENMASK(7, 4)),
+ s2mpg10_regulator_desc_buck_gpio(7, s2mpg10_buck_vranges1, DVS_RAMP2,
+ PCTRLSEL4, GENMASK(3, 0)),
+ s2mpg10_regulator_desc_buck(8, s2mpg10_buck_vranges1, DVS_RAMP2),
+ s2mpg10_regulator_desc_buck(9, s2mpg10_buck_vranges1, DVS_RAMP3),
+ s2mpg10_regulator_desc_buck_gpio(10, s2mpg10_buck_vranges1, DVS_RAMP3,
+ PCTRLSEL4, GENMASK(7, 4))
+};
+
static const struct regulator_ops s2mps11_ldo_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
@@ -1271,6 +1774,18 @@ static int s2mps11_handle_ext_control(struct s2mps11_info *s2mps11,
ret = s2mps14_pmic_enable_ext_control(s2mps11, rdev);
break;

+ case S2MPG10:
+ /*
+ * If desc.enable_val is != 0, then external control was
+ * requested. We can not test s2mpg10_desc::ext_control,
+ * because 0 is a valid value.
+ */
+ if (!rdev->desc->enable_val)
+ return 0;
+
+ ret = s2mpg10_enable_ext_control(s2mps11, rdev);
+ break;
+
default:
return 0;
}
@@ -1286,6 +1801,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
unsigned int rdev_num;
int i, ret;
const struct regulator_desc *regulators;
+ const struct s2mpg10_regulator_desc *s2mpg10_regulators = NULL;

s2mps11 = devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info),
GFP_KERNEL);
@@ -1294,6 +1810,30 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)

s2mps11->dev_type = platform_get_device_id(pdev)->driver_data;
switch (s2mps11->dev_type) {
+ case S2MPG10:
+ /*
+ * Add 1, because our core driver subtracted 1 via
+ * devm_mfd_add_devices().
+ */
+ switch (pdev->id + 1) {
+ case S2MPG10_REGULATOR_CELL_ID_BUCKS:
+ rdev_num = ARRAY_SIZE(s2mpg10_regulators_bucks);
+ s2mpg10_regulators = s2mpg10_regulators_bucks;
+ break;
+ case S2MPG10_REGULATOR_CELL_ID_LDOS:
+ rdev_num = ARRAY_SIZE(s2mpg10_regulators_ldos);
+ s2mpg10_regulators = s2mpg10_regulators_ldos;
+ break;
+ default:
+ return -EINVAL;
+ }
+ /*
+ * Can not use ARRAY_SIZE() here, as it doesn't reflect the
+ * highest regulator id.
+ */
+ BUILD_BUG_ON((enum s2mpg10_regulators) S2MPS_REGULATOR_MAX <
+ S2MPG10_REGULATOR_MAX);
+ break;
case S2MPS11X:
rdev_num = ARRAY_SIZE(s2mps11_regulators);
regulators = s2mps11_regulators;
@@ -1339,14 +1879,28 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
config.driver_data = s2mps11;
for (i = 0; i < rdev_num; i++) {
struct regulator_dev *regulator;
+ const struct regulator_desc *rdesc = &regulators[i];
+
+ if (s2mpg10_regulators) {
+ struct s2mpg10_regulator_desc *s2mpg10_desc;
+
+
+ s2mpg10_desc = devm_kmemdup(&pdev->dev,
+ &s2mpg10_regulators[i],
+ sizeof(*s2mpg10_desc),
+ GFP_KERNEL);
+ if (!s2mpg10_desc)
+ return -ENOMEM;
+
+ rdesc = &s2mpg10_desc->desc;
+ }

regulator = devm_regulator_register(&pdev->dev,
- &regulators[i], &config);
+ rdesc, &config);
if (IS_ERR(regulator))
return dev_err_probe(&pdev->dev, PTR_ERR(regulator),
"regulator init failed for %d/%s\n",
- regulators[i].id,
- regulators[i].name);
+ rdesc->id, rdesc->name);

ret = s2mps11_handle_ext_control(s2mps11, regulator);
if (ret < 0)
@@ -1357,6 +1911,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
}

static const struct platform_device_id s2mps11_pmic_id[] = {
+ { "s2mpg10-regulator", S2MPG10},
{ "s2mps11-regulator", S2MPS11X},
{ "s2mps13-regulator", S2MPS13X},
{ "s2mps14-regulator", S2MPS14X},
diff --git a/include/linux/mfd/samsung/s2mpg10.h b/include/linux/mfd/samsung/s2mpg10.h
index 3e8bc65078472518c5e77f8bd199ee403eda18ea..f2e2c7923ad8116816ff5cae3b0c0eb98af2e42b 100644
--- a/include/linux/mfd/samsung/s2mpg10.h
+++ b/include/linux/mfd/samsung/s2mpg10.h
@@ -295,6 +295,9 @@ enum s2mpg10_pmic_reg {
S2MPG10_PMIC_LDO_SENSE4,
};

+/* rail controlled externally, based on PCTRLSELx */
+#define S2MPG10_PMIC_CTRL_ENABLE_EXT BIT(0)
+
/* Meter registers (type 0xa00) */
enum s2mpg10_meter_reg {
S2MPG10_METER_CTRL1,

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675912-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DE17441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:07:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6617B17B102
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:06:50 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3135F28C029;
Fri, 6 Jun 2025 15:03:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C53/AjF8"
Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE3EA28A707
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222207; cv=none; b=Amw2Z2aqKu8gu7RVdl2ou65GV7AdCdo1Hf1hKbctx4UAc8m99K5P2jrj6LqGvF357YQ5hbgUj3REzfjqen/Lrl3XoPxNJrqz7Nw60wOs/gM4EDl7Gd6KbpAnbVM3a1yQrF/5rL/kQOfOQRuXk7E+1Ws6TgOVZMkk4BwXjynJnW0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222207; c=relaxed/simple;
bh=qolkrs3g9m1XRitO5lnJhgwGXH80xlE9UKZOEGY5QLA=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=QxEY1OoI7a0OCRXwxuLJLjt9RAUGn8GHS7QyCSYjcDH5k2NUeBxGrQntQnVJOZLNP2h+UmUkAW7gCVrOUYES1JcJCcpPZwI18MdantY3b++axn1LyPNo49hzePEuDgdHbzSYzCtG9oH3f1chzfpkhE9kzpSFG2HmNtrSB0N4UwQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=C53/AjF8; arc=none smtp.client-ip=209.85.218.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-adb2bd27c7bso352327266b.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222203; x=1749827003; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=23HNY0T10kbJEBdypFT8EdO6lJ8vGZTGFp43/u8D8EQ=;
b=C53/AjF826WB5HRT+muLZF6Kljdh7MIkySoy4kKeqKvUZCnx1f0BKpDfm4UYFQZitB
9OZl0B8l+YA97xSWlSVEeL8JVsK/8/wUhAbvgCCx02zL3ZBdlBlxGdU1JMMI0WIhJ5OV
YFvyodgN1mDPLgNwBvZGCLyuifRV5bMSeQxaFCcs3sxuyq5fvpKLlwNIuoMPdotee1gN
SzYFOL41CXtBJ/Y3+D9xDK4VOWPiUOa3kihLWLuQeLurfNN1M0sFOEIep1rzVqoJoXP5
1pppoNcwqgeAvRBeBPnyuOJHx1/piw+y1M4cKSUNfsxrG5LtFQqhZu1RLNLJHXLQYlu0
O2bQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222203; x=1749827003;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=23HNY0T10kbJEBdypFT8EdO6lJ8vGZTGFp43/u8D8EQ=;
b=jf7zQK1t2NDhIQkFyuHq+LRDaDml69QbqHwx1Eu5k+RElfmhIt+15xh/45lBE94Uvm
AC9vPpX5KKfZrL//plxey5U64GNaBx7U0L0luIz6aV1vV9pGDY48ZplPg7usJQYoGW/M
k6gqaMuSsn1PYtx8KrZi0tI5eXzrnJV8yVRGncpizDCQlc5UpQ4LmOml77oZgLS6x/3f
4wncurmJ9CEL18Qrt9KsX5o+V8Q6CZwo8KrrGJW91kh0ZxZTVFP3LSg2FRBjKd/eWpe2
xb8WxdOG8Bmu7elPal7/UCPvVvd+4ALxvTfOIE2HqbsCJTi0Lugqj0TUzCp6hToWUgaH
PbMw==
X-Forwarded-Encrypted: i=1; AJvYcCWtQ3o8kr7MnGN/ZufwxxxeVGmVmctJUiiSqDOWuDZ6SEvRKC1cokjM+Rh5qesJngzVJA8uZCZqkeOxw8E=@vger.kernel.org
X-Gm-Message-State: AOJu0YwEWIM68RJHFUko2lF2N4sAtBGFQmxG8mXGheeukWiy1SBQRrVG
I76oLyDuZ/EPLzrm8keIkZr30nuJA/6dWUrYM26jyv5nbBPR0ocmzG1BM8QpR1GKMzM=
X-Gm-Gg: ASbGncuIuCo7MWxUzxQiwnMlpMlyWb8uKUnfHqNaFAhOYS9z7DAsw45OlzFOpI2z4aY
nXzkjorU0XLzkax5FuTDXtnddiD9LZSplx1GFzGpZICDdMel6NotxyCvHR9gDHtsJ5z9u1l//7E
R/BNOM6Ibopt97dczRoEmzTRnP/cldKlPzkI57CLsyX0ak0n1ilOQ49pKk1um0j5qB3tFQ+VoR0
is1Y+FPVnNJSECr011KmKfgG34BZ2Lk81KC8E/Bh3ty/9I8cD2IUdwRbJudXviCE9VN5UP/+/lX
8Vgcax8TTLOinqfSH/Y6/noboeEJq77C579eFGL8QUu5DzRMVJQ8DneU6/j8mJd2MLjRwoPLAEG
pHnL9HXPDe3LuyscniRdzn7G1/9OmbYhf3Ac=
X-Google-Smtp-Source: AGHT+IEyyt1ZlOm5xokwecrQZlojNukMbOCRBHPGSyCxVc6nJs9ihRs3pxSxkqbDaVo1utFTbV4JCg==
X-Received: by 2002:a17:906:c109:b0:adb:2db9:b0b0 with SMTP id a640c23a62f3a-ade1a978ddamr329710166b.35.1749222201191;
Fri, 06 Jun 2025 08:03:21 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.20
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:20 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:13 +0100
Subject: [PATCH v2 17/17] regulator: s2mps11: more descriptive gpio
consumer name
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-17-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Currently, GPIOs claimed by this driver for external rail control
all show up with "s2mps11-regulator" as consumer, which is not
very informative.

Switch to using the regulator name via desc->name instead, using the
device name as fallback.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
drivers/regulator/s2mps11.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index d46b743d4c6f5e745e101d054581a74e992fbaea..dcb813461e6d68505c21aa7deabfd03b450e1d3c 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -357,7 +357,8 @@ static int s2mps11_of_parse_gpiod(struct device_node *np,
"samsung,ext-control", 0,
GPIOD_OUT_HIGH |
GPIOD_FLAGS_BIT_NONEXCLUSIVE,
- "s2mps11-regulator");
+ desc->name
+ ? : dev_name(config->dev));
if (IS_ERR(ena_gpiod)) {
ret = PTR_ERR(ena_gpiod);


--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675913-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 42F3641E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:07:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id AFA2C189DFC6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:07:21 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EF30F28C2B2;
Fri, 6 Jun 2025 15:03:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WmguJ+CX"
Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEBE028A719
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222208; cv=none; b=YDg6YYWDY9IcwrvE0zbOm5mge5PmS755SdbDPsCvbxS29VDgKUNsN5n4XASCS+wcllwYYssb96P+RXqKFEjn+MXK1KTrVK4UDHGFh4gk9XWLWfB03utB96FjfCvuzXaAJQPtnZ+OOt3ErMS6dE9/fqD44NUzssQDQgeglZvArHI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222208; c=relaxed/simple;
bh=syZqlGzC72/t8vkCP+G/vfPzkzAsoIw8JOd/I56yBTA=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=gRBzFMtemFpIq7POtn7Sep3nSNaChBc12hk9D0EPwOt4M3qqFkTxxJWB9dhfMGoOHp0aYqj5baq5DhUWaqx0nBl6Y0zjp3bpCllBUipROC1U5fgo3PdsuI94z1v/QqA27z0Z4McvhfBJBAFYNv6ua142FtVY5pMcoToEQc8pp8k=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WmguJ+CX; arc=none smtp.client-ip=209.85.208.51
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-604f26055c6so6504659a12.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222203; x=1749827003; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=TxuFgIOh2mgMCY+EKEZtpxVIWFIGfgf2zHxoAajskPM=;
b=WmguJ+CXGspvSr+oIn/PQ1MUjeEHCGI+ZfgeETj+0o3HtZ79wQ0ePv43jv6ZqSpWJV
OEw1Cpp0mTFlwaRmTsgU5e12X1Q0RxwucNZzD1KSXlmRgPu/itakZFVh1LyYmIsnCbMm
n2W8J7aEeI/ODoMKH/A6QT8U6DRIYkIsyAllMzFpqIrvVn0nYkWliRF8M0Z9TzE6cmdM
p3Y1Q2aFS3lc4d2dpaLn4ia69Fd48Efm1YomiYI8SgRjxR1fX/7nN5x4PkiqsSyEYNwL
QIYCznsn+HyerMFYormtoz7JjwPXxd0vvI+jaVn8tCyBjOJm/QIIF3taKxxXn9/0E93K
67sQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222203; x=1749827003;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=TxuFgIOh2mgMCY+EKEZtpxVIWFIGfgf2zHxoAajskPM=;
b=vrHSCxKO0kPS+BSS2qmcS56FO0qS0g1WKJtt2m8SHTFec0hthtiDy2Eqg7VGjoqbnB
WRHnK0vyOALn3vLDENoi7c/J27DvPRQEh+qIgqsP90Da4BlnoqKCPQZ00mdjRqMjnM2N
XdfSraFg3odycuQ9rvIqVhtQkrFr5I+M/NEe0p9sv0w66CKDKdBlI22XWkS9oSKIUAu6
c8R0R7qGY8poI6XrKIHvENHo3jd+8Vhlc9SvTBCd1edf9I8wHfrgm26htKIfuGWlWtPq
bLn313jDmAOEd6eORXIk7oOayPS5JMCNjvhTphzuikmhPXpuHZu6Gfo5YGZ4D/csv69e
BVNA==
X-Forwarded-Encrypted: i=1; AJvYcCXdD5KE6e+PJFTeoBgm9a9QS8pD0GcWOc72BJ8ZgAkIOfMB7CTUCV+n874JIdGuITTi2O/pqizlO6P9G6M=@vger.kernel.org
X-Gm-Message-State: AOJu0YyhdkUQoUDsfhkLA28EFPkdToUbE9FGrRX0BzvjgmuaGL5yIsNh
KTvUe2DEvOTHZRWXhUv4H/t64L/l3EkbnAKiLoewe3V+DcO1jp5+JhkRqtn6KApbDcA=
X-Gm-Gg: ASbGncuRiXj9GErIJyHc7AjacQdeh41LtCwgeYTFPnzXt5PF7c68KGEI3yFG12iHdFH
ztSnH+foWRysiwEW/s6W2ndf8jVfOvAx/vZrHz+6FvyQ1OAGl3TzEX1w9e9RxzRo1Y0Nl0NEHQ2
z59FC3FcSqePPBn3JChq9HFviN/uTzYzDIMLYRbYLZqZXL8YppzD+64VKV1iQ8HK4aVKDNINFVG
8+GbUsR5ZzfvKqROwxDFmzeXlkexTggsB9ztYgkSyePHbMfcQESJOG04wx/+Fxtichbr5tSmAKO
XWCpKDaZUvP98efHn/vhf3t3fgJpMjWpYlczVzSOngLn8JP12DMAkEcZUdwEY9V/35K4cl8tPap
xwaXsOkqcstnrezd/Y4SqS8e6REXH59jxq2s=
X-Google-Smtp-Source: AGHT+IFQ9GdhBmsl8Wmw5y1twbzw8bstB4oQUdlQnMwH7xyg/21qXcgF4oPPHSFacZvABtKOeaLB5Q==
X-Received: by 2002:a17:906:99c2:b0:ad8:8f3b:de2d with SMTP id a640c23a62f3a-ade07606d85mr625857866b.9.1749222200718;
Fri, 06 Jun 2025 08:03:20 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.20
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:20 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:12 +0100
Subject: [PATCH v2 16/17] regulator: s2mps11: add S2MPG11 regulator
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-16-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,LOTS_OF_MONEY,
MAILING_LIST_MULTI,MONEY_NOHTML,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The S2MPG11 PMIC is a Power Management IC for mobile applications with
buck converters, various LDOs, power meters, and additional GPIO
interfaces. It typically complements an S2MPG10 PMIC in a main/sub
configuration as the sub-PMIC.

It has 12 buck, 1 buck-boost, and 15 LDO rails. Several of these can
either be controlled via software or via external signals, e.g. input
pins connected to a main processor's GPIO pins.

This commit implements support for these rails.

The rails are instantiated as separate driver instances for bucks and
LDOs, because S2MPG11 is typically used with an S2MPG10 main-PMIC where
some bucks of one typically supply at least some of the LDOs of the
other.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
v2:
- fix commit message typo
- mention GPIOs in commit message
---
drivers/regulator/s2mps11.c | 301 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 300 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 2829062c54a49a17911cd091cf0ffb7950393787..d46b743d4c6f5e745e101d054581a74e992fbaea 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -18,6 +18,7 @@
#include <linux/regulator/of_regulator.h>
#include <linux/mfd/samsung/core.h>
#include <linux/mfd/samsung/s2mpg10.h>
+#include <linux/mfd/samsung/s2mpg11.h>
#include <linux/mfd/samsung/s2mps11.h>
#include <linux/mfd/samsung/s2mps13.h>
#include <linux/mfd/samsung/s2mps14.h>
@@ -413,7 +414,7 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
struct s2mpg10_regulator_desc *s2mpg10_desc = to_s2mpg10_regulator_desc(desc);
u32 ext_control;

- if (s2mps11->dev_type != S2MPG10)
+ if (s2mps11->dev_type != S2MPG10 && s2mps11->dev_type != S2MPG11)
return 0;

if (of_property_read_u32(np, "samsung,ext-control", &ext_control))
@@ -439,6 +440,27 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
}
break;

+ case S2MPG11:
+ switch (desc->id) {
+ case S2MPG11_BUCK1 ... S2MPG11_BUCK3:
+ case S2MPG11_BUCK5:
+ case S2MPG11_BUCK8:
+ case S2MPG11_BUCK9:
+ case S2MPG11_BUCKD:
+ case S2MPG11_BUCKA:
+ case S2MPG10_LDO1:
+ case S2MPG10_LDO2:
+ case S2MPG10_LDO8:
+ case S2MPG10_LDO13:
+ if (ext_control > S2MPG11_PCTRLSEL_LDO13S_EN)
+ return -EINVAL;
+ break;
+
+ default:
+ return -EINVAL;
+ }
+ break;
+
default:
return -EINVAL;
}
@@ -476,6 +498,7 @@ static int s2mpg10_enable_ext_control(struct s2mps11_info *s2mps11,

switch (s2mps11->dev_type) {
case S2MPG10:
+ case S2MPG11:
s2mpg10_desc = to_s2mpg10_regulator_desc(rdev->desc);
break;

@@ -603,6 +626,21 @@ static int s2mpg10_regulator_buck_set_voltage_time(struct regulator_dev *rdev,
rdev->desc->ramp_mask);
}

+static int s2mpg11_regulator_buck_set_voltage_time(struct regulator_dev *rdev,
+ int old_uV, int new_uV)
+{
+ unsigned int ramp_mask;
+
+ ramp_mask = rdev->desc->ramp_mask;
+ if (old_uV > new_uV)
+ /* The downwards mask is at a different position. */
+ ramp_mask >>= 2;
+
+ return s2mpg1x_regulator_buck_set_voltage_time(rdev, old_uV, new_uV,
+ rdev->desc->ramp_reg,
+ ramp_mask);
+}
+
/*
* We assign both, ::set_voltage_time() and ::set_voltage_time_sel(), because
* only if the latter is != NULL, the regulator core will call neither during
@@ -918,6 +956,249 @@ static const struct s2mpg10_regulator_desc s2mpg10_regulators_bucks[] = {
PCTRLSEL4, GENMASK(7, 4))
};

+static const struct regulator_ops s2mpg11_reg_buck_ops[] = {
+ {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .is_enabled = regulator_is_enabled_regmap,
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time = s2mpg11_regulator_buck_set_voltage_time,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ .enable_time = s2mpg10_regulator_buck_enable_time,
+ .set_ramp_delay = regulator_set_ramp_delay_regmap,
+ }, {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time = s2mpg11_regulator_buck_set_voltage_time,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ .enable_time = s2mpg10_regulator_buck_enable_time,
+ .set_ramp_delay = regulator_set_ramp_delay_regmap,
+ }
+};
+
+#define s2mpg11_regulator_desc_ldo_cmn(_num, _supply, _vrange, \
+ _vsel_reg_sfx, _vsel_mask, _en_reg, _en_mask, \
+ _ramp_delay, _r_reg, _r_mask, _r_table, _r_table_sz, \
+ _pc_reg, _pc_mask) \
+ { \
+ .desc = regulator_desc_s2mpg1x_ldo_cmn(#_num"s", \
+ S2MPG11_LDO##_num, _supply, \
+ s2mpg10_reg_ldo_ops, \
+ _vrange, \
+ S2MPG11_PMIC_L##_num##S_##_vsel_reg_sfx, \
+ _vsel_mask, \
+ S2MPG11_PMIC_##_en_reg, _en_mask, \
+ _ramp_delay, _r_reg, _r_mask, _r_table, \
+ _r_table_sz), \
+ .pctrlsel_reg = _pc_reg, \
+ .pctrlsel_mask = _pc_mask, \
+ }
+
+
+/* standard LDO via LxM_CTRL */
+#define s2mpg11_regulator_desc_ldo(_num, _supply, _vrange) \
+ s2mpg11_regulator_desc_ldo_cmn(_num, _supply, _vrange, \
+ CTRL, GENMASK(5, 0), \
+ L##_num##S_CTRL, BIT(7), \
+ 0, 0, 0, NULL, 0, \
+ 0, 0)
+
+/* standard LDO but possibly GPIO controlled */
+#define s2mpg11_regulator_desc_ldo_gpio(_num, _supply, _vrange, \
+ _pc_reg, _pc_mask) \
+ s2mpg11_regulator_desc_ldo_cmn(_num, _supply, _vrange, \
+ CTRL, GENMASK(5, 0), \
+ L##_num##S_CTRL, GENMASK(7, 6), \
+ 0, 0, 0, NULL, 0, \
+ S2MPG11_PMIC_##_pc_reg, _pc_mask)
+
+/* LDO with ramp support and possibly GPIO controlled */
+#define s2mpg11_regulator_desc_ldo_ramp(_num, _supply, _vrange, \
+ _en_mask, _r_reg_sfx, _pc_reg, _pc_mask) \
+ s2mpg11_regulator_desc_ldo_cmn(_num, _supply, _vrange, \
+ CTRL1, GENMASK(6, 0), \
+ LDO_CTRL1, _en_mask, \
+ 6250, S2MPG11_PMIC_##_r_reg_sfx, GENMASK(1, 0), \
+ s2mpg10_ldo_ramp_table, \
+ ARRAY_SIZE(s2mpg10_ldo_ramp_table), \
+ S2MPG11_PMIC_##_pc_reg, _pc_mask)
+
+#define s2mpg11_buck_to_ramp_mask(n) (GENMASK(3, 2) << (((n) % 2) * 4))
+
+#define regulator_desc_s2mpg11_buckx(_name, _id, _supply, _vrange, \
+ _vsel_reg, _en_reg, _en_mask, _r_reg) \
+ regulator_desc_s2mpg1x_buck_cmn(_name, _id, _supply, \
+ s2mpg11_reg_buck_ops, _vrange, \
+ S2MPG11_PMIC_##_vsel_reg, GENMASK(7, 0), \
+ S2MPG11_PMIC_##_en_reg, _en_mask, \
+ S2MPG11_PMIC_##_r_reg, \
+ s2mpg11_buck_to_ramp_mask(_id - S2MPG11_BUCK1), \
+ s2mpg10_buck_ramp_table, \
+ ARRAY_SIZE(s2mpg10_buck_ramp_table), 30)
+
+#define s2mpg11_regulator_desc_buck_xm(_num, _vrange, _vsel_reg_sfx, \
+ _en_mask, _r_reg, _en_rrate) \
+ .desc = regulator_desc_s2mpg11_buckx(#_num"s", \
+ S2MPG11_BUCK##_num, "vinb"#_num"s", \
+ _vrange, \
+ B##_num##S_##_vsel_reg_sfx, \
+ B##_num##S_CTRL, _en_mask, \
+ _r_reg), \
+ .enable_ramp_rate = _en_rrate
+
+#define s2mpg11_regulator_desc_buck_cm(_num, _vrange, _vsel_reg_sfx, \
+ _en_mask, _r_reg) \
+ { \
+ s2mpg11_regulator_desc_buck_xm(_num, _vrange, \
+ _vsel_reg_sfx, _en_mask, _r_reg, 12500), \
+ }
+
+#define s2mpg11_regulator_desc_buckn_cm_gpio(_num, _vrange, \
+ _vsel_reg_sfx, _en_mask, _r_reg, _pc_reg, _pc_mask) \
+ { \
+ s2mpg11_regulator_desc_buck_xm(_num, _vrange, \
+ _vsel_reg_sfx, _en_mask, _r_reg, 12500), \
+ .pctrlsel_reg = S2MPG11_PMIC_##_pc_reg, \
+ .pctrlsel_mask = _pc_mask, \
+ }
+
+#define s2mpg11_regulator_desc_buck_vm(_num, _vrange, _vsel_reg_sfx, \
+ _en_mask, _r_reg) \
+ { \
+ s2mpg11_regulator_desc_buck_xm(_num, _vrange, \
+ _vsel_reg_sfx, _en_mask, _r_reg, 25000), \
+ }
+
+#define s2mpg11_regulator_desc_bucka(_num, _num_lower, _r_reg, \
+ _pc_reg, _pc_mask) \
+ { \
+ .desc = regulator_desc_s2mpg11_buckx(#_num_lower, \
+ S2MPG11_BUCK##_num, "vinb"#_num_lower, \
+ s2mpg11_buck_vranges##_num_lower, \
+ BUCK##_num##_OUT, \
+ BUCK##_num##_CTRL, GENMASK(7, 6), \
+ _r_reg), \
+ .enable_ramp_rate = 25000, \
+ .pctrlsel_reg = S2MPG11_PMIC_##_pc_reg, \
+ .pctrlsel_mask = _pc_mask, \
+ }
+
+#define s2mpg11_regulator_desc_buckboost() \
+ { \
+ .desc = regulator_desc_s2mpg1x_buck_cmn("boost", \
+ S2MPG11_BUCKBOOST, "vinbb", \
+ s2mpg10_reg_ldo_ops, \
+ s2mpg11_buck_vrangesboost, \
+ S2MPG11_PMIC_BB_OUT1, GENMASK(6, 0), \
+ S2MPG11_PMIC_BB_CTRL, BIT(7), \
+ 0, 0, NULL, 0, 35), \
+ .enable_ramp_rate = 17500, \
+ }
+
+/* voltage range for s2mpg11 LDO 1, 2 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 1, 300000, 450000, 950000, STEP_12_5_MV);
+
+/* voltage range for s2mpg11 LDO 3, 7, 10, 11, 12, 14, 15 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 3, 700000, 1600000, 1950000, STEP_25_MV);
+
+/* voltage range for s2mpg11 LDO 4, 6 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 4, 1800000, 2500000, 3300000, STEP_25_MV);
+
+/* voltage range for s2mpg11 LDO 5 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 5, 1600000, 1600000, 1950000, STEP_12_5_MV);
+
+/* voltage range for s2mpg11 LDO 8 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 8, 979600, 1130400, 1281200, 5800);
+
+/* voltage range for s2mpg11 LDO 9 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 9, 725000, 725000, 1300000, STEP_12_5_MV);
+
+/* voltage range for s2mpg11 LDO 13 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_ldo, 13, 1800000, 1800000, 3350000, STEP_25_MV);
+
+/* voltage range for s2mpg11 BUCK 1, 2, 3, 4, 8, 9, 10 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, 1, 200000, 450000, 1300000, STEP_6_25_MV);
+
+/* voltage range for s2mpg11 BUCK 5 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, 5, 200000, 400000, 1300000, STEP_6_25_MV);
+
+/* voltage range for s2mpg11 BUCK 6 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, 6, 200000, 1000000, 1500000, STEP_6_25_MV);
+
+/* voltage range for s2mpg11 BUCK 7 */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, 7, 600000, 1500000, 2200000, STEP_12_5_MV);
+
+/* voltage range for s2mpg11 BUCK D */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, d, 600000, 2400000, 3300000, STEP_12_5_MV);
+
+/* voltage range for s2mpg11 BUCK A */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, a, 600000, 1700000, 2100000, STEP_12_5_MV);
+
+/* voltage range for s2mpg11 BUCK BOOST */
+S2MPG10_VOLTAGE_RANGE(s2mpg11_buck, boost,
+ 2600000, 3000000, 3600000, STEP_12_5_MV);
+
+static const struct s2mpg10_regulator_desc s2mpg11_regulators_ldos[] = {
+ s2mpg11_regulator_desc_ldo_ramp(1, "vinl1s", s2mpg11_ldo_vranges1,
+ GENMASK(5, 4), DVS_SYNC_CTRL1,
+ PCTRLSEL5, GENMASK(3, 0)),
+ s2mpg11_regulator_desc_ldo_ramp(2, "vinl1s", s2mpg11_ldo_vranges1,
+ GENMASK(7, 6), DVS_SYNC_CTRL2,
+ PCTRLSEL5, GENMASK(7, 4)),
+ s2mpg11_regulator_desc_ldo(3, "vinl3s", s2mpg11_ldo_vranges3),
+ s2mpg11_regulator_desc_ldo(4, "vinl5s", s2mpg11_ldo_vranges4),
+ s2mpg11_regulator_desc_ldo(5, "vinl3s", s2mpg11_ldo_vranges5),
+ s2mpg11_regulator_desc_ldo(6, "vinl5s", s2mpg11_ldo_vranges4),
+ s2mpg11_regulator_desc_ldo(7, "vinl3s", s2mpg11_ldo_vranges3),
+ s2mpg11_regulator_desc_ldo_gpio(8, "vinl2s", s2mpg11_ldo_vranges8,
+ PCTRLSEL6, GENMASK(3, 0)),
+ s2mpg11_regulator_desc_ldo(9, "vinl2s", s2mpg11_ldo_vranges9),
+ s2mpg11_regulator_desc_ldo(10, "vinl4s", s2mpg11_ldo_vranges3),
+ s2mpg11_regulator_desc_ldo(11, "vinl4s", s2mpg11_ldo_vranges3),
+ s2mpg11_regulator_desc_ldo(12, "vinl4s", s2mpg11_ldo_vranges3),
+ s2mpg11_regulator_desc_ldo_gpio(13, "vinl6s", s2mpg11_ldo_vranges13,
+ PCTRLSEL6, GENMASK(7, 4)),
+ s2mpg11_regulator_desc_ldo(14, "vinl4s", s2mpg11_ldo_vranges3),
+ s2mpg11_regulator_desc_ldo(15, "vinl3s", s2mpg11_ldo_vranges3),
+};
+
+static const struct s2mpg10_regulator_desc s2mpg11_regulators_bucks[] = {
+ s2mpg11_regulator_desc_buckboost(),
+ s2mpg11_regulator_desc_buckn_cm_gpio(1, s2mpg11_buck_vranges1,
+ OUT1, GENMASK(7, 6), DVS_RAMP1,
+ PCTRLSEL1, GENMASK(3, 0)),
+ s2mpg11_regulator_desc_buckn_cm_gpio(2, s2mpg11_buck_vranges1,
+ OUT1, GENMASK(7, 6), DVS_RAMP1,
+ PCTRLSEL1, GENMASK(7, 4)),
+ s2mpg11_regulator_desc_buckn_cm_gpio(3, s2mpg11_buck_vranges1,
+ OUT1, GENMASK(7, 6), DVS_RAMP2,
+ PCTRLSEL2, GENMASK(3, 0)),
+ s2mpg11_regulator_desc_buck_cm(4, s2mpg11_buck_vranges1,
+ OUT, BIT(7), DVS_RAMP2),
+ s2mpg11_regulator_desc_buckn_cm_gpio(5, s2mpg11_buck_vranges5,
+ OUT, GENMASK(7, 6), DVS_RAMP3,
+ PCTRLSEL2, GENMASK(7, 4)),
+ s2mpg11_regulator_desc_buck_cm(6, s2mpg11_buck_vranges6,
+ OUT1, BIT(7), DVS_RAMP3),
+ s2mpg11_regulator_desc_buck_vm(7, s2mpg11_buck_vranges7,
+ OUT1, BIT(7), DVS_RAMP4),
+ s2mpg11_regulator_desc_buckn_cm_gpio(8, s2mpg11_buck_vranges1,
+ OUT1, GENMASK(7, 6), DVS_RAMP4,
+ PCTRLSEL3, GENMASK(3, 0)),
+ s2mpg11_regulator_desc_buckn_cm_gpio(9, s2mpg11_buck_vranges1,
+ OUT1, GENMASK(7, 6), DVS_RAMP5,
+ PCTRLSEL3, GENMASK(7, 4)),
+ s2mpg11_regulator_desc_buck_cm(10, s2mpg11_buck_vranges1,
+ OUT, BIT(7), DVS_RAMP5),
+ s2mpg11_regulator_desc_bucka(D, d, DVS_RAMP6, PCTRLSEL4, GENMASK(3, 0)),
+ s2mpg11_regulator_desc_bucka(A, a, DVS_RAMP6, PCTRLSEL4, GENMASK(7, 4)),
+};
+
static const struct regulator_ops s2mps11_ldo_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
@@ -1802,6 +2083,7 @@ static int s2mps11_handle_ext_control(struct s2mps11_info *s2mps11,
break;

case S2MPG10:
+ case S2MPG11:
/*
* If desc.enable_val is != 0, then external control was
* requested. We can not test s2mpg10_desc::ext_control,
@@ -1861,6 +2143,22 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
BUILD_BUG_ON((enum s2mpg10_regulators) S2MPS_REGULATOR_MAX <
S2MPG10_REGULATOR_MAX);
break;
+ case S2MPG11:
+ switch (pdev->id + 1) {
+ case S2MPG10_REGULATOR_CELL_ID_BUCKS:
+ rdev_num = ARRAY_SIZE(s2mpg11_regulators_bucks);
+ s2mpg10_regulators = s2mpg11_regulators_bucks;
+ break;
+ case S2MPG10_REGULATOR_CELL_ID_LDOS:
+ rdev_num = ARRAY_SIZE(s2mpg11_regulators_ldos);
+ s2mpg10_regulators = s2mpg11_regulators_ldos;
+ break;
+ default:
+ return -EINVAL;
+ }
+ BUILD_BUG_ON((enum s2mpg11_regulators) S2MPS_REGULATOR_MAX <
+ S2MPG11_REGULATOR_MAX);
+ break;
case S2MPS11X:
rdev_num = ARRAY_SIZE(s2mps11_regulators);
regulators = s2mps11_regulators;
@@ -1939,6 +2237,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)

static const struct platform_device_id s2mps11_pmic_id[] = {
{ "s2mpg10-regulator", S2MPG10},
+ { "s2mpg11-regulator", S2MPG11},
{ "s2mps11-regulator", S2MPS11X},
{ "s2mps13-regulator", S2MPS13X},
{ "s2mps14-regulator", S2MPS14X},

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675908-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9113B41E003FC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:07:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 046947AC33C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:04:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E714289376;
Fri, 6 Jun 2025 15:03:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WqDEOU26"
Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBC1428A1D7
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222205; cv=none; b=t7wUKXKZjwNlVXavxSmAR8pIJF/4RolC3D9ow6eWieMtoLA8Ol/COzERezsCekngfkZjRpzQptKzjp+WxcLbKoyfIOFByo/Ct/O2gayDjx1W08J5fdwu55eVvezpdwQoe43qGmxvVqyNbmlnPCFWC3Dp1AZ2x0bhh4gh5TsLDuU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222205; c=relaxed/simple;
bh=u0sGN7ydx4uMtzXn04toQXzwTv85evbuIZ6QE3/YgMk=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=XvfkAnbhGm6eO2OlPRw0PJOjT2Ly+uXKK99NGKXpoZPvZBb4wsDomZuG9itE3RpUNX6+w5XCj3KYk2io/qo0txn915lAcuA8gC8SY4aWWeQ+FrrQUYolXk8JCiXyal6L2JcseufrBlkgPgtXM3bsq1SrFeuogqEdQeFidtz68qY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WqDEOU26; arc=none smtp.client-ip=209.85.208.53
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-6077d0b9bbeso1121628a12.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222199; x=1749826999; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=sp17uD+Ck7qERE7Du3GZRQM5DwcLbeJ07EXw1C758vE=;
b=WqDEOU26CwmvUF/ht8QIDUXoTqvWei/tDYEOlrZbRt4Qt7NcwriSmugxnsT0xNh1G/
5uKR6v0J0fltj0qq2VXLIcp5UnqrLnebMTu8v0/Uuzxjz+Qs8GoLiP6brHjeLLdzseXI
69PkbBNc+1uhCxrqHZbBmyFtM8KK6q+oFc0p0/o6E4jHrRFDZznbWUq1jeKlbzzeVgBx
ubbBdgzFyQwbV12u9M9C6tmTxgJ050XYqrxkviBIPy7lZj/VWyIUijih5jI4IbTvAfum
NA8RhTXunxKVJko7jNeddUaS3T4dsWbCzM3tEYKws2lIdoWCJH6GCknaVzmzy+IxDpSH
X15A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222199; x=1749826999;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=sp17uD+Ck7qERE7Du3GZRQM5DwcLbeJ07EXw1C758vE=;
b=waVIC4A7VtgbbFIFv33IY6a70dMWh7TLe/YxhTTEMlve4QIBRWUrarHcPzMp2QUtU3
KA1TnHvvRgp3Nor0Lm6To5Th3rNUVICAMprl2KsGmxPCr59v/spVXTo3Nnp40KOcv8DE
MsZfTavE3Gg+iDz0Ene5QU0cHzfpXXqZmjlDIB88T0Kh78MM0ruEd9V1c1qJylkkgeiN
CK5H09JYmMTIvKTjK40ZKpNn/Gt5+LEaUV9ZGs73BllvXSvpzB9QGormQqAPL+eL2b1m
7PM1MYoNAjKIB/x3NBzNeMrNeSTXnoJMeh15n2lh+6tbNDgfFxX2Sp6eduPaMs0KXRo3
UQBg==
X-Forwarded-Encrypted: i=1; AJvYcCXOuQBoI2xDZAfZjy3PhxQ9ElA7t9KyqbFyxTd831u1n941ieCjChDgu3QhzVA/Y10AXP5tdKKQZQu9Eco=@vger.kernel.org
X-Gm-Message-State: AOJu0Yz7AevWD749kmJO0AcOjpvYMR5op35X1RUPrFMMvoCqaKD6SZN8
gD/K6iePMKA9rbgF9IW2Jd2AHmKHbEJ3qsPrbJMA0/b48RaC4FajNCcwkwhnj5TnNxs=
X-Gm-Gg: ASbGncvWgDjJallm4whhv6g/nweodrx5ALGHvx/Cq2IDMNxpjDLY1Jw8H+98V2D9yZ5
QpgVMh4/3O/IGzdhMmzrRUYiMfACc1DkxUhn+z6D3BLcg+3CYMeuQTCPC+fWORP/sg47mN41Hsy
2vz4ETEF/3MahHCfLTNtv6rR+iWmC3/Znef7Yef4XJfDmcUv4fRduJofg6qau3lMYFPPO/yBwjL
VQM7mIhAHol6sWQKRestCmlosrBiE/fTlT0lMbta4PUaMPV8pGnou2UXp5TiK3CaDZoNUhGVuyB
et6FJKMy1bfpu7HjI8C5dXA0TemoUhYn9h4KbauGyILJS95dr+b6IEW8iypp/6t0Spfwj1EfPBK
ogZHefRUq5juGZ9bo6WT8ov4wx9QM0zy5KhI06cYcGABmAg==
X-Google-Smtp-Source: AGHT+IFLMof/DV5Z1UjifZ5XRPYfS8ED3LxnpNpMroHTMjtBmz83MVE70EV7inVwrnIoSK5yhF97rg==
X-Received: by 2002:a17:907:d02:b0:ad8:9b5d:2c23 with SMTP id a640c23a62f3a-ade1aa5d45emr316376466b.10.1749222198347;
Fri, 06 Jun 2025 08:03:18 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.17
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:17 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:08 +0100
Subject: [PATCH v2 12/17] regulator: s2mps11: refactor handling of external
rail control
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-12-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Refactor s2mps14_pmic_enable_ext_control() and s2mps11_of_parse_cb()
slightly as a preparation for adding S2MPG10 and S2MPG11 support, as
both of those PMICs also support control of rails via GPIOs.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
drivers/regulator/s2mps11.c | 86 ++++++++++++++++++++++++++++++---------------
1 file changed, 57 insertions(+), 29 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index d3739526add3c966eb2979b9be2e543b5ad9d89a..ff9124c998c685d9c598570148dca074e671a99b 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -328,27 +328,13 @@ static int s2mps11_regulator_set_suspend_disable(struct regulator_dev *rdev)
rdev->desc->enable_mask, state);
}

-static int s2mps11_of_parse_cb(struct device_node *np,
- const struct regulator_desc *desc,
- struct regulator_config *config)
+static int s2mps11_of_parse_gpiod(struct device_node *np,
+ const struct regulator_desc *desc,
+ struct regulator_config *config)
{
- const struct s2mps11_info *s2mps11 = config->driver_data;
struct gpio_desc *ena_gpiod;
int ret;

- if (s2mps11->dev_type == S2MPS14X)
- switch (desc->id) {
- case S2MPS14_LDO10:
- case S2MPS14_LDO11:
- case S2MPS14_LDO12:
- break;
-
- default:
- return 0;
- }
- else
- return 0;
-
ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np),
"samsung,ext-control", 0,
GPIOD_OUT_HIGH |
@@ -380,6 +366,28 @@ static int s2mps11_of_parse_cb(struct device_node *np,
return 0;
}

+static int s2mps11_of_parse_cb(struct device_node *np,
+ const struct regulator_desc *desc,
+ struct regulator_config *config)
+{
+ const struct s2mps11_info *s2mps11 = config->driver_data;
+
+ if (s2mps11->dev_type == S2MPS14X)
+ switch (desc->id) {
+ case S2MPS14_LDO10:
+ case S2MPS14_LDO11:
+ case S2MPS14_LDO12:
+ break;
+
+ default:
+ return 0;
+ }
+ else
+ return 0;
+
+ return s2mps11_of_parse_gpiod(np, desc, config);
+}
+
static const struct regulator_ops s2mps11_ldo_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
@@ -903,10 +911,16 @@ static const struct regulator_desc s2mps15_regulators[] = {
};

static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11,
- struct regulator_dev *rdev)
+ struct regulator_dev *rdev)
{
- return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
- rdev->desc->enable_mask, S2MPS14_ENABLE_EXT_CONTROL);
+ int ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
+ rdev->desc->enable_mask,
+ S2MPS14_ENABLE_EXT_CONTROL);
+ if (ret < 0)
+ return dev_err_probe(rdev_get_dev(rdev), ret,
+ "failed to enable GPIO control over %d/%s\n",
+ rdev->desc->id, rdev->desc->name);
+ return 0;
}

static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
@@ -1244,6 +1258,26 @@ static const struct regulator_desc s2mpu05_regulators[] = {
regulator_desc_s2mpu05_buck45(5),
};

+static int s2mps11_handle_ext_control(struct s2mps11_info *s2mps11,
+ struct regulator_dev *rdev)
+{
+ int ret;
+
+ switch (s2mps11->dev_type) {
+ case S2MPS14X:
+ if (!rdev->ena_pin)
+ return 0;
+
+ ret = s2mps14_pmic_enable_ext_control(s2mps11, rdev);
+ break;
+
+ default:
+ return 0;
+ }
+
+ return ret;
+}
+
static int s2mps11_pmic_probe(struct platform_device *pdev)
{
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
@@ -1314,15 +1348,9 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
regulators[i].id,
regulators[i].name);

- if (regulator->ena_pin) {
- ret = s2mps14_pmic_enable_ext_control(s2mps11,
- regulator);
- if (ret < 0)
- return dev_err_probe(&pdev->dev, ret,
- "failed to enable GPIO control over %d/%s\n",
- regulator->desc->id,
- regulator->desc->name);
- }
+ ret = s2mps11_handle_ext_control(s2mps11, regulator);
+ if (ret < 0)
+ return ret;
}

return 0;

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675906-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CC69241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:07:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0EB717ABAFF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:04:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1455728B7EC;
Fri, 6 Jun 2025 15:03:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="k1xfH/Pw"
Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6516289E24
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222203; cv=none; b=n8LQ2nAQ5rZBYSE1IVxpxttrFhDScXMLERyWMUwRu+Aa+mcpttPoTfRjYyQ11Ju3raOk64wVht4uUYetqrEvmZRpErGIH8r1Hd6CEmcWoawVZVSRjbTKhwf98D4v5lMisDQ6njQVYWv8fZo8oQ5gRJDzMZBw1B3MsCr38iFmJqs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222203; c=relaxed/simple;
bh=+s163ydE7tiTCqnOvvriobj58/fXY+HcuDNzRx4JD7U=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=DZ4hw92bUiw/H8UR/k7fkEiZWhzde3syWeCgccKyHR8VDjjI+DDwnE0XxCQTKjW/9Qyyj8RUNttnWpJ6iYq+1kQyNFrZ/91GXjRHkq4rCr03euUEqKrbIaKoo+igkqoIDyWG6uglDZpTJnHUyFh/rHqkEhDPaWadMcpNBagv5CM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=k1xfH/Pw; arc=none smtp.client-ip=209.85.218.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-ad88d77314bso433823166b.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222198; x=1749826998; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=Mopysv96cxff2dDKJYcFZ9h4ADK2rg8yUvxp9Hcgv04=;
b=k1xfH/PwtGJxc4YPGSGyT3TeTjQ3jCuzqbyEZNREruF0EInsEwOS5mzB7IUIp3D5KX
V+V508PsKblr0mR8z7x21eWq6k2RUEsuIo7DHcPRFTIUOAJofsNve3ktfnHxNIH+ikBN
zJE4kA+BoRHKoCoQVBlM9P/cgH3Y/5saOgHvsn6y51DK54Oj/Y45pM0EtnTYqTXaHRnK
bH/pNMsxrZh0U+10b/lq6G/Ue6aANIhE4Vio0l68UGH8ZNv6vJ8nSs2LoJHjkMDoE+Tn
cgjnkoWmUf7adD/YhrjnVa69lY9pMHW6L31nx9Lvyq53TbBIqMnZBgzWETGc+kZdNpQV
Ncqw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222198; x=1749826998;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=Mopysv96cxff2dDKJYcFZ9h4ADK2rg8yUvxp9Hcgv04=;
b=aH5I9Cg9BXIPbppWUyQeidF0X4NmgGrWn6DnhwRoOePV+yLRKXQpKhAyGSvKiaRyWw
3w5NVnPNczI+LNyTD/PUgTIV+08Hr/XMIeAyeAcrwEgqcACKUqF05xCJCTiVyZFonMV5
6gch21eH2lkEa9SNKzmyggVURVc3ZUJLYSG5othxn/5e3awbYYxRqelNy0vcCJObkmh2
C25LHQjKhSwYaBHMaSg2eXFmRo30F9RsU0yzz3286pLCDFXI/SoULN/YdohvVX5TGXfg
677B0IIIeO3GybD36FGYBsZSMjkIqq6SxwnFO1yy9EvQYhzBM4GCBPG6UzJHlDJnSy/F
sTlg==
X-Forwarded-Encrypted: i=1; AJvYcCXBnbY7NCYo4pPdOTITKhOCvmC4y8OY+41dAnDFEZf+l4ttY/g7RNMScrwMPyf3WDJjh66NoYMYPqEoA8Y=@vger.kernel.org
X-Gm-Message-State: AOJu0Yy9FiWVdgaGdUymK3RAyeVWNup5JU6IWmoQ1yfSy618URg+ZKWw
4B2IhWSrNXjN8DnrBCe4htwldFEDYZsAfmr/t6d3hyWul6stmpLr3WgHwV+Coqw04V8=
X-Gm-Gg: ASbGncvrhVQh6k2OFM+rcaYkTgT5p4DRdBAg8NBN2t5sfZOucTWlGbNvGBnhgexvQ78
N5y9iqWIKX3+hkcWJ8gweD/rCt1cFZMvUWi45nq+0YLtR2DQFBNp1fbXgKvIhgmkLxR89yzPHYU
egI/VErDxxtaiBLEj61hhJtw3Ml5hQ5fmpjydb08Ocij/XxRAu2/Dyag7dvVAShOHPoxO68fb/L
00MmecScn8luId+oMJRWI4gEpVBbE7sVN9Vmw0ZKWDXfnBqH1fjDhgXdFwytWaQ9icPdsJDpI8K
0lpNu8ECjnwnlxDK+iG/BHoAZakCPyYdy80pGkw5IpD5q/8TFWCOEP3jCjRm8FvL6aSiHq/TgDv
LgHl3OO5f9d4JpxrnYsgfTbQFT8BfuQqtO0w=
X-Google-Smtp-Source: AGHT+IG11DrBLt/JxO9Ky9mLD6ChK0R8Mzea+kTNJV4+4M+mApYMHnzkDOeQR/MkQQpfirpqNf9jVw==
X-Received: by 2002:a17:907:2da0:b0:add:f191:d851 with SMTP id a640c23a62f3a-ade1a92d9a7mr329510066b.32.1749222197740;
Fri, 06 Jun 2025 08:03:17 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.17
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:17 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:07 +0100
Subject: [PATCH v2 11/17] regulator: s2mps11: update node parsing (allow
-supply properties)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-11-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

For the upcoming S2MPG10 and S2MPG11 support, we need to be able to
parse -supply properties in the PMIC's DT node.

This currently doesn't work, because the code here currently points the
regulator core at each individual regulator sub-node, and therefore the
regulator core is unable to find the -supply properties.

Update the code to simply let the regulator core handle all the parsing
by adding the ::of_match and ::regulators_node members to all existing
regulator descriptions, by adding ::of_parse_cb() to those
regulators which support the vendor-specific samsung,ext-control-gpios
to parse it (S2MPS14), and by dropping the explicit call to
of_regulator_match().

Configuring the PMIC to respect the external control GPIOs via
s2mps14_pmic_enable_ext_control() is left outside ::of_parse_cb()
because the regulator core ignores errors other than -EPROBE_DEFER from
that callback, while the code currently fails probe on register write
errors and I believe it should stay that way.

The driver can now avoid the devm_gpiod_unhinge() dance due to
simpler error handling of GPIO descriptor acquisition.

This change also has the advantage of reducing runtime memory
consumption by quite a bit as the driver doesn't need to allocate a
'struct of_regulator_match' and a 'struct gpio_desc *' for each
regulator for all PMICs as the regulator core does that. This saves
40+8 bytes on arm64 for each individual regulator on all supported
PMICs (even on non-S2MPS14 due to currently unnecessarily allocating
the extra memory unconditionally). With the upcoming S2MPG10 and
S2MPG11 support, this amounts to 1640+328 and 1120+224 bytes
respectively.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
v2:
- fix commit message typos: s2mp1 -> s2mpg1
---
drivers/regulator/s2mps11.c | 192 ++++++++++++++++++++++++--------------------
1 file changed, 105 insertions(+), 87 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 30586e9884bfb998ff07e3148813344b307506c0..d3739526add3c966eb2979b9be2e543b5ad9d89a 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -40,12 +40,6 @@ struct s2mps11_info {
* the suspend mode was enabled.
*/
DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX);
-
- /*
- * Array (size: number of regulators) with GPIO-s for external
- * sleep control.
- */
- struct gpio_desc **ext_control_gpiod;
};

static int get_ramp_delay(int ramp_delay)
@@ -244,7 +238,7 @@ static int s2mps11_regulator_enable(struct regulator_dev *rdev)
case S2MPS14X:
if (test_bit(rdev_id, s2mps11->suspend_state))
val = S2MPS14_ENABLE_SUSPEND;
- else if (s2mps11->ext_control_gpiod[rdev_id])
+ else if (rdev->ena_pin)
val = S2MPS14_ENABLE_EXT_CONTROL;
else
val = rdev->desc->enable_mask;
@@ -334,6 +328,58 @@ static int s2mps11_regulator_set_suspend_disable(struct regulator_dev *rdev)
rdev->desc->enable_mask, state);
}

+static int s2mps11_of_parse_cb(struct device_node *np,
+ const struct regulator_desc *desc,
+ struct regulator_config *config)
+{
+ const struct s2mps11_info *s2mps11 = config->driver_data;
+ struct gpio_desc *ena_gpiod;
+ int ret;
+
+ if (s2mps11->dev_type == S2MPS14X)
+ switch (desc->id) {
+ case S2MPS14_LDO10:
+ case S2MPS14_LDO11:
+ case S2MPS14_LDO12:
+ break;
+
+ default:
+ return 0;
+ }
+ else
+ return 0;
+
+ ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np),
+ "samsung,ext-control", 0,
+ GPIOD_OUT_HIGH |
+ GPIOD_FLAGS_BIT_NONEXCLUSIVE,
+ "s2mps11-regulator");
+ if (IS_ERR(ena_gpiod)) {
+ ret = PTR_ERR(ena_gpiod);
+
+ /* Ignore all errors except probe defer. */
+ if (ret == -EPROBE_DEFER)
+ return ret;
+
+ if (ret == -ENOENT)
+ dev_info(config->dev,
+ "No entry for control GPIO for %d/%s in node %pOF\n",
+ desc->id, desc->name, np);
+ else
+ dev_warn_probe(config->dev, ret,
+ "Failed to get control GPIO for %d/%s in node %pOF\n",
+ desc->id, desc->name, np);
+ return 0;
+ }
+
+ dev_info(config->dev, "Using GPIO for ext-control over %d/%s\n",
+ desc->id, desc->name);
+
+ config->ena_gpiod = ena_gpiod;
+
+ return 0;
+}
+
static const struct regulator_ops s2mps11_ldo_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
@@ -362,6 +408,8 @@ static const struct regulator_ops s2mps11_buck_ops = {
#define regulator_desc_s2mps11_ldo(num, step) { \
.name = "LDO"#num, \
.id = S2MPS11_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps11_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -378,6 +426,8 @@ static const struct regulator_ops s2mps11_buck_ops = {
#define regulator_desc_s2mps11_buck1_4(num) { \
.name = "BUCK"#num, \
.id = S2MPS11_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -395,6 +445,8 @@ static const struct regulator_ops s2mps11_buck_ops = {
#define regulator_desc_s2mps11_buck5 { \
.name = "BUCK5", \
.id = S2MPS11_BUCK5, \
+ .of_match = of_match_ptr("BUCK5"), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -412,6 +464,8 @@ static const struct regulator_ops s2mps11_buck_ops = {
#define regulator_desc_s2mps11_buck67810(num, min, step, min_sel, voltages) { \
.name = "BUCK"#num, \
.id = S2MPS11_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -429,6 +483,8 @@ static const struct regulator_ops s2mps11_buck_ops = {
#define regulator_desc_s2mps11_buck9 { \
.name = "BUCK9", \
.id = S2MPS11_BUCK9, \
+ .of_match = of_match_ptr("BUCK9"), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -502,6 +558,8 @@ static const struct regulator_ops s2mps14_reg_ops;
#define regulator_desc_s2mps13_ldo(num, min, step, min_sel) { \
.name = "LDO"#num, \
.id = S2MPS13_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -518,6 +576,8 @@ static const struct regulator_ops s2mps14_reg_ops;
#define regulator_desc_s2mps13_buck(num, min, step, min_sel) { \
.name = "BUCK"#num, \
.id = S2MPS13_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -535,6 +595,8 @@ static const struct regulator_ops s2mps14_reg_ops;
#define regulator_desc_s2mps13_buck7(num, min, step, min_sel) { \
.name = "BUCK"#num, \
.id = S2MPS13_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -552,6 +614,8 @@ static const struct regulator_ops s2mps14_reg_ops;
#define regulator_desc_s2mps13_buck8_10(num, min, step, min_sel) { \
.name = "BUCK"#num, \
.id = S2MPS13_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -634,6 +698,9 @@ static const struct regulator_ops s2mps14_reg_ops = {
#define regulator_desc_s2mps14_ldo(num, min, step) { \
.name = "LDO"#num, \
.id = S2MPS14_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
+ .of_parse_cb = s2mps11_of_parse_cb, \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -649,6 +716,9 @@ static const struct regulator_ops s2mps14_reg_ops = {
#define regulator_desc_s2mps14_buck(num, min, step, min_sel) { \
.name = "BUCK"#num, \
.id = S2MPS14_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
+ .of_parse_cb = s2mps11_of_parse_cb, \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -725,6 +795,8 @@ static const struct regulator_ops s2mps15_reg_buck_ops = {
#define regulator_desc_s2mps15_ldo(num, range) { \
.name = "LDO"#num, \
.id = S2MPS15_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps15_reg_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -740,6 +812,8 @@ static const struct regulator_ops s2mps15_reg_buck_ops = {
#define regulator_desc_s2mps15_buck(num, range) { \
.name = "BUCK"#num, \
.id = S2MPS15_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mps15_reg_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -835,60 +909,6 @@ static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11,
rdev->desc->enable_mask, S2MPS14_ENABLE_EXT_CONTROL);
}

-static void s2mps14_pmic_dt_parse_ext_control_gpio(struct platform_device *pdev,
- struct of_regulator_match *rdata, struct s2mps11_info *s2mps11)
-{
- struct gpio_desc **gpio = s2mps11->ext_control_gpiod;
- unsigned int i;
- unsigned int valid_regulators[3] = { S2MPS14_LDO10, S2MPS14_LDO11,
- S2MPS14_LDO12 };
-
- for (i = 0; i < ARRAY_SIZE(valid_regulators); i++) {
- unsigned int reg = valid_regulators[i];
-
- if (!rdata[reg].init_data || !rdata[reg].of_node)
- continue;
-
- gpio[reg] = devm_fwnode_gpiod_get(&pdev->dev,
- of_fwnode_handle(rdata[reg].of_node),
- "samsung,ext-control",
- GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
- "s2mps11-regulator");
- if (PTR_ERR(gpio[reg]) == -ENOENT)
- gpio[reg] = NULL;
- else if (IS_ERR(gpio[reg])) {
- dev_err(&pdev->dev, "Failed to get control GPIO for %d/%s\n",
- reg, rdata[reg].name);
- gpio[reg] = NULL;
- continue;
- }
- if (gpio[reg])
- dev_dbg(&pdev->dev, "Using GPIO for ext-control over %d/%s\n",
- reg, rdata[reg].name);
- }
-}
-
-static int s2mps11_pmic_dt_parse(struct platform_device *pdev,
- struct of_regulator_match *rdata, struct s2mps11_info *s2mps11,
- unsigned int rdev_num)
-{
- struct device_node *reg_np;
-
- reg_np = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
- if (!reg_np) {
- dev_err(&pdev->dev, "could not find regulators sub-node\n");
- return -EINVAL;
- }
-
- of_regulator_match(&pdev->dev, reg_np, rdata, rdev_num);
- if (s2mps11->dev_type == S2MPS14X)
- s2mps14_pmic_dt_parse_ext_control_gpio(pdev, rdata, s2mps11);
-
- of_node_put(reg_np);
-
- return 0;
-}
-
static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
{
unsigned int ramp_val, ramp_shift, ramp_reg;
@@ -946,6 +966,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_ldo1(num) { \
.name = "LDO"#num, \
.id = S2MPU02_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -961,6 +983,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_ldo2(num) { \
.name = "LDO"#num, \
.id = S2MPU02_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -976,6 +1000,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_ldo3(num) { \
.name = "LDO"#num, \
.id = S2MPU02_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -991,6 +1017,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_ldo4(num) { \
.name = "LDO"#num, \
.id = S2MPU02_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -1006,6 +1034,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_ldo5(num) { \
.name = "LDO"#num, \
.id = S2MPU02_LDO##num, \
+ .of_match = of_match_ptr("LDO"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -1022,6 +1052,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_buck1234(num) { \
.name = "BUCK"#num, \
.id = S2MPU02_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -1038,6 +1070,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_buck5(num) { \
.name = "BUCK"#num, \
.id = S2MPU02_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -1054,6 +1088,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_buck6(num) { \
.name = "BUCK"#num, \
.id = S2MPU02_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -1070,6 +1106,8 @@ static const struct regulator_ops s2mpu02_buck_ops = {
#define regulator_desc_s2mpu02_buck7(num) { \
.name = "BUCK"#num, \
.id = S2MPU02_BUCK##num, \
+ .of_match = of_match_ptr("BUCK"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -1125,6 +1163,8 @@ static const struct regulator_desc s2mpu02_regulators[] = {
#define regulator_desc_s2mpu05_ldo_reg(num, min, step, reg) { \
.name = "ldo"#num, \
.id = S2MPU05_LDO##num, \
+ .of_match = of_match_ptr("ldo"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -1156,6 +1196,8 @@ static const struct regulator_desc s2mpu02_regulators[] = {
#define regulator_desc_s2mpu05_buck(num, which) { \
.name = "buck"#num, \
.id = S2MPU05_BUCK##num, \
+ .of_match = of_match_ptr("buck"#num), \
+ .regulators_node = of_match_ptr("regulators"), \
.ops = &s2mpu02_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
@@ -1254,22 +1296,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
s2mps11->dev_type);
}

- s2mps11->ext_control_gpiod = devm_kcalloc(&pdev->dev, rdev_num,
- sizeof(*s2mps11->ext_control_gpiod), GFP_KERNEL);
- if (!s2mps11->ext_control_gpiod)
- return -ENOMEM;
-
- struct of_regulator_match *rdata __free(kfree) =
- kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL);
- if (!rdata)
- return -ENOMEM;
-
- for (i = 0; i < rdev_num; i++)
- rdata[i].name = regulators[i].name;
-
- ret = s2mps11_pmic_dt_parse(pdev, rdata, s2mps11, rdev_num);
- if (ret)
- return ret;
+ device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);

platform_set_drvdata(pdev, s2mps11);

@@ -1279,15 +1306,6 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
for (i = 0; i < rdev_num; i++) {
struct regulator_dev *regulator;

- config.init_data = rdata[i].init_data;
- config.of_node = rdata[i].of_node;
- config.ena_gpiod = s2mps11->ext_control_gpiod[i];
- /*
- * Hand the GPIO descriptor management over to the regulator
- * core, remove it from devres management.
- */
- if (config.ena_gpiod)
- devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod);
regulator = devm_regulator_register(&pdev->dev,
&regulators[i], &config);
if (IS_ERR(regulator))
@@ -1296,7 +1314,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
regulators[i].id,
regulators[i].name);

- if (config.ena_gpiod) {
+ if (regulator->ena_pin) {
ret = s2mps14_pmic_enable_ext_control(s2mps11,
regulator);
if (ret < 0)

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675910-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4F92341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:07:16 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 512DD17100F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:07:02 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7969B28C035;
Fri, 6 Jun 2025 15:03:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gBh2AG6o"
Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED26928A1DA
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222207; cv=none; b=S+DEe67K1UME18GVVRX/HQfgVpd6p0lRyrMM4PpO1pAPoXZjcmy4vU9vviPxF5MtZr4Jx1BPHvDX3e3UuhfeIh8WlL6pjwfwvb6Hmn/F27EPAFWJFrkP9XVhAteOa0PnfOcLfJ7gKZo31eNL0kCREZdzNh2ca4kVeDOED4zIwD4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222207; c=relaxed/simple;
bh=0XeO/VDfzUTHfzf5Yl9P2pVMGyD2yiAGeuFLsceTU7g=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=PmVhTGUJviiFmy7OACyWMBa0EiAqh4JZ2gvpIVtp44mFdmgUte252JOaOrmb7Jg1+CXHUxti4vs7DCD4KjkuOO+gOdIA7+qxl+vgwV0m0WdC71rURMy1P6vQ8vzKjTVN/G0zZ/+ypOOKP/yw86X/EIxiDQTxP5zqyWPYWm+CW1M=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=gBh2AG6o; arc=none smtp.client-ip=209.85.208.53
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-604bff84741so4353741a12.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222199; x=1749826999; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=0DZ2jUshUhkWuf/SX8itqq14+wTZkkxgmmRHp73m8Y0=;
b=gBh2AG6owVgX7M1YOyl5gKYXhWrliqhimnxAMsYaNcay5fZrkItvpfrUKv7YBQJH2k
AHyEhjouc0DmL6CcN948QfPe5W4if7Dr2KtWmPHrsKju8c9PHJAKPiAgkGBPaoeqn+Oe
NBLCtSkPFyI/xU+kRF2Nt096a8JWuppmNloTsyLSEKGDxFQ4RA6uEu3LwQ1g4Yjq5qLV
cosxgRput7Cv5Xvv+eExV7Q/rDH1fB/LdDuzO3A4djB6qcihykx2u3r8hgQoCD+ryXXW
v2QJ0sMsx7A99jiqSg4SXXaD0PedFqXk8/3VxtsKQk0SGwQyHYmMAxKs51X2RbRX+Cjq
bKcQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222199; x=1749826999;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=0DZ2jUshUhkWuf/SX8itqq14+wTZkkxgmmRHp73m8Y0=;
b=FJpOtkr8YBJyD6e1sVfEBQs+ohagBHC7Sftg08RCl5XkS7pxtfBoOXb/lDOyTYw/aF
7Hztsohn7xsFZ9Lj5Wd2UeALSmjYkW7tETRf4KQkqtNzynV4LUsLiUtA9BvxbI5sUGW7
z+owX4mpspCo1V0P3bmEkiSpKJlXrLylB1zBwWhpnbQzk58OYFqTrUp0NFdbIn/zhs/e
i7WC8R7yugwQVIrYOvbFv/TeTwT5oXmu3emUj6Qz8jQNLXGX3SgwF4mfiAqIOzYj/SVa
Fuhnyr+C1JEAOrnGnxWUBzghKAT7X/22cXCvXZ7CINVaZwz3L1q3lVrR2sqh/VERf19C
L75Q==
X-Forwarded-Encrypted: i=1; AJvYcCVkMMJdiYWCwD8qA+SQeNMLFHL3xNmjrS81D+aQl4GeHcx+yYJxisPEA53HEecpDDrTtgyn9kt7b+KeUeA=@vger.kernel.org
X-Gm-Message-State: AOJu0YzTC7nTquYzOXCnR562W+nra6/RaWYQOGA4VPxTL38NkQpkG0kF
LeHOcesS7nAUu9Jw2nS5AxksETjkLCS615FLy25PxosBallTkmXWpi8RzrRJ8fo0TdA=
X-Gm-Gg: ASbGncsR9ejzYGckhWpLEMBBOAq4qqEX5cefu+HxXmC2cim6ySnQBoyf3K7XHPHqTvK
nUt2bGp6AvmyNw1Gwa5MetJikcOU1nJEheuY/ZLLWjR/8+RNPogtFj7yARCJQTFnoWwYehiY6jI
GuW85pZYndgTbIfTnlgCMsf35lhPMgePo8anzFV9fnJDQp2y4GAU831Oq7BnED0TlPzV7CcrQeP
xZCTL8s7w5CanlfxgVsBQTOJ4Jc/fhxptumCIIv0OznM+VO7M6GZH2GQBMV6kj/kviZzyO84Qv1
Ds4I5D4milCzf7QujHltMO7hIdlf3gx/DyHo2IxZQdQwkWCL55RyAI/hMyVuZAPkDxwXTPzOVWz
bK+ZddjoX3RvVJX/qaEf7wj2YyjSsYNWuG9m4JcpFnzb/sA==
X-Google-Smtp-Source: AGHT+IG7V3GvfxWs1GjQKVXwu5Fh4R/fGDoN3f6EH+nQSGOzoBvLc/RHMQDe6c+2rsKteTCM0QYU9w==
X-Received: by 2002:a17:907:3c8d:b0:ad8:adbc:bbf6 with SMTP id a640c23a62f3a-ade1ab32c07mr353204066b.58.1749222195899;
Fri, 06 Jun 2025 08:03:15 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.15
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:15 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:04 +0100
Subject: [PATCH v2 08/17] mfd: sec: Add support for S2MPG11 PMIC via ACPM
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-8-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add support for Samsung's S2MPG11 PMIC, which is a Power Management IC
for mobile applications with buck converters, various LDOs, power
meters, and additional GPIO interfaces. It typically complements an
S2MPG10 PMIC in a main/sub configuration as the sub-PMIC.

Like S2MPG10, communication is not via I2C, but via the Samsung ACPM
firmware.

Note: The firmware uses the ACPM channel ID and the Speedy channel ID
to select the PMIC address. Since these are firmware properties, they
can not be retrieved from DT, but instead are deducted from the
compatible for now.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>

---
Note: checkpatch suggests to update MAINTAINERS, but the new file is
covered already due to using a wildcard.

v2:
- mention GPIOs in commit message
---
drivers/mfd/sec-acpm.c | 213 +++++++++++++++++-
drivers/mfd/sec-common.c | 18 +-
drivers/mfd/sec-irq.c | 67 +++++-
include/linux/mfd/samsung/core.h | 1 +
include/linux/mfd/samsung/irq.h | 99 +++++++++
include/linux/mfd/samsung/s2mpg11.h | 420 ++++++++++++++++++++++++++++++++++++
6 files changed, 807 insertions(+), 11 deletions(-)

diff --git a/drivers/mfd/sec-acpm.c b/drivers/mfd/sec-acpm.c
index 8b31c816d65b86c54a108fa994384abfac0e7da4..b44af6f8b1cdfcb75cf9d4c55c9d973a88fd510c 100644
--- a/drivers/mfd/sec-acpm.c
+++ b/drivers/mfd/sec-acpm.c
@@ -13,6 +13,7 @@
#include <linux/mfd/samsung/core.h>
#include <linux/mfd/samsung/rtc.h>
#include <linux/mfd/samsung/s2mpg10.h>
+#include <linux/mfd/samsung/s2mpg11.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -216,6 +217,155 @@ static const struct regmap_config s2mpg10_regmap_config_meter = {
.cache_type = REGCACHE_FLAT,
};

+static const struct regmap_range s2mpg11_common_registers[] = {
+ regmap_reg_range(0x00, 0x02), /* CHIP_ID_S, INT, INT_MASK */
+ regmap_reg_range(0x0a, 0x0c), /* Speedy control */
+ regmap_reg_range(0x1a, 0x27), /* Debug */
+};
+
+static const struct regmap_range s2mpg11_common_ro_registers[] = {
+ regmap_reg_range(0x00, 0x01), /* CHIP_ID_S, INT */
+ regmap_reg_range(0x25, 0x27), /* Debug */
+};
+
+static const struct regmap_range s2mpg11_common_nonvolatile_registers[] = {
+ regmap_reg_range(0x00, 0x00), /* CHIP_ID_S */
+ regmap_reg_range(0x02, 0x02), /* INT_MASK */
+ regmap_reg_range(0x0a, 0x0c), /* Speedy control */
+};
+
+static const struct regmap_range s2mpg11_common_precious_registers[] = {
+ regmap_reg_range(0x01, 0x01), /* INT */
+};
+
+static const struct regmap_access_table s2mpg11_common_wr_table = {
+ .yes_ranges = s2mpg11_common_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_common_registers),
+ .no_ranges = s2mpg11_common_ro_registers,
+ .n_no_ranges = ARRAY_SIZE(s2mpg11_common_ro_registers),
+};
+
+static const struct regmap_access_table s2mpg11_common_rd_table = {
+ .yes_ranges = s2mpg11_common_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_common_registers),
+};
+
+static const struct regmap_access_table s2mpg11_common_volatile_table = {
+ .no_ranges = s2mpg11_common_nonvolatile_registers,
+ .n_no_ranges = ARRAY_SIZE(s2mpg11_common_nonvolatile_registers),
+};
+
+static const struct regmap_access_table s2mpg11_common_precious_table = {
+ .yes_ranges = s2mpg11_common_precious_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_common_precious_registers),
+};
+
+static const struct regmap_config s2mpg11_regmap_config_common = {
+ .name = "common",
+ .reg_bits = ACPM_ADDR_BITS,
+ .val_bits = 8,
+ .max_register = S2MPG11_COMMON_SPD_DEBUG4,
+ .wr_table = &s2mpg11_common_wr_table,
+ .rd_table = &s2mpg11_common_rd_table,
+ .volatile_table = &s2mpg11_common_volatile_table,
+ .precious_table = &s2mpg11_common_precious_table,
+ .num_reg_defaults_raw = S2MPG11_COMMON_SPD_DEBUG4 + 1,
+ .cache_type = REGCACHE_FLAT,
+};
+
+static const struct regmap_range s2mpg11_pmic_registers[] = {
+ regmap_reg_range(0x00, 0x5a), /* All PMIC registers */
+ regmap_reg_range(0x5c, 0xb7), /* All PMIC registers */
+};
+
+static const struct regmap_range s2mpg11_pmic_ro_registers[] = {
+ regmap_reg_range(0x00, 0x05), /* INTx */
+ regmap_reg_range(0x0c, 0x0d), /* STATUS OFFSRC */
+ regmap_reg_range(0x98, 0x98), /* GPIO input */
+};
+
+static const struct regmap_range s2mpg11_pmic_nonvolatile_registers[] = {
+ regmap_reg_range(0x06, 0x0b), /* INTxM */
+};
+
+static const struct regmap_range s2mpg11_pmic_precious_registers[] = {
+ regmap_reg_range(0x00, 0x05), /* INTx */
+};
+
+static const struct regmap_access_table s2mpg11_pmic_wr_table = {
+ .yes_ranges = s2mpg11_pmic_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_pmic_registers),
+ .no_ranges = s2mpg11_pmic_ro_registers,
+ .n_no_ranges = ARRAY_SIZE(s2mpg11_pmic_ro_registers),
+};
+
+static const struct regmap_access_table s2mpg11_pmic_rd_table = {
+ .yes_ranges = s2mpg11_pmic_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_pmic_registers),
+};
+
+static const struct regmap_access_table s2mpg11_pmic_volatile_table = {
+ .no_ranges = s2mpg11_pmic_nonvolatile_registers,
+ .n_no_ranges = ARRAY_SIZE(s2mpg11_pmic_nonvolatile_registers),
+};
+
+static const struct regmap_access_table s2mpg11_pmic_precious_table = {
+ .yes_ranges = s2mpg11_pmic_precious_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_pmic_precious_registers),
+};
+
+static const struct regmap_config s2mpg11_regmap_config_pmic = {
+ .name = "pmic",
+ .reg_bits = ACPM_ADDR_BITS,
+ .val_bits = 8,
+ .max_register = S2MPG11_PMIC_LDO_SENSE2,
+ .wr_table = &s2mpg11_pmic_wr_table,
+ .rd_table = &s2mpg11_pmic_rd_table,
+ .volatile_table = &s2mpg11_pmic_volatile_table,
+ .precious_table = &s2mpg11_pmic_precious_table,
+ .num_reg_defaults_raw = S2MPG11_PMIC_LDO_SENSE2 + 1,
+ .cache_type = REGCACHE_FLAT,
+};
+
+static const struct regmap_range s2mpg11_meter_registers[] = {
+ regmap_reg_range(0x00, 0x3e), /* Meter config */
+ regmap_reg_range(0x40, 0x8a), /* Meter data */
+ regmap_reg_range(0x8d, 0x9c), /* Meter data */
+};
+
+static const struct regmap_range s2mpg11_meter_ro_registers[] = {
+ regmap_reg_range(0x40, 0x9c), /* Meter data */
+};
+
+static const struct regmap_access_table s2mpg11_meter_wr_table = {
+ .yes_ranges = s2mpg11_meter_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_meter_registers),
+ .no_ranges = s2mpg11_meter_ro_registers,
+ .n_no_ranges = ARRAY_SIZE(s2mpg11_meter_ro_registers),
+};
+
+static const struct regmap_access_table s2mpg11_meter_rd_table = {
+ .yes_ranges = s2mpg11_meter_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_meter_registers),
+};
+
+static const struct regmap_access_table s2mpg11_meter_volatile_table = {
+ .yes_ranges = s2mpg11_meter_ro_registers,
+ .n_yes_ranges = ARRAY_SIZE(s2mpg11_meter_ro_registers),
+};
+
+static const struct regmap_config s2mpg11_regmap_config_meter = {
+ .name = "meter",
+ .reg_bits = ACPM_ADDR_BITS,
+ .val_bits = 8,
+ .max_register = S2MPG11_METER_LPF_DATA_NTC7_2,
+ .wr_table = &s2mpg11_meter_wr_table,
+ .rd_table = &s2mpg11_meter_rd_table,
+ .volatile_table = &s2mpg11_meter_volatile_table,
+ .num_reg_defaults_raw = S2MPG11_METER_LPF_DATA_NTC7_2 + 1,
+ .cache_type = REGCACHE_FLAT,
+};
+
struct sec_pmic_acpm_shared_bus_context {
const struct acpm_handle *acpm;
unsigned int acpm_chan_id;
@@ -325,16 +475,22 @@ static struct regmap *sec_pmic_acpm_regmap_init(struct device *dev,
return regmap;
}

-static void sec_pmic_acpm_mask_common_irqs(void *regmap_common)
+static void sec_pmic_acpm_mask_common_s2mpg10_irqs(void *regmap_common)
{
regmap_write(regmap_common, S2MPG10_COMMON_INT_MASK, S2MPG10_COMMON_INT_SRC);
}

+static void sec_pmic_acpm_mask_common_s2mpg11_irqs(void *regmap_common)
+{
+ regmap_write(regmap_common, S2MPG11_COMMON_INT_MASK, S2MPG11_COMMON_INT_SRC);
+}
+
static int sec_pmic_acpm_probe(struct platform_device *pdev)
{
struct regmap *regmap_common, *regmap_pmic, *regmap;
const struct sec_pmic_acpm_platform_data *pdata;
struct sec_pmic_acpm_shared_bus_context *shared_ctx;
+ void (*masq_irqs_handler)(void *data);
const struct acpm_handle *acpm;
struct device *dev = &pdev->dev;
int ret, irq;
@@ -365,7 +521,19 @@ static int sec_pmic_acpm_probe(struct platform_device *pdev)
return PTR_ERR(regmap_common);

/* Mask all interrupts from 'common' block, until successful init */
- ret = regmap_write(regmap_common, S2MPG10_COMMON_INT_MASK, S2MPG10_COMMON_INT_SRC);
+ switch (pdata->device_type) {
+ case S2MPG10:
+ ret = regmap_write(regmap_common, S2MPG10_COMMON_INT_MASK, S2MPG10_COMMON_INT_SRC);
+ break;
+
+ case S2MPG11:
+ ret = regmap_write(regmap_common, S2MPG11_COMMON_INT_MASK, S2MPG11_COMMON_INT_SRC);
+ break;
+
+ default:
+ return dev_err_probe(dev, -EINVAL, "Unsupported device type %d\n",
+ pdata->device_type);
+ }
if (ret)
return dev_err_probe(dev, ret, "failed to mask common block interrupts\n");

@@ -374,10 +542,12 @@ static int sec_pmic_acpm_probe(struct platform_device *pdev)
if (IS_ERR(regmap_pmic))
return PTR_ERR(regmap_pmic);

- regmap = sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCESSTYPE_RTC,
- pdata->regmap_cfg_rtc, true);
- if (IS_ERR(regmap))
- return PTR_ERR(regmap);
+ if (pdata->regmap_cfg_rtc) {
+ regmap = sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCESSTYPE_RTC,
+ pdata->regmap_cfg_rtc, true);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+ }

regmap = sec_pmic_acpm_regmap_init(dev, shared_ctx, SEC_PMIC_ACPM_ACCESSTYPE_METER,
pdata->regmap_cfg_meter, true);
@@ -392,13 +562,28 @@ static int sec_pmic_acpm_probe(struct platform_device *pdev)
devm_device_init_wakeup(dev);

/* Unmask PMIC interrupt from 'common' block, now that everything is in place. */
- ret = regmap_clear_bits(regmap_common, S2MPG10_COMMON_INT_MASK,
- S2MPG10_COMMON_INT_SRC_PMIC);
+ switch (pdata->device_type) {
+ case S2MPG10:
+ ret = regmap_clear_bits(regmap_common, S2MPG10_COMMON_INT_MASK,
+ S2MPG10_COMMON_INT_SRC_PMIC);
+ masq_irqs_handler = sec_pmic_acpm_mask_common_s2mpg10_irqs;
+ break;
+
+ case S2MPG11:
+ ret = regmap_clear_bits(regmap_common, S2MPG11_COMMON_INT_MASK,
+ S2MPG11_COMMON_INT_SRC_PMIC);
+ masq_irqs_handler = sec_pmic_acpm_mask_common_s2mpg11_irqs;
+ break;
+
+ default:
+ return dev_err_probe(dev, -EINVAL, "Unsupported device type %d\n",
+ pdata->device_type);
+ }
if (ret)
return dev_err_probe(dev, ret, "failed to unmask PMIC interrupt\n");

/* Mask all interrupts from 'common' block on shutdown */
- ret = devm_add_action_or_reset(dev, sec_pmic_acpm_mask_common_irqs, regmap_common);
+ ret = devm_add_action_or_reset(dev, masq_irqs_handler, regmap_common);
if (ret)
return ret;

@@ -420,8 +605,18 @@ static const struct sec_pmic_acpm_platform_data s2mpg10_data = {
.regmap_cfg_meter = &s2mpg10_regmap_config_meter,
};

+static const struct sec_pmic_acpm_platform_data s2mpg11_data = {
+ .device_type = S2MPG11,
+ .acpm_chan_id = 2,
+ .speedy_channel = 1,
+ .regmap_cfg_common = &s2mpg11_regmap_config_common,
+ .regmap_cfg_pmic = &s2mpg11_regmap_config_pmic,
+ .regmap_cfg_meter = &s2mpg11_regmap_config_meter,
+};
+
static const struct of_device_id sec_pmic_acpm_of_match[] = {
{ .compatible = "samsung,s2mpg10-pmic", .data = &s2mpg10_data, },
+ { .compatible = "samsung,s2mpg11-pmic", .data = &s2mpg11_data, },
{ },
};
MODULE_DEVICE_TABLE(of, sec_pmic_acpm_of_match);
diff --git a/drivers/mfd/sec-common.c b/drivers/mfd/sec-common.c
index 8a1694c6ed8708397a51ebd4a49c22387d7e3495..497dcbb907c4e94db3be43c498f70996d72f13f6 100644
--- a/drivers/mfd/sec-common.c
+++ b/drivers/mfd/sec-common.c
@@ -43,6 +43,13 @@ static const struct mfd_cell s2mpg10_devs[] = {
MFD_CELL_OF("s2mpg10-gpio", NULL, NULL, 0, 0, "samsung,s2mpg10-gpio"),
};

+static const struct mfd_cell s2mpg11_devs[] = {
+ MFD_CELL_NAME("s2mpg11-meter"),
+ MFD_CELL_BASIC("s2mpg11-regulator", NULL, NULL, 0, S2MPG10_REGULATOR_CELL_ID_BUCKS),
+ MFD_CELL_BASIC("s2mpg11-regulator", NULL, NULL, 0, S2MPG10_REGULATOR_CELL_ID_LDOS),
+ MFD_CELL_OF("s2mpg11-gpio", NULL, NULL, 0, 0, "samsung,s2mpg11-gpio"),
+};
+
static const struct mfd_cell s2mps11_devs[] = {
MFD_CELL_NAME("s2mps11-regulator"),
MFD_CELL_NAME("s2mps14-rtc"),
@@ -86,8 +93,13 @@ static void sec_pmic_dump_rev(struct sec_pmic_dev *sec_pmic)
unsigned int val;

/* For s2mpg1x, the revision is in a different regmap */
- if (sec_pmic->device_type == S2MPG10)
+ switch (sec_pmic->device_type) {
+ case S2MPG10:
+ case S2MPG11:
return;
+ default:
+ break;
+ }

/* For each device type, the REG_ID is always the first register */
if (!regmap_read(sec_pmic->regmap_pmic, S2MPS11_REG_ID, &val))
@@ -192,6 +204,10 @@ int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq,
sec_devs = s2mpg10_devs;
num_sec_devs = ARRAY_SIZE(s2mpg10_devs);
break;
+ case S2MPG11:
+ sec_devs = s2mpg11_devs;
+ num_sec_devs = ARRAY_SIZE(s2mpg11_devs);
+ break;
case S2MPS11X:
sec_devs = s2mps11_devs;
num_sec_devs = ARRAY_SIZE(s2mps11_devs);
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index c5c80b1ba104e6c5a55b442d2f10a8554201a961..a04e46144baae6a195a84df56c53e399e3875e3d 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -11,6 +11,7 @@
#include <linux/mfd/samsung/core.h>
#include <linux/mfd/samsung/irq.h>
#include <linux/mfd/samsung/s2mpg10.h>
+#include <linux/mfd/samsung/s2mpg11.h>
#include <linux/mfd/samsung/s2mps11.h>
#include <linux/mfd/samsung/s2mps14.h>
#include <linux/mfd/samsung/s2mpu02.h>
@@ -73,6 +74,58 @@ static const struct regmap_irq s2mpg10_irqs[] = {
REGMAP_IRQ_REG(S2MPG10_IRQ_PWR_WARN_CH7, 5, S2MPG10_IRQ_PWR_WARN_CH7_MASK),
};

+static const struct regmap_irq s2mpg11_irqs[] = {
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWRONF, 0, S2MPG11_IRQ_PWRONF_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWRONR, 0, S2MPG11_IRQ_PWRONR_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PIF_TIMEOUT_MIF, 0, S2MPG11_IRQ_PIF_TIMEOUT_MIF_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PIF_TIMEOUTS, 0, S2MPG11_IRQ_PIF_TIMEOUTS_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_WTSR, 0, S2MPG11_IRQ_WTSR_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_ABNORMAL_STOP, 0, S2MPG11_IRQ_SPD_ABNORMAL_STOP_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_PARITY_ERR, 0, S2MPG11_IRQ_SPD_PARITY_ERR_MASK),
+
+ REGMAP_IRQ_REG(S2MPG11_IRQ_140C, 1, S2MPG11_IRQ_INT140C_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_120C, 1, S2MPG11_IRQ_INT120C_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_TSD, 1, S2MPG11_IRQ_TSD_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_WRST, 1, S2MPG11_IRQ_WRST_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_CYCLE_DONE, 1, S2MPG11_IRQ_NTC_CYCLE_DONE_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PMETER_OVERF, 1, S2MPG11_IRQ_PMETER_OVERF_MASK),
+
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B1S, 2, S2MPG11_IRQ_OCP_B1S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B2S, 2, S2MPG11_IRQ_OCP_B2S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B3S, 2, S2MPG11_IRQ_OCP_B3S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B4S, 2, S2MPG11_IRQ_OCP_B4S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B5S, 2, S2MPG11_IRQ_OCP_B5S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B6S, 2, S2MPG11_IRQ_OCP_B6S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B7S, 2, S2MPG11_IRQ_OCP_B7S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B8S, 2, S2MPG11_IRQ_OCP_B8S_MASK),
+
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B9S, 3, S2MPG11_IRQ_OCP_B9S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_B10S, 3, S2MPG11_IRQ_OCP_B10S_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BDS, 3, S2MPG11_IRQ_OCP_BDS_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BAS, 3, S2MPG11_IRQ_OCP_BAS_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_OCP_BBS, 3, S2MPG11_IRQ_OCP_BBS_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_WLWP_ACC, 3, S2MPG11_IRQ_WLWP_ACC_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_SPD_SRP_PKT_RST, 3, S2MPG11_IRQ_SPD_SRP_PKT_RST_MASK),
+
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH0, 4, S2MPG11_IRQ_PWR_WARN_CH0_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH1, 4, S2MPG11_IRQ_PWR_WARN_CH1_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH2, 4, S2MPG11_IRQ_PWR_WARN_CH2_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH3, 4, S2MPG11_IRQ_PWR_WARN_CH3_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH4, 4, S2MPG11_IRQ_PWR_WARN_CH4_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH5, 4, S2MPG11_IRQ_PWR_WARN_CH5_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH6, 4, S2MPG11_IRQ_PWR_WARN_CH6_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_PWR_WARN_CH7, 4, S2MPG11_IRQ_PWR_WARN_CH7_MASK),
+
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH0, 5, S2MPG11_IRQ_NTC_WARN_CH0_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH1, 5, S2MPG11_IRQ_NTC_WARN_CH1_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH2, 5, S2MPG11_IRQ_NTC_WARN_CH2_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH3, 5, S2MPG11_IRQ_NTC_WARN_CH3_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH4, 5, S2MPG11_IRQ_NTC_WARN_CH4_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH5, 5, S2MPG11_IRQ_NTC_WARN_CH5_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH6, 5, S2MPG11_IRQ_NTC_WARN_CH6_MASK),
+ REGMAP_IRQ_REG(S2MPG11_IRQ_NTC_WARN_CH7, 5, S2MPG11_IRQ_NTC_WARN_CH7_MASK),
+};
+
static const struct regmap_irq s2mps11_irqs[] = {
REGMAP_IRQ_REG(S2MPS11_IRQ_PWRONF, 0, S2MPS11_IRQ_PWRONF_MASK),
REGMAP_IRQ_REG(S2MPS11_IRQ_PWRONR, 0, S2MPS11_IRQ_PWRONR_MASK),
@@ -180,7 +233,7 @@ static const struct regmap_irq s5m8767_irqs[] = {
REGMAP_IRQ_REG(S5M8767_IRQ_WTSR, 2, S5M8767_IRQ_WTSR_MASK),
};

-/* All S2MPG10 interrupt sources are read-only and don't require clearing */
+/* All S2MPG1x interrupt sources are read-only and don't require clearing */
static const struct regmap_irq_chip s2mpg10_irq_chip = {
.name = "s2mpg10",
.irqs = s2mpg10_irqs,
@@ -190,6 +243,15 @@ static const struct regmap_irq_chip s2mpg10_irq_chip = {
.mask_base = S2MPG10_PMIC_INT1M,
};

+static const struct regmap_irq_chip s2mpg11_irq_chip = {
+ .name = "s2mpg11",
+ .irqs = s2mpg11_irqs,
+ .num_irqs = ARRAY_SIZE(s2mpg11_irqs),
+ .num_regs = 6,
+ .status_base = S2MPG11_PMIC_INT1,
+ .mask_base = S2MPG11_PMIC_INT1M,
+};
+
static const struct regmap_irq_chip s2mps11_irq_chip = {
.name = "s2mps11",
.irqs = s2mps11_irqs,
@@ -270,6 +332,9 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
case S2MPG10:
sec_irq_chip = &s2mpg10_irq_chip;
break;
+ case S2MPG11:
+ sec_irq_chip = &s2mpg11_irq_chip;
+ break;
case S2MPS11X:
sec_irq_chip = &s2mps11_irq_chip;
break;
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index d785e101fe795a5d8f9cccf4ccc4232437e89416..f5fba117bea61b3e3fb308759dc2748f6dd01dfb 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -40,6 +40,7 @@ enum sec_device_type {
S2DOS05,
S2MPA01,
S2MPG10,
+ S2MPG11,
S2MPS11X,
S2MPS13X,
S2MPS14X,
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index b4805cbd949bd605004bd88cf361109d1cbbc3bf..08b1ab33bad48194491fef88d48d5d0027e06a7c 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -160,6 +160,105 @@ enum s2mpg10_irq {
S2MPG10_IRQ_NR,
};

+enum s2mpg11_irq {
+ /* PMIC */
+ S2MPG11_IRQ_PWRONF,
+ S2MPG11_IRQ_PWRONR,
+ S2MPG11_IRQ_PIF_TIMEOUT_MIF,
+ S2MPG11_IRQ_PIF_TIMEOUTS,
+ S2MPG11_IRQ_WTSR,
+ S2MPG11_IRQ_SPD_ABNORMAL_STOP,
+ S2MPG11_IRQ_SPD_PARITY_ERR,
+#define S2MPG11_IRQ_PWRONF_MASK BIT(0)
+#define S2MPG11_IRQ_PWRONR_MASK BIT(1)
+#define S2MPG11_IRQ_PIF_TIMEOUT_MIF_MASK BIT(3)
+#define S2MPG11_IRQ_PIF_TIMEOUTS_MASK BIT(4)
+#define S2MPG11_IRQ_WTSR_MASK BIT(5)
+#define S2MPG11_IRQ_SPD_ABNORMAL_STOP_MASK BIT(6)
+#define S2MPG11_IRQ_SPD_PARITY_ERR_MASK BIT(7)
+
+ S2MPG11_IRQ_140C,
+ S2MPG11_IRQ_120C,
+ S2MPG11_IRQ_TSD,
+ S2MPG11_IRQ_WRST,
+ S2MPG11_IRQ_NTC_CYCLE_DONE,
+ S2MPG11_IRQ_PMETER_OVERF,
+#define S2MPG11_IRQ_INT140C_MASK BIT(0)
+#define S2MPG11_IRQ_INT120C_MASK BIT(1)
+#define S2MPG11_IRQ_TSD_MASK BIT(2)
+#define S2MPG11_IRQ_WRST_MASK BIT(5)
+#define S2MPG11_IRQ_NTC_CYCLE_DONE_MASK BIT(6)
+#define S2MPG11_IRQ_PMETER_OVERF_MASK BIT(7)
+
+ S2MPG11_IRQ_OCP_B1S,
+ S2MPG11_IRQ_OCP_B2S,
+ S2MPG11_IRQ_OCP_B3S,
+ S2MPG11_IRQ_OCP_B4S,
+ S2MPG11_IRQ_OCP_B5S,
+ S2MPG11_IRQ_OCP_B6S,
+ S2MPG11_IRQ_OCP_B7S,
+ S2MPG11_IRQ_OCP_B8S,
+#define S2MPG11_IRQ_OCP_B1S_MASK BIT(0)
+#define S2MPG11_IRQ_OCP_B2S_MASK BIT(1)
+#define S2MPG11_IRQ_OCP_B3S_MASK BIT(2)
+#define S2MPG11_IRQ_OCP_B4S_MASK BIT(3)
+#define S2MPG11_IRQ_OCP_B5S_MASK BIT(4)
+#define S2MPG11_IRQ_OCP_B6S_MASK BIT(5)
+#define S2MPG11_IRQ_OCP_B7S_MASK BIT(6)
+#define S2MPG11_IRQ_OCP_B8S_MASK BIT(7)
+
+ S2MPG11_IRQ_OCP_B9S,
+ S2MPG11_IRQ_OCP_B10S,
+ S2MPG11_IRQ_OCP_BDS,
+ S2MPG11_IRQ_OCP_BAS,
+ S2MPG11_IRQ_OCP_BBS,
+ S2MPG11_IRQ_WLWP_ACC,
+ S2MPG11_IRQ_SPD_SRP_PKT_RST,
+#define S2MPG11_IRQ_OCP_B9S_MASK BIT(0)
+#define S2MPG11_IRQ_OCP_B10S_MASK BIT(1)
+#define S2MPG11_IRQ_OCP_BDS_MASK BIT(2)
+#define S2MPG11_IRQ_OCP_BAS_MASK BIT(3)
+#define S2MPG11_IRQ_OCP_BBS_MASK BIT(4)
+#define S2MPG11_IRQ_WLWP_ACC_MASK BIT(5)
+#define S2MPG11_IRQ_SPD_SRP_PKT_RST_MASK BIT(7)
+
+ S2MPG11_IRQ_PWR_WARN_CH0,
+ S2MPG11_IRQ_PWR_WARN_CH1,
+ S2MPG11_IRQ_PWR_WARN_CH2,
+ S2MPG11_IRQ_PWR_WARN_CH3,
+ S2MPG11_IRQ_PWR_WARN_CH4,
+ S2MPG11_IRQ_PWR_WARN_CH5,
+ S2MPG11_IRQ_PWR_WARN_CH6,
+ S2MPG11_IRQ_PWR_WARN_CH7,
+#define S2MPG11_IRQ_PWR_WARN_CH0_MASK BIT(0)
+#define S2MPG11_IRQ_PWR_WARN_CH1_MASK BIT(1)
+#define S2MPG11_IRQ_PWR_WARN_CH2_MASK BIT(2)
+#define S2MPG11_IRQ_PWR_WARN_CH3_MASK BIT(3)
+#define S2MPG11_IRQ_PWR_WARN_CH4_MASK BIT(4)
+#define S2MPG11_IRQ_PWR_WARN_CH5_MASK BIT(5)
+#define S2MPG11_IRQ_PWR_WARN_CH6_MASK BIT(6)
+#define S2MPG11_IRQ_PWR_WARN_CH7_MASK BIT(7)
+
+ S2MPG11_IRQ_NTC_WARN_CH0,
+ S2MPG11_IRQ_NTC_WARN_CH1,
+ S2MPG11_IRQ_NTC_WARN_CH2,
+ S2MPG11_IRQ_NTC_WARN_CH3,
+ S2MPG11_IRQ_NTC_WARN_CH4,
+ S2MPG11_IRQ_NTC_WARN_CH5,
+ S2MPG11_IRQ_NTC_WARN_CH6,
+ S2MPG11_IRQ_NTC_WARN_CH7,
+#define S2MPG11_IRQ_NTC_WARN_CH0_MASK BIT(0)
+#define S2MPG11_IRQ_NTC_WARN_CH1_MASK BIT(1)
+#define S2MPG11_IRQ_NTC_WARN_CH2_MASK BIT(2)
+#define S2MPG11_IRQ_NTC_WARN_CH3_MASK BIT(3)
+#define S2MPG11_IRQ_NTC_WARN_CH4_MASK BIT(4)
+#define S2MPG11_IRQ_NTC_WARN_CH5_MASK BIT(5)
+#define S2MPG11_IRQ_NTC_WARN_CH6_MASK BIT(6)
+#define S2MPG11_IRQ_NTC_WARN_CH7_MASK BIT(7)
+
+ S2MPG11_IRQ_NR,
+};
+
enum s2mps11_irq {
S2MPS11_IRQ_PWRONF,
S2MPS11_IRQ_PWRONR,
diff --git a/include/linux/mfd/samsung/s2mpg11.h b/include/linux/mfd/samsung/s2mpg11.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4de7665f19fdb05dc4fcb83752728013d7a79ff
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mpg11.h
@@ -0,0 +1,420 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2015 Samsung Electronics
+ * Copyright 2020 Google Inc
+ * Copyright 2025 Linaro Ltd.
+ */
+
+#ifndef __LINUX_MFD_S2MPG11_H
+#define __LINUX_MFD_S2MPG11_H
+
+/* Common registers (type 0x000) */
+enum s2mpg11_common_reg {
+ S2MPG11_COMMON_CHIPID,
+ S2MPG11_COMMON_INT,
+ S2MPG11_COMMON_INT_MASK,
+ S2MPG11_COMMON_SPD_CTRL1 = 0x0a,
+ S2MPG11_COMMON_SPD_CTRL2,
+ S2MPG11_COMMON_SPD_CTRL3,
+ S2MPG11_COMMON_MON1SEL = 0x1a,
+ S2MPG11_COMMON_MON2SEL,
+ S2MPG11_COMMON_MONR,
+ S2MPG11_COMMON_DEBUG_CTRL1,
+ S2MPG11_COMMON_DEBUG_CTRL2,
+ S2MPG11_COMMON_DEBUG_CTRL3,
+ S2MPG11_COMMON_DEBUG_CTRL4,
+ S2MPG11_COMMON_DEBUG_CTRL5,
+ S2MPG11_COMMON_DEBUG_CTRL6,
+ S2MPG11_COMMON_TEST_MODE1,
+ S2MPG11_COMMON_SPD_DEBUG1,
+ S2MPG11_COMMON_SPD_DEBUG2,
+ S2MPG11_COMMON_SPD_DEBUG3,
+ S2MPG11_COMMON_SPD_DEBUG4,
+};
+
+/* For S2MPG11_COMMON_INT and S2MPG11_COMMON_INT_MASK */
+#define S2MPG11_COMMON_INT_SRC GENMASK(2, 0)
+#define S2MPG11_COMMON_INT_SRC_PMIC BIT(0)
+
+/* PMIC registers (type 0x100) */
+enum s2mpg11_pmic_reg {
+ S2MPG11_PMIC_INT1,
+ S2MPG11_PMIC_INT2,
+ S2MPG11_PMIC_INT3,
+ S2MPG11_PMIC_INT4,
+ S2MPG11_PMIC_INT5,
+ S2MPG11_PMIC_INT6,
+ S2MPG11_PMIC_INT1M,
+ S2MPG11_PMIC_INT2M,
+ S2MPG11_PMIC_INT3M,
+ S2MPG11_PMIC_INT4M,
+ S2MPG11_PMIC_INT5M,
+ S2MPG11_PMIC_INT6M,
+ S2MPG11_PMIC_STATUS1,
+ S2MPG11_PMIC_OFFSRC,
+ S2MPG11_PMIC_COMMON_CTRL1,
+ S2MPG11_PMIC_COMMON_CTRL2,
+ S2MPG11_PMIC_COMMON_CTRL3,
+ S2MPG11_PMIC_MIMICKING_CTRL,
+ S2MPG11_PMIC_B1S_CTRL,
+ S2MPG11_PMIC_B1S_OUT1,
+ S2MPG11_PMIC_B1S_OUT2,
+ S2MPG11_PMIC_B2S_CTRL,
+ S2MPG11_PMIC_B2S_OUT1,
+ S2MPG11_PMIC_B2S_OUT2,
+ S2MPG11_PMIC_B3S_CTRL,
+ S2MPG11_PMIC_B3S_OUT1,
+ S2MPG11_PMIC_B3S_OUT2,
+ S2MPG11_PMIC_B4S_CTRL,
+ S2MPG11_PMIC_B4S_OUT,
+ S2MPG11_PMIC_B5S_CTRL,
+ S2MPG11_PMIC_B5S_OUT,
+ S2MPG11_PMIC_B6S_CTRL,
+ S2MPG11_PMIC_B6S_OUT1,
+ S2MPG11_PMIC_B6S_OUT2,
+ S2MPG11_PMIC_B7S_CTRL,
+ S2MPG11_PMIC_B7S_OUT1,
+ S2MPG11_PMIC_B7S_OUT2,
+ S2MPG11_PMIC_B8S_CTRL,
+ S2MPG11_PMIC_B8S_OUT1,
+ S2MPG11_PMIC_B8S_OUT2,
+ S2MPG11_PMIC_B9S_CTRL,
+ S2MPG11_PMIC_B9S_OUT1,
+ S2MPG11_PMIC_B9S_OUT2,
+ S2MPG11_PMIC_B10S_CTRL,
+ S2MPG11_PMIC_B10S_OUT,
+ S2MPG11_PMIC_BUCKD_CTRL,
+ S2MPG11_PMIC_BUCKD_OUT,
+ S2MPG11_PMIC_BUCKA_CTRL,
+ S2MPG11_PMIC_BUCKA_OUT,
+ S2MPG11_PMIC_BB_CTRL,
+ S2MPG11_PMIC_BB_OUT1,
+ S2MPG11_PMIC_BB_OUT2,
+ S2MPG11_PMIC_BUCK1S_USONIC,
+ S2MPG11_PMIC_BUCK2S_USONIC,
+ S2MPG11_PMIC_BUCK3S_USONIC,
+ S2MPG11_PMIC_BUCK4S_USONIC,
+ S2MPG11_PMIC_BUCK5S_USONIC,
+ S2MPG11_PMIC_BUCK6S_USONIC,
+ S2MPG11_PMIC_BUCK7S_USONIC,
+ S2MPG11_PMIC_BUCK8S_USONIC,
+ S2MPG11_PMIC_BUCK9S_USONIC,
+ S2MPG11_PMIC_BUCK10S_USONIC,
+ S2MPG11_PMIC_BUCKD_USONIC,
+ S2MPG11_PMIC_BUCKA_USONIC,
+ S2MPG11_PMIC_BB_USONIC,
+ S2MPG11_PMIC_L1S_CTRL1,
+ S2MPG11_PMIC_L1S_CTRL2,
+ S2MPG11_PMIC_L2S_CTRL1,
+ S2MPG11_PMIC_L2S_CTRL2,
+ S2MPG11_PMIC_L3S_CTRL,
+ S2MPG11_PMIC_L4S_CTRL,
+ S2MPG11_PMIC_L5S_CTRL,
+ S2MPG11_PMIC_L6S_CTRL,
+ S2MPG11_PMIC_L7S_CTRL,
+ S2MPG11_PMIC_L8S_CTRL,
+ S2MPG11_PMIC_L9S_CTRL,
+ S2MPG11_PMIC_L10S_CTRL,
+ S2MPG11_PMIC_L11S_CTRL,
+ S2MPG11_PMIC_L12S_CTRL,
+ S2MPG11_PMIC_L13S_CTRL,
+ S2MPG11_PMIC_L14S_CTRL,
+ S2MPG11_PMIC_L15S_CTRL,
+ S2MPG11_PMIC_LDO_CTRL1,
+ S2MPG11_PMIC_LDO_DSCH1,
+ S2MPG11_PMIC_LDO_DSCH2,
+ S2MPG11_PMIC_DVS_RAMP1,
+ S2MPG11_PMIC_DVS_RAMP2,
+ S2MPG11_PMIC_DVS_RAMP3,
+ S2MPG11_PMIC_DVS_RAMP4,
+ S2MPG11_PMIC_DVS_RAMP5,
+ S2MPG11_PMIC_DVS_RAMP6,
+ /* Nothing @ 0x5a */
+ S2MPG11_PMIC_DVS_SYNC_CTRL1 = 0x5c,
+ S2MPG11_PMIC_DVS_SYNC_CTRL2,
+ S2MPG11_PMIC_OFF_CTRL1,
+ S2MPG11_PMIC_OFF_CTRL2,
+ S2MPG11_PMIC_OFF_CTRL3,
+ S2MPG11_PMIC_SEQ_CTRL1,
+ S2MPG11_PMIC_SEQ_CTRL2,
+ S2MPG11_PMIC_SEQ_CTRL3,
+ S2MPG11_PMIC_SEQ_CTRL4,
+ S2MPG11_PMIC_SEQ_CTRL5,
+ S2MPG11_PMIC_SEQ_CTRL6,
+ S2MPG11_PMIC_SEQ_CTRL7,
+ S2MPG11_PMIC_SEQ_CTRL8,
+ S2MPG11_PMIC_SEQ_CTRL9,
+ S2MPG11_PMIC_SEQ_CTRL10,
+ S2MPG11_PMIC_SEQ_CTRL11,
+ S2MPG11_PMIC_SEQ_CTRL12,
+ S2MPG11_PMIC_SEQ_CTRL13,
+ S2MPG11_PMIC_SEQ_CTRL14,
+ S2MPG11_PMIC_SEQ_CTRL15,
+ S2MPG11_PMIC_SEQ_CTRL16,
+ S2MPG11_PMIC_SEQ_CTRL17,
+ S2MPG11_PMIC_SEQ_CTRL18,
+ S2MPG11_PMIC_SEQ_CTRL19,
+ S2MPG11_PMIC_SEQ_CTRL20,
+ S2MPG11_PMIC_SEQ_CTRL21,
+ S2MPG11_PMIC_SEQ_CTRL22,
+ S2MPG11_PMIC_SEQ_CTRL23,
+ S2MPG11_PMIC_SEQ_CTRL24,
+ S2MPG11_PMIC_SEQ_CTRL25,
+ S2MPG11_PMIC_SEQ_CTRL26,
+ S2MPG11_PMIC_SEQ_CTRL27,
+ S2MPG11_PMIC_OFF_SEQ_CTRL1,
+ S2MPG11_PMIC_OFF_SEQ_CTRL2,
+ S2MPG11_PMIC_OFF_SEQ_CTRL3,
+ S2MPG11_PMIC_OFF_SEQ_CTRL4,
+ S2MPG11_PMIC_OFF_SEQ_CTRL5,
+ S2MPG11_PMIC_OFF_SEQ_CTRL6,
+ S2MPG11_PMIC_OFF_SEQ_CTRL7,
+ S2MPG11_PMIC_OFF_SEQ_CTRL8,
+ S2MPG11_PMIC_OFF_SEQ_CTRL9,
+ S2MPG11_PMIC_OFF_SEQ_CTRL10,
+ S2MPG11_PMIC_OFF_SEQ_CTRL11,
+ S2MPG11_PMIC_OFF_SEQ_CTRL12,
+ S2MPG11_PMIC_OFF_SEQ_CTRL13,
+ S2MPG11_PMIC_OFF_SEQ_CTRL14,
+ S2MPG11_PMIC_OFF_SEQ_CTRL15,
+ S2MPG11_PMIC_OFF_SEQ_CTRL16,
+ S2MPG11_PMIC_OFF_SEQ_CTRL17,
+ S2MPG11_PMIC_PCTRLSEL1,
+ S2MPG11_PMIC_PCTRLSEL2,
+ S2MPG11_PMIC_PCTRLSEL3,
+ S2MPG11_PMIC_PCTRLSEL4,
+ S2MPG11_PMIC_PCTRLSEL5,
+ S2MPG11_PMIC_PCTRLSEL6,
+ S2MPG11_PMIC_DCTRLSEL1,
+ S2MPG11_PMIC_DCTRLSEL2,
+ S2MPG11_PMIC_DCTRLSEL3,
+ S2MPG11_PMIC_DCTRLSEL4,
+ S2MPG11_PMIC_DCTRLSEL5,
+ S2MPG11_PMIC_GPIO_CTRL1,
+ S2MPG11_PMIC_GPIO_CTRL2,
+ S2MPG11_PMIC_GPIO_CTRL3,
+ S2MPG11_PMIC_GPIO_CTRL4,
+ S2MPG11_PMIC_GPIO_CTRL5,
+ S2MPG11_PMIC_GPIO_CTRL6,
+ S2MPG11_PMIC_GPIO_CTRL7,
+ S2MPG11_PMIC_B2S_OCP_WARN,
+ S2MPG11_PMIC_B2S_OCP_WARN_X,
+ S2MPG11_PMIC_B2S_OCP_WARN_Y,
+ S2MPG11_PMIC_B2S_OCP_WARN_Z,
+ S2MPG11_PMIC_B2S_SOFT_OCP_WARN,
+ S2MPG11_PMIC_B2S_SOFT_OCP_WARN_X,
+ S2MPG11_PMIC_B2S_SOFT_OCP_WARN_Y,
+ S2MPG11_PMIC_B2S_SOFT_OCP_WARN_Z,
+ S2MPG11_PMIC_BUCK_OCP_EN1,
+ S2MPG11_PMIC_BUCK_OCP_EN2,
+ S2MPG11_PMIC_BUCK_OCP_PD_EN1,
+ S2MPG11_PMIC_BUCK_OCP_PD_EN2,
+ S2MPG11_PMIC_BUCK_OCP_CTRL1,
+ S2MPG11_PMIC_BUCK_OCP_CTRL2,
+ S2MPG11_PMIC_BUCK_OCP_CTRL3,
+ S2MPG11_PMIC_BUCK_OCP_CTRL4,
+ S2MPG11_PMIC_BUCK_OCP_CTRL5,
+ S2MPG11_PMIC_BUCK_OCP_CTRL6,
+ S2MPG11_PMIC_BUCK_OCP_CTRL7,
+ S2MPG11_PMIC_PIF_CTRL,
+ S2MPG11_PMIC_BUCK_HR_MODE1,
+ S2MPG11_PMIC_BUCK_HR_MODE2,
+ S2MPG11_PMIC_FAULTOUT_CTRL,
+ S2MPG11_PMIC_LDO_SENSE1,
+ S2MPG11_PMIC_LDO_SENSE2,
+};
+
+/* Meter registers (type 0xa00) */
+enum s2mpg11_meter_reg {
+ S2MPG11_METER_CTRL1,
+ S2MPG11_METER_CTRL2,
+ S2MPG11_METER_CTRL3,
+ S2MPG11_METER_CTRL4,
+ S2MPG11_METER_CTRL5,
+ S2MPG11_METER_BUCKEN1,
+ S2MPG11_METER_BUCKEN2,
+ S2MPG11_METER_MUXSEL0,
+ S2MPG11_METER_MUXSEL1,
+ S2MPG11_METER_MUXSEL2,
+ S2MPG11_METER_MUXSEL3,
+ S2MPG11_METER_MUXSEL4,
+ S2MPG11_METER_MUXSEL5,
+ S2MPG11_METER_MUXSEL6,
+ S2MPG11_METER_MUXSEL7,
+ S2MPG11_METER_LPF_C0_0,
+ S2MPG11_METER_LPF_C0_1,
+ S2MPG11_METER_LPF_C0_2,
+ S2MPG11_METER_LPF_C0_3,
+ S2MPG11_METER_LPF_C0_4,
+ S2MPG11_METER_LPF_C0_5,
+ S2MPG11_METER_LPF_C0_6,
+ S2MPG11_METER_LPF_C0_7,
+ S2MPG11_METER_NTC_LPF_C0_0,
+ S2MPG11_METER_NTC_LPF_C0_1,
+ S2MPG11_METER_NTC_LPF_C0_2,
+ S2MPG11_METER_NTC_LPF_C0_3,
+ S2MPG11_METER_NTC_LPF_C0_4,
+ S2MPG11_METER_NTC_LPF_C0_5,
+ S2MPG11_METER_NTC_LPF_C0_6,
+ S2MPG11_METER_NTC_LPF_C0_7,
+ S2MPG11_METER_PWR_WARN0,
+ S2MPG11_METER_PWR_WARN1,
+ S2MPG11_METER_PWR_WARN2,
+ S2MPG11_METER_PWR_WARN3,
+ S2MPG11_METER_PWR_WARN4,
+ S2MPG11_METER_PWR_WARN5,
+ S2MPG11_METER_PWR_WARN6,
+ S2MPG11_METER_PWR_WARN7,
+ S2MPG11_METER_NTC_L_WARN0,
+ S2MPG11_METER_NTC_L_WARN1,
+ S2MPG11_METER_NTC_L_WARN2,
+ S2MPG11_METER_NTC_L_WARN3,
+ S2MPG11_METER_NTC_L_WARN4,
+ S2MPG11_METER_NTC_L_WARN5,
+ S2MPG11_METER_NTC_L_WARN6,
+ S2MPG11_METER_NTC_L_WARN7,
+ S2MPG11_METER_NTC_H_WARN0,
+ S2MPG11_METER_NTC_H_WARN1,
+ S2MPG11_METER_NTC_H_WARN2,
+ S2MPG11_METER_NTC_H_WARN3,
+ S2MPG11_METER_NTC_H_WARN4,
+ S2MPG11_METER_NTC_H_WARN5,
+ S2MPG11_METER_NTC_H_WARN6,
+ S2MPG11_METER_NTC_H_WARN7,
+ S2MPG11_METER_PWR_HYS1,
+ S2MPG11_METER_PWR_HYS2,
+ S2MPG11_METER_PWR_HYS3,
+ S2MPG11_METER_PWR_HYS4,
+ S2MPG11_METER_NTC_HYS1,
+ S2MPG11_METER_NTC_HYS2,
+ S2MPG11_METER_NTC_HYS3,
+ S2MPG11_METER_NTC_HYS4,
+ /* Nothing @ 0x3f */
+ S2MPG11_METER_ACC_DATA_CH0_1 = 0x40,
+ S2MPG11_METER_ACC_DATA_CH0_2,
+ S2MPG11_METER_ACC_DATA_CH0_3,
+ S2MPG11_METER_ACC_DATA_CH0_4,
+ S2MPG11_METER_ACC_DATA_CH0_5,
+ S2MPG11_METER_ACC_DATA_CH0_6,
+ S2MPG11_METER_ACC_DATA_CH1_1,
+ S2MPG11_METER_ACC_DATA_CH1_2,
+ S2MPG11_METER_ACC_DATA_CH1_3,
+ S2MPG11_METER_ACC_DATA_CH1_4,
+ S2MPG11_METER_ACC_DATA_CH1_5,
+ S2MPG11_METER_ACC_DATA_CH1_6,
+ S2MPG11_METER_ACC_DATA_CH2_1,
+ S2MPG11_METER_ACC_DATA_CH2_2,
+ S2MPG11_METER_ACC_DATA_CH2_3,
+ S2MPG11_METER_ACC_DATA_CH2_4,
+ S2MPG11_METER_ACC_DATA_CH2_5,
+ S2MPG11_METER_ACC_DATA_CH2_6,
+ S2MPG11_METER_ACC_DATA_CH3_1,
+ S2MPG11_METER_ACC_DATA_CH3_2,
+ S2MPG11_METER_ACC_DATA_CH3_3,
+ S2MPG11_METER_ACC_DATA_CH3_4,
+ S2MPG11_METER_ACC_DATA_CH3_5,
+ S2MPG11_METER_ACC_DATA_CH3_6,
+ S2MPG11_METER_ACC_DATA_CH4_1,
+ S2MPG11_METER_ACC_DATA_CH4_2,
+ S2MPG11_METER_ACC_DATA_CH4_3,
+ S2MPG11_METER_ACC_DATA_CH4_4,
+ S2MPG11_METER_ACC_DATA_CH4_5,
+ S2MPG11_METER_ACC_DATA_CH4_6,
+ S2MPG11_METER_ACC_DATA_CH5_1,
+ S2MPG11_METER_ACC_DATA_CH5_2,
+ S2MPG11_METER_ACC_DATA_CH5_3,
+ S2MPG11_METER_ACC_DATA_CH5_4,
+ S2MPG11_METER_ACC_DATA_CH5_5,
+ S2MPG11_METER_ACC_DATA_CH5_6,
+ S2MPG11_METER_ACC_DATA_CH6_1,
+ S2MPG11_METER_ACC_DATA_CH6_2,
+ S2MPG11_METER_ACC_DATA_CH6_3,
+ S2MPG11_METER_ACC_DATA_CH6_4,
+ S2MPG11_METER_ACC_DATA_CH6_5,
+ S2MPG11_METER_ACC_DATA_CH6_6,
+ S2MPG11_METER_ACC_DATA_CH7_1,
+ S2MPG11_METER_ACC_DATA_CH7_2,
+ S2MPG11_METER_ACC_DATA_CH7_3,
+ S2MPG11_METER_ACC_DATA_CH7_4,
+ S2MPG11_METER_ACC_DATA_CH7_5,
+ S2MPG11_METER_ACC_DATA_CH7_6,
+ S2MPG11_METER_ACC_COUNT_1,
+ S2MPG11_METER_ACC_COUNT_2,
+ S2MPG11_METER_ACC_COUNT_3,
+ S2MPG11_METER_LPF_DATA_CH0_1,
+ S2MPG11_METER_LPF_DATA_CH0_2,
+ S2MPG11_METER_LPF_DATA_CH0_3,
+ S2MPG11_METER_LPF_DATA_CH1_1,
+ S2MPG11_METER_LPF_DATA_CH1_2,
+ S2MPG11_METER_LPF_DATA_CH1_3,
+ S2MPG11_METER_LPF_DATA_CH2_1,
+ S2MPG11_METER_LPF_DATA_CH2_2,
+ S2MPG11_METER_LPF_DATA_CH2_3,
+ S2MPG11_METER_LPF_DATA_CH3_1,
+ S2MPG11_METER_LPF_DATA_CH3_2,
+ S2MPG11_METER_LPF_DATA_CH3_3,
+ S2MPG11_METER_LPF_DATA_CH4_1,
+ S2MPG11_METER_LPF_DATA_CH4_2,
+ S2MPG11_METER_LPF_DATA_CH4_3,
+ S2MPG11_METER_LPF_DATA_CH5_1,
+ S2MPG11_METER_LPF_DATA_CH5_2,
+ S2MPG11_METER_LPF_DATA_CH5_3,
+ S2MPG11_METER_LPF_DATA_CH6_1,
+ S2MPG11_METER_LPF_DATA_CH6_2,
+ S2MPG11_METER_LPF_DATA_CH6_3,
+ S2MPG11_METER_LPF_DATA_CH7_1,
+ S2MPG11_METER_LPF_DATA_CH7_2,
+ S2MPG11_METER_LPF_DATA_CH7_3,
+ /* Nothing @ 0x8b 0x8c */
+ S2MPG11_METER_LPF_DATA_NTC0_1 = 0x8d,
+ S2MPG11_METER_LPF_DATA_NTC0_2,
+ S2MPG11_METER_LPF_DATA_NTC1_1,
+ S2MPG11_METER_LPF_DATA_NTC1_2,
+ S2MPG11_METER_LPF_DATA_NTC2_1,
+ S2MPG11_METER_LPF_DATA_NTC2_2,
+ S2MPG11_METER_LPF_DATA_NTC3_1,
+ S2MPG11_METER_LPF_DATA_NTC3_2,
+ S2MPG11_METER_LPF_DATA_NTC4_1,
+ S2MPG11_METER_LPF_DATA_NTC4_2,
+ S2MPG11_METER_LPF_DATA_NTC5_1,
+ S2MPG11_METER_LPF_DATA_NTC5_2,
+ S2MPG11_METER_LPF_DATA_NTC6_1,
+ S2MPG11_METER_LPF_DATA_NTC6_2,
+ S2MPG11_METER_LPF_DATA_NTC7_1,
+ S2MPG11_METER_LPF_DATA_NTC7_2,
+};
+
+/* S2MPG11 regulator IDs */
+enum s2mpg11_regulators {
+ S2MPG11_LDO1,
+ S2MPG11_LDO2,
+ S2MPG11_LDO3,
+ S2MPG11_LDO4,
+ S2MPG11_LDO5,
+ S2MPG11_LDO6,
+ S2MPG11_LDO7,
+ S2MPG11_LDO8,
+ S2MPG11_LDO9,
+ S2MPG11_LDO10,
+ S2MPG11_LDO11,
+ S2MPG11_LDO12,
+ S2MPG11_LDO13,
+ S2MPG11_LDO14,
+ S2MPG11_LDO15,
+ S2MPG11_BUCK1,
+ S2MPG11_BUCK2,
+ S2MPG11_BUCK3,
+ S2MPG11_BUCK4,
+ S2MPG11_BUCK5,
+ S2MPG11_BUCK6,
+ S2MPG11_BUCK7,
+ S2MPG11_BUCK8,
+ S2MPG11_BUCK9,
+ S2MPG11_BUCK10,
+ S2MPG11_BUCKD,
+ S2MPG11_BUCKA,
+ S2MPG11_BUCKBOOST,
+ S2MPG11_REGULATOR_MAX,
+};
+
+#endif /* __LINUX_MFD_S2MPG11_H */

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675911-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7982C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:07:49 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 361707AC8D9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:05:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 436CB28C02C;
Fri, 6 Jun 2025 15:03:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="B1yAVPmC"
Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6474C28A414
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222207; cv=none; b=EgPiCWQsRfqzzCm9bJwzrX0WjJ3xA3HVEeVVikKsKFp14KVDQIt/+1UUNi2gK6MappmNY6ts8I9aVVqOWKhc2CqED2Lf2c4UThQCrgFVg1CGfd3HfdjOsy19n4UVg8ylYGeGeqSZHUvID6c0BoBLgB8kKhBsqgm2RzaGGh1X48c=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222207; c=relaxed/simple;
bh=DtlBkmeFf9pjAxGCgmCN5Tg4/h2onm9CJStRVS1CP9s=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
In-Reply-To:To:Cc; b=lVSkaHCDPGECoMh9asZRB4YhqXK30MTmL7zRiD3FeYGG5f79nn1NSpsuRQP56mzUxk7ZK7VceavklDUL//AoNwRnOmbGYnLUN+6EvR4WUSXSt1pocGkibTVKoD6KzZTnOEDvSYS/EKWKBZGcPb4EZNTDWDRUcFYDRysNATCLh8Q=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=B1yAVPmC; arc=none smtp.client-ip=209.85.218.46
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-ad1b94382b8so367705766b.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222201; x=1749827001; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:from:to:cc:subject:date:message-id
:reply-to;
bh=7btE5VBq3UbP0k1jf4CzhHOohoUdya+2IgQP8EiGSvc=;
b=B1yAVPmCn7q80Q46pfamFbOoJ/Hh3nPHnt3sW6UK+hbaCn70FYvVqGxYPoIcq+Cv/C
FofI2H87hL+DOeqtIOhYILkDcYNu9icRb09QWVkFjlgeeGHfSbnMBhFBGMsN8D+Qgdmx
porGVnj66Ijd/CFoFCjag2xQjx8J6s14mcWmXV8X7PzWPdzhzyrK+/jNizM31gpmnDAw
2ppdkyJbG0rNGnzOh+YRp92rR21n4C6z+/xapj50CPj9CyvaW78DbkEB6C62tgPMJHX6
KUMAEspgBxTlwCq6e2FlzHtYfk6Njhwt8UrR1uJ4yUzZgcJBwfcZ/KZ7Jbn96nfsNRP9
Y68A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222201; x=1749827001;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:mime-version:subject:date:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=7btE5VBq3UbP0k1jf4CzhHOohoUdya+2IgQP8EiGSvc=;
b=mVoy1e/HoWLBVExubA53IMHg2JBb2RBJwux8QG4KsSpAnn++YyK69JF65j+pRNSF5r
szzTP00eAYIUy4vtbyKDdAmrlGiE205EHx1rw7HAIfFasy2QwTP+skR6t1h2fSPjf2g/
mBzxLCvJSotzYDVo2GG8/B5JjgNZMkhgHTrcKWf/rOs9h3SRJhSq/YRb3sjqDc/p1Nqn
ofD3GrUKgBQHKm+Wfq68jaE3Dvi5b/5vyNRm1McxtMHKwX//jQqWVYcRJtXgnntNX3XQ
Uyi6Q8Apklm+em/XNHts43kvxYRymkokRRzxK03kRwB3nBE9EkB6moy5AGGkJvCqWlZd
a0Cg==
X-Forwarded-Encrypted: i=1; AJvYcCV5ENgpM3jiR5icu9Cx8zZ/38WvSok2IKcXUDXFQmnsANeGC2zMDWpret92Ys97IxFkh/2EaEbF98QuoEM=@vger.kernel.org
X-Gm-Message-State: AOJu0YyKLc2rBpt4FX3Wt6eYFqlqTQJV+3yLVKnIIwGoCUokNPJilXhc
1C/wsRGd7o5dFm7FPalojTsCTg6ehVANYh7+ElP18AUNm0xkdlGElPyCA8pLMhzy5kY=
X-Gm-Gg: ASbGncuFAHpqSncAHK0zzuW0mktvsWX2YZen3k1fHaOu3gN7jc2B0rEUsOGvZ7g+sAL
xUK26Hbdivf5ktTAlZJMHjLOowg7JfJ3+T8e3vuaGcfH0haXpP0gf15A+Nb0dcaB34GjObozf79
J55KpFG095UJPfc8ht0uiYaWmG2n2veqLh8N9RVbvK67ynV8h1thseBD2cphiFscgdRqs6u9f3z
PaKSod50NdCtcQJYKmWHR0/W5dWzkh02X8P5gp32Wcmz1HOFvw+CPyvN87Hfh4sCXO6/zlNpYGC
hxmWId0D3z+t1VxEZmTD1YyRj9lPjGXMsF6uYEknbyDvXFJMftIsYm73lTTjcknz4yBUBPnaPjd
T5Cp2TIPCBa8nhiXPbompaMbFtjoCHF9mvS2qzFywthVc+A==
X-Google-Smtp-Source: AGHT+IGxnm6pBbHVIYIIe9hkMQ8JxTW7peP3cR4UL9qPSHSxqgc6/znfqj1QohdocTUC3/x18Pe/gQ==
X-Received: by 2002:a17:907:8694:b0:ad8:8529:4f73 with SMTP id a640c23a62f3a-ade1aa0e3e8mr353586166b.49.1749222199472;
Fri, 06 Jun 2025 08:03:19 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38cf2sm127735066b.121.2025.06.06.08.03.19
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:03:19 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:03:10 +0100
Subject: [PATCH v2 14/17] regulator: s2mps11: refactor S2MPG10
::set_voltage_time() for S2MPG11 reuse
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-s2mpg1x-regulators-v2-14-b03feffd2621@xxxxxxxxxx>
References: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
In-Reply-To: <20250606-s2mpg1x-regulators-v2-0-b03feffd2621@xxxxxxxxxx>
To: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>,
Bartosz Golaszewski <brgl@xxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Will McVicker <willmcvicker@xxxxxxxxxx>, kernel-team@xxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The upcoming S2MPG11 support needs a similar, but different version of
::set_voltage_time(). For S2MPG10, the downwards and upwards ramps for
a rail are at different offsets at the same bit positions, while for
S2MPG11 the ramps are at the same offset at different bit positions.

Refactor the existing version slightly to allow reuse.

Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
drivers/regulator/s2mps11.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 3f2993b96c3e54427f5c0af7bb045e2278daa671..76be81c75c898fddc9570a62a64da787bacad7d7 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -562,26 +562,23 @@ static int s2mpg10_regulator_buck_enable_time(struct regulator_dev *rdev)
+ DIV_ROUND_UP(curr_uV, s2mpg10_desc->enable_ramp_rate));
}

-static int s2mpg10_regulator_buck_set_voltage_time(struct regulator_dev *rdev,
- int old_uV, int new_uV)
+static int s2mpg1x_regulator_buck_set_voltage_time(struct regulator_dev *rdev,
+ int old_uV, int new_uV,
+ unsigned int ramp_reg,
+ unsigned int ramp_mask)
{
- unsigned int ramp_reg, ramp_sel, ramp_rate;
+ unsigned int ramp_sel, ramp_rate;
int ret;

if (old_uV == new_uV)
return 0;

- ramp_reg = rdev->desc->ramp_reg;
- if (old_uV > new_uV)
- /* The downwards ramp is at a different offset. */
- ramp_reg += S2MPG10_PMIC_DVS_RAMP4 - S2MPG10_PMIC_DVS_RAMP1;
-
ret = regmap_read(rdev->regmap, ramp_reg, &ramp_sel);
if (ret)
return ret;

- ramp_sel &= rdev->desc->ramp_mask;
- ramp_sel >>= ffs(rdev->desc->ramp_mask) - 1;
+ ramp_sel &= ramp_mask;
+ ramp_sel >>= ffs(ramp_mask) - 1;
if (ramp_sel >= rdev->desc->n_ramp_values ||
!rdev->desc->ramp_delay_table)
return -EINVAL;
@@ -591,6 +588,21 @@ static int s2mpg10_regulator_buck_set_voltage_time(struct regulator_dev *rdev,
return DIV_ROUND_UP(abs(new_uV - old_uV), ramp_rate);
}

+static int s2mpg10_regulator_buck_set_voltage_time(struct regulator_dev *rdev,
+ int old_uV, int new_uV)
+{
+ unsigned int ramp_reg;
+
+ ramp_reg = rdev->desc->ramp_reg;
+ if (old_uV > new_uV)
+ /* The downwards ramp is at a different offset. */
+ ramp_reg += S2MPG10_PMIC_DVS_RAMP4 - S2MPG10_PMIC_DVS_RAMP1;
+
+ return s2mpg1x_regulator_buck_set_voltage_time(rdev, old_uV, new_uV,
+ ramp_reg,
+ rdev->desc->ramp_mask);
+}
+
/*
* We assign both, ::set_voltage_time() and ::set_voltage_time_sel(), because
* only if the latter is != NULL, the regulator core will call neither during

--
2.50.0.rc0.604.gd4ff7b7c86-goog



Return-Path: <linux-kernel+bounces-675914-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6367E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:08:04 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id BD6D4189DFEB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:08:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 203FC289838;
Fri, 6 Jun 2025 15:03:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="u7ARvbu/"
Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183])
(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 9E7F845009
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222225; cv=none; b=EcAsuJTRf5yi+3+FCp6KrNMqVP0uy4q2oz9wtQN3Vid+Pjx6AQ6iTgHqNyfz3Ww6YXHcvtLsNCmhEiJko+P2WqqAfydNIHMwZ81pckzlJcU6o1XmLd4cVwSfxgVfL8e2eCHAH4EMnMohS4Jvo74FQlTjh97rv21w5x2ThReT5pE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222225; c=relaxed/simple;
bh=DRVrh8AqSjSv5TXQJ3G55uv/2k+YOtrWpqdhnHMfGCo=;
h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=o/0qVxEC1hjzexFrhiOgZji6ul+qJUfnsXmAdU5phc4xgDPJOKhqInCOLejV3yWnZftEoccpOUAwwG/SmwrMZa2dCeZz2IBFlM1A9yQ4rx65evEYRNfUMVwMvUL9gItqEyKGrnY5bXjefMGfK+l0E/WTMDZWhRW+/nMLlVk+I2I=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=u7ARvbu/; arc=none smtp.client-ip=95.215.58.183
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Report-Abuse: Please report any abuse attempt to abuse@xxxxxxxxxx and include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1;
t=1749222210;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding;
bh=qAtVAk3ktG/11zUq9KHayxDPp/WA9lPsPFV1ZKBYtiA=;
b=u7ARvbu/JzSUVWLY8cd49nFOwDoNbZbc7BxwPr0P/Vu7xmxtyo3bV4YHLYBk01rRT1P7Mz
TSW/8A5IJKY0e2c/LtfR8RouSikixGy0ffXl0bAbgpNMCHWfarhMNWdSkzlTrUI/x4//r5
xaN896qIkM5mY1zgBKi7zbiLiofnWHs=
From: Tao Chen <chen.dylane@xxxxxxxxx>
To: ast@xxxxxxxxxx,
daniel@xxxxxxxxxxxxx,
john.fastabend@xxxxxxxxx,
andrii@xxxxxxxxxx,
martin.lau@xxxxxxxxx,
eddyz87@xxxxxxxxx,
song@xxxxxxxxxx,
yonghong.song@xxxxxxxxx,
kpsingh@xxxxxxxxxx,
sdf@xxxxxxxxxxx,
haoluo@xxxxxxxxxx,
jolsa@xxxxxxxxxx
Cc: bpf@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Tao Chen <chen.dylane@xxxxxxxxx>
Subject: [PATCH bpf-next v2] bpf: Add show_fdinfo for perf_event
Date: Fri, 6 Jun 2025 23:02:58 +0800
Message-Id: <20250606150258.3385166-1-chen.dylane@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Migadu-Flow: FLOW_OUT
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

After commit 1b715e1b0ec5 ("bpf: Support ->fill_link_info for perf_event") add
perf_event info, we can also show the info with the method of cat /proc/[fd]/fdinfo.

kprobe fdinfo:
link_type: perf
link_id: 10
prog_tag: bcf7977d3b93787c
prog_id: 20
name: bpf_fentry_test1
offset: 0
missed: 0
addr: ffffffffa28a2904
event_type: kprobe
cookie: 3735928559

uprobe fdinfo:
link_type: perf
link_id: 13
prog_tag: bcf7977d3b93787c
prog_id: 21
name: /proc/self/exe
offset: 63dce4
ref_ctr_offset: 33eee2a
event_type: uprobe
cookie: 3735928559

tracepoint fdinfo:
link_type: perf
link_id: 11
prog_tag: bcf7977d3b93787c
prog_id: 22
tp_name: sched_switch
event_type: tracepoint
cookie: 3735928559

perf_event fdinfo:
link_type: perf
link_id: 12
prog_tag: bcf7977d3b93787c
prog_id: 23
type: 1
config: 2
event_type: event
cookie: 3735928559

Signed-off-by: Tao Chen <chen.dylane@xxxxxxxxx>
---
kernel/bpf/syscall.c | 118 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 118 insertions(+)

Change list:
- v1 -> v2:
- Andrii suggested:
1. define event_type with string
2. print offset and addr with hex

- Jiri suggested:
1. add ref_ctr_offset for uprobe
- v1:
https://lore.kernel.org/bpf/20250604163723.3175258-1-chen.dylane@xxxxxxxxx

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 89d027cd7ca..928ff129087 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -3795,6 +3795,31 @@ static int bpf_perf_link_fill_kprobe(const struct perf_event *event,
info->perf_event.kprobe.cookie = event->bpf_cookie;
return 0;
}
+
+static void bpf_perf_link_fdinfo_kprobe(const struct perf_event *event,
+ struct seq_file *seq)
+{
+ const char *name;
+ int err;
+ u32 prog_id, type;
+ u64 offset, addr;
+ unsigned long missed;
+
+ err = bpf_get_perf_event_info(event, &prog_id, &type, &name,
+ &offset, &addr, &missed);
+ if (err)
+ return;
+
+ seq_printf(seq,
+ "name:\t%s\n"
+ "offset:\t%llx\n"
+ "missed:\t%lu\n"
+ "addr:\t%llx\n"
+ "event_type:\t%s\n"
+ "cookie:\t%llu\n",
+ name, offset, missed, addr, type == BPF_FD_TYPE_KRETPROBE ?
+ "kretprobe" : "kprobe", event->bpf_cookie);
+}
#endif

#ifdef CONFIG_UPROBE_EVENTS
@@ -3823,6 +3848,30 @@ static int bpf_perf_link_fill_uprobe(const struct perf_event *event,
info->perf_event.uprobe.ref_ctr_offset = ref_ctr_offset;
return 0;
}
+
+static void bpf_perf_link_fdinfo_uprobe(const struct perf_event *event,
+ struct seq_file *seq)
+{
+ const char *name;
+ int err;
+ u32 prog_id, type;
+ u64 offset, ref_ctr_offset;
+ unsigned long missed;
+
+ err = bpf_get_perf_event_info(event, &prog_id, &type, &name,
+ &offset, &ref_ctr_offset, &missed);
+ if (err)
+ return;
+
+ seq_printf(seq,
+ "name:\t%s\n"
+ "offset:\t%llx\n"
+ "ref_ctr_offset:\t%llx\n"
+ "event_type:\t%s\n"
+ "cookie:\t%llu\n",
+ name, offset, ref_ctr_offset, type == BPF_FD_TYPE_URETPROBE ?
+ "uretprobe" : "uprobe", event->bpf_cookie);
+}
#endif

static int bpf_perf_link_fill_probe(const struct perf_event *event,
@@ -3891,10 +3940,79 @@ static int bpf_perf_link_fill_link_info(const struct bpf_link *link,
}
}

+static void bpf_perf_event_link_show_fdinfo(const struct perf_event *event,
+ struct seq_file *seq)
+{
+ seq_printf(seq,
+ "type:\t%u\n"
+ "config:\t%llu\n"
+ "event_type:\t%s\n"
+ "cookie:\t%llu\n",
+ event->attr.type, event->attr.config,
+ "event", event->bpf_cookie);
+}
+
+static void bpf_tracepoint_link_show_fdinfo(const struct perf_event *event,
+ struct seq_file *seq)
+{
+ int err;
+ const char *name;
+ u32 prog_id;
+
+ err = bpf_get_perf_event_info(event, &prog_id, NULL, &name, NULL,
+ NULL, NULL);
+ if (err)
+ return;
+
+ seq_printf(seq,
+ "tp_name:\t%s\n"
+ "event_type:\t%s\n"
+ "cookie:\t%llu\n",
+ name, "tracepoint", event->bpf_cookie);
+}
+
+static void bpf_probe_link_show_fdinfo(const struct perf_event *event,
+ struct seq_file *seq)
+{
+#ifdef CONFIG_KPROBE_EVENTS
+ if (event->tp_event->flags & TRACE_EVENT_FL_KPROBE)
+ return bpf_perf_link_fdinfo_kprobe(event, seq);
+#endif
+
+#ifdef CONFIG_UPROBE_EVENTS
+ if (event->tp_event->flags & TRACE_EVENT_FL_UPROBE)
+ return bpf_perf_link_fdinfo_uprobe(event, seq);
+#endif
+}
+
+static void bpf_perf_link_show_fdinfo(const struct bpf_link *link,
+ struct seq_file *seq)
+{
+ struct bpf_perf_link *perf_link;
+ const struct perf_event *event;
+
+ perf_link = container_of(link, struct bpf_perf_link, link);
+ event = perf_get_event(perf_link->perf_file);
+ if (IS_ERR(event))
+ return;
+
+ switch (event->prog->type) {
+ case BPF_PROG_TYPE_PERF_EVENT:
+ return bpf_perf_event_link_show_fdinfo(event, seq);
+ case BPF_PROG_TYPE_TRACEPOINT:
+ return bpf_tracepoint_link_show_fdinfo(event, seq);
+ case BPF_PROG_TYPE_KPROBE:
+ return bpf_probe_link_show_fdinfo(event, seq);
+ default:
+ return;
+ }
+}
+
static const struct bpf_link_ops bpf_perf_link_lops = {
.release = bpf_perf_link_release,
.dealloc = bpf_perf_link_dealloc,
.fill_link_info = bpf_perf_link_fill_link_info,
+ .show_fdinfo = bpf_perf_link_show_fdinfo,
};

static int bpf_perf_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
--
2.43.0



Return-Path: <linux-kernel+bounces-675915-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6B47A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:08:50 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id CFE5F17B4CC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:08:15 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F290289E13;
Fri, 6 Jun 2025 15:03:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nfvyh27C"
Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D502745009
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:03:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222231; cv=none; b=E8xKf56QhLkOKVNvINtWZSZHM9igfvLt+v/9xrIt9k3Kb0C9IiO0KWsA24RphgPFP2Qa6ZXij2Z6KHgkqA30NAtBiALDKFkH851FXx4bBXB/DrvXltgoG5sLid5irsYRSpTehteIqJl29zA60pXXIM03mpfc3b8XN+i0qMUHvLQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222231; c=relaxed/simple;
bh=MP1DlX3KQk0isYvYsMaQEocILjiYOZ/JELPcnsAuWZU=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=nAHZBIR05f5u9B/7/GkiXs5yVxhuYN/d1DtU4A9puy0LAZMUdGiLstdp5xVxxqkpwsQrMyw685VPZOq1T+XtSoOOAiCN5Hn33/zubGY/2rAb9Xew4RLsP5AO9pLQ363MvWToeQR/zqwsvd6ih9HcNi8tb11BH3O2BUd5YQojYPM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nfvyh27C; arc=none smtp.client-ip=209.85.208.52
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-601f278369bso4373581a12.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:03:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222228; x=1749827028; darn=vger.kernel.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=LKFTgmexJ2tRnAKnlvK8zPAnKcYjOx7uvqLUInYgAWM=;
b=nfvyh27C9fMKooOlxtKM/i2mO2e4IvC6XaZy3tyRtFeiOxXiozM1zf1u5BhgT1JM44
DRpcygqh3EVIE2tWmWfVNsTWDLzSAYLYHa0T3fCLMeACHskITPz/UrIpD9UHFssVCF/B
RU6wQZc3u1JrRJnkP6eVRHgoC0YVQDQ1IEdAr0M5KX/7R5pwT/zOgAI+XywTcoPTTSfK
PgH33L4b2F8iqI2z/JYJ37D3QdghXneH8HRlneNPSFRZQd1uIDU0SXHBMYcMhKSFqsIZ
yz3VtsAKESdYn4wBE86WWJUbrleHLYLpzn5J5mfgFD6bAtZ4/839F0cqFPYmPMzI4ZX9
Iywg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222228; x=1749827028;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=LKFTgmexJ2tRnAKnlvK8zPAnKcYjOx7uvqLUInYgAWM=;
b=bF24ZD1FLTve8vObxj/WsXNCA+FIKxZtxPoKC/lYxsyhI4IOmAPRWVa4rWOTqH0PtI
ImMOVzqSS0zUDFsh+gDZMW8jZnyfr9w9+CUoGxbPPcMkjMDMyF+v2m63rEC9RPCqiYwJ
cveNY7Boue8qy54rqSqMwkHyEiK4h4lgbQPD9n4d0G42yct7mECIZRzg7lQQC8cszmze
hbwQB6gjPeiQr5cQSH12WXciqubdTES1XFSbsFPqlkXhCJ1OwA0AdwRbXDFfvaKzOZHs
lygfXW30g0diwmpBybp7fEW54MeMC7IJDp3Fx8fZvR5ScVVB3jJiT3YqpPRFngAsLuZ5
gRIg==
X-Forwarded-Encrypted: i=1; AJvYcCWxBqRn29vCYPlwN2RVB2SDJrUfWgD2vP2sADXVTOOQiHhdM9YPloB+TFqdrEoctrHi/dmfQkIcEn6cFsM=@vger.kernel.org
X-Gm-Message-State: AOJu0Yz9scU/cePg3GijU0QoZ2maD3pt14rL/t5ED2+OSePoVXEY8n75
yhPyEpYhrCWY2WaaHqFINgmbLjg2IE34pJ/gjOZkYZ7lQcdj7KKYBERoYK7FdUkH0tfnPnUQkx7
Jy9fnpEdA5+J0PLsAnqxj+8GBRfogdaGtuxn+FtcxqA==
X-Gm-Gg: ASbGncuQ0vg+GxKX7TjmlI/QIs7o9hD/BA1tQQkD+f6Ccv2chu7wiV3fGZWm6SaLAp9
qvIeG1xQ+EsGjvDeSOe6pg7RWvRrxohXvb8MhP7Tg3OOSeO7tTeckpmQ6RDS4BJgq46cutgW+wd
teEuKJDmbmWGzjeJPC6o+L1+D95W4Um/4/mkTSUyYIKr77kDNGHVZ4WNKBsSNtyT059P07wVg8
X-Google-Smtp-Source: AGHT+IHb+JIgUTS+Jy05lwbJZA4PqXBhKzT+HUFPD4/O0+x0rM7l/7JgkPmvPnA8jVqm7RQCEOc4OaSz79JZUmZz5Ik=
X-Received: by 2002:a17:907:6d0d:b0:ad5:7732:675b with SMTP id
a640c23a62f3a-ade1ab2088cmr371102566b.40.1749222228076; Fri, 06 Jun 2025
08:03:48 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250520094538.086709102@xxxxxxxxxxxxx> <20250520101727.984171377@xxxxxxxxxxxxx>
In-Reply-To: <20250520101727.984171377@xxxxxxxxxxxxx>
From: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 17:03:36 +0200
X-Gm-Features: AX0GCFv_fVC0VUzxSff7a-L_s-fxu5T2EqxzSb-EwHgZJZPdeebuweUcX02bGVI
Message-ID: <CAKfTPtDOQVEMRWaK9xEVqSDKcvUfai4CUck6G=oOdaeRBhZQUw@xxxxxxxxxxxxxx>
Subject: Re: [RFC][PATCH 5/5] sched: Add ttwu_queue support for delayed tasks
To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: mingo@xxxxxxxxxx, juri.lelli@xxxxxxxxxx, dietmar.eggemann@xxxxxxx,
rostedt@xxxxxxxxxxx, bsegall@xxxxxxxxxx, mgorman@xxxxxxx, vschneid@xxxxxxxxxx,
clm@xxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Tue, 20 May 2025 at 12:18, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> One of the things lost with introduction of DELAY_DEQUEUE is the
> ability of TTWU to move those tasks around on wakeup, since they're
> on_rq, and as such, need to be woken in-place.

I was thinking that you would call select_task_rq() somewhere in the
wake up path of delayed entity to get a chance to migrate it which was
one reason for the perf regression (and which would have also been
useful for EAS case) but IIUC, the task is still enqueued on the same
CPU but the target cpu will do the enqueue itself instead on the local
CPU. Or am I missing something ?

>
> Doing the in-place thing adds quite a bit of cross-cpu latency, add a
> little something that gets remote CPUs to do their own in-place
> wakeups, significantly reducing the rq->lock contention.
>
> Reported-by: Chris Mason <clm@xxxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> kernel/sched/core.c | 74 ++++++++++++++++++++++++++++++++++++++++++------
> kernel/sched/fair.c | 5 ++-
> kernel/sched/features.h | 1
> kernel/sched/sched.h | 1
> 4 files changed, 72 insertions(+), 9 deletions(-)
>
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3784,6 +3784,8 @@ static int __ttwu_runnable(struct rq *rq
> return 1;
> }
>
> +static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags);
> +
> /*
> * Consider @p being inside a wait loop:
> *
> @@ -3811,6 +3813,33 @@ static int __ttwu_runnable(struct rq *rq
> */
> static int ttwu_runnable(struct task_struct *p, int wake_flags)
> {
> +#ifdef CONFIG_SMP
> + if (sched_feat(TTWU_QUEUE_DELAYED) && READ_ONCE(p->se.sched_delayed)) {
> + /*
> + * Similar to try_to_block_task():
> + *
> + * __schedule() ttwu()
> + * prev_state = prev->state if (p->sched_delayed)
> + * if (prev_state) smp_acquire__after_ctrl_dep()
> + * try_to_block_task() p->state = TASK_WAKING
> + * ... set_delayed()
> + * RELEASE p->sched_delayed = 1
> + *
> + * __schedule() and ttwu() have matching control dependencies.
> + *
> + * Notably, once we observe sched_delayed we know the task has
> + * passed try_to_block_task() and p->state is ours to modify.
> + *
> + * TASK_WAKING controls ttwu() concurrency.
> + */
> + smp_acquire__after_ctrl_dep();
> + WRITE_ONCE(p->__state, TASK_WAKING);
> +
> + if (ttwu_queue_wakelist(p, task_cpu(p), wake_flags | WF_DELAYED))
> + return 1;
> + }
> +#endif
> +
> CLASS(__task_rq_lock, guard)(p);
> return __ttwu_runnable(guard.rq, p, wake_flags);
> }
> @@ -3830,12 +3859,41 @@ void sched_ttwu_pending(void *arg)
> update_rq_clock(rq);
>
> llist_for_each_entry_safe(p, t, llist, wake_entry.llist) {
> + struct rq *p_rq = task_rq(p);
> + int ret;
> +
> + /*
> + * This is the ttwu_runnable() case. Notably it is possible for
> + * on-rq entities to get migrated -- even sched_delayed ones.

I haven't found where the sched_delayed task could migrate on another cpu.

> + */
> + if (unlikely(p_rq != rq)) {
> + rq_unlock(rq, &rf);
> + p_rq = __task_rq_lock(p, &rf);
> + }
> +
> + ret = __ttwu_runnable(p_rq, p, WF_TTWU);
> +
> + if (unlikely(p_rq != rq)) {
> + if (!ret)
> + set_task_cpu(p, cpu_of(rq));
> +
> + __task_rq_unlock(p_rq, &rf);
> + rq_lock(rq, &rf);
> + update_rq_clock(rq);
> + }
> +
> + if (ret) {
> + // XXX ttwu_stat()
> + continue;
> + }
> +
> + /*
> + * This is the 'normal' case where the task is blocked.
> + */
> +
> if (WARN_ON_ONCE(p->on_cpu))
> smp_cond_load_acquire(&p->on_cpu, !VAL);
>
> - if (WARN_ON_ONCE(task_cpu(p) != cpu_of(rq)))
> - set_task_cpu(p, cpu_of(rq));
> -
> ttwu_do_activate(rq, p, p->sched_remote_wakeup ? WF_MIGRATED : 0, &rf);
> }
>
> @@ -3974,7 +4032,7 @@ static inline bool ttwu_queue_cond(struc
>
> static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
> {
> - bool def = sched_feat(TTWU_QUEUE_DEFAULT);
> + bool def = sched_feat(TTWU_QUEUE_DEFAULT) || (wake_flags & WF_DELAYED);
>
> if (!ttwu_queue_cond(p, cpu, def))
> return false;
> @@ -4269,8 +4327,8 @@ int try_to_wake_up(struct task_struct *p
> * __schedule(). See the comment for smp_mb__after_spinlock().
> *
> * Form a control-dep-acquire with p->on_rq == 0 above, to ensure
> - * schedule()'s deactivate_task() has 'happened' and p will no longer
> - * care about it's own p->state. See the comment in __schedule().
> + * schedule()'s try_to_block_task() has 'happened' and p will no longer
> + * care about it's own p->state. See the comment in try_to_block_task().
> */
> smp_acquire__after_ctrl_dep();
>
> @@ -6712,8 +6770,8 @@ static void __sched notrace __schedule(i
> preempt = sched_mode == SM_PREEMPT;
>
> /*
> - * We must load prev->state once (task_struct::state is volatile), such
> - * that we form a control dependency vs deactivate_task() below.
> + * We must load prev->state once, such that we form a control
> + * dependency vs try_to_block_task() below.
> */
> prev_state = READ_ONCE(prev->__state);
> if (sched_mode == SM_IDLE) {
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5395,7 +5395,10 @@ static __always_inline void return_cfs_r
>
> static void set_delayed(struct sched_entity *se)
> {
> - se->sched_delayed = 1;
> + /*
> + * See TTWU_QUEUE_DELAYED in ttwu_runnable().
> + */
> + smp_store_release(&se->sched_delayed, 1);
>
> /*
> * Delayed se of cfs_rq have no tasks queued on them.
> --- a/kernel/sched/features.h
> +++ b/kernel/sched/features.h
> @@ -82,6 +82,7 @@ SCHED_FEAT(TTWU_QUEUE, false)
> SCHED_FEAT(TTWU_QUEUE, true)
> #endif
> SCHED_FEAT(TTWU_QUEUE_ON_CPU, true)
> +SCHED_FEAT(TTWU_QUEUE_DELAYED, false)

I'm not sure that the feature will be tested as people mainly test
default config

> SCHED_FEAT(TTWU_QUEUE_DEFAULT, false)
>
> /*
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -2313,6 +2313,7 @@ static inline int task_on_rq_migrating(s
> #define WF_RQ_SELECTED 0x80 /* ->select_task_rq() was called */
>
> #define WF_ON_CPU 0x0100
> +#define WF_DELAYED 0x0200
>
> #ifdef CONFIG_SMP
> static_assert(WF_EXEC == SD_BALANCE_EXEC);
>
>


Return-Path: <linux-kernel+bounces-675917-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 058AA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:08:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 16B5C1898438
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:09:05 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D86C6289E27;
Fri, 6 Jun 2025 15:05:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="vy/ub6sv"
Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86])
(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 65C84289E2A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:05:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.86
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222311; cv=none; b=M+9VFgxaWZjojI5Hv/QkPBQs3I0TyQqW06NVW7ML0V1OC+Pm8Kutvo4OezsKEQv8byBVHLsX+WJQsze4FhO0i8fnLBo0D44K2okP8bYd8IhLPr0fhxLAK8QXuNVWJpfrmqQTieMYGSAXcjZtKsIkGWcOCVn6HYvbVJZAvtlDG1E=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222311; c=relaxed/simple;
bh=X++z+hQYFYN3nw3M+I3vO+WuT+TKLemBGmnnjojb3mM=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:To:CC; b=oCUlnAd6H46fT6Ngdfri+ANp+enBMVmQg73nrIHOrg2/RChUjrX2NbNzTdSYyCO4h8qeE3fapQuNBiWAFWsQ4OI69rjpkghGkyKv1UWCIgNis1N05GxbGqfNhqwbqEJcsRcHkUoFcu/KUWoE2UIH0B8rAhf93Ds6wHyQLr+pNtQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=vy/ub6sv; arc=none smtp.client-ip=91.207.212.86
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com
Received: from pps.filterd (m0168888.ppops.net [127.0.0.1])
by mx08-00376f01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565hD2J006948;
Fri, 6 Jun 2025 16:04:44 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc
:content-transfer-encoding:content-type:date:from:message-id
:mime-version:subject:to; s=dk201812; bh=SMsHjoH5Q2nG0ifgBRmmw70
aAn/K1FaIdIXnVF9bSm8=; b=vy/ub6svoGkvMYJU5GwFa81XZKREJGkiGofK+XL
bmhRbtSlNBhyXA8Ch9gmOqGfuk22RjfZiqIXRjlbzh/p3rKp1qODLmRLrggA9FaR
2bM4PNsnTlVL8NyFNnpQ81NVVlaQF3sGTdkCK+xB5/ETL+69u4rEPhWLYE4a203L
/voI8GZQe2KrKsOqP0pGTu6Am7dITuArtM2jhS+HtzEt0kMN9juun9N2qLcDiYna
qkOU0btTXWOkJ+TT0cBrEIodZgftA7/E8Ztm/yL0X/dN4mrvXm0eRMggdgRmVcMT
6Q4i0jMkVIRB0UG9AfqWz5qJG23yNQg+KTMGkPtQtTvmXFw==
Received: from hhmail05.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141])
by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 46yr1s63k6-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT);
Fri, 06 Jun 2025 16:04:44 +0100 (BST)
Received: from [127.0.1.1] (10.100.108.37) by HHMAIL05.hh.imgtec.org
(10.100.10.120) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Fri, 6 Jun
2025 16:04:43 +0100
From: Alexandru Dadu <alexandru.dadu@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 16:04:34 +0100
Subject: [PATCH] drm/imagination: Reasoning code comments for Sparse
warnings/errors
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-ID: <20250606-sprase-reasoning-comments-v1-1-433c0ff11a09@xxxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIAIEDQ2gC/x3MywrCQAxG4VcpWRuIYzteXkVcDPW3ZtFMSYoIp
e/u4PJbnLNRwBVBt24jx0dDqzUcDx2N72ITWJ/NlCQNkiVzLF4C7ChRTW3isc4zbA1Gf5HcD6d
0liu1fnG89Pt/3x/7/gOOxCkpawAAAA==
X-Change-ID: 20250606-sprase-reasoning-comments-e48064532709
To: Frank Binns <frank.binns@xxxxxxxxxx>,
Matt Coster
<matt.coster@xxxxxxxxxx>,
Maarten Lankhorst
<maarten.lankhorst@xxxxxxxxxxxxxxx>,
Maxime Ripard <mripard@xxxxxxxxxx>,
Thomas Zimmermann <tzimmermann@xxxxxxx>,
David Airlie <airlied@xxxxxxxxx>, Simona Vetter <simona@xxxxxxxx>
CC: <dri-devel@xxxxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
Alexandru Dadu <alexandru.dadu@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=3309;
i=alexandru.dadu@xxxxxxxxxx; h=from:subject:message-id;
bh=X++z+hQYFYN3nw3M+I3vO+WuT+TKLemBGmnnjojb3mM=;
b=owEB7QES/pANAwAKARW10uOFNYqiAcsmYgBoQwOKkbBZi/rxufPpXkC9fyJL/1bwCQRSpKVdS
a+8gzrCL6mJAbMEAAEKAB0WIQS9+pJTOgt5GeXoStwVtdLjhTWKogUCaEMDigAKCRAVtdLjhTWK
ol55C/48yg+Qgz4D9kRy6vfYEv/WDC8kbF01pPaGOOITCi8/0OFVbE/iZ1MZR8QE3ni+bRYXa1F
hjW5+smCiN23unWDNI57tY0QpzAU+Q+UgGpDF+MEkuzzNEgNHtoZnxaLBCHvJmCFYqpROLoHDBN
ynh43FHaqUl2TpyXDuOBprzX8cwBwD/QPgB6uYe3aZZfrSq7ickkzU7jXfxBK7WmkaSouBjTBll
YDiwj9s2j9BrmUEJYLSbbIef0VIE3IB9pS/oTqfNqQeT5lduRvyLNg74k2lE+Q9H3cvBrvljJWy
QxHenKbb8D+VpGvOU4CYMQxuLYldBGjDaQq8bQxmeNc4FmarTVRhj6K3saSKpw09ieMBNT/0mIP
gR7nvp3KFZPJBmvKefnlL4oWHm7eG6r/G3MUGRIOUGLbuYJhxpiMimW1bHR5R+LpZs42Bbb8QG4
JxKQ38PsA8dPWIexGqMStHC45R26keJ1AI8P/fgkT9hc2GuvQem042i8PyJXYsa2rJJGY=
X-Developer-Key: i=alexandru.dadu@xxxxxxxxxx; a=openpgp;
fpr=BDFA92533A0B7919E5E84ADC15B5D2E385358AA2
X-EXCLAIMER-MD-CONFIG: 15a78312-3e47-46eb-9010-2e54d84a9631
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzMyBTYWx0ZWRfX6wFwHCYW2OnI +bGai4RlOcjZxumrnGXQc+kh2O9+/qFI2Wfuzbt3KDViAvc/qb7IazvHLfWF7JMNHHh1fhCLssI LwfSU8zk3/xOqZM1l9hc427JySvJb0Dib4qKcbQDU8kw6oVvqp1MXEleyHTNybZjS7zrzGS/ijZ
Fni7aYfZNFvpoik9MeM62aVzdxUnmWE7ALpeIqJ0f+2eNrg5qe7rHq193BBcOwG9HIim6RodaPi jDgW+rxNDlsdArdoxryYxM5tq/V4wOHRSEGrRxeV0D9cFlvrKI6isYB8LiE96RvYt/GY1WPIBEN Djdyc8lcRZTI69xXL2c/yivyXrFvx9EJ0uOM+2hEMKrPe+VikIoLSHunSVUj9y17Ch60Xat7vN8
qNm3g2qRrjlYU16pj50JQI4WCV4KxLizfpFf9j4+nZT9V85q9TY31xXUzNrTI5OG3cfokdRl
X-Proofpoint-GUID: PsfeHOxNl8A2KxD9JuUdMlum11DxwHG8
X-Proofpoint-ORIG-GUID: PsfeHOxNl8A2KxD9JuUdMlum11DxwHG8
X-Authority-Analysis: v=2.4 cv=ENAG00ZC c=1 sm=1 tr=0 ts=6843038c cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=WWlI6AgWcwAA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=r_1tXGB3AAAA:8 a=s9JQ9v9PLfxFY4fmZf8A:9 a=QEXdDO2ut3YA:10
a=t8nPyN_e6usw4ciXM-Pk:22
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Added code comments for the lines that might generate Sparse
warnings/errors.
The warnings/errors cannot be fixed with refactoring without masively
impacting the whole code implementation and/or they are incorrectly
generated by Sparse.

Signed-off-by: Alexandru Dadu <alexandru.dadu@xxxxxxxxxx>
---
drivers/gpu/drm/imagination/pvr_rogue_fwif_check.h | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif_check.h b/drivers/gpu/drm/imagination/pvr_rogue_fwif_check.h
index 51dc37e78f41d7bdf45d1f434dd1aa5b9eca700a..96a423f34c639581a745a7c0498b82d601680ca6 100644
--- a/drivers/gpu/drm/imagination/pvr_rogue_fwif_check.h
+++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif_check.h
@@ -157,6 +157,20 @@ OFFSET_CHECK(struct rogue_fwif_frag_ctx_state, frag_reg_pm_deallocated_mask_stat
OFFSET_CHECK(struct rogue_fwif_frag_ctx_state, frag_reg_dm_pds_mtilefree_status, 4);
OFFSET_CHECK(struct rogue_fwif_frag_ctx_state, ctx_state_flags, 8);
OFFSET_CHECK(struct rogue_fwif_frag_ctx_state, frag_reg_isp_store, 12);
+
+/*
+ ******************************************************************************
+ * SPARSE warning reasoning: SIZE_CHECK(struct rogue_fwif_frag_ctx_state, 16)
+ ******************************************************************************
+ *
+ * The structure rogue_fwif_frag_ctx_state contains a flexible size field.
+ * The SIZE_CHECK will run a static_assert function over the structure and it
+ * will use 'sizeof' over a flexible structure.
+ * The implementation of the flexible size field is there by design and cannot
+ * be refactored in a way thet doesn't impact key features.
+ * To avoid having the sparse warning this argument can be used when triggering
+ * the sparse check from the build command "-Wno-sizeof-array-argument"
+ */
SIZE_CHECK(struct rogue_fwif_frag_ctx_state, 16);

OFFSET_CHECK(struct rogue_fwif_compute_ctx_state, ctx_state_flags, 0);
@@ -484,6 +498,20 @@ OFFSET_CHECK(struct rogue_fwif_hwrtdata, rtc_dev_addr, 264);
OFFSET_CHECK(struct rogue_fwif_hwrtdata, owner_geom_not_used_by_host, 272);
OFFSET_CHECK(struct rogue_fwif_hwrtdata, geom_caches_need_zeroing, 276);
OFFSET_CHECK(struct rogue_fwif_hwrtdata, cleanup_state, 320);
+
+/*
+ ******************************************************************************
+ * SPARSE error reasoning: SIZE_CHECK(struct rogue_fwif_hwrtdata, 384)
+ ******************************************************************************
+ *
+ * The structure rogue_fwif_hwrtdata contains different memory alignment
+ * attributes for its fields.
+ * The SIZE_CHECK will run a static_assert function over the structure to check
+ * the size. The compilation will fail if the SIZE_CHECK fails.
+ * SPARSE seems to treat the alignment attributes in a different way than the
+ * compilation does since the compilation is not failing.
+ * This SPARSE error over this line should be ignored if it pops up.
+ */
SIZE_CHECK(struct rogue_fwif_hwrtdata, 384);

OFFSET_CHECK(struct rogue_fwif_sync_checkpoint, state, 0);

---
base-commit: 217f80acfcf126b7d7d7b818c9bfea3c96fa85ec
change-id: 20250606-sprase-reasoning-comments-e48064532709

Best regards,
--
Alexandru Dadu <alexandru.dadu@xxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675918-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A6AA241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:09:09 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 5F8191895131
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:09:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BF3A28937A;
Fri, 6 Jun 2025 15:07:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Hve9braA"
Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14E9719D07A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:07:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222434; cv=none; b=MMp6SUdHIdl9DsKLLFTG0rYzAAa4JdGtWsgAGPGWonNgmXSSh8woilj3UjHDY8Y2zLTZocUu9KAW6IDcW6xUVJg4Vd0SjtIoSQ18wSwHlZA2QxA7TSksX3NXEY8hshUJsC4ailRLEYsM8mopVPc//6vjzMp6a2AIVu5QH26N/h0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222434; c=relaxed/simple;
bh=ADVJJCRcmD0mLAlYAE92zYCKME0YhADfudgXzeyCt+4=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=o7fIF0msBoHQQu3AWHYbXdctv68jotM0YeVFfzzTWQO3FLRT2DJeXf1I7hPjAyNl4+75AaCGRI/pXJhQ5aTS/hIoP4zj1jG4V787JfSbzD/YilIA9/7V/wkHM/1o5Gtq32M+JIKhoCmrtQmbGgqUreluKh+VCmCqYkMlYvD4uKc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Hve9braA; arc=none smtp.client-ip=209.85.218.48
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-adb47e0644dso493771966b.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:07:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749222431; x=1749827231; darn=vger.kernel.org;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=Pc/SK1Fvfl7qYXo204AzZDmTFG30IXxvBddG6FvY2z4=;
b=Hve9braA/Xw2ZtkTjBqpKh1ShWZQe0+Kj2zPfQSihjN+7rzlCIqzRSBj13BhEG4JOJ
FC1S2PHg6yWK3G1JyaU/Z3clV9VkIw2OeCYQiGnh5ldadlpRbE11vTFMw+f8vKbY58MW
hH9Vc7lw474waRGL23HF6DksydN1F/p0RhoWnPwHcD3NSt8uSkoa+Rknjtesu66hLKHW
MB1CFsvR3ADgQWWYnckAaRvZ5AOLNXSYUtXRKY614f6ew+JHfbIxFiBg3SpNcJLO2mnL
SvQjJvVz+ybzrW0X63shQ6A5Iamexypiv4XK53ul4VCYuJSpnnuRSAFIaoZDEBmt6ovK
LHOQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222431; x=1749827231;
h=in-reply-to:content-disposition:mime-version:references:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=Pc/SK1Fvfl7qYXo204AzZDmTFG30IXxvBddG6FvY2z4=;
b=cbvCYEh63xf2FhSImd9TiNGTMw8zYOidnrUkhTA4F8zV9H1MK+SDvuzpjy99xM4oEt
2nEAcjZGy+t6ytyU6rjepEMhMXVapx9mitGfZgwaR1oDP0O9qNdvo98aLLb9+6qGleA5
l2LVhUucvJAjGty96R8yTxARTkXGOA4PGP2RIFdQsLc93/pmBvKsgqWXTD69lMr4HIMY
Enb0U4j6MdnLoCJ9j/JU1Srlgnscyy91CIB572H/vRTQXmpHMGkaRM0OE6D17bIrAOnr
szMsA8Yf5wHG9SWNk2cc072hf9mQ0YwhgTunnmLw0LTfNH00snzFeof45bKyw/khrfxE
vMuw==
X-Forwarded-Encrypted: i=1; AJvYcCU/SDf50tA9aW8ZnY4Ki37gIEZGL64ESnRcL3YMes+9enhj5MD6i+SRl5G3IxAQGfLyT49Aq38+Ye8Uzk8=@vger.kernel.org
X-Gm-Message-State: AOJu0YyQduc/6rveu4f7IDl0hIDVrsKmqiVHrdhsQS4mKhgPobiokv8t
cPrSRsSNVV4l0oFFFoOV/eCU8FNFgsX5a/crEbVOsm6ExEvTeVacmVAzkHgDyQ884sA=
X-Gm-Gg: ASbGncuBBg58dtKcI+mB75a47jxIMf9nYd181rXesY8YAkCOCWcbMdqU5Am9vbx9hcx
2fe2veZVCCy+NoAlv+7DcDYzrI2IoHqs8OmaColC8TV7FYo4ycj/7MQPJ7tLXJ9gTBGWtDaUVOW
8CorJX88lePiX6SYK0NXoOyiHjnWnogek196PXiErXCeCD/YE684S19gHHvYjA0q8taZoASYIDk
ewkAL1bZPjDiP47I7TUcmxpb8lqx2hvWlYFSezdVZyS6vS7pxd7nRLip6V10JxWrVMeUZ43HSYx
onYmvQZVhkczpCnPIy5HWco4gw+1vu1uN0XrvcyOCtTuLHJCo7965XjxUQVj/4c8s4rzDisEtg=
=
X-Google-Smtp-Source: AGHT+IHAKCgU6k68iC6QxjWSvfB5F/Whj3LvE9iYIb5LO7mQImUC1Ui1uT3AEHCwbJX5msacoU1mJA==
X-Received: by 2002:a17:906:830f:b0:ade:31bf:611c with SMTP id a640c23a62f3a-ade31bf657cmr104820766b.9.1749222431322;
Fri, 06 Jun 2025 08:07:11 -0700 (PDT)
Received: from linaro.org ([2a02:2454:ff21:ef30:fec5:df29:72db:ff36])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1d7542c8sm130047266b.21.2025.06.06.08.07.10
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:07:10 -0700 (PDT)
Date: Fri, 6 Jun 2025 17:07:05 +0200
From: Stephan Gerhold <stephan.gerhold@xxxxxxxxxx>
To: quic_utiwari@xxxxxxxxxxx
Cc: Thara Gopinath <thara.gopinath@xxxxxxxxx>,
Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>,
"David S . Miller" <davem@xxxxxxxxxxxxx>,
linux-crypto@xxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, bartosz.golaszewski@xxxxxxxxxx,
quic_neersoni@xxxxxxxxxxx
Subject: Re: [PATCH] crypto: qce - Add suspend and resume support
Message-ID: <aEMEGZhGamnRD6_I@xxxxxxxxxx>
References: <20250606105808.2119280-1-quic_utiwari@xxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606105808.2119280-1-quic_utiwari@xxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 04:28:08PM +0530, quic_utiwari@xxxxxxxxxxx wrote:
> From: Udit Tiwari <quic_utiwari@xxxxxxxxxxx>
>
> Add basic suspend and resume callbacks to the QCE platform driver to
> manage interconnect bandwidth during system sleep and wake-up cycles.
>
> Signed-off-by: Udit Tiwari <quic_utiwari@xxxxxxxxxxx>

Can you add runtime PM support instead, so we can also reduce the
bandwidth/power consumption at runtime when QCE is not used?

Also, what about the clocks? They should also be disabled, not just the
bandwidth.

Thanks,
Stephan

> ---
> drivers/crypto/qce/core.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index e95e84486d9a..2566bdad5d4a 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
> @@ -249,6 +249,21 @@ static int qce_crypto_probe(struct platform_device *pdev)
> return devm_qce_register_algs(qce);
> }
>
> +static int qce_crypto_suspend(struct platform_device *pdev, pm_message_t state)
> +{
> + struct qce_device *qce = platform_get_drvdata(pdev);
> +
> + return icc_set_bw(qce->mem_path, 0, 0);
> +}
> +
> +static int qce_crypto_resume(struct platform_device *pdev)
> +{
> + struct qce_device *qce = platform_get_drvdata(pdev);
> +
> + return icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH,
> + QCE_DEFAULT_MEM_BANDWIDTH);
> +}
> +
> static const struct of_device_id qce_crypto_of_match[] = {
> { .compatible = "qcom,crypto-v5.1", },
> { .compatible = "qcom,crypto-v5.4", },
> @@ -259,6 +274,8 @@ MODULE_DEVICE_TABLE(of, qce_crypto_of_match);
>
> static struct platform_driver qce_crypto_driver = {
> .probe = qce_crypto_probe,
> + .suspend = qce_crypto_suspend,
> + .resume = qce_crypto_resume,
> .driver = {
> .name = KBUILD_MODNAME,
> .of_match_table = qce_crypto_of_match,
> --
> 2.34.1
>


Return-Path: <linux-kernel+bounces-675916-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9515B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:09:29 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2F5793B31E9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:08:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E1B6A289E34;
Fri, 6 Jun 2025 15:05:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YpCV2m3l"
Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44C6B288CBA;
Fri, 6 Jun 2025 15:05:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222309; cv=none; b=VX08g7VwcDycF7XHI/1uC/i/9ox8ZdDEEyxqG2Ca8+eYo2X/Rpp8toMVxcs2ddZjgWzg4go9ssxIpl/5blvUpLoxC4rB/XfTbRJ3HCpZ9J6n5KzR/okIvL0a9H9tZEMIfamzX4Nb/qTICfIiVOCmX/7e6jlM0O2tJnYacFbsY8Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222309; c=relaxed/simple;
bh=gJtT0Tn2PpQSNzJ2Th229/jPzi9ZJ2Ls6N/5fNjLzI8=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=Y2jyv3Dy4iyS3Sns25AfIGZ3eNQhAt7noExVSe3SolIdJ+znoSw8bRmwHqUIErxCkoHN62wyp92zyyvszmbDRGwIRMsrOrJ4JXON+eY9k5+xxdRgxyy5goXK5pmttGbklnc51c+3LsksPTKZZWWO6t1fbBx+btok4aHwuXLIg/A=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YpCV2m3l; arc=none smtp.client-ip=209.85.208.179
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-3105ef2a071so25108781fa.1;
Fri, 06 Jun 2025 08:05:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749222305; x=1749827105; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=5NhdrlgztzgpE1Xk+Zp4kkuAyeJA1EIIswOLXPfRZyk=;
b=YpCV2m3lvJOOefyFXL82qLH4EogGzFVPWK9M8oCN07Fic9U7v1tEDkXt95WXzFVp2q
AZDqK0FCG7MzzPHmPUjQPmXUAbZgNouTnIp5tagkakj56oeYlHsiGL+3yo8c79yJE7PO
IJFdUCYvA5b4PzBIzpxkhCjNNb3mzTJQceauLyOCTZ1kWVLEzbJ7v5HsxuKcaMGb5ur5
ViGhjhBniksIIE0WnkZ0tc7Hs8QS2TL01fzz5Q2a4MYQlb+9CSlU/HkQ7pGFL/s9mzgI
lIj8nefnfKImlYYhGGTlYFZDY10CHofyH/hQo1HZe2iMzTHFByKPREy2qo0vhHXmfXNA
ZKIg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749222305; x=1749827105;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=5NhdrlgztzgpE1Xk+Zp4kkuAyeJA1EIIswOLXPfRZyk=;
b=D/r0sXxjiDPejZlzps9G3ilCEbEvTYSvDAx64WWhcFDnDrS0S4+TR0d4qY1wB+WiOt
4G9NRTP7vg4iAAZqG3Nh6bTi/tmO4iKCgHTU2ygoo2tnqj+ZxrAUY/ut0au5H1OSypXd
wWSKyOmGXBBg7dUoMIeXNNckYrgEUw6lSGRinV32nvO1jr4WijaY0+18ThfRb/D5hVsH
6lxTvMdDoal+yBKtHmF+cEZXHLKLmhkv4J/ylH7CgWPrmzErv+Rmsn16y2Eq0eBWOnIt
Ay9ykoQ09X5qvq/aA76X3phalOS3wqzqwrYChIouR23P0IguNyHJL2XDuzZQlq5BIt2n
zPzg==
X-Forwarded-Encrypted: i=1; AJvYcCVpnz/sqc4ziP30JMqf1mF5/86NlBjG9sC5CTwS3dZsxiDCXn/RK/L9LEtFucp2GiNjTPcbCczEbTYo6L8=@vger.kernel.org, AJvYcCXFTPRoCf6NacWolkDBNPEi2swHImLx+ElfCn/cuMSNyCIHDOUiwLNKxBoO97ZoWa+jqzwuQoVK@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YyRkgFQ3toitz6kVAbx6arHiWeQr+PeG0vxFVm3f96g1Ii1M9nA
Y7cSSrOaK95eBU4qeEj4qlsNTrdt7iDE8t+yM3MFx4bfXMD2m4Pnv2TXYa4Luxx2ASAvLFdKc1a
fG6GYWeXeT85xG2tgKkSA4rpT3y2dVCs=
X-Gm-Gg: ASbGncs+0PRWoxPzBMHuIrAk596EMmTM5A5+VrS7XNAWkxnCKPtleL/vifMG7a43c46
SotbBoho6faYhN140m0Y0JswMrJG7tgVWvcWMTRTMxvza9eYfJ2OS90iz6e9lO83Mv6JIu7el3I
id+tEpfZpcNbhbLhE3bQh4+2z6LJ7nRVbLkYNOIXKfFOEn8LKDYnjzpvi2rlnirV86j1AybzAje
8INuw==
X-Google-Smtp-Source: AGHT+IH78G8M0elhu6vNm3wt3JuGbGuw0AvHq4vu10oYAIAXshUAr7D1SoCJMauU898LZIj0vl45j514wQ0JYhgZ68o=
X-Received: by 2002:a2e:a7ca:0:b0:32a:88b5:7b3e with SMTP id
38308e7fff4ca-32adfeec0bemr8720921fa.41.1749222305096; Fri, 06 Jun 2025
08:05:05 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250602135932.464194-1-pranav.tyagi03@xxxxxxxxx> <2025060239-delirium-nephew-e37c@gregkh>
In-Reply-To: <2025060239-delirium-nephew-e37c@gregkh>
From: Pranav Tyagi <pranav.tyagi03@xxxxxxxxx>
Date: Fri, 6 Jun 2025 20:34:53 +0530
X-Gm-Features: AX0GCFvdMphOgp8NP2z6BCJwn33AWaLDf2vr9-l3CqvYDu4QUg76FhA0esJXBe4
Message-ID: <CAH4c4jKrYsyVi_g=bem2bGmH1Y95mRkKPApqbQbWZXkQuVWtDQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] net: randomize layout of struct net_device
To: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: andrew+netdev@xxxxxxx, davem@xxxxxxxxxxxxx, edumazet@xxxxxxxxxx,
kuba@xxxxxxxxxx, pabeni@xxxxxxxxxx, horms@xxxxxxxxxx, keescook@xxxxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
skhan@xxxxxxxxxxxxxxxxxxx, linux-kernel-mentees@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Mon, Jun 2, 2025 at 8:50=E2=80=AFPM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>=
wrote:
>
> On Mon, Jun 02, 2025 at 07:29:32PM +0530, Pranav Tyagi wrote:
> > Add __randomize_layout to struct net_device to support structure layout
> > randomization if CONFIG_RANDSTRUCT is enabled else the macro expands to
> > do nothing. This enhances kernel protection by making it harder to
> > predict the memory layout of this structure.
> >
> > Link: https://github.com/KSPP/linux/issues/188
> > Signed-off-by: Pranav Tyagi <pranav.tyagi03@xxxxxxxxx>
> > ---
> > include/linux/netdevice.h | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> > index 7ea022750e4e..0caff664ef3a 100644
> > --- a/include/linux/netdevice.h
> > +++ b/include/linux/netdevice.h
> > @@ -2077,7 +2077,11 @@ enum netdev_reg_state {
> > * moves out.
> > */
> >
> > +#ifdef CONFIG_RANDSTRUCT
> > +struct __randomize_layout net_device {
> > +#else
> > struct net_device {
> > +#endif
>
> Are you sure the #ifdef is needed?
>
> thanks,
>
> greg k-h

Hi Greg,

No, the #ifdef is not required since __randomize_layout is defined
as a no-op when CONFIG_RANDSTRUCT is disabled.
I rechecked the documentation to confirm this.
Thanks for pointing it out!
I will remove the #ifdef and update the patch before resending.

Regards
Pranav Tyagi


Return-Path: <linux-kernel+bounces-675919-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A0FB341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:11:00 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 47EF217BF0C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:10:00 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8537428937E;
Fri, 6 Jun 2025 15:09:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="i2FeXr7j"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10])
(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 F311013EFF3;
Fri, 6 Jun 2025 15:09:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.10
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222577; cv=fail; b=sbqNSDf+xt0H+Wm7vEvjWuR5tMnciDY+4ZdeeaE6ZjK2vbk9Z+GMe6+FCF/cJ8XFSO7cA9HfItWIdUuYZOpM+QMaBmiA8PkAsO29GLUzlaUMOONbbDAGODbdcgTzcjZgQHVVkSgvWu3xenLLn8ucM2HP5Y2BIhMNbpvMCE+YxZE=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222577; c=relaxed/simple;
bh=+ZN3nZPDeAoC5NkSAjZNLLG2RILW9RerPeZRZ7NrXXs=;
h=Date:From:To:CC:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=S//spe8BVOKIH/0uHUGJrohPoKmWwjKRXO2eLXMWiyrvbEnto8kehBdBd0efcRgeZi9C+6PY911GsGSl4PWHo0BHx2EWmT83FBlD9Vt+T0gJ3/zH56qTXSmd5QIMcT6Y4Bjazh084sgO7+vH74qAjTBdNbT3hBLCm/F84P4XMW4=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=i2FeXr7j; arc=fail smtp.client-ip=192.198.163.10
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749222575; x=1780758575;
h=date:from:to:cc:subject:message-id:references:
content-transfer-encoding:in-reply-to:mime-version;
bh=+ZN3nZPDeAoC5NkSAjZNLLG2RILW9RerPeZRZ7NrXXs=;
b=i2FeXr7jN7n9yY+QjJe2CDxkXCYAWv5YNTsf6X0zx7jebQ2GeJWNNh3o
TXgjzvImPKQMfPvFuRO6ayDush5m5lBb6eUfGMLotsjJAVMLtZoTNZ1U4
hjBDNuOMArZ/EWtbpMtm9jxfa3wWlPc3Nyj4VXDnCbvJnadStOnvMWyfk
KeAjhmSDxuvMYDoy61b2s0pIIZUpYqEKxED56nOIdt0zNpp8h8wy9/lXe
hfy9g4WyQzXaCNPrsiQJGek+XvIwImApLn9hi7J8MEOJglbX32rxaPGvP
M61tnjnJeugHoGkxz2baB0zmIMtrzfayJVw1kTcaVeXnNhWLM30PStOXH
A==;
X-CSE-ConnectionGUID: x8sDMec5RZyvLKlKC8CliA==
X-CSE-MsgGUID: tRiG/8FJTWKKpC+GVd/2Iw==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="62734014"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="62734014"
Received: from orviesa003.jf.intel.com ([10.64.159.143])
by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:08:34 -0700
X-CSE-ConnectionGUID: zKqOytjLREaAokSXA7g2yw==
X-CSE-MsgGUID: Vh1hEcIcTyCO2A5BCp1YyQ==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="150685917"
Received: from orsmsx901.amr.corp.intel.com ([10.22.229.23])
by orviesa003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:08:33 -0700
Received: from ORSMSX901.amr.corp.intel.com (10.22.229.23) by
ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1544.25; Fri, 6 Jun 2025 08:08:32 -0700
Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by
ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1544.25 via Frontend Transport; Fri, 6 Jun 2025 08:08:32 -0700
Received: from NAM10-BN7-obe.outbound.protection.outlook.com (40.107.92.56) by
edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.1.2507.55; Fri, 6 Jun 2025 08:08:29 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=CUAMc0zcaBiTFHZPdAJe0K2hmZGQGASrWAMonAVvdkxCMiKi/DsKZTQFrzokWRd7Fwh8+KfLwA++s1QeyQgYsYCcM7g+jxEb+0NJwHV+Qn2W1ULoHqZp58KOPqIfXrHBxGSvloBUuNuX4VzA3J8bkV7NRH+9vkhoSNuVQGr/tOYrRJyDQEuXFNbTnD3BBr+mkKlmvQUknOgPNcNWm+0Gb7CdgPjIYs9ByU6gXnkeR14Rs+PdCTrZGBTryjGVO0euGSeH7ER9QkO8I46tSSod5VXDyLuALl/SNWJOQX4fGnY2MWWir6CjQE1iYgj+2n4cwYgMgTyNm4ytgS4TFqUkxQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=kLNlnXDl/suLR42cmko/CHaJV2RTszdMAaLL9q5ARM8=;
b=cMd70QCpn/TASaDov+7GH6uTkEP/rMh2y2MLP94kk/f5amYlsrT/3yKrc16SBS+pFNsG52x5g0yfkRyLYf7gkGN/X6oCe7pvtU/ueFoFJIMbnbkRw6Q1X7gj7hLWFkIZgSkNNzZAfP52i/gBGrY3F3PGlpxdF2S5dCDfbRgsB53nebJfyA9RxTldMWOhnrdka+xq7ooMr64lw8XVfowHVSmMqrlj7Tcc1QDrUceZq8quJfLmzcBTKhUuhzihQh8u5FSoDcXH6lmfXXjcFdtZlIobfz3lK5slu3NxLqboJRALkHkbxxd4V8FnXMlqU6EkdoJjIw2NET610E5Nqn4J/Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
dkim=pass header.d=intel.com; arc=none
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=intel.com;
Received: from PH3PPF9E162731D.namprd11.prod.outlook.com
(2603:10b6:518:1::d3c) by CH0PR11MB8189.namprd11.prod.outlook.com
(2603:10b6:610:18d::13) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.22; Fri, 6 Jun
2025 15:08:24 +0000
Received: from PH3PPF9E162731D.namprd11.prod.outlook.com
([fe80::19ef:ed1c:d30:468f]) by PH3PPF9E162731D.namprd11.prod.outlook.com
([fe80::19ef:ed1c:d30:468f%4]) with mapi id 15.20.8813.021; Fri, 6 Jun 2025
15:08:24 +0000
Date: Fri, 6 Jun 2025 10:09:11 -0500
From: Ira Weiny <ira.weiny@xxxxxxxxx>
To: Paul Moore <paul@xxxxxxxxxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>
CC: Ackerley Tng <ackerleytng@xxxxxxxxxx>,
<linux-security-module@xxxxxxxxxxxxxxx>, <selinux@xxxxxxxxxxxxxxx>,
<kvm@xxxxxxxxxxxxxxx>, <linux-mm@xxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<x86@xxxxxxxxxx>, <linux-fsdevel@xxxxxxxxxxxxxxx>, <aik@xxxxxxx>,
<ajones@xxxxxxxxxxxxxxxx>, <akpm@xxxxxxxxxxxxxxxxxxxx>,
<amoorthy@xxxxxxxxxx>, <anthony.yznaga@xxxxxxxxxx>, <anup@xxxxxxxxxxxxxx>,
<aou@xxxxxxxxxxxxxxxxx>, <bfoster@xxxxxxxxxx>, <binbin.wu@xxxxxxxxxxxxxxx>,
<brauner@xxxxxxxxxx>, <catalin.marinas@xxxxxxx>, <chao.p.peng@xxxxxxxxx>,
<chenhuacai@xxxxxxxxxx>, <dave.hansen@xxxxxxxxx>, <david@xxxxxxxxxx>,
<dmatlack@xxxxxxxxxx>, <dwmw@xxxxxxxxxxxx>, <erdemaktas@xxxxxxxxxx>,
<fan.du@xxxxxxxxx>, <fvdl@xxxxxxxxxx>, <graf@xxxxxxxxxx>,
<haibo1.xu@xxxxxxxxx>, <hch@xxxxxxxxxxxxx>, <hughd@xxxxxxxxxx>,
<ira.weiny@xxxxxxxxx>, <isaku.yamahata@xxxxxxxxx>, <jack@xxxxxxx>,
<james.morse@xxxxxxx>, <jarkko@xxxxxxxxxx>, <jgg@xxxxxxxx>,
<jgowans@xxxxxxxxxx>, <jhubbard@xxxxxxxxxx>, <jroedel@xxxxxxx>,
<jthoughton@xxxxxxxxxx>, <jun.miao@xxxxxxxxx>, <kai.huang@xxxxxxxxx>,
<keirf@xxxxxxxxxx>, <kent.overstreet@xxxxxxxxx>, <kirill.shutemov@xxxxxxxxx>,
<liam.merwick@xxxxxxxxxx>, <maciej.wieczor-retman@xxxxxxxxx>,
<mail@xxxxxxxxxxxxxxxxxxxxx>, <maz@xxxxxxxxxx>, <mic@xxxxxxxxxxx>,
<michael.roth@xxxxxxx>, <mpe@xxxxxxxxxxxxxx>, <muchun.song@xxxxxxxxx>,
<nikunj@xxxxxxx>, <nsaenz@xxxxxxxxx>, <oliver.upton@xxxxxxxxx>,
<palmer@xxxxxxxxxxx>, <pankaj.gupta@xxxxxxx>, <paul.walmsley@xxxxxxxxxx>,
<pbonzini@xxxxxxxxxx>, <pdurrant@xxxxxxxxxxxx>, <peterx@xxxxxxxxxx>,
<pgonda@xxxxxxxxxx>, <pvorel@xxxxxxx>, <qperret@xxxxxxxxxx>,
<quic_cvanscha@xxxxxxxxxxx>, <quic_eberman@xxxxxxxxxxx>,
<quic_mnalajal@xxxxxxxxxxx>, <quic_pderrin@xxxxxxxxxxx>,
<quic_pheragu@xxxxxxxxxxx>, <quic_svaddagi@xxxxxxxxxxx>,
<quic_tsoni@xxxxxxxxxxx>, <richard.weiyang@xxxxxxxxx>,
<rick.p.edgecombe@xxxxxxxxx>, <rientjes@xxxxxxxxxx>, <roypat@xxxxxxxxxxxx>,
<seanjc@xxxxxxxxxx>, <shuah@xxxxxxxxxx>, <steven.price@xxxxxxx>,
<steven.sistare@xxxxxxxxxx>, <suzuki.poulose@xxxxxxx>, <tabba@xxxxxxxxxx>,
<thomas.lendacky@xxxxxxx>, <vannapurve@xxxxxxxxxx>, <vbabka@xxxxxxx>,
<viro@xxxxxxxxxxxxxxxxxx>, <vkuznets@xxxxxxxxxx>, <wei.w.wang@xxxxxxxxx>,
<will@xxxxxxxxxx>, <willy@xxxxxxxxxxxxx>, <xiaoyao.li@xxxxxxxxx>,
<yan.y.zhao@xxxxxxxxx>, <yilun.xu@xxxxxxxxx>, <yuzenghui@xxxxxxxxxx>,
<zhiquan1.li@xxxxxxxxx>
Subject: Re: [PATCH 1/2] fs: Provide function that allocates a secure
anonymous inode
Message-ID: <68430497a6fbf_19ff672943@iweiny-mobl.notmuch>
References: <cover.1748890962.git.ackerleytng@xxxxxxxxxx>
<c03fbe18c3ae90fb3fa7c71dc0ee164e6cc12103.1748890962.git.ackerleytng@xxxxxxxxxx>
<aD_8z4pd7JcFkAwX@xxxxxxxxxx>
<CAHC9VhQczhrVx4YEGbXbAS8FLi0jaV1RB0kb8e4rPsUOXYLqtA@xxxxxxxxxxxxxx>
<aEEv-A1ot_t8ePgv@xxxxxxxxxx>
<CAHC9VhR3dKsXYAxY+1Ujr4weO=iBHMPHsJ3-8f=wM5q_oo81wA@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAHC9VhR3dKsXYAxY+1Ujr4weO=iBHMPHsJ3-8f=wM5q_oo81wA@xxxxxxxxxxxxxx>
X-ClientProxiedBy: MW3PR06CA0029.namprd06.prod.outlook.com
(2603:10b6:303:2a::34) To PH3PPF9E162731D.namprd11.prod.outlook.com
(2603:10b6:518:1::d3c)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PH3PPF9E162731D:EE_|CH0PR11MB8189:EE_
X-MS-Office365-Filtering-Correlation-Id: 8879f3e8-f363-4255-2726-08dda50bfb7d
X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014;
X-Microsoft-Antispam-Message-Info: =?utf-8?B?NG9YUzZOeUVnV21UaWs1c3dqazFKUDJTQ2dHQkF2Qm9abDhkODVabkIxQXM0?=
=?utf-8?B?RWVhc1JNYU9tZW9seEdvRUYva1dRVjE2VFpSSVplclRCZ2dRQmo0V1pPYVBP?=
=?utf-8?B?TVp4OVRUUTB0TTkwVU1Yb01xTk9Pd1MrUU91KzQ3aWE4aHA4UkdRM25yUDl3?=
=?utf-8?B?aGFkOHlGUlRyKzFJZ2I4Um9kZEdCYklsWG9wemtDZmVDVjc0ZDRYczBuNWxF?=
=?utf-8?B?UktabFBaZndzMUxuMS80MXVRTm1DZ1BWQ25xSzNPbk1RMnRGaWpkNjE0c2lu?=
=?utf-8?B?cWhQK3U4blhsWXRENUtEUHh2RHVSNzdEU1hZZUlGMGk0c2tDTEV5TkNRVmtp?=
=?utf-8?B?dVh0cTlaRmo0RWlDQ1JSUXZKN1Era05iZzVBVmRCdjhQcDhYOHJrVm81VEpw?=
=?utf-8?B?V0FPM3hnU0hXTW1EOVliZmxXQnRJYzNzTlYxajlIZ0dTOGN4cFB0VlZDQ2tM?=
=?utf-8?B?TWtibXg5Mzl6SzZQVjdWZEZETVBHQlY1T2FmVWUxNElZT0E0U0hHbFBldEhS?=
=?utf-8?B?Zkk2UzBnUnJQejVqWUJZbTc2NFVWR05IK0x4NHJyc0hneTlmVE9JT0paRmts?=
=?utf-8?B?MjBkWTRYd1YzYm15cjREa3FSQTRVSDZiQ00yajY5MmdNQkV1azdObjlnVVBQ?=
=?utf-8?B?eEttR2EyOFVyVCsvalFBWWZJRlAzV2h2eW5WaGZ2Tm9ZZTRlTWMvdVB0RXJK?=
=?utf-8?B?ZWJpVEV6TGhWQ2Q1cnFmWllRQWJEeTJ1OVVvS0hMcnpjdG8xMGRmOTgvMFh5?=
=?utf-8?B?bTVwU25rSGhDSjJ6VFIxSlF4bFZ2VkoyVFR4OThUcWxab3lwRE94ZHE3Z3dF?=
=?utf-8?B?UzE5b2R4ZVhxT1daUWYramFqUDFUUmwxRmw4QStSL2lGZnN4TEdONEFIalJx?=
=?utf-8?B?Q1V1b2xCTUw0eGJHbHhZMElnbTE2UWZYd3FpeVlUMWx0UXdVWVpOaEE5NU13?=
=?utf-8?B?MmN5T1g5aXZPMitJUlFLZ1piWGpNVU1rQXVyN1F2YUVoOE84Vk9adUxzRGty?=
=?utf-8?B?ekdTS05oTldabVRGSjVPMkZOM1hCMTlxYnlob1RJS0lYNXc3RU1ER1dZczlC?=
=?utf-8?B?clRUYmFvUVVQVWVnVFFwZitSYXNsS0N0WC9Qbys2aWp1aEJFU2FRRXozcW81?=
=?utf-8?B?NkMvNXprS3BiYjZDbFdzaHRKVUhEWGJDa0p5Qmc4V3h4elJRa01WZVBXNzEv?=
=?utf-8?B?S0RhL3VmMEJ2M3NzKzV5bXEzS3Q1STFxWmVIT2ZmaFczdVJqRlJaa2Z0Rlkz?=
=?utf-8?B?NURGNmswVE8yd2lmeXovc0VSRVhxS0J6cGZrRG5UQjdaZGowUzk1QUZoMit5?=
=?utf-8?B?Ky90SnhvZlZOYk9Ec0srenJZUmlQUko0UE9pamREQ1ZaQXFraU1BZExZY3pq?=
=?utf-8?B?RFE1Rzg1OUpBU2VTYXphWWJhMnZUOHRjSEE4SFNIZk5CS2VjbndoN2tkVzNW?=
=?utf-8?B?eWRQSnFFbmJFWjYxYkgxN0RsVXd0dVF2SGczbnMwMXNyeG1oYlVnbVIybTlC?=
=?utf-8?B?ZWRCMy9OZDVTN2VCNnMwcXFCSUlIdnU1SzZNVCtLVHV2U1BMRGZhYU0zbmw4?=
=?utf-8?B?WUVIcUFraWpzSllrRzhCSm5rbzZoR2Y4WTE3bGRiWXNYS2Y4OTlndmVNOEly?=
=?utf-8?B?Z1ltK05jUklteTB6aTY5dkJHQTIwdkNLY0xuOXF1ZGRWSWFwOG9ieGVDRlg0?=
=?utf-8?B?L0ZjeDNCVE5ybWZDUnBkTHNBUWJwY25NZ3Nkb0k1emZ6NjltUE1oMDlqbkNn?=
=?utf-8?B?Mmp5M0U5MWJIM2ZRZXBxVGRBTC9SaUdhNTdudHJ0UUd1V3N5YndCcGJmbG9Y?=
=?utf-8?B?WURrNVozdUUxZWhDb3BVNVgxRER2L2lIRmxWSEhZSDRBQ0RVZWNRRkV2OXND?=
=?utf-8?B?NlNWemk5VGJheEVKa0tXSDJkVHY2a3ZqUC8vNFZiZmNRR2wrUlUxYlR1Tjg2?=
=?utf-8?Q?ejqlLHZlmT0=3D?=
X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH3PPF9E162731D.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QXRTS3dpSktWc2Q0eHhuRUp3NTlsa3JhNW1qeDlER0hKVmN3cllBSGVGYkJY?=
=?utf-8?B?YjB2L1pwS2Vwdm4wVWhraXJnTHAvVG42RVNJbm5ENUEvSGR3SXhVTmxrcHF4?=
=?utf-8?B?NU1RMXhKNkhtMXlrazhHMXZHbEQvbHVmUjBjOVI3QVRESU5QT2FiSUIwcGlE?=
=?utf-8?B?NXdNeFk5V2QwVjhOand6L3FYZFhqVGM0YVlPLyt4dVBlK3NIeGovWm01OFBN?=
=?utf-8?B?S0dpeEpuOTg5SXZWc3hkQ01UeVFjcXhVT1dXdnNjN1NkK0hRc25QekdMcWti?=
=?utf-8?B?a2JGU3ZmaE9ZRWFvQjJDNFl4ZTIxWXphSW5RNkhvcTVXL3VidVFDZ2kyNVBx?=
=?utf-8?B?aE9HYTN0dHVEeXp2dWRMRldYeHFmWVZvUHI3c21KcDRkQk9GSWp3d0FSTnZt?=
=?utf-8?B?Y2VhSFllQmdLZERmSjQzMnNSa3FBcEVWbzhSYlFXZW1hczZrZjMzRSsyZGFX?=
=?utf-8?B?L2hZZzlvZ1R3OG8rNVZNU1dnK3dTWVRzdk5sNHhjL2Q1dWJsWXhPMmNxV2lH?=
=?utf-8?B?MUpTV0tOWEYyQ0x3WnpYWkNMcDlTMVNIdFptRnoxVGp6MXIxN3hIeW5RYVd4?=
=?utf-8?B?UnIxanZsUDhrTkROdGtlU3dJb3AzVElVNDBkNWF6OHlIV3hwTStwTFdudkFH?=
=?utf-8?B?anFITjU0WHdQUjU2VWZPaHczd1lhTU1xbEFRMTlwYXdmOHdnRGRTUHRydnlh?=
=?utf-8?B?QnFPTnpGeVRjWHNGb1NWSE5QYTgwSGVIdVJaQXJ2Y052VFYwSzVGQWhsTnVx?=
=?utf-8?B?R1YwcXd0cm9PamFleXBCT2tyVWorcXJSZlJRVmp3MlRhY2VOU0cvbFh6b3hM?=
=?utf-8?B?bllQQWt4NGlnZnFHNGdwT1UzQWcxU0ZzWGFXYXBvMmxkb0tJQ0l6dVF3UmFI?=
=?utf-8?B?dTl4VGRGSllyU3lOZllTZzlqTlFGRTQ3N3I5dmFQdXF6RWxIdnNROFBZWk4y?=
=?utf-8?B?ekpEa25DMmFzVmVtVnI0QWtDa0kxdk5CK3pJWnlZb2l2T1BIcUtnRUtuZytS?=
=?utf-8?B?ZTJpQSszNGlza1JUYXRuU2VqeXFTMGdtc01NcjJFR3NPeERoUUVkeHg2aFJi?=
=?utf-8?B?Rlk3aHJjZTcvTUxYRCtOT2pxR1VtbmFqcTZ6cmxTbFVJaWc4MHN0S1ArTnVN?=
=?utf-8?B?TlVadDBPUHRLNURsbE5JVDd6ZzhuVWwvak9aNmNtMUtEUzRkczJHQ0ttc1lC?=
=?utf-8?B?WTFDRy9JcVJuRE9JQ2VBbnQyM3JqbWlqOVB0Ni9IOGg1SFMzd2Y5d1I5Smwv?=
=?utf-8?B?dUlvU3RhL2NhQU5GTFVzelpLVWpURFRCZ0E2UmtDM3ZPOVFpaDl6VTlkcUU1?=
=?utf-8?B?eDhxaG1zRGowbTBPUERmSFFSN1NpTnNhNTR4bEt0RHdZSHFyY24rWU1wTG03?=
=?utf-8?B?RjRPZjVhdzBUdy9lLzJOaFlVRnNZN0ZFWklZUXFieFoxWGZ6M0h5UnkyMUxZ?=
=?utf-8?B?S0ZzV0JXMW8xbmJRTnBCTFlKYXBjKzJhVTlsSzVwYmoxQVdHNUdPZG9xb3ds?=
=?utf-8?B?eDF2T05FSWtUdGJHblBGZi9xamhLQUhCTHAyYVA0TXdXdW9ubnI5enkzZzJh?=
=?utf-8?B?S1RldDlHZnU5dFU0Y0FtSmltVnhKcUVyaktib3pDYUpjRm1DRWNKZUF4UlpC?=
=?utf-8?B?aFJSbFZWRGRSM3VUOTBBSWZvREVIOFVUQXI3WlVBSUVIV2ZaS3Fmc1FlYUd4?=
=?utf-8?B?VGVoVHNhaGpBdkU0SXc4UFd2eWt2d0tQbXM1Vml4a2MvUlN6S3NlazUydEZV?=
=?utf-8?B?R1FQRHFseGJCVmZTWXVKZDBEbHVlSWhIN2NPaWNxRnpPTHlUK2E3dDNsd0RH?=
=?utf-8?B?UG8xWWkrb2c2UEc2TVcvRTJBelQwbmN4RzJ5d0xIQ01iNjlnaHhJanBva211?=
=?utf-8?B?cCtVS1lWV3hRekpua2xCRXlLLy90dS9PU0p0RXhzL1NyUXJkMkNQSlFKMmsr?=
=?utf-8?B?MDZ2ZmxJbi9yOGNPQUhmc0d4Y25BNmJidS9FU2xMNjlrMDRLMmpYdmF0cU4v?=
=?utf-8?B?c2NCV1BDZnFtR2JjNzQ5bmxncU14TWd0T0VmbGE1NCtCZnZlREdQR2FjTnRy?=
=?utf-8?B?ZUYzK0pYTW8wWXhMWTZXTnkwOG9SYkpmY0c0bHZhTGlBcXllTlZSYTZMUmpr?=
=?utf-8?Q?bma9UEVsn1FwE3c4C3wrqehYI?=
X-MS-Exchange-CrossTenant-Network-Message-Id: 8879f3e8-f363-4255-2726-08dda50bfb7d
X-MS-Exchange-CrossTenant-AuthSource: PH3PPF9E162731D.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 15:08:24.1769
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: e+l5m7VssgHlA3vwz9cL3VbgzGMq8qupU3WvoWRKM83XQJNsD8Xk4ibsiF/hollSDOqxi5PGBhZkkf+pH3hkWA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR11MB8189
X-OriginatorOrg: intel.com
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Paul Moore wrote:
> On Thu, Jun 5, 2025 at 1:50â?¯AM Mike Rapoport <rppt@xxxxxxxxxx> wrote:
> >
> > secretmem always had S_PRIVATE set because alloc_anon_inode() clears it
> > anyway and this patch does not change it.
>
> Yes, my apologies, I didn't look closely enough at the code.
>
> > I'm just thinking that it makes sense to actually allow LSM/SELinux
> > controls that S_PRIVATE bypasses for both secretmem and guest_memfd.
>
> It's been a while since we added the anon_inode hooks so I'd have to
> go dig through the old thread to understand the logic behind marking
> secretmem S_PRIVATE, especially when the
> anon_inode_make_secure_inode() function cleared it. It's entirely
> possible it may have just been an oversight.

I'm jumping in where I don't know what I'm talking about...

But my reading of the S_PRIVATE flag is that the memory can't be mapped by
user space. So for guest_memfd() we need !S_PRIVATE because it is
intended to be mapped by user space. So we want the secure checks.

I think secretmem is the same.

Do I have that right?

Ira

[snip]


Return-Path: <linux-kernel+bounces-675920-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DA44641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:14:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id B640C1892C31
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:15:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 10A5828934B;
Fri, 6 Jun 2025 15:14:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YHe0HCfa"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4239045009;
Fri, 6 Jun 2025 15:14:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222879; cv=none; b=umX9XfxyjUonr82wbOfhkVwCtrtpxloeJrpHVY1tIe2B/flpICP+h7BE30ME9qfeSRi5t7oXuVyKC4tGlgh1A4DKYbAxJxxL17UUmDxLL3ETapqiYonCkvv1+OO2RYL1jt6iOtPppNjfbU1RLmCGoOytgY9cbQvgMut06fVjUuY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222879; c=relaxed/simple;
bh=i6FYWVz+2Y+2+RafxhFes1KyUuzU/moaSG0EciA6/jw=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=MmtRUt1W9F4BZH4KDoscOCbbjTV51ZKS9F91fVDm796r9ZE542oKPSdnU4grjVweGiukIFV2ygh4kcl4SemfcoRQWf1pHcjgm99OWRSWKGiZLHrKNW+A0Wye5XYJhn+uzjOiq3hM+ETBdTyne4C+fpHO8b41RlfRWS8uS7uwbVc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YHe0HCfa; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id E29FFC4CEEB;
Fri, 6 Jun 2025 15:14:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749222878;
bh=i6FYWVz+2Y+2+RafxhFes1KyUuzU/moaSG0EciA6/jw=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=YHe0HCfaDw7jxWz7zqEzpf9IvXPUJLEgJ57nu7o+6x2rCp98WEHH+TVYBt1rJ1vb6
ZTN+gDHKZXor+5KWdz4m42ekz4xEKsnfaV/vprfAKFgMj17DwjpwxmUglVtcjh/DSP
0S/XEMWsp4bV0+2KcBX1R/rOLLfrTGXcuv2da/DZ10erAbeCTfgGNDwBUn8rVaBBgG
ZoxoIAxmCE13Q696nfS8e3PrA9inYXIH2iRAxgk39jjIdHhcadxkuGc6mbbYsbm+61
DWHBJiVPkX3OfsT2JY8PYIHaERkvNtZz2q8KeX8utiDsnmjoOD9DpuO2mGcAnryF4B
qgGxe2rlsu5Vg==
Date: Fri, 6 Jun 2025 17:14:31 +0200
From: Danilo Krummrich <dakr@xxxxxxxxxx>
To: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Cc: Igor Korotin <igor.korotin@xxxxxxxxx>, Miguel Ojeda <ojeda@xxxxxxxxxx>,
Alex Gaynor <alex.gaynor@xxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>,
"Rafael J . Wysocki" <rafael@xxxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
rust-for-linux@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-acpi@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?iso-8859-1?Q?Bj=F6rn?= Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>,
Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Len Brown <lenb@xxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>,
Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>,
Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
Subject: Re: [PATCH v2 3/5] rust: driver: Add ACPI id table support to
Adapter trait
Message-ID: <aEMF18wLMoCNAxFN@pollux>
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605162726.3659792-1-igor.korotin@xxxxxxxxx>
<aELyEqg0GrkC8oZY@pollux>
<CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx>
<aEL76mgHSZG5idW8@pollux>
<CAG7QV91kkVqE2BgB5VpmX7QST25VDCqr+9zNx1Nt0-fuwp9t=A@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAG7QV91kkVqE2BgB5VpmX7QST25VDCqr+9zNx1Nt0-fuwp9t=A@xxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 03:58:11PM +0100, Igor Korotin wrote:
> On Fri, Jun 6, 2025 at 3:32â?¯PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
> >
> > On Fri, Jun 06, 2025 at 03:26:13PM +0100, Igor Korotin wrote:
> > > On Fri, Jun 6, 2025 at 2:50â?¯PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
> > > > However, I don't understand why we need this and the subsequent
> > > > is_acpi_device_node() and is_of_node() checks.
> > >
> > > The idea is to avoid unnecessary table lookups when both OF and ACPI
> > > match tables are present.
> >
> > Ok, that's fair -- let's build it on top of the FwNode abstractions though.
>
> I'm ok with the FwNode abstractions. Just to make sure I understood
> you correctly:
> I'll need to wait until these FwNode abstractions are pushed to the
> rust-next branch, reimplement what is necessary and send v3. Is this
> the course of actions?

Not all Rust code goes through the Rust-for-Linux tree, it depends on who
maintains the code. For the FwNode and device property series I pointed you to,
the code is maintained by the driver-core maintainers and hence will go through
the driver-core tree [1].

(You can always check the corresponding entries in the MAINTAINERS file, they
document, who maintains a file and which tree changes go through. For
instance, if you want to know this for a specific file, you can run

./scripts/get_maintainer.pl path/to/file

and the script tells you everything you need to know.

In general, before submitting patches you should run this script on your patches
to find out who you should send them to.)

However, there is no need to wait until the FwNode and device property series
lands in driver-core-next, you can just fetch the patch series from the mailing
list and build your patches on top of that.

If you do this, you should make sure to mention the exact series you build on
top of in the cover letter, ideally with a lore link to the specific version of
the series.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git/


Return-Path: <linux-kernel+bounces-675921-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DCAC341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:15:32 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 74A1D3AD3BF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:15:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A2FB2868A5;
Fri, 6 Jun 2025 15:15:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O9GYbl9q"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96EEA14C5B0;
Fri, 6 Jun 2025 15:15:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749222924; cv=none; b=asspCn5MHpQyF/PlceiEy2n1mhwLLUjlKKKyOehDdKPnZ07GjIXPJ1IZBGuvQmp3hOPTK5ZasOUbGVjtBZsEJBX304L7cGQ1R2+/JT9hCQT753sg41kyYFGdv+0rMx2A8Q8+PQZvBL7aOoAd2aVccHCxC1UUj7oBMR1CcNL1hJU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749222924; c=relaxed/simple;
bh=HpLZ1rPClxi7MC6tDS7NrB9TQE+s3gTEHmZEc2dNsRk=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=diYEXzERd8oS7cYhSuGBW8dsAq46jKJ0OF8HX6rnwlnFF5x5K9vg9UZMW+dbN9Bt5zNFF5XDm1ijsrPyKfUBL6lUiX40JcpfNMgKGr2yMXyfzJhkktA18VN3XzsaPA3NF3fxmZSETByC5/x+gAdbmkOP47N8i5HLuWHcoFu2Gmo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O9GYbl9q; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBAF6C4CEEB;
Fri, 6 Jun 2025 15:15:21 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749222924;
bh=HpLZ1rPClxi7MC6tDS7NrB9TQE+s3gTEHmZEc2dNsRk=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=O9GYbl9qwgykRIFjSKYPk4F/tbiiyI2s25RztmlY5I8KfxA9mv0MV17oTpL9v+AG6
i9OG06zP0svvVex+7zeLRRY1QZ+ssd44RFn5y942ceUuU8ydMOTYFU7GNS63zMujUh
QRcCmgEZEaO8rQ34q3EkDJ3VgVzDQB2zmr1lQYfFMV4k/SHkVUcKChsd5cGg1bFrqy
qssB/YNHGL0VVyQVcGXvCPRY/eu1vLGV75EH6Pu+DNyRmEB4vri669WOmp/5L3NJcJ
u3EQ0HQgNYQD/U3MBP++4/BUW8iwaMmPMrFOLi5RdhRwqnYdwNnEjtUKJwnioviDG1
edESQmeIyeKGg==
Date: Fri, 6 Jun 2025 16:15:19 +0100
From: Conor Dooley <conor@xxxxxxxxxx>
To: Victor.Duicu@xxxxxxxxxxxxx
Cc: dlechner@xxxxxxxxxxxx, nuno.sa@xxxxxxxxxx, linux-iio@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, robh@xxxxxxxxxx, jic23@xxxxxxxxxx,
krzk+dt@xxxxxxxxxx, andy@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
Marius.Cristea@xxxxxxxxxxxxx, conor+dt@xxxxxxxxxx
Subject: Re: [PATCH v2 1/2] dt-bindings: iio: temperature: add support for
MCP998X
Message-ID: <20250606-unfeeling-legacy-c7eab453b062@spud>
References: <20250529093628.15042-1-victor.duicu@xxxxxxxxxxxxx>
<20250529093628.15042-2-victor.duicu@xxxxxxxxxxxxx>
<0f68e3f9-cba5-4df3-8e56-2cccbccf35ce@xxxxxxxxxxxx>
<20250530-dramatize-camisole-0a1aa9a38281@spud>
<91c1d757a4ac051c115a821779a8c1fba764ea05.camel@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="rOBXgDHc5asVEnsI"
Content-Disposition: inline
In-Reply-To: <91c1d757a4ac051c115a821779a8c1fba764ea05.camel@xxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--rOBXgDHc5asVEnsI
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Jonathan,

On Mon, Jun 02, 2025 at 02:48:52PM +0000, Victor.Duicu@xxxxxxxxxxxxx wrote:
> On Fri, 2025-05-30 at 16:55 +0100, Conor Dooley wrote:
> > On Thu, May 29, 2025 at 01:13:38PM -0500, David Lechner wrote:
> > > On 5/29/25 4:36 AM, victor.duicu@xxxxxxxxxxxxx=A0wrote:
> > > > From: Victor Duicu <victor.duicu@xxxxxxxxxxxxx>
> > > > +=A0 microchip,recd12:
> > > > +=A0=A0=A0 description:
> > > > +=A0=A0=A0=A0=A0 Enable resistance error correction for external ch=
annels 1
> > > > and 2.
> > > > +=A0=A0=A0=A0=A0 Omit this tag to disable REC for channels 1 and 2.
> > > > +=A0=A0=A0 type: boolean
> > > > +
> > > > +=A0 microchip,recd34:
> > > > +=A0=A0=A0 description:
> > > > +=A0=A0=A0=A0=A0 Enable resistance error correction for external ch=
annels 3
> > > > and 4.
> > > > +=A0=A0=A0=A0=A0 Omit this tag to disable REC for channels 3 and 4.
> >=20
> > Why are these two devicetree properties, rather than runtime
> > controls?
>=20
> The parasitic resistance added to the series resistance is dependent
> only on the circuit.=A0
> It is possible for the chip and the transistor to be at some distance
> from each other. The manufacturer can approximate the error added and
> decide if resistance error correction should be applied.

I don't think I buy this line of argument. The property is not
describing the hardware, it's literally being used as a toggle for some
software feature. It'd be more acceptable if it indicated that the chip
and transistor were distant, leaving software to make a decision on what
that meant. One user (say bsd) might want decide that the driver should
always enable it, but another (say linux) might expose it as a control
to userspace defaulting based the dt property.
Additionally, the name of the property is pretty awful, and does not
even hint at what it's doing - and there's no mention of why channel 1/2
and 3/4 are bound together.

> The user cannot influence the parasitic resistance nor calculate it.

I don't think that's super relevant here, since the property has nothing
to do with influencing or calculating the value. I meant deciding whether
or not the correction is applied, just as the dt property you propose
does now.

Cheers,
Conor.

--rOBXgDHc5asVEnsI
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaEMGBwAKCRB4tDGHoIJi
0pxQAP9tTTrVpJUEVSo8w2luowpdXWHkIwEmzGJRQxsvWHLAqQEA7cPYTT2cxcpC
2oWW2XnwxZ6f/4UpPGb81sV59m7imwg=
=SSGP
-----END PGP SIGNATURE-----

--rOBXgDHc5asVEnsI--


Return-Path: <linux-kernel+bounces-675922-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B7B6E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:17:10 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 04DED1898DE8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:17:20 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B5B4288C3A;
Fri, 6 Jun 2025 15:16:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Y6GTTxAI"
Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5])
(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 CB62513D52F;
Fri, 6 Jun 2025 15:16:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223014; cv=none; b=UIb6fucQLXooTEcpS+3yDXciBaEXw3OphYlZjkMHz2c734y7841L7LNVfRinjAZR/DZbgm/6WvJ5Pizh9gFh5GeoAjkLXhMLSV0eLggpvjGWfoaEje6wKVP4FbUpNx3ae74YUxuow4VwUo3gfngzvnYpFMHnowbF9BMstdwJDx4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223014; c=relaxed/simple;
bh=bMcoQZ8/56NkiSi6ldpCU2xHO/U+BegQxxASRAkiQqY=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=Z9qtYqX7lnhRNRvyjxkJsTdZZADK6pKol2gIzow49IHDmW+qX1ShCrkRFMTX7WfESV7XpfHlbuuUvGI8/tMpR5wQ+JOnyISYLLliG0xZE1/3t6MMqVPwz2sLVcc6AH/ydyABO4v3CFeShI627IQgImLpEWATmE1DZcvCbxtr/M0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Y6GTTxAI; arc=none smtp.client-ip=148.163.158.5
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com
Received: from pps.filterd (m0353725.ppops.net [127.0.0.1])
by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556DRAn9032703;
Fri, 6 Jun 2025 15:16:32 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=pp1; bh=SznduB
7uZbB2TupeB0XlulVyY8Rgk+W8Ehae2oY7ceE=; b=Y6GTTxAIFQWQlF31NbTc5E
T0ZUbm+qQx39BmBDGD1J+qVov1GCE2WXdnG7URSUetlJ1S2/LXCvwWcP3NXZS0xZ
nwSuj1iXhNfBq9uJJUZEE8C0gMio+1KEAhlM5QtU/frwOtwypW/ps77Dw53FZ6Cw
bVa6Tj5KujgvWkSRKLEJLqmO+VkQM60HU1heFx32saFcYlo66J0sm3b/gAkD4hWH
bzhuvrAWHmZKpD9E/6UatVpHV1tJXm181X7NoHS+dNEddYL+48e+qH9tzARQ+eLK
nK7lb/8fiXt8+MYEG2iyqxw9YAbNUgoG8oB42qVbLU1jhYz6dh5+6fuNHgwKERZg
==
Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93])
by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 47332yru34-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 15:16:32 +0000 (GMT)
Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1])
by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 556BdQkI024914;
Fri, 6 Jun 2025 15:16:31 GMT
Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8])
by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 470dkmsxsf-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 15:16:31 +0000
Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229])
by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 556FGUL421234430
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 6 Jun 2025 15:16:31 GMT
Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id A7D7158059;
Fri, 6 Jun 2025 15:16:30 +0000 (GMT)
Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id AA04958058;
Fri, 6 Jun 2025 15:16:24 +0000 (GMT)
Received: from [9.67.149.38] (unknown [9.67.149.38])
by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP;
Fri, 6 Jun 2025 15:16:24 +0000 (GMT)
Message-ID: <041186c7-a249-4564-979c-3e480aadaa23@xxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 20:46:22 +0530
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH RFC 3/4] dm-stripe: limit chunk_sectors to the stripe size
To: John Garry <john.g.garry@xxxxxxxxxx>, agk@xxxxxxxxxx, snitzer@xxxxxxxxxx,
mpatocka@xxxxxxxxxx, song@xxxxxxxxxx, yukuai3@xxxxxxxxxx, hch@xxxxxx,
axboe@xxxxxxxxx
Cc: dm-devel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-raid@xxxxxxxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx,
ojaswin@xxxxxxxxxxxxx, martin.petersen@xxxxxxxxxx
References: <20250605150857.4061971-1-john.g.garry@xxxxxxxxxx>
<20250605150857.4061971-4-john.g.garry@xxxxxxxxxx>
Content-Language: en-US
From: Nilay Shroff <nilay@xxxxxxxxxxxxx>
In-Reply-To: <20250605150857.4061971-4-john.g.garry@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-TM-AS-GCONF: 00
X-Proofpoint-GUID: zfauzWNZU7Fhnw5fbhqBnJ3WZz4ZokBJ
X-Proofpoint-ORIG-GUID: zfauzWNZU7Fhnw5fbhqBnJ3WZz4ZokBJ
X-Authority-Analysis: v=2.4 cv=SO9CVPvH c=1 sm=1 tr=0 ts=68430650 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=H49iAnPEzUvt3JwDqx0A:9 a=QEXdDO2ut3YA:10
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzMiBTYWx0ZWRfXzHp/c9A8vlDS ayOHWFRgdS0HJWnzKg+fvUE3XNFE5d8qw35o3/l8GuKe9CFK7YTWYq6ljJk2VBoraFptL4IEVse itmjoeBC9QZ0SXvcY3YuFwXz1GniImC2TewbiPzjf0mA6KrSHdfuMU7T4INGzTkVEO1UlL7mgIi
iHcpkPgrqzDIIKbM/sZFXiZbQbmhV/BYbK36gJ4TL7tqVwIiHsBErpSJobu+H3aGm0dPH3DDG9o HcmjLM9PMa7PNEtLSWzBfP8dyiyCmg2GVYyWsyJXP2ERYnbQCLnOt2awPIVfjMDDjFooQgNsrXg xrYC+aCMYl46wrDarZEHCCl25LPx4KQtWgKwk7ZpNcTGBtBjY7F7mdraAj+Kz7/DUhTpmXi/YLz
z1/BOl1I1fEee4heF5fqJ9pzrXJmjjg+Nc9sX8mUs5A47wQjRBnM4w0UZbHN6Y0kO+CL5yMR
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0
impostorscore=0 phishscore=0 priorityscore=1501 adultscore=0
mlxlogscore=999 clxscore=1011 spamscore=0 lowpriorityscore=0 bulkscore=0
mlxscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060132
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/5/25 8:38 PM, John Garry wrote:
> Currently we use min io size as the chunk size when deciding on the limit
> of atomic write size.
>
> Using min io size is not reliable, as this may be mutated when stacking
> the bottom device limits.
>
> The block stacking limits will rely on chunk_sectors in future, so set
> this value (to the chunk size).
>
> Introduce a flag - DM_TARGET_STRIPED - and check this in
> dm_set_device_limits() when setting this limit.
>
> Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
> ---
> drivers/md/dm-stripe.c | 3 ++-
> drivers/md/dm-table.c | 4 ++++
> include/linux/device-mapper.h | 3 +++
> 3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
> index a7dc04bd55e5..c30df6715149 100644
> --- a/drivers/md/dm-stripe.c
> +++ b/drivers/md/dm-stripe.c
> @@ -466,7 +466,8 @@ static struct target_type stripe_target = {
> .name = "striped",
> .version = {1, 7, 0},
> .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_NOWAIT |
> - DM_TARGET_ATOMIC_WRITES | DM_TARGET_PASSES_CRYPTO,
> + DM_TARGET_ATOMIC_WRITES | DM_TARGET_PASSES_CRYPTO |
> + DM_TARGET_STRIPED,
> .module = THIS_MODULE,
> .ctr = stripe_ctr,
> .dtr = stripe_dtr,
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index 24a857ff6d0b..4f1f7173740c 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -430,6 +430,10 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
> return 0;
> }
>
> + /* For striped types, limit the chunk_sectors to the chunk size */
> + if (dm_target_supports_striped(ti->type))
> + limits->chunk_sectors = len >> SECTOR_SHIFT;
> +
I think here "len" refers to the total size of dm target and not the
chunk sectors. So we need to modify this and take into account chunk sectors..
We can get chunk sectors, for example, like this:

struct stripe_c *sc = ti->private;
limits->chunk_sectors = sc->chunk_size;

But again struct stripe_c is private to dm-stripe.c and so we can't access it
here directly in dm-table.c Better we add a new callback function for dm target
type under struct target_type and then use that callback to get chunk sector.

struct target_type stripe_target = {
...
.chunk_sectors = stripe_chunk_sectors,
...
}

Thanks,
--Nilay



Return-Path: <linux-kernel+bounces-675923-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 35D3641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:17:32 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1160B1720D4
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:17:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 051DB28937A;
Fri, 6 Jun 2025 15:17:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="elql2HZ9"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3659C1991CD;
Fri, 6 Jun 2025 15:17:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223039; cv=none; b=clHcnHU8qjN46dD/pp27yh0iKu7kEjb6PfAKuryLsqWlVB9xG4WhMcGOYIp7jm6JTXLHzWef8h4JMiut9OvFHwCCmZHHF9SM3vsP2KHioE1W1yzitPAkN1W5ZR6UMe2mZFXzE2QXiyMNgviwfW2yWRFYrVP12MzzaInmSbXedYE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223039; c=relaxed/simple;
bh=SZEx9/PHTlU/AzqfimMF/aQJ07Zs92TCTW3A11T2ll8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=UatNr9gkddD2FbpUzuCEs4Kr+aiA3av0rWvks8ohVoyYyQzOaBsv7KJBvW3S041k6mGqMyYlE15hwj4t9og/79tudkLdkkWNnkex/KOTFYRu7mooNKNu6/V/rdgaHuUHy0tRLw5fzD9qbLl7VSVStAxZob9YYwbc8oFpZUSvbVI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=elql2HZ9; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD22CC4CEEB;
Fri, 6 Jun 2025 15:17:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749223036;
bh=SZEx9/PHTlU/AzqfimMF/aQJ07Zs92TCTW3A11T2ll8=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=elql2HZ9+gtHvY35GtOiYx0rdbcugqG9COKyiBsqE5u6G+ZselZNyCQ8ifregkx4G
IRcbvbJ4gTPuV41LzVDKLVzMLjYd5y17Zkaipl7FmdbGRidLBFxthV9r/KJbMU+IfK
oYQ7dqeS3IMJHFI/PbkXxvWkNHAC69iRfdhkH2MTc9oqyNCBs9FtUYDho32eIzZ/NM
wxeLIT1CGY8ZZnFpjmD7SiWzphak9SvJuWRHhkmd6QvXRheckOHlqCQ6msL/mD2SVX
3OAyZTBpzNj5idhrC7qtgJqrLKwNvYHcr6zcZdHrgmsOMpWUJf0pnn4TIFZ6hnmCSg
cR2KpwDw/ocXg==
Date: Fri, 6 Jun 2025 16:17:11 +0100
From: Conor Dooley <conor@xxxxxxxxxx>
To: Frank Li <Frank.li@xxxxxxx>
Cc: Vinod Koul <vkoul@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, Shawn Guo <shawnguo@xxxxxxxxxx>,
Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>,
Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>,
Fabio Estevam <festevam@xxxxxxxxx>, Marek Vasut <marex@xxxxxxx>,
"open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" <dmaengine@xxxxxxxxxxxxxxx>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" <devicetree@xxxxxxxxxxxxxxx>,
"open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" <imx@xxxxxxxxxxxxxxx>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>,
open list <linux-kernel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH 1/1] dt-bindings: dma: fsl-mxs-dma: allow interrupt-names
for fsl,imx23-dma-apbx
Message-ID: <20250606-unending-rockband-fabcdaed87a4@spud>
References: <20250523213252.582366-1-Frank.Li@xxxxxxx>
<20250526-plural-nifty-b43938d9f180@spud>
<aDcw0sgN1ZX0kCCZ@lizhi-Precision-Tower-5810>
<20250530-those-frequency-f8106275769f@spud>
<aDnYpeViGvIsGCLD@lizhi-Precision-Tower-5810>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="LWyb0P04RKgeQbRs"
Content-Disposition: inline
In-Reply-To: <aDnYpeViGvIsGCLD@lizhi-Precision-Tower-5810>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--LWyb0P04RKgeQbRs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, May 30, 2025 at 12:11:17PM -0400, Frank Li wrote:
> On Fri, May 30, 2025 at 04:24:51PM +0100, Conor Dooley wrote:
> > On Wed, May 28, 2025 at 11:50:42AM -0400, Frank Li wrote:
> > > On Mon, May 26, 2025 at 04:28:07PM +0100, Conor Dooley wrote:
> > > > On Fri, May 23, 2025 at 05:32:52PM -0400, Frank Li wrote:
> > > > > Allow interrupt-names for fsl,imx23-dma-apbx and keep the same re=
striction
> > > > > for others.
> > > >
> > > > The content of the patch seems okay, but why are you doing this? Wh=
at is
> > > > the value on this particular platform but not the others?
> > >
> > > Actually it is not used in dma driver, i.MX23 is quite old chips (ove=
r 10year).
> >
> > If they provide no value, why not just delete them?
>=20
> The platform is too old. I have not hardware to test if it really unused.

oh well,
Acked-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>

--LWyb0P04RKgeQbRs
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaEMGdwAKCRB4tDGHoIJi
0rfRAP0d1c7CjpWwGCBbFeIXDYjKjS0gYWoeInijKrMbsrTAEwEA7zYVo1MkZANM
Jf3bucvpJep13y2QUVEkdnRbqqP5+A0=
=2oX8
-----END PGP SIGNATURE-----

--LWyb0P04RKgeQbRs--


Return-Path: <linux-kernel+bounces-675924-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 87CA841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:18:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id AC6CF172551
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:18:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 740A327FB02;
Fri, 6 Jun 2025 15:18:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ZNTsRwcU"
Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40])
(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 C400713D52F;
Fri, 6 Jun 2025 15:18:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.40
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223121; cv=fail; b=DqNs5jbczMBVjb+QujBs95pqx8PVo29R1L7u9YbrjjdiBRhZOr1HqfekZ2IHpoXcO2uxeL6miZTv4/XcMYOEBaXajYjDet75vZsDA9klLVOv2HW3q/Kp73sjF0q5LOs0DcMdiMQXb/GF4mEs/V7PAfZp+SoBH4Zz+UbMFLQOe3M=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223121; c=relaxed/simple;
bh=NffLlTwbMLTvPVSFKp3ezzNhlo9WuiwKEbpWfe5LuNM=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
Content-Type:MIME-Version; b=CPnIZQkWzF3AoWZibfOzzFoM1JGZec24Ohp2PPwCiNXXx86Hto7NOy7VBUF8gwpw8YF7fT9Rb8xVEXhR4bLbLWZaqMNqKaGkoztKVKRhfh09Eb+qbwnWwUGtN2hPKSQcnih3Cu2O8WHqkdCehsCAIdIXjU0kXQ2cCLJ1XZXi+ws=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=ZNTsRwcU; arc=fail smtp.client-ip=40.107.236.40
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=lS4sA1cf+DUWe0KRSrQ/yetyZBTF3IQyTE49udZsYTJeDEia1q4spid/tW4pJQ6FcAudv0IRQ7cTyXlOpKLCsXXtiji+EqRNhJFd3S2tmp6fZ+rqWZSVcQm/FBuQR2q7W00+q4yeAKB1qdf1cdrd/kZgNJZEky+SAkHIzS8l6a7HXG3XuWJX9oPasJSWTHC2xtEk5P7Xd7ZhFL1xxkKZ8YAAv6Q2hy1kD9sFOaH3aowRqjRpUdfEtI1ifCpYmZ60shAjy9/R8juRhhz2DDpEu9TaoGTa/rxl73O8D5Fansu5+dm5gSWou0erwN9MG3a78Q8atgu3v48+b4rSW8Vfag==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=4iCR1ZJBL2B6Nxjw8NhPV4Cj+/3kBptyS5yBLqqS4Zo=;
b=Fw8QBK0lqtAw+AuqH0N9HbaNmTgEcT3dnJAbEdtTEvjn6tDTJ31r88XLHIsQTmSp6vjsPVRjqwgmN+9sAGyWTHJQXFjD+Et/Nbryd8lbV8A67GK7TZf4rJfd8DD4ENdeRUBYOn/3ad86rBqjuQ9gcSWrmCTGHiyrHW24q/eKXVBUWvB33fcieGWUUCqztsLzjP33IlsTUlOq0MUWxGrAC/fPHzQuBJ/uEMrlO6u4ZSQzIa66Cics0XpCOLoLhX6+ZWEBxzumj10x7AhGg3v4U3atRzC/PDee3rWV7Jczn/jnLJmauW+we3pdTZnKNn7qKqKqmwWOa1/0kM7Ccmovjg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
dkim=pass header.d=nvidia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=4iCR1ZJBL2B6Nxjw8NhPV4Cj+/3kBptyS5yBLqqS4Zo=;
b=ZNTsRwcUCNKZdvFn6x2PSilNlCQr/0eIME1PyyT7kJnich4pHnttfAxII1my+gWw0yQ/DORKaE49U3oEbGoXjuKNcqR5U/+DZqXK1CAxwAwTKWC5o12H0qK/9kbFCeRq0Q6El8u43b/umtdtdKTRtNIfDLbLQ15OcKY4FJg50qfezUKEuIiVK3GVc/i1eBzWWWpupJwRefRK7IsnzljvFPLBlEDbTupsCWFLw0P6tuSLsVXdCslRjPt2epr2CHGeehDnJME68E4PQCkjUwXTg+nlWRPFEhisPlVpswbSEZ2SnwvYlINz9Ae1UDKzqZYKQ5Lle57peeeJ+Gvw5Ir9xQ==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nvidia.com;
Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by
DS0PR12MB7827.namprd12.prod.outlook.com (2603:10b6:8:146::9) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.8792.34; Fri, 6 Jun 2025 15:18:33 +0000
Received: from DS7PR12MB9473.namprd12.prod.outlook.com
([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com
([fe80::5189:ecec:d84a:133a%5]) with mapi id 15.20.8792.034; Fri, 6 Jun 2025
15:18:33 +0000
From: Zi Yan <ziy@xxxxxxxxxx>
To: Usama Arif <usamaarif642@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, david@xxxxxxxxxx,
linux-mm@xxxxxxxxx, hannes@xxxxxxxxxxx, shakeel.butt@xxxxxxxxx,
riel@xxxxxxxxxxx, baolin.wang@xxxxxxxxxxxxxxxxx, lorenzo.stoakes@xxxxxxxxxx,
Liam.Howlett@xxxxxxxxxx, npache@xxxxxxxxxx, ryan.roberts@xxxxxxx,
dev.jain@xxxxxxx, hughd@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-doc@xxxxxxxxxxxxxxx, kernel-team@xxxxxxxx,
Juan Yescas <jyescas@xxxxxxxxxx>
Subject: Re: [RFC] mm: khugepaged: use largest enabled hugepage order for
min_free_kbytes
Date: Fri, 06 Jun 2025 11:18:31 -0400
X-Mailer: MailMate (2.0r6255)
Message-ID: <A409F7B3-A901-40F9-A694-DC3FB00B57FE@xxxxxxxxxx>
In-Reply-To: <20250606143700.3256414-1-usamaarif642@xxxxxxxxx>
References: <20250606143700.3256414-1-usamaarif642@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-ClientProxiedBy: BL6PEPF00016415.NAMP222.PROD.OUTLOOK.COM
(2603:10b6:22e:400:0:1004:0:d) To DS7PR12MB9473.namprd12.prod.outlook.com
(2603:10b6:8:252::5)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|DS0PR12MB7827:EE_
X-MS-Office365-Filtering-Correlation-Id: 585971b3-7e29-4b4b-6001-08dda50d66d6
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?ZVhvZ29lUDQ0R2ZGazh0eUwvVW9HTU5leUlFNDhndkFGZ2QrQmgrWmREQVZR?=
=?utf-8?B?UHZsUU1EMitRS1l5ZG1KY2ErN2p2VnlhV1prdzEwcnhEZFpMTmF5ZW1abzFT?=
=?utf-8?B?aWNiWWtaVndkZEdUd0tFSXNqVUhVbXlTWGxOTzlQaEFGYjR2NmFnTlRueXlH?=
=?utf-8?B?NzIwaFYxRHdEaDlHc0pPMlFYeXRZYnJadC9VanRUTk1VejcyRkhvK3d6c1F1?=
=?utf-8?B?Q1Z6QTgySWRFRlgwak1oM1NhaGpncS9FdlNwVXVYby9WTTFzSlV6V1dSeFVq?=
=?utf-8?B?TmFuZDFKLzlRcU9FL0QzZkMxVmVoczA2SnVkdFhLa0JXYkdUcnQzZzdRTW5U?=
=?utf-8?B?cFBvc0pVWmQrZ1RkOXMvOUV5MGp4ZE10cmdsUDhWOEpneFVxdUprMGdSWE5p?=
=?utf-8?B?YlNpOTZQblNKbHNmUGhhZDV2YS9pTmNSMFVLTWpETW1OVTBJMC9nSnhwTkRs?=
=?utf-8?B?S00yRENKeVFlNGtKc09rU21vQ0NrRGd3Sjc2VGdxY2dIRjZOWklUSjJFNTBq?=
=?utf-8?B?RTJqaFNPdnNPNnkyN3hITWlURkhhcTl1QVBsRDBVMXA1aDIvM1pRenhUMHpp?=
=?utf-8?B?czFtMGtFdWhlbE51WGlnbHhrWTM0TnhhbFMyVU44VndIaklRU3cvMUI2RDlR?=
=?utf-8?B?SE9ac3daMnNuM0o0SjA4ZEU3V1dWZEE5QXRTeUxvaWNrMU4zZTR1UnRNNHlH?=
=?utf-8?B?Qkx3NmdVaUo5aWpxMG5VWVI1U0ZobWZvbjUxc2pCUU5mSEtROFZiQ1VQQ3dn?=
=?utf-8?B?UkNmT3FqeUNzSENCYW1ZaGlkOEgyUjd6RFh0TkV5RXFsWmxYeE5YR3NESUZD?=
=?utf-8?B?bExRWDRPS1ZjeE9JL1YvaWQwV0g5R0JpRXZ4UXd4SDZiSFkxbExtWW1mKzFO?=
=?utf-8?B?ZnAyeEEzbUlLeW4rN1NYa2tQbjk0eU9OZTB6Siszb1RYbzQrVnpLazVsSU9u?=
=?utf-8?B?N2ZIeDJyWnlObmNmalBPYkxtUzNXNHRENDdvTVRFZlh3ZkNWQ1Zab2Jlckg3?=
=?utf-8?B?WS9jclN4bnZYMjlaY3RSRFd6WGE0eHFuUDNqeUpKaEthWCtlWEZILzE1ZHNn?=
=?utf-8?B?WkFkeSt6eUs5ZTRmUmJ5cnV0d09CUE1CK29lSFU4M2lqT3JjU3FPYXJhK0ky?=
=?utf-8?B?UmlJbkhvMTFvSW5BR2NlU3BrMDVCTE1sQzBGa2dVQzUvY2svSVpRRlFZK1Vw?=
=?utf-8?B?M0dJQzRFS241MGs5aW9rZ1YvVS9zV0NsR0xScUZHRjNIZENTS1E5Mks5TTFD?=
=?utf-8?B?c1h6NzRSTHhlZDZvZTBrVDVrcHJpV0lmSEw5am5tUkNLUXJYbVJrMk9DcE1H?=
=?utf-8?B?TzNwU1drZ2Z5UEdKNXFRSXkvdXlsUTIrVnE1a3RIR1h1bklWVDZ2WG5TSjFR?=
=?utf-8?B?YzNKQWlnS1BFQS9hY3ZUQzhvNFA5ZlBMWWpBR0NzNU0xM3NCWjZlRTdWMldU?=
=?utf-8?B?b1FZQ3hJTGpzT0hqcCs3YktuK1ZuOXJEcjl1SmZFb3l4T29mWC9aa3puQlp4?=
=?utf-8?B?b0hKL215VkovN0x0bFVBc3MrYnBRNm11eFh2VVI5SmpDd1p0bFYwSVM5cHNw?=
=?utf-8?B?NFBRS24xOEd3MVJFL3MvZG5JWDBDMFBnODh0bG84YWdvQndnUysrcUo0L2NK?=
=?utf-8?B?QUtNbWQrYkYzT2U2cWR5bHFEUko3RjZ6RWVkTHpUKzdHL3ZiVmtjdzZZdEJT?=
=?utf-8?B?ZkNSckFhQTZYNkppSVhwNEdzTEVjNVBKU1dSSjVmSVFqTkpHRU4xazlIand6?=
=?utf-8?B?eE4rQ3BOZzdoczFaM241SHhleFBMaW8vUGZhVnFCWm1xdFJ5OWZzTzVFbzBX?=
=?utf-8?B?Mzh2c1plTnc4VWwzMGRGK3FobDRjRGpaYTJXTUFPZmJOZDBJTkdmU3ZaMnZi?=
=?utf-8?B?L1NkLzFWTU1iNWdFK1VLWEYvc28zQ0Y0LzZ3VnBPaVFkaGxMYkE3cEJxZFNo?=
=?utf-8?Q?TVDjYJIvnNw=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?eEZBMVRKczNza0dUZXEyd1hKVjlBZk53UE10SnZRTW10QUtVQlgwL25SMS84?=
=?utf-8?B?MEZtZ3NHUUVTbDQxOURPVkVaOGx0djhoR2hEeUtiV015VHVrandXRFk2QXNC?=
=?utf-8?B?ZEhPTTgyL0RRWldHRzBMcUhLRFZzeWE5NDFsQ1dRdWd0M0tsTEROOG5PUk41?=
=?utf-8?B?Uy9DNE1HdkhqUWhLSDM2Mko4WTRxYXdKajNyVWx2OXJkODk3RGJpMU96RUZI?=
=?utf-8?B?MGFERmVTTXFVRDFkMG95L0hkeHFJSGxDZlNqdzVEeVRYTU14KzhFWjRXRkoy?=
=?utf-8?B?K0w3UWRlNlBKbGVtYk43S2NFeVNOdDgwQnhXeEc4WlRLanBYYnRSc0s5WnRJ?=
=?utf-8?B?Y1c1QU82NEx6dHNQNlFZZzBCUEwwb29CSnRVYzF4T0VQU2JobFBLNVlZb1ZN?=
=?utf-8?B?MWJ2RjhTYzN4SFRXUVdwUC9ReGtRa0Q4dW9sZGhVZXI2S2s0SiswWCt3NUIx?=
=?utf-8?B?Qm1rVTRoUVNmam5ZSjI3eFNrL1dUaE1iam1TUUNacGVvZjVVbERCWnZFaGlO?=
=?utf-8?B?S1AyUXJ2S1l2VmNaMi9Idlg2cnhlMjZmbmhmRnAwYlNrb1lZUS9IN1dHSGx0?=
=?utf-8?B?NnNlcVh5UE9PbXlwVUZyZm5lME1tWWdudHR3NmRydG44bjZnNlQzTTJpbzFH?=
=?utf-8?B?REgyUEpRM1loWVp4YUdsYkIzeTNSZG9vWHZnNkNUSWQ4V29PNkdRTDhGVGNq?=
=?utf-8?B?MkNjN0xKbUxtMC93b25HUjdoTTFGRVR2ZEJBQjNtMDVCZ1U5dXB4Y2FQL3pp?=
=?utf-8?B?dzR4aVJsVjBhS3FKVnhpdnF6WVV0bkhqTjdPL2U2KzRrSFhWZ0Y1ZmtudS9z?=
=?utf-8?B?K3dod3VtSEVDS3JRMVFTZlpDS0xEbGZ4YVNxajIyRGN1SmVpUzQveUQ1QVVT?=
=?utf-8?B?Nnk3UmxrY05NcVBoakUwKzVnbXN0ZU9kbEwxUzJrYlErdkh6ZHplR2lMMkRO?=
=?utf-8?B?RXNXVzFvdUFyR3AxUkdrd0dMN1dxTEk2VEEySFYvMlZPOTVybit4Nkh2eDE2?=
=?utf-8?B?Y2xEaW5uL05LTmlkOWZOdmR1T3ZDSlNuQXdGWUJoc21KT1l3REZseE1uWHZM?=
=?utf-8?B?T3l5NDNIeUxZTlFwSFowdnVxUkZndmNWRHNtYTFpQ1dncFVVbnBlV2J2TXdv?=
=?utf-8?B?bjQ1Q3ZMZmtpVWE0Y3UxTEhCc256YU8zTlo5U2Y1YmhjUkxMMFd2aGhHM1Ew?=
=?utf-8?B?VnNteENYZTlpdkt0VlhxVHc4MUg4V2pVeFNWbEVSWEtRMXRBajFzVEV2aGhw?=
=?utf-8?B?Q2NvcU83ZnJlMllyalNxQ1ZrekxVT1FDU2ZKdmZpZVFTVUdDa21ESGZQV0hB?=
=?utf-8?B?V2JTWTNENEJVTUZ4ZTNyVXFYWXpUOFpkQWsrakdHNXVBWWphcE1XeS9OM04r?=
=?utf-8?B?N1BwRTFvcUJFUjNGRENwWW5PVTVZcTk1OHNUL28zRlY4bDBJdHpDelRWcC8r?=
=?utf-8?B?blo3ck04L2NKck1rcVljemVLM0l4SEw0NkgwV2FkV2ZQb1pRZkdiaFNJbHBY?=
=?utf-8?B?U0tyOVJKY1J0YzE5aEc1OE5oczB4NlEyQzB1WmkxV0dQZ1MrdDM2cnErNWdJ?=
=?utf-8?B?MnpqSnNrWU10bUZHUitzL2x3azZqdjBGU0RrOGlOclNXWlZkclhJTWV6aUxG?=
=?utf-8?B?M2RRWEtPRFkrU0FPZ0hNMG44YzhiTXhjcGQzQmNwWWZwa3Jsc0lxQlJTQnNR?=
=?utf-8?B?V3hLM29zTU5WRUdTOGk4M09wQ2xhUjhqQzlMc0tZRFllTmNXakdWZmljdy9P?=
=?utf-8?B?SXkxL3hEVENQdnJXWTdYcVh1UXhBSEM5dFc4aGZPdW9BQTdzdFErejdiNU15?=
=?utf-8?B?UUlPYjBBSFFDZjgyM3JBQUpLVnRIb1Q2ZXBPTlYwNHBsU05MWEJpbDdlQ2Zl?=
=?utf-8?B?TUdETmpDZGhhQVRqdU9idGNHYURYaTViMUZTdzlLemNReU9Id0lBTEVYaXBX?=
=?utf-8?B?dXAzbUxPSlQ1ZUIxN1NUV3hjcGFWU2t4SzBmc1h5QzVUZEV0RFl5aVdscmtz?=
=?utf-8?B?SWwzMTVuTU9rNmNUZ3JoQUxnM0FBQ081cTg1ZmY2MUNKb3FmZ28vdGN3eXRS?=
=?utf-8?B?d3R3L3dqVFY1OXAvbGtJZE1uRkxFSWY3QUpxWFg2VkpvV0lISEhTYUMrdVVM?=
=?utf-8?Q?bQZ1cLqz9r2+DQ7403vL4e/1T?=
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 585971b3-7e29-4b4b-6001-08dda50d66d6
X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 15:18:33.6380
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: HCHzWIpaDIbUaCIEcD1v8a2tSkivzBzlQxUk+gGyEptDgfHErwd6fZRDteo4k3ui
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7827
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6 Jun 2025, at 10:37, Usama Arif wrote:

> On arm64 machines with 64K PAGE_SIZE, the min_free_kbytes and hence the
> watermarks are evaluated to extremely high values, for e.g. a server with
> 480G of memory, only 2M mTHP hugepage size set to madvise, with the rest
> of the sizes set to never, the min, low and high watermarks evaluate to
> 11.2G, 14G and 16.8G respectively.
> In contrast for 4K PAGE_SIZE of the same machine, with only 2M THP hugepa=
ge
> size set to madvise, the min, low and high watermarks evaluate to 86M, 56=
6M
> and 1G respectively.
> This is because set_recommended_min_free_kbytes is designed for PMD
> hugepages (pageblock_order =3D min(HPAGE_PMD_ORDER, PAGE_BLOCK_ORDER)).
> Such high watermark values can cause performance and latency issues in
> memory bound applications on arm servers that use 64K PAGE_SIZE, eventhou=
gh
> most of them would never actually use a 512M PMD THP.
>
> Instead of using HPAGE_PMD_ORDER for pageblock_order use the highest larg=
e
> folio order enabled in set_recommended_min_free_kbytes.
> With this patch, when only 2M THP hugepage size is set to madvise for the
> same machine with 64K page size, with the rest of the sizes set to never,
> the min, low and high watermarks evaluate to 2.08G, 2.6G and 3.1G
> respectively. When 512M THP hugepage size is set to madvise for the same
> machine with 64K page size, the min, low and high watermarks evaluate to
> 11.2G, 14G and 16.8G respectively, the same as without this patch.

Getting pageblock_order involved here might be confusing. I think you just
want to adjust min, low and high watermarks to reasonable values.
Is it OK to rename min_thp_pageblock_nr_pages to min_nr_free_pages_per_zone
and move MIGRATE_PCPTYPES * MIGRATE_PCPTYPES inside? Otherwise, the changes
look reasonable to me.

Another concern on tying watermarks to highest THP order is that if
user enables PMD THP on such systems with 2MB mTHP enabled initially,
it could trigger unexpected memory reclaim and compaction, right?
That might surprise user, since they just want to adjust availability
of THP sizes, but the whole system suddenly begins to be busy.
Have you experimented with it?

>
> An alternative solution would be to change PAGE_BLOCK_ORDER by changing
> ARCH_FORCE_MAX_ORDER to a lower value for ARM64_64K_PAGES. However, this

PAGE_BLOCK_ORDER can be changed in Kconfig without changing
ARCH_FORCE_MAX_ORDER by Juan=E2=80=99s recent patch[1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/commit/?h=
=3Dmm-everything&id=3De13e7922d03439e374c263049af5f740ceae6346

> is not dynamic with hugepage size, will need different kernel builds for
> different hugepage sizes and most users won't know that this needs to be
> done as it can be difficult to detmermine that the performance and latenc=
y
> issues are coming from the high watermark values.
>
> All watermark numbers are for zones of nodes that had the highest number
> of pages, i.e. the value for min size for 4K is obtained using:
> cat /proc/zoneinfo | grep -i min | awk '{print $2}' | sort -n | tail -n=
1 | awk '{print $1 * 4096 / 1024 / 1024}';
> and for 64K using:
> cat /proc/zoneinfo | grep -i min | awk '{print $2}' | sort -n | tail -n=
1 | awk '{print $1 * 65536 / 1024 / 1024}';
>
> An arbirtary min of 128 pages is used for when no hugepage sizes are set
> enabled.
>
> Signed-off-by: Usama Arif <usamaarif642@xxxxxxxxx>
> ---
> include/linux/huge_mm.h | 25 +++++++++++++++++++++++++
> mm/khugepaged.c | 32 ++++++++++++++++++++++++++++----
> mm/shmem.c | 29 +++++------------------------
> 3 files changed, 58 insertions(+), 28 deletions(-)
>

Thanks.

Best Regards,
Yan, Zi


Return-Path: <linux-kernel+bounces-675925-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0F8D841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:21:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 6F483188F2DD
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:22:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F23728934B;
Fri, 6 Jun 2025 15:21:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NONsr/od"
Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B65213D52F;
Fri, 6 Jun 2025 15:21:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223300; cv=none; b=Kw1UybB4hpWI6MyvZMSTPkABLUJwVAPNFO6ZElueQlhM4p9QS8dZdX+YxdcBUfKPntovb3k2vVNmuPeRmvXA9Ba1ovikLIL3g2ADhz8RUaxb6npY8dDq9ra+bu/qWjZSQU34EWNHD7ztJ61Wyc14Qlap3bwpY1d81e188riqEbg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223300; c=relaxed/simple;
bh=gwPihyT66GFBCKXnAdMFwJ23HBwzvXhtzzRMUFfYe6w=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=CsCG8f0og9je5buxDrC2H+4Fi3n1FFp5SObzhwPrC0rY8yHfoYmzToJX48cvCSeTSvFnGFVud/NucDUUMP6LjPU1j2YRTG6MxJxvimqacUUnyIkhZ6nQRlX6tJfxUq47VqOPg2JVqcClMKMpVAav8tNaipD+w++iL5oO+iv3i3c=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NONsr/od; arc=none smtp.client-ip=209.85.216.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-311ea13388fso230781a91.2;
Fri, 06 Jun 2025 08:21:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749223297; x=1749828097; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=6y/pTaKdTa3jjo68DaVXoYV6RDpz4d2nIZzF6qf145E=;
b=NONsr/odtLu+ufQxZ3rkKLyO5m5He/5utEPk7WhR0ajewDV91FG9Zz29u1EiJbeB3h
27f+yXGGuYxPbB2okmXDAHe1Z9aWg8b2Rilze1ilVgoY46cJWOZNZGGL1RHs5p5RhdiH
UdeKsY5TLtY42H9Wj6n8d03r6myUTmafT9mp+0hVaFR2DI7/EifYmQIkWutLeueABNXg
1nCjpnlTXpIc5bBy9PyT/jI+fuNCuDKOik+xi6u0qK/ZO1+RfUbf2Ul4iRwDG2kNQzEi
tywLpF3YO86kPh+Dir1BaavwAOxvSJ/v2z/i06rh9NeW00a3pv53ohFSXlt8cVlvNiFs
h3Yw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749223297; x=1749828097;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=6y/pTaKdTa3jjo68DaVXoYV6RDpz4d2nIZzF6qf145E=;
b=GK8L5KSmvUL4zS5vfuvtovVJtBTYdCSSdAXKugOdVgqgjBjGEHCJYYis2YgCq3TS58
PMA+FFlq+UejjAQKufrDnLKf9WyvnRYYSeaBYYdqh/LXt2CnRhaSnD/70n1CQX67MELT
riKXT+8zOMXB4YXn+h0pF7zZ2mJf+q4fcCtbW9T918FAk/GpJRn1XPFDFeioyE3MBw9K
tUveodD91QKEEoVhos8Fl+ZgSzshKO/C1lysiCKsLMd+l1MySILma/ay3tHzDD1b02qP
LB+FAu1Dms8CisZ0dUHh3yNQ1JeRzpbiOyK1pS9F5J6OKXckGVC2tT6gRlLOYUY6jRnv
/L9A==
X-Forwarded-Encrypted: i=1; AJvYcCUy+FBrM2rs/2iDZeF+hXHDi/v4BLgAliTa6uPeS0pv7dXdnIJ5FoIPflxfthE3L7WkHKi54rdPNHJm@xxxxxxxxxxxxxxx, AJvYcCWEdFecA3WtEzW91/xmtGltVaYE+tOuqs7l+AzNe7uMyeJKJjYfBzh2YzLxBdJshtiyhflSg9KLDO4AhD2R@xxxxxxxxxxxxxxx, AJvYcCWhZSxDaH9rQHUDYRgD+eKhf9f6wuAZh2lKTULe4hDKC4NuO2lcJQnXu6+lR9l6AoNauSzNR3RwvK8jMz0QriU=@vger.kernel.org, AJvYcCXsikRJgRX7o8yUnaAD/qBgT2NValh1GfLUeVwOfZZwjawCJHPx+zFz8IkDQmvwGmQRkN4IM6OrjG/w@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzvxNCN39JDX/xNunb1oYl4XmNmfb/9Zw14Ddn+rX5tmc/RwEPg
MY8XrT4PIrxiDprNd1XzYPCq+1k/N+1Fd6mejlVsqpVk2zLAjqY0ePhm/VaE1RTzdqr9/+tA/l2
d9DbfXjb+WX0kIwsKypErhyson/TCDVs=
X-Gm-Gg: ASbGnctTGXv4ykWakCquNxCql0ZF9PK4de1p+etG8E4DUlkuq4v8n0haXXI7uD5h4cG
Age5dXQ/mRJegW3ufaEHkE3kQyHwrwOVOrLCVPuG0eiCej3KXUzB+hDBlg6gy5uqdni7RiOTbJD
VOTdeAom6Ava92x4N7c+FTfN/eTANhBBWg
X-Google-Smtp-Source: AGHT+IFyOIamAdvMd6PyTbKxN9A+KfVhNlUc26UeNq5/4kcHIWj1RvrgAIyHNMb7SFTTos+AIoRpMNq1w6r+sr9p6LI=
X-Received: by 2002:a17:90a:d006:b0:311:e9a6:332e with SMTP id
98e67ed59e1d1-3134ded1839mr1619938a91.0.1749223297388; Fri, 06 Jun 2025
08:21:37 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250524-rust-next-pwm-working-fan-for-sending-v1-0-bdd2d5094ff7@xxxxxxxxxxx>
<CGME20250524211521eucas1p1929a51901c91d1a37e9f4c2da86ff7b0@xxxxxxxxxxxxxxxxxxxx>
<20250524-rust-next-pwm-working-fan-for-sending-v1-2-bdd2d5094ff7@xxxxxxxxxxx>
<q6dkihyfosi3k4mtrvyff54nbsjpovmujdbmoqhapo7daznpja@of2p5gtmcq2m> <b1c4792e-f997-4eba-a8ed-d2e3f76e3fdd@xxxxxxxxxxx>
In-Reply-To: <b1c4792e-f997-4eba-a8ed-d2e3f76e3fdd@xxxxxxxxxxx>
From: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
Date: Fri, 6 Jun 2025 17:21:23 +0200
X-Gm-Features: AX0GCFvFtqr5rx5vUZL_23m9VolSo1UVOelTmGY--77dwJA0BboM7GZ90cFl2gw
Message-ID: <CANiq72kVvLogBSVKz0eRg6V4LDB1z7b-6y1WPLSQfXXLW7X3cw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH RFC 2/6] pwm: Add Rust driver for T-HEAD TH1520 SoC
To: Michal Wilczynski <m.wilczynski@xxxxxxxxxxx>
Cc: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= <ukleinek@xxxxxxxxxx>,
Miguel Ojeda <ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>, Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Danilo Krummrich <dakr@xxxxxxxxxx>, Drew Fustini <drew@xxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>,
Fu Wei <wefu@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>,
Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Alexandre Ghiti <alex@xxxxxxxx>,
Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
linux-pwm@xxxxxxxxxxxxxxx, rust-for-linux@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 4:08=E2=80=AFPM Michal Wilczynski
<m.wilczynski@xxxxxxxxxxx> wrote:
>
> You're right, thank you. The wrapping_mul is unsafe due to the overflow
> risk you pointed out.

What do you mean by "unsafe"? `wrapping_mul` does not trigger UB and
it intentionally provides wrapping arithmetic.

> The ideal solution would be to use the kernel's own mul_u64_u64_div_u64
> helper function.
>
> Rust maintainers: This binding doesn't seem to be available yet. Would a
> preparatory patch introducing a minimal rust/kernel/math.rs with only
> this binding be the best way to proceed? It seems like a useful utility
> for more than just this driver.

Sounds good to me. We also recently had related discussions about
64-bit divisions in 32-bit architectures and `const fn`s, you may want
to take a look:

https://lore.kernel.org/rust-for-linux/CANiq72ke45eOwckMhWHvmwxc03dxr4r=
nxxKvx+HvWdBLopZfrQ@xxxxxxxxxxxxxx/
https://lore.kernel.org/rust-for-linux/20250502004524.230553-1-fujita.t=
omonori@xxxxxxxxx/
https://lore.kernel.org/rust-for-linux/20250501015818.226376-1-fujita.t=
omonori@xxxxxxxxx/

I would also be careful choosing the names: if they are supposed the
same behavior, then please pick the same name as C. Otherwise, we
should avoid it. Either way, we should document them.

For instance, is this supposed to be `mul_u64_u64_div_u64`? I guess
not, given e.g. the `c =3D=3D 0` case.

I hope that helps & thanks!

Cheers,
Miguel


Return-Path: <linux-kernel+bounces-675926-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C9ACF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:23:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 68AFE1893FC1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:23:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 576C1289800;
Fri, 6 Jun 2025 15:23:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b="K2tCnOwG"
Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150])
(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 53B3913D52F;
Fri, 6 Jun 2025 15:23:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.143.211.150
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223403; cv=none; b=Gi5s3haulA7o89LOrutaPLwppFfAiReh1OTWWSlwRL+9VkvkXKSKddYHE4mjhmbxnM8LVFdEMY7Cq7rtPm1tmMmLNSHejnUT1GgqizVadWyWBoURRqVaPTh65askGv5PsHkhdwBB936QFKqpcRgtdIgd2o++Qocxlws9d4KNQ0g=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223403; c=relaxed/simple;
bh=YPQHOA5kSqFGUsoQ+jIhAIS36Z4dE20BlDV3jKC+PYI=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=l/ViD0qPFS6J9B2wlLLoZb4RQ1c07LOiXmu0CHmXXbXkAMzNDMAOfEMed9ToWzLcpAgKTGJyqPOaq98ZjHify4imTfLUt/hjUihF6t3mKcNueLdn7jyEET/VcheiRVreHTolb67jsib8dcAFZc7zq+yWCCjMVsG8OeDZLiBURts=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=swemel.ru; spf=pass smtp.mailfrom=swemel.ru; dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b=K2tCnOwG; arc=none smtp.client-ip=95.143.211.150
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=swemel.ru
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=swemel.ru
Message-ID: <3b461ee7-c3ee-484b-b945-ec6070355bfe@xxxxxxxxx>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail;
t=1749223398;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=EC5WXwIyePFbi5jc4rzYZSJpl/hestrYvtJLaOCfr/c=;
b=K2tCnOwGIIkIFg0EJpp+pfHV2hk6mQ1J5urKlln67Jp5fOG7BkINyAZLmeBP2rChxlDZei
7s3I6VKB79cpZhyt1jcb+fqAQ8v7Ctxk08/ZFVXH6AGy+EJZ6hOr4nFbz4eR9VxMNfp5Yn
IlUrn/sE5ZbRKNd7wiB96flFIQnU1lE=
Date: Fri, 6 Jun 2025 18:24:16 +0300
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Subject: Re: [PATCH v2] security,fs,nfs,net: update
security_inode_listsecurity() interface
Content-Language: en-US
To: Stephen Smalley <stephen.smalley.work@xxxxxxxxx>
Cc: linux-security-module@xxxxxxxxxxxxxxx, linux-nfs@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx, selinux@xxxxxxxxxxxxxxx,
Christian Brauner <brauner@xxxxxxxxxx>,
Casey Schaufler <casey@xxxxxxxxxxxxxxxx>, Paul Moore <paul@xxxxxxxxxxxxxx>
References: <20250428195022.24587-2-stephen.smalley.work@xxxxxxxxx>
<49730b18-605f-4194-8f93-86f832f4b8f8@xxxxxxxxx>
<CAEjxPJ5KoTBB18_7+fWL+GWY4N5Vp2=Kn=9FJR2GewFRcMgzPQ@xxxxxxxxxxxxxx>
From: Konstantin Andreev <andreev@xxxxxxxxx>
Disposition-Notification-To: Konstantin Andreev <andreev@xxxxxxxxx>
In-Reply-To: <CAEjxPJ5KoTBB18_7+fWL+GWY4N5Vp2=Kn=9FJR2GewFRcMgzPQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-OriginalArrivalTime: 06 Jun 2025 15:23:17.0475 (UTC) FILETIME=[EDA31B30:01DBD6F6]
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Stephen Smalley, 06/06/2025 10:28 -0400:
> On Fri, Jun 6, 2025 at 9:38â?¯AM Konstantin Andreev <andreev@xxxxxxxxx> wrote:
>> Stephen Smalley, 28/04/2025:
>>> Update the security_inode_listsecurity() interface to allow
>>> use of the xattr_list_one() helper and update the hook
>>> implementations.
>>>
>>> Link: https://lore.kernel.org/selinux/20250424152822.2719-1-stephen.smalley.work@xxxxxxxxx/
>>
>> Sorry for being late to the party.
>>
>> Your approach assumes that every fs-specific xattr lister
>> called like
>>
>> | vfs_listxattr() {
>> | if (inode->i_op->listxattr)
>> | error = inode->i_op->listxattr(dentry, list, size)
>> | ...
>>
>> must call LSM to integrate LSM's xattr(s) into fs-specific list.
>> You did this for tmpfs:
>>
>> | simple_xattr_list() {
>> | security_inode_listsecurity()
>> | // iterate real xatts list
>>
>>
>> Well, but what about other filesystems in the linux kernel?
>> Should all of them also modify their xattr listers?
>>
>> To me, taking care of security xattrs is improper responsibility
>> for filesystem code.
>>
>> May it be better to merge LSM xattrs
>> and fs-backed xattrs at the vfs level (vfs_listxattr)?
>
> This patch and the preceding one on which it depends were specifically
> to address a regression in the handling of listxattr() for tmpfs/shmem
> and similar filesystems.
> Originally they had no xattr handler at the filesystem level and
> vfs_listxattr() already has a fallback to ensure inclusion of the
> security.* xattr for that case.

Understood

> For filesystems like ext4 that have always (relative to first
> introduction of security.* xattrs) provided handlers, they already
> return the fs-backed xattr value and we don't need to ask the LSM for
> it.

They only return those security.* xattrs that were physically stored
in the fs permanent storage.

If LSM's xattrs are not stored they are not listed :(

> That said, you may be correct that it would be better to introduce
> some additional handling in vfs_listxattr() but I would recommend
> doing that as a follow-up.

Understood

--
Konstantin Andreev


Return-Path: <linux-kernel+bounces-675927-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D894041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:24:57 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id A9BF73A92F6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:24:35 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 15C86289358;
Fri, 6 Jun 2025 15:24:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="r7pF90pF"
Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2055.outbound.protection.outlook.com [40.107.93.55])
(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 D7B69126C17;
Fri, 6 Jun 2025 15:24:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.55
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223484; cv=fail; b=tnfMmmw88JN6jZ9cUBCDf1xyiRIO9J2ysISmAZFeBdMoSW9o6FMJkIFe+QFZfdviZJ3VP6vvBdShXGjDeBtDjQqDZ3gTRZ7KuTwMNbShFfFmECWFuf0fxVaLHq0z+HSELRRqsFyfMXwAq8COxOIOveC98K3hcKcxWhFAkJ0XXvY=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223484; c=relaxed/simple;
bh=ntscqIPWcgDNAVjoC62X78VjHbpdfg1YMoHLbAmtur8=;
h=Message-ID:Date:Subject:From:To:References:In-Reply-To:
Content-Type:MIME-Version; b=rZf/lwaZPIO8qpnjvon4s20tmJT28jl/1sGqUxunKDT5ODn6E1YIWbYIi28DLz/sxbp93G27Wv0/QhxZkVoYOeVPKKOSsQlxlqBp/jRqilViAEkb1cmwk9Q5uOpN9cY9W/E7PtgFCvmMcddIamsWui32hrTsIfB6hcbtjvHdjNY=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=r7pF90pF; arc=fail smtp.client-ip=40.107.93.55
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=caiOKZCEFUPWmKcCdtgxv5pZg/Rp1mJ8jT8cPJp9zNC/ju0uKIKcy92gbrMX6aVQ7mJ9290K9aaFHlasZQRzBkCJnzXtrFJ0yL8SlM1jX+H/LZ+cCEEfs2pPigqJze6F3gzPz6eZrQQWdr1UrTXDs603qs+FfUhHVot6mAZos6lvs3YaH2QEugH3GmIgjzomkbcluZEnPi4dF/81eW8WsK6phtQfvsFrQUOKEzIa+/NN29QcQohn/gyYinILTeXtaURCSxB1TiAN1HHqGqw9iKCYWccOLD+Xp8vpzi/nLZezMyrtbSWfFxQHt0aprSWaLKwuV4T+8su2MXJJ7ogDkQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=QOODe3MzEc0knQOg8Mgea4We0rj78J2xmOkNfi9E+yg=;
b=mx0DVIazhPjCow9p4m/yQh10rJ9HRe+/o/hgtYCOtE9XRaJPc9hUpcnO72M+f+5eRDGlojW0EtgI0wkpq5NFm6GEKXz6Ts7JzZKGBfvS5Nn0mNcZS/77fmdMMW6ikzkOapq0vD0YOF8GI79VW0rsHLcY+bBeTo1//B5vaaiPzqOt+Ni2VGlObXP42Gu78z4w33zq9L/iZBBO3E8iKCyJtoSR8BLb8mvKWuoDoXEEWcx8GE2ZkDm8miT0BMy7jBO7CddO6IS3FHXFdnqmvEwpSNxcmh62bF3z5vYE3bwvPgn5ph4eiIWzrP15AFuHR+ERHVRLtxsGZ9tpgbJYUtdwmA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass
header.d=amd.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=QOODe3MzEc0knQOg8Mgea4We0rj78J2xmOkNfi9E+yg=;
b=r7pF90pFSmFYRAGBiQAnda2ir7mhpaiVwt9iR+MZxNDTBLLIWysfI2mdodd6nf2BWJLzFhbSyuC6cPIfQX16IUNH7XADiuWofEnsSUxz9mHp7kNyX0IflqHPERKtntyVeHGVxhxYMKhBxZWBge6bvep5PysHw4LRUemRL+q4nCM=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=amd.com;
Received: from DS0PR12MB6390.namprd12.prod.outlook.com (2603:10b6:8:ce::7) by
IA1PR12MB6185.namprd12.prod.outlook.com (2603:10b6:208:3e7::21) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.34; Fri, 6 Jun
2025 15:24:40 +0000
Received: from DS0PR12MB6390.namprd12.prod.outlook.com
([fe80::38ec:7496:1a35:599f]) by DS0PR12MB6390.namprd12.prod.outlook.com
([fe80::38ec:7496:1a35:599f%5]) with mapi id 15.20.8792.034; Fri, 6 Jun 2025
15:24:39 +0000
Message-ID: <e319c9b2-742d-4fbf-8092-90a4f96d7980@xxxxxxx>
Date: Fri, 6 Jun 2025 10:24:25 -0500
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v9 10/16] cxl/pci: Unify CXL trace logging for CXL
Endpoints and CXL Ports
From: "Bowman, Terry" <terry.bowman@xxxxxxx>
To: Shiju Jose <shiju.jose@xxxxxxxxxx>,
"PradeepVineshReddy.Kodamati@xxxxxxx" <PradeepVineshReddy.Kodamati@xxxxxxx>,
"dave@xxxxxxxxxxxx" <dave@xxxxxxxxxxxx>,
Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>,
"dave.jiang@xxxxxxxxx" <dave.jiang@xxxxxxxxx>,
"alison.schofield@xxxxxxxxx" <alison.schofield@xxxxxxxxx>,
"vishal.l.verma@xxxxxxxxx" <vishal.l.verma@xxxxxxxxx>,
"ira.weiny@xxxxxxxxx" <ira.weiny@xxxxxxxxx>,
"dan.j.williams@xxxxxxxxx" <dan.j.williams@xxxxxxxxx>,
"bhelgaas@xxxxxxxxxx" <bhelgaas@xxxxxxxxxx>, "bp@xxxxxxxxx" <bp@xxxxxxxxx>,
"ming.li@xxxxxxxxxxxx" <ming.li@xxxxxxxxxxxx>,
"dan.carpenter@xxxxxxxxxx" <dan.carpenter@xxxxxxxxxx>,
"Smita.KoralahalliChannabasappa@xxxxxxx"
<Smita.KoralahalliChannabasappa@xxxxxxx>,
"kobayashi.da-06@xxxxxxxxxxx" <kobayashi.da-06@xxxxxxxxxxx>,
"yanfei.xu@xxxxxxxxx" <yanfei.xu@xxxxxxxxx>,
"rrichter@xxxxxxx" <rrichter@xxxxxxx>,
"peterz@xxxxxxxxxxxxx" <peterz@xxxxxxxxxxxxx>,
"colyli@xxxxxxx" <colyli@xxxxxxx>,
"uaisheng.ye@xxxxxxxxx" <uaisheng.ye@xxxxxxxxx>,
"fabio.m.de.francesco@xxxxxxxxxxxxxxx"
<fabio.m.de.francesco@xxxxxxxxxxxxxxx>,
"ilpo.jarvinen@xxxxxxxxxxxxxxx" <ilpo.jarvinen@xxxxxxxxxxxxxxx>,
"yazen.ghannam@xxxxxxx" <yazen.ghannam@xxxxxxx>,
"linux-cxl@xxxxxxxxxxxxxxx" <linux-cxl@xxxxxxxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,
"linux-pci@xxxxxxxxxxxxxxx" <linux-pci@xxxxxxxxxxxxxxx>
References: <20250603172239.159260-1-terry.bowman@xxxxxxx>
<20250603172239.159260-11-terry.bowman@xxxxxxx>
<959acc682e6e4b52ac0283b37ee21026@xxxxxxxxxx>
<3e022f34-ad65-4caa-9321-c181bb8ae676@xxxxxxx>
Content-Language: en-US
In-Reply-To: <3e022f34-ad65-4caa-9321-c181bb8ae676@xxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: CP6P284CA0042.BRAP284.PROD.OUTLOOK.COM
(2603:10d6:103:1ac::18) To DS0PR12MB6390.namprd12.prod.outlook.com
(2603:10b6:8:ce::7)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS0PR12MB6390:EE_|IA1PR12MB6185:EE_
X-MS-Office365-Filtering-Correlation-Id: f18a27ab-3d3c-4349-70a9-08dda50e410b
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|1800799024|366016|376014|7416014|921020|7053199007;
X-Microsoft-Antispam-Message-Info:
=?utf-8?B?cm4wV2VYMVlIQUorR1ozVG1Lb1c0UjloTTNLWm1YVFA3VXlSaW9CTG1YZG1B?=
=?utf-8?B?Y1ZRU0RQbGowaXVYMnd1VUlQZkdCUkx2b0N2VVpHaU5Qa2tybm1yWVNUSC8y?=
=?utf-8?B?REw2TXlaNXJqb0ZScU9kK3pPclBoOXhrMHoxNEZBZm5sZmEzb3YvSWgzbUJC?=
=?utf-8?B?YVlEU0RxTWtWcEN0bFpJZFBObDdaV0xRaFpKY1UyUDRJMVg2TXlLUG1SbWxU?=
=?utf-8?B?aERQdnN6akgrM1JYdDgrbjc4UFRwaDA0L0hxRUlISC9WcGJMRmZTTUZaT0I3?=
=?utf-8?B?T1FoZWQyUmc2VjdRbWJtSlRMWktkUmtyTmt0a0syTm8raTNYTzE4azBqNE1j?=
=?utf-8?B?MDNkN3h4UHQ4NEpXVTY4QjZPY0RZYngrNUJFbW9jMGo3ZUdiemxLcTVhd1ZN?=
=?utf-8?B?VmF3bEdyVHpqU1RYY2htdWEybCtpQUxNS29EOWhOdHI2Ym5nZ09Nd0ZxVDNF?=
=?utf-8?B?SncvOVJCcEd2bEdPNnRWdUZkT09BdHpKZ1lvd1NGSS9lekVTY0Rvc1NzSnd1?=
=?utf-8?B?SE0vQ0ZHYzRrL2R3MVFnWGFqbDJ2RlV6MVJXTlhacys1L0s2T3VyQXZaZ0VK?=
=?utf-8?B?RlRhai9zRnk2b1FHQURhQ0FGYXVWT1dKSXRObC85eTI2Wlhub3c2cEJYb2dO?=
=?utf-8?B?d2tWTHpEaFAzeUlSOU95TEM1SDBGOTFRQW9kWndtWFRRbyttajNqRUFKQ2M1?=
=?utf-8?B?UTdHMWtsN2VvQU9waGp3TUNYd25ReXBSdCsvS0trMmF1OGRtK0RubE8zcVE2?=
=?utf-8?B?dytuMVJabk1IOVJGSXQ1V2JIaEFiYlJzYmJzalRVWmRsMUpkRnpzVUxkMmk4?=
=?utf-8?B?TDNYVFprRVdxemJKaHpsdTBvbUU5OUJ0NmhYUERpRzNVL1owMGVUWXBidWp1?=
=?utf-8?B?VUpzR3RWMEt1V1h6N2QzTUYvWWI3cytMajMzOGE1dDRTejdjQTd4Unl3SWx0?=
=?utf-8?B?aFRDWkhFSHlVTTRSUVhXM3NOcWZSVmVDdlRhTkZOeVlIdjF2YmpSbGZWWUVz?=
=?utf-8?B?bUwzYXVvcFN0anF5cWZ5aGlBVjFoMXNzaVZiV3pGV3JlTWdlWURTY0dWbTIv?=
=?utf-8?B?QU1MYlNKcE9iMmN2K2JMZzZYbmpEcUVoNUpaSXQ5M3ppTnZvVk12cVJBVDMz?=
=?utf-8?B?bGNjMkFaOGJVT0xLTzdVczdWbDVyVEZxRXQ2YjF4S3J2K3pyZ0h3NmFiSE9t?=
=?utf-8?B?RFBpbmZQZ1NxQUxtdmFIbUh3a3lHUmFTV1lPWDROSVZ0VVNJWE5rZmIyWTE1?=
=?utf-8?B?MVlvRVExcHg3eDZHQU5TYlVSaUYxeU5ER3dCTkIyMkI4ekdOTVJObnBnc2hx?=
=?utf-8?B?cGV6eGppTVUwajYwcW1mZWxoSk5iYUJRU0lxQ3RTSXMxWEttU0crdjZtbSt2?=
=?utf-8?B?NEh0aFBpN2Q4Uy8xcFVOR2hmWFh3TXByU0FDbjRMV2lsYVBMRVR6YmxrZUlW?=
=?utf-8?B?blFLK0JwTkxKRjluaS9VWVR6ZktCd0xDT0Z0U2JySHhNYzNvUHk4VmptQ1B6?=
=?utf-8?B?RmplTVU0cjNSaFdlRUxzS2ptTE5vQ1pVbHFvTzQrZWFqVUJCL2VkSU4vcXhi?=
=?utf-8?B?alRMcWdhTTZtSWNyMi9KSVRjTHNiYis5NkpRbzJ6TDF0cnBuWFhKSlJZTjlD?=
=?utf-8?B?U2VwZGhJOE1ZZUQvWnNYc0k1aFB1N3BldjJDMzRCaVlHc056MUhiZEVpWVJH?=
=?utf-8?B?UVZ2ZklCUjNpbkZiRVJ2N2xhWWs5SUxqYm1hdWEwZVNja2hIMU8xNHpNWHdo?=
=?utf-8?B?MFpzaU8vTjk2bFZ4L2E4aE1mK3VnQytDWjRvQTI2QXhyZDc2cnpvbm5wcjZQ?=
=?utf-8?B?clc2eHg4c3BhcEExODQ4V0treGhPckViRVlxZTZJU1FhOXJyS3BzdkZCZUNB?=
=?utf-8?B?aFFRTm4wcmJYdlVxeG5CQ0hvTkd4M25CYXlFTytld3NwU24vMDU5YWFDTG92?=
=?utf-8?B?b1FSd0dxbjl6OUF6cE94TFlTOWVZNGdLUkpCb1NTYllPNmxLeFNBaEQvZlJK?=
=?utf-8?B?R1BablM1VHdnPT0=?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB6390.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014)(921020)(7053199007);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?utf-8?B?eWlVZnlEZWxKWE5DaEphbHhTaEZta2xycWNJcHQzdm1PWWdMa0Y1TmwyYTR3?=
=?utf-8?B?dTlkUFIwdGNzeG5SRHZuZjF0TUgrQTJpZHk0Q0F2cDY1SU5VNmlKbmIxWFh2?=
=?utf-8?B?cFBndWFaYldCODFsNkpjYTZ0UGNSZkVLYitJYlFiRDBJUFNkdmpCbG1uZERO?=
=?utf-8?B?VWhvcmNta2QyTTNDQ1BBUlpMcFl1KzdkdmdyVGpLRkJNckxBNVpVbkd0SDQ0?=
=?utf-8?B?SGxYVW11OVRtQTRodng4MUZhNWdvNW5TcVY0Zmg4OGRpUmNQeDdzR0Viajg5?=
=?utf-8?B?Q0tLbTQvclJNZDR4eHNMOE1XVlpVR2NVSjRtbUswS0k4TUZuWVdKelRuZnps?=
=?utf-8?B?OEkzR29KQjFUaGdVL0ZlVGJmTHh3WkxnVWdtckVlVUk5WEFuQjlBQit0MnA5?=
=?utf-8?B?REZoWUVHRUp6MFJSQ3ZrZXJJS1BWWmlRb1ZBeEdxMTUxL2hORVlTL0ZYSlVP?=
=?utf-8?B?dytEVVdrakVlYm55MTVqT3RITW1WVFhlemFXQkxpMEx0VUR0ZGlmaWNsdlRr?=
=?utf-8?B?ZEtwRXdkc1AvdEk5eU9aRTVDeXpBc3QyeHhYeXdSVm1GV3dqNDdJMERCTklW?=
=?utf-8?B?R1VRa2U4RERQaEZndWw5UDNLNG9HeCsvZXR2ZURyWmxJWllnNjdwdVV4dXlv?=
=?utf-8?B?S0o4TFJLMEt6RHZLNTF2ekxNbUhaMDZGNUJmakk1dmNQbTdSVDBaak9ZSXlE?=
=?utf-8?B?TzRPcFhYK0I0SmgzTU85UUorSDlYbi9wUVUzRWVMK2wrMk1zaHNnS2M3bXhB?=
=?utf-8?B?a2F4ZTNhaE5yeVBVZ05FeUlNMDJXVVRpdEdWZCtJbk9SSnhra09sRkF6MUNt?=
=?utf-8?B?SDhXMUVoNDdJM2dpTldudG5tRHl4QUdhc3JCNElYNU13amJMZXdXZ2k1STJL?=
=?utf-8?B?YkFLYk5GVS9xVC8zWlRkQldrSW14RlhEZnpjRWFVQTNIZzBYNjE3czQ2Z2p0?=
=?utf-8?B?bFpYbXVLcldnajljOWhtdmN1L2JSOWhOWFpkOEltT1gzd2FrVW9lL0R2Z1pn?=
=?utf-8?B?TmM2ekl1dmFRUmFYYXcwUjRWV04xQ3FwZWdKWktPVFY0aW55K2toV0Izd1lI?=
=?utf-8?B?QWt5MEJqcDJLeHY4RENnenhNZDczWlFuekFzSEVlZmxwMHhoQ3Z0NGpXTWR4?=
=?utf-8?B?RDlINFdZUDVWTUhobkJ1bkI4Qy81aElQTldZTHRtWkZ4bFh5OSsxYTBPWUgr?=
=?utf-8?B?Z1h6Y0d0NDExeXk4V1kxaC9HY01lZndRMHBUNXE1eUFhZ1VoTFgrSWRlM0U0?=
=?utf-8?B?Ky9YZXViaHpVVk83NGdENDhsekIwYWZuUkVLTGNOTko0cVhvYkc4SFYvU2lh?=
=?utf-8?B?RkhSU3JGNXEvb0Q1cmVSMDl5RUNvUEN6MVE3WFBsbld1NUtQMmxrMjBpaVdO?=
=?utf-8?B?cTV4WllKWlpRMkFqdU1RZlBlWWcwOGpydWtpQ2hCTGhkd202Nkx4cDNlOGpB?=
=?utf-8?B?ZVVkdWM1a3UxV0o3U3dDSU42SVB1K1h2NkVCRE13VGNRKzgyWllMc0MzT0Yv?=
=?utf-8?B?bm5JakpxNmRMTEN1MXlEQzJZNG04SWU0QjBnY1A1Nk1pTTJzUWEwTjJhS2VB?=
=?utf-8?B?aG5SRmtPbENPYXBNSGowbnRrMGJ4Z0FMSFRmaEkrSXk3YlhKV0VjVjhveG95?=
=?utf-8?B?cjA2MzlCaGRYdFc5QUczRHlwTWVweG5QcVF5a2I1bUUvbUF6SW5KMkszR01D?=
=?utf-8?B?TWt0eFRRYkhkYjRxcmJhNVJwSW5ES05ScVk4cXFPQ3dTZlJUWUQ0ZGQ1UzBi?=
=?utf-8?B?dGNpb2RFR3hobFhkNUJzelRhbjNIN3k4c0NlV2RxM3prc2ZzeWRia01WclJ4?=
=?utf-8?B?SDl5V0NvLzZCWERuZkJwYWsyZkh6blludjBHTG9KdktBV3dNMVhlMWxoQ080?=
=?utf-8?B?Z3JCcENycjFUNzVPaGV1aGlOR2ZCblM5SDFvT1RXREpaeVhMelF3VDFGSzF5?=
=?utf-8?B?bERWTWRVR2U5Y0w4ZllSZ3ZQQ1doZTVtaTlBdUVQaTB5UVBCSVBVUTUvTElp?=
=?utf-8?B?b2FkVGsxb21ycFlNY1ZwelBzcGQyaDJUbWxzeHZQTk00RHBDekpoVTBIcGdQ?=
=?utf-8?B?bnR6Q0lxWG5RUTA4ejA2REwrQTF2bHFxUWoxYjg4by9jNEM2WHgyVU1aNS9G?=
=?utf-8?Q?fhG4nFBz0Q5YtR/ltTC3iEYd3?=
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-Network-Message-Id: f18a27ab-3d3c-4349-70a9-08dda50e410b
X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB6390.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 15:24:39.8767
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 4Ev74YpPtpJ4AjcadtbL1bE8C2ht6AqTWiqatZyn073P0W42rNWw47Y/RaM8F1kprEgDf31pWSJkdPf9R0rO3w==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6185
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/6/2025 9:41 AM, Bowman, Terry wrote:
>
> On 6/6/2025 4:08 AM, Shiju Jose wrote:
>>> -----Original Message-----
>>> From: Terry Bowman <terry.bowman@xxxxxxx>
>>> Sent: 03 June 2025 18:23
>>> To: PradeepVineshReddy.Kodamati@xxxxxxx; dave@xxxxxxxxxxxx; Jonathan
>>> Cameron <jonathan.cameron@xxxxxxxxxx>; dave.jiang@xxxxxxxxx;
>>> alison.schofield@xxxxxxxxx; vishal.l.verma@xxxxxxxxx; ira.weiny@xxxxxxxxx;
>>> dan.j.williams@xxxxxxxxx; bhelgaas@xxxxxxxxxx; bp@xxxxxxxxx;
>>> ming.li@xxxxxxxxxxxx; Shiju Jose <shiju.jose@xxxxxxxxxx>;
>>> dan.carpenter@xxxxxxxxxx; Smita.KoralahalliChannabasappa@xxxxxxx;
>>> kobayashi.da-06@xxxxxxxxxxx; terry.bowman@xxxxxxx; yanfei.xu@xxxxxxxxx;
>>> rrichter@xxxxxxx; peterz@xxxxxxxxxxxxx; colyli@xxxxxxx;
>>> uaisheng.ye@xxxxxxxxx; fabio.m.de.francesco@xxxxxxxxxxxxxxx;
>>> ilpo.jarvinen@xxxxxxxxxxxxxxx; yazen.ghannam@xxxxxxx; linux-
>>> cxl@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-pci@xxxxxxxxxxxxxxx
>>> Subject: [PATCH v9 10/16] cxl/pci: Unify CXL trace logging for CXL Endpoints and
>>> CXL Ports
>>>
>>> CXL currently has separate trace routines for CXL Port errors and CXL Endpoint
>>> errors. This is inconvenient for the user because they must enable
>>> 2 sets of trace routines. Make updates to the trace logging such that a single
>>> trace routine logs both CXL Endpoint and CXL Port protocol errors.
>>>
>>> Rename the 'host' field from the CXL Endpoint trace to 'parent' in the unified
>>> trace routines. 'host' does not correctly apply to CXL Port devices. Parent is more
>>> general and applies to CXL Port devices and CXL Endpoints.
>>>
>>> Add serial number parameter to the trace logging. This is used for EPs and 0 is
>>> provided for CXL port devices without a serial number.
>>>
>>> Below is output of correctable and uncorrectable protocol error logging.
>>> CXL Root Port and CXL Endpoint examples are included below.
>>>
>>> Root Port:
>>> cxl_aer_correctable_error: device=0000:0c:00.0 parent=pci0000:0c serial: 0
>>> status='CRC Threshold Hit'
>>> cxl_aer_uncorrectable_error: device=0000:0c:00.0 parent=pci0000:0c serial: 0
>>> status: 'Cache Byte Enable Parity Error' first_error: 'Cache Byte Enable Parity
>>> Error'
>>>
>>> Endpoint:
>>> cxl_aer_correctable_error: device=mem3 parent=0000:0f:00.0 serial=0
>>> status='CRC Threshold Hit'
>>> cxl_aer_uncorrectable_error: device=mem3 parent=0000:0f:00.0 serial: 0
>>> status: 'Cache Byte Enable Parity Error' first_error: 'Cache Byte Enable Parity
>>> Error'
>>>
>>> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx>
>>> ---
>>> drivers/cxl/core/pci.c | 18 +++++----
>>> drivers/cxl/core/ras.c | 14 ++++---
>>> drivers/cxl/core/trace.h | 84 +++++++++-------------------------------
>>> 3 files changed, 37 insertions(+), 79 deletions(-)
>>>
>>> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index
>>> 186a5a20b951..0f4c07fd64a5 100644
>>> --- a/drivers/cxl/core/pci.c
>>> +++ b/drivers/cxl/core/pci.c
>>> @@ -664,7 +664,7 @@ void read_cdat_data(struct cxl_port *port) }
>>> EXPORT_SYMBOL_NS_GPL(read_cdat_data, "CXL");
>>>
>> [...]
>>> static void cxl_cper_handle_prot_err(struct cxl_cper_prot_err_work_data
>>> *data) diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h index
>>> 25ebfbc1616c..8c91b0f3d165 100644
>>> --- a/drivers/cxl/core/trace.h
>>> +++ b/drivers/cxl/core/trace.h
>>> @@ -48,49 +48,22 @@
>>> { CXL_RAS_UC_IDE_RX_ERR, "IDE Rx Error" } \
>>> )
>>>
>>> -TRACE_EVENT(cxl_port_aer_uncorrectable_error,
>>> - TP_PROTO(struct device *dev, u32 status, u32 fe, u32 *hl),
>>> - TP_ARGS(dev, status, fe, hl),
>>> - TP_STRUCT__entry(
>>> - __string(device, dev_name(dev))
>>> - __string(host, dev_name(dev->parent))
>>> - __field(u32, status)
>>> - __field(u32, first_error)
>>> - __array(u32, header_log, CXL_HEADERLOG_SIZE_U32)
>>> - ),
>>> - TP_fast_assign(
>>> - __assign_str(device);
>>> - __assign_str(host);
>>> - __entry->status = status;
>>> - __entry->first_error = fe;
>>> - /*
>>> - * Embed the 512B headerlog data for user app retrieval and
>>> - * parsing, but no need to print this in the trace buffer.
>>> - */
>>> - memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE);
>>> - ),
>>> - TP_printk("device=%s host=%s status: '%s' first_error: '%s'",
>>> - __get_str(device), __get_str(host),
>>> - show_uc_errs(__entry->status),
>>> - show_uc_errs(__entry->first_error)
>>> - )
>>> -);
>>> -
>>> TRACE_EVENT(cxl_aer_uncorrectable_error,
>>> - TP_PROTO(const struct cxl_memdev *cxlmd, u32 status, u32 fe, u32
>>> *hl),
>>> - TP_ARGS(cxlmd, status, fe, hl),
>>> + TP_PROTO(struct device *dev, u64 serial, u32 status, u32 fe,
>>> + u32 *hl),
>>> + TP_ARGS(dev, serial, status, fe, hl),
>>> TP_STRUCT__entry(
>>> - __string(memdev, dev_name(&cxlmd->dev))
>>> - __string(host, dev_name(cxlmd->dev.parent))
>>> + __string(name, dev_name(dev))
>>> + __string(parent, dev_name(dev->parent))
>> Hi Terry,
>>
>> As we pointed out in v8, renaming the fields "memdev" to "name" and "host" to "parent"
>> causes issues and failures in userspace rasdaemon while parsing the trace event data.
>> Additionally, we can't rename these fields in rasdaemon due to backward compatibility.
> Yes, I remember but didn't understand why other SW couldn't be updated to handle. I will
> change as you request but many people will be confused why a port device's name is labeled
> as a memdev. memdev is only correct for EPs and does not correctly reflect *any* of the
> other CXL device types (RP, USP, DSP).
>
>>> __field(u64, serial)
>>> __field(u32, status)
>>> __field(u32, first_error)
>>> __array(u32, header_log, CXL_HEADERLOG_SIZE_U32)
>>> ),
>>> TP_fast_assign(
>>> - __assign_str(memdev);
>>> - __assign_str(host);
>>> - __entry->serial = cxlmd->cxlds->serial;
>>> + __assign_str(name);
>>> + __assign_str(parent);
>>> + __entry->serial = serial;
>>> __entry->status = status;
>>> __entry->first_error = fe;
>>> /*
>>> @@ -99,8 +72,8 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
>>> */
>>> memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE);
>>> ),
>>> - TP_printk("memdev=%s host=%s serial=%lld: status: '%s' first_error:
>>> '%s'",
>>> - __get_str(memdev), __get_str(host), __entry->serial,
>>> + TP_printk("device=%s parent=%s serial=%lld status='%s'
>>> first_error='%s'",
>>> + __get_str(name), __get_str(parent), __entry->serial,
>>> show_uc_errs(__entry->status),
>>> show_uc_errs(__entry->first_error)
>>> )
>>> @@ -124,42 +97,23 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
>>> { CXL_RAS_CE_PHYS_LAYER_ERR, "Received Error From Physical Layer"
>>> } \
>>> )
>>>
>>> -TRACE_EVENT(cxl_port_aer_correctable_error,
>>> - TP_PROTO(struct device *dev, u32 status),
>>> - TP_ARGS(dev, status),
>>> - TP_STRUCT__entry(
>>> - __string(device, dev_name(dev))
>>> - __string(host, dev_name(dev->parent))
>>> - __field(u32, status)
>>> - ),
>>> - TP_fast_assign(
>>> - __assign_str(device);
>>> - __assign_str(host);
>>> - __entry->status = status;
>>> - ),
>>> - TP_printk("device=%s host=%s status='%s'",
>>> - __get_str(device), __get_str(host),
>>> - show_ce_errs(__entry->status)
>>> - )
>>> -);
>>> -
>>> TRACE_EVENT(cxl_aer_correctable_error,
>>> - TP_PROTO(const struct cxl_memdev *cxlmd, u32 status),
>>> - TP_ARGS(cxlmd, status),
>>> + TP_PROTO(struct device *dev, u64 serial, u32 status),
>>> + TP_ARGS(dev, serial, status),
>>> TP_STRUCT__entry(
>>> - __string(memdev, dev_name(&cxlmd->dev))
>>> - __string(host, dev_name(cxlmd->dev.parent))
>>> + __string(name, dev_name(dev))
>>> + __string(parent, dev_name(dev->parent))
>> Renaming these fields is an issue for userspace as mentioned above
>> in cxl_aer_uncorrectable_error.
> I understand, I'll revert as you request.
>
> Terry

I'll update the commit message with explanation for leaving as-is.

Terry
>>> __field(u64, serial)
>>> __field(u32, status)
>>> ),
>>> TP_fast_assign(
>>> - __assign_str(memdev);
>>> - __assign_str(host);
>>> - __entry->serial = cxlmd->cxlds->serial;
>>> + __assign_str(name);
>>> + __assign_str(parent);
>>> + __entry->serial = serial;
>>> __entry->status = status;
>>> ),
>>> - TP_printk("memdev=%s host=%s serial=%lld: status: '%s'",
>>> - __get_str(memdev), __get_str(host), __entry->serial,
>>> + TP_printk("device=%s parent=%s serial=%lld status='%s'",
>>> + __get_str(name), __get_str(parent), __entry->serial,
>>> show_ce_errs(__entry->status)
>>> )
>>> );
>>> --
>>> 2.34.1
>> Thanks,
>> Shiju



Return-Path: <linux-kernel+bounces-675928-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AD19941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:25:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 15DB9172F20
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:25:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E0E5289824;
Fri, 6 Jun 2025 15:24:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="QlKmfyvd"
Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1])
(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 49171126C17;
Fri, 6 Jun 2025 15:24:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223495; cv=none; b=TffMidNXug4K/Jv6mTdhi63sLsAtqY/IoAjWClozD+7WAssZ2HKDbIC6EsUB6ZNTARbtS9LqfVbYfRrMPdO+Yi6V/KkCve5EY2ubbW+XPdwMjSexBW3sni0wwtGGe7cMoe2JvR8S1FXxSKV8HjsRBFfFP+8M03gI1aAISipA8aY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223495; c=relaxed/simple;
bh=PGxsIoF6XolSXA0yz6NNwiZhEBrLUkM+cSRlgFa4b6w=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=evFvnEmpKErByEoxz4dTrFTJX4YWpLF5CpLm+ugJeAnxhDQ8YmCb5VEgx+SzdgNSVa3mtzMd2LP07XOKaGM+4VPEhHew5/zEdmFw1UOsQ3/ZHS5dCvjuwg8NtkCgQEHoALYogGQ0zteTSsZf2aWiBFJ+opMGfSo7DZapgAdBnG8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=QlKmfyvd; arc=none smtp.client-ip=148.163.156.1
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com
Received: from pps.filterd (m0360083.ppops.net [127.0.0.1])
by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556CZAZx030304;
Fri, 6 Jun 2025 15:23:27 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=pp1; bh=71jYEz
zkLLgoJ5VbvpTNuDtlu7S8OnwL/GqbGzUT0bA=; b=QlKmfyvdBBpIXkO+fbv8Mo
J0bAIS6e1OzWCyU/1M9HwXsjCnh17zKX2ajFv4XpfH5cCcpy3myaefUBzboG4wSn
XErxht2lDnaMHsSWoQOLlyw2vYkPfCSmSMZoOGijkLyBANQ1x56I9xKhcNJFQq6k
NFiTzfQTLU84F5FWYsv8hwL/nt1OG03Adt+L1MgDdKX3qqnEnkNkUqb+17nYgnxF
roAo8ss3uOe9fqUBW/jYr4QpchLdd9dTYu2jkOLaYOuruE4mH46TUWosBN40p7fX
RzIWp7Qf9RYLgaAEhxZOi7xbQJ3VYtYt9KBW/9oNcD1WlVVI9hXcdbK5L3gPtwmA
==
Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93])
by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 471gf07ahu-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 15:23:26 +0000 (GMT)
Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1])
by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 556F0mVN024768;
Fri, 6 Jun 2025 15:23:25 GMT
Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6])
by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 470dkmsyj7-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 15:23:25 +0000
Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229])
by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 556FNOXA26280540
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 6 Jun 2025 15:23:24 GMT
Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id 2DFC05805E;
Fri, 6 Jun 2025 15:23:24 +0000 (GMT)
Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id F282258059;
Fri, 6 Jun 2025 15:23:17 +0000 (GMT)
Received: from [9.67.149.38] (unknown [9.67.149.38])
by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP;
Fri, 6 Jun 2025 15:23:17 +0000 (GMT)
Message-ID: <94718ca7-edb8-4e87-9b2d-586dcbd42690@xxxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 20:53:16 +0530
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH RFC 4/4] block: use chunk_sectors when evaluating stacked
atomic write limits
To: John Garry <john.g.garry@xxxxxxxxxx>, agk@xxxxxxxxxx, snitzer@xxxxxxxxxx,
mpatocka@xxxxxxxxxx, song@xxxxxxxxxx, yukuai3@xxxxxxxxxx, hch@xxxxxx,
axboe@xxxxxxxxx
Cc: dm-devel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-raid@xxxxxxxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx,
ojaswin@xxxxxxxxxxxxx, martin.petersen@xxxxxxxxxx
References: <20250605150857.4061971-1-john.g.garry@xxxxxxxxxx>
<20250605150857.4061971-5-john.g.garry@xxxxxxxxxx>
Content-Language: en-US
From: Nilay Shroff <nilay@xxxxxxxxxxxxx>
In-Reply-To: <20250605150857.4061971-5-john.g.garry@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-TM-AS-GCONF: 00
X-Authority-Analysis: v=2.4 cv=Pq2TbxM3 c=1 sm=1 tr=0 ts=684307ee cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=yPCof4ZbAAAA:8 a=FRLcGKbqzZ5yKL8xwJUA:9
a=QEXdDO2ut3YA:10
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzMiBTYWx0ZWRfXzd0EnRca5xVc 0uGyd1wyuBCUmYmpt3lJF8TqD/n7XVAFr1kakUSre9tzJhRqudUpqHO+5QVDAvNe2hTDshZLEBC UqkWesWm+fWT/FK0H+WAPly3a+73oagO18tDW9PW0MeIkQ30V62RPbkWuxJMwTaLgDTjUc+Cnad
k+7cpcbuIkklaySQwf9dyyqkVW5vig03DayEyXRm5xP2a75SjyyokLgSScofh5PdoKsnQ0Vj+tW Fy1/QTR3wxfS+6RnbpcjQqAI8+9N4IFvg4iXcbSassLW35fdGusim5vjpiPrwEXCAXYpOa/OZV/ 6wA7JscWzdD1aKzwGbfO9/L64ijPCayCdArfFA1zQ23Dw7IfZjTy3uC06dYFqBNiKIu4Hg72V7a
uP7/c2FS2oQvvcuL/93L1Vl8LBm+9b74sIT5ybVegVYDSP7exd9mj3uqjm8QjqG89MYlJr63
X-Proofpoint-GUID: 8j7_MUFoHJHOYQoVUE6ahr8RJfFrSiP3
X-Proofpoint-ORIG-GUID: 8j7_MUFoHJHOYQoVUE6ahr8RJfFrSiP3
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0
lowpriorityscore=0 clxscore=1015 malwarescore=0 mlxlogscore=999
phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 priorityscore=1501
mlxscore=0 adultscore=0 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060132
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/5/25 8:38 PM, John Garry wrote:
> The atomic write unit max is limited by any stack device stripe size.
>
> It is required that the atomic write unit is a power-of-2 factor of the
> stripe size.
>
> Currently we use io_min limit to hold the stripe size, and check for a
> io_min <= SECTOR_SIZE when deciding if we have a striped stacked device.
>
> Nilay reports that this causes a problem when the physical block size is
> greater than SECTOR_SIZE [0].
>
> Furthermore, io_min may be mutated when stacking devices, and this makes
> it a poor candidate to hold the stripe size. Such an example would be
> when the io_min is less than the physical block size.
>
> Use chunk_sectors to hold the stripe size, which is more appropriate.
>
> [0] https://lore.kernel.org/linux-block/888f3b1d-7817-4007-b3b3-1a2ea04df771@xxxxxxxxxxxxx/T/#mecca17129f72811137d3c2f1e477634e77f06781
>
> Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
> ---
> block/blk-settings.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index a000daafbfb4..5b0f1a854e81 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -594,11 +594,13 @@ static bool blk_stack_atomic_writes_boundary_head(struct queue_limits *t,
> static bool blk_stack_atomic_writes_head(struct queue_limits *t,
> struct queue_limits *b)
> {
> + unsigned int chunk_size = t->chunk_sectors << SECTOR_SHIFT;
> +
> if (b->atomic_write_hw_boundary &&
> !blk_stack_atomic_writes_boundary_head(t, b))
> return false;
>
> - if (t->io_min <= SECTOR_SIZE) {
> + if (!t->chunk_sectors) {
> /* No chunk sectors, so use bottom device values directly */
> t->atomic_write_hw_unit_max = b->atomic_write_hw_unit_max;
> t->atomic_write_hw_unit_min = b->atomic_write_hw_unit_min;
> @@ -617,12 +619,12 @@ static bool blk_stack_atomic_writes_head(struct queue_limits *t,
> * aligned with both limits, i.e. 8K in this example.
> */
> t->atomic_write_hw_unit_max = b->atomic_write_hw_unit_max;
> - while (t->io_min % t->atomic_write_hw_unit_max)
> + while (chunk_size % t->atomic_write_hw_unit_max)
> t->atomic_write_hw_unit_max /= 2;
>
> t->atomic_write_hw_unit_min = min(b->atomic_write_hw_unit_min,
> t->atomic_write_hw_unit_max);
> - t->atomic_write_hw_max = min(b->atomic_write_hw_max, t->io_min);
> + t->atomic_write_hw_max = min(b->atomic_write_hw_max, chunk_size);
>
> return true;
> }

This works well with my NVMe disk which supports atomic writes however the only
concern is what if in case t->chunk_sectors is also defined for NVMe disk?
I see that nvme_set_chunk_sectors() initializes the chunk_sectors for NVMe.
The value which is assigned to lim->chunk_sectors in nvme_set_chunk_sectors()
represents "noiob" (i.e. Namespace Optimal I/O Boundary). My disk has "noiob"
set to zero but in case if it's non-zero then would it break the above logic
for NVMe atomic writes?

Thanks,
--Nilay




Return-Path: <linux-kernel+bounces-675929-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AD3E141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:25:43 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id D803A7A9098
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:24:22 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 592772857D2;
Fri, 6 Jun 2025 15:25:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="bdwYGjCF"
Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131])
(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 0AEB41B040D
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:25:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223530; cv=none; b=EDxCCdYDfTqQ72/jqBm7fyeeU6k4CiRp91YjdYimf0iky881FOUTTJs6hD7Vx8PLXFdUer7Q2ExsifiXom7ya9m3zgJ7tT/ZGnQMH+Ly1O+563wdUvnevFkqx5dG/8sfH3dZlX6aU4HaxRU3QUZozAdMiztyTPOaGuTdU8B7JEE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223530; c=relaxed/simple;
bh=HC6LsIuSjJdJIiJFfJoG+7VCrWOecIYvMQ4VvDDwg8E=;
h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=VJwAOtCGq1HtpSIpARnC0tkgKKTqXDmCgiD8GVdv+YY6tzt5k3wHKF2Fb2MSbBaDK1SRby+j6Ayx6HtooeZoj3sV4mdXZO/Pp9zNgytjety9Rg0CEObiJNtIyilprrQVgE5Lr3ew1e/3CKGpIZN6mz7XCfRcc/sWdrXtb1xOENc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=bdwYGjCF; arc=none smtp.client-ip=205.220.168.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com
Received: from pps.filterd (m0279865.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556F9G5T004397
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:25:28 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=
cc:content-transfer-encoding:date:from:message-id:mime-version
:subject:to; s=qcppdkim1; bh=QMrk3eQZuTJ6Bbd8ZWvEu0BI3B7FJkAMmmB
mL0sh1sA=; b=bdwYGjCFEG7vaEpcIiuCiiXREzZTyhBYBqo0YNGVj/OFHAG3dWy
k26BWitZglZYM6Sw/ImDKvlujGPtvpmQcV7XdtkYH6hilKOtf2TDyEVH6x3uDsxN
wFGqhCqjI163CeZaFwnnrA0Nq4ppV/FT+TVEq3qc2UdtyOsR+ckRyUuQYsrOyELD
LAmeNq3TvRGLDXoHF9n9wZtDTnPORczrhFh/19xzmZoIB9s8xLmQG94Y0COFNz/N
ljW4kgnaGoEUgeAcHNVenfY6D1eTDAnn9OpZhPlqBHFMPEeK8uQbAvKRj8D7Rw67
dSH/oqxKPaZkbrQBaHJGNTne7iR9ct+QLgg==
Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8t517q-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 15:25:28 +0000 (GMT)
Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7d0962035b7so371944085a.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:25:27 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749223527; x=1749828327;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=QMrk3eQZuTJ6Bbd8ZWvEu0BI3B7FJkAMmmBmL0sh1sA=;
b=AdshdytOShSYYMfGG3V3lkLdFZnXptLUm8EzxhDEEyq8IpbQe+n1NkE5tLWnOknsNg
NcW/3i/FJB9xZnJV2+3V+ZDOltxPQMlpYerEesAe137rLrLxybjYoKjXoKVBnAfu52/p
v3y5UqOFwbcb2wtFhtuKq+NAkuSoWBlTB6HmA/2/0J9TqCpkkfFcnOiTGnhJdGTlbJSa
ZutvMxkawMDdYA3eYN1t3Red6/FW7X83SAniWikPA+nVkPifNdfy+onXRx44BNq73DV6
f7EU2p8vLeKHVDUtF5PgGox7mdAu3VP0eBvGfCfRue9TwaGP+BgFpieeUjKh72ZVwZ+O
kbPg==
X-Forwarded-Encrypted: i=1; AJvYcCU1+vPqrMqfyiU7z+sUMSDPTyD+kiFM3SkUURtix2pn9PX5T8sBU/0kxVUnqP3n5j+/TXdn548RO2fJszQ=@vger.kernel.org
X-Gm-Message-State: AOJu0YxuPKse1tp6AGJMFC0k4zmx0ZyupYvw8MLQEwQyL+5H2bMTr9UG
nHgryZ6BxEeT/30xXJcyUSVsoKw5S0AOJGcn16HhsoxJjRQ/aSRI6r9EWwlVTeTJYOEwh8SSyJ9
3R/9sXJObRHNnKiRU9JWAqCERQxGYjz1/DKK5OwLkdUxRTaRVmcOTQV8cSY6Z1hEVjLI=
X-Gm-Gg: ASbGncu/CieSi1T1y5fPcjjqn4l37xq5quCeX8pII0MHEHMbA84Px/c00tm5vHv+LYI
lEwvFk/jMJlTTeYKtPWgjKYCTGb6ZbhDzGH6lmPnPKq+UW6XEXL/S2SFD6UGGrgzJTICpNBrsfC
+SULmSX0/TPgvN4xH+i2YfRWbovtjFpMLqncO1WZd/o23w7EDE/SBiKQKVSzjBtBz/5YwHjXA/e
l4hoASCbMyQHwRbyThgg4Rea/wI1EQl04t68cCkmtkEjT86rPpqll7YzjreSu/VJemVETs1T4h3
mQum3PfEn5rqhqALfcBCbLFy9Vr2NvbHhB7LVDPMLy6Ga7BY18s3A0TLql2Z6owVbIXMrTNnjan
u
X-Received: by 2002:a05:620a:4487:b0:7ce:bd05:83ed with SMTP id af79cd13be357-7d22987d994mr658447585a.7.1749223526810;
Fri, 06 Jun 2025 08:25:26 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IH7SY5w0YSLHb0XHZ+BNK1tvP4sA95RKfBWut3ciF+YIVDSFV5SVbZ2+XhvLmzE/7rcFXto9Q==
X-Received: by 2002:a05:620a:4487:b0:7ce:bd05:83ed with SMTP id af79cd13be357-7d22987d994mr658444185a.7.1749223526437;
Fri, 06 Jun 2025 08:25:26 -0700 (PDT)
Received: from trex.. (142.red-79-144-193.dynamicip.rima-tde.net. [79.144.193.142])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4521370961csm27575945e9.22.2025.06.06.08.25.25
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:25:25 -0700 (PDT)
From: Jorge Ramirez-Ortiz <jorge.ramirez@xxxxxxxxxxxxxxxx>
To: jorge.ramirez@xxxxxxxxxxxxxxxx, quic_vgarodia@xxxxxxxxxxx,
quic_dikshita@xxxxxxxxxxx, bryan.odonoghue@xxxxxxxxxx,
mchehab@xxxxxxxxxx
Cc: hans.verkuil@xxxxxxxxx, stanimir.varbanov@xxxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCHv3] media: venus: protect against spurious interrupts during probe
Date: Fri, 6 Jun 2025 17:25:22 +0200
Message-Id: <20250606152522.4123158-1-jorge.ramirez@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Authority-Analysis: v=2.4 cv=RMizH5i+ c=1 sm=1 tr=0 ts=68430868 cx=c_pps
a=50t2pK5VMbmlHzFWWp8p/g==:117 a=jucdD076RO8dzeEYkB3eYw==:17
a=6IFa9wvqVegA:10 a=EUspDBNiAAAA:8 a=ixoX2jXuh38yZQZJg40A:9
a=IoWCM6iH3mJn3m4BftBB:22
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNiBTYWx0ZWRfX01JDsoKA7Xvy
zngpE/5Ubo1/ORjNMDTw5fzLfEyUK0EtA5XocH6cH48TR2wONqFcnKig+c89SNSFIp8485Hkokk
inJBol/DcnAyWL2iesU5pyiuOHKX0JJ8Hu76wRMIfzJogSYM8ApxmCySzP3ojcFqEptEomFIFWq
+z/cYY60lfMkivFSrNRzOvbD0z0zD3ikHsQzk6+Q3anC40+lgrKPL+F5aH/RumbLeyNaZiRiGhl
RpaOHkDan5lY+hNfKdqxsYTrv2flxTt/ROueVrt0hipkautBYdYgvL+rF/TWbTxFgwTou8B1Vls
NhYX2OJhTMp5DwyZvuVc+SOIp0byjlE9pMz2RFQ2XHwBTq1TCMI7GrJIHCEM5bTaKYD9C2cpQtM
B/yP85zHhiqNEHvFcLghTILG/x/UH4KwmsvahByLbsiceN7GSKIkXbxLPQ7mk46ISsTUDfa9
X-Proofpoint-GUID: I8TSww4MgaEdiAaO94FUpdlaNoSDighY
X-Proofpoint-ORIG-GUID: I8TSww4MgaEdiAaO94FUpdlaNoSDighY
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
impostorscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0
bulkscore=0 suspectscore=0 adultscore=0 mlxlogscore=911 mlxscore=0
clxscore=1015 priorityscore=1501 classifier=spam authscore=0 authtc=n/a
authcc= route=outbound adjust=0 reason=mlx scancount=1
engine=8.19.0-2505280000 definitions=main-2506060136
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Make sure the interrupt handler is initialized before the interrupt is
registered.

If the IRQ is registered before hfi_create(), it's possible that an
interrupt fires before the handler setup is complete, leading to a NULL
dereference.

This error condition has been observed during system boot on Rb3Gen2.

Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions")
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@xxxxxxxxxxxxxxxx>
---
v3:
Added Fixes tag
v2:
Fix authorship
Fix spelling mistake

drivers/media/platform/qcom/venus/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index d305d74bb152..5bd99d0aafe4 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -424,13 +424,13 @@ static int venus_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
init_waitqueue_head(&core->sys_err_done);

- ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "venus", core);
+ ret = hfi_create(core, &venus_core_ops);
if (ret)
goto err_core_put;

- ret = hfi_create(core, &venus_core_ops);
+ ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
+ IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ "venus", core);
if (ret)
goto err_core_put;

--
2.34.1



Return-Path: <linux-kernel+bounces-675930-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6D22941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:28:04 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 403683AB99B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:27:42 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A642028688F;
Fri, 6 Jun 2025 15:27:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="K4ANQA08"
Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCAB01B040D
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:27:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223676; cv=none; b=fBhvPFCPLs6cocHoktrHvJJdjEtfdKgTz0lw5XBUpah1wB50m/Iznds4/oDZLrmlffz8Yg+9ll2VhXRpRQF8GK6zlzJHgvWn/r+/DFxHq74nAyEwdkGY8LuUcYpHw4ucLx6HCdn8U9VKU3Ng6FTETEscSdsb/CufyuizYWIaPY4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223676; c=relaxed/simple;
bh=ugfrFncA70C9ZK4V8ZompiSzm3hFeJrKmH6Iw6tKOSI=;
h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:
Content-Disposition; b=jZYMUIa+j65v+D9QQgFbtybMKscphs6xPiXkcY9vpeGAvn4W9oSqjuBkE1QTAK0guq2RtsOQ6b8U2fNmv/6K1MjhNUSfgU+Cq3rBSY+ZXuHq4CzG1AqiqHndzUbiBtxaI2MhVS2Aeqg85CqVFZH0SoQ3kRXtBLQgzCUoKIBX8jI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch; spf=none smtp.mailfrom=ffwll.ch; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b=K4ANQA08; arc=none smtp.client-ip=209.85.221.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch
Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3a50fc819f2so1756621f8f.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:27:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=ffwll.ch; s=google; t=1749223672; x=1749828472; darn=vger.kernel.org;
h=content-disposition:mime-version:mail-followup-to:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
bh=HV+zyLjQ0HNvp2YJ2dyJWt9/49NJYivF2xYtOj/CuJk=;
b=K4ANQA08WI1DrOwC9y0brXN6J2PnRCU8H+GHarAEZ/vzs85l1JsGe87z8FsqYyR6VC
ohsE5Bkl1N3n4zgCgu7WZL0jQupsKFPCp3uPNyRwfU7yIxGoV1hL3f/AOvMP8YsVCO5v
f1UkTEnNofkjfD55yYr4latgnV6BeW2BG0EsE=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749223672; x=1749828472;
h=content-disposition:mime-version:mail-followup-to:message-id
:subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=HV+zyLjQ0HNvp2YJ2dyJWt9/49NJYivF2xYtOj/CuJk=;
b=st2iw6WUXds4BDwSKxMZYAXCCgcH5ApzZvAaIAtMQ0zZnzHYZ4VP7qAMEeckpwWoiy
3Yvu/xHgZwi/xTynQZ1AfgtcUm+n42Uouyh+NH4MHqSh1ri3SgWhcwv4MGqxVH24GkeB
thFVltG91LwaikNusXtSbHZEsmplK3NptQDwhUs//jBEMRgEqLoRgLnpn+KnvfSw/3in
y7V2Zt+zGnLybfxPZn9IDz83vdBOndyFfOXysb0ftOnYbXlyy4GweR+4fkCVsH+QRLt1
gbOG2P10o5ocy5NwOYz5C8bX6WerBhdLc1PNIzk2J6LlyEuetRELU4zVEzKRDF+GxYJy
QJUw==
X-Forwarded-Encrypted: i=1; AJvYcCWmo7/sQjq9JDAR7hbgQ3KYHlwwF9y5HotpJIY5J7C4fJoArIHwJc6xmxhi6DQnK/tHjf1C6ZB1SJLt3VM=@vger.kernel.org
X-Gm-Message-State: AOJu0YzXcUr5QrEPhv6e1pFNltRzRmnCcu2oVaLZsmdNA16L5MeRpQYz
ZOR0FyIl7pUVl0obJwcSZtABI0wvQHTZqvVbFxzMTZAHs8H0o0md//1Iz2bdUs606hKYfoQYMhy
CKuTU
X-Gm-Gg: ASbGncssx5CBJVwj6MJrSziwIt343FQz9oTntG6bHT4NdmRR2uJhAr8c34IBPyux2fZ
0uZ8yqYBMKPPSbbQ+s1VbkWuvE5pbqiEK8nBsEfDpZgd1OxYPC6PDbE3nG696zBRWm5igR2AIPK
uufrW60RXa9m9kp/7nwZMcC/r8Bmnpmn8QH9j6WRq/+LwhQOiUfE4ipToYu55x9Fe35MMagc5eH
+55ssmbCB02xvEIxrl8GYGUOo1iotYas1V9YDDXmK1ojYK1itQSoaE2r2qHDWWtFWDdOFbQOfv0
hoos3RYvgVAoiFU+LmHPWhWZpc+r0GzlUOtKfr7beVU2RmIi64fZCzjr47LzgsmHk7yRq8HGag=
=
X-Google-Smtp-Source: AGHT+IEcaPeLT7DBJWnAMobQr9n3IUdJGVV6M4ddpXjS8Lw4C+oT20Nu8NffeHJtFVcrfNR8SyTNMw==
X-Received: by 2002:adf:ce8e:0:b0:3a4:f513:7f03 with SMTP id ffacd0b85a97d-3a531cafabdmr2549452f8f.44.1749223671948;
Fri, 06 Jun 2025 08:27:51 -0700 (PDT)
Received: from phenom.ffwll.local ([2a02:168:57f4:0:5485:d4b2:c087:b497])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a532463905sm2202708f8f.92.2025.06.06.08.27.51
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:27:51 -0700 (PDT)
Date: Fri, 6 Jun 2025 17:27:48 +0200
From: Simona Vetter <simona.vetter@xxxxxxxx>
To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Dave Airlie <airlied@xxxxxxxxx>,
DRI Development <dri-devel@xxxxxxxxxxxxxxxxxxxxx>,
LKML <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PULL] drm-fixes, yet another one
Message-ID: <aEMI9P_NF-K-_sLv@phenom.ffwll.local>
Mail-Followup-To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>,
Dave Airlie <airlied@xxxxxxxxx>,
DRI Development <dri-devel@xxxxxxxxxxxxxxxxxxxxx>,
LKML <linux-kernel@xxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Operating-System: Linux phenom 6.12.25-amd64
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Linus,

Another small batch of drm fixes, this time with a different baseline and
hence separate. Also due to this context conflict in ivpu with what you
have already, linux-next resolution matches what I have:

https://lore.kernel.org/dri-devel/20250606094711.4b9909af@xxxxxxxxxxxxxxxx/

Cheers, Sima

drm-fixes-2025-06-06:
drm-fixes for v6.16-rc1

Drivers:
- ivpu: dma_resv locking, warnings, reset failure handling, improve
logging, update fw file names, fix cmdqueue unregister
- panel-simple: add Evervision VGG644804

Core Changes:
- sysfb: screen_info type check
- video: screen_info for relocated pci fb
- drm/sched: signal fence of killed job
- dummycon: deferred takeover fix

Cheers, Sima

The following changes since commit 0ff41df1cb268fc69e703a08a57ee14ae967d0ca:

Linux 6.15 (2025-05-25 16:09:23 -0700)

are available in the Git repository at:

https://gitlab.freedesktop.org/drm/kernel.git tags/drm-fixes-2025-06-06

for you to fetch changes up to 6f7e234f74caf5f8863bbca51b1b135d0736b0b3:

Merge tag 'drm-misc-fixes-2025-06-06' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes (2025-06-06 14:38:51 +0200)

----------------------------------------------------------------
drm-fixes for v6.16-rc1

Drivers:
- ivpu: dma_resv locking, warnings, reset failure handling, improve
logging, update fw file names, fix cmdqueue unregister
- panel-simple: add Evervision VGG644804

Core Changes:
- sysfb: screen_info type check
- video: screen_info for relocated pci fb
- drm/sched: signal fence of killed job
- dummycon: deferred takeover fix

----------------------------------------------------------------
Jacek Lawrynowicz (4):
accel/ivpu: Improve buffer object logging
accel/ivpu: Use firmware names from upstream repo
accel/ivpu: Use dma_resv_lock() instead of a custom mutex
accel/ivpu: Fix warning in ivpu_gem_bo_free()

Karol Wachowski (2):
accel/ivpu: Reorder Doorbell Unregister and Command Queue Destruction
accel/ivpu: Trigger device recovery on engine reset/resume failure

Lin.Cao (1):
drm/scheduler: signal scheduled fence when kill job

Michael Walle (1):
drm/panel-simple: fix the warnings for the Evervision VGG644804

Simona Vetter (2):
Merge tag 'drm-misc-fixes-2025-05-28' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
Merge tag 'drm-misc-fixes-2025-06-06' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes

Thomas Zimmermann (3):
dummycon: Trigger redraw when switching consoles with deferred takeover
video: screen_info: Relocate framebuffers behind PCI bridges
sysfb: Fix screen_info type check for VGA

drivers/accel/ivpu/ivpu_fw.c | 12 ++---
drivers/accel/ivpu/ivpu_gem.c | 91 +++++++++++++++++++-------------
drivers/accel/ivpu/ivpu_gem.h | 2 +-
drivers/accel/ivpu/ivpu_job.c | 14 ++---
drivers/accel/ivpu/ivpu_jsm_msg.c | 9 +++-
drivers/firmware/sysfb.c | 26 ++++++---
drivers/gpu/drm/panel/panel-simple.c | 5 +-
drivers/gpu/drm/scheduler/sched_entity.c | 1 +
drivers/video/console/dummycon.c | 18 +++++--
drivers/video/screen_info_pci.c | 75 ++++++++++++++++----------
10 files changed, 158 insertions(+), 95 deletions(-)

--
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Return-Path: <linux-kernel+bounces-675931-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A59BE41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:29:27 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5AE6117497F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:29:28 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 116B5289372;
Fri, 6 Jun 2025 15:29:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="guReOcGA"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DECF76026;
Fri, 6 Jun 2025 15:29:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223756; cv=none; b=kV7CwdrYui4L32ILgJsNq7iiQhbfPOgQYVk2vmU+MDuKCR0VwSifCmsVM6u5sq7FdFgi7mFUdHcnETASTbX2LWGSpaaodfyX7TrC/PBi9947MlOYLZDvim07X8F2XXyBOI2AxyIPvwUcMR+TD+f6Ya8/9+Mj76oXQr7n49mSAu0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223756; c=relaxed/simple;
bh=YIkEnsYYTAgzRDQisXl/WSdMTrphUkF1HTvZcQOQYq0=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=oSjKn7uBC3oUquFROpB+OowDe9M+iG/yxn/rfhnlW9qp0skYKJUcEWV37VkkC11rcabmz8aWQ+N5qvl7x+pO3KibkHWn548ywagd6u5DPxJ50474zEpfJUj4v6mGlTUtXQGDuGytEN2PaHda8f7gBPndAZ91klIjHTOFreSUXGQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=guReOcGA; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48AEEC4CEEB;
Fri, 6 Jun 2025 15:29:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749223755;
bh=YIkEnsYYTAgzRDQisXl/WSdMTrphUkF1HTvZcQOQYq0=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=guReOcGAKKw4HD4jeerRrIFyOHMiXU0z9TIQs8uPkmlcV6Mgut3B7/Q3kNTr+TF4S
kOcLJaOeKevDftVnYiOhpJA3fk2Z/auvyc6219Qh9gVutrYzGPT1u4pInE8cHnQgW1
dt8yb3ZKfD9dpROfIMuPoH5MrCjn85IMM9DMcnt8=
Date: Fri, 6 Jun 2025 17:29:13 +0200
From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Cc: Danilo Krummrich <dakr@xxxxxxxxxx>,
Igor Korotin <igor.korotin@xxxxxxxxx>,
Miguel Ojeda <ojeda@xxxxxxxxxx>,
Alex Gaynor <alex.gaynor@xxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>,
"Rafael J . Wysocki" <rafael@xxxxxxxxxx>,
rust-for-linux@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-acpi@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
Boqun Feng <boqun.feng@xxxxxxxxx>, Gary Guo <gary@xxxxxxxxxxx>,
=?iso-8859-1?Q?Bj=F6rn?= Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>,
Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>,
Len Brown <lenb@xxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>,
Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>,
Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
Subject: Re: [PATCH v2 3/5] rust: driver: Add ACPI id table support to
Adapter trait
Message-ID: <2025060635-unleveled-drowsily-a192@gregkh>
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605162726.3659792-1-igor.korotin@xxxxxxxxx>
<aELyEqg0GrkC8oZY@pollux>
<CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 03:26:13PM +0100, Igor Korotin wrote:
> On Fri, Jun 6, 2025 at 2:50â?¯PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
> > However, I don't understand why we need this and the subsequent
> > is_acpi_device_node() and is_of_node() checks.
>
> The idea is to avoid unnecessary table lookups when both OF and ACPI
> match tables are present. If we already know the fwnode type, these
> simple pointer comparisons (is_acpi_device_node() / is_of_node()) let
> us skip the irrelevant match function.
>
> Those checks are cheap (just pointer comparisons), while
> acpi_match_device() and of_match_device() iterate over tables.
>
> So yeah, itâ??s a bit ugly, but it can save some CPU cycles during enumeration.

You have loads of CPU cycles during enumeration, keep things simple
first, only attempt to optimize things later on if it is actually
measureable.

thanks,

greg k-h


Return-Path: <linux-kernel+bounces-675932-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 926DF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:30:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id CE9DB174F78
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:30:08 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E838576026;
Fri, 6 Jun 2025 15:29:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="T5EJUzKq"
Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5])
(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 A5ECA2857D2;
Fri, 6 Jun 2025 15:29:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223796; cv=none; b=Vre1c2Dqfzkqx/LeuXsegqDt0Ah6hz06Snb5WbbbSNlTkk1mGxCEP1iFwaStpUIh/59ozNYzhXaiBq8qlw8TO7zfO0YDW8Kry3S8xfaHXJG/lMBgE/bqHafXIjAmuYI7Vm9HCA+sHcn0FHbakpuC2J8oki8mKEUXEDb8mHN9PWU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223796; c=relaxed/simple;
bh=wPZ31T1OTJ/lEqz6ozHAKyDdaa1BoP9raSYEep7iOxY=;
h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:
Content-Disposition; b=Q+BVWP5eGOUVboFo5gr78uRVqtc42Zgy5m0Vqogd6Aaf2uO3IX2NIPJ+VQ2BMwf0r/vi4FkctZTL/9WtnghR7Yk2L4PfbSvKmI55YP1lXzMid+17sbz6tFW4NhG6b0FEUjdLfGnuYy0pYSp1VlTqaZrsHmIH7zxrY89BTMMP/eQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=T5EJUzKq; arc=none smtp.client-ip=148.163.158.5
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com
Received: from pps.filterd (m0360072.ppops.net [127.0.0.1])
by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556F2CtV025631;
Fri, 6 Jun 2025 15:29:53 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc
:content-type:date:from:message-id:mime-version:subject:to; s=
pp1; bh=TuzBtG6emqrxneh2fDnmxB4Z6BX2h3xJtq3/g8bxJzM=; b=T5EJUzKq
EtqTA02N+jJsUH0CkvRgk1fv15WLosA8bCY1kURIFJZdfbk9DIyKPDud1kMTu5k/
0eQi6B5OSD8KHFAADkI5neoNz4Wzp+/uCyHdKgDPIRdUIQh9NiFH8XWNqINdLJkQ
KJPrtSZoaaSb8E5yLU1vDsv7/JlmUy2Jlm0NK12fGCO6m5ARZcwTgffSXBxvFLnv
9f8Eg3uA+Z+Nr4uOJmFsrsg7lF8oaQihAbC6v3Aag8+lhA2znw5OL16xIEYC2czg
Pwyw7iPSTIiDP2+ypG/H+b3fQssQhKu4BUsX0TkKU3BO2JeZmRk70Gr8Pqk+ZVSk
vosucBQYOxhxTA==
Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91])
by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 472fwuxnmv-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 15:29:52 +0000 (GMT)
Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1])
by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 556Bahn7019851;
Fri, 6 Jun 2025 15:29:52 GMT
Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227])
by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 470d3pa2td-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 15:29:52 +0000
Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103])
by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 556FTmo359441650
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 6 Jun 2025 15:29:48 GMT
Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id 2CB2420043;
Fri, 6 Jun 2025 15:29:48 +0000 (GMT)
Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id DD8EB20040;
Fri, 6 Jun 2025 15:29:47 +0000 (GMT)
Received: from osiris (unknown [9.111.77.68])
by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTPS;
Fri, 6 Jun 2025 15:29:47 +0000 (GMT)
Date: Fri, 6 Jun 2025 17:29:46 +0200
From: Heiko Carstens <hca@xxxxxxxxxxxxx>
To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx>,
Alexander Gordeev <agordeev@xxxxxxxxxxxxx>, linux-s390@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [GIT PULL] more s390 updates for 6.16 merge window
Message-ID: <20250606152946.20790Ff2-hca@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-TM-AS-GCONF: 00
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzMiBTYWx0ZWRfX+6AjeCkiafZy 8kY89VTwO6fmNLqO9dJk8zt4jmgUo10qkSs1QaZSJgKQVLW/CMQ1e7sQGw/DFfVHPwTPRNaiM/3 IiWgXyYf6lg8NFinTGukk1yHNvOT/BYn9LUV28HTxN9PN1AcARPef+n9Zf0yGq8Swk5+8rkfXYU
3NWBS1UpSE3u9sszHDQcRrzpJrsbF2QYkX4wHVHswgYDfkOzQWJhXRI7fMLul6q3gODLz5v0/hP zGt1XoydswgiDyfiismH8E1578HPXRQQ5W8UV3Rcy9iEL7g1JQT5jQMXNDzF4Ipku6GIqJY2axC aL9Q0LOE/mGw/HStVYQksP//i8WFK0G4LDN1X+ttWdaEgGxflTcgWoGm6/H2+zeSWdCdrLkm3Tu
CuZVm+rigb0jnAKenDel6OgIjCa3gBwspvlfytMTEumUGSfKtMbmaGOnbPF9Dv8UzGCJvoAk
X-Proofpoint-GUID: CAJZjNCcqqzX1fNRRpvRxIkmA9b0AUmo
X-Proofpoint-ORIG-GUID: CAJZjNCcqqzX1fNRRpvRxIkmA9b0AUmo
X-Authority-Analysis: v=2.4 cv=QtVe3Uyd c=1 sm=1 tr=0 ts=68430970 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=VwQbUJbxAAAA:8 a=8S_yueXukSYS4pLg3-IA:9 a=CjuIK1q_8ugA:10
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0
bulkscore=0 adultscore=0 phishscore=0 impostorscore=0 malwarescore=0
priorityscore=1501 mlxlogscore=729 lowpriorityscore=0 spamscore=0
clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060132
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Linus,

please pull two small fixes for the 6.16 merge window.

Thanks,
Heiko

The following changes since commit d8cb068359f6210d790828714081d4ccb47014ff:

Merge tag 's390-6.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux (2025-05-26 14:36:05 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git tags/s390-6.16-2

for you to fetch changes up to 11709abccf93b08adde95ef313c300b0d4bc28f1:

s390/mm: Fix in_atomic() handling in do_secure_storage_access() (2025-06-05 12:29:22 +0200)

----------------------------------------------------------------
more s390 updates for 6.16 merge window

- Add missing select CRYPTO_ENGINE to CRYPTO_PAES_S390

- Fix secure storage access exception handling when fault handling is
disabled

----------------------------------------------------------------
Harald Freudenberger (1):
s390/crypto: Select crypto engine in Kconfig when PAES is chosen

Heiko Carstens (1):
s390/mm: Fix in_atomic() handling in do_secure_storage_access()

arch/s390/mm/fault.c | 2 ++
drivers/crypto/Kconfig | 1 +
2 files changed, 3 insertions(+)

diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index da84ff6770de..8b3f6dd00eab 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -442,6 +442,8 @@ void do_secure_storage_access(struct pt_regs *regs)
if (rc)
BUG();
} else {
+ if (faulthandler_disabled())
+ return handle_fault_error_nolock(regs, 0);
mm = current->mm;
mmap_read_lock(mm);
vma = find_vma(mm, addr);
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 5686369779be..9f8a3a5bed7e 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -180,6 +180,7 @@ config CRYPTO_PAES_S390
depends on PKEY
select CRYPTO_ALGAPI
select CRYPTO_SKCIPHER
+ select CRYPTO_ENGINE
help
This is the s390 hardware accelerated implementation of the
AES cipher algorithms for use with protected key.


Return-Path: <linux-kernel+bounces-675933-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D703C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:30:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 5E69A1898DF3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:30:28 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E88B289812;
Fri, 6 Jun 2025 15:29:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pbmecGN1"
Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1B0628540B
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:29:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223796; cv=none; b=XP0F5mABf72PAxIXlUxc6+UtVOpeAihLkgHG9Tyb3oh3dfUKff89PQMdWmfvRmWdmVvVZOcKE/ai38+Z5tHal4nL7HYL4iLbwd7BOSAHI40q+B8OZu1PLFBjJXE+X2MNYhSaXCV/e6j7A2R9QFYezRs2Uz9MZIkkFtO0P9j+gwo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223796; c=relaxed/simple;
bh=v7Au4C4CPsHEk+3y2XJCnvtIlU+mBidFXKTov4cpvRU=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=AqLhMc5LVios4NwfiyWxaz4xsnVlrcvbK86pf5rmzq15qO5TCibzGpV5QYKelvOC9KGALXCOow9PS67zQhHvqYLaxw5kMXcFgKxitSwHcp7OKh+IS0s236KBokA7i8wan7UrcR9Xg0cTRHJSXKnIJY682m5b+4RbXqLKm4Xqf2s=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pbmecGN1; arc=none smtp.client-ip=209.85.218.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-ad51ef2424bso443395866b.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:29:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linaro.org; s=google; t=1749223792; x=1749828592; darn=vger.kernel.org;
h=cc:to:message-id:content-transfer-encoding:mime-version:subject
:date:from:from:to:cc:subject:date:message-id:reply-to;
bh=pHKg9aReCBIhycPzMljP890R0nKClsGn0j0TZZruLEs=;
b=pbmecGN1OqgEPpflLsZ6dogyEF3lkXEgtGQaxQLFjznGg7x3l/xQPaFD7/z6uaPZHa
RlVxeE0SbmVxT8ACQ+xtW3FvCZQE8+YntL3kCqoBmtGcqg5pb51BSS0RNpEsarjnAGVK
mLCDx3HjHR2QrM+NAKgq6JrGMWeJsylP13ZwGbpzWZow0/cP/9pVqZnyI07L/aPlU/Bx
IWXvTJDPKkLo+s4fXRqNIMyUTzyF7EwcyG7moiM4NrZy+BXcqJmKpX4z9qYgDHlsHcvo
/ik0BQ3ArHKyWkBqepM79Nv54AxgyZJbe4sa8ZXzrj4d0X8348ld/Ddn7v5ujqMO84Fg
RY2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749223792; x=1749828592;
h=cc:to:message-id:content-transfer-encoding:mime-version:subject
:date:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=pHKg9aReCBIhycPzMljP890R0nKClsGn0j0TZZruLEs=;
b=PEcznLo69ixCzy6x+nQjLtuLzMDkV3HZ4DtvndAJvzPXPVN2rt2Nl5qVYmKh+ss3e1
RxedK1wa3rJ5HfK3jfaOHhBjuXkSdBzwFRAFp46cqkmQ1r46IIepoy885/gXZPFHG0fz
gLl+6/dTolzQVg8TlmA6rwWQ5Mvm/Oj/LAIyWQJPNGBpd33R9UUgPWcZ+BxVJg6hxsQu
bAj6y1+PQBhceQAbyS5GIngirbZVyZjtBfZxo5Tp0hIUPMCTCQMVuhoHN2iWYUHujKTv
VaGxSJqDANlcI41nyGvFc9l+RGWhqf7p7X7CjU3Uq5JY9H8YhKGSB3ST1p5rKyUzDTjN
tu+g==
X-Forwarded-Encrypted: i=1; AJvYcCW1ZZl4ojZ5nRDmxwoRb22criQk3fLuSDzYOs28KQ5QmUq78AgnO3PGax2woYgZMg21pZXENf7FQnzukaI=@vger.kernel.org
X-Gm-Message-State: AOJu0YzMQ/Hj+WtemCq8t+NhA1CiK+p0VUeRIJFNlR9JVu4FkgG8xoHr
3lJhx/oHILQbCvCWVpI3uEBn4pRz05rwhbWuzChXdN48uVfBY/1++TahCsMlXdzf0H4=
X-Gm-Gg: ASbGncsacaWp4AaAUr5oO52nLDFw2IwVAQi5Gj9Jz8h7Qbu2J4LTTj5leE4gDOuF5OW
9Abzyp/rOejBR1Eb1/nWfPZ1BtJzMTJb+oEm2jx8uTeAHD5Y3jy3tmv92xzNZb02Bh87P9nuiun
kjnuBjBvRqNWlO9oBEtdW7q3Dpn7Phy8A+e6+y3S+JIDm1G2Jcb+ZbRVLbQnJXbP7XDZ4iBoens
E0rXwOOxAbBKttzvdtcPkHA5HCXrn7kgzSypuH4n39XieQK50QRm2VmRQ8dEPRHodYqZrBGklhf
ql5BzdKeDoH2SzxljJ/OzoiIQ2ZEcgrN3FeKksRifWRqk7JYL0gTZsBB9AUdav2f1pKKAWHcfW9
CgPejWIyQTTuWT8dF+9nPOXNHdaT3FAK4RGz5LI7tQA7WWA==
X-Google-Smtp-Source: AGHT+IFIbqOwQmbDQEe3E/wlxCxAjm4JmZX9I8K8ar5M7fYX/U4wmJP0R3iG9BUeJ0Tu3p9r9nBSjg==
X-Received: by 2002:a17:906:9fc7:b0:ade:8df:5b4d with SMTP id a640c23a62f3a-ade1a9329dcmr347910366b.15.1749223792241;
Fri, 06 Jun 2025 08:29:52 -0700 (PDT)
Received: from puffmais.c.googlers.com (140.20.91.34.bc.googleusercontent.com. [34.91.20.140])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1d754913sm130801166b.4.2025.06.06.08.29.51
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 08:29:51 -0700 (PDT)
From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 16:29:43 +0100
Subject: [PATCH] scsi: mpt3sas: drop unused variable in
mpt3sas_send_mctp_passthru_req()
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Message-Id: <20250606-mpt3sas-v1-1-906ffe49fb6b@xxxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIAGYJQ2gC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE
vPSU3UzU4B8JSMDI1MDMwMz3dyCEuPixGJdQ1NTM2MLA8s0cwNTJaDqgqLUtMwKsEnRsbW1AGY
q/l5ZAAAA
X-Change-ID: 20250606-mpt3sas-15563809f705
To: Sathya Prakash <sathya.prakash@xxxxxxxxxxxx>,
Sreekanth Reddy <sreekanth.reddy@xxxxxxxxxxxx>,
Suganath Prabu Subramani <suganath-prabu.subramani@xxxxxxxxxxxx>,
"James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>,
"Martin K. Petersen" <martin.petersen@xxxxxxxxxx>,
Shivasharan S <shivasharan.srikanteshwara@xxxxxxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>,
Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, MPT-FusionLinux.pdl@xxxxxxxxxxxx,
linux-scsi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx,
=?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@xxxxxxxxxx>
X-Mailer: b4 0.14.2
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

With W=1, gcc complains correctly:

mpt3sas_ctl.c: In function â??mpt3sas_send_mctp_passthru_reqâ??:
mpt3sas_ctl.c:2917:29: error: variable â??mpi_replyâ?? set but not used [-Werror=unused-but-set-variable]
2917 | MPI2DefaultReply_t *mpi_reply;
| ^~~~~~~~~

Drop the unused assignment and variable.

Fixes: c72be4b5bb7c ("scsi: mpt3sas: Add support for MCTP Passthrough commands")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
drivers/scsi/mpt3sas/mpt3sas_ctl.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 02fc204b9bf7b276115bf6db52746155381799fd..3b951589feeb6c13094ea44b494ca3050a309b15 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -2914,7 +2914,6 @@ int mpt3sas_send_mctp_passthru_req(struct mpt3_passthru_command *command)
{
struct MPT3SAS_ADAPTER *ioc;
MPI2RequestHeader_t *mpi_request = NULL, *request;
- MPI2DefaultReply_t *mpi_reply;
Mpi26MctpPassthroughRequest_t *mctp_passthru_req;
u16 smid;
unsigned long timeout;
@@ -3022,8 +3021,6 @@ int mpt3sas_send_mctp_passthru_req(struct mpt3_passthru_command *command)
goto issue_host_reset;
}

- mpi_reply = ioc->ctl_cmds.reply;
-
/* copy out xdata to user */
if (data_in_sz)
memcpy(command->data_in_buf_ptr, data_in, data_in_sz);

---
base-commit: a0bea9e39035edc56a994630e6048c8a191a99d8
change-id: 20250606-mpt3sas-15563809f705

Best regards,
--
André Draszik <andre.draszik@xxxxxxxxxx>



Return-Path: <linux-kernel+bounces-675934-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DB5F141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:30:32 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 24DAF175627
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:30:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C2BA5289360;
Fri, 6 Jun 2025 15:30:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="DcJWtOcZ"
Received: from AS8PR03CU001.outbound.protection.outlook.com (mail-westeuropeazon11012047.outbound.protection.outlook.com [52.101.71.47])
(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 105C914F104;
Fri, 6 Jun 2025 15:30:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.71.47
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223817; cv=fail; b=WEvaQ+kPsRXX2Awda1etMuFaknqM/GxCJAIms4ZslNwDiG2G37CKUJo96oMDmTLSaBh3h8aee6MBZbFApRot5GLv6AEf4LlxUgnOW92Z4taPK/Yv47Km5HjiZ7OWO4XjZbGccfpbOCH4UfJQRlmiuEMtGjTRf0nu7UWI6iGhe8A=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223817; c=relaxed/simple;
bh=Lje4wNRKgwb25qGrm7iajkZCikV8+VEzDk5D4QEmC5I=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=Yq6mGzsnEO5Z7/7uBdVa6sHPCsjU3rN9EB+XcXn4NunULHebctkctKBbbD2kp77D/6vhsbpbcJvkrIS4D1BxgMHWjfMWS/frMroNOIMzjMpyzwM1UMphVHcLauz8D1Iax0AdWIg2wavj1ukYK8YyfbqfXQSjvsn9gqyZcQTNiCo=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=DcJWtOcZ; arc=fail smtp.client-ip=52.101.71.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=xtMaMVHUiYbTw/nGHxgepY2mlyyQQRXXOT3q1PUhnVA3ML5fZff2TYseeGAxaxKL5LBuRBVhxl11QKsatPd/hoaisoR51txmX+GgxVbno5OKzklBryN5lZTGBmkRZKuo32Il9BSKRCZy6UCyUweupUvdr2RVJUcRNd991RsJFOEEuvLTvVRAettW4AEPGP02KueOR5ZmSxDo8O9w0McINGxlDClPLxn53W8RTuWmgQiPNC8fvzdQAv2iuZEnQTODO/TuiYLVoHw8V07bf08VakGjvz1PM5rmyT6HvCopADJSosZPYk/9nMKLIDFnENOh9/w1RIuLZ9UwcFrlc2274w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=btl5kK6xryG+Uxq3Mmi9pvnmZdChsjQKfoH5Tqeqjuo=;
b=l/NDtyDOqj3K+Vh29Sz0kDKwm5zTl10oOR0bLRd9LcUcHnjciZ4gP2Uwdhu1qdRbWr0IlRWiWhh9i28sNtQHJPj4K5QUTr3mP/QyR4qladIHbJbKXZVkqDrqDjOhAdNcbX9Rx/BlBKDX8Z58BTgVs8GctmY8aYQ1n3tyhXVGOEb7aZHYlp4tV1ghcIfNw+sUQGeA7m43xSy6J3G3G7+r5/zzZTspuxOlrYpw4udg+q7ja7FZh0oPOebu5+242QXT3DAgt5Rd3d5TNe2BL8mkIFVvlovOFhZZe4Rv/2BixraXXzZfcQ0YWUQuO9RNJyUTjsxsYtO6XXYbWcqsGuO/Gw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=btl5kK6xryG+Uxq3Mmi9pvnmZdChsjQKfoH5Tqeqjuo=;
b=DcJWtOcZvuKrT79MWv6cBW0kXHByGWU6FbPTv4I+oPchCs647QsaDWtPZwTVDRDUydcNT0v+bUtpiqEX/KZ6dUajw2YPLo7W62A8rJt6isyGzHYG2yp3NUEE/lSHq91x9SBz5hwyDM3CrKxXe5zZSp0olpCfVFN1A97rIUtQRJKJFHYBEjzHz+fzmMc3koMSvyfdDdypjR/8A6TK0mKFJeV/aDKcZlg+ksR9eTpTKOGozGdFBZpUwqAfXjjB+1dlVx9JFZUtB+ReHHeMqFEgjTJ7iReTray3IVt0T+W7RI8soGXcZmXoNXIg00hBwY/lAcbgz7CDaCMWbQqlc472Rw==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14)
by GVXPR04MB10183.eurprd04.prod.outlook.com (2603:10a6:150:1c1::17) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 15:30:11 +0000
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06%6]) with mapi id 15.20.8769.025; Fri, 6 Jun 2025
15:30:11 +0000
Date: Fri, 6 Jun 2025 11:30:02 -0400
From: Frank Li <Frank.li@xxxxxxx>
To: Richard Zhu <hongxing.zhu@xxxxxxx>
Cc: l.stach@xxxxxxxxxxxxxx, lpieralisi@xxxxxxxxxx, kw@xxxxxxxxx,
manivannan.sadhasivam@xxxxxxxxxx, robh@xxxxxxxxxx,
bhelgaas@xxxxxxxxxx, shawnguo@xxxxxxxxxx, s.hauer@xxxxxxxxxxxxxx,
kernel@xxxxxxxxxxxxxx, festevam@xxxxxxxxx,
linux-pci@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
imx@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v1] PCI: imx6: Align EP link start behavior with
documentation
Message-ID: <aEMJeovM0G/+WZo7@lizhi-Precision-Tower-5810>
References: <20250606075729.3855815-1-hongxing.zhu@xxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606075729.3855815-1-hongxing.zhu@xxxxxxx>
X-ClientProxiedBy: SJ0PR03CA0246.namprd03.prod.outlook.com
(2603:10b6:a03:3a0::11) To PAXPR04MB9642.eurprd04.prod.outlook.com
(2603:10a6:102:240::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|GVXPR04MB10183:EE_
X-MS-Office365-Filtering-Correlation-Id: 4ac8f6ed-6193-4fa7-b3c3-08dda50f06cc
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|1800799024|376014|7416014|366016|52116014|38350700014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?XSu+coH6gRaN+QSVJ5yFfuetM9CksR6+py5RySV2RCIkuT+lXq5jM40/aljA?=
=?us-ascii?Q?GLCZ1W25frMU707//FdkO8JlQnGLn6O6aD+6FHdx+PcQvNPY7OfjbGhax4EW?=
=?us-ascii?Q?LLxOC0mvSOhteSbYHwpfIwG1rJlaigQtLzIy+7AbgVBcbt62BE49+qFKyPGB?=
=?us-ascii?Q?9WLBUHwJR3sOb8zS+4Xac0N696KG2+Qbl2l2I4GCTsmtkFeL/gyYqopj5dh5?=
=?us-ascii?Q?D7JVyK4ZZbM79pRlOZip/cMIIrrQISq0ihACP1enYdQDejL1XBit4p59Fm2G?=
=?us-ascii?Q?GQa/BGllOjMCkcXwf9sIW4Y+QrwM03lMoyfYq1MdPnOnfEFs2QGsZD4TkPgS?=
=?us-ascii?Q?zLC4drEDxh8P+chCGPerA296R5EpTlQG+Yzs1QnrYqCtL1FxhWys8JpAFJH/?=
=?us-ascii?Q?S4AdMmn1A9vRpy8PrvXqKSP0I8Du+rTGhksvGzLCTuJslYuylEAZTNBIcYq4?=
=?us-ascii?Q?gqZH7ZNCmXNCq4TjmGoqlPp9OW4wvcdM72ZVWd/90FGB6wDPhbdF3fN7UQgK?=
=?us-ascii?Q?9m1J04jdd8p5Zt3ss7TheAkOt6fYTjeAmooD5/937Rvi3Y6Xp97K1IgEw4ok?=
=?us-ascii?Q?moMj2ScqWMCIEMNWZNBpS/21RJ4UPOjdMz5nTZ9m8qoDUHnBUh00fg60Xb1j?=
=?us-ascii?Q?QWVqDWxN3g0HRJOCh5CsuxlgZNGmPQu+vA3rn6kxnHM4WMyStgrqh2ojIrWU?=
=?us-ascii?Q?/YTT09ps3NL+4HHubSTJ+Fftth3Xo+HKgwj+V+f2FIueMPmhQYBT6ipvYYro?=
=?us-ascii?Q?yedmMgbDg4QXcfVa6nD6Gi9Bmm4UfHLpx4WexW7Ku011bfs0cpoaqUGfLY1h?=
=?us-ascii?Q?9fGOD6CvR0g28GiUpehTgZmJSM/HzIelr4QCK4/1jlbkdAUZNTrZYTchqNyv?=
=?us-ascii?Q?ZEq6vPtHvDnlFUue8W6XiwAykpMuhGS9KyjcC/MAILQfHBoeW1+qWmu/NyxU?=
=?us-ascii?Q?/ggcGwhSclrZcWZQLp2qNhBnAdzaxzIPq6FWXUAyEpOxZmPyjq+kai8pH0ol?=
=?us-ascii?Q?Hz2GnUegcXBj5aA4S1l5CwCM0QA9s6R4hVuUoMuQYR/So8c/ghSrjOfnvrJL?=
=?us-ascii?Q?fp/FsXK2Ryx2pFFwo2KXv3QehI2Nse7rXhqd38C7WqjSAbjVeUnLU0+LPFVl?=
=?us-ascii?Q?iqdCnlMwkOcZV6cxKEs8XKWQm+zkc+l9DKHOqgE2xMWuqHN0G9+nw1CBUizF?=
=?us-ascii?Q?WdMolDG+A4JjLqn7usEzIqqGtCtTCXyIwi7IIgryrYfaz2AeNWWB3DMQrMN1?=
=?us-ascii?Q?ietWBnd45wmIh/4mw2vmflZb24R2tdJ3ikHm0gbX9a5gA36tSKCL70lwCsB3?=
=?us-ascii?Q?TStPn1d/hRKDG44SwXzwYq9gcS19vQxfNQ6W8s/qjRmArNJkV8goN41D5T4t?=
=?us-ascii?Q?oTLBqdrCz6T/CDIoZ4d4QQfrz7kK9LHSDXiOjrQ7OWivhOg/oP24LHFeXmQ4?=
=?us-ascii?Q?2ZoTN/Mjei5zznHUv5Sf+Yzk4wvIQTrFAXqISoUUc+91Ah45TNOsZA=3D=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?pUdU8SIDhWX+MODtgpvrjp8enHPh9s8V8Lk+ogRhiraE9YtsLU5QXHPmDkvV?=
=?us-ascii?Q?Hptn5OntMMRFZgLHXUX7FwKWwA+OpZVE3GEQ/fwPnvFXZKnpTnNUEddPQhCU?=
=?us-ascii?Q?68mXStfcx5pFjKbnZ6bYiC6NG8yg9llmZwJoKhe0u5vhxqYztVK6SXrWOSEX?=
=?us-ascii?Q?5aZWEQFhNZa19bGMhj8FdZHyjG0GPqj5daFkzW7S11OFsIRAhT+ig683A2Me?=
=?us-ascii?Q?xpvDIGJc+ebVyXlJOcZBWpAQNh9rML330JOVR95AWSbshgWndZYxQg7zxdTq?=
=?us-ascii?Q?3ZMPQffSJwvsuBZiUZjLsNbyUByB8qmvsPsQm4OPE6qqFbpDkGj+kd0JGdtX?=
=?us-ascii?Q?0dbLEtrslT0SDEDGbPJJp2L7TAnmWZUrRV83Bj7W1hPvMyrEy1Lyr+OngUKa?=
=?us-ascii?Q?MAlNnCO71w7CpQSVz0/GBIOufdHwDDH8yVOrCVO8eBbjDohgHyaqnr9e2b9z?=
=?us-ascii?Q?riGNgxOpb4lJPlN+zGMEZQ5Td+u8J84z682Mppw0BGVeE/8vTMoQ6JjwcSpy?=
=?us-ascii?Q?u39pDWcKGI0g813TeAdKwl1v53x5f5W4VRR1WS02DiZNgrmhdzCNfgXSja5V?=
=?us-ascii?Q?8SQcE/WmlFxqU/EsHFssEH0OoILjUkJYUd2hQyiUgxxJOkH/DLD0ldjBLnsY?=
=?us-ascii?Q?hRjSkEw/dcd+HoIZmBJ0m+KLuU1rug/51GWh9EHgIKfEwQ/HeI00bh3wjRo2?=
=?us-ascii?Q?ayrHoWaAon3XgZjfY7zfUBUy1D7SboLqmXmDXFZXFzfGB1cVOZp/Tlr317Md?=
=?us-ascii?Q?RSdiZgEILFT3ODnMBEQE9axUWAxsw1Clwvp9fxNiRQQbdKTVXshd2eprqbcy?=
=?us-ascii?Q?+htDPL+HYMMwgz35RPfN0pJD6ryLQMFge8o0fnkdXEQk9lF7MYuVzjvlvMbm?=
=?us-ascii?Q?5SOf/hDAOH+Zxpk2zip43hU6IcQFmT0AnfqLUnUkiUiJCNIEYXQ/gpAZPMa0?=
=?us-ascii?Q?yD+/az+TS6EyOCZg4FJmTlFD90X1jaN7R9gjhaS/RFBYZPDp5rD4grfYXJ5s?=
=?us-ascii?Q?5cQPIeJzRC/7F/wvIR7q1gGEsDLB8iJ3EXFL5LW6zYTAy6tenMiUZyyGrz6v?=
=?us-ascii?Q?XopKM10fKoTJ64T/vkYp2PG2yF8ttYHY+C0isODZyQx38cHlS0+91AEOaFVL?=
=?us-ascii?Q?FWrihEH0ivMrxDknzOCPh7G4qftzQDTFg6d6a0jORBUvOR4RxILK3hmw/YuS?=
=?us-ascii?Q?wJQ0U3MC9VbnunefAbN0BucbpPP9/bldBlFvN88EsNJGbsTC4PgqYn5wlSm1?=
=?us-ascii?Q?HgvmJO/OAPdoZY4D22Z/gV+xCBcNDF1s2gLs+kwKB+itL1p9tY9f0Bi9HMGN?=
=?us-ascii?Q?2GQFRBsoDlfp1ocXY7NCFlles6Pqv/adu2AJA0mmE97df4Y183nHze6ZEC9A?=
=?us-ascii?Q?n34dOu0+0wncC8Lhz/xczYKQI6IyVwYexKCGEYuCyA37bTJD2udMGLlI6gTX?=
=?us-ascii?Q?XKMsfGFBOVKXjPK5EzTlTkXke/vik+Ju5p/ZFZcaYEQEHxlxJq6NSSIPETK2?=
=?us-ascii?Q?fIV22la2fQbL/rCi3gNugbv5LQvUWuwuOIJoad5RVpLmuhX4yrHHFWemuTWV?=
=?us-ascii?Q?6cQf9B7QHvsTSsxMbC8=3D?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 4ac8f6ed-6193-4fa7-b3c3-08dda50f06cc
X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 15:30:11.5017
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 3LJjwITTqIBHUKuMavIdG82PqQUEBGUhHRcxFsU2T9FXXegzQ7/laC+r+pe+NF25iYMPmRURio49zl5Cvs+unw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10183
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 03:57:29PM +0800, Richard Zhu wrote:
> According to PCI/endpoint/pci-endpoint-cfs.rst, the endpoint (EP) should
> only link up after `echo 1 > start` is executed.
>
> To match the documented behavior, do not start the link automatically
> when adding the EP controller. Ensure the LTSSM_EN bit is not asserted
> to 1'b1 by default.

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

>
> Signed-off-by: Richard Zhu <hongxing.zhu@xxxxxxx>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 5f267dd261b5..69825e47d2d4 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1337,6 +1337,10 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
> struct device *dev = pci->dev;
>
> imx_pcie_host_init(pp);
> +
> + /* Make sure that PCIe LTSSM is cleared */
> + imx_pcie_ltssm_disable(dev);
> +
> ep = &pci->ep;
> ep->ops = &pcie_ep_ops;
>
> @@ -1360,9 +1364,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
>
> pci_epc_init_notify(ep->epc);
>
> - /* Start LTSSM. */
> - imx_pcie_ltssm_enable(dev);
> -
> return 0;
> }
>
> --
> 2.37.1
>


Return-Path: <linux-kernel+bounces-675935-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8F99C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:33:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6DBC67A87F9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:32:02 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A666288CBA;
Fri, 6 Jun 2025 15:33:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y9sY+4Vw"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76C1B126C17;
Fri, 6 Jun 2025 15:33:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749223990; cv=none; b=akSLRL8ThNN9qerhMBqTEcDvRrxrEQs42uhRU2NEfWx0I3XRd2af5ZjbzJuweGjw0nswqpRPSQuflAIo0XoeWGUD2HhAlMSSjF12UQi7mNiZf5bESqrNx1Mwf2vgbQqZm4Y6R4nTp/CUUQzrPlX4KTej8J+VPKHafsnN23gTW9A=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749223990; c=relaxed/simple;
bh=eFI9xeUFmF4rI2dCK4V9G58Eni9zAREHZy6uDgy3Crs=;
h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=Z0XXBDBcbo3XByNK7dl/PIoWM7pCJg8ZS0wh0LG2qGOi8ThiMxi/1DxZcmNJmiHIJcA/6Ew3d1cuUYFV5Fif7UxOT1bqPhZwYeOqc0zBH8v90Ql7nzgQOHtHcVwrUpu76Artd1bGJOFcw7u0a1hHgPNDE+0dDYd3jyZjaTSbrFA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y9sY+4Vw; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPS id 1A19BC4CEED;
Fri, 6 Jun 2025 15:33:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749223990;
bh=eFI9xeUFmF4rI2dCK4V9G58Eni9zAREHZy6uDgy3Crs=;
h=From:Date:Subject:To:Cc:Reply-To:From;
b=Y9sY+4Vwylp42SVCseYf+Xs9IllAuZ7nyJjRbl/gVeQ/Lacg9NXvsA5rIMajjzOb3
tAlhbSHPpYoil4TaQXo/NwCzJgQduIzrTl06AL6itN5GOfk+nFdMeZc2Zop+DZD+g7
gcSG+GcG83cbNq9MTnd4T9FkCa5ZOFPw/5fL7Pmvui6kzsRwALF9Px/bQpdi8WRB3X
R3cvH2IPzoZNtPyJGqSvF3/BLlVjnuA3ARUiEpWfL8wPxEKtiYPjMznE42xUMzWrlh
rBkR9tO5GzNlwyXHjJEXwjRvD4/JK0pIvwYiWVa9YLa1JcN4mZpplJGIuMCB2uHQjl
JOD0AEZJgZdSg==
Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1])
by smtp.lore.kernel.org (Postfix) with ESMTP id 0664AC61CE7;
Fri, 6 Jun 2025 15:33:10 +0000 (UTC)
From: Haochen Tong via B4 Relay <devnull+i.hexchain.org@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 23:33:03 +0800
Subject: [PATCH] Bluetooth: btusb: Add a new VID/PID 2c7c/7009 for MT7925
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20250606-btusb-mt7925-add-v1-1-9b64bfa86ea4@xxxxxxxxxxxx>
X-B4-Tracking: v=1; b=H4sIAC4KQ2gC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE
vPSU3UzU4B8JSMDI1MDMwMz3aSS0uIk3dwSc0sjU93ElBRd4yRL00RLM3NjCzNLJaC2gqLUtMw
KsJHRsbW1ANE/BQhiAAAA
X-Change-ID: 20250606-btusb-mt7925-add-3b95a9673869
To: Marcel Holtmann <marcel@xxxxxxxxxxxx>,
Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx>
Cc: linux-bluetooth@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
X-Mailer: b4 0.14.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1749223989; l=3127;
i=i@xxxxxxxxxxxx; s=hitori; h=from:subject:message-id;
bh=l1pzEMSqiCKHnCKcovE0KP8Jz664l6WVWK2Fa8hLWhY=;
b=CXITlyYQ4OL76dWZM3RLlobupw/4ikv4zkqcYbPCxMnlwLo6C0qf5KFCMg924Z6zYq5zmg51+
+GB8fdHiO1XBU4Yks3v2bf6/a60SPfjdM01L8feI2uV6+vVDDF2r2mB
X-Developer-Key: i=i@xxxxxxxxxxxx; a=ed25519;
pk=PyxHSC4BlFPXyw6JBia4ophgQYawC9AZWZKF9uDPsz0=
X-Endpoint-Received: by B4 Relay for i@xxxxxxxxxxxx/hitori with auth_id=428
X-Original-From: Haochen Tong <i@xxxxxxxxxxxx>
Reply-To: i@xxxxxxxxxxxx
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Haochen Tong <i@xxxxxxxxxxxx>

Adds a new entry with VID 2c7c and PID 7009 for MediaTek MT7925
Bluetooth chip.

The device information from /sys/kernel/debug/usb/devices is provided
below.

T: Bus=03 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#= 3 Spd=480 MxCh= 0
D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=2c7c ProdID=7009 Rev= 1.00
S: Manufacturer=MediaTek Inc.
S: Product=Wireless_Device
S: SerialNumber=000000000
C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
A: FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=125us
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=8a(I) Atr=03(Int.) MxPS= 64 Ivl=125us
E: Ad=0a(O) Atr=03(Int.) MxPS= 64 Ivl=125us
I: If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=8a(I) Atr=03(Int.) MxPS= 512 Ivl=125us
E: Ad=0a(O) Atr=03(Int.) MxPS= 512 Ivl=125us

Signed-off-by: Haochen Tong <i@xxxxxxxxxxxx>
---
drivers/bluetooth/btusb.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 9ab661d2d1e69028061fa3accd5106f481094100..e4a45596762f8c7d8ba10b4107d6e6f2203188e2 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -725,6 +725,8 @@ static const struct usb_device_id quirks_table[] = {
BTUSB_WIDEBAND_SPEECH },
{ USB_DEVICE(0x13d3, 0x3630), .driver_info = BTUSB_MEDIATEK |
BTUSB_WIDEBAND_SPEECH },
+ { USB_DEVICE(0x2c7c, 0x7009), .driver_info = BTUSB_MEDIATEK |
+ BTUSB_WIDEBAND_SPEECH },

/* Additional Realtek 8723AE Bluetooth devices */
{ USB_DEVICE(0x0930, 0x021d), .driver_info = BTUSB_REALTEK },

---
base-commit: e271ed52b344ac02d4581286961d0c40acc54c03
change-id: 20250606-btusb-mt7925-add-3b95a9673869

Best regards,
--
Haochen Tong <i@xxxxxxxxxxxx>




Return-Path: <linux-kernel+bounces-675936-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 047CB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:34:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 82B8E173214
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E7AA288CBA;
Fri, 6 Jun 2025 15:34:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="BlffJf/D";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="hGHpgx7E";
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="BlffJf/D";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="hGHpgx7E"
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAF4A17A2F0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224044; cv=none; b=K8IvGqdacxWomRmFV3rSMZinKV+GYDXuoeK+TIQwD+4iWr11GKEmipNWDIG9KWmtAU/2OXxGSvqlWLcEkc6VR654vpg/7GKX8lZ90MCQE50LvfuqHsPWwRQ0NH3ESzZ73NYtrWWObNsL1Iazj+NSnu0UFbvF9tr68Jt8vkLaeNI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224044; c=relaxed/simple;
bh=6zGH2THaO++Hoe2Pq3QI6AhoAcscA0m3XSJOahn94Qw=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=HRsmgyo7Q/ORFNNkAxRvqwVfuf/8iqQOHxCUbGVCVYA+LimTJqyLmlDnN2uP+rxDxtFBwnD446LEOvr7ypZTg/FfuHSpPmGYGVwcdT2hnMcVF/Dsp5DgLLmyVe2ZCrqtxOj50WRUmhn6vBD9VbVyTDxdmVmOi/m9jG690cQ4FUc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=BlffJf/D; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=hGHpgx7E; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=BlffJf/D; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=hGHpgx7E; arc=none smtp.client-ip=195.135.223.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz
Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by smtp-out2.suse.de (Postfix) with ESMTPS id 30C701F7AF;
Fri, 6 Jun 2025 15:34:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749224041; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=SlwW0J0385Y0bArYP2SUZCYXr9QqXS7xayaGmcRxHrI=;
b=BlffJf/DBrN5guDiHTn0NQPpKU7mMuHbwBoSgvGqSJD+AhxjnE85osPIFTdzS2ph5vH8ny
wrILZp4VyPV0yO+osD9vJaNwOXVDnW5E+vSyuiZ9STCTuEYfrod06qX9sA3cz52fOh15tG
AxaWABKIcXvwfUMPEikLBL3weUsOXZk=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749224041;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=SlwW0J0385Y0bArYP2SUZCYXr9QqXS7xayaGmcRxHrI=;
b=hGHpgx7EGs+9pq7TLA28HHzDvffqXl+pWlyrywYRA25G2gCoCgYcAwBsyHtlrM0tYQA88w
wh3wuaYX5H13mKAw==
Authentication-Results: smtp-out2.suse.de;
none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749224041; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=SlwW0J0385Y0bArYP2SUZCYXr9QqXS7xayaGmcRxHrI=;
b=BlffJf/DBrN5guDiHTn0NQPpKU7mMuHbwBoSgvGqSJD+AhxjnE85osPIFTdzS2ph5vH8ny
wrILZp4VyPV0yO+osD9vJaNwOXVDnW5E+vSyuiZ9STCTuEYfrod06qX9sA3cz52fOh15tG
AxaWABKIcXvwfUMPEikLBL3weUsOXZk=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749224041;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=SlwW0J0385Y0bArYP2SUZCYXr9QqXS7xayaGmcRxHrI=;
b=hGHpgx7EGs+9pq7TLA28HHzDvffqXl+pWlyrywYRA25G2gCoCgYcAwBsyHtlrM0tYQA88w
wh3wuaYX5H13mKAw==
Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F389C1336F;
Fri, 6 Jun 2025 15:34:00 +0000 (UTC)
Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
by imap1.dmz-prg2.suse.org with ESMTPSA
id f5UjO2gKQ2gaLQAAD6G6ig
(envelope-from <vbabka@xxxxxxx>); Fri, 06 Jun 2025 15:34:00 +0000
Message-ID: <2b6cce1b-5ca4-49d2-8a33-aeae1543ddc6@xxxxxxx>
Date: Fri, 6 Jun 2025 17:34:00 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/2] mm/memory: ensure fork child sees coherent memory
snapshot
Content-Language: en-US
To: Jann Horn <jannh@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>, Mike Rapoport
<rppt@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Michal Hocko <mhocko@xxxxxxxx>, linux-mm@xxxxxxxxx,
Pedro Falcato <pfalcato@xxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
References: <20250603-fork-tearing-v1-0-a7f64b7cfc96@xxxxxxxxxx>
<20250603-fork-tearing-v1-1-a7f64b7cfc96@xxxxxxxxxx>
<ba208d76-7992-4c70-be8f-49082001f194@xxxxxxx>
<CAG48ez1R7v-L-L33nJUXtj_Y=SKyyFcU8amLs0dQ6ecuC3xMWA@xxxxxxxxxxxxxx>
From: Vlastimil Babka <vbabka@xxxxxxx>
Autocrypt: addr=vbabka@xxxxxxx; keydata=
xsFNBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB
KxRWDHX0R2tgpFDXHnzZcQywawu8eSq0LxzxFNYMvtB7sV1pxYwej2qx9B75qW2plBs+7+YB
87tMFA+u+L4Z5xAzIimfLD5EKC56kJ1CsXlM8S/LHcmdD9Ctkn3trYDNnat0eoAcfPIP2OZ+
9oe9IF/R28zmh0ifLXyJQQz5ofdj4bPf8ecEW0rhcqHfTD8k4yK0xxt3xW+6Exqp9n9bydiy
tcSAw/TahjW6yrA+6JhSBv1v2tIm+itQc073zjSX8OFL51qQVzRFr7H2UQG33lw2QrvHRXqD
Ot7ViKam7v0Ho9wEWiQOOZlHItOOXFphWb2yq3nzrKe45oWoSgkxKb97MVsQ+q2SYjJRBBH4
8qKhphADYxkIP6yut/eaj9ImvRUZZRi0DTc8xfnvHGTjKbJzC2xpFcY0DQbZzuwsIZ8OPJCc
LM4S7mT25NE5kUTG/TKQCk922vRdGVMoLA7dIQrgXnRXtyT61sg8PG4wcfOnuWf8577aXP1x
6mzw3/jh3F+oSBHb/GcLC7mvWreJifUL2gEdssGfXhGWBo6zLS3qhgtwjay0Jl+kza1lo+Cv
BB2T79D4WGdDuVa4eOrQ02TxqGN7G0Biz5ZLRSFzQSQwLn8fbwARAQABzSBWbGFzdGltaWwg
QmFia2EgPHZiYWJrYUBzdXNlLmN6PsLBlAQTAQoAPgIbAwULCQgHAwUVCgkICwUWAgMBAAIe
AQIXgBYhBKlA1DSZLC6OmRA9UCJPp+fMgqZkBQJnyBr8BQka0IFQAAoJECJPp+fMgqZkqmMQ
AIbGN95ptUMUvo6aAdhxaOCHXp1DfIBuIOK/zpx8ylY4pOwu3GRe4dQ8u4XS9gaZ96Gj4bC+
jwWcSmn+TjtKW3rH1dRKopvC07tSJIGGVyw7ieV/5cbFffA8NL0ILowzVg8w1ipnz1VTkWDr
2zcfslxJsJ6vhXw5/npcY0ldeC1E8f6UUoa4eyoskd70vO0wOAoGd02ZkJoox3F5ODM0kjHu
Y97VLOa3GG66lh+ZEelVZEujHfKceCw9G3PMvEzyLFbXvSOigZQMdKzQ8D/OChwqig8wFBmV
QCPS4yDdmZP3oeDHRjJ9jvMUKoYODiNKsl2F+xXwyRM2qoKRqFlhCn4usVd1+wmv9iLV8nPs
2Db1ZIa49fJet3Sk3PN4bV1rAPuWvtbuTBN39Q/6MgkLTYHb84HyFKw14Rqe5YorrBLbF3rl
M51Dpf6Egu1yTJDHCTEwePWug4XI11FT8lK0LNnHNpbhTCYRjX73iWOnFraJNcURld1jL1nV
r/LRD+/e2gNtSTPK0Qkon6HcOBZnxRoqtazTU6YQRmGlT0v+rukj/cn5sToYibWLn+RoV1CE
Qj6tApOiHBkpEsCzHGu+iDQ1WT0Idtdynst738f/uCeCMkdRu4WMZjteQaqvARFwCy3P/jpK
uvzMtves5HvZw33ZwOtMCgbpce00DaET4y/UzsBNBFsZNTUBCACfQfpSsWJZyi+SHoRdVyX5
J6rI7okc4+b571a7RXD5UhS9dlVRVVAtrU9ANSLqPTQKGVxHrqD39XSw8hxK61pw8p90pg4G
/N3iuWEvyt+t0SxDDkClnGsDyRhlUyEWYFEoBrrCizbmahOUwqkJbNMfzj5Y7n7OIJOxNRkB
IBOjPdF26dMP69BwePQao1M8Acrrex9sAHYjQGyVmReRjVEtv9iG4DoTsnIR3amKVk6si4Ea
X/mrapJqSCcBUVYUFH8M7bsm4CSxier5ofy8jTEa/CfvkqpKThTMCQPNZKY7hke5qEq1CBk2
wxhX48ZrJEFf1v3NuV3OimgsF2odzieNABEBAAHCwXwEGAEKACYCGwwWIQSpQNQ0mSwujpkQ
PVAiT6fnzIKmZAUCZ8gcVAUJFhTonwAKCRAiT6fnzIKmZLY8D/9uo3Ut9yi2YCuASWxr7QQZ
lJCViArjymbxYB5NdOeC50/0gnhK4pgdHlE2MdwF6o34x7TPFGpjNFvycZqccSQPJ/gibwNA
zx3q9vJT4Vw+YbiyS53iSBLXMweeVV1Jd9IjAoL+EqB0cbxoFXvnjkvP1foiiF5r73jCd4PR
rD+GoX5BZ7AZmFYmuJYBm28STM2NA6LhT0X+2su16f/HtummENKcMwom0hNu3MBNPUOrujtW
khQrWcJNAAsy4yMoJ2Lw51T/5X5Hc7jQ9da9fyqu+phqlVtn70qpPvgWy4HRhr25fCAEXZDp
xG4RNmTm+pqorHOqhBkI7wA7P/nyPo7ZEc3L+ZkQ37u0nlOyrjbNUniPGxPxv1imVq8IyycG
AN5FaFxtiELK22gvudghLJaDiRBhn8/AhXc642/Z/yIpizE2xG4KU4AXzb6C+o7LX/WmmsWP
Ly6jamSg6tvrdo4/e87lUedEqCtrp2o1xpn5zongf6cQkaLZKQcBQnPmgHO5OG8+50u88D9I
rywqgzTUhHFKKF6/9L/lYtrNcHU8Z6Y4Ju/MLUiNYkmtrGIMnkjKCiRqlRrZE/v5YFHbayRD
dJKXobXTtCBYpLJM4ZYRpGZXne/FAtWNe4KbNJJqxMvrTOrnIatPj8NhBVI0RSJRsbilh6TE
m6M14QORSWTLRg==
In-Reply-To: <CAG48ez1R7v-L-L33nJUXtj_Y=SKyyFcU8amLs0dQ6ecuC3xMWA@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spamd-Result: default: False [-4.30 / 50.00];
BAYES_HAM(-3.00)[100.00%];
NEURAL_HAM_LONG(-1.00)[-1.000];
NEURAL_HAM_SHORT(-0.20)[-1.000];
MIME_GOOD(-0.10)[text/plain];
MID_RHS_MATCH_FROM(0.00)[];
RCVD_VIA_SMTP_AUTH(0.00)[];
MIME_TRACE(0.00)[0:+];
ARC_NA(0.00)[];
RCPT_COUNT_TWELVE(0.00)[13];
RCVD_TLS_ALL(0.00)[];
DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];
FUZZY_BLOCKED(0.00)[rspamd.com];
FROM_HAS_DN(0.00)[];
TO_DN_SOME(0.00)[];
FROM_EQ_ENVFROM(0.00)[];
TO_MATCH_ENVRCPT_ALL(0.00)[];
RCVD_COUNT_TWO(0.00)[2];
DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]
X-Spam-Level:
X-Spam-Score: -4.30
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 14:55, Jann Horn wrote:
> On Thu, Jun 5, 2025 at 9:33â?¯AM Vlastimil Babka <vbabka@xxxxxxx> wrote:
> + * - Before mmap_write_unlock(), a TLB flush ensures that parent threads can't
> + * write to copy-on-write pages anymore.
> + * - Before dup_mmap() copies page contents (which happens rarely), the
> + * parent's PTE for the page is made read-only and a TLB flush is issued, so
> + * subsequent writes are delayed until mmap_write_unlock().
>
> But I guess this way makes it hard to review patch 1/2 individually.
> Should I just squash the two patches together, and then write in the
> commit message "see the comment blocks I'm adding for the fix

That would be good unless it makes it increases the conflicts in stable
backports.

> approach"? Or is there value in repeating the explanation in the
> commit message?

Depending on the above, if the stable fix needs to stay minimal, it would be
valuable to make it more self-contained by repeating that in the commit
message. So that the LLM has an easier job marking it as a CVE. </sarcasm>

Vlastimil

>> > Fixes: 70e806e4e645 ("mm: Do early cow for pinned pages during fork() for ptes")
>> > Cc: stable@xxxxxxxxxxxxxxx
>> > Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>
>>
>> Given how the fix seems to be localized to the already rare slowpath and
>> doesn't require us to pessimize every trivial fork(), it seems reasonable to
>> me even if don't have a concrete example of a sane code in the wild that's
>> broken by the current behavior, so:
>>
>> Acked-by: Vlastimil Babka <vbabka@xxxxxxx>
>
> Thanks!



Return-Path: <linux-kernel+bounces-675937-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7545041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:34:45 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 535741887CB9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E696F28937A;
Fri, 6 Jun 2025 15:34:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="I8Eo/SWS"
Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011068.outbound.protection.outlook.com [40.107.130.68])
(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 E619A17C219;
Fri, 6 Jun 2025 15:34:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.130.68
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224068; cv=fail; b=PQkDV2T9Vh598MAUeg45VEQJvv7HRQ2aJ+XYOhSsZMemmO3mcelkvXV5/YwfZqTE4MLFup8nP9MGK7Kdh8QV/XKc3TL1QaB5h5ZGlYPLJOgCyeIcArdYyaBUWIWAhEMhHqwJkAqm004nhcfVLsl7It24VbFQ5VuTU4ePrYGG91Q=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224068; c=relaxed/simple;
bh=J4QfwvPt5J9RaY8MchxndM52ueJ4XG0G/WwUxYQGJqo=;
h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
Content-Disposition:In-Reply-To:MIME-Version; b=Ip1svxYko3baCErUDSIdwRFrE5gKDc0+KPqHMJZdrtglvoFQz/9FWr+2SZnXiyF8x5kEcNDT3JwObvY6eZqXZLNVwPcnFYPLmbCH7OnvgCq2fGFBq420NHTz6q98KzGHLGqnHonZ70ufX/SYodv1F+g3rYpq4aArRJuXgB7aAps=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=I8Eo/SWS; arc=fail smtp.client-ip=40.107.130.68
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=RVMkHrWv0G1xo4NfA1tbwJde+jsPWuvAdFchaGMebU9mbmqUGyCmESN1PQ+kG8HmooRGVu3qAD4fqMUBd4oRjNuKR+JjBzqBAiD+w6bsd+0FHuaaWGPqxVF3bAAaSxnyY6NAT/S6k8l3+wocDteDC4+8U8J5so/bB1FjVIuCBXqU102CvBFItIe14scxtt7on0NSa8Plk50zSKYHpULZ3/NbAXaWhrn+L6deiu692FPH+gKD02e6jFoWblS7dq4C9c3jXL6llvSbXSGg0OzjwFBm4WJHqJtfRU97vWvkkILeZUe8rQF0h5Ou9+s+NGWLsIdVn6i+7xN/22yej/DvWw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=zoti0JNR92Z9hgLFLl3Ml28qUOFEOHa97B+FeEwr5aU=;
b=Rt1lVzVspuTcYTMyAD1kZwfttsBhB1vOTMr2yoGVKhRFDtce/vfnQ5SIV34x9EuyTNs+fm+NzkZkdzX9m4Gn2R7Bq5lm6HNnTnlAa0+ifhYEVMHPA2YqIhSPKkLxw1kFmzb0kvaQviKMCevbxdmY23RVZdJfAmfLAV30LAmimp1xXl4Bwc7JJWXQeaI5lUZtgkUygRvPl3dwDb8BkL0vbfcEJvdHBGSgu+cmmqRiFh6wUKckPQEwhxLsRvJYGFLVH0MDFenSrf9rw81F+RqYlcJdh7dphvKGglU8Z3lOoSYsahy3KDwLIDRKQyW0J5FreefaKZakRDsDDUCYjey85A==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=zoti0JNR92Z9hgLFLl3Ml28qUOFEOHa97B+FeEwr5aU=;
b=I8Eo/SWSbYHEFw/BjzEraOsc88U1CmJippKNf7OpvbqvFjSFT8BGJYn+n1iGq0QyjNsF4iECR1AkfNWY96HxkvP9HVuF/MfRPlQrfV60VEiS3Oy9/+AeU57QL1MDyQ1IhkihL1xjjYKTDysI6LHsOLRVDREj+/GA+6EGceK3D3057BlBF21Qjk0bKBCd3DQoRGayKdWpvknEG4TyaqGikAMPWdqMtAdCOZv4xR66XtI514swGzoGRXtlS4x6RoUPKlbVqz4+uMZISDiMsx/iwpUXD+to6xvlFENa/+5MNCH7Qs+YzWZ5kTlki6P0GKj/mjVkN/XJFCQF5JvNqfKWnA==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14)
by AM9PR04MB8762.eurprd04.prod.outlook.com (2603:10a6:20b:409::16) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.23; Fri, 6 Jun
2025 15:34:23 +0000
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06%6]) with mapi id 15.20.8769.025; Fri, 6 Jun 2025
15:34:23 +0000
Date: Fri, 6 Jun 2025 11:34:16 -0400
From: Frank Li <Frank.li@xxxxxxx>
To: "Li, Meng" <Meng.Li@xxxxxxxxxxxxx>
Cc: "linux@xxxxxxxxxxxx" <linux@xxxxxxxxxxxx>,
"s.hauer@xxxxxxxxxxxxxx" <s.hauer@xxxxxxxxxxxxxx>,
"kernel@xxxxxxxxxxxxxx" <kernel@xxxxxxxxxxxxxx>,
"linux-watchdog@xxxxxxxxxxxxxxx" <linux-watchdog@xxxxxxxxxxxxxxx>,
"imx@xxxxxxxxxxxxxxx" <imx@xxxxxxxxxxxxxxx>,
"shawnguo@xxxxxxxxxx" <shawnguo@xxxxxxxxxx>,
"robh@xxxxxxxxxx" <robh@xxxxxxxxxx>,
"conor+dt@xxxxxxxxxx" <conor+dt@xxxxxxxxxx>,
"krzk+dt@xxxxxxxxxx" <krzk+dt@xxxxxxxxxx>,
"linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>,
"devicetree@xxxxxxxxxxxxxxx" <devicetree@xxxxxxxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>
Subject: Re: [v4 PATCH 0/2] create patches for nxp-ls1046a platform watchdog
feature
Message-ID: <aEMKeMaka8yLtMEc@lizhi-Precision-Tower-5810>
References: <20250604034246.3234837-1-Meng.Li@xxxxxxxxxxxxx>
<CH3PR11MB8773488D4C9E9C7A9D44DBF9F16EA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CH3PR11MB8773488D4C9E9C7A9D44DBF9F16EA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
X-ClientProxiedBy: PH8PR20CA0003.namprd20.prod.outlook.com
(2603:10b6:510:23c::16) To PAXPR04MB9642.eurprd04.prod.outlook.com
(2603:10a6:102:240::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM9PR04MB8762:EE_
X-MS-Office365-Filtering-Correlation-Id: e751f061-1fa2-4f80-8624-08dda50f9cdf
X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|52116014|7416014|1800799024|366016|376014|7053199007|38350700014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?+zZigXTP/ZhqgKLUORLqdg2sl6zD9m/LK4TJtp+JtDixmw2OQEaOblsSAFxp?=
=?us-ascii?Q?ODLHtiEaUy3Dt8LbHGDNM7F+iEKIXkZL6MIMpq6ETMlSRySFGKGvkbPiMXeq?=
=?us-ascii?Q?dQEntThr3E/bgTDN1CH0WjiSJ2ybmP5Jpomlv99ZgWtqGMCXgId3hSkEWuGn?=
=?us-ascii?Q?jsjfZqkvRTZTswbC6FS9AfxuIHfOfsTDtLQ24/WUinCz2Cqe9Is1N+LGx7/h?=
=?us-ascii?Q?hWlu8YP1OoyLZosg7ErJl5qxfRxSkEDJ2QIBniXsl4TSP5Aa9N00YWoMB1ZD?=
=?us-ascii?Q?J35IserEi40fOQcZk/jaJi80z5J5JoyXaSPHQyFEZ5xz9BsQOeBwJhwOt8EN?=
=?us-ascii?Q?tQnLQGFbDwBPfn5WVSJITui4SI0pbXy2lfECSa+kR6jPuqdFTdpSI9BDx4lM?=
=?us-ascii?Q?Jwz2VLYPQAkjEOVpYiV88qtbw4USI/dBEdE5wWH9xDq2ETfT4KDYmV4RjWGO?=
=?us-ascii?Q?iQY81ZfuydiiQIeUrk0yOPMo2IoCWlcj08oDuVj5bDQDrn8HVZwspvzCGNLb?=
=?us-ascii?Q?tE3pVrV3uCBU6nmnEp4986nlt83XAN6iVkU361rxO/b2Nas08gaxGTotGaWZ?=
=?us-ascii?Q?0wyRYJi/Y2NpMXiOll/An5p4cxgfTWLY9DpzmfPKf1T1bEC6HzYc9IMUCGxQ?=
=?us-ascii?Q?SIM9A4xatPK7Xt8I002NAu0ZSRsKY9F2p9WK2Utgg4EKjcCSjke3g4/noVXt?=
=?us-ascii?Q?RDSYHk6/4L6xn4ANeli2imH41v4miqrmLJ+Yzlupi6xAoX8baN3Fgp2SjK/I?=
=?us-ascii?Q?nHGMMQAozaEAE3CFsLkIMFMks59xWOM7ypR6xSsbYMODVfmJGTx15OEJxBpo?=
=?us-ascii?Q?272NplKF2HEuBnBc7+GSw/2JAARCgZxNILskM7HdB6SNWoB8SR5Rj7Lm9Cse?=
=?us-ascii?Q?uMpfMOu5oIGBoxAkHMXjPy0xLcgCWtEhm6Vpi1Gd3+n3CmDYrmjP+aTLgAW5?=
=?us-ascii?Q?EG1A31BonSEXaujNEsPJIh4CKExCN68B+Dqze716VRy3xAxBrlm2oS5vaZ/D?=
=?us-ascii?Q?MJfEcgRjJf+ufX3tLziUQ9uVU+9nrccGkkEJ5+VrrwGwoiiS3HEVkoml5IQ0?=
=?us-ascii?Q?RwgOfZtvX0Fgtmv1ua5Nq8f2GJFKvqSFcG/1vjKwl2XginMWLVkBZQiSEXUX?=
=?us-ascii?Q?fWIq8He50i99cd58RZbt+CcivY3fuv4ZGmD0yqPBJrd7asrvPgUDINLmlD2n?=
=?us-ascii?Q?YMJ0Z+cgdOnDpn6bIK+eTHj5nWvaIWO1IIX742lXbdX13TReasZlE4dikvAL?=
=?us-ascii?Q?iziafz7orb0xmrQuMBeI1a83742iWbH9U53yfiljWFJVduVit+kTF6jtt9as?=
=?us-ascii?Q?F1ks7TmvkXbak4mBGwhS3Drk0yDjjaeQAc1KicI4gWSUrry91IWXTrYqq1aV?=
=?us-ascii?Q?vHCNsIEC60x5AfQWZisQpmX2IdChD9zUBdyZQI/kh2Fn984oCaa2PG3UsQxj?=
=?us-ascii?Q?vIJpwBjKBmwRB9Kd7SFaxQpjt6pgwISft+kDILRvcai3wVrXFvvxZDVnMOhg?=
=?us-ascii?Q?KQPqSvDM/DyABXo=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(1800799024)(366016)(376014)(7053199007)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?FKQ7MUU6hLCY5ImdIVkpzHoV6Re/GHOVpD7d6QR5Gi593m1ouaIGqh2pcAkM?=
=?us-ascii?Q?oO9+cufZsovVVMZ22Ry+XuhEh8BwgtnqlrN74NYAC7QTiSAsBVRkVSeDEsnl?=
=?us-ascii?Q?Y6Qgv+0cCc6vtFwRrTZLeOtB8bfLwlK/t/j+3jkB5KmmuqZP9LMl+/yOBRA4?=
=?us-ascii?Q?PiN9IWr+djQiBW0/sb4xoBc2ZCKL3+ShmXIttU9jWfY6W9oL8CraLYamZ2VW?=
=?us-ascii?Q?rh61VVAO010IrZLP8DLe5Jg8Dcf1RFifOjXkSL6O5N6OMAuFDCWzvU0GtsWp?=
=?us-ascii?Q?oMGWhkCmanCYUgxxnuK8jeE/v/fMuxYDo+YmWdrGQfuRFgtr/9lc/zf7qHnX?=
=?us-ascii?Q?vJwT+NL/u/BzkFOtZ9/Mj49K7N4mlEApdCu0xHFK1Gbdq38/5MdJL+arSmZ3?=
=?us-ascii?Q?kpc61OT6RxxNsrIpi9cNvGxd3hfWuC9l1cZQkKiO+cprjYqP5YIquiod6e/B?=
=?us-ascii?Q?i4xNzHoG6SMLMK5B0zfVWm+5ddlTeU3F2XaFXYuRgZbBjm9ApEOfzHLA2AK4?=
=?us-ascii?Q?S5dzUTu29yjLND+zM0z6NbM8H/HPWhTvOxN8PZ0vtg2On8F7KqDw9aUvX3C4?=
=?us-ascii?Q?Mfl7rDn/Sotkkz5+dd3Xxk19lDsrt0INETB+te5gPsv/F9ixxIfvYir07kWt?=
=?us-ascii?Q?XFB1KA+0yh1hJKE8O0fc6vaORWvabAPaFBPsB6skLWF7NCskpgKT7UZSHl56?=
=?us-ascii?Q?k6+Sfd8Z6x64/m5LG1cMx1BrykivSeZm0NPDeKjB2OrAiXCw4CakOEkA9Qnv?=
=?us-ascii?Q?hj3C+QMkyFeAH/6WHWtJIf+Xw0LSUCuUkIx1oSwdm2mY4CHzyINASyueaHxf?=
=?us-ascii?Q?AAvV+cMSO0GWbbvaIONdlSUvJKnQiHKotSRP9x/1ATidbbIFBKJ6PIV0lLcc?=
=?us-ascii?Q?/Et2A4CRBJRUvrxX6nBRFBO3dTqG/fyfM/8Qk7gvCgg5jwTNK80WavHhBKD8?=
=?us-ascii?Q?oQfXyn7PgrINjWfaoF2K+0HhYTBBxqVvr43KFZ5x/piN4JrNFRFF+skkUo0h?=
=?us-ascii?Q?Trl2mQ8EIsXTMvne7irEkdgvxZG4SKBu1Ah5yp+etbkcaF6J++J31aCjJQBb?=
=?us-ascii?Q?dYDlLp48I7z9Hlkmnm5LWP8hYzk+jOe9O4qAG9pMIVUpB+hInoM3G/D8cVYl?=
=?us-ascii?Q?NojVQfzLq/AQXREn3UgnI//fEQ+qJ4nQQgRWcgriuKSOgqc/8LgAOKkJTHdx?=
=?us-ascii?Q?+gsI1iqsd4GYF8OCvrG3mEESIHpiftFD7B2b9Ws059TYUcmmV/dLeOL5FdEV?=
=?us-ascii?Q?Sn/EdFgeTzzbDwb4z2e41iNGOAey61vNCoBfHEIorKOuZlAttKx4NxkXFO85?=
=?us-ascii?Q?o6qCRVQ1Sdfq+guq16l8IGgzn2Q70KUqQ78pQ9ptv2LY8Rxd2/xmpfZVqi6a?=
=?us-ascii?Q?u6a+0LuX2ZjrcOqZdViIpK1CAosthKwqpK/DoV8tC5kWYo6GJYCNQNEiV4j2?=
=?us-ascii?Q?ksK1Auk7emz4PzmWluvZ0zETYdhwRlh4fSmedgGuKvvLnYJQk78Yxa1cJOjy?=
=?us-ascii?Q?BvtuL9aGkE8J9NqNUX8gkkQjxuYzANqWDDiw9JQjZv/XB3DYIfTYAv5cJ8fM?=
=?us-ascii?Q?MYCsVXAdjzjzT6R6kjI2EarfHNE/7TjhApb20T2U?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: e751f061-1fa2-4f80-8624-08dda50f9cdf
X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 15:34:23.3007
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: SRE70GJ99DSBQiLVB8a9zctqso+kE1zJNeBqBz7TNJPjMGlfhOGIuiUk03covv+icKrzZgX2o0AVTqZtJFmNTA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8762
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 01:46:56AM +0000, Li, Meng wrote:
> Add watchdog binding maintainer for the patch-0001.

You may need resend whole patches, which included linux-watchdog, they may
use patchwork to track patches and miss this one.

Frank

>
> Thanks,
> Limeng
>
> > -----Original Message-----
> > From: Li, Meng <Meng.Li@xxxxxxxxxxxxx>
> > Sent: Wednesday, June 4, 2025 11:43 AM
> > To: linux@xxxxxxxxxxxx; s.hauer@xxxxxxxxxxxxxx; kernel@xxxxxxxxxxxxxx;
> > linux-watchdog@xxxxxxxxxxxxxxx; imx@xxxxxxxxxxxxxxx; shawnguo@xxxxxxxxxx;
> > robh@xxxxxxxxxx; conor+dt@xxxxxxxxxx; Frank.Li@xxxxxxx
> > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx; linux-
> > kernel@xxxxxxxxxxxxxxx; Li, Meng <Meng.Li@xxxxxxxxxxxxx>
> > Subject: [v4 PATCH 0/2] create patches for nxp-ls1046a platform watchdog
> > feature
> >
> > v4:
> > - Improve commit log of patch0002
> >
> > v3:
> > - merge patch 0002 into patch 0001
> > - improve the commit log of patches
> >
> > v2:
> > - improve the commit log of patch 0001
> > - add another 2 patches to fix below warning
> > arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dtb:
> > watchdog@2ad0000(fsl,imx21-wdt): big-endian: False schema does not allow
> > True
> >
> > v1:
> > - create patch 0001-arch-arm64-dts-add-big-endian-property-back-into-
> > wat.patch
> >
> > Meng Li (2):
> > dt-bindings: watchdog: fsl-imx-wdt: add compatible string
> > fsl,ls1046a-wdt
> > arch: arm64: dts: add big-endian property back into watchdog node
> >
> > Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml | 2 ++
> > arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 3 ++-
> > 2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > --
> > 2.34.1
>


Return-Path: <linux-kernel+bounces-675938-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6A22E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:35:06 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id D4C8E3B1E74
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DB3D28937A;
Fri, 6 Jun 2025 15:34:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Jov7fJJk"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 C1CD01C1741
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224096; cv=none; b=T1PgdjM7KK4c1xRf1eW4fvimez4KBB/eEsF6rIP/UiP+/0oZdCqsocj90P2TMNzYjB7pZ3js2LqazPKvUOtz9WVrUw6ie+65/bKPqzaIPmWafRP+e6rLV+C4ArPz7aiaty1pAKWK/2aKtbKl0aN3pHmHZvNTMu7WYfRHPdJ9yDg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224096; c=relaxed/simple;
bh=4rH/Gc2zIAmQVULcfBWujwFbbIqz8s2kJYv87k077Nk=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=QL/3KIZnE/2qdPis2AVmT48TfYDNTH6Vyz3/bwGmpAJSFqyMnrwFKgtRRSLAswIOGjS67uVAV1rd23zwPCV9+1XKRIm/cD8WWQXczo4GmsOwcdA12qU8HrY01rjVdLQOSr0IVIxCaH0LkLE9/pvlEX9a7uQFgzucKL/yKqmcHd0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Jov7fJJk; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246632.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565Md4K011823;
Fri, 6 Jun 2025 15:34:49 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=fsWbO
kl2AGNdbyJ3MQxyQRY4djEzAoU2dzjlX/stUUo=; b=Jov7fJJk6yXySm0iQ8lT+
VP2NqwTU/fAz4QCGRmXqWh4zE8qcUQhJkkNyi/no7eP0WUzqbao/2Qn3woFv7Ela
CJm06mh19Tp7YLd5nv2r7fAApI/j3mQOIWgyEZoPT/+ut+y9ivZITv/G4eRmS3Xg
mfye1FOhLgwJo3mFonJ97SWsNR0+tqwbMSi4LHRr4ohLn1AsGhZkOSiClempgyX5
v6iSl9q/GTRI5XqcBA3yz/psKbHqdzzQtLTnHqJO35p+bCl3g6cjVxwoLcmIMDF1
GxzzsyYlUJQt63JbVIk5ZGCOEsx6G3Oxto7NEeSSaSFBboXlNJv1STyDEgdnNXMB
w==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8j89ck-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:49 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556E22Oa038561;
Fri, 6 Jun 2025 15:34:48 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7des51-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:48 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3h015517;
Fri, 6 Jun 2025 15:34:48 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-3;
Fri, 06 Jun 2025 15:34:47 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 02/13] objtool: Create disassembly context
Date: Fri, 6 Jun 2025 17:34:29 +0200
Message-ID: <20250606153440.865808-3-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=934 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Proofpoint-GUID: 2KpW7A7QWI1djaUkjkBtM-BaPdnmGI2g
X-Proofpoint-ORIG-GUID: 2KpW7A7QWI1djaUkjkBtM-BaPdnmGI2g
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX1ZKd6bL/BLPp M7go1xXG1VxXtzkD5TNi8VFfgE9UCp04+/y4KOE5GX9kXrP0dke8YMfdfN3FubKnr5zpFPvfgq/ iz/W7PLWlWlkVj1aMbJ5wmx4vNJbPeg9lsYeGyhr+AyHUuxvLxwGa8nFw+WJMekE2MeRiytG9J8
Gy6CT16uFpcRgzQ6mGvsllYxD+Y7wO/+npEtyNr4KZLaJbNPpIWipKFW55wU6yVBvbTpT0o5L/m M889X0FZdqV4msH5DrCDvInGwltnyYd6P5Y+W7Bd25FcnSOts65Pi0jwU32YhblCvlcmjEl0cJ7 nQUeeMec1uuRZoaIx/VXHsgDLFwoIa0s/U3Yq8+OsVaU3NoZxn0m/qudm6CS4VWSNkul8vOgSvr
ZMmxztQ16GseVRX1l9kL9PKHtKKkhe/EmawPSWbn1P7wgWHn/LI/Aftc6Tq6F3NfCvz2pzYu
X-Authority-Analysis: v=2.4 cv=QI1oRhLL c=1 sm=1 tr=0 ts=68430a99 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=WrX3ccauloUazzeUkokA:9
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Create a structure to store information for disassembling functions.
For now, it is just a wrapper around an objtool file.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/check.c | 5 +++-
tools/objtool/disas.c | 33 +++++++++++++++++++++++--
tools/objtool/include/objtool/objtool.h | 5 +++-
3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index bd1974717fa3..085fcc1b643b 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4591,6 +4591,7 @@ static void free_insns(struct objtool_file *file)

int check(struct objtool_file *file)
{
+ struct disas_context *disas_ctx;
int ret = 0, warnings = 0;

arch_initial_func_cfi_state(&initial_func_cfi);
@@ -4720,7 +4721,9 @@ int check(struct objtool_file *file)
if (opts.werror && warnings)
WARN("%d warning(s) upgraded to errors", warnings);
print_args();
- disas_warned_funcs(file);
+ disas_ctx = disas_context_create(file);
+ disas_warned_funcs(disas_ctx);
+ disas_context_destroy(disas_ctx);
}

return ret;
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index 77de46beb496..ed74554bccbf 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -8,6 +8,30 @@

#include <linux/string.h>

+struct disas_context {
+ struct objtool_file *file;
+};
+
+struct disas_context *disas_context_create(struct objtool_file *file)
+{
+ struct disas_context *dctx;
+
+ dctx = malloc(sizeof(*dctx));
+ if (!dctx) {
+ WARN("failed too allocate disassembly context\n");
+ return NULL;
+ }
+
+ dctx->file = file;
+
+ return dctx;
+}
+
+void disas_context_destroy(struct disas_context *dctx)
+{
+ free(dctx);
+}
+
/* 'funcs' is a space-separated list of function names */
static void disas_funcs(const char *funcs)
{
@@ -58,12 +82,17 @@ static void disas_funcs(const char *funcs)
}
}

-void disas_warned_funcs(struct objtool_file *file)
+void disas_warned_funcs(struct disas_context *dctx)
{
struct symbol *sym;
char *funcs = NULL, *tmp;

- for_each_sym(file, sym) {
+ if (!dctx) {
+ ERROR("disassembly context is not defined");
+ return;
+ }
+
+ for_each_sym(dctx->file, sym) {
if (sym->warned) {
if (!funcs) {
funcs = malloc(strlen(sym->name) + 1);
diff --git a/tools/objtool/include/objtool/objtool.h b/tools/objtool/include/objtool/objtool.h
index 4d3e94b70fd8..f5ab71f07f5c 100644
--- a/tools/objtool/include/objtool/objtool.h
+++ b/tools/objtool/include/objtool/objtool.h
@@ -47,6 +47,9 @@ int check(struct objtool_file *file);
int orc_dump(const char *objname);
int orc_create(struct objtool_file *file);

-void disas_warned_funcs(struct objtool_file *file);
+struct disas_context;
+struct disas_context *disas_context_create(struct objtool_file *file);
+void disas_context_destroy(struct disas_context *dctx);
+void disas_warned_funcs(struct disas_context *dctx);

#endif /* _OBJTOOL_H */
--
2.43.5



Return-Path: <linux-kernel+bounces-675940-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1067041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:35:10 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 21443175243
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8057128980E;
Fri, 6 Jun 2025 15:34:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ALVVZTNv"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 C1DBB2857D2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224096; cv=none; b=muimDWBA8pVlbhQ3VTtuA/0atS7XI8CntTIJ1JBLos2TD/7TR2B+w/Y4atailUGUYALvCYDQFX6NKjVDa+JEEyL2uedUYjdUucCPy8U8nNxPo/KZd9qgcH3/UIrB9fuB+OLsYxh/KqbfbZiCj6cQ05/psNj5wSW/swHZg0VjCZA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224096; c=relaxed/simple;
bh=uFli8qripjOIKS+FVhZZomp//yZqATpNXfvNFflsUhE=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=lC2wbbHzAHDs/knMNa/s2vsmlVdIVJFyD51U6PdP6knU2mscchLs52MS5UXhy3zGm4yPN9HNCI2d4W8FyAFKouFQdFahy7Osjf45ToWvHiVBNRp2/IaehvawrRXfIBoM+a5+iMt78PE9/zgli0S/aShxMLr1jryJ6+K0dqSeR80=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=ALVVZTNv; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0333520.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MYQU002138;
Fri, 6 Jun 2025 15:34:47 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=TQjWc
pisuoarYkrPpFS4fkXe+RQOPP/UyAZhdCaRaSQ=; b=ALVVZTNvUQHgnoHuoB/lr
wQ9+rILCUe41zJLgPAPOIuO3unqWdAKrDUQonV0e3pS0Ui41Rq2/HLaxI2bJc0bG
k/Jd1VKeoEsuFAi3c+iYYQ47F287NezTfkQM1TfFd8Px97R3iK+VGOyXkbNayabU
ujMde3VJU0h/y3bhFpCJEo0SPNP+OIkq94p0IF2KPJo4VL1tMBy4A6FyZ6BA2Dh5
vTLYDkFMAYn35o55im24CBZ+riDlupq5CILgSo4iWhJZBkXNJKCIVv4RsodCIZHr
6LA74JgIiTbjbDs+ts/p8x4xeWypdXci1/GLTrVewX/9D4kv/HwowD0K+1gJAsEI
w==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gahgafe-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:47 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556EKfsp039169;
Fri, 6 Jun 2025 15:34:46 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7des3q-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:46 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3f015517;
Fri, 6 Jun 2025 15:34:46 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-2;
Fri, 06 Jun 2025 15:34:45 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 01/13] objtool: Move disassembly functions to a separated file
Date: Fri, 6 Jun 2025 17:34:28 +0200
Message-ID: <20250606153440.865808-2-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=aqqyCTZV c=1 sm=1 tr=0 ts=68430a97 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=20KFwNOVAAAA:8 a=dBVU6wt392Vc8wzyTJAA:9
X-Proofpoint-GUID: afOuQ-x1qthg74Vzxnhh2gywORA-aq3p
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX2myZSbfx0x9q +V6JoFeWGO2E4lB6p1BGpPsfxEidOB0hcwjuf0ageOuLa4Kgp7TTWcaEf2gOK7yG1UsLNAgOf2J LngR4cMCBPuz00KRSGBj07nEjuhUX1th6KIAL6H5a1W8ViCXdqNLxTxTXnPlsSma3xpkR/KLqH9
8RHyTtGbBa7X89pVcltouCJ8kQCRdumfo3c8kiEUSDXhbfKvOCV6gyrz3vM1ef8TDrm0QGmaPGg oenAXUe7OjXNbmiSlRv7tBjXwUt1+bPaP9gAI4qY1Uovm28+9V5L79A0nsgym45iAAJfiClQIeE ShiafMjCWVp84Trjk2q25m3HXxcTMSuJFMH2j2e5sZUojKH16WpmLTq1E4t+QZEC7m9b3XDDjNv
1GA0azkC+XRA4uLKO9y/2KOvn9/E1C8a2kG4bP3M3foR048siuvujn5S/D2CGl6Powj4SNxr
X-Proofpoint-ORIG-GUID: afOuQ-x1qthg74Vzxnhh2gywORA-aq3p
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

objtool disassembles functions which have warnings. Move the code
to do that to a dedicated file. The code is just moved, it is not
changed.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/Build | 1 +
tools/objtool/check.c | 81 ----------------------
tools/objtool/disas.c | 90 +++++++++++++++++++++++++
tools/objtool/include/objtool/objtool.h | 2 +
4 files changed, 93 insertions(+), 81 deletions(-)
create mode 100644 tools/objtool/disas.c

diff --git a/tools/objtool/Build b/tools/objtool/Build
index a3cdf8af6635..677bf9148cba 100644
--- a/tools/objtool/Build
+++ b/tools/objtool/Build
@@ -7,6 +7,7 @@ objtool-y += special.o
objtool-y += builtin-check.o
objtool-y += elf.o
objtool-y += objtool.o
+objtool-y += disas.o

objtool-$(BUILD_ORC) += orc_gen.o
objtool-$(BUILD_ORC) += orc_dump.o
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index f23bdda737aa..bd1974717fa3 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4561,87 +4561,6 @@ static int validate_reachable_instructions(struct objtool_file *file)
return warnings;
}

-/* 'funcs' is a space-separated list of function names */
-static void disas_funcs(const char *funcs)
-{
- const char *objdump_str, *cross_compile;
- int size, ret;
- char *cmd;
-
- cross_compile = getenv("CROSS_COMPILE");
- if (!cross_compile)
- cross_compile = "";
-
- objdump_str = "%sobjdump -wdr %s | gawk -M -v _funcs='%s' '"
- "BEGIN { split(_funcs, funcs); }"
- "/^$/ { func_match = 0; }"
- "/<.*>:/ { "
- "f = gensub(/.*<(.*)>:/, \"\\\\1\", 1);"
- "for (i in funcs) {"
- "if (funcs[i] == f) {"
- "func_match = 1;"
- "base = strtonum(\"0x\" $1);"
- "break;"
- "}"
- "}"
- "}"
- "{"
- "if (func_match) {"
- "addr = strtonum(\"0x\" $1);"
- "printf(\"%%04x \", addr - base);"
- "print;"
- "}"
- "}' 1>&2";
-
- /* fake snprintf() to calculate the size */
- size = snprintf(NULL, 0, objdump_str, cross_compile, objname, funcs) + 1;
- if (size <= 0) {
- WARN("objdump string size calculation failed");
- return;
- }
-
- cmd = malloc(size);
-
- /* real snprintf() */
- snprintf(cmd, size, objdump_str, cross_compile, objname, funcs);
- ret = system(cmd);
- if (ret) {
- WARN("disassembly failed: %d", ret);
- return;
- }
-}
-
-static void disas_warned_funcs(struct objtool_file *file)
-{
- struct symbol *sym;
- char *funcs = NULL, *tmp;
-
- for_each_sym(file, sym) {
- if (sym->warned) {
- if (!funcs) {
- funcs = malloc(strlen(sym->name) + 1);
- if (!funcs) {
- ERROR_GLIBC("malloc");
- return;
- }
- strcpy(funcs, sym->name);
- } else {
- tmp = malloc(strlen(funcs) + strlen(sym->name) + 2);
- if (!tmp) {
- ERROR_GLIBC("malloc");
- return;
- }
- sprintf(tmp, "%s %s", funcs, sym->name);
- free(funcs);
- funcs = tmp;
- }
- }
- }
-
- if (funcs)
- disas_funcs(funcs);
-}
-
struct insn_chunk {
void *addr;
struct insn_chunk *next;
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
new file mode 100644
index 000000000000..77de46beb496
--- /dev/null
+++ b/tools/objtool/disas.c
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
+ */
+
+#include <objtool/arch.h>
+#include <objtool/warn.h>
+
+#include <linux/string.h>
+
+/* 'funcs' is a space-separated list of function names */
+static void disas_funcs(const char *funcs)
+{
+ const char *objdump_str, *cross_compile;
+ int size, ret;
+ char *cmd;
+
+ cross_compile = getenv("CROSS_COMPILE");
+ if (!cross_compile)
+ cross_compile = "";
+
+ objdump_str = "%sobjdump -wdr %s | gawk -M -v _funcs='%s' '"
+ "BEGIN { split(_funcs, funcs); }"
+ "/^$/ { func_match = 0; }"
+ "/<.*>:/ { "
+ "f = gensub(/.*<(.*)>:/, \"\\\\1\", 1);"
+ "for (i in funcs) {"
+ "if (funcs[i] == f) {"
+ "func_match = 1;"
+ "base = strtonum(\"0x\" $1);"
+ "break;"
+ "}"
+ "}"
+ "}"
+ "{"
+ "if (func_match) {"
+ "addr = strtonum(\"0x\" $1);"
+ "printf(\"%%04x \", addr - base);"
+ "print;"
+ "}"
+ "}' 1>&2";
+
+ /* fake snprintf() to calculate the size */
+ size = snprintf(NULL, 0, objdump_str, cross_compile, objname, funcs) + 1;
+ if (size <= 0) {
+ WARN("objdump string size calculation failed");
+ return;
+ }
+
+ cmd = malloc(size);
+
+ /* real snprintf() */
+ snprintf(cmd, size, objdump_str, cross_compile, objname, funcs);
+ ret = system(cmd);
+ if (ret) {
+ WARN("disassembly failed: %d", ret);
+ return;
+ }
+}
+
+void disas_warned_funcs(struct objtool_file *file)
+{
+ struct symbol *sym;
+ char *funcs = NULL, *tmp;
+
+ for_each_sym(file, sym) {
+ if (sym->warned) {
+ if (!funcs) {
+ funcs = malloc(strlen(sym->name) + 1);
+ if (!funcs) {
+ ERROR_GLIBC("malloc");
+ return;
+ }
+ strcpy(funcs, sym->name);
+ } else {
+ tmp = malloc(strlen(funcs) + strlen(sym->name) + 2);
+ if (!tmp) {
+ ERROR_GLIBC("malloc");
+ return;
+ }
+ sprintf(tmp, "%s %s", funcs, sym->name);
+ free(funcs);
+ funcs = tmp;
+ }
+ }
+ }
+
+ if (funcs)
+ disas_funcs(funcs);
+}
diff --git a/tools/objtool/include/objtool/objtool.h b/tools/objtool/include/objtool/objtool.h
index c0dc86a78ff6..4d3e94b70fd8 100644
--- a/tools/objtool/include/objtool/objtool.h
+++ b/tools/objtool/include/objtool/objtool.h
@@ -47,4 +47,6 @@ int check(struct objtool_file *file);
int orc_dump(const char *objname);
int orc_create(struct objtool_file *file);

+void disas_warned_funcs(struct objtool_file *file);
+
#endif /* _OBJTOOL_H */
--
2.43.5



Return-Path: <linux-kernel+bounces-675939-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2B38841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:35:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id BD816189767D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D9B9289801;
Fri, 6 Jun 2025 15:34:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="bcQ1GQN+"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 C1D3E276048
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224096; cv=none; b=FeVCCzPONj8F6aHdEniyhbpZtVhnr6ZG+gCH94FL3V3E0V4ot08xnHKiSOXmvhQhVmgsqHNpJj7OQ3QUNb4uDPyyUoukcBwH0yp3iuSppFZdS5MDS28NxQb60knLPhYFJnf13ps6ArBnfHwsVB94JOu8hTHk7j9/+lxR+NJYlrk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224096; c=relaxed/simple;
bh=BS+zh5yU5vGnBCSvvOVWB1cP4WpPeREEPt0Phq3KVZA=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TyEKDhAl1WrXBbLHZ2BxAYz/CAqlxbSkHvM8zvv4zDNA6604PHSLw6KGH2meLWZx4208e/oQyDfkh/uSzn6yX4znB/Rq+ztE+IbC8VLyXfwVTCm4aI8Dod4GqmuTlu/ACeO0gIi88dCpYI5Vvhd9WOQUEx5OjIxho7NJqAtEu6g=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=bcQ1GQN+; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246630.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MZgm027935;
Fri, 6 Jun 2025 15:34:45 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:message-id:mime-version
:subject:to; s=corp-2025-04-25; bh=tnj6bwPSnk6wSfeuheEGEqqUvWoPr
0IPs+/pGnVSKXE=; b=bcQ1GQN+wbAQh2+B9K27P+3y2K5j5jC7ZLYOEH0q+KHMN
TeCeu799CpB/+IpOdcC63nKaYZlRiA4BqDlvtFFkYtoBt5n8WCpVHEnADjvTAN7Y
arryUehiiEELa//M2S93cl9v1ho+tMFizyI7pkUEMn8YIh+7Ig1ybQwT3lBbn8N6
zwZng6cXSkLJO5QnIW3Setk3qg5TkRYgmAT0tcxT5Hy8N4pWHrzxU1puipszq09s
QdlaP7zguTAZ7mbDcJrPUicV9rz4kfAkGPlFVRL7dZqbOCXi1VujmzHXVxU4ALfv
H1PcdNifJJyKhxZ6/BCQFV2/pABln2L+CRfKXKGJQ==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8gg48v-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:44 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556ERKdn039260;
Fri, 6 Jun 2025 15:34:44 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7des2k-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:43 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3d015517;
Fri, 6 Jun 2025 15:34:43 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-1;
Fri, 06 Jun 2025 15:34:43 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 00/13] objtool: Function validation tracing
Date: Fri, 6 Jun 2025 17:34:27 +0200
Message-ID: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX2oDtO9oA++4h csEmVQgf7VkVe1fix7+//8uBVZllCOJY152NACiIVwCoiJZWDqFDyQmkHiCGrzyI8r6YmK5qhrC GemAtH2m3qHfsPJl/7LnXhOaGXfRZamQ0C+UQzPPeQe05emFUKMYJ8Jr5CXBzA3CMAeNb8LE4FX
Cz02oNQbINHOf8lJxl+aVCYA6ZAm6t0+LJ7W6+F+N46sKnsNC1f67x37w4t/H4U4LDcnuT3NJ0G Es0qo6o0H51ABLhlFLds5nCAJ3RGWouxyuLzNtOTBauuzt+dWMEkQxguvjKpiIsufqsEO3EHYCm ChNANeZquRNRVWIYpJJd9axWmfezYEO8C7Dr5I1bgqZNbef/I2+ngTEkeuax5BrpyFH+bKlz+TM
6ja22cNmmJ3qR/oOIDQbRJmMQIFAu7lkq/sqSHkFWrDsqs+gCsd0mEL4NH1aUkLLDEuPnqTS
X-Proofpoint-GUID: TypE75PePfKSf2DDFOBieyQOlHnFJF5q
X-Proofpoint-ORIG-GUID: TypE75PePfKSf2DDFOBieyQOlHnFJF5q
X-Authority-Analysis: v=2.4 cv=H5Tbw/Yi c=1 sm=1 tr=0 ts=68430a95 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=nI6GfosoK6DoNDHVT7AA:9
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi,

This RFC provides two changes to objtool.

- Disassemble code with libopcodes instead of running objdump

objtool executes the objdump command to disassemble code. In particular,
if objtool fails to validate a function then it will use objdump to
disassemble the entire file which is not very helpful when processing
a large file (like vmlinux.o).

Using libopcodes provides more control about the disassembly scope and
output, and it is possible to disassemble a single instruction or
a single function. Now when objtool fails to validate a function it
will disassemble that single function instead of disassembling the
entire file.

- Add the --trace <function> option to trace function validation

Figuring out why a function validation has failed can be difficult because
objtool checks all code flows (including alternatives) and maintains
instructions states (in particular call frame information).

The trace option allows to follow the function validation done by objtool
instruction per instruction, see what objtool is doing and get function
validation information. An output example is shown below.

Note: some changes are architecture specific (x86, powerpc, loongarch). So far,
I have only tested on x86, and some code might be x86 specific. Any feedback
about the behavior on powerpc and loongarch is welcome.

Thanks,

alex.


-----

Example: Trace the validation of the os_save() function in vmlinux.o

$ ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --hacks=skylake --ibt --orc --retpoline --rethunk --sls --static-call --uaccess --prefix=16 --link --trace os_xsave -v vmlinux.o
os_xsave: validation begin
65c20: os_xsave+0x0 push %r12 - state: cfa=rsp+16 r12=(cfa-16) stack_size=16
65c22: os_xsave+0x2 mov 0x0(%rip),%eax # alternatives_patched
65c28: os_xsave+0x8 push %rbp - state: cfa=rsp+24 rbp=(cfa-24) stack_size=24
65c29: os_xsave+0x9 mov %rdi,%rbp
65c2c: os_xsave+0xc push %rbx - state: cfa=rsp+32 rbx=(cfa-32) stack_size=32
65c2d: os_xsave+0xd mov 0x8(%rdi),%rbx
65c31: os_xsave+0x11 mov %rbx,%r12
65c34: os_xsave+0x14 shr $0x20,%r12
65c38: os_xsave+0x18 test %eax,%eax
65c3a: os_xsave+0x1a je 65c6a <os_xsave+0x4a> - jump taken
65c6a: os_xsave+0x4a | ud2
65c6c: os_xsave+0x4c | jmp 65c3c <os_xsave+0x1c> - unconditional jump
65c3c: os_xsave+0x1c | xor %edx,%edx
65c3e: os_xsave+0x1e | mov %rbx,%rsi
65c41: os_xsave+0x21 | mov %rbp,%rdi
65c44: os_xsave+0x24 | callq xfd_validate_state - call
65c49: os_xsave+0x29 | mov %ebx,%eax
65c4b: os_xsave+0x2b | mov %r12d,%edx
65c4e: os_xsave+0x2e | <alternative.65c4e> alt 1/4 begin
65c55: os_xsave+0x35 | | test %ebx,%ebx
65c57: os_xsave+0x37 | | jne 65c6e <os_xsave+0x4e> - jump taken
65c6e: os_xsave+0x4e | | | ud2
65c70: os_xsave+0x50 | | | pop %rbx - state: cfa=rsp+24 rbx=<undef> stack_size=24
65c71: os_xsave+0x51 | | | pop %rbp - state: cfa=rsp+16 rbp=<undef> stack_size=16
65c72: os_xsave+0x52 | | | pop %r12 - state: cfa=rsp+8 r12=<undef> stack_size=8
65c74: os_xsave+0x54 | | | xor %eax,%eax
65c76: os_xsave+0x56 | | | xor %edx,%edx
65c78: os_xsave+0x58 | | | xor %esi,%esi
65c7a: os_xsave+0x5a | | | xor %edi,%edi
65c7c: os_xsave+0x5c | | | jmpq __x86_return_thunk - return
65c57: os_xsave+0x37 | | jne 65c6e <os_xsave+0x4e> - jump not taken
65c59: os_xsave+0x39 | | pop %rbx - state: cfa=rsp+24 rbx=<undef> stack_size=24
65c5a: os_xsave+0x3a | | pop %rbp - state: cfa=rsp+16 rbp=<undef> stack_size=16
65c5b: os_xsave+0x3b | | pop %r12 - state: cfa=rsp+8 r12=<undef> stack_size=8
65c5d: os_xsave+0x3d | | xor %eax,%eax
65c5f: os_xsave+0x3f | | xor %edx,%edx
65c61: os_xsave+0x41 | | xor %esi,%esi
65c63: os_xsave+0x43 | | xor %edi,%edi
65c65: os_xsave+0x45 | | jmpq __x86_return_thunk - return
| <alternative.65c4e> alt 1/4 end
65c4e: os_xsave+0x2e | <alternative.65c4e> alt 2/4 begin
1c3d: .altinstr_replacement+0x1c3d | | xsaves64 0x40(%rbp)
65c53: os_xsave+0x33 | | xor %ebx,%ebx
65c55: os_xsave+0x35 | | test %ebx,%ebx - already visited
| <alternative.65c4e> alt 2/4 end
65c4e: os_xsave+0x2e | <alternative.65c4e> alt 3/4 begin
1c38: .altinstr_replacement+0x1c38 | | xsavec64 0x40(%rbp)
65c53: os_xsave+0x33 | | xor %ebx,%ebx - already visited
| <alternative.65c4e> alt 3/4 end
65c4e: os_xsave+0x2e | <alternative.65c4e> alt 4/4 begin
1c33: .altinstr_replacement+0x1c33 | | xsaveopt64 0x40(%rbp)
65c53: os_xsave+0x33 | | xor %ebx,%ebx - already visited
| <alternative.65c4e> alt 4/4 end
65c4e: os_xsave+0x2e | <alternative.65c4e> alt default
65c4e: os_xsave+0x2e | xsave64 0x40(%rbp)
65c53: os_xsave+0x33 | xor %ebx,%ebx - already visited
65c3a: os_xsave+0x1a je 65c6a <os_xsave+0x4a> - jump not taken
65c3c: os_xsave+0x1c xor %edx,%edx - already visited
os_xsave: validation end

-----

Alexandre Chartre (13):
objtool: Move disassembly functions to a separated file
objtool: Create disassembly context
objtool: Disassemble code with libopcodes instead of running objdump
objtool: Print symbol during disassembly
objtool: Store instruction disassembly result
objtool: Disassemble instruction on warning or backtrace
objtool: Extract code to validate instruction from the validate branch
loop
objtool: Record symbol name max length
objtool: Add option to trace function validation
objtool: Trace instruction state changes during function validation
objtool: Improve register reporting during function validation
objtool: Improve tracing of alternative instructions
objtool: Do not validate IBT for .return_sites and .call_sites

tools/objtool/Build | 1 +
tools/objtool/Makefile | 2 +-
tools/objtool/arch/loongarch/decode.c | 17 +
tools/objtool/arch/powerpc/decode.c | 18 +
tools/objtool/arch/x86/decode.c | 15 +
tools/objtool/builtin-check.c | 1 +
tools/objtool/check.c | 829 ++++++++++++++++--------
tools/objtool/disas.c | 452 +++++++++++++
tools/objtool/include/objtool/arch.h | 7 +
tools/objtool/include/objtool/builtin.h | 1 +
tools/objtool/include/objtool/check.h | 29 +
tools/objtool/include/objtool/warn.h | 17 +-
12 files changed, 1122 insertions(+), 267 deletions(-)
create mode 100644 tools/objtool/disas.c

--
2.43.5



Return-Path: <linux-kernel+bounces-675941-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7067A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:35:40 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id A5EBB3B2862
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 51661289E31;
Fri, 6 Jun 2025 15:35:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="N5CAAhL6"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 39F9528937C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224099; cv=none; b=SotE2hdeRd06EjK4654DrL66DUnofS61uYNdtrDSbTJQKkdKY6n8Zyigri0IpOM6jDvZleui4fMGdymM7bnCpbPwsqWXjNexv9rLDlvkcm1poPDiyVhCyUz22ZPirTkdqpR4krbtpWMn306lFXk0saipKd09pDZp0dnENrC1FGc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224099; c=relaxed/simple;
bh=3U+y0mvrYcUDNm0lFtJarweNEzMOapJF5DzVUHf/hkI=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=rkASfTFRZsHG1EWwEx9RPb+71jF2UZE3uOdm3n/1Up3MxwZ4Yc8/fd5v+OWoLDW1Uq0a35R/lC0bLuGpBNMfCJ/n6KE7UXbKd+N0t0DH4ZF6oWOhLSydd+BBkQ5OBKSWe46XdcmDYKyzrgV9TqYT8dqLwXqWYWOtiT+uEJdcSqQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=N5CAAhL6; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246632.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MZlU011741;
Fri, 6 Jun 2025 15:34:52 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=PeI/p
k5Il/MGVPlz2adzv5NVdLjN9omB9528dMPld/c=; b=N5CAAhL6bvx03RnB+7uJa
DKPYkH7eLAHxLxvnyErWZQ+GOsQlqyBP0jMJKsQbiz1GTRt0QWzVfGjkdrx1ebmU
w9V+I/qhiZ6ZzUJYeDKfijQ9G15kAkG1Xm/ubnVYaufu+gf99LFpLjZVOtLPNjad
Qf7VLjTm009ygy80+M7RAH/LjXpNvlhagffqe/fMntlOJpK0z9iJLx22HMUeedur
Aia7s8GSbD6z5ubdRiPLpMDcsWESifb2NllzWFzj6Sv9OeiCM1G5hbyB5/sB1w5j
AN4CTOY4VNXFsGxyRpFfiNfwbH5mxFEmFAD0vP0uA8DPpmrLIHOc+eEY8+NrRggQ
g==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8j89cs-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:51 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556Eshsk039288;
Fri, 6 Jun 2025 15:34:50 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7des69-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:50 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3j015517;
Fri, 6 Jun 2025 15:34:50 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-4;
Fri, 06 Jun 2025 15:34:50 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 03/13] objtool: Disassemble code with libopcodes instead of running objdump
Date: Fri, 6 Jun 2025 17:34:30 +0200
Message-ID: <20250606153440.865808-4-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Proofpoint-GUID: AF7nlqu_3zg58uwv76jnljc7-Sj5ajxD
X-Proofpoint-ORIG-GUID: AF7nlqu_3zg58uwv76jnljc7-Sj5ajxD
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX+iqYyXOcqGzH Ysd0gBbvJY8+R7HSK3MrnAx2Birk5Jv/hp4PphWgtlK3MejmQ//+N3nT6pWkHtOBuakj7iMs+sZ KdN9QLwDbXu2KVAHHNuuI1+VQclPA8Y+edJoZ+jSS8jE3tATo7R31GxDMVg6j+FePhuch28cU52
d0G65kU6BhiDj3n3Xj5UiMx235NxVu9ke6RBNCbvKdFA64lEyNvCRR70cw6DZzJ3r6epAVyBOWr j8FKAsp7sSpg3PNLyIZbOW1Z2HDNQgYYxAlGd5HMNo721nYLOjWewnOZ/Z0WFmt7tVBTkGriHpT EgEArh4VU1/kY4h+ZhirstjB5fEAmhOmTAxhf2A1PC9+qlNPEMXX3+hF7h/wTN2/URcUr+Mkn17
eLD46CD4KuobMma047DRukE86UeJng9F5oP4HqM9QPaLbt/gUrWvxwOyI/RVvfxe9SJ+bHbL
X-Authority-Analysis: v=2.4 cv=QI1oRhLL c=1 sm=1 tr=0 ts=68430a9b cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=OvpEF-eQTjwjmUvlGM4A:9
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

objtool executes the objdump command to disassemble code. Use libopcodes
instead to have more control about the disassembly scope and output.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/Makefile | 2 +-
tools/objtool/arch/loongarch/decode.c | 6 +
tools/objtool/arch/powerpc/decode.c | 6 +
tools/objtool/arch/x86/decode.c | 7 +
tools/objtool/check.c | 4 +-
tools/objtool/disas.c | 186 +++++++++++++++---------
tools/objtool/include/objtool/arch.h | 5 +
tools/objtool/include/objtool/check.h | 5 +
tools/objtool/include/objtool/objtool.h | 4 +
9 files changed, 154 insertions(+), 71 deletions(-)

diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 8c20361dd100..00350fc7c662 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -34,7 +34,7 @@ INCLUDES := -I$(srctree)/tools/include \
# is passed here to match a legacy behavior.
WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs
OBJTOOL_CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
-OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
+OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) -lopcodes

# Allow old libelf to be used:
elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(HOSTCC) $(OBJTOOL_CFLAGS) -x c -E - 2>/dev/null | grep elf_getshdr)
diff --git a/tools/objtool/arch/loongarch/decode.c b/tools/objtool/arch/loongarch/decode.c
index b6fdc68053cc..bf5ac6750512 100644
--- a/tools/objtool/arch/loongarch/decode.c
+++ b/tools/objtool/arch/loongarch/decode.c
@@ -386,4 +386,10 @@ unsigned long arch_jump_table_sym_offset(struct reloc *reloc, struct reloc *tabl
default:
return reloc->sym->offset + reloc_addend(reloc);
}
+
+int arch_disas_info_init(struct disassemble_info *dinfo)
+{
+ return disas_info_init(dinfo, bfd_arch_loongarch,
+ bfd_mach_loongarch32, bfd_mach_loongarch64,
+ NULL);
}
diff --git a/tools/objtool/arch/powerpc/decode.c b/tools/objtool/arch/powerpc/decode.c
index c851c51d4bd3..c0fcab2d643c 100644
--- a/tools/objtool/arch/powerpc/decode.c
+++ b/tools/objtool/arch/powerpc/decode.c
@@ -127,4 +127,10 @@ unsigned int arch_reloc_size(struct reloc *reloc)
default:
return 8;
}
+
+int arch_disas_info_init(struct disassemble_info *dinfo)
+{
+ return disas_info_init(dinfo, bfd_arch_powerpc,
+ bfd_mach_ppc, bfd_mach_ppc64,
+ NULL);
}
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 98c4713c1b09..6c13c67ed9b9 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -880,3 +880,10 @@ unsigned int arch_reloc_size(struct reloc *reloc)
return 8;
}
}
+
+int arch_disas_info_init(struct disassemble_info *dinfo)
+{
+ return disas_info_init(dinfo, bfd_arch_i386,
+ bfd_mach_i386_i386, bfd_mach_x86_64,
+ "att");
+}
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 085fcc1b643b..9cfac23185b8 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4701,8 +4701,6 @@ int check(struct objtool_file *file)
goto out;
}

- free_insns(file);
-
if (opts.stats) {
printf("nr_insns_visited: %ld\n", nr_insns_visited);
printf("nr_cfi: %ld\n", nr_cfi);
@@ -4726,5 +4724,7 @@ int check(struct objtool_file *file)
disas_context_destroy(disas_ctx);
}

+ free_insns(file);
+
return ret;
}
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index ed74554bccbf..f2eb1050ce11 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -4,17 +4,52 @@
*/

#include <objtool/arch.h>
+#include <objtool/check.h>
#include <objtool/warn.h>

+#include <bfd.h>
#include <linux/string.h>
+#include <tools/dis-asm-compat.h>

struct disas_context {
struct objtool_file *file;
+ disassembler_ftype disassembler;
+ struct disassemble_info info;
};

+/*
+ * Initialize disassemble info arch, mach (32 or 64-bit) and options.
+ */
+int disas_info_init(struct disassemble_info *dinfo,
+ int arch, int mach32, int mach64,
+ const char *options)
+{
+ struct disas_context *dctx = dinfo->application_data;
+ struct objtool_file *file = dctx->file;
+
+ dinfo->arch = arch;
+
+ switch (file->elf->ehdr.e_ident[EI_CLASS]) {
+ case ELFCLASS32:
+ dinfo->mach = mach32;
+ break;
+ case ELFCLASS64:
+ dinfo->mach = mach64;
+ break;
+ default:
+ return -1;
+ }
+
+ dinfo->disassembler_options = options;
+
+ return 0;
+}
+
struct disas_context *disas_context_create(struct objtool_file *file)
{
struct disas_context *dctx;
+ struct disassemble_info *dinfo;
+ int err;

dctx = malloc(sizeof(*dctx));
if (!dctx) {
@@ -23,8 +58,49 @@ struct disas_context *disas_context_create(struct objtool_file *file)
}

dctx->file = file;
+ dinfo = &dctx->info;
+
+ init_disassemble_info_compat(dinfo, stdout,
+ (fprintf_ftype)fprintf,
+ fprintf_styled);
+
+ dinfo->read_memory_func = buffer_read_memory;
+ dinfo->application_data = dctx;
+
+ /*
+ * bfd_openr() is not used to avoid doing ELF data processing
+ * and caching that has already being done. Here, we just need
+ * to identify the target file so we call an arch specific
+ * function to fill some disassemble info (arch, mach).
+ */
+
+ dinfo->arch = bfd_arch_unknown;
+ dinfo->mach = 0;
+
+ err = arch_disas_info_init(dinfo);
+ if (err || dinfo->arch == bfd_arch_unknown || dinfo->mach == 0) {
+ WARN("failed to init disassembly arch\n");
+ goto error;
+ }
+
+ dinfo->endian = (file->elf->ehdr.e_ident[EI_DATA] == ELFDATA2MSB) ?
+ BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
+
+ disassemble_init_for_target(dinfo);
+
+ dctx->disassembler = disassembler(dinfo->arch,
+ dinfo->endian == BFD_ENDIAN_BIG,
+ dinfo->mach, NULL);
+ if (!dctx->disassembler) {
+ WARN("failed to create disassembler function\n");
+ goto error;
+ }

return dctx;
+
+error:
+ free(dctx);
+ return NULL;
}

void disas_context_destroy(struct disas_context *dctx)
@@ -32,60 +108,54 @@ void disas_context_destroy(struct disas_context *dctx)
free(dctx);
}

-/* 'funcs' is a space-separated list of function names */
-static void disas_funcs(const char *funcs)
+/*
+ * Disassemble a single instruction. Return the size of the instruction.
+ */
+static size_t disas_insn(struct disas_context *dctx,
+ struct instruction *insn)
{
- const char *objdump_str, *cross_compile;
- int size, ret;
- char *cmd;
-
- cross_compile = getenv("CROSS_COMPILE");
- if (!cross_compile)
- cross_compile = "";
-
- objdump_str = "%sobjdump -wdr %s | gawk -M -v _funcs='%s' '"
- "BEGIN { split(_funcs, funcs); }"
- "/^$/ { func_match = 0; }"
- "/<.*>:/ { "
- "f = gensub(/.*<(.*)>:/, \"\\\\1\", 1);"
- "for (i in funcs) {"
- "if (funcs[i] == f) {"
- "func_match = 1;"
- "base = strtonum(\"0x\" $1);"
- "break;"
- "}"
- "}"
- "}"
- "{"
- "if (func_match) {"
- "addr = strtonum(\"0x\" $1);"
- "printf(\"%%04x \", addr - base);"
- "print;"
- "}"
- "}' 1>&2";
-
- /* fake snprintf() to calculate the size */
- size = snprintf(NULL, 0, objdump_str, cross_compile, objname, funcs) + 1;
- if (size <= 0) {
- WARN("objdump string size calculation failed");
- return;
- }
-
- cmd = malloc(size);
+ disassembler_ftype disasm = dctx->disassembler;
+ struct disassemble_info *dinfo = &dctx->info;
+
+ /*
+ * Set the disassembler buffer to read data from the section
+ * containing the instruction to disassemble.
+ */
+ dinfo->buffer = insn->sec->data->d_buf;
+ dinfo->buffer_vma = 0;
+ dinfo->buffer_length = insn->sec->sh.sh_size;
+
+ return disasm(insn->offset, &dctx->info);
+}

- /* real snprintf() */
- snprintf(cmd, size, objdump_str, cross_compile, objname, funcs);
- ret = system(cmd);
- if (ret) {
- WARN("disassembly failed: %d", ret);
- return;
+/*
+ * Disassemble a function.
+ */
+static void disas_func(struct disas_context *dctx, struct symbol *func)
+{
+ struct instruction *insn;
+ size_t addr, size;
+
+ printf("%s:\n", func->name);
+ sym_for_each_insn(dctx->file, func, insn) {
+
+ addr = insn->offset;
+ printf(" %6lx: %s+0x%-6lx ",
+ addr, func->name, addr - func->offset);
+ size = disas_insn(dctx, insn);
+ printf("\n");
+ if (size != insn->len)
+ WARN("inconsistent insn size (%ld and %d)\n", size, insn->len);
}
+ printf("\n");
}

+/*
+ * Disassemble all warned functions.
+ */
void disas_warned_funcs(struct disas_context *dctx)
{
struct symbol *sym;
- char *funcs = NULL, *tmp;

if (!dctx) {
ERROR("disassembly context is not defined");
@@ -93,27 +163,7 @@ void disas_warned_funcs(struct disas_context *dctx)
}

for_each_sym(dctx->file, sym) {
- if (sym->warned) {
- if (!funcs) {
- funcs = malloc(strlen(sym->name) + 1);
- if (!funcs) {
- ERROR_GLIBC("malloc");
- return;
- }
- strcpy(funcs, sym->name);
- } else {
- tmp = malloc(strlen(funcs) + strlen(sym->name) + 2);
- if (!tmp) {
- ERROR_GLIBC("malloc");
- return;
- }
- sprintf(tmp, "%s %s", funcs, sym->name);
- free(funcs);
- funcs = tmp;
- }
- }
+ if (sym->warned)
+ disas_func(dctx, sym);
}
-
- if (funcs)
- disas_funcs(funcs);
}
diff --git a/tools/objtool/include/objtool/arch.h b/tools/objtool/include/objtool/arch.h
index 01ef6f415adf..aecf8fc29571 100644
--- a/tools/objtool/include/objtool/arch.h
+++ b/tools/objtool/include/objtool/arch.h
@@ -6,6 +6,8 @@
#ifndef _ARCH_H
#define _ARCH_H

+#include <bfd.h>
+#include <dis-asm.h>
#include <stdbool.h>
#include <linux/list.h>
#include <objtool/objtool.h>
@@ -98,7 +100,10 @@ int arch_rewrite_retpolines(struct objtool_file *file);

bool arch_pc_relative_reloc(struct reloc *reloc);

+
unsigned int arch_reloc_size(struct reloc *reloc);
unsigned long arch_jump_table_sym_offset(struct reloc *reloc, struct reloc *table);

+int arch_disas_info_init(struct disassemble_info *dinfo);
+
#endif /* _ARCH_H */
diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/objtool/check.h
index 00fb745e7233..5290ac1ebbc1 100644
--- a/tools/objtool/include/objtool/check.h
+++ b/tools/objtool/include/objtool/check.h
@@ -125,4 +125,9 @@ struct instruction *next_insn_same_sec(struct objtool_file *file, struct instruc
insn && insn->sec == _sec; \
insn = next_insn_same_sec(file, insn))

+#define sym_for_each_insn(file, sym, insn) \
+ for (insn = find_insn(file, sym->sec, sym->offset); \
+ insn && insn->offset < sym->offset + sym->len; \
+ insn = next_insn_same_sec(file, insn))
+
#endif /* _CHECK_H */
diff --git a/tools/objtool/include/objtool/objtool.h b/tools/objtool/include/objtool/objtool.h
index f5ab71f07f5c..0b404cfd81c0 100644
--- a/tools/objtool/include/objtool/objtool.h
+++ b/tools/objtool/include/objtool/objtool.h
@@ -48,8 +48,12 @@ int orc_dump(const char *objname);
int orc_create(struct objtool_file *file);

struct disas_context;
+struct disassemble_info;
struct disas_context *disas_context_create(struct objtool_file *file);
void disas_context_destroy(struct disas_context *dctx);
void disas_warned_funcs(struct disas_context *dctx);
+int disas_info_init(struct disassemble_info *dinfo,
+ int arch, int mach32, int mach64,
+ const char *options);

#endif /* _OBJTOOL_H */
--
2.43.5



Return-Path: <linux-kernel+bounces-675943-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EF37441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:35:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D54F175642
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7ED6B28A1E4;
Fri, 6 Jun 2025 15:35:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TS/SflEA"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 F0175276048
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224102; cv=none; b=BG83fNkS76buN4vbzQBPgb6egVH+LZ2ljtqP51neWR+MpYJSc50nBGlJPEQSIK2XgOnVHtzTEZHDg7jlEn5AQV68qhKkGhHQnZVgouUqMzCUDY2o/2ohEBfb+TIyafBOJFwmUFcAYfSzEeJXIB8nr3i4TtxOrkIObMZzODWP7g8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224102; c=relaxed/simple;
bh=kRHpxHGdnDbmGJgSjhss+LvCRQXFlC9CVb2+NgDTQCA=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=my6Z+TGiIs5VXIU5Wj4NEh/uIinYxqOJlmi//lPU/QB/1XDh3zQMVy/WM1mPPiF55ETvXgsaPvbI0mnu+qXVhGKElsr4zqZaYVdD09HkVgSiONQCC1EUf0n1TXcs9FJfsjCOW8a4cuVR6u2a3Z7IvkGmUFO5EdLlLJJ+DVJFL4c=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=TS/SflEA; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0333520.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565Nd0U003840;
Fri, 6 Jun 2025 15:34:56 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=5uU22
ZQC8/bZaX1N2l5t1e/8/ilrOtO9X/0/f7od/jw=; b=TS/SflEAZ3b4zjtgYV+Xd
AGNmlrcrZvlB7h4mqsD3jo/3c/jfRHIGkH99RsqUz4QeXjKh+ODF9+yT0ng9bYYB
EHYo42gafxWFJu03xdtnkyuBBaUxMsWgZMy5QhgcKXBuwv6Xkgcj7R4e8iuLuNiQ
T//uYVz9DZoglFDuNo1GRv0VPwxMknVPdb5czEAxP5eFHGgzFLWR+dCrJgfnKg3y
cbBPnU+ALdUznh3dELWOM7/qAw6F6v3YkYUPix7kHyrzLj9kvfcDsaKEq2jmfmzg
bBOxgMUZUAIqEvox/aWcQDwmWx2xARUfqsPehWEk/jBAk1YArWpon82MFH4cI/Ia
w==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gahgafq-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:55 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556EJExp038537;
Fri, 6 Jun 2025 15:34:54 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7des9e-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:54 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3n015517;
Fri, 6 Jun 2025 15:34:54 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-6;
Fri, 06 Jun 2025 15:34:54 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 05/13] objtool: Store instruction disassembly result
Date: Fri, 6 Jun 2025 17:34:32 +0200
Message-ID: <20250606153440.865808-6-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=aqqyCTZV c=1 sm=1 tr=0 ts=68430a9f cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=15-dxsL2gXYqenlZGRYA:9
X-Proofpoint-GUID: Glyc08PLi2wD6WSLjOpAo2H0nxexilx6
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX5VbHRAyjQ83/ dZPht+K35Vnc1XDZCC6vgSdsrs4F5MUuh9CadfD53jA4awRE4/4GiswJnmCnpjNB1wDqX9u7sjr PSWVhvQiw6v0ZxF5UaZTyrKpv4uAx58Wzv5AbBgcyq1V1zRsNSkJnTDItHQEp2x8Zd0+Uo7iQiE
7AEdYtN78HjRoFgz4vC7LFEdo3Ra0iMGuT9zirCq4vjucXUCZVcZI8rfxxMJQEEculxB+HkfLC+ A8y4niVqGQbF6hjnl2TsnoMwQh6Xqb4nTfnlv3jDcM9+j0ZbpdERveP1/q7P0ouxndJXWGnqP82 7GR9x2xDYIn8g3rGGKdRy5ohe0W1PeJ8yDh7TalXu7D7meDBvn2qVyTAGbFTwg71stLLkEdssa6
nEZke3WV/0qcZIyZjkwcP3+4Ckbggm76ENKM4SvcaczVBxqOQE/SPqklV6AZQeL0Jzrschk5
X-Proofpoint-ORIG-GUID: Glyc08PLi2wD6WSLjOpAo2H0nxexilx6
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

When disassembling an instruction store the result instead of directly
printing it.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/disas.c | 161 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 155 insertions(+), 6 deletions(-)

diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index 83fe2c018c4b..f86b9b04ef97 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -11,9 +11,16 @@
#include <linux/string.h>
#include <tools/dis-asm-compat.h>

+struct dbuffer {
+ char *addr;
+ size_t size;
+ size_t used;
+};
+
struct disas_context {
struct objtool_file *file;
struct instruction *insn;
+ struct dbuffer result;
disassembler_ftype disassembler;
struct disassemble_info info;
};
@@ -21,6 +28,129 @@ struct disas_context {
#define DINFO_FPRINTF(dinfo, ...) \
((*(dinfo)->fprintf_func)((dinfo)->stream, __VA_ARGS__))

+
+static int dbuffer_init(struct dbuffer *dbuf, size_t size)
+{
+ dbuf->used = 0;
+ dbuf->size = size;
+
+ if (!size) {
+ dbuf->addr = NULL;
+ return 0;
+ }
+
+ dbuf->addr = malloc(size);
+ if (!dbuf->addr)
+ return -1;
+
+ return 0;
+}
+
+static void dbuffer_fini(struct dbuffer *dbuf)
+{
+ free(dbuf->addr);
+ dbuf->size = 0;
+ dbuf->used = 0;
+}
+
+static void dbuffer_reset(struct dbuffer *dbuf)
+{
+ dbuf->used = 0;
+}
+
+static char *dbuffer_data(struct dbuffer *dbuf)
+{
+ return dbuf->addr;
+}
+
+static int dbuffer_expand(struct dbuffer *dbuf, size_t space)
+{
+ size_t size;
+ char *addr;
+
+ size = dbuf->size + space;
+ addr = realloc(dbuf->addr, size);
+ if (!addr)
+ return -1;
+
+ dbuf->addr = addr;
+ dbuf->size = size;
+
+ return 0;
+}
+
+static int dbuffer_vappendf_noexpand(struct dbuffer *dbuf, const char *fmt, va_list ap)
+{
+ int free, len;
+
+ free = dbuf->size - dbuf->used;
+
+ len = vsnprintf(dbuf->addr + dbuf->used, free, fmt, ap);
+
+ if (len < 0)
+ return -1;
+
+ if (len < free) {
+ dbuf->used += len;
+ return 0;
+ }
+
+ return (len - free) + 1;
+}
+
+static int dbuffer_vappendf(struct dbuffer *dbuf, const char *fmt, va_list ap)
+{
+ int space_needed, err;
+
+ space_needed = dbuffer_vappendf_noexpand(dbuf, fmt, ap);
+ if (space_needed <= 0)
+ return space_needed;
+
+ /*
+ * The buffer is not large enough to store all data. Expand
+ * the buffer and retry. The buffer is expanded with enough
+ * space to store all data.
+ */
+ err = dbuffer_expand(dbuf, space_needed * 2);
+ if (err) {
+ WARN("failed to expand buffer\n");
+ return -1;
+ }
+
+ return dbuffer_vappendf_noexpand(dbuf, fmt, ap);
+}
+
+static int disas_fprintf(void *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int len;
+
+ va_start(arg, fmt);
+ len = dbuffer_vappendf(stream, fmt, arg);
+ va_end(arg);
+
+ return len == 0 ? 0 : -1;
+}
+
+/*
+ * For init_disassemble_info_compat().
+ */
+static int disas_fprintf_styled(void *stream,
+ enum disassembler_style style,
+ const char *fmt, ...)
+{
+ va_list arg;
+ int len;
+
+ (void)style;
+
+ va_start(arg, fmt);
+ len = dbuffer_vappendf(stream, fmt, arg);
+ va_end(arg);
+
+ return len == 0 ? 0 : -1;
+}
+
static void disas_print_address(bfd_vma addr, struct disassemble_info *dinfo)
{
struct disas_context *dctx = dinfo->application_data;
@@ -147,6 +277,7 @@ struct disas_context *disas_context_create(struct objtool_file *file)
{
struct disas_context *dctx;
struct disassemble_info *dinfo;
+ struct dbuffer *dbuf;
int err;

dctx = malloc(sizeof(*dctx));
@@ -157,10 +288,16 @@ struct disas_context *disas_context_create(struct objtool_file *file)

dctx->file = file;
dinfo = &dctx->info;
+ dbuf = &dctx->result;
+
+ err = dbuffer_init(dbuf, 1024);
+ if (err) {
+ WARN("failed to initialize buffer\n");
+ return NULL;
+ }

- init_disassemble_info_compat(dinfo, stdout,
- (fprintf_ftype)fprintf,
- fprintf_styled);
+ init_disassemble_info_compat(dinfo, dbuf,
+ disas_fprintf, disas_fprintf_styled);

dinfo->read_memory_func = buffer_read_memory;
dinfo->print_address_func = disas_print_address;
@@ -204,9 +341,18 @@ struct disas_context *disas_context_create(struct objtool_file *file)

void disas_context_destroy(struct disas_context *dctx)
{
+ if (!dctx)
+ return;
+
+ dbuffer_fini(&dctx->result);
free(dctx);
}

+static char *disas_result(struct disas_context *dctx)
+{
+ return dbuffer_data(&dctx->result);
+}
+
/*
* Disassemble a single instruction. Return the size of the instruction.
*/
@@ -216,6 +362,7 @@ static size_t disas_insn(struct disas_context *dctx,
disassembler_ftype disasm = dctx->disassembler;
struct disassemble_info *dinfo = &dctx->info;

+ dbuffer_reset(&dctx->result);
dctx->insn = insn;

/*
@@ -241,10 +388,12 @@ static void disas_func(struct disas_context *dctx, struct symbol *func)
sym_for_each_insn(dctx->file, func, insn) {

addr = insn->offset;
- printf(" %6lx: %s+0x%-6lx ",
- addr, func->name, addr - func->offset);
size = disas_insn(dctx, insn);
- printf("\n");
+
+ printf(" %6lx: %s+0x%-6lx %s\n",
+ addr, func->name, addr - func->offset,
+ disas_result(dctx));
+
if (size != insn->len)
WARN("inconsistent insn size (%ld and %d)\n", size, insn->len);
}
--
2.43.5



Return-Path: <linux-kernel+bounces-675942-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CD65941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:36:12 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 98B97189EA49
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:56 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A3AFA28A1C5;
Fri, 6 Jun 2025 15:35:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="V2j+fAD6"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 EA206289E03
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:34:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224100; cv=none; b=Ot08UxKCu0S7IuGt17ObFRlMVncM0/1zV85sQGq7QwuoZxTX2SoNFPzf8/J0k1wYIaFA2LkBTER8EmlTLO1ijf4ArGK5apLMoIkZ0jEShKJ9r0tp3fagXEs7DS0xKNpUqFX4Na1c//Io4ePiJJTRQYXq9vul4z1prZZMB97Fndk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224100; c=relaxed/simple;
bh=7s1S+tY477XcZ2hoynSKzaGJovL0nWx0gUoFfx5bI9k=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=ELvVGEoDZoM6lhG0veU6hKiX1voJtZVAMXUQgLHO86ulnVeWBSYpymYM1oDlOJUuxxVvvJAKrdgN2LuryduHFLCwFhAv2eiKC1U31r2lU1kVmUlJo6FfxT0A2KIpnFRbHJXhi6dAtaOISBJlrVtBbEtff1zs6axzEaxbO8IB5e4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=V2j+fAD6; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246631.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MY8A030076;
Fri, 6 Jun 2025 15:34:53 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=vDQhR
jq/WXJAo/D85QYcbbaMFMBUxMy1kZmMNHPiQAU=; b=V2j+fAD66bUGws5IsGJLs
g6Z8Ieh3tosA/1LJ5d+gJuU0GhVOfPCrxQUqTr7REUY/9N8H47U+4OtusJSGBDd+
7y3WaQtd08oiXiY00HQb9Leo/PsmMLSI4dNRkQaWjFUw8YjumfrH5euqri1+dvKK
OevwBroX8fwZZQg9XyIBnr1ZXUFDu+Df1h/klFJGOFWv+qPIl0bGEQDaSucZUKKY
wjxd4NQQWdljClzc8nkvhtgyixZQo/G80DuAHob8ZvYrnxQ/T8unAF7uxK203l9d
cNgmxp75Z1nNGFb+f1tidfZ5aqpC7i0jukl2nuSJfhoOmP5YKxDiH6fNjH6T55EQ
w==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8e086t-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:53 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556E22Od038561;
Fri, 6 Jun 2025 15:34:52 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7des7t-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:52 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3l015517;
Fri, 6 Jun 2025 15:34:52 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-5;
Fri, 06 Jun 2025 15:34:51 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 04/13] objtool: Print symbol during disassembly
Date: Fri, 6 Jun 2025 17:34:31 +0200
Message-ID: <20250606153440.865808-5-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=Va/3PEp9 c=1 sm=1 tr=0 ts=68430a9d cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=GRtY48bZnyd7kpkPou0A:9
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX/mVhWij6uIrt g4rFDULjrolbqeI88a9IH/6SXZyUocAutCEo+iRk0O7nYeoVRq9/azBkknM8mRBl47xcFY1HzFC +V1pzuUplWKMuDMHAXFloTBh0ZqjOnlshyZum5/MMNfog7kxTakALRMxMvsvS4JYszmjA7ItOng
pOYd462cLruDvooJlJcdC4ACoQmIhRSi7/4ZWI2vQ9biSdvWc4l46o6aDbwuMmGRsm5/6IyEcnp b8NXzUeARVjYxq4xyCFVhW2dhbDVxsuNEuJkVqnXS1BpMdbPOCBx96fTPxDwxetnDh6G+17WKWc fP0/VITR50eKw0e9AiuDurjoqmZIE/BlTKLzreEtTsi7W94BlvE0fSUO+2SvY75jjGOZM7S/QhE
3cyiGyYj8UAM5C6MyWReN9TIMi4rtCPs8/9TBF7lkbgFyLzUdxxaNRxlcNJimbBUCdYQB5nC
X-Proofpoint-ORIG-GUID: sKFFsyCCLaCiCk3wJKJ9GCWfOg8gkRDq
X-Proofpoint-GUID: sKFFsyCCLaCiCk3wJKJ9GCWfOg8gkRDq
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Print symbols referenced during disassembly instead of just printing
raw addresses. Also handle address relocation.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/check.c | 9 ---
tools/objtool/disas.c | 101 ++++++++++++++++++++++++++
tools/objtool/include/objtool/check.h | 9 +++
3 files changed, 110 insertions(+), 9 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 9cfac23185b8..ee613f03e57d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -131,15 +131,6 @@ static struct instruction *prev_insn_same_sym(struct objtool_file *file,
for (insn = next_insn_same_sec(file, insn); insn; \
insn = next_insn_same_sec(file, insn))

-static inline struct symbol *insn_call_dest(struct instruction *insn)
-{
- if (insn->type == INSN_JUMP_DYNAMIC ||
- insn->type == INSN_CALL_DYNAMIC)
- return NULL;
-
- return insn->_call_dest;
-}
-
static inline struct reloc *insn_jump_table(struct instruction *insn)
{
if (insn->type == INSN_JUMP_DYNAMIC ||
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index f2eb1050ce11..83fe2c018c4b 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -13,10 +13,108 @@

struct disas_context {
struct objtool_file *file;
+ struct instruction *insn;
disassembler_ftype disassembler;
struct disassemble_info info;
};

+#define DINFO_FPRINTF(dinfo, ...) \
+ ((*(dinfo)->fprintf_func)((dinfo)->stream, __VA_ARGS__))
+
+static void disas_print_address(bfd_vma addr, struct disassemble_info *dinfo)
+{
+ struct disas_context *dctx = dinfo->application_data;
+ struct instruction *insn = dctx->insn;
+ struct objtool_file *file = dctx->file;
+ struct symbol *call_dest, *sym;
+ struct instruction *jump_dest;
+ struct section *sec;
+ struct reloc *reloc;
+ bool is_reloc;
+ s64 offset;
+
+ /*
+ * If the instruction is a call/jump and it references a
+ * destination then this is likely the address we are looking
+ * up. So check it first.
+ */
+ jump_dest = insn->jump_dest;
+ if (jump_dest && jump_dest->offset == addr) {
+ DINFO_FPRINTF(dinfo, "%lx <%s+0x%lx>", addr,
+ jump_dest->sym->name,
+ jump_dest->offset - jump_dest->sym->offset);
+ return;
+ }
+
+ /*
+ * Assume the address is a relocation if it points to the next
+ * instruction.
+ */
+ is_reloc = (addr == insn->offset + insn->len);
+
+ /*
+ * The call destination offset can be the address we are looking
+ * up, or 0 if there is a relocation.
+ */
+ call_dest = insn_call_dest(insn);
+ if (call_dest) {
+ if (call_dest->offset == addr) {
+ DINFO_FPRINTF(dinfo, "%lx <%s>", addr, call_dest->name);
+ return;
+ }
+ if (call_dest->offset == 0 && is_reloc) {
+ DINFO_FPRINTF(dinfo, "%s", call_dest->name);
+ return;
+ }
+ }
+
+ if (!is_reloc) {
+ DINFO_FPRINTF(dinfo, "0x%lx", addr);
+ return;
+ }
+
+ /*
+ * If this is a relocation, check if we have relocation information
+ * for this instruction.
+ */
+ reloc = find_reloc_by_dest_range(file->elf, insn->sec,
+ insn->offset, insn->len);
+ if (!reloc) {
+ DINFO_FPRINTF(dinfo, "0x%lx", addr);
+ return;
+ }
+
+ if (reloc_type(reloc) == R_X86_64_PC32 ||
+ reloc_type(reloc) == R_X86_64_PLT32)
+ offset = arch_dest_reloc_offset(reloc_addend(reloc));
+ else
+ offset = reloc_addend(reloc);
+
+ /*
+ * If the relocation symbol is a section name (for example ".bss")
+ * then we try to further resolve the name.
+ */
+ sec = find_section_by_name(file->elf, reloc->sym->name);
+ if (sec) {
+ sym = find_symbol_containing(sec, offset);
+ if (sym) {
+ if (sym->offset == offset)
+ DINFO_FPRINTF(dinfo, "%s+0x%lx = %s",
+ reloc->sym->name, offset, sym->name);
+ else
+ DINFO_FPRINTF(dinfo, "%s+0x%lx = %s+0x%lx",
+ reloc->sym->name, offset,
+ sym->name, offset - sym->offset);
+ return;
+ }
+ }
+
+ if (offset)
+ DINFO_FPRINTF(dinfo, "%s+0x%lx", reloc->sym->name, offset);
+ else
+ DINFO_FPRINTF(dinfo, "%s", reloc->sym->name);
+}
+
/*
* Initialize disassemble info arch, mach (32 or 64-bit) and options.
*/
@@ -65,6 +163,7 @@ struct disas_context *disas_context_create(struct objtool_file *file)
fprintf_styled);

dinfo->read_memory_func = buffer_read_memory;
+ dinfo->print_address_func = disas_print_address;
dinfo->application_data = dctx;

/*
@@ -117,6 +216,8 @@ static size_t disas_insn(struct disas_context *dctx,
disassembler_ftype disasm = dctx->disassembler;
struct disassemble_info *dinfo = &dctx->info;

+ dctx->insn = insn;
+
/*
* Set the disassembler buffer to read data from the section
* containing the instruction to disassemble.
diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/objtool/check.h
index 5290ac1ebbc1..4adbcd760c6f 100644
--- a/tools/objtool/include/objtool/check.h
+++ b/tools/objtool/include/objtool/check.h
@@ -115,6 +115,15 @@ static inline bool is_jump(struct instruction *insn)
return is_static_jump(insn) || is_dynamic_jump(insn);
}

+static inline struct symbol *insn_call_dest(struct instruction *insn)
+{
+ if (insn->type == INSN_JUMP_DYNAMIC ||
+ insn->type == INSN_CALL_DYNAMIC)
+ return NULL;
+
+ return insn->_call_dest;
+}
+
struct instruction *find_insn(struct objtool_file *file,
struct section *sec, unsigned long offset);

--
2.43.5



Return-Path: <linux-kernel+bounces-675945-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F1BE341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:36:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 533173B2EB5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7640A28A417;
Fri, 6 Jun 2025 15:35:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="i65WNvjv"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 5BD8328A3E2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224107; cv=none; b=dmy5ceUSPf6MWcAPAq2gON6cQy5IaR1JgCYodF4ek4T/3qjf14nlpJ46PerjtkmMwUX/5jVN8iceglgQmtxy6iFa8Tt1rq/q8irtkANrwYzVV7etT4IWAmiPvd+hHjl/Ai3A2pSYRa6qk3thNhSRKwye5qDwTVZihSiUl/2rWLw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224107; c=relaxed/simple;
bh=wHEFyBTkm62XrtfmdTIT8TqWz7wYriDq2vcRhdzM6yo=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=qptNHJjGaa8hD1cNjlHNSG8bnmuUXP5tBnQ8c6+dfN6JiVfhn3weNxUwS02OQbM2MrqAvlSb1XABqGryUeIxmHUb5rMX1zPPUT2OPxejlry2NrMHMopM68Um9Uu4I+7z2ZWq6QlNze8xOsDu+a0RLclrshWm4RI+QpE9SU1z6Yk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=i65WNvjv; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246631.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565McdQ030094;
Fri, 6 Jun 2025 15:35:00 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=SV7xZ
kJY28IXuHyUrf/x9Sg5EBI6i480a87R8ab46QA=; b=i65WNvjvvF7Oi0P+UDLq8
G36Xrv+RvgirwnIvZ2EkeIs5qlXGM9Fxphpa30sn953xR8ZI+Gu0BfmvPxJcz8/V
f3MVUNIjyda6H5cg3RGhJ8PRfIoxBSVCWI96D6+h6ZEgw7JvyrIkE7slKCkl2z5+
fymmkJfZmaK4wNaA5ehAXXDz1o7oac67WcvXr88ePiWc9iiodIpqYk6h6KvojQJv
fglsdaR+4epIbyLwMOncQqdXWQV+b8UT/wzg0ez9k5u8pcYiO4zZlAcIAQ5CFKoY
b8O7GdaQuBCrCKBWdTtukbRSgEA3bR7ElT4gO2zrfx0wSmu1FZkGEsa0S88U84r0
A==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8e0873-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:00 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556ERKdx039260;
Fri, 6 Jun 2025 15:34:59 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7desc8-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:59 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3r015517;
Fri, 6 Jun 2025 15:34:58 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-8;
Fri, 06 Jun 2025 15:34:58 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 07/13] objtool: Extract code to validate instruction from the validate branch loop
Date: Fri, 6 Jun 2025 17:34:34 +0200
Message-ID: <20250606153440.865808-8-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=Va/3PEp9 c=1 sm=1 tr=0 ts=68430aa4 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=17Qteg5u5z3jqcDY0jQA:9
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX0DtRWUUTquCu daM2sUul4gY/dAAx1TS5vjChGEb4jesYXr4SRyY+ytyoup57FFgNfeQE88tul4e5oqqfCoiOCv0 f3SYdwZ6uJvI0f/5YLsVOQCFQtJXTC2gePV1a20xboUDJqNKcS/V4IQyX+QHpYs4bZwDh2Q4kbQ
BnVhiZNtKZIGNBI6RGjYJNcM1B8MnhkVT6CLT9A1v8bO4UGz+6eT6jX7xs9VvbwcLz2fgUulbGg OBMpFoaQUiYsZciu2xNkYSsUikfj5Zje/62uywnqw14D3CUwCTZFy6VUWujuHhP9X01X0GIuJ/l CiIf4JspYavrQkakWl1moiJAYMn7xMqvjyQMB4nTaKvhnwUGMk79ltLwAArOIB9PiX027C+stua
/g+eAoAi2Ev+87maGm58qoVO32jz5yzTGKBGi5ae1Ihxwf1OjaA0G6HNoky8OdRzHZ9IeZrw
X-Proofpoint-ORIG-GUID: KUzkORfUHJgnMncUlwMCM2j67GaH3zf3
X-Proofpoint-GUID: KUzkORfUHJgnMncUlwMCM2j67GaH3zf3
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The code to validate a branch loops through all instructions of the
branch and validate each instruction. Move the code to validate an
instruction to a separated function.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/check.c | 375 +++++++++++++++++++++++-------------------
1 file changed, 208 insertions(+), 167 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 2c73c8d3515d..36ec08b8d654 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3527,6 +3527,11 @@ static bool skip_alt_group(struct instruction *insn)
return alt_insn->type == INSN_CLAC || alt_insn->type == INSN_STAC;
}

+static int validate_insn(struct objtool_file *file, struct symbol *func,
+ struct instruction *insn, struct insn_state *statep,
+ struct instruction *prev_insn, struct instruction *next_insn,
+ bool *validate_nextp);
+
/*
* Follow the branch starting at the given instruction, and recursively follow
* any other branches (jumps). Meanwhile, track the frame pointer state at
@@ -3536,10 +3541,9 @@ static bool skip_alt_group(struct instruction *insn)
static int validate_branch(struct objtool_file *file, struct symbol *func,
struct instruction *insn, struct insn_state state)
{
- struct alternative *alt;
struct instruction *next_insn, *prev_insn = NULL;
struct section *sec;
- u8 visited;
+ bool validate_next;
int ret;

if (func && func->ignore)
@@ -3566,232 +3570,269 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
return 1;
}

- visited = VISITED_BRANCH << state.uaccess;
- if (insn->visited & VISITED_BRANCH_MASK) {
- if (!insn->hint && !insn_cfi_match(insn, &state.cfi))
- return 1;
+ ret = validate_insn(file, func, insn, &state,
+ prev_insn, next_insn,
+ &validate_next);
+ if (!validate_next)
+ break;

- if (insn->visited & visited)
+ if (!next_insn) {
+ if (state.cfi.cfa.base == CFI_UNDEFINED)
return 0;
- } else {
- nr_insns_visited++;
+ if (file->ignore_unreachables)
+ return 0;
+
+ WARN("%s%sunexpected end of section %s",
+ func ? func->name : "", func ? "(): " : "",
+ sec->name);
+ return 1;
}

- if (state.noinstr)
- state.instr += insn->instr;
+ prev_insn = insn;
+ insn = next_insn;
+ }

- if (insn->hint) {
- if (insn->restore) {
- struct instruction *save_insn, *i;
+ return ret;
+}

- i = insn;
- save_insn = NULL;
+static int validate_insn(struct objtool_file *file, struct symbol *func,
+ struct instruction *insn, struct insn_state *statep,
+ struct instruction *prev_insn, struct instruction *next_insn,
+ bool *validate_nextp)
+{
+ struct alternative *alt;
+ u8 visited;
+ int ret;

- sym_for_each_insn_continue_reverse(file, func, i) {
- if (i->save) {
- save_insn = i;
- break;
- }
- }
+ /*
+ * Indicate that, by default, the calling function should not
+ * validate the next instruction and validation should be
+ * stopped. That way this function can stop validation by just
+ * returning at any point before reaching the end of the function.
+ *
+ * If the end of this function is reached then that means that the
+ * validation should continue and the caller should validate the
+ * next instruction, so *validate_nextp will be set to true at
+ * that point.
+ */
+ *validate_nextp = false;

- if (!save_insn) {
- WARN_INSN(insn, "no corresponding CFI save for CFI restore");
- return 1;
- }
+ visited = VISITED_BRANCH << statep->uaccess;
+ if (insn->visited & VISITED_BRANCH_MASK) {
+ if (!insn->hint && !insn_cfi_match(insn, &statep->cfi))
+ return 1;

- if (!save_insn->visited) {
- /*
- * If the restore hint insn is at the
- * beginning of a basic block and was
- * branched to from elsewhere, and the
- * save insn hasn't been visited yet,
- * defer following this branch for now.
- * It will be seen later via the
- * straight-line path.
- */
- if (!prev_insn)
- return 0;
+ if (insn->visited & visited)
+ return 0;
+ } else {
+ nr_insns_visited++;
+ }

- WARN_INSN(insn, "objtool isn't smart enough to handle this CFI save/restore combo");
- return 1;
- }
+ if (statep->noinstr)
+ statep->instr += insn->instr;

- insn->cfi = save_insn->cfi;
- nr_cfi_reused++;
- }
+ if (insn->hint) {
+ if (insn->restore) {
+ struct instruction *save_insn, *i;

- state.cfi = *insn->cfi;
- } else {
- /* XXX track if we actually changed state.cfi */
+ i = insn;
+ save_insn = NULL;

- if (prev_insn && !cficmp(prev_insn->cfi, &state.cfi)) {
- insn->cfi = prev_insn->cfi;
- nr_cfi_reused++;
- } else {
- insn->cfi = cfi_hash_find_or_add(&state.cfi);
+ sym_for_each_insn_continue_reverse(file, func, i) {
+ if (i->save) {
+ save_insn = i;
+ break;
+ }
}
- }

- insn->visited |= visited;
+ if (!save_insn) {
+ WARN_INSN(insn, "no corresponding CFI save for CFI restore");
+ return 1;
+ }

- if (propagate_alt_cfi(file, insn))
- return 1;
+ if (!save_insn->visited) {
+ /*
+ * If the restore hint insn is at the
+ * beginning of a basic block and was
+ * branched to from elsewhere, and the
+ * save insn hasn't been visited yet,
+ * defer following this branch for now.
+ * It will be seen later via the
+ * straight-line path.
+ */
+ if (!prev_insn)
+ return 0;

- if (insn->alts) {
- for (alt = insn->alts; alt; alt = alt->next) {
- ret = validate_branch(file, func, alt->insn, state);
- if (ret) {
- BT_INSN(insn, "(alt)");
- return ret;
- }
+ WARN_INSN(insn, "objtool isn't smart enough to handle this CFI save/restore combo");
+ return 1;
}
+
+ insn->cfi = save_insn->cfi;
+ nr_cfi_reused++;
}

- if (skip_alt_group(insn))
- return 0;
+ statep->cfi = *insn->cfi;
+ } else {
+ /* XXX track if we actually changed statep->cfi */

- if (handle_insn_ops(insn, next_insn, &state))
- return 1;
+ if (prev_insn && !cficmp(prev_insn->cfi, &statep->cfi)) {
+ insn->cfi = prev_insn->cfi;
+ nr_cfi_reused++;
+ } else {
+ insn->cfi = cfi_hash_find_or_add(&statep->cfi);
+ }
+ }

- switch (insn->type) {
+ insn->visited |= visited;

- case INSN_RETURN:
- return validate_return(func, insn, &state);
+ if (propagate_alt_cfi(file, insn))
+ return 1;

- case INSN_CALL:
- case INSN_CALL_DYNAMIC:
- ret = validate_call(file, insn, &state);
- if (ret)
+ if (insn->alts) {
+ for (alt = insn->alts; alt; alt = alt->next) {
+ ret = validate_branch(file, func, alt->insn, *statep);
+ if (ret) {
+ BT_INSN(insn, "(alt)");
return ret;
-
- if (opts.stackval && func && !is_special_call(insn) &&
- !has_valid_stack_frame(&state)) {
- WARN_INSN(insn, "call without frame pointer save/setup");
- return 1;
}
+ }
+ }

- break;
-
- case INSN_JUMP_CONDITIONAL:
- case INSN_JUMP_UNCONDITIONAL:
- if (is_sibling_call(insn)) {
- ret = validate_sibling_call(file, insn, &state);
- if (ret)
- return ret;
-
- } else if (insn->jump_dest) {
- ret = validate_branch(file, func,
- insn->jump_dest, state);
- if (ret) {
- BT_INSN(insn, "(branch)");
- return ret;
- }
- }
+ if (skip_alt_group(insn))
+ return 0;

- if (insn->type == INSN_JUMP_UNCONDITIONAL)
- return 0;
+ if (handle_insn_ops(insn, next_insn, statep))
+ return 1;

- break;
+ switch (insn->type) {

- case INSN_JUMP_DYNAMIC:
- case INSN_JUMP_DYNAMIC_CONDITIONAL:
- if (is_sibling_call(insn)) {
- ret = validate_sibling_call(file, insn, &state);
- if (ret)
- return ret;
- }
+ case INSN_RETURN:
+ return validate_return(func, insn, statep);

- if (insn->type == INSN_JUMP_DYNAMIC)
- return 0;
+ case INSN_CALL:
+ case INSN_CALL_DYNAMIC:
+ ret = validate_call(file, insn, statep);
+ if (ret)
+ return ret;

- break;
+ if (opts.stackval && func && !is_special_call(insn) &&
+ !has_valid_stack_frame(statep)) {
+ WARN_INSN(insn, "call without frame pointer save/setup");
+ return 1;
+ }

- case INSN_SYSCALL:
- if (func && (!next_insn || !next_insn->hint)) {
- WARN_INSN(insn, "unsupported instruction in callable function");
- return 1;
- }
+ break;

- break;
+ case INSN_JUMP_CONDITIONAL:
+ case INSN_JUMP_UNCONDITIONAL:
+ if (is_sibling_call(insn)) {
+ ret = validate_sibling_call(file, insn, statep);
+ if (ret)
+ return ret;

- case INSN_SYSRET:
- if (func && (!next_insn || !next_insn->hint)) {
- WARN_INSN(insn, "unsupported instruction in callable function");
- return 1;
+ } else if (insn->jump_dest) {
+ ret = validate_branch(file, func,
+ insn->jump_dest, *statep);
+ if (ret) {
+ BT_INSN(insn, "(branch)");
+ return ret;
}
+ }

+ if (insn->type == INSN_JUMP_UNCONDITIONAL)
return 0;

- case INSN_STAC:
- if (!opts.uaccess)
- break;
+ break;

- if (state.uaccess) {
- WARN_INSN(insn, "recursive UACCESS enable");
- return 1;
- }
+ case INSN_JUMP_DYNAMIC:
+ case INSN_JUMP_DYNAMIC_CONDITIONAL:
+ if (is_sibling_call(insn)) {
+ ret = validate_sibling_call(file, insn, statep);
+ if (ret)
+ return ret;
+ }

- state.uaccess = true;
- break;
+ if (insn->type == INSN_JUMP_DYNAMIC)
+ return 0;

- case INSN_CLAC:
- if (!opts.uaccess)
- break;
+ break;

- if (!state.uaccess && func) {
- WARN_INSN(insn, "redundant UACCESS disable");
- return 1;
- }
+ case INSN_SYSCALL:
+ if (func && (!next_insn || !next_insn->hint)) {
+ WARN_INSN(insn, "unsupported instruction in callable function");
+ return 1;
+ }

- if (func_uaccess_safe(func) && !state.uaccess_stack) {
- WARN_INSN(insn, "UACCESS-safe disables UACCESS");
- return 1;
- }
+ break;

- state.uaccess = false;
- break;
+ case INSN_SYSRET:
+ if (func && (!next_insn || !next_insn->hint)) {
+ WARN_INSN(insn, "unsupported instruction in callable function");
+ return 1;
+ }

- case INSN_STD:
- if (state.df) {
- WARN_INSN(insn, "recursive STD");
- return 1;
- }
+ return 0;

- state.df = true;
+ case INSN_STAC:
+ if (!opts.uaccess)
break;

- case INSN_CLD:
- if (!state.df && func) {
- WARN_INSN(insn, "redundant CLD");
- return 1;
- }
+ if (statep->uaccess) {
+ WARN_INSN(insn, "recursive UACCESS enable");
+ return 1;
+ }

- state.df = false;
- break;
+ statep->uaccess = true;
+ break;

- default:
+ case INSN_CLAC:
+ if (!opts.uaccess)
break;
+
+ if (!statep->uaccess && func) {
+ WARN_INSN(insn, "redundant UACCESS disable");
+ return 1;
}

- if (insn->dead_end)
- return 0;
+ if (func_uaccess_safe(func) && !statep->uaccess_stack) {
+ WARN_INSN(insn, "UACCESS-safe disables UACCESS");
+ return 1;
+ }

- if (!next_insn) {
- if (state.cfi.cfa.base == CFI_UNDEFINED)
- return 0;
- if (file->ignore_unreachables)
- return 0;
+ statep->uaccess = false;
+ break;

- WARN("%s%sunexpected end of section %s",
- func ? func->name : "", func ? "(): " : "",
- sec->name);
+ case INSN_STD:
+ if (statep->df) {
+ WARN_INSN(insn, "recursive STD");
return 1;
}

- prev_insn = insn;
- insn = next_insn;
+ statep->df = true;
+ break;
+
+ case INSN_CLD:
+ if (!statep->df && func) {
+ WARN_INSN(insn, "redundant CLD");
+ return 1;
+ }
+
+ statep->df = false;
+ break;
+
+ default:
+ break;
}

+ if (insn->dead_end)
+ return 0;
+
+ /*
+ * Indicate that the caller should validate the next
+ * instruction and continue the validation.
+ */
+ *validate_nextp = true;
+
return 0;
}

--
2.43.5



Return-Path: <linux-kernel+bounces-675944-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CBED841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:36:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 6BFD3189ED24
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:36:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B877F28A3EF;
Fri, 6 Jun 2025 15:35:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="m98Cz9AF"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 346E728A1DD
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224104; cv=none; b=j6bLt1y/LYMgx1ggy8C9bxd6DB5dayOOR/vmGgLzJAC2YoGdVPwdyoHTovEl/+MvCcGVV2fxzA8O335fgXoj9OiRjQe8nvi/oiIa0W2gDYeEbgF9q0cbjVM5M+v3c7nWWe2RYtw9Ip9g21q+3GZTUpn1uK/9Zb0xSThPrdRHcBE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224104; c=relaxed/simple;
bh=rh2rppaKF/ghsqA+OyEMxeQOq2p9iJlfrX8v9ArZL3g=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=TXy292uTXggc9nNV+ZSUJTCKhdzdORa/qLUKsbtilKfvxGOQCMa/HkENO9c3xiwbBRp/oXpw37f0aWDq6v679kituxirt8Lwlh1vi9c9VLSQxLbMTLGXiF/77EsLEhj9YUd0w4GF2xsAneBHUZ1bZHjWg9NpQVkKvy3TBXKxgmQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=m98Cz9AF; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0333520.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MXVq002110;
Fri, 6 Jun 2025 15:34:58 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=ShrFy
nUlxGk8nWVeIgPchPdYzOw/hadrawBr7I8U5Rs=; b=m98Cz9AFnrjZpLdCSlPDb
Mo0nLDlA9E/XgsSyG2XQ1KNZHFVR5Duqp5zm3JZKS3uR0rmhckig7a3+Ocz5qm++
ooIaUl4xidiCj+WnoUn/aHu704mooo1fVvRZAMimgmPn8PoPm8jmzbxy8+oETB4D
Zw2x8xRzNxsH18of613KuoL7ieltyu8TGXiQ90Gs1o1x2TNr683B+znaoIWm0wbF
Eneaw7ypOjMU3vesspaX+n5Tv0vhEC53Z4dGi+1ktSutx63/MkkgyqvBLMpSmG+M
lNoBhV3OVWWsPjoNKZ52EeQjifa+iES13mpupX0Cb/UVtpkTfZ/G4VzlSuwKlLMq
g==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gahgafv-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:57 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556EZ1PY038505;
Fri, 6 Jun 2025 15:34:57 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7desav-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:34:56 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3p015517;
Fri, 6 Jun 2025 15:34:56 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-7;
Fri, 06 Jun 2025 15:34:56 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 06/13] objtool: Disassemble instruction on warning or backtrace
Date: Fri, 6 Jun 2025 17:34:33 +0200
Message-ID: <20250606153440.865808-7-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=aqqyCTZV c=1 sm=1 tr=0 ts=68430aa2 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=49cdYLv4DVxkACFpF8YA:9
X-Proofpoint-GUID: 8eFwyzk2SNiDdwO87Tl6ExPQVgbfTpQP
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX+PcvDh66Ll5F q/s0sQbFKi/PKr6MZZf6FxM8OG0OOsjxyyTqKxczBb5AnoDX5dA2l6ZobKEqFExVLPYe5LKF9s+ 2WNKDEcW7/77tfjTgZgyfLI5TtxPowgl41kuURhc9yq0aO2SplOY5HfeoXjaeaRAcuR2UvsP1a4
m7ZE/IADqaI7ZY9gtd7KvsqL45V3HWtTak/XFPAVGNbZGmJUjG4oitsIvg3c1H7O2KYxVPZyHec xAulE36toVZm5hTi4LSsJObWd2nzHknroKC6Dk4aPqjgYKcykKIzLTCz3VeMJnDYACfA3MjzJ8g msd9PCcbPrnvE15Amx9QYVOk+k+ahbHWOZiTzM0HqpBH8Ldrk+gCxF4+fLD01yEliY3Mh27k5/U
8MHflJ0qb1vXSEo86RFGznaGsvkPBvHFPgpHl3gc/NXCzJWxV211M2d8jufONegwa6GfPW1a
X-Proofpoint-ORIG-GUID: 8eFwyzk2SNiDdwO87Tl6ExPQVgbfTpQP
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

When an instruction warning (WARN_INSN) or backtrace (BT_INSN) is issued,
disassemble the instruction to provide more context.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/check.c | 30 +++++++++++++++++++++++--
tools/objtool/disas.c | 5 ++---
tools/objtool/include/objtool/check.h | 12 ++++++++++
tools/objtool/include/objtool/objtool.h | 9 --------
tools/objtool/include/objtool/warn.h | 14 ++++++++----
5 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index ee613f03e57d..2c73c8d3515d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4580,11 +4580,34 @@ static void free_insns(struct objtool_file *file)
free(chunk->addr);
}

+static struct disas_context *objtool_disas_ctx;
+
+const char *objtool_disas_insn(struct instruction *insn)
+{
+ struct disas_context *dctx = objtool_disas_ctx;
+
+ if (!dctx)
+ return "";
+
+ disas_insn(dctx, insn);
+ return disas_result(dctx);
+}
+
int check(struct objtool_file *file)
{
- struct disas_context *disas_ctx;
+ struct disas_context *disas_ctx = NULL;
int ret = 0, warnings = 0;

+ /*
+ * If the verbose or backtrace option is used then we need a
+ * disassembly context to disassemble instruction or function
+ * on warning or backtrace.
+ */
+ if (opts.verbose || opts.backtrace) {
+ disas_ctx = disas_context_create(file);
+ objtool_disas_ctx = disas_ctx;
+ }
+
arch_initial_func_cfi_state(&initial_func_cfi);
init_cfi_state(&init_cfi);
init_cfi_state(&func_cfi);
@@ -4710,9 +4733,12 @@ int check(struct objtool_file *file)
if (opts.werror && warnings)
WARN("%d warning(s) upgraded to errors", warnings);
print_args();
- disas_ctx = disas_context_create(file);
disas_warned_funcs(disas_ctx);
+ }
+
+ if (disas_ctx) {
disas_context_destroy(disas_ctx);
+ objtool_disas_ctx = NULL;
}

free_insns(file);
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index f86b9b04ef97..1e198d5f9205 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -348,7 +348,7 @@ void disas_context_destroy(struct disas_context *dctx)
free(dctx);
}

-static char *disas_result(struct disas_context *dctx)
+char *disas_result(struct disas_context *dctx)
{
return dbuffer_data(&dctx->result);
}
@@ -356,8 +356,7 @@ static char *disas_result(struct disas_context *dctx)
/*
* Disassemble a single instruction. Return the size of the instruction.
*/
-static size_t disas_insn(struct disas_context *dctx,
- struct instruction *insn)
+size_t disas_insn(struct disas_context *dctx, struct instruction *insn)
{
disassembler_ftype disasm = dctx->disassembler;
struct disassemble_info *dinfo = &dctx->info;
diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/objtool/check.h
index 4adbcd760c6f..92bfe6b209ad 100644
--- a/tools/objtool/include/objtool/check.h
+++ b/tools/objtool/include/objtool/check.h
@@ -139,4 +139,16 @@ struct instruction *next_insn_same_sec(struct objtool_file *file, struct instruc
insn && insn->offset < sym->offset + sym->len; \
insn = next_insn_same_sec(file, insn))

+struct disas_context;
+struct disassemble_info;
+struct disas_context *disas_context_create(struct objtool_file *file);
+void disas_context_destroy(struct disas_context *dctx);
+void disas_warned_funcs(struct disas_context *dctx);
+int disas_info_init(struct disassemble_info *dinfo,
+ int arch, int mach32, int mach64,
+ const char *options);
+size_t disas_insn(struct disas_context *dctx, struct instruction *insn);
+char *disas_result(struct disas_context *dctx);
+const char *objtool_disas_insn(struct instruction *insn);
+
#endif /* _CHECK_H */
diff --git a/tools/objtool/include/objtool/objtool.h b/tools/objtool/include/objtool/objtool.h
index 0b404cfd81c0..c0dc86a78ff6 100644
--- a/tools/objtool/include/objtool/objtool.h
+++ b/tools/objtool/include/objtool/objtool.h
@@ -47,13 +47,4 @@ int check(struct objtool_file *file);
int orc_dump(const char *objname);
int orc_create(struct objtool_file *file);

-struct disas_context;
-struct disassemble_info;
-struct disas_context *disas_context_create(struct objtool_file *file);
-void disas_context_destroy(struct disas_context *dctx);
-void disas_warned_funcs(struct disas_context *dctx);
-int disas_info_init(struct disassemble_info *dinfo,
- int arch, int mach32, int mach64,
- const char *options);
-
#endif /* _OBJTOOL_H */
diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h
index cb8fe846d9dd..32a8dd299c87 100644
--- a/tools/objtool/include/objtool/warn.h
+++ b/tools/objtool/include/objtool/warn.h
@@ -77,9 +77,11 @@ static inline char *offstr(struct section *sec, unsigned long offset)
#define WARN_INSN(insn, format, ...) \
({ \
struct instruction *_insn = (insn); \
- if (!_insn->sym || !_insn->sym->warned) \
+ if (!_insn->sym || !_insn->sym->warned) { \
WARN_FUNC(_insn->sec, _insn->offset, format, \
##__VA_ARGS__); \
+ BT_INSN(_insn, ""); \
+ } \
if (_insn->sym) \
_insn->sym->warned = 1; \
})
@@ -87,9 +89,13 @@ static inline char *offstr(struct section *sec, unsigned long offset)
#define BT_INSN(insn, format, ...) \
({ \
if (opts.verbose || opts.backtrace) { \
- struct instruction *_insn = (insn); \
- char *_str = offstr(_insn->sec, _insn->offset); \
- WARN(" %s: " format, _str, ##__VA_ARGS__); \
+ struct instruction *__insn = (insn); \
+ char *_str = offstr(__insn->sec, __insn->offset); \
+ const char *_istr = objtool_disas_insn(__insn); \
+ int len; \
+ len = snprintf(NULL, 0, " %s: " format, _str, ##__VA_ARGS__); \
+ len = (len < 50) ? 50 - len : 0; \
+ WARN(" %s: " format " %*s%s", _str, ##__VA_ARGS__, len, "", _istr); \
free(_str); \
} \
})
--
2.43.5



Return-Path: <linux-kernel+bounces-675946-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 478D741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:37:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id A042A189E6D8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:36:40 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 30DB228A701;
Fri, 6 Jun 2025 15:35:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="kszUSr7b"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 EE2C928A40C
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224108; cv=none; b=Ur34ta/MgVArfJcVl3qZk08ZlxfQzGjfeMj+39YdfBXEnrs+PjzNPKLhifZTgbR/BBVv7WMeI8xgOAibE8EAli+IwWXY2mKsOuaWWanxxQQOY21DBL4ExeH+qVNb2SCNXRi18GLi+VwQQMYB2UBHVcIHi2CZiC3XNRen/7sZX2Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224108; c=relaxed/simple;
bh=wf45yRpEwq5KiZcDz36ZHOLG9XlM2tWNLMFFlF385kY=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=UtmER+rwgaOmXDwjN317Kyq7pTci6fb1miOdiwV59R8zfzcT6JuWk36Z9UmXjbNvtluaBuvSO55DY6f1avdWhkx3TQ+R9BboObttpcsLJ1gL92YqrQV3H/FflUbLPpchF3ixFlwEjZuth5Dm6/lwnZXtPf0Pf4DFKw6HcB7XfDs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=kszUSr7b; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0333520.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MWAb002101;
Fri, 6 Jun 2025 15:35:02 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=G4+f+
x8WW0xnNhwauAPhEewB+fqNtqeekRCjKKOKkv8=; b=kszUSr7bMRY1tjD/kw/6L
FEyttZn5jB/KBErkPqj3XxhWZmyZPDx5wlQIQaj4jLUgY7pJz2hV0vlss1OE379a
TgHQeaNJ+THaH97blIEuwoCHX/SDgKFzcdYEH0R1sUln7P5CQ3Wnct8+bRpSaOfw
NspDdC/cyQ2ATfNdOrGtqhi3+pfdcGTM+PXifkdPX7jwwcFYC2QH1/J1OGBvvGBS
VTqoARwIOCmOn8bVNszQ7Us/6AzKEzBRutmKpVwTG9vDq46dshbO/2Ynoc+017s8
e6CoN7+U1CkScCPcERobjWZn53c5ac87YhIvFhUZTbEPBKWDoyKqS/4jvY+E6zx5
g==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gahgag7-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:02 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556EGXHo039442;
Fri, 6 Jun 2025 15:35:01 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7desdx-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:01 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3t015517;
Fri, 6 Jun 2025 15:35:00 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-9;
Fri, 06 Jun 2025 15:35:00 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 08/13] objtool: Record symbol name max length
Date: Fri, 6 Jun 2025 17:34:35 +0200
Message-ID: <20250606153440.865808-9-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=aqqyCTZV c=1 sm=1 tr=0 ts=68430aa6 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=xKpiAcmDGk3KfUQPlkUA:9
X-Proofpoint-GUID: e1aT2PFvLXcXI2pJ_4RM6K48iuejL4A3
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX6A6eS7NrWZgb 60CsbyU2+rrEjaUBDPy5cN1GzVJOsciSu9P3vBHYZznFcgcCTcGtJqecppGn+UmB5ym5maIVYhA Tf9RdcAbqecxJvnmwlLofoSFUW58lExHA8uGDMLn6Ess4ssMQHqJidu/Bz/JWJ1KhS8DoqA54eG
wn0LyjtJdlblg9mBR5jTmgClhhVoZuvY0wBIiBHRIs12odcaBEbksuWaz1uSYE3ft4MCxN5gbI0 P/CeEoFKeOXtElOrhwowCLHuH73ovwEnbFbT5XacvyLDwxCxRzh9wrBKA3ZeV29knryZFoi2iL2 6Z7OHT/XGhVBNcqGFAbnBndF+1HcpuKIaN0Z7Rxbz1gfR/aDZfRg5SEmHaw6kW9/6fJN3wIEqrN
rCnnyECd+t/ritPyFRnCngyUVZBaHok8WrlrIqu1SIeb7C0vdIPz4Z2/sjmoPGU7nmwtnajw
X-Proofpoint-ORIG-GUID: e1aT2PFvLXcXI2pJ_4RM6K48iuejL4A3
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Keep track of the maximum length of symbol names. This will help
formatting the code flow between different functions.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/check.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 36ec08b8d654..300428cb5c2c 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -34,6 +34,8 @@ static struct cfi_state init_cfi;
static struct cfi_state func_cfi;
static struct cfi_state force_undefined_cfi;

+static size_t sym_name_max_len;
+
struct instruction *find_insn(struct objtool_file *file,
struct section *sec, unsigned long offset)
{
@@ -2458,6 +2460,7 @@ static bool is_profiling_func(const char *name)
static int classify_symbols(struct objtool_file *file)
{
struct symbol *func;
+ size_t len;

for_each_sym(file, func) {
if (func->type == STT_NOTYPE && strstarts(func->name, ".L"))
@@ -2484,6 +2487,10 @@ static int classify_symbols(struct objtool_file *file)

if (is_profiling_func(func->name))
func->profiling_func = true;
+
+ len = strlen(func->name);
+ if (len > sym_name_max_len)
+ sym_name_max_len = len;
}

return 0;
--
2.43.5



Return-Path: <linux-kernel+bounces-675949-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id EA40441E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:37:02 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2ECC2175DA6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:37:00 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id F33AB28AB0C;
Fri, 6 Jun 2025 15:35:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="GFo1JNNt"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 8DE7F28A735
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224115; cv=none; b=fPex5TxCl2P9EleU47yARBu5ycfYMfTaE/BvHYBuKIKA20554i7vhie8yvH/xLE2XA1hG9UizdOMKfnBBR+dzcsbKcPGC87a3vFFyd99MH6r5ojpIlAEW1Nsp1GQ1+HyJSiNj/ZkyDgDFYsGcy8n48dAzet181dnhzEZbZzUgGQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224115; c=relaxed/simple;
bh=dgMNb7nu3lnJ+1jnVGA/ngCPVqkJTEXfIFpETz3HFyU=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=IOv7I2WI5bL0kspui8/s6matib0/6lM3YN0Goaoc8Ld38GKkdpFdgwgOSsnJHLAnVdlx0oQXdCKVXxeNM4TxPbnmaEuOHMf2oDZ08CXNpNHH/62Y9DC8TcOzmy6R1OdfIBPjeqq0qOriJI3C4ET7c7JUw3zYwH6V9koDbev4/C4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=GFo1JNNt; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246631.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MZft030080;
Fri, 6 Jun 2025 15:35:09 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=wIqqo
/7E2WJ8UlpKCwyClHDZQx7NjCfXE9MZI+8M53M=; b=GFo1JNNtU8DtfYiVqw71F
GVJs007b+7kddzy9+pF+Igyfd7kHea+kQUpCBTuUjj88mBg3c12FBFucGiNud4Px
ywthMtvLnKBvU4/IjvXGUgFP2KBtXFvgfeBkxq6XaUigxWHHa+35FF3hGZMO1P7X
9qlBab6jYvRjsb7/CroZiLn4k7IeAkA3S0ibpWIJ2saK6K3w71CyIlT5UuVrqmPw
p8ygOdbmxIdocsKgmay8UhrFPyIySLYVM8qZd7/ARXK1KM07CKKecmgff4Y1cbTM
Af6ZQH6AxMdOeZm66u8bKDWxdz34DmnEjCPBK8KvHzgm0TF1LAp1k4eeHolqupgC
w==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8e087g-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:08 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556Eshsx039288;
Fri, 6 Jun 2025 15:35:07 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7desjb-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:07 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh41015517;
Fri, 6 Jun 2025 15:35:07 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-12;
Fri, 06 Jun 2025 15:35:07 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 11/13] objtool: Improve register reporting during function validation
Date: Fri, 6 Jun 2025 17:34:38 +0200
Message-ID: <20250606153440.865808-12-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=Va/3PEp9 c=1 sm=1 tr=0 ts=68430aac cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=CogidulLUEdmuW3A26oA:9
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfXx4CU7yTzBV5J maLSzd0flFMTqFuNXLqsGgkZYy3K/gQnIe4/j4QQFSDiOw0TKRW++6DYa9bsDcWN1ZKsmxKI7uV RF1Y3J/zQj/0JrwN8HFuRa4kyBamXZUNnFTTzIr/Gnoj3i7wcYBniD5xnWItUHZFYL8ORMFe8DW
C8moURtp9W9sAdgg7PtbhATnEQ7uyry+cOa44J4zBLdI9Bal+PTNTSx+PpWqRWqi6FZKwpR/4Vt dRJyUaM2NMmgOLIIqSbWykmHb+nGzIK8SRpIFrTtpnE3n1Ij+RF7Mw+v+Ec8oHFaXh0z62WYT1I AwFz0F3VTflDo5iIylzFDz+LYMWLVdqVefplagVRIEY9ntve0bA8elM3FC3o4BBZ/AkB2o4g2sb
e2zGsCV95MCoc2DrHd/GGp/JRl9Ru3C0F3aFYKQEoSlnEO6oKrPiuSvJrU5UBV/KxRxqKbxl
X-Proofpoint-ORIG-GUID: 3210MFP6L7sjBEL_xe6PHwdRWL07PmeV
X-Proofpoint-GUID: 3210MFP6L7sjBEL_xe6PHwdRWL07PmeV
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

When tracing function validation, instruction state changes can
report changes involving registers. These registers are reported
with the name "r<num>" (e.g. "r3"). Print the CPU specific register
name instead of a generic name (e.g. print "rbx" instead of "r3"
on x86).

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/arch/loongarch/decode.c | 11 +++++++++++
tools/objtool/arch/powerpc/decode.c | 12 ++++++++++++
tools/objtool/arch/x86/decode.c | 8 ++++++++
tools/objtool/disas.c | 7 +++++++
tools/objtool/include/objtool/arch.h | 2 ++
5 files changed, 40 insertions(+)

diff --git a/tools/objtool/arch/loongarch/decode.c b/tools/objtool/arch/loongarch/decode.c
index bf5ac6750512..fbad237e54fb 100644
--- a/tools/objtool/arch/loongarch/decode.c
+++ b/tools/objtool/arch/loongarch/decode.c
@@ -7,6 +7,17 @@
#include <linux/objtool_types.h>
#include <arch/elf.h>

+const char *arch_reg_name[CFI_NUM_REGS] = {
+ "zero", "ra", "tp", "sp",
+ "a0", "a1", "a2", "a3",
+ "a4", "a5", "a6", "a7",
+ "t0", "t1", "t2", "t3",
+ "t4", "t5", "t6", "t7",
+ "t8", "u0", "fp", "s0",
+ "s1", "s2", "s3", "s4",
+ "s5", "s6", "s7", "s8"
+};
+
int arch_ftrace_match(char *name)
{
return !strcmp(name, "_mcount");
diff --git a/tools/objtool/arch/powerpc/decode.c b/tools/objtool/arch/powerpc/decode.c
index c0fcab2d643c..df5bf6476b78 100644
--- a/tools/objtool/arch/powerpc/decode.c
+++ b/tools/objtool/arch/powerpc/decode.c
@@ -9,6 +9,18 @@
#include <objtool/builtin.h>
#include <objtool/endianness.h>

+const char *arch_reg_name[CFI_NUM_REGS] = {
+ "r0", "sp", "r2", "r3",
+ "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19",
+ "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27",
+ "r28", "r29", "r30", "r31",
+ "ra"
+};
+
int arch_ftrace_match(char *name)
{
return !strcmp(name, "_mcount");
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 6c13c67ed9b9..56e2df35c9ee 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -23,6 +23,14 @@
#include <objtool/builtin.h>
#include <arch/elf.h>

+const char *arch_reg_name[CFI_NUM_REGS] = {
+ "rax", "rcx", "rdx", "rbx",
+ "rsp", "rbp", "rsi", "rdi",
+ "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
+ "ra"
+};
+
int arch_ftrace_match(char *name)
{
return !strcmp(name, "__fentry__");
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index 4326c608f925..8265ad7479a3 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -38,6 +38,7 @@ struct disas_context {
const char *register_name(unsigned int reg)
{
static char rname_buffer[REGISTER_NAME_MAXLEN];
+ const char *rname;

switch (reg) {
case CFI_UNDEFINED:
@@ -50,6 +51,12 @@ const char *register_name(unsigned int reg)
return "(bp)";
}

+ if (reg < CFI_NUM_REGS) {
+ rname = arch_reg_name[reg];
+ if (rname)
+ return rname;
+ }
+
if (snprintf(rname_buffer, REGISTER_NAME_MAXLEN, "r%d", reg) == 1)
return NULL;

diff --git a/tools/objtool/include/objtool/arch.h b/tools/objtool/include/objtool/arch.h
index aecf8fc29571..4736b08805d6 100644
--- a/tools/objtool/include/objtool/arch.h
+++ b/tools/objtool/include/objtool/arch.h
@@ -106,4 +106,6 @@ unsigned long arch_jump_table_sym_offset(struct reloc *reloc, struct reloc *tabl

int arch_disas_info_init(struct disassemble_info *dinfo);

+extern const char *arch_reg_name[CFI_NUM_REGS];
+
#endif /* _ARCH_H */
--
2.43.5



Return-Path: <linux-kernel+bounces-675948-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AFF7641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:37:21 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6DEF03A37D8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:36:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B2E4F28AAE3;
Fri, 6 Jun 2025 15:35:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="RYIBqSxz"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 EF9B028A72F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224113; cv=none; b=j9nMO8B2qy5NfrDHABEr2XagbseJrYSAv3iU/w16XqO0Vy6Y47D2PgOx1oW2gxEMZz2MEBT6L7c3aAj9Q5D2VeUMWzNUonXJnl6PejCV77kY6CsE+7zGT/2IrXv8H5imsEaRyVKp/ldK4pzwTGMEvRMsWjl6CjDl0c24UnXB/Ss=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224113; c=relaxed/simple;
bh=6Bblu348mo32rRnTruCxD/P6AYHqPJFxK0tzVbRIe7s=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=GHp6UX0pEQY0jkmU9Jlb4kIAvFQUu+hvvFWjy+vo2ZZMMkqkjJH5y94zkuuYXdvOlKtx5M5YNq6qzFCvo2qKkP5VXgRGxbEcj2TVVsQIcqDakDBhe0GQ3MVzjVTNcWEcQ7eVGCwoIX94accslc9TyuOZ9iaQuLv3e+dtLQF1tyI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=RYIBqSxz; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246631.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565Mteq030195;
Fri, 6 Jun 2025 15:35:07 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=PRLnR
8PU0PfWjOaw1qk46DtX5R6mdIBS8buVTSqwDxU=; b=RYIBqSxzY+j3oar7pl0RC
4lRqM5nBXUk1kAyHl0wQC7JbZMyzmYXETqkmYZI0l3nYaJpdP2WYbiECI+gMNq4t
euifI7v0QXs8CbR4gR/1Yli9Q42x9wXIdHx13/CMHvXJgfCgwPOEOsNRcg/UD8gQ
DtwvlOdEJSmy1vA5tGa2romPG7D/2tkyrf+nlkVjHRpZlryBq1B5+zhKhv6jjMQi
BFWCLv8M0aEoA3/diDMvp2SVwLq+ZjTsk7uO0Y519bLAH4frveCfKNSjAlv3lwZa
409rzqx+UzJEBBtXtvl9TzaAoIgEjitBlKxlK0T2MkIfB1dlCD+tgOqMFEozW5th
w==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8e087e-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:06 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556DjJJ7038525;
Fri, 6 Jun 2025 15:35:05 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7desgr-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:05 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3x015517;
Fri, 6 Jun 2025 15:35:05 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-11;
Fri, 06 Jun 2025 15:35:04 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 10/13] objtool: Trace instruction state changes during function validation
Date: Fri, 6 Jun 2025 17:34:37 +0200
Message-ID: <20250606153440.865808-11-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=Va/3PEp9 c=1 sm=1 tr=0 ts=68430aaa cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=drXov0Ccr8RUBnCnCHQA:9
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX0lIbybLshXxO 8K+nYizUUJa+/RXVOuQ+h079xxlHuR/y4Wb2WXS4ymUWaq6MwPPgZFt/Exj9u3PsLDXEyp+azhW CATo102vv713ToX5qYCbl5FSowG2dMpPiIvHz5IW8LCCY9GZj8ncg3ovjdCiL4kBhMdmP20nfm8
j8pWqWUgZt5q5WFerKDxFxJASzGxteY0RQpQBBmmRXCOPizD6kXQBDkM6Z01o2PKEMdYysLXhOt nF5mwB3ETsAXVOS97PbgbPbvltLKrrQ+AUOnkJuZ1gmtzUox8J51Shl7GFu1ZCWf0YmbrmUkwun k9MzLT+aM0zfh2B1hTLaiUHAe0CuYahcdkJ3gZqhQCVX6nJpOF1w9OcOozu4n8fQjmMh+BjkY3s
JISQlu5OKdr/tNQFoZ5UNVWtQqVWpj0e3rL5hi+AHmf67RJDe+pbXjdDtLEa++YRJjvdBDNq
X-Proofpoint-ORIG-GUID: 8sEli5ux3Vc1FmUomLOlD7wxC05mPr-4
X-Proofpoint-GUID: 8sEli5ux3Vc1FmUomLOlD7wxC05mPr-4
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

During function validation, objtool maintains a per-instruction state,
in particular to track call frame information. When tracing validation,
print any instruction state changes.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/check.c | 116 +++++++++++++++++++++++++-
tools/objtool/disas.c | 27 ++++++
tools/objtool/include/objtool/check.h | 1 +
3 files changed, 143 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 40eaac4b5756..050d34930372 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -111,6 +111,111 @@ static void vtrace_insn(struct instruction *insn, const char *format, ...)
free((char *)addr_str);
}

+/*
+ * Macros to trace CFI state attributes changes.
+ */
+
+#define VTRACE_CFI_ATTR(attr, prev, next, fmt, ...) \
+ do { \
+ if ((prev)->attr != (next)->attr) \
+ VTRACE_PRINTF("%s=" fmt " ", #attr, __VA_ARGS__); \
+ } while (0)
+
+#define VTRACE_CFI_ATTR_BOOL(attr, prev, next) \
+ VTRACE_CFI_ATTR(attr, prev, next, \
+ "%s", (next)->attr ? "true" : "false")
+
+#define VTRACE_CFI_ATTR_NUM(attr, prev, next, fmt) \
+ VTRACE_CFI_ATTR(attr, prev, next, fmt, (next)->attr)
+
+/*
+ * Functions and macros to trace CFI registers changes.
+ */
+
+static void vtrace_cfi_register(const char *prefix, int reg, const char *fmt,
+ int base_prev, int offset_prev,
+ int base_next, int offset_next)
+{
+ const char *rname;
+
+ if (base_prev == base_next && offset_prev == offset_next)
+ return;
+
+ if (prefix)
+ VTRACE_PRINTF("%s:", prefix);
+
+ rname = register_name(reg);
+
+ if (base_next == CFI_UNDEFINED) {
+ VTRACE_PRINTF("%1$s=<undef> ", rname);
+ } else {
+ VTRACE_PRINTF(fmt, rname,
+ register_name(base_next), offset_next);
+ }
+}
+
+static void vtrace_cfi_reg_value(const char *prefix, int reg,
+ int base_prev, int offset_prev,
+ int base_next, int offset_next)
+{
+ vtrace_cfi_register(prefix, reg, "%1$s=%2$s%3$+d ",
+ base_prev, offset_prev, base_next, offset_next);
+}
+
+static void vtrace_cfi_reg_reference(const char *prefix, int reg,
+ int base_prev, int offset_prev,
+ int base_next, int offset_next)
+{
+ vtrace_cfi_register(prefix, reg, "%1$s=(%2$s%3$+d) ",
+ base_prev, offset_prev, base_next, offset_next);
+}
+
+#define VTRACE_CFI_REG_VAL(reg, prev, next) \
+ vtrace_cfi_reg_value(NULL, reg, prev.base, prev.offset, \
+ next.base, next.offset)
+
+#define VTRACE_CFI_REG_REF(reg, prev, next) \
+ vtrace_cfi_reg_reference(NULL, reg, prev.base, prev.offset, \
+ next.base, next.offset)
+
+static void vtrace_insn_state(struct instruction *insn,
+ struct insn_state *sprev,
+ struct insn_state *snext)
+{
+ struct cfi_state *cprev, *cnext;
+ int i;
+
+ if (memcmp(sprev, snext, sizeof(struct insn_state)) == 0)
+ return;
+
+ cprev = &sprev->cfi;
+ cnext = &snext->cfi;
+
+ vtrace_insn(insn, NULL);
+ VTRACE_PRINTF(" - state: ");
+
+ /* print registers changes */
+ VTRACE_CFI_REG_VAL(CFI_CFA, cprev->cfa, cnext->cfa);
+ for (i = 0; i < CFI_NUM_REGS; i++) {
+ VTRACE_CFI_REG_VAL(i, cprev->vals[i], cnext->vals[i]);
+ VTRACE_CFI_REG_REF(i, cprev->regs[i], cnext->regs[i]);
+ }
+
+ /* print attributes changes */
+ VTRACE_CFI_ATTR_NUM(stack_size, cprev, cnext, "%d");
+ VTRACE_CFI_ATTR_BOOL(drap, cprev, cnext);
+ if (cnext->drap) {
+ vtrace_cfi_reg_value("drap", cnext->drap_reg,
+ cprev->drap_reg, cprev->drap_offset,
+ cnext->drap_reg, cnext->drap_offset);
+ }
+ VTRACE_CFI_ATTR_BOOL(bp_scratch, cprev, cnext);
+ VTRACE_CFI_ATTR_NUM(instr, sprev, snext, "%d");
+ VTRACE_CFI_ATTR_NUM(uaccess_stack, sprev, snext, "%u");
+
+ VTRACE_PRINTF("\n");
+}
+
struct instruction *find_insn(struct objtool_file *file,
struct section *sec, unsigned long offset)
{
@@ -3698,6 +3803,7 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
struct instruction *prev_insn, struct instruction *next_insn,
bool *validate_nextp)
{
+ struct insn_state state_prev;
struct alternative *alt;
u8 visited;
int ret;
@@ -3814,7 +3920,15 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
if (skip_alt_group(insn))
return 0;

- if (handle_insn_ops(insn, next_insn, statep))
+ if (vtrace)
+ state_prev = *statep;
+
+ ret = handle_insn_ops(insn, next_insn, statep);
+
+ if (vtrace)
+ vtrace_insn_state(insn, &state_prev, statep);
+
+ if (ret)
return 1;

switch (insn->type) {
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index 1e198d5f9205..4326c608f925 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -29,6 +29,33 @@ struct disas_context {
((*(dinfo)->fprintf_func)((dinfo)->stream, __VA_ARGS__))


+#define REGISTER_NAME_MAXLEN 16
+
+/*
+ * Return the name of a register. Note that the same static buffer
+ * is returned if the name is dynamically generated.
+ */
+const char *register_name(unsigned int reg)
+{
+ static char rname_buffer[REGISTER_NAME_MAXLEN];
+
+ switch (reg) {
+ case CFI_UNDEFINED:
+ return "<undefined>";
+ case CFI_CFA:
+ return "cfa";
+ case CFI_SP_INDIRECT:
+ return "(sp)";
+ case CFI_BP_INDIRECT:
+ return "(bp)";
+ }
+
+ if (snprintf(rname_buffer, REGISTER_NAME_MAXLEN, "r%d", reg) == 1)
+ return NULL;
+
+ return (const char *)rname_buffer;
+}
+
static int dbuffer_init(struct dbuffer *dbuf, size_t size)
{
dbuf->used = 0;
diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/objtool/check.h
index 1b9b399578ea..137d20963921 100644
--- a/tools/objtool/include/objtool/check.h
+++ b/tools/objtool/include/objtool/check.h
@@ -152,5 +152,6 @@ int disas_info_init(struct disassemble_info *dinfo,
size_t disas_insn(struct disas_context *dctx, struct instruction *insn);
char *disas_result(struct disas_context *dctx);
const char *objtool_disas_insn(struct instruction *insn);
+const char *register_name(unsigned int reg);

#endif /* _CHECK_H */
--
2.43.5



Return-Path: <linux-kernel+bounces-675947-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E6B2341E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:37:21 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id DBB21189E561
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:36:57 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 00DFF28A73F;
Fri, 6 Jun 2025 15:35:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="i8xOlKOt"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 D56E528A712
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224111; cv=none; b=NoQIGCBfZoooJPEXeZlnD+kWebR1CZ89yKf7IIKzoNiMmE5s8kWhp73gkAesf0ENEd2q2tW3Llsnm56vOmWs1joaS/6pELIwPN690CaQ8lBy5Z3+fO5dQbqJ2jyfDVbF4DwK96rs0Bl26zlnaZEEo+tmt49B9hkh7ZpLlWCPpJY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224111; c=relaxed/simple;
bh=5VRcBlwWdFrzBO1gZwxKYh3RHAZZunOUilG2FYKP2c4=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=Ak5H53mcFD42iU9/ZT01Tuaj56vEao7gge/Z5cKR+RwnI3wrpd+Sjsku/QL3HuhZjDSwItKaQDZMPS8pWtZ50Twu/Q/e9DelfqxOMdMfHZGsRCV4GzyafPuPFy9GQ5639xoVwTJXowSsBr/0JtZsG4q9m3SxORq3in2p4ZN+DGI=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=i8xOlKOt; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0333520.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565Nd0Y003840;
Fri, 6 Jun 2025 15:35:04 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=YQ4u7
YKzX0ON4oY/CU35826hOt/DbKIXfUFaOcdRH9g=; b=i8xOlKOtf9J/Rpww/lM5E
3HRmuqahlkgBPdYQE7Yajd+diJN/NVxjR0uAQjgUBmnAM08tt9kYHqzX24dEjVYF
OmDkp7uRLUASr8Lkd31WWDknF3sv/4Y9k40sLZmwEwUjMKQ3nH7I+s4sM3xgFSl/
EcVlVnrNumOC25p4idX+yEcs0lHefFozeF/oqCNa+sytUYs/qgce30yvvwsDeLsY
gcBjEa8yAzJzJ3WsJahaP6UutMrx1l+SnL510SteP/npVtUb2RfJUqB3WbD0tYAD
htKPh4hqljZIkoIqtiHFCOfPMyow2qVdrQLh6yJ1TeubqSMdGm2yFm7AdQ5Y8ZKa
A==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gahgaga-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:04 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556EHAmA038592;
Fri, 6 Jun 2025 15:35:03 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7desfe-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:03 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh3v015517;
Fri, 6 Jun 2025 15:35:03 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-10;
Fri, 06 Jun 2025 15:35:02 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 09/13] objtool: Add option to trace function validation
Date: Fri, 6 Jun 2025 17:34:36 +0200
Message-ID: <20250606153440.865808-10-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=aqqyCTZV c=1 sm=1 tr=0 ts=68430aa8 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=20KFwNOVAAAA:8 a=6m_oaggMU0vmvekz6BQA:9
X-Proofpoint-GUID: qjQK7fmGsMVNBOSqSRIFg3gtUi0qjT1L
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX6xXqnDS0xO71 680QuWOVuAck64FUgH1Odil07pCEyxpipkdRC9xd2Jrvp0ApMyUVZCAAUu+qMTI/7+bvpQubUEN BDdHCFOjj+2rw7qiu+EHdHgIjoHFYA0pN0+auX74UyQWBggtwJPdOLx3524r9VRiPZM/sEdhrtD
xYzauWMqbab/DMLo2M/I0TVDfuzLKlHLz1aludKJofZmy6Uv05mTBPTb3VYa7xSZrp48tP0jKll T0zTKn/CPVOcdeck7x/lE/JrrwvWC0H+OsKMsMsnJp8ZNhZGjhmD8pagQ7gIAJDLLkul8tACCzk 0NMOaKNn+RoWTF2c8vu/JOz63CSXBB+IS/ZXCNKS79WMJDzHm8m8ehPppWxOGUAWhkHXX5xJq5p
RF3t9xpt8JPSDZp+zTWHB+ddwVq5Bg602Y3VonnE6WhtrK9ZmmTz4vKtk45MlYIjMvxrRvrK
X-Proofpoint-ORIG-GUID: qjQK7fmGsMVNBOSqSRIFg3gtUi0qjT1L
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Add an option to trace and have information during the validation
of specified functions. Functions are specified with the --trace
option which can be a single function name (e.g. --trace foo to
trace the function with the name "foo"), or a shell wildcard
pattern (e.g. --trace foo* to trace all functions with a name
starting with "foo").

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/builtin-check.c | 1 +
tools/objtool/check.c | 179 ++++++++++++++++++++++--
tools/objtool/include/objtool/builtin.h | 1 +
tools/objtool/include/objtool/check.h | 2 +
tools/objtool/include/objtool/warn.h | 3 +-
5 files changed, 171 insertions(+), 15 deletions(-)

diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 80239843e9f0..ac7baf95f5bf 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -99,6 +99,7 @@ static const struct option check_options[] = {
OPT_STRING('o', "output", &opts.output, "file", "output file name"),
OPT_BOOLEAN(0, "sec-address", &opts.sec_address, "print section addresses in warnings"),
OPT_BOOLEAN(0, "stats", &opts.stats, "print statistics"),
+ OPT_STRING(0, "trace", &opts.trace, "func", "trace function validation"),
OPT_BOOLEAN('v', "verbose", &opts.verbose, "verbose warnings"),
OPT_BOOLEAN(0, "Werror", &opts.werror, "return error on warnings"),

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 300428cb5c2c..40eaac4b5756 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3,6 +3,7 @@
* Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
*/

+#include <fnmatch.h>
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>
@@ -36,6 +37,80 @@ static struct cfi_state force_undefined_cfi;

static size_t sym_name_max_len;

+static bool vtrace;
+static int vtrace_depth;
+
+/*
+ * Validation traces are sent to stderr so that they are output
+ * on the same flow as warnings.
+ */
+#define VTRACE_PRINTF(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
+
+#define VTRACE_INSN(insn, fmt, ...) \
+ do { \
+ if (vtrace) { \
+ vtrace_insn(insn, fmt, ##__VA_ARGS__); \
+ VTRACE_PRINTF("\n"); \
+ } \
+ } while (0)
+
+#define VTRACE_INSN_OFFSET_SPACE 10
+#define VTRACE_INSN_SPACE 60
+
+/*
+ * Print an instruction address (offset and function), the instruction itself
+ * and an optional message.
+ */
+static void vtrace_insn(struct instruction *insn, const char *format, ...)
+{
+ char fake_nop_insn[32];
+ const char *addr_str, *insn_str;
+ bool fake_nop;
+ va_list args;
+ int i, len;
+
+ len = sym_name_max_len + VTRACE_INSN_OFFSET_SPACE;
+
+ /*
+ * Alternative can insert a fake nop, sometimes with no
+ * associated section so nothing to disassemble.
+ */
+ fake_nop = (!insn->sec && insn->type == INSN_NOP);
+ if (fake_nop) {
+ addr_str = "";
+ snprintf(fake_nop_insn, 32, "<fake nop> (%d bytes)", insn->len);
+ insn_str = fake_nop_insn;
+ } else {
+ addr_str = offstr(insn->sec, insn->offset);
+ insn_str = objtool_disas_insn(insn);
+ }
+
+ /* print the instruction address */
+ VTRACE_PRINTF("%6lx: %-*s ", insn->offset, len, addr_str);
+
+ /* print vertical bars to show the validation flow */
+ for (i = 1; i < vtrace_depth; i++)
+ VTRACE_PRINTF("| ");
+
+ /* print the instruction */
+ len = vtrace_depth * 2 < VTRACE_INSN_SPACE ?
+ VTRACE_INSN_SPACE - vtrace_depth * 2 : 1;
+ VTRACE_PRINTF("%-*s", len, insn_str);
+
+ /* print message if any */
+ if (format) {
+ VTRACE_PRINTF(" - ");
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ }
+
+ insn->vtrace++;
+
+ if (!fake_nop)
+ free((char *)addr_str);
+}
+
struct instruction *find_insn(struct objtool_file *file,
struct section *sec, unsigned long offset)
{
@@ -3511,8 +3586,10 @@ static bool skip_alt_group(struct instruction *insn)
struct instruction *alt_insn = insn->alts ? insn->alts->insn : NULL;

/* ANNOTATE_IGNORE_ALTERNATIVE */
- if (insn->alt_group && insn->alt_group->ignore)
+ if (insn->alt_group && insn->alt_group->ignore) {
+ VTRACE_INSN(insn, "alt group ignored");
return true;
+ }

/*
* For NOP patched with CLAC/STAC, only follow the latter to avoid
@@ -3539,14 +3616,17 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
struct instruction *prev_insn, struct instruction *next_insn,
bool *validate_nextp);

+static int validate_branch(struct objtool_file *file, struct symbol *func,
+ struct instruction *insn, struct insn_state state);
+
/*
* Follow the branch starting at the given instruction, and recursively follow
* any other branches (jumps). Meanwhile, track the frame pointer state at
* each instruction and validate all the rules described in
* tools/objtool/Documentation/objtool.txt.
*/
-static int validate_branch(struct objtool_file *file, struct symbol *func,
- struct instruction *insn, struct insn_state state)
+static int do_validate_branch(struct objtool_file *file, struct symbol *func,
+ struct instruction *insn, struct insn_state state)
{
struct instruction *next_insn, *prev_insn = NULL;
struct section *sec;
@@ -3558,7 +3638,10 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,

sec = insn->sec;

- while (1) {
+ do {
+
+ insn->vtrace = 0;
+
next_insn = next_insn_to_validate(file, insn);

if (func && insn_func(insn) && func != insn_func(insn)->pfunc) {
@@ -3570,6 +3653,8 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
if (file->ignore_unreachables)
return 0;

+ VTRACE_INSN(insn, "falls through to next function");
+
WARN("%s() falls through to next function %s()",
func->name, insn_func(insn)->name);
func->warned = 1;
@@ -3580,10 +3665,8 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
ret = validate_insn(file, func, insn, &state,
prev_insn, next_insn,
&validate_next);
- if (!validate_next)
- break;

- if (!next_insn) {
+ if (validate_next && !next_insn) {
if (state.cfi.cfa.base == CFI_UNDEFINED)
return 0;
if (file->ignore_unreachables)
@@ -3595,9 +3678,17 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
return 1;
}

+ if (!insn->vtrace) {
+ if (ret)
+ VTRACE_INSN(insn, "validated (%d)", ret);
+ else
+ VTRACE_INSN(insn, NULL);
+ }
+
prev_insn = insn;
insn = next_insn;
- }
+
+ } while (validate_next);

return ret;
}
@@ -3629,8 +3720,10 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
if (!insn->hint && !insn_cfi_match(insn, &statep->cfi))
return 1;

- if (insn->visited & visited)
+ if (insn->visited & visited) {
+ VTRACE_INSN(insn, "already visited");
return 0;
+ }
} else {
nr_insns_visited++;
}
@@ -3667,8 +3760,10 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
* It will be seen later via the
* straight-line path.
*/
- if (!prev_insn)
+ if (!prev_insn) {
+ VTRACE_INSN(insn, "defer restore");
return 0;
+ }

WARN_INSN(insn, "objtool isn't smart enough to handle this CFI save/restore combo");
return 1;
@@ -3696,13 +3791,24 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
return 1;

if (insn->alts) {
+ int i, count;
+
+ count = 0;
+ for (alt = insn->alts; alt; alt = alt->next)
+ count++;
+
+ i = 1;
for (alt = insn->alts; alt; alt = alt->next) {
+ VTRACE_INSN(insn, "alternative %d/%d", i, count);
ret = validate_branch(file, func, alt->insn, *statep);
if (ret) {
BT_INSN(insn, "(alt)");
return ret;
}
+ i++;
}
+
+ VTRACE_INSN(insn, "alternative orig");
}

if (skip_alt_group(insn))
@@ -3714,10 +3820,12 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
switch (insn->type) {

case INSN_RETURN:
+ VTRACE_INSN(insn, "return");
return validate_return(func, insn, statep);

case INSN_CALL:
case INSN_CALL_DYNAMIC:
+ VTRACE_INSN(insn, "call");
ret = validate_call(file, insn, statep);
if (ret)
return ret;
@@ -3733,13 +3841,21 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
case INSN_JUMP_CONDITIONAL:
case INSN_JUMP_UNCONDITIONAL:
if (is_sibling_call(insn)) {
+ VTRACE_INSN(insn, "sibling call");
ret = validate_sibling_call(file, insn, statep);
if (ret)
return ret;

} else if (insn->jump_dest) {
- ret = validate_branch(file, func,
- insn->jump_dest, *statep);
+ if (insn->type == INSN_JUMP_UNCONDITIONAL) {
+ VTRACE_INSN(insn, "unconditional jump");
+ ret = do_validate_branch(file, func,
+ insn->jump_dest, *statep);
+ } else {
+ VTRACE_INSN(insn, "jump taken");
+ ret = validate_branch(file, func,
+ insn->jump_dest, *statep);
+ }
if (ret) {
BT_INSN(insn, "(branch)");
return ret;
@@ -3749,10 +3865,12 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
if (insn->type == INSN_JUMP_UNCONDITIONAL)
return 0;

+ VTRACE_INSN(insn, "jump not taken");
break;

case INSN_JUMP_DYNAMIC:
case INSN_JUMP_DYNAMIC_CONDITIONAL:
+ VTRACE_INSN(insn, "dynamic jump");
if (is_sibling_call(insn)) {
ret = validate_sibling_call(file, insn, statep);
if (ret)
@@ -3765,6 +3883,7 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
break;

case INSN_SYSCALL:
+ VTRACE_INSN(insn, "syscall");
if (func && (!next_insn || !next_insn->hint)) {
WARN_INSN(insn, "unsupported instruction in callable function");
return 1;
@@ -3773,6 +3892,7 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
break;

case INSN_SYSRET:
+ VTRACE_INSN(insn, "sysret");
if (func && (!next_insn || !next_insn->hint)) {
WARN_INSN(insn, "unsupported instruction in callable function");
return 1;
@@ -3781,6 +3901,7 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
return 0;

case INSN_STAC:
+ VTRACE_INSN(insn, "stac");
if (!opts.uaccess)
break;

@@ -3793,6 +3914,7 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
break;

case INSN_CLAC:
+ VTRACE_INSN(insn, "clac");
if (!opts.uaccess)
break;

@@ -3810,6 +3932,7 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
break;

case INSN_STD:
+ VTRACE_INSN(insn, "std");
if (statep->df) {
WARN_INSN(insn, "recursive STD");
return 1;
@@ -3819,6 +3942,7 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
break;

case INSN_CLD:
+ VTRACE_INSN(insn, "cld");
if (!statep->df && func) {
WARN_INSN(insn, "redundant CLD");
return 1;
@@ -3831,8 +3955,10 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
break;
}

- if (insn->dead_end)
+ if (insn->dead_end) {
+ VTRACE_INSN(insn, "dead end");
return 0;
+ }

/*
* Indicate that the caller should validate the next
@@ -3843,6 +3969,18 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
return 0;
}

+static int validate_branch(struct objtool_file *file, struct symbol *func,
+ struct instruction *insn, struct insn_state state)
+{
+ int ret;
+
+ vtrace_depth++;
+ ret = do_validate_branch(file, func, insn, state);
+ vtrace_depth--;
+
+ return ret;
+}
+
static int validate_unwind_hint(struct objtool_file *file,
struct instruction *insn,
struct insn_state *state)
@@ -4253,9 +4391,22 @@ static int validate_symbol(struct objtool_file *file, struct section *sec,
if (opts.uaccess)
state->uaccess = sym->uaccess_safe;

+ if (opts.trace && fnmatch(opts.trace, sym->name, 0) == 0) {
+ vtrace = true;
+ vtrace_depth = 0;
+ VTRACE_PRINTF("%s: validation begin\n", sym->name);
+ }
+
ret = validate_branch(file, insn_func(insn), insn, *state);
if (ret)
BT_INSN(insn, "<=== (sym)");
+
+ if (vtrace) {
+ VTRACE_PRINTF("%s: validation %s\n\n",
+ sym->name, ret ? "failed" : "end");
+ vtrace = false;
+ }
+
return ret;
}

@@ -4651,7 +4802,7 @@ int check(struct objtool_file *file)
* disassembly context to disassemble instruction or function
* on warning or backtrace.
*/
- if (opts.verbose || opts.backtrace) {
+ if (opts.verbose || opts.backtrace || opts.trace) {
disas_ctx = disas_context_create(file);
objtool_disas_ctx = disas_ctx;
}
diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/include/objtool/builtin.h
index 6b08666fa69d..b3c84b6fdc5f 100644
--- a/tools/objtool/include/objtool/builtin.h
+++ b/tools/objtool/include/objtool/builtin.h
@@ -37,6 +37,7 @@ struct opts {
const char *output;
bool sec_address;
bool stats;
+ const char *trace;
bool verbose;
bool werror;
};
diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/objtool/check.h
index 92bfe6b209ad..1b9b399578ea 100644
--- a/tools/objtool/include/objtool/check.h
+++ b/tools/objtool/include/objtool/check.h
@@ -81,6 +81,8 @@ struct instruction {
struct symbol *sym;
struct stack_op *stack_ops;
struct cfi_state *cfi;
+
+ u32 vtrace;
};

static inline struct symbol *insn_func(struct instruction *insn)
diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h
index 32a8dd299c87..0bb94f2d3ae4 100644
--- a/tools/objtool/include/objtool/warn.h
+++ b/tools/objtool/include/objtool/warn.h
@@ -96,7 +96,8 @@ static inline char *offstr(struct section *sec, unsigned long offset)
len = snprintf(NULL, 0, " %s: " format, _str, ##__VA_ARGS__); \
len = (len < 50) ? 50 - len : 0; \
WARN(" %s: " format " %*s%s", _str, ##__VA_ARGS__, len, "", _istr); \
- free(_str); \
+ free(_str); \
+ __insn->vtrace++; \
} \
})

--
2.43.5



Return-Path: <linux-kernel+bounces-675950-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9FFF341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:37:55 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id E697B189ECF7
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:37:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 939F6289836;
Fri, 6 Jun 2025 15:35:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="mNBcPPCC"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 418C728B407
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224118; cv=none; b=HbtYCsalU8Jn25U5AfMTxZB9l19YktbFxVUlESZHeEmjVHS/7S7mzDRng3c/rNNdsw5p/fCv3Q35Dqww4t1CAUybtXMcbO5kjv1rWGKwMtAizriMTDQHRpq45wENqem19B1za8ar9Yv4h5vO0qLEDnMc+2HY3imz43HDMAhafbM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224118; c=relaxed/simple;
bh=pNz8oI4NgRu/uensBbLsGjNJQn6uHB9jVjTVFyCtJ4c=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=BSZaaXyvlZiYlT9x1jxu21P/6R2mQNXucV7CKmcKmtdpjryzbIElLZ6ojHErcnsd/C75Zfn7mhjJOJ7H2zSvX12/P0ZOtHljw1I+152lfGPqT6zouFGVQ1S8emiTT6UNnd/6Fmy9t5jBNcJgXHdfn5ksa+glBeU7VEh3NHLzzvc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=mNBcPPCC; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0246632.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MZla011741;
Fri, 6 Jun 2025 15:35:13 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=f38ZA
5UozH5ByoH9pR2Me3XWlBHPHaaOZKuA3m4xCvo=; b=mNBcPPCCrNvUL9SWEX+zF
wtMfnFD1CxwA9eEKB4G2cQy6D0INZKIN9FFtwspSyzMjdEWKr1WHYYj492TH3yzW
FzUzTF03RndBP0E96ioasVIRkHaCM/Fr1k5MuGordPALlFy07ew5FAFgWcCZjQ5l
NtsxitRKc2F+SKLHhW3DDgwbfUNiyIz33Rp98MD3p8Uc4d+sY/+1uWijvbL502wy
vKQdkL6+wBPGgal7NYUPY5AniLpu5dwsQZgFyjbqcMII06MXqDCreMrEkljxP7Q9
K3i2V3TT4X/DkyJAdegRTWSDuVsrfcfXMRaeUPriv3jeYVPYxaGnSXuH5hi8nwee
Q==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471g8j89dy-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:12 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556Ejvkt039147;
Fri, 6 Jun 2025 15:35:10 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7desmc-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:10 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh43015517;
Fri, 6 Jun 2025 15:35:09 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-13;
Fri, 06 Jun 2025 15:35:09 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 12/13] objtool: Improve tracing of alternative instructions
Date: Fri, 6 Jun 2025 17:34:39 +0200
Message-ID: <20250606153440.865808-13-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Proofpoint-GUID: hhTm_Y8lnZ6qNsoBXw5vdrtJCrxJL3O3
X-Proofpoint-ORIG-GUID: hhTm_Y8lnZ6qNsoBXw5vdrtJCrxJL3O3
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX1XcM7KO0aCQq Futq2/ZXyc09l51rO2FmdQvHev7IKAL29JbogRGkJG7PMgoCL5HxJevXsgw5BfmRutB8e7nUIlX P6xAnhp0oewvlAqeTsaRwjiYV3HdqjPuEmNQ9vZDHfPJRswKOeET/r52WUi/y3JvwsYxdBrj5Ia
QNW+s29Pxrb771+wqHkIVU5JDXJN1vNIrf6yCFJxeD6a/UbUdEMHN1/8ycE27Yt2EQl8dZgS8o3 hq3aQ4VcxKvFuvhEqKQo68ZwsCiN71WR432t61mSdKkPWwfZKyvRPeAjU1sxuc6JUXLkEsBbQqX NxxN4+Lx+CTDL4eXBU4Y/bvr/8V1gdXy+NmAy6M1SYS2gRlVMSAf5O9iPVBeby7yOUcVxK5sRxK
H0J3Y6liJ+/X/O1mDxaK3SNm87ktFecUYruB0eZUoNSHwEAYcT+XZgv14kgmbTDJFhjdYX8W
X-Authority-Analysis: v=2.4 cv=QI1oRhLL c=1 sm=1 tr=0 ts=68430ab0 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=RxUVdm5A3GcFcKIcQO8A:9
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

When tracing function validation, improve the reporting of
alternative instruction by more clearly showing the different
alternatives beginning and end.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/check.c | 59 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 56 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 050d34930372..afcb6c67daa9 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -54,9 +54,61 @@ static int vtrace_depth;
} \
} while (0)

+#define VTRACE_INFO(insn, fmt, ...) \
+ do { \
+ if (vtrace) \
+ vtrace_info(insn, fmt, ##__VA_ARGS__); \
+ } while (0)
+
+#define VTRACE_ALT_FMT(fmt) "<alternative.%lx> alt " fmt
+
+#define VTRACE_ALT(insn, fmt, ...) \
+ VTRACE_INSN(insn, VTRACE_ALT_FMT(fmt), \
+ (insn)->offset, ##__VA_ARGS__)
+
+#define VTRACE_ALT_INFO(insn, fmt, ...) \
+ VTRACE_INFO(insn, VTRACE_ALT_FMT(fmt), \
+ (insn)->offset, ##__VA_ARGS__)
+
+#define VTRACE_ALT_INFO_NOADDR(insn, fmt, ...) \
+ VTRACE_INFO(NULL, VTRACE_ALT_FMT(fmt), \
+ (insn)->offset, ##__VA_ARGS__)
+
#define VTRACE_INSN_OFFSET_SPACE 10
#define VTRACE_INSN_SPACE 60

+/*
+ * Print a message in the instruction flow. If insn is not NULL then
+ * the instruction address is printed in addition of the message,
+ * otherwise only the message is printed. In all cases, the instruction
+ * itself is not printed.
+ */
+static void vtrace_info(struct instruction *insn, const char *format, ...)
+{
+ const char *addr_str;
+ va_list args;
+ int len;
+ int i;
+
+ len = sym_name_max_len + VTRACE_INSN_OFFSET_SPACE;
+ if (insn) {
+ addr_str = offstr(insn->sec, insn->offset);
+ VTRACE_PRINTF("%6lx: %-*s ", insn->offset, len, addr_str);
+ } else {
+ len += 11;
+ VTRACE_PRINTF("%-*s", len, "");
+ }
+
+ /* print vertical bars to show the validation flow */
+ for (i = 1; i < vtrace_depth; i++)
+ VTRACE_PRINTF("| ");
+
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ VTRACE_PRINTF("\n");
+}
+
/*
* Print an instruction address (offset and function), the instruction itself
* and an optional message.
@@ -3692,7 +3744,7 @@ static bool skip_alt_group(struct instruction *insn)

/* ANNOTATE_IGNORE_ALTERNATIVE */
if (insn->alt_group && insn->alt_group->ignore) {
- VTRACE_INSN(insn, "alt group ignored");
+ VTRACE_ALT(insn, "alt group ignored");
return true;
}

@@ -3905,8 +3957,9 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,

i = 1;
for (alt = insn->alts; alt; alt = alt->next) {
- VTRACE_INSN(insn, "alternative %d/%d", i, count);
+ VTRACE_ALT_INFO(insn, "%d/%d begin", i, count);
ret = validate_branch(file, func, alt->insn, *statep);
+ VTRACE_ALT_INFO_NOADDR(insn, "%d/%d end", i, count);
if (ret) {
BT_INSN(insn, "(alt)");
return ret;
@@ -3914,7 +3967,7 @@ static int validate_insn(struct objtool_file *file, struct symbol *func,
i++;
}

- VTRACE_INSN(insn, "alternative orig");
+ VTRACE_ALT_INFO(insn, "default");
}

if (skip_alt_group(insn))
--
2.43.5



Return-Path: <linux-kernel+bounces-675951-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8B39F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:38:03 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 6D13B189E5CB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:37:43 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A9F228B50B;
Fri, 6 Jun 2025 15:35:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="dp8+meFx"
Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
(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 0ECD328B41E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:35:17 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224120; cv=none; b=VeP5ue8FR8xBYwYEUzaeUbQT6S9Ul6MJSrzUGu6cM+jA3HyzqMW1cwQN41sTkQCdZtxtZ0Qbk7f9+/oki8WAa2PFQcFZzxlZeyRPvyan9deOvjlb78AbT1v1oSprYihBWgw353RiBSeU/sXGMhHyyb1fqor1B325puwcovuGxMs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224120; c=relaxed/simple;
bh=eapQH9Pu3xNVR8smEr7tNLOEPObMvHtSxQXhpF37H8Y=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=rBAcfxPQApqLgsoh+KgIYyWZnqgbZRYgO59ooKNkcEaXZiilRjcBXWKkABG2okFyklOEvoTKXj8s/+Ur8Z71dmFDq62AiMUOuErS+FF7ySMX/vc4gd9RyUIVU3XT0HY9JF8nxwSSz4AUAkYKOZ6lK1lNqgNIZ9tDthcvH0tu2kU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=dp8+meFx; arc=none smtp.client-ip=205.220.177.32
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com
Received: from pps.filterd (m0333520.ppops.net [127.0.0.1])
by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5565MWvU002076;
Fri, 6 Jun 2025 15:35:13 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc
:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=corp-2025-04-25; bh=qKWmo
QacCgmw1/3xvcsQO6P0KgtNTrg1orkARsvgoVg=; b=dp8+meFxWEZ3QGs3c/AQg
iMz48JYRCBSIlB5Qve0VG0QKceQWd8o8dUg9IxdteqJI8CUw7gzqBwj0VIcJabaR
DiAq86tFeLGvfFvv8nbMyvxenK8a6sVNWvuAU6PYMr8qSr8uftw1ef/3iyORGdtF
EkFW4uMnlVlMFdMuxtjMDuNMgEsTHbsw/UF9npJz4MGScE6RQ2J0mVmaohNBbcsb
1RQDaLthOq1UjOIscf2ejA8uWJweeL7mJ2uuvdvmtTLp8qWt1ogwCIVG3H45zrbn
NvJ5cB2r7XgBagU6r3QVjY3Nn15mpP0V/1iN9LrNnXEuv2KROHWSc+QThc55ObrG
A==
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 471gahgags-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:13 +0000 (GMT)
Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 556ERKe8039260;
Fri, 6 Jun 2025 15:35:12 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 46yr7despk-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Fri, 06 Jun 2025 15:35:12 +0000
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 556FYh45015517;
Fri, 6 Jun 2025 15:35:11 GMT
Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-187-118.vpn.oracle.com [10.154.187.118])
by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 46yr7des15-14;
Fri, 06 Jun 2025 15:35:11 +0000
From: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, jpoimboe@xxxxxxxxxx,
peterz@xxxxxxxxxxxxx
Cc: alexandre.chartre@xxxxxxxxxx
Subject: [RFC 13/13] objtool: Do not validate IBT for .return_sites and .call_sites
Date: Fri, 6 Jun 2025 17:34:40 +0200
Message-ID: <20250606153440.865808-14-alexandre.chartre@xxxxxxxxxx>
X-Mailer: git-send-email 2.43.5
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0
phishscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000
definitions=main-2506060136
X-Authority-Analysis: v=2.4 cv=aqqyCTZV c=1 sm=1 tr=0 ts=68430ab1 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=yvIqsss6GtJD96b7xZoA:9
X-Proofpoint-GUID: uYYyFBdp_eo6C9GSYKr6E653Ii9VcV2i
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfXx7WY+3vCKjOe 7+uRcx2V5CuxraB4EJ+1pcW0QBlWxUpxvmritY76Evjyo25bzo2FRilV8f0rP5TN/4SUkUTtlyK VLHwk+X4HceSVbryN/Edlc0b4rsteG4cr4TtdnUbcBA8NOEopKczGk705kXFSKNXnnckfaRoLdn
rGGvkydmvesHsRFSyUj+/pmRzIf48OUotwsbLTs2XKcrIf3eq2KHyVSNJsrJos0Z42KyfmhSYgH PAPIff3ipOvPk++fNsND6+J/axx6o2hsFVOhtb8n93v51MCJAAUnu4fXKoPEi7rvrDS5dYJqsSK DSBToVSZowFW3S+uF+SU9Y8WqSgjU+9frgIo1zOn5G04eG5p9SJCgLMw7cSQJF8Jb+0NMmB7s8V
R9WvqMjvTj4AcpmrzrB2f6TIRib3IHJTcQIDUojjK0gfcoCTdwMYHqP8PUwYKDz/M23RIQLO
X-Proofpoint-ORIG-GUID: uYYyFBdp_eo6C9GSYKr6E653Ii9VcV2i
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The .return_sites and .call_sites sections reference text addresses,
but not with the intent to indirect branch to them, so they don't
need to be validated for IBT.

This is useful when running objtool on object files which already
have .return_sites or .call_sites sections, for example to re-run
objtool after it has reported an error or a warning.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
tools/objtool/check.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index afcb6c67daa9..6d81dabef64e 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4844,6 +4844,8 @@ static int validate_ibt(struct objtool_file *file)
!strcmp(sec->name, ".llvm.call-graph-profile") ||
!strcmp(sec->name, ".llvm_bb_addr_map") ||
!strcmp(sec->name, "__tracepoints") ||
+ !strcmp(sec->name, ".return_sites") ||
+ !strcmp(sec->name, ".call_sites") ||
strstr(sec->name, "__patchable_function_entries"))
continue;

--
2.43.5



Return-Path: <linux-kernel+bounces-675952-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C561441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:38:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2315B3B3B46
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:37:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 098ED28B7E5;
Fri, 6 Jun 2025 15:35:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="nI8u/Ccn"
Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131])
(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 2622B28983D;
Fri, 6 Jun 2025 15:35:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224129; cv=none; b=d+QKtUaP9Z+dNgxlkW/Z+dj4er2fw88uWrASiDIXG31unAApLhggPQvvZHcWl1PxLuyZ7P43nBf7W/kIZVbBSEyEzQuzGYdC5EFzVVDmmRjst451EZvgj/eVe6Z64OYFw7SOjsjOY832Njay0yb9pHrtVvl4RUhw0+xcS6ydebw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224129; c=relaxed/simple;
bh=8SY1GsuYfcNx8zwGx+fhS3YamoOR30i4JTZ3TgJntko=;
h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From:
In-Reply-To:Content-Type; b=u9r73jhp+knxCYujG4T8Kp0Bmrz1Nw65weRCBjp0Ruff1VYZEasEjYNRI86j0qJvruiNJdcuFRvdYbNHwktBASRlnxzfFsRWmxCSquBLwrx2B74/hVvYSK88JOjJeN2vy5PDyoykCsonmmiTd8F6siqZcYS4WhKGCQlwp/bCrHc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=nI8u/Ccn; arc=none smtp.client-ip=205.220.180.131
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com
Received: from pps.filterd (m0279872.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 556F9FT7018079;
Fri, 6 Jun 2025 15:35:21 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=
cc:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=qcppdkim1; bh=
IHVYulWU7RDStgIiNys38hXNypv1tVavSEag4eeBhas=; b=nI8u/CcnO4RhT7XI
sNjdnXGQzSBxPBMPIo9GaLIroCMP1UtJqVeBCqN4CY+RkVb9hWSNzukCKrv/e9Kq
uj24XvXSxdeNWl96t93wJKk+1zhB/CWJFWDEAOP4pRDoSbxFmCe16Hjis29+Ezgd
IqbKeLIvJCAK2ni4nnJGEuSDPP8mmRnmKXW4UI6QY0rBusYQs3M6CVH6RUeb60jo
9PBOID58qRHqDyIe0aaoKe8prP5OxTNKlS2AzWimawoOoiIiNH8ca3INVXCPZ6IS
c3+GP1bi9nDFqpjqV4+zvudx68MisRKNpdbxEb+HXNGrrw8+AJjNQUNMf4CPA92V
aVX+Ag==
Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8qd3nq-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 15:35:20 +0000 (GMT)
Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231])
by NASANPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 556FZJ15001636
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 6 Jun 2025 15:35:19 GMT
Received: from [10.50.32.91] (10.80.80.8) by nasanex01a.na.qualcomm.com
(10.52.223.231) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 6 Jun 2025
08:35:15 -0700
Message-ID: <265b1625-bf53-ba5d-9dc5-eb2ab78fb822@xxxxxxxxxxx>
Date: Fri, 6 Jun 2025 21:05:12 +0530
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Subject: Re: [PATCH v8 0/3] media: venus: enable venus on qcs615
Content-Language: en-US
To: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>,
Renjiang Han
<quic_renjiang@xxxxxxxxxxx>,
Krzysztof Kozlowski <krzk@xxxxxxxxxx>,
"Dmitry
Baryshkov" <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
CC: Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>,
Mauro Carvalho Chehab
<mchehab@xxxxxxxxxx>,
Bjorn Andersson <andersson@xxxxxxxxxx>,
Konrad Dybcio
<konradybcio@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski
<krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, <linux-media@xxxxxxxxxxxxxxx>,
<linux-arm-msm@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<devicetree@xxxxxxxxxxxxxxx>,
"Nicolas
Dufresne" <nicolas.dufresne@xxxxxxxxxxxxx>
References: <20250530-add-venus-for-qcs615-v8-0-c0092ac616d0@xxxxxxxxxxx>
<wmri66tkksq6i3hfyoveedq5slghnnpozjzx6gck5r3zsiwsg6@xevgh54rnlqd>
<285cae4a-219c-4514-818f-34c8225529de@xxxxxxxxxxx>
<5854a587-aba7-4e71-87f8-249ba00cbc59@xxxxxxxxxx>
<996c9a39-5520-4b43-adfa-06ce29223ba0@xxxxxxxxxxx>
<713b87cb-0003-4ee3-a599-9cd41629bb42@xxxxxxxxxx>
<7aa36a0f-6741-40c2-93f4-036823d245fd@xxxxxxxxxxx>
<247002c0-ee68-4d0d-857a-768bf68bce75@xxxxxxxxxx>
<d5aee491-3ba2-4beb-8b8f-4ba8372e6d16@xxxxxxxxxxx>
<fa6a7983-27bf-40db-9843-0891bdadf523@xxxxxxxxxx>
From: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>
In-Reply-To: <fa6a7983-27bf-40db-9843-0891bdadf523@xxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To
nasanex01a.na.qualcomm.com (10.52.223.231)
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085
X-Proofpoint-GUID: sqKJ0bWR7sATR-9H6WTnIX8AJFHNxamg
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzNyBTYWx0ZWRfX/RtdDxEWRVI1
kL2t+6YDr++2G34Ofbyxc8X+MNNnjyWb2EZGCrnkPI+Hjk5WpUqjxfxM+Oou/DUtJpOt1txRj0b
W6rVFmIWjDkt8zYTptRUNH+elBxffavWZl7lC8sRG4IuwPmP0oV2dijSsZAqTAqOSRYYUJAUk66
Qeek+Jf8HSsVULEGeu9i+63xZAvMoxvfyIN/irFWTJ0tNIPJdYdD4fA5KVOhcaERMrQOe8WSyRs
S+M+srP1z9BTkyccvtDy2gm1N0Wsf4ilMvhcPWmOzwN+Nd6g1as9VCtb2mXpvsCTdFzWDIUFjn0
rKTqc07y0G8X8ueBnRWYzrO70DnHDBa4hVVmY8ZQo/ytXGP/GgAImcIhCyaYrpmXqGTvZ3aJCZR
Zrn9s0b7fG7T0eYZ+UedxEin8IvMmhyyKsU5XlzVjaG/DQ1bKrQiiObEziut9fJhF9JSgiNp
X-Proofpoint-ORIG-GUID: sqKJ0bWR7sATR-9H6WTnIX8AJFHNxamg
X-Authority-Analysis: v=2.4 cv=PrmTbxM3 c=1 sm=1 tr=0 ts=68430ab8 cx=c_pps
a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17
a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10
a=3HzSJax5ekaUL6_BMMgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
phishscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 lowpriorityscore=0
impostorscore=0 malwarescore=0 spamscore=0 clxscore=1015 adultscore=0
suspectscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc=
route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000
definitions=main-2506060137
X-Spam-Status: No, score=-5.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
NICE_REPLY_A,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


On 6/6/2025 8:23 PM, Bryan O'Donoghue wrote:
> On 06/06/2025 14:32, Renjiang Han wrote:
>>
>> On 6/6/2025 8:56 PM, Krzysztof Kozlowski wrote:
>>> On 06/06/2025 14:51, Renjiang Han wrote:
>>>> On 6/6/2025 8:44 PM, Krzysztof Kozlowski wrote:
>>>>> On 06/06/2025 14:37, Renjiang Han wrote:
>>>>>> On 6/5/2025 8:34 PM, Bryan O'Donoghue wrote:
>>>>>>> On 31/05/2025 01:05, Renjiang Han wrote:
>>>>>>>>>> Note:
>>>>>>>>>> This series consist of DT patches and a venus driver patch. The patch
>>>>>>>>>> 1/3, which is venus driver patch, can be picked independently without
>>>>>>>>>> having any functional dependency. But patch 2/3 & patch 3/3, which are
>>>>>>>>>> DT patches, still depend on [1].
>>>>>>>>> I'd say 2/3 and 3/3 still depend on 1/3, otherwise we can get video
>>>>>>>>> core
>>>>>>>>> on QCS615 over(?)clocked.
>>>>>>>> Agree, so we need to make sure that the driver patch is not picked
>>>>>>>> after the DT patch.
>>>>>>> This statement is confusing.
>>>>>>>
>>>>>>> 1/3 states that there will be a fallback if there is no OPP table
>>>>>>> present.
>>>>>>>
>>>>>>> Giving the code a glance, I believe that is so, freq_table should be
>>>>>>> used if there is no OPP specified in the DT.
>>>>>>>
>>>>>>> I think we are having a hard time here understanding what you are saying.
>>>>>>>
>>>>>>> My understanding:
>>>>>>>
>>>>>>> - venus modification is standalone 1/3
>>>>>>>     Qcs615 will fallback if no OPP is present
>>>>>>>
>>>>>>> - dt modification 2/3 3/3 is therefore also independent of driver
>>>>>>>
>>>>>>> ---
>>>>>>> bod
>>>>>> yes, let me re-spin this with driver patch alone. Once that gets in,
>>>>>> will bring in the DT patches.
>>>>> Did you read my feedback? There is no "once that gets in". DTS is an
>>>>> independent hardware description and your patchset claiming there is
>>>>> dependency is just broken.
>>>>>
>>>>> I am repeating this since few emails, so shall I NAK it that you will
>>>>> address the main issue you have?
>>>>>
>>>>> Best regards,
>>>>> Krzysztof
>>>> Hi Krzysztof
>>>>
>>>> SC7180 and QCS615 use the same video core. Only difference lies in the
>>>> freq_table for the video. Freq_table is generally determined at SOC level.
>>>> The Venus driver does not currently handle freq_table compatibility well
>>>> across platforms. This patch enables the driver to use the OPP-table from
>>>> the DT, addressing the frequency compatibility issue.
>>> This does not resolve the main problem at all. If SW cannot use the
>>> fallback alone, your fallback has no meaning and is not only confusing
>>> but actually incorrect. And based on previous statements like
>>> "overclocking" it is not only incorrect, but even harmful.
>>>
>>> Best regards,
>>> Krzysztof
>> The fallback is only triggered when there is no OPP table in the DT.
>> Since the QCS615 DT will include an OPP table, the fallback logic will
>> not be used.
>>
>> Also, if the freq from the freq_table and the OPP table are the same,
>> would it be acceptable to drop the freq_table from the driver?
>
> If you drop the freq_table, you will need to apply OPPs for the sc7180 to DTS
> first before venus or you'll break sc7180.
>
> I think TBH you should add a freq_tbl for QCS615 and make it so the order of
> patch application doesn't matter wrt adding OPP support.
That would my proposal too here. Add the proper table in driver resources for
QCS615, so that either of OPP or fallback would not matter and would be carrying
right values either way(no over clocking).

Regards,
Vikash
>
> - Add QCS freq_tbl
> - Add OPP support
>
> Then do whatever in DTS, nothing can break in this case.
>
> As we've established the fallback isn't a fallback because it falls back to
> wrong data, so lets fix that.
>
> ---
> bod


Return-Path: <linux-kernel+bounces-675953-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 14E3F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:38:50 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 3A2B4189EDA0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:38:21 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id F30A0276048;
Fri, 6 Jun 2025 15:36:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k5dcNJiu"
Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93E811C1741
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:36:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224184; cv=none; b=tSKFj17MgqXOUBNdSF0DrRfw7RvGy1oNRI8O5xBtOLeec9WAZgF2ZlkojcBMnV7Sf7Vz1jKbOyNqwwd8FcpYXnGrvfnqJhcGexZFzLD8seQGGHEim5/cXi9TaRdkYSvd1cHHOHRJFIlk7Fi144trED/vnn/Nr/ceOK9wOl75Q2s=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224184; c=relaxed/simple;
bh=H3Hs9P+dciQUXHnhHSgkXcGE66Hv/GWrtUX1VrkIyyg=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=nhanyt9WvdlUDleVV3Yd3dIo6bwHubzicF0op9iVeMv+9PXj0ErggwTPa82pqo4BbD7EgemvJ1cz+mAKLzLHCMamzEp9NbuSCqdZcgP+03MX6JfkPfsxCPpujp2JvF9UfTEYlyCW9qyzG7NbRMqc1u1/pDLNSim9g7pvmXH7J3E=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k5dcNJiu; arc=none smtp.client-ip=209.85.218.45
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-acb5ec407b1so398604766b.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:36:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749224180; x=1749828980; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=C8EDbgSSHh5vY5XHHz5Ly91Fa77ndpTfrnTlTnw+Etg=;
b=k5dcNJiuqYWZ5SalFcWUmgQiOpUskTp4UBJlE+FZnC5PHhwfueaKDlbFKiNEqaRxE4
nk7zq6ccSIgbsfrBIxAHZXS/4C5QIHVrENApZRuXzk9ZvmLh/ht6VTCjh95QIOA0d06m
GIcHZ5QS8qFlgBVPn2qECqhuGkYOVj2+dfkafOducPhGgcT7e+j88EJUZ1PpnYCSpLv6
EU6iNOx5lZmvlQ4ztGcvNh5DpsK8f2hlTKcOWl2DYR5e27CfI1O5OUWjU+Mwf8sXK1MF
bE1ZIDR2SS+jDFO7ayTGdLsU5Voi0ySf1O/u7/Z49dyPomoXaz15Lr0Plj9M0eao4oCT
h8jQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749224180; x=1749828980;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=C8EDbgSSHh5vY5XHHz5Ly91Fa77ndpTfrnTlTnw+Etg=;
b=KdRa3jatjgaOyNQzm3OAHllZVDLzmk3tryNmPODPK3KfVIJqQIXbFBHh5cCLp/uPfo
U1XYinXiF8RlH5YuFyCtg2c+nfTL0uqyZ5G2PKcMttUmyX9FlbwjTXF22VP7ykICS/kW
R9avzOsDwBGJBSRCDNCsvmNHJgHXF/AEFMBe1GtFo+vcVX1flrBrGoq1PcOKkwCoIQVX
0+mmQ9piXaXDg3gjoKho9tp4sfO7wYGml5hCaUiXDt9E9SyzMJe1gQ/LQXvk1GDzO76N
R2AJujFX3ya0vr69f9Qhi/ddoQ7O/L2R54ibo6G3WGlwwtX1yOg+lebdeA7NGOD/qF2J
82rw==
X-Forwarded-Encrypted: i=1; AJvYcCUn9jOntKbmpxX3EyPCQ2AoN6XpJEXKPLvBTL0Ve/a1oW7DP40rqQ+RA7kJTLdDgF8jgsSbPrpxlzUznV4=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzn3UNdk9RMVszjsDdKlaULlGgfmbWufZRVjmoYsX0P5bW+0fkx
1PVRtmxaaO2CqEOC+Djb1R9qGqYfHKcUdu2uelPHc8PJJZ8uL64xBnKP6bTlSG6TXTtAimt/WBQ
ihEw1SKPtHOjp117GiHww2W2bEN5hXMU=
X-Gm-Gg: ASbGncunhSDR96ck18qkc65GZI/nv8wijefTWU0w6MLFWklyY4hzy3q+vuAwbqS8/Qz
ubE4keeqf496Fsm7yKSqlk3khOUnFImCyFojzA++O0YdqN0Eo5pMJQ4XTzWbd1vUqNAffdEV8/G
YVR/LnST84U8oFNXlTbmw6wT3vnKXmXJTyKzFWqkWqu9A=
X-Google-Smtp-Source: AGHT+IHGVGxv21OiSj201XMJYK0towMU/A2+e7txxouqDZMOhuq2OOLQjM0BzOGN/q7EiP4FLVSY/4uy1TSnjZMYOsE=
X-Received: by 2002:a17:906:9f92:b0:ad5:27f5:7183 with SMTP id
a640c23a62f3a-ade1ab87a79mr344410966b.39.1749224179557; Fri, 06 Jun 2025
08:36:19 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250605164733.737543-1-mjguzik@xxxxxxxxx> <20250605190054.GH30486@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
In-Reply-To: <20250605190054.GH30486@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
From: Mateusz Guzik <mjguzik@xxxxxxxxx>
Date: Fri, 6 Jun 2025 17:36:07 +0200
X-Gm-Features: AX0GCFvN2zdZaUP8lMkHPpvB_2_XuvzHoejq8kwdaj1gaJoWb-QBH-HRbbQzc3s
Message-ID: <CAGudoHF1yh2CoO-jzt=M7z_114g_Zw3-gy1yBW56tAsjb0k_wA@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v2] x86: prevent gcc from emitting rep movsq/stosq for
inlined ops
To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: torvalds@xxxxxxxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, x86@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, ubizjak@xxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 5, 2025 at 9:00=E2=80=AFPM Peter Zijlstra <peterz@xxxxxxxxxxxxx=
> wrote:
>
> On Thu, Jun 05, 2025 at 06:47:33PM +0200, Mateusz Guzik wrote:
> > gcc is over eager to use rep movsq/stosq (starts above 40 bytes), which
> > comes with a significant penalty on CPUs without the respective fast
> > short ops bits (FSRM/FSRS).
>
> I don't suppose there's a magic compiler toggle to make it emit prefix
> padded 'rep movs'/'rep stos' variants such that they are 5 bytes each,
> right?
>
> Something like:
>
> 2e 2e 2e f3 a4 cs cs rep movsb %ds:(%rsi),%es:(%rdi)
>
> because if we can get the compilers to do this; then I can get objtool
> to collect all these locations and then we can runtime patch them to be:
>
> call rep_movs_alternative / rep_stos_alternative
>
> or whatever other crap we want really.

Even if inlining patchable rep mov/stos is the long term solution, you
still want the compiler to emit regular stores for sizes up to 16 or
so bytes or you are losing out.

So you would still need custom flags to dictate the policy, which is
the bit protested here.

Per other mail in this thread, gcc as is does not do what you need anyway.

So if any patches would have to be written, how about fix up gcc to
emit better inline asm for these to begin with. ;)

--=20
Mateusz Guzik <mjguzik gmail.com>


Return-Path: <linux-kernel+bounces-675954-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8842741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:38:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id A967E17B8C5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:38:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 30F3028982D;
Fri, 6 Jun 2025 15:37:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O97hB+bs"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6357613DBA0;
Fri, 6 Jun 2025 15:37:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224278; cv=none; b=etc6pK1HJd694rfFBK6o3KhNGKugGid3XnU8p1kCs5E3Lu3e8usiOE57T9AH+LTyWY9eC8XG2MOCJmdIfEf+M0BLktd9NirbtAdCkT1CdK2Y6rDCvlMLC7H/3TNdJbxDY7d9NswNK3gnUHpSBOBVtgzGV7EkukwSILHgq7HVhJA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224278; c=relaxed/simple;
bh=PJ9atPS4bsZVal3++1yzNZRHe20wMZYu+nKTUqy5wCE=;
h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:
Content-Disposition; b=BWu/dYIPUj5CjXm5+oxdKeOFKrR/PhtAgxBhV1EXJLYpaCSHKdt3sllDKlqJ9J1Qfzu6sFtqcmNBRVwZcCffhpR4JurRe2WObc3AP30L8v4F1skAGO5qXksFcxYZefcLtEujub8gzIfMECWGNY6n9D+oi3IirTD0r4jZNbgAxxU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O97hB+bs; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90D41C4CEEB;
Fri, 6 Jun 2025 15:37:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224277;
bh=PJ9atPS4bsZVal3++1yzNZRHe20wMZYu+nKTUqy5wCE=;
h=Date:From:To:Cc:Subject:From;
b=O97hB+bs7nvpAmHSxmuM4Sm7KWAGcRTgOpArRr9v7oSDE9EBSm6KbrGrEu3fYX5be
ph24h22vO4GrXR7BI7+uNqxT1mSGo7Q0krrikqFZCBvJLT/TEXy4cFKtR6fpCCs7mt
KgLlmJ6C66BRjPu9XAnJC7FhnlLO+1BcAEPjRYw7cnPYeyMBChK6C5LEt9MHlMhxZt
n9CKS9TfECZhuMzDrcWK8+1pmNG67lj/eoL6eaPm0kyWyBDwK68K9ZuwnB4O/mTWhY
Ypwq3MvwXOOx9gKt83LMbZdSHUqTb7fqEr4rZY/5fCflEy6gUolrLcGi6cWmDZiMGL
RlK+oZQ/pisJQ==
Date: Fri, 6 Jun 2025 12:37:55 -0300
From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
To: Lorenz Bauer <lmb@xxxxxxxxxxxxx>
Cc: Andrii Nakryiko <andrii@xxxxxxxxxx>,
Alan Maguire <alan.maguire@xxxxxxxxxx>,
Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>,
bpf@xxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx
Subject: BTF loading failing on perf
Message-ID: <aEMLU2li1x2bAO4w@x1>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

root@number:~# perf trace -e openat --max-events=1
libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV
libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV
0.000 ( 0.016 ms): ptyxis-agent/4375 openat(dfd: CWD, filename: "/proc/6593/cmdline", flags: RDONLY|CLOEXEC) = 13
root@number:~#

openat(AT_FDCWD, "/sys/kernel/btf/vmlinux", O_RDONLY) = 258
mmap(NULL, 6519699, PROT_READ, MAP_PRIVATE, 258, 0) = -1 ENODEV (No such device)
libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV

root@number:~# ls -la /sys/kernel/btf/vmlinux
-r--r--r--. 1 root root 6519699 Jun 6 12:19 /sys/kernel/btf/vmlinux
root@number:~# uname -a
Linux number 6.14.9-300.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 29 14:27:53 UTC 2025 x86_64 GNU/Linux
root@number:~# head /etc/os-release
NAME="Fedora Linux"
VERSION="42 (Workstation Edition)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=42
VERSION_CODENAME=""
PLATFORM_ID="platform:f42"
PRETTY_NAME="Fedora Linux 42 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
root@number:~# rpm -q glibc-devel
package glibc-devel is not installed
root@number:~# rpm -q glibc
glibc-2.41-5.fc42.x86_64
root@number:~#

Reverting the patch below "cures" the problem.

⬢ [acme@toolbx perf-tools]$ git log --oneline -10 tools/lib/bpf/
370118ff875244d4 (HEAD -> perf-tools) Revert "libbpf: Use mmap to parse vmlinux BTF from sysfs"
90b83efa6701656e Merge tag 'bpf-next-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
3c0421c93ce4ff0f libbpf: Use mmap to parse vmlinux BTF from sysfs
4e29128a9acec2a6 libbpf/btf: Fix string handling to support multi-split BTF
d0445d7dd3fd9b15 libbpf: Check bpf_map_skeleton link for NULL
fd5fd538a1f4b34c libbpf: Use proper errno value in nlattr
62e23f183839c3d7 libbpf: Improve BTF dedup handling of "identical" BTF types
41d4ce6df3f49453 bpf: Fix uninitialized values in BPF_{CORE,PROBE}_READ
358b1c0f56ebb699 libbpf: Use proper errno value in linker
8e64c387c942229c libbpf: Add identical pointer detection to btf_dedup_is_equiv()
⬢ [acme@toolbx perf-tools]$

root@number:~# perf -v
perf version 6.15.g370118ff8752
root@number:~# perf trace -e connect --max-events=5
0.000 ( 0.021 ms): DNS Res~ver #4/7932 connect(fd: 102, uservaddr: { .family: LOCAL, path: /run/systemd/r }, addrlen: 42) = 0
0.304 ( 0.013 ms): systemd-resolv/1420 connect(fd: 25, uservaddr: { .family: INET, port: 53, addr: 186.208.78.194 }, addrlen: 16) = 0
0.371 ( 0.002 ms): systemd-resolv/1420 connect(fd: 26, uservaddr: { .family: INET, port: 53, addr: 186.208.78.194 }, addrlen: 16) = 0
0.591 ( 0.009 ms): DNS Res~ver #2/7523 connect(fd: 104, uservaddr: { .family: LOCAL, path: /run/systemd/r }, addrlen: 42) = 0
0.731 ( 0.006 ms): systemd-resolv/1420 connect(fd: 28, uservaddr: { .family: INET, port: 53, addr: 186.208.78.194 }, addrlen: 16) = 0
root@number:~#

Ideas?

- Arnaldo

⬢ [acme@toolbx perf-tools]$ git bisect good
3c0421c93ce4ff0f5f2612666122c34fc941d569 is the first bad commit
commit 3c0421c93ce4ff0f5f2612666122c34fc941d569
Author: Lorenz Bauer <lmb@xxxxxxxxxxxxx>
Date: Tue May 20 14:01:19 2025 +0100

libbpf: Use mmap to parse vmlinux BTF from sysfs

Teach libbpf to use mmap when parsing vmlinux BTF from /sys. We don't
apply this to fall-back paths on the regular file system because there
is no way to ensure that modifications underlying the MAP_PRIVATE
mapping are not visible to the process.

Signed-off-by: Lorenz Bauer <lmb@xxxxxxxxxxxxx>
Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
Tested-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
Link: https://lore.kernel.org/bpf/20250520-vmlinux-mmap-v5-3-e8c941acc414@xxxxxxxxxxxxx

tools/lib/bpf/btf.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 71 insertions(+), 18 deletions(-)
⬢ [acme@toolbx perf-tools]$


Return-Path: <linux-kernel+bounces-675955-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 62D6041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:39:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 3B51F189E968
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:38:50 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A99B528937C;
Fri, 6 Jun 2025 15:38:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="uLFwioCG"
Received: from casper.infradead.org (casper.infradead.org [90.155.50.34])
(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 ACEC6276048
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:38:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224292; cv=none; b=hOsgV0W0qmifleVFtgPOYFyL0Q4jhE7pkv2VH2aEEjPqziiFbNJ96eR8dVlf8izYqqmb50iFSisJgYSLbru3+WhnCylXD3fdFQ3b/z2PINELJcOtGikaKKGvNLceyMWJlfGY8pKf98Hmz7Dq+jcDr7DuFFVuzYRDQfi3N06o2w0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224292; c=relaxed/simple;
bh=4X95mHJDWKTAMJlKQG04hYb66R2l9Muxa2mv604C5rg=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=WSitwiGF08D/nWhIwd2ZYRw40jo+WYM4QxkeZULgszkQ//MFMg+YZGqiSViZOsb9YndfVY4daS6i7iBqYW3NKKZCgXut2oHi5F5BcXQSFS1nha6/DWHwAsRa1Cfve6l48bKGnLvvBVIoL9/OmvvPdC3RReSl0/5EiCJG8Zx6Mas=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=uLFwioCG; arc=none smtp.client-ip=90.155.50.34
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version:
References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:
Content-Transfer-Encoding:Content-ID:Content-Description;
bh=HePKWS3kmkS0czonpDaymeqsS5lCZ/0cwc3/yYKH/bc=; b=uLFwioCG2Nseyx2tnrhGq8Nxi1
Sfz/sC+K3CvFwxAEiypJIlw9KdR/UVYpNPtdQ6hyPlfj7SFuPK3nHWJHmRzBGE43yqR52BmRuWFPj
KmGGv6oiYGTZyNweWUKyJPy0Ch/EPWDuhR39M62USa0zBg/SSBz6Hk6aAVC5OiEh98kVnlZwpbNqB
F++TlKA1LIqZVdXzCBgFjNOOSga1c911dJlrf9cHvE4dGpFR+Vf10DCBR4V4E492AHUHJ99WvL1HZ
Hhs5Dw6B47QqgzeR5A/g9kCTfit5i0VZmUoYfsIgzMQTEGCPVYXFK9GmPzaGfX+B+qkMCEEjBDebJ
MOrLOgkA==;
Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net)
by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux))
id 1uNZ8r-00000005SHl-2YjK;
Fri, 06 Jun 2025 15:38:01 +0000
Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000)
id CC52C3005AF; Fri, 6 Jun 2025 17:38:00 +0200 (CEST)
Date: Fri, 6 Jun 2025 17:38:00 +0200
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
To: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Cc: mingo@xxxxxxxxxx, juri.lelli@xxxxxxxxxx, dietmar.eggemann@xxxxxxx,
rostedt@xxxxxxxxxxx, bsegall@xxxxxxxxxx, mgorman@xxxxxxx,
vschneid@xxxxxxxxxx, clm@xxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [RFC][PATCH 5/5] sched: Add ttwu_queue support for delayed tasks
Message-ID: <20250606153800.GB39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20250520094538.086709102@xxxxxxxxxxxxx>
<20250520101727.984171377@xxxxxxxxxxxxx>
<CAKfTPtDOQVEMRWaK9xEVqSDKcvUfai4CUck6G=oOdaeRBhZQUw@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAKfTPtDOQVEMRWaK9xEVqSDKcvUfai4CUck6G=oOdaeRBhZQUw@xxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 05:03:36PM +0200, Vincent Guittot wrote:
> On Tue, 20 May 2025 at 12:18, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > One of the things lost with introduction of DELAY_DEQUEUE is the
> > ability of TTWU to move those tasks around on wakeup, since they're
> > on_rq, and as such, need to be woken in-place.
>
> I was thinking that you would call select_task_rq() somewhere in the
> wake up path of delayed entity to get a chance to migrate it which was
> one reason for the perf regression (and which would have also been
> useful for EAS case) but IIUC, the task is still enqueued on the same
> CPU but the target cpu will do the enqueue itself instead on the local
> CPU. Or am I missing something ?

Correct. I tried to add that migration into the mix, but then things get
tricky real fast.

Just getting rid of the remote rq lock also helped; these dispatch
threads just need to get on with waking up tasks, any delay hurts.

> >
> > Doing the in-place thing adds quite a bit of cross-cpu latency, add a
> > little something that gets remote CPUs to do their own in-place
> > wakeups, significantly reducing the rq->lock contention.
> >
> > Reported-by: Chris Mason <clm@xxxxxxxx>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > ---
> > kernel/sched/core.c | 74 ++++++++++++++++++++++++++++++++++++++++++------
> > kernel/sched/fair.c | 5 ++-
> > kernel/sched/features.h | 1
> > kernel/sched/sched.h | 1
> > 4 files changed, 72 insertions(+), 9 deletions(-)
> >
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -3784,6 +3784,8 @@ static int __ttwu_runnable(struct rq *rq
> > return 1;
> > }
> >
> > +static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags);
> > +
> > /*
> > * Consider @p being inside a wait loop:
> > *
> > @@ -3811,6 +3813,33 @@ static int __ttwu_runnable(struct rq *rq
> > */
> > static int ttwu_runnable(struct task_struct *p, int wake_flags)
> > {
> > +#ifdef CONFIG_SMP
> > + if (sched_feat(TTWU_QUEUE_DELAYED) && READ_ONCE(p->se.sched_delayed)) {
> > + /*
> > + * Similar to try_to_block_task():
> > + *
> > + * __schedule() ttwu()
> > + * prev_state = prev->state if (p->sched_delayed)
> > + * if (prev_state) smp_acquire__after_ctrl_dep()
> > + * try_to_block_task() p->state = TASK_WAKING
> > + * ... set_delayed()
> > + * RELEASE p->sched_delayed = 1
> > + *
> > + * __schedule() and ttwu() have matching control dependencies.
> > + *
> > + * Notably, once we observe sched_delayed we know the task has
> > + * passed try_to_block_task() and p->state is ours to modify.
> > + *
> > + * TASK_WAKING controls ttwu() concurrency.
> > + */
> > + smp_acquire__after_ctrl_dep();
> > + WRITE_ONCE(p->__state, TASK_WAKING);
> > +
> > + if (ttwu_queue_wakelist(p, task_cpu(p), wake_flags | WF_DELAYED))
> > + return 1;
> > + }
> > +#endif
> > +
> > CLASS(__task_rq_lock, guard)(p);
> > return __ttwu_runnable(guard.rq, p, wake_flags);
> > }
> > @@ -3830,12 +3859,41 @@ void sched_ttwu_pending(void *arg)
> > update_rq_clock(rq);
> >
> > llist_for_each_entry_safe(p, t, llist, wake_entry.llist) {
> > + struct rq *p_rq = task_rq(p);
> > + int ret;
> > +
> > + /*
> > + * This is the ttwu_runnable() case. Notably it is possible for
> > + * on-rq entities to get migrated -- even sched_delayed ones.
>
> I haven't found where the sched_delayed task could migrate on another cpu.

Doesn't happen often, but it can happen. Nothing really stops it from
happening. Eg weight based balancing can do it. As can numa balancing
and affinity changes.


Return-Path: <linux-kernel+bounces-675956-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5B53041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:39:42 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A9A73A7B70
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:38:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 63A3A289804;
Fri, 6 Jun 2025 15:39:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fYcdotZl"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8601213DBA0;
Fri, 6 Jun 2025 15:39:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224342; cv=none; b=UywuJ/CQDf6mocX5UWYnPr6tXviHmaoBJtwZ6lSF8MRyvnw2h4JKmujC0TQOz+7Uull4QztmFybrZpD8z83ux563sLJELmQL3uyJDXs3hTcTsOJFDfF2bYZChgqAvbPAZTPJK62jOJjZFvsLA1eG4suFQy+OwoMyI9b8tl0+BmE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224342; c=relaxed/simple;
bh=UGLikP/qZtf4sFlH8DwnQ90HiF5s8Tor/O7KHagFCII=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=Bp+CpdCPWDx3Hwqfe3GUkwdM2qYAQBbAeWEGylbUmFGq568jALjUdfMxRwlCsideIh7xgb1Z/Y1oN5Kwq94OZvrnX6Tvf42o2UxFVY+omUdejCy+wKg7/e4/j9774w2pP3uUiZ6i8cnrYgtPqL5qqllJ0XHLXbpKB/IUldSa5+8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fYcdotZl; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D22DC4CEEB;
Fri, 6 Jun 2025 15:38:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224342;
bh=UGLikP/qZtf4sFlH8DwnQ90HiF5s8Tor/O7KHagFCII=;
h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
b=fYcdotZlDgIcxkH/gmjVHX8EnV5ANOEwY8ytcA8q4eQxIvAo/UWBbhUX+DFNwt2v2
AYptnw+3ludL/ltvelG9/35rShFPbF5FB/6Oef96qRed5lT/MB+fX/HvxdkSKkG64v
C+9y+KD/Otg/x4z4ceq3Pu3hsAiIeVfYm16k5yvV4WViyo1xMSu+5s/Wkfy4XPpxBo
kzCwDZNxPWh3tU5mozOdKQbp8QTt3OY49i4uiRxv1PnwNFXW0hfZOPRhAUjNtpWK5K
BYSeCCAwGzwolY6OT0MhiFlnBub8WL/eQ1ZHjxe0viTzeqMso18idgejLRHlwW4UCE
x162QIkqZN7OA==
Message-ID: <ce134894-f33e-4810-97ab-76270438fff7@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 17:38:55 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v2 3/5] rust: driver: Add ACPI id table support to Adapter
trait
To: Igor Korotin <igor.korotin.linux@xxxxxxxxx>,
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
Igor Korotin <igor.korotin@xxxxxxxxx>
Cc: Miguel Ojeda <ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>, Saravana Kannan <saravanak@xxxxxxxxxx>,
"Rafael J . Wysocki" <rafael@xxxxxxxxxx>, rust-for-linux@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, Boqun Feng <boqun.feng@xxxxxxxxx>,
Gary Guo <gary@xxxxxxxxxxx>, =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?=
<bjorn3_gh@xxxxxxxxxxxxxx>, Benno Lossin <benno.lossin@xxxxxxxxx>,
Andreas Hindborg <a.hindborg@xxxxxxxxxx>, Alice Ryhl <aliceryhl@xxxxxxxxxx>,
Trevor Gross <tmgross@xxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>,
Viresh Kumar <viresh.kumar@xxxxxxxxxx>,
Wedson Almeida Filho <wedsonaf@xxxxxxxxx>, Alex Hung <alex.hung@xxxxxxx>,
Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>,
Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605162726.3659792-1-igor.korotin@xxxxxxxxx> <aELyEqg0GrkC8oZY@pollux>
<CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx>
<2025060635-unleveled-drowsily-a192@gregkh>
From: Danilo Krummrich <dakr@xxxxxxxxxx>
Content-Language: en-US
In-Reply-To: <2025060635-unleveled-drowsily-a192@gregkh>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 5:29 PM, Greg Kroah-Hartman wrote:
> On Fri, Jun 06, 2025 at 03:26:13PM +0100, Igor Korotin wrote:
>> On Fri, Jun 6, 2025 at 2:50â?¯PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>>> However, I don't understand why we need this and the subsequent
>>> is_acpi_device_node() and is_of_node() checks.
>>
>> The idea is to avoid unnecessary table lookups when both OF and ACPI
>> match tables are present. If we already know the fwnode type, these
>> simple pointer comparisons (is_acpi_device_node() / is_of_node()) let
>> us skip the irrelevant match function.
>>
>> Those checks are cheap (just pointer comparisons), while
>> acpi_match_device() and of_match_device() iterate over tables.
>>
>> So yeah, itâ??s a bit ugly, but it can save some CPU cycles during enumeration.
>
> You have loads of CPU cycles during enumeration, keep things simple
> first, only attempt to optimize things later on if it is actually
> measureable.

I'm fine either way, I don't expect much value in optimizing this and at the
same time I don't see doing it adds significant complexity either.

If Greg prefers not to have this optimization to begin with, let's go without
it please.


Return-Path: <linux-kernel+bounces-675957-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7BC6D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:39:54 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id DDBE7179CB5
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:39:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2081D289839;
Fri, 6 Jun 2025 15:39:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S8US8CpF"
Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E2A7EEB5;
Fri, 6 Jun 2025 15:39:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224344; cv=none; b=C2d9VjdueZqZz0x41IUr6NJ49bSOwA+PzpLixUZ69kt0WG4LON2YPTkwZY9z9+Ip/RmBE0JYM5qhqPhMS7pYS0DGB4piqd51kp5m9vKmvaz3gPlyhqWKZ9XBobVT/SoDgMpon8ugbC4Fah+9W4qUQKD5cvQ8M6hXrgxX/DX8Xqo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224344; c=relaxed/simple;
bh=RU59iHBqI0534jwkspMLqvob00uxei2xVKtkzhefafQ=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=lyWoSPfq6QYMedZuNmIOA65cA8ljdtVo2EH5Y5bdahLPLQZ7zEHRi2LKMxlaSMclI9a/dtUedQFzW6GuWwDSNa2PwHsrXwcf53OCfE28amU5iKI0f0/y/gF8RFx4NMetlaPWpOV98tW3w7SMuZjBBY948KocE/E5UViiprjxvN8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=S8US8CpF; arc=none smtp.client-ip=209.85.128.44
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4508287895dso21633785e9.1;
Fri, 06 Jun 2025 08:39:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749224341; x=1749829141; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=t6NY6udn4zLxxSCFsYax6o0dwGkH5UV6tkVSlHy2EN0=;
b=S8US8CpF6MFYkHoDEojVV/gg0qXHlLgzLF6V3NpBqL1LqAJaG53nlgYUA78BASR4XK
LEvmn1uA2+bD9HClHnJX4fA2C4eqE9F68uwCZRfkXaLaR40nLGOsyZXw1SCt1GpQRgry
NfdJ7bceORBGKKnfEJ9LZZ1XqioBw+JzpJLc1cqDAVVoCk9it9k6MTKXxCYtTAO5xxrk
2/TblA3dpkc+na70TVDAHmuIRKnMeQCx+CwcLy+nBNlOfj6xIeExfn3H3/DBA/Z7AGpw
65bZwgn4XZALVnGByWg0sRhgTx+sJi2lpFxJlFyWi5+48pnGAAZzyOPU+Gg0J28rQPDf
APQw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749224341; x=1749829141;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=t6NY6udn4zLxxSCFsYax6o0dwGkH5UV6tkVSlHy2EN0=;
b=hpJXzYRyYVM0M652SRkQXWrbzix4noooInDLERfJRYJAkoVevm7Vjf6hoO+dgTMxGQ
sWRAqDecc5+bU0ar92xTgxU/lHRDY8iM/gAoUtD4NHcW2g0FURN22wPdGkLUfTBADFxM
cbcfFDstWfA1LEDr7IWsOCCm1lL74CFF4xFTIpQTB1QqJI2ZPX/+R3Iv64WWImWKU8GR
gjIBi6tEZMpVrrD0H5a3YlW6h0JLQPFhKdA2pVzTcvnqjwCoPX+D/Umo1aw8hY/HLEKW
8i4kL5E6xMNGGE2rPyLKV2DbiFgB5V971QhEmzAdVtuznO7CGfbDmhq7tInwM+rdVtNh
+rjQ==
X-Forwarded-Encrypted: i=1; AJvYcCVWu0AE+TQH4hP8hnwio0E6qaA2T0zQN9/9L6v8MBL7sHHwybAe+e+Jci0nMspVMZmn0bReu5mtAq4=@vger.kernel.org, AJvYcCWvK6aC2t95S/bDe4KmfOI6P9zUV1OYvRX37Z5rvGFrHKOyyP/OGmQyw7lk7UzsmkJRqzijYXLcU3+8nloz@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YwLvp4x5+r6K1Q2TtuUs1GxCYLeRYKbxxk1yCgORmRyB7Ibj/IV
a91FKpAV8z5qdqlubneZJ49rdUAerHZvC7J3ZWF+MbiO+OIck7i3A6CX
X-Gm-Gg: ASbGncvpfQo+misTICtcLqF4kgYJLzRlOBnPOuo1+gSmZtPYXvBuOb3eyJiB4aLAmif
XvVkhrMwrLmCbRQCAJHXhR5BbEZs83VN7E9XiiJ2rhtcSCS3aoP74VSQmib4ynDn/tatVEWMYDV
Ffo5RjXPaVkWxiX5rFvQzBLGw1Js2bkaHbLrn48IRSdNQ037y8P25jhaJ2RUCz744Xfs3ufMy8d
7sRQjwmSjBsv4KT2bQtiGyzFDXyobR9mkGRVdm29fZS1QeeyASMB94KEkYkrbPqEWewlZMrBKlm
IYOkGBOXh5BUsXgfqUnnZVo41c4Sa8mobSBseOEp2KuveeOkKcDwc1DdgK5bW2MHm1LCtH2fRHN
qWSk5rmV25NjEDAi97wT+xvGybOhn3BHGFus5t4XqMzXgRIk=
X-Google-Smtp-Source: AGHT+IGhSK2qefvHASJtcgqAzBf89NtW7wxEsbwEa2hrZjYh8Rmd7yqQOgg3ab9Crxdjf/74+VmliQ==
X-Received: by 2002:a05:6000:144e:b0:3a4:ce5c:5e8d with SMTP id ffacd0b85a97d-3a526e0cf3emr7962984f8f.20.1749224340338;
Fri, 06 Jun 2025 08:39:00 -0700 (PDT)
Received: from ?IPV6:2a02:6b6f:e750:f900:146f:2c4f:d96e:4241? ([2a02:6b6f:e750:f900:146f:2c4f:d96e:4241])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324520e7sm2205547f8f.84.2025.06.06.08.38.59
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 08:38:59 -0700 (PDT)
Message-ID: <b807deec-99a9-4691-9001-c2f3adf586b9@xxxxxxxxx>
Date: Fri, 6 Jun 2025 16:38:59 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [RFC] mm: khugepaged: use largest enabled hugepage order for
min_free_kbytes
To: Zi Yan <ziy@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, david@xxxxxxxxxx,
linux-mm@xxxxxxxxx, hannes@xxxxxxxxxxx, shakeel.butt@xxxxxxxxx,
riel@xxxxxxxxxxx, baolin.wang@xxxxxxxxxxxxxxxxx, lorenzo.stoakes@xxxxxxxxxx,
Liam.Howlett@xxxxxxxxxx, npache@xxxxxxxxxx, ryan.roberts@xxxxxxx,
dev.jain@xxxxxxx, hughd@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-doc@xxxxxxxxxxxxxxx, kernel-team@xxxxxxxx,
Juan Yescas <jyescas@xxxxxxxxxx>, Breno Leitao <leitao@xxxxxxxxxx>
References: <20250606143700.3256414-1-usamaarif642@xxxxxxxxx>
<A409F7B3-A901-40F9-A694-DC3FB00B57FE@xxxxxxxxxx>
Content-Language: en-US
From: Usama Arif <usamaarif642@xxxxxxxxx>
In-Reply-To: <A409F7B3-A901-40F9-A694-DC3FB00B57FE@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 06/06/2025 16:18, Zi Yan wrote:
> On 6 Jun 2025, at 10:37, Usama Arif wrote:
>
>> On arm64 machines with 64K PAGE_SIZE, the min_free_kbytes and hence the
>> watermarks are evaluated to extremely high values, for e.g. a server with
>> 480G of memory, only 2M mTHP hugepage size set to madvise, with the rest
>> of the sizes set to never, the min, low and high watermarks evaluate to
>> 11.2G, 14G and 16.8G respectively.
>> In contrast for 4K PAGE_SIZE of the same machine, with only 2M THP hugepage
>> size set to madvise, the min, low and high watermarks evaluate to 86M, 566M
>> and 1G respectively.
>> This is because set_recommended_min_free_kbytes is designed for PMD
>> hugepages (pageblock_order = min(HPAGE_PMD_ORDER, PAGE_BLOCK_ORDER)).
>> Such high watermark values can cause performance and latency issues in
>> memory bound applications on arm servers that use 64K PAGE_SIZE, eventhough
>> most of them would never actually use a 512M PMD THP.
>>
>> Instead of using HPAGE_PMD_ORDER for pageblock_order use the highest large
>> folio order enabled in set_recommended_min_free_kbytes.
>> With this patch, when only 2M THP hugepage size is set to madvise for the
>> same machine with 64K page size, with the rest of the sizes set to never,
>> the min, low and high watermarks evaluate to 2.08G, 2.6G and 3.1G
>> respectively. When 512M THP hugepage size is set to madvise for the same
>> machine with 64K page size, the min, low and high watermarks evaluate to
>> 11.2G, 14G and 16.8G respectively, the same as without this patch.
>
> Getting pageblock_order involved here might be confusing. I think you just
> want to adjust min, low and high watermarks to reasonable values.
> Is it OK to rename min_thp_pageblock_nr_pages to min_nr_free_pages_per_zone
> and move MIGRATE_PCPTYPES * MIGRATE_PCPTYPES inside? Otherwise, the changes
> look reasonable to me.

Hi Zi,

Thanks for the review!

I forgot to change it in another place, sorry about that! So can't move
MIGRATE_PCPTYPES * MIGRATE_PCPTYPES into the combined function.
Have added the additional place where min_thp_pageblock_nr_pages() is called
as a fixlet here:
https://lore.kernel.org/all/a179fd65-dc3f-4769-9916-3033497188ba@xxxxxxxxx/

I think atleast in this context the orginal name pageblock_nr_pages isn't
correct as its min(HPAGE_PMD_ORDER, PAGE_BLOCK_ORDER).
The new name min_thp_pageblock_nr_pages is also not really good, so happy
to change it to something appropriate.
>
> Another concern on tying watermarks to highest THP order is that if
> user enables PMD THP on such systems with 2MB mTHP enabled initially,
> it could trigger unexpected memory reclaim and compaction, right?
> That might surprise user, since they just want to adjust availability
> of THP sizes, but the whole system suddenly begins to be busy.
> Have you experimented with it?
>

Yes I would imagine it would trigger reclaim and compaction if the system memory
is too low, but that should hopefully be expected? If the user is enabling 512M
THP, they should expect changes by kernel to allow them to give hugepage of
that size.
Also hopefully, no one is enabling PMD THPs when the system is so low on
memory that it triggers reclaim! There would be an OOM after just a few
of those are faulted in.

Thanks!



Return-Path: <linux-kernel+bounces-675958-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A78B741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:41:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 20ECB18839B3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:41:45 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FE63288CB7;
Fri, 6 Jun 2025 15:41:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="a4JMcvhu"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 108BBEEB5
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:41:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224483; cv=none; b=PmGiI1zB3ZGdvi0HotkkI/iYckqxrhgEixQSNa381LFiwjHBGLpz5/KgEiBUuZd6VDF3O4n1bHnGfQmOzyCmuBbhwFbeEEqPhw02BcyMpZH4u03Y6GGqARdUtHFEMwwnTennsL5MAKjsAM+VYzG38hdSeR5wZynoM4wOHU1jurM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224483; c=relaxed/simple;
bh=/7iBzU3r1GPozEcYGhCVGVjgk634/K7NdYqe7dm2+gw=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=grfi57gIM4/Z+cSC+v9LOEzZFmjxLKqbMmhM55uCDt0saSi0e7uPgiUnk+0T4DHJ19FiGYvO6psddMvQUnd91JMcV3Nq5OixWtEu+Vk0SaCmjUrelLKsnCakenJ13SsKZmcLvhrhGq9cgxolmodZJId/Rhb3Q4worq5J3mvMc14=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=a4JMcvhu; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749224479;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=NZqzUrzNJKUWHGvlIX3S4FYdgn3FdTRfiGRa2Z5gBww=;
b=a4JMcvhuJ+YgcSd5F++OxqaRjitRYNOHXWLYGD30ZvNVpDCTE/U6M39JzqQPEc2Y1CUaKu
5PBd7SmT3HXp6qlJl3MOp/5xIOq63VEpIeACE29aLh9Ok532wsro3mzVyiKUcuvsQ4wh0o
NKVSVxX4RWsh8aNDe4QR8J/mnln7k/o=
Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-510-iF9Zgw1FOGG9JcWAhdL19w-1; Fri,
06 Jun 2025 11:41:17 -0400
X-MC-Unique: iF9Zgw1FOGG9JcWAhdL19w-1
X-Mimecast-MFC-AGG-ID: iF9Zgw1FOGG9JcWAhdL19w_1749224476
Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0191519560A6;
Fri, 6 Jun 2025 15:41:16 +0000 (UTC)
Received: from fedora.redhat.com (unknown [10.45.225.251])
by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E08811956050;
Fri, 6 Jun 2025 15:41:13 +0000 (UTC)
From: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
To: Ard Biesheuvel <ardb@xxxxxxxxxx>
Cc: Luiz Capitulino <luizcap@xxxxxxxxxx>,
linux-efi@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] efi: Drop preprocessor directives from zboot.lds
Date: Fri, 6 Jun 2025 17:41:12 +0200
Message-ID: <20250606154112.311565-1-vkuznets@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Older versions of `ld` don't seem to support preprocessor directives in
linker scripts, e.g. on RHEL9's ld-2.35.2-63.el9 the build fails with:

ld:./drivers/firmware/efi/libstub/zboot.lds:32: ignoring invalid character `#' in expression
ld:./drivers/firmware/efi/libstub/zboot.lds:33: syntax error

We don't seem to need these '#ifdef', no empty .sbat section is created
when CONFIG_EFI_SBAT_FILE="":

# objdump -h arch/arm64/boot/vmlinuz.efi

arch/arm64/boot/vmlinuz.efi: file format pei-aarch64-little

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00b94000 0000000000001000 0000000000001000 00001000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000200 0000000000b95000 0000000000b95000 00b95000 2**2
CONTENTS, ALLOC, LOAD, DATA

Fixes: 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")
Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
---
Note: not-yet-merged x86 version of 0f9a1739dd0e does not seem to be affected
as vmlinux.lds script is a pre-processed version of vmlinux.lds.S.
---
drivers/firmware/efi/libstub/zboot.lds | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/firmware/efi/libstub/zboot.lds b/drivers/firmware/efi/libstub/zboot.lds
index c3a166675450..4b8d5cd3dfa2 100644
--- a/drivers/firmware/efi/libstub/zboot.lds
+++ b/drivers/firmware/efi/libstub/zboot.lds
@@ -29,14 +29,12 @@ SECTIONS
. = _etext;
}

-#ifdef CONFIG_EFI_SBAT
.sbat : ALIGN(4096) {
_sbat = .;
*(.sbat)
_esbat = ALIGN(4096);
. = _esbat;
}
-#endif

.data : ALIGN(4096) {
_data = .;
--
2.49.0



Return-Path: <linux-kernel+bounces-675959-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5088A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:42:15 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9DC2F161FCE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:42:16 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A854289832;
Fri, 6 Jun 2025 15:41:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D8cKfEuZ"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8660F13DBA0;
Fri, 6 Jun 2025 15:41:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224518; cv=none; b=Qs/w55wl/5ww8zK7q0TVKMliZeSP8NVAP1rRqkPxV/nUX8+9R7JnuMt8Wcpxf79evsRkpGZvGfX6r6FIhmwtq/TBFdrclMdz5whUS1GPrFxM4pWnI9wSApBkBX73LqdZWm0QdrDjzP6pKx6F6g+iXUaDfB/SvhYxGOTRTgfiq0Y=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224518; c=relaxed/simple;
bh=2igutj4SSLBAJdSGlH3+Gl6xmdswJeM1ZN3pALT+e70=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=S/i8d9ustmUAen0iG1PMUovyl9OFdi31St+mPpyZvkrplurk6Ad5Gka20CL5GAkXHYAEAuojiqiJMwj4noaRxFJcLrt0ZopoPNjc0SO6ufxwBL3zqrBYesfTUCgxkChbAlSwYfPLhsC6VOo22mWJuMrMOJYOJ7vX16LbaW4tjjY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D8cKfEuZ; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32071C4CEEB;
Fri, 6 Jun 2025 15:41:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224518;
bh=2igutj4SSLBAJdSGlH3+Gl6xmdswJeM1ZN3pALT+e70=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=D8cKfEuZA1CSoQGcKhZ2rCSxCE6rWNKNFOp2IlsNaXHDyJP2jp32d8EQMKeuKgp95
o+IJ5qR6KYFRLQoWdSWJn2Bu79rMukEA85bskaH7gM/1A2ookONR6M6nYSUsT3l28l
dM0ZuVb07XvQWpo+u5uce9Do7xXF9PJSPfw6Cb19V3FullPVCSAnhRHd+Cu87q63Mx
SoZCEk7bOe23UyIafUKqzVfbu9FPBsB7nU2fJi9lvNUOZiguvSeYx4TAHORWYSxk8l
1LJ5iOTLz1+yZlhZbTG59gUF4ThlZ4Yn9hzTLHP9yEvs18Euzarnl3TNq98RCV78Yu
iVyvb9LCvTyYA==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Peng Fan <peng.fan@xxxxxxx>,
Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.15 07/21] mailbox: Not protect module_put with spin_lock_irqsave
Date: Fri, 6 Jun 2025 11:41:32 -0400
Message-Id: <20250606154147.546388-7-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154147.546388-1-sashal@xxxxxxxxxx>
References: <20250606154147.546388-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.15.1
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peng Fan <peng.fan@xxxxxxx>

[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]

&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
Signed-off-by: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES** This commit should be backported to stable kernel trees.
**Analysis:** 1. **Clear Bug Fix**: The commit fixes an improper use of
`module_put()` under a spinlock in `mbox_free_channel()`. Looking at the
current code in `/home/sasha/linux/drivers/mailbox/mailbox.c:489`,
`module_put()` is called while holding `&chan->lock` with
`spin_lock_irqsave()`. 2. **Locking Inconsistency**: The commit message
correctly identifies that `&chan->lock` is not supposed to protect
`chan->mbox`. In `__mbox_bind_client()` (line 324),
`try_module_get(chan->mbox->dev->driver->owner)` is called **outside**
the spinlock protection, making the current `module_put()` placement
inconsistent. 3. **Minimal Risk Change**: The fix is extremely simple
and low-risk - it just moves one line (`module_put()`) outside the
spinlock region. This maintains the same operation order but fixes the
locking issue. 4. **No Side Effects**: Moving `module_put()` outside the
lock doesn't change the functionality or introduce new race conditions.
The `module_put()` implementation uses `atomic_dec_if_positive()`, so
it's safe to call without additional locking. 5. **Follows Stable
Rules**: This commit: - Fixes a real locking issue that could
potentially cause problems - Is small and contained (single line move) -
Has minimal regression risk - Doesn't introduce new features or
architectural changes 6. **Similar Pattern**: Looking at similar commits
in the historical references, commits that fix locking issues (like
Similar Commit #5 which fixed a locking bug in mailbox-test) were marked
as YES for backporting. The commit addresses a legitimate kernel locking
violation where `module_put()` should not be called under a spinlock,
making it a suitable candidate for stable tree backporting.

drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 0593b4d036859..aea0e690b63ee 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -486,8 +486,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;

- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);

--
2.39.5



Return-Path: <linux-kernel+bounces-675960-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 17F3C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:42:31 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 24D5A3A99C9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:42:08 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 607CF289E24;
Fri, 6 Jun 2025 15:42:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BoIaFOBA"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 977C0289376;
Fri, 6 Jun 2025 15:42:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224520; cv=none; b=Om6i2c5nDhRgQrQFGKLHa+XhubgcTyEEsPMARpcLdZSThfun6qvvcQkvAYLTfX+kCsud5rEnNUb9MG5D61MDFuC1T6OvYbjnc67QgcgwhFLkMP+As5TvHzjJddCy9lUvOkS5vTW3N4Yb+NpZQ8LmiitDF78Iirb25eJ0ZXk7La0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224520; c=relaxed/simple;
bh=cSV2s7RixPkjrBSQuDprrXa/GlT3m+vYjOcot1cKvq8=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=nyeM0G4NfQBerS40CB8BMwdRtceqUvvUpJ33l7Yl1lh7uMCFt2fr+M/CvxHioWsny7NZuqWrpdWUHFwUktApY7Pp+568HBBge8iJ47vxx+jsmphdslMDnK4mSbwF7tJA1ZzAdXV62N2cwM5IvcqXPmA+DuNxSDFISL54bblZVyY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BoIaFOBA; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E20CC4CEEB;
Fri, 6 Jun 2025 15:41:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224520;
bh=cSV2s7RixPkjrBSQuDprrXa/GlT3m+vYjOcot1cKvq8=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=BoIaFOBAaQrEHFuG91nXISJ5LQwWnfty/Zs/y4GSp34JJWmB0pUUTSq0VJm2Y4n8C
ypu4ITvJsguB8r69f4sLfbDJ7pZNZt/KvCwttN9NglPPw3aDAMuUPMmgGPl07QMDFO
ZenDofBQrxrygo92avNZ7pRk0LB8RVloacQhGctO1FiBSPdsvA0NsH4m274WHZPiVr
Y2mtVxuLqHe2zucHmt//dx4ny399/31hD3dbmf6jvVG0TcNJf5LOzEEn85aJ5DT8UD
L9uLvrCw2Eds8oXw1USF/3MbZReJsm0hIz+OMVFW5rKf0IUFFT5/PHtUHsVAVdDUaK
iZitxlOTx7AwA==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.15 09/21] mfd: max14577: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:41:34 -0400
Message-Id: <20250606154147.546388-9-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154147.546388-1-sashal@xxxxxxxxxx>
References: <20250606154147.546388-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.15.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-3-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

Now let me understand the difference between the fixes - the historical
commits show two patterns:
1. Using `devm_device_init_wakeup()` - automatically handles cleanup
2. Manual cleanup by calling `device_init_wakeup(dev, false)` in remove
functions

Let me check if this specific commit has `Cc: stable@xxxxxxxxxxxxxxx` in
the message:

Based on my analysis of this commit and comparison with the similar
historical commits, here is my assessment:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Analysis

### **Code Change Analysis**
The commit adds a single line in the `max14577_i2c_remove()` function:
```c
+ device_init_wakeup(max14577->dev, false);
```

This addition occurs at drivers/mfd/max14577.c:459, right before
`mfd_remove_devices()` is called.

### **Bug Fix Characteristics**
1. **Memory Leak Fix**: The commit fixes a wakeup source memory leak
that occurs when the device is unbound. When `device_init_wakeup(dev,
true)` is called during probe (line 442), it allocates memory for
wakeup source structures. Without the corresponding cleanup call,
this memory is leaked on device removal.

2. **Small and Contained**: The fix is minimal - a single line addition
that mirrors the cleanup pattern used throughout the kernel.

3. **Low Risk**: The change has extremely low regression risk since it
only adds proper cleanup that should have been there originally.

### **Comparison with Historical Similar Commits**
Looking at the provided historical commits, there are two categories:

**YES commits (backported)**:
- `gpio: mpc8xxx: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`
- `gpio: zynq: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`

**NO commits (not backported)**:
- IIO driver commits that use `devm_device_init_wakeup()` instead of
manual cleanup

The key difference is that the YES commits use the same fix pattern as
this MFD commit - manual cleanup in the remove function, while the NO
commits use the `devm_` managed approach that automatically handles
cleanup.

### **Impact Assessment**
- **User Impact**: Memory leaks on device unbind affect systems where
MFD devices are frequently bound/unbound
- **Subsystem**: MFD (Multi-Function Device) is a core kernel subsystem
used by many embedded systems
- **Regression Risk**: Minimal - adding proper cleanup cannot cause
functional regression

### **Stable Tree Criteria Met**
1. â?? Fixes an important bug (memory leak)
2. â?? Small and contained change
3. â?? No architectural changes
4. â?? Minimal risk of regression
5. â?? Follows established patterns seen in other backported commits

The commit follows the exact same pattern as the GPIO driver commits
that were successfully backported to stable trees (commits #1 and #2 in
the historical examples), making it a clear candidate for backporting.

drivers/mfd/max14577.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 6fce79ec2dc64..7e7e8af9af224 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -456,6 +456,7 @@ static void max14577_i2c_remove(struct i2c_client *i2c)
{
struct max14577 *max14577 = i2c_get_clientdata(i2c);

+ device_init_wakeup(max14577->dev, false);
mfd_remove_devices(max14577->dev);
regmap_del_irq_chip(max14577->irq, max14577->irq_data);
if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
--
2.39.5



Return-Path: <linux-kernel+bounces-675961-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 48A3541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:42:41 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3284A3AEAC2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:42:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 239D228A1C2;
Fri, 6 Jun 2025 15:42:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FXww4luO"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C9DF289E2A;
Fri, 6 Jun 2025 15:42:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224522; cv=none; b=FdTd3vN13/u14b2RQyhCRnNQVrLVSL7L7XJ5TXUUvs5m9efSMlxNK/9LGgDSE9husOyocFxo9CxHsuxWuNAMaVIhTNh2EJLpAsapRvj9Mbo5nEzBIt/qPFVq7+fRuf82VTaJrCh54s23MBxRFBckrg1Mwrva8kRiznlFttWV0wU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224522; c=relaxed/simple;
bh=tiPe0dPe4UwN7HqdxG/tSbJJaFiRrqkxXdZlcNBDMsQ=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=S6D3bPgdKw2GZBMnuRLTaXi1jEXA2Je98PQA9A0ICAjc8YIffWyDnc32qdQIfXxo6qUpsewf6dF4WsKAzkD4oWFUfGzGteb1cheWDr7AhHZbkhrbefsJHHrHNarFgykO/+TFQr80WBVzGq4i8fn9uw6+GDMDHHRuIZfGnJ+B/w4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FXww4luO; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF14AC4CEF1;
Fri, 6 Jun 2025 15:42:00 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224521;
bh=tiPe0dPe4UwN7HqdxG/tSbJJaFiRrqkxXdZlcNBDMsQ=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=FXww4luOf9z82lFs/omMf3NuX51KfZTRRYMBeMpjiD2TurYjklLuxZpeKTqP/zjv+
28pkNPP4rLkIcinq6iSn4MW1n6LzP1USc1nroUsFEBps49GBgGoLQeVoVuKBdwi7Sv
VScnZyRNvRbENzPzXP/0ZiEBHszdQtaI1gkQibhRu29gNjQ3QO8nWB0VXvvYkgSPq/
SyxkksdWclFDgBsGeKXFojnpzOpp2uMGnkadwnGnGGfkjwSvZGmCi40jLiLUTW6bPf
4TgKuLQNQtI52KDdm6rZr5TfNBlBi4yfl74elIfQH81hB1mbqVhk+RRqahCrnBQFN1
Xj0mGM3N+7o8A==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.15 10/21] mfd: max77705: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:41:35 -0400
Message-Id: <20250606154147.546388-10-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154147.546388-1-sashal@xxxxxxxxxx>
References: <20250606154147.546388-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.15.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit a59a56cc4fb1f7d101f7ce1f5396ceaa2e304b71 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-5-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES**

This commit should be backported to stable kernel trees. Here's my
extensive analysis:

## Code Change Analysis

The commit changes line 134 in `drivers/mfd/max77705.c` from:
```c
device_init_wakeup(dev, true);
```
to:
```c
ret = devm_device_init_wakeup(dev);
if (ret)
return dev_err_probe(dev, ret, "Failed to init wakeup\n");
```

This is a classic **resource leak fix** pattern where the driver was
using `device_init_wakeup()` without proper cleanup on device unbind,
which causes memory leaks for the wakeup source.

## Backport Suitability Assessment

### 1. **Fixes a Real Bug**: â?? YES
- This fixes a memory leak that occurs when devices are unbound from the
driver
- The wakeup source memory is not released without proper cleanup
- This affects real user scenarios where devices can be unbound/rebound

### 2. **Small and Contained Change**: â?? YES
- Only 3 lines changed: 1 deletion, 2 additions
- Single function modification in probe path
- No architectural changes whatsoever
- Extremely localized to wakeup source initialization

### 3. **Low Risk of Regression**: â?? YES
- `devm_device_init_wakeup()` is a well-established managed resource
pattern
- Same functionality as original but with automatic cleanup
- The change follows standard kernel resource management patterns
- No behavior change except proper cleanup

### 4. **Pattern Consistency**: â?? YES
>From the git history analysis, I found this is part of a systematic fix
series by Krzysztof Kozlowski addressing the same issue across multiple
subsystems:
- `gpio: mpc8xxx: Fix wakeup source leaks` - **marked with Cc:
stable@xxxxxxxxxxxxxxx**
- `gpio: zynq: Fix wakeup source leaks` - **marked with Cc:
stable@xxxxxxxxxxxxxxx**
- Similar fixes in iio, watchdog, mfd subsystems with identical patterns

### 5. **Critical Subsystem**: â?? YES
- MFD (Multi-Function Device) drivers are core platform drivers
- MAX77705 is a PMIC (Power Management IC) used in mobile devices
- Resource leaks in power management components can lead to system
instability

### 6. **Stable Tree Compatibility**: â?? YES
- The `devm_device_init_wakeup()` function has been available since
early kernel versions
- No new API dependencies
- The fix pattern is well-established and widely used

### 7. **Related Evidence**:
The companion commits in the same series (`gpio: mpc8xxx` and `gpio:
zynq`) were **explicitly tagged with `Cc: stable@xxxxxxxxxxxxxxx`**,
indicating the author and maintainers consider this class of fix
appropriate for stable backporting.

**Conclusion**: This is a textbook stable candidate - a small, safe
resource leak fix that addresses a real problem with minimal risk and
follows established patterns that have been deemed stable-worthy in the
same patch series.

drivers/mfd/max77705.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/max77705.c b/drivers/mfd/max77705.c
index 60c457c21d952..6b263bacb8c28 100644
--- a/drivers/mfd/max77705.c
+++ b/drivers/mfd/max77705.c
@@ -131,7 +131,9 @@ static int max77705_i2c_probe(struct i2c_client *i2c)
if (ret)
return dev_err_probe(dev, ret, "Failed to register child devices\n");

- device_init_wakeup(dev, true);
+ ret = devm_device_init_wakeup(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to init wakeup\n");

return 0;
}
--
2.39.5



Return-Path: <linux-kernel+bounces-675962-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 94FB041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:43:39 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7F80D3B20F8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:43:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9514228A3F8;
Fri, 6 Jun 2025 15:42:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tLrDY8Jb"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC4BA28A3E4;
Fri, 6 Jun 2025 15:42:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224556; cv=none; b=aRUNYh965ngmPcpFKCxPixnEEwOnmAZgvgRAXmL7rNtRYvdqnQPrRGrHa9Fgt803479b33ur52TuVcSnus5IhUBmgwQkDIOYXNLxjd1OVJ8xrUpDkTK4dqoHRa5YEOfbEYPxfPzu248zoDoGENiur7G/SbjqRMXZ8EmVXMVRBWU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224556; c=relaxed/simple;
bh=JvxKiUvZup5FCydVPN8K3QMiW0hQscyESTJprVJQzbg=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=aIczj2JJJuJdXO61281a3DCc+Snr9UOLEcAL5qJnXm64XxtMNOGUJeCjRe168qA/5Z5xbOpsL9m1SB5E9QhF89aIE0Qb8UQbY3ySeIEdJjtc8W4psLrLz7ZP3TfvnyXA75n5gBXKZQil2n0wn04Nz5lzUW31/+j6bt8wDItOEAk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tLrDY8Jb; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id C69E2C4CEEB;
Fri, 6 Jun 2025 15:42:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224556;
bh=JvxKiUvZup5FCydVPN8K3QMiW0hQscyESTJprVJQzbg=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=tLrDY8JbjeNoVk8DVJ6ZNyhX5fDvG3Uvo4VAP9rTlltytl2/6fVIhp9z8/ASMLJ+s
eEsarX1hCZsVRMc9JGxfhHe+b/5Gub+7mHzydC7yvgEt93kofgfJk1Th6XJZ34CTLW
WNfRggRuRcoT4TFZlncQk9UimNY9BpOMN9i4HQKcWWzL3Z1eBF/GQlo3pJkjA106BM
g4jDP8dQtGlb4eIbi+gfYaHtZecHwLtW2X8SkPK6bLf9UiYEpYyNJV2PNqxo1uCz7A
gMjJhmWsDXN3TRMFHvfGmKzmx8LWY0XcFA1gTlYqwdPLcXWnijEuxS6gn7x+HC87a7
0AC3CnODB1EKA==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Peng Fan <peng.fan@xxxxxxx>,
Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.14 07/19] mailbox: Not protect module_put with spin_lock_irqsave
Date: Fri, 6 Jun 2025 11:42:13 -0400
Message-Id: <20250606154225.546969-7-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154225.546969-1-sashal@xxxxxxxxxx>
References: <20250606154225.546969-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.14.10
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peng Fan <peng.fan@xxxxxxx>

[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]

&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
Signed-off-by: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES** This commit should be backported to stable kernel trees.
**Analysis:** 1. **Clear Bug Fix**: The commit fixes an improper use of
`module_put()` under a spinlock in `mbox_free_channel()`. Looking at the
current code in `/home/sasha/linux/drivers/mailbox/mailbox.c:489`,
`module_put()` is called while holding `&chan->lock` with
`spin_lock_irqsave()`. 2. **Locking Inconsistency**: The commit message
correctly identifies that `&chan->lock` is not supposed to protect
`chan->mbox`. In `__mbox_bind_client()` (line 324),
`try_module_get(chan->mbox->dev->driver->owner)` is called **outside**
the spinlock protection, making the current `module_put()` placement
inconsistent. 3. **Minimal Risk Change**: The fix is extremely simple
and low-risk - it just moves one line (`module_put()`) outside the
spinlock region. This maintains the same operation order but fixes the
locking issue. 4. **No Side Effects**: Moving `module_put()` outside the
lock doesn't change the functionality or introduce new race conditions.
The `module_put()` implementation uses `atomic_dec_if_positive()`, so
it's safe to call without additional locking. 5. **Follows Stable
Rules**: This commit: - Fixes a real locking issue that could
potentially cause problems - Is small and contained (single line move) -
Has minimal regression risk - Doesn't introduce new features or
architectural changes 6. **Similar Pattern**: Looking at similar commits
in the historical references, commits that fix locking issues (like
Similar Commit #5 which fixed a locking bug in mailbox-test) were marked
as YES for backporting. The commit addresses a legitimate kernel locking
violation where `module_put()` should not be called under a spinlock,
making it a suitable candidate for stable tree backporting.

drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index cb174e788a96c..92c2fb618c8e1 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -490,8 +490,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;

- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);

--
2.39.5



Return-Path: <linux-kernel+bounces-675963-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 52C5441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:44:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id BA9341799E8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:43:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 568B928A407;
Fri, 6 Jun 2025 15:42:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LHo0E9mz"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E1D328A411;
Fri, 6 Jun 2025 15:42:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224559; cv=none; b=KmZ+uSdxdGfAOAMKV4yFacWABsTP+IR9NVFAqWfCHm6kKA9Q/f3Bh9civG5+EnpJusOV7mTUqWPipvF26CHpcll4S1ZspU1HXMb/lmXL5F8Uy8PkIekc9s7o59g0SsH8aQ4GwX2liWRGMgxPUYBMmGYEFHS3NKMIEG5khcGAPEU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224559; c=relaxed/simple;
bh=cSV2s7RixPkjrBSQuDprrXa/GlT3m+vYjOcot1cKvq8=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=Zhnbdo2EkziLf0bgrN9FSNJy7UfNXwwqpeU74DZSooEcHOL0NWRUHX2wWMp+t2lgk/f6yc8jYLzLLHl1Osu7NRN1iRHIxKD5EfXcL9MryZhIbu0q++jDOaUsL5TUXC3LXMXsA6YU679jsMomaSaFiNGl9h0FuEghNe/D8P5UGno=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LHo0E9mz; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C8DDC4CEF0;
Fri, 6 Jun 2025 15:42:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224559;
bh=cSV2s7RixPkjrBSQuDprrXa/GlT3m+vYjOcot1cKvq8=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=LHo0E9mzcLxlNPpzNG655U1uhglA4dziPUkJMFWeDOhfJl9ZUIUdRiBXFyiwU6Yqe
zYmXhDaHcMvG224dW7ixzAYnIWUXWzmRDATJR55Gv1j82Yp8fJORgFWzqQ1gCyXU4+
SzXbioKnIhZxE+gFKdtEKURyDeuv+P039G7Qn+k1Q6FgSXGjh/L1Pho2jEzAL7fU5e
eMbwRj9T7DT43nmciAvvAh/Ksdm9WSdQS49PAqb7qfxM5aComYysyewki166hNKGk3
PcV9KIrazTXlET30BWHlLigRS6CxLYc13P2OMiwdhQs90lxbmqY50DVfdlURDHFlNV
wp41Dl7WVAppw==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.14 09/19] mfd: max14577: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:42:15 -0400
Message-Id: <20250606154225.546969-9-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154225.546969-1-sashal@xxxxxxxxxx>
References: <20250606154225.546969-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.14.10
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-3-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

Now let me understand the difference between the fixes - the historical
commits show two patterns:
1. Using `devm_device_init_wakeup()` - automatically handles cleanup
2. Manual cleanup by calling `device_init_wakeup(dev, false)` in remove
functions

Let me check if this specific commit has `Cc: stable@xxxxxxxxxxxxxxx` in
the message:

Based on my analysis of this commit and comparison with the similar
historical commits, here is my assessment:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Analysis

### **Code Change Analysis**
The commit adds a single line in the `max14577_i2c_remove()` function:
```c
+ device_init_wakeup(max14577->dev, false);
```

This addition occurs at drivers/mfd/max14577.c:459, right before
`mfd_remove_devices()` is called.

### **Bug Fix Characteristics**
1. **Memory Leak Fix**: The commit fixes a wakeup source memory leak
that occurs when the device is unbound. When `device_init_wakeup(dev,
true)` is called during probe (line 442), it allocates memory for
wakeup source structures. Without the corresponding cleanup call,
this memory is leaked on device removal.

2. **Small and Contained**: The fix is minimal - a single line addition
that mirrors the cleanup pattern used throughout the kernel.

3. **Low Risk**: The change has extremely low regression risk since it
only adds proper cleanup that should have been there originally.

### **Comparison with Historical Similar Commits**
Looking at the provided historical commits, there are two categories:

**YES commits (backported)**:
- `gpio: mpc8xxx: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`
- `gpio: zynq: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`

**NO commits (not backported)**:
- IIO driver commits that use `devm_device_init_wakeup()` instead of
manual cleanup

The key difference is that the YES commits use the same fix pattern as
this MFD commit - manual cleanup in the remove function, while the NO
commits use the `devm_` managed approach that automatically handles
cleanup.

### **Impact Assessment**
- **User Impact**: Memory leaks on device unbind affect systems where
MFD devices are frequently bound/unbound
- **Subsystem**: MFD (Multi-Function Device) is a core kernel subsystem
used by many embedded systems
- **Regression Risk**: Minimal - adding proper cleanup cannot cause
functional regression

### **Stable Tree Criteria Met**
1. â?? Fixes an important bug (memory leak)
2. â?? Small and contained change
3. â?? No architectural changes
4. â?? Minimal risk of regression
5. â?? Follows established patterns seen in other backported commits

The commit follows the exact same pattern as the GPIO driver commits
that were successfully backported to stable trees (commits #1 and #2 in
the historical examples), making it a clear candidate for backporting.

drivers/mfd/max14577.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 6fce79ec2dc64..7e7e8af9af224 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -456,6 +456,7 @@ static void max14577_i2c_remove(struct i2c_client *i2c)
{
struct max14577 *max14577 = i2c_get_clientdata(i2c);

+ device_init_wakeup(max14577->dev, false);
mfd_remove_devices(max14577->dev);
regmap_del_irq_chip(max14577->irq, max14577->irq_data);
if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
--
2.39.5



Return-Path: <linux-kernel+bounces-675965-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8DECE41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:44:58 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 99C023B24DA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:44:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4614928B3E2;
Fri, 6 Jun 2025 15:43:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="phRsmion"
Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F79E193077
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:43:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.171
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224590; cv=none; b=ACbkFjOaztevdW/qDg9/wrTZKZaqshI8knjJeu/ik2Hk9DMYelwGaMcvBz1vn1LdQLUMYAsqORIp5q9+aSo8rYkmo2xtetPTdQS3u1iqoRRRd+7l1MuGDRkGap6NTOXo+oK1aXT1Uw19d2Ji84JPgALyRQ/dCWvZCdM4DapNFno=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224590; c=relaxed/simple;
bh=BssSf538SCQ3bExCodfPwCOVcFqz70KXS8ab1xagiEs=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=hK8hB4+SGdrv4z3IE7Nt2HNV75hBbswahewz+3xUDkm7wzzy9BfWXqcuNxsTA56/EHKxfzswJx1hIY3VPcYA/zqFg5pKYbEuQXE/sfXj/wRTZlo0Uyh2+hWaqPGZX4Xk2quxJraBPbzWINFWiF5/B2Uw7VUrzNgCR/3O3jqVOg4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=phRsmion; arc=none smtp.client-ip=209.85.167.171
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com
Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-406e31162c6so729036b6e.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:43:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749224587; x=1749829387; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=atBrsiBQdovA6XQSD3owooH8KFvjiwxKuYkfC+ytQP0=;
b=phRsmion5rMvrNd8AGQFINgqWDWwFC3G8oP2O928hBR4x0cH9XuaqB874eiHIhiCeZ
H8mGmPNqpv/uiOAOL3KEjelRdA2w0fMsY5g7h5MI8xRRr3RmYl2cxWfYOuIquw9Lx4lT
ZpNkdHX0DQCm5hz9xsw/9Etgq2WC7Xl0Cdw5mK25QJeotNxg5fES+HOLUjsUEFby4B8r
iBZ7Rc28YFO1XyTXYt7TS+IUkvWyyImDQZ9b6xliyAFW+TeeTclNP7xMTka/P3WhMG7+
i00YsWsn5KIf+/91oxnu4zbiG/uYVesqMwQkglG08Dadxn4hJxdAz7e7g6ObK0MElOpE
FWnw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749224587; x=1749829387;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=atBrsiBQdovA6XQSD3owooH8KFvjiwxKuYkfC+ytQP0=;
b=uUafbEkVLDqULVxCiszjNtdgFieaEmUNqo7F1DpNTrqO418SCGZ011l5fnKcriZWOw
O9Mr/VRFChkTJu/fGzblCCCA/kp3ktYrp/7R1W8jgRqmFNcCyxuFcZe/nH59u/aFRuK8
z268nX++zfwseU063ZFTMKs1gewBxxTtaTu2MOOaDgVJNncx9Tw4fq/ZvVakTQqKqrDL
bScnd4TpzmYylQ3/IeDxZB+nswDqL21EDBodqm7A1xwtK8st3HqV39fxQtyLdKDghGMz
/TcSam7RCxQCW3C4OVDCTSgy5kLhai6g1YXweQ8/sTlykUYOhXMrUpd0Jl2VSx/PWoGu
7XUw==
X-Forwarded-Encrypted: i=1; AJvYcCVln5NY5lZmfNWp4zd0/2DcemGn9T57dmTMdeIe93DcpWUfHVnxkTi3irep6F4goX5pZ5bKbuICEgZOd/Q=@vger.kernel.org
X-Gm-Message-State: AOJu0Yx/fE/qjbtiTymMsGkGleouMpEup7JglOzZpy2ptATXIeUiCfLI
g8/rRo3W7im7d5+6LDg6s9HFoEetKUcDPx1BiuxCLB2/xgxt3y9w1ZqOEORuRdzF+e1mHfEaWVe
8PzY95oAHZA1171wIQVennu7C8xXRSKDHZ7+b+RpAb57D2P20PsNIQPO6QtM=
X-Gm-Gg: ASbGncv4gCIdoM5H+5XnhyPCb3fJ//aMmF/GgMils/xOYwy5aqLCB1oEoOBr580w426
d8U2MblCiKVrybDm3rxzte1YkANG77HLqHwV8V83OaNpIZrM5fqPUnnF5LgtsaU7FjYO8cJw72U
k6KTZSnhuBVMPsN6q20jS8fm/5f01Nnv3R782ZVwlN0to=
X-Google-Smtp-Source: AGHT+IFwZt96R27Gw8zd/WO1DCWRNwmmGO5Su5CRhGAMCitk7Zp+EPKl0GeXrmi6Y9mF2xBgCReQybypIDNLM8S7cR4=
X-Received: by 2002:a05:622a:5c16:b0:494:a2b8:88f0 with SMTP id
d75a77b69052e-4a5b9d7a923mr72974071cf.33.1749224577010; Fri, 06 Jun 2025
08:42:57 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250602135932.464194-1-pranav.tyagi03@xxxxxxxxx>
<053507e4-14dc-48db-9464-f73f98c16b46@xxxxxxx> <202506021057.3AB03F705@keescook>
<25d96fc0-c54b-4f24-a62b-cf68bf6da1a9@xxxxxxx> <CAH4c4jJRkeiCaRji9s1dXxWL538X=vXRyKgwcuAOLPNd-jv4VQ@xxxxxxxxxxxxxx>
In-Reply-To: <CAH4c4jJRkeiCaRji9s1dXxWL538X=vXRyKgwcuAOLPNd-jv4VQ@xxxxxxxxxxxxxx>
From: Eric Dumazet <edumazet@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 08:42:45 -0700
X-Gm-Features: AX0GCFu5bBYumsgogodK6DnGqjj3NSYGozTewcVjea7gPo9oQSX8_BL5MzVZrmc
Message-ID: <CANn89iJR1i3hhXrkDNtXyPCNUj1KmrTAff2=pcuYNsXBxogNpw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] net: randomize layout of struct net_device
To: Pranav Tyagi <pranav.tyagi03@xxxxxxxxx>
Cc: Andrew Lunn <andrew@xxxxxxx>, Kees Cook <kees@xxxxxxxxxx>, andrew+netdev@xxxxxxx,
davem@xxxxxxxxxxxxx, kuba@xxxxxxxxxx, pabeni@xxxxxxxxxx, horms@xxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
skhan@xxxxxxxxxxxxxxxxxxx, linux-kernel-mentees@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 7:55=E2=80=AFAM Pranav Tyagi <pranav.tyagi03@gmail.c=
om> wrote:
>
> On Tue, Jun 3, 2025 at 12:36=E2=80=AFAM Andrew Lunn <andrew@xxxxxxx> wrot=
e:
> >
> > On Mon, Jun 02, 2025 at 11:03:18AM -0700, Kees Cook wrote:
> > > On Mon, Jun 02, 2025 at 04:46:14PM +0200, Andrew Lunn wrote:
> > > > On Mon, Jun 02, 2025 at 07:29:32PM +0530, Pranav Tyagi wrote:
> > > > > Add __randomize_layout to struct net_device to support structure =
layout
> > > > > randomization if CONFIG_RANDSTRUCT is enabled else the macro expa=
nds to
> > > > > do nothing. This enhances kernel protection by making it harder t=
o
> > > > > predict the memory layout of this structure.
> > > > >
> > > > > Link: https://github.com/KSPP/linux/issues/188
> > >
> > > I would note that the TODO item in this Issue is "evaluate struct
> > > net_device".
> > >
> > > > A dumb question i hope.
> > > >
> > > > As you can see from this comment, some time and effort has been put
> > > > into the order of members in this structure so that those which are
> > > > accessed on the TX fast path are in the same cache line, and those =
on
> > > > the RX fast path are in the same cache line, and RX and TX fast pat=
hs
> > > > are in different cache lines, etc.
> > >
> > > This is pretty well exactly one of the right questions to ask, and
> > > should be detailed in the commit message. Mainly: a) how do we know i=
t
> > > will not break anything? b) why is net_device a struct that is likely
> > > to be targeted by an attacker?
> >
> > For a), i doubt anything will break. The fact the structure has been
> > optimised for performance implies that members have been moved around,
> > and there are no comments in the structure saying don't move this,
> > otherwise bad things will happen.
> >
> > There is a:
> >
> > u8 priv[] ____cacheline_aligned
> > __counted_by(priv_len);
> >
> > at the end, but i assume RANDSTRUCT knows about them and won't move it.
> >
> > As for b), i've no idea, not my area. There are a number of pointers
> > to structures contains ops. Maybe if you can take over those pointers,
> > point to something you can control, you can take control of the
> > Program Counter?
> >
> > > > Does CONFIG_RANDSTRUCT understand this? It is safe to move members
> > > > around within a cache line. And it is safe to move whole cache line=
s
> > > > around. But it would be bad if the randomisation moved members betw=
een
> > > > cache lines, mixing up RX and TX fast path members, or spreading fa=
st
> > > > path members over more cache lines, etc.
> > >
> > > No, it'll move stuff all around. It's very much a security vs
> > > performance trade-off, but the systems being built with it are happy =
to
> > > take the hit.
> >
> > It would be interesting to look back at the work optimising this
> > stricture to get a ball park figure how big a hit this is?
> >
> > I also think some benchmark numbers would be interesting. I would
> > consider two different systems:
> >
> > 1) A small ARM/MIPS/RISC-V with 1G interfaces. The low amount of L1
> > cache on these systems mean that cache misses are important. So
> > spreading out the fast path members will be bad.
> >
> > 2) Desktop/Server class hardware, lots of cores, lots of cache, 10G,
> > 40G or 100G interfaces. For these systems, i expect cache line
> > bouncing is more of an issue, so Rx and Tx fast path members want to
> > be kept in separate cache lines.
> >
> > > The basic details are in security/Kconfig.hardening in the "choice" f=
ollowing
> > > the CC_HAS_RANDSTRUCT entry.
> >
> > So i see two settings here. It looks like RANDSTRUCT_PERFORMANCE
> > should have minimal performance impact, so maybe this should be
> > mentioned in the commit message, and the benchmarks performed both on
> > full randomisation and with the performance setting.
> >
> > I would also suggest a comment is added to the top of
> > Documentation/networking/net_cachelines/net_device.rst pointing out
> > this assumed RANDSTRUCT is disabled, and the existing comment in
> > struct net_device is also updated.
> >
> > Andrew
>
> Resending to the list=E2=80=94my previous reply was accidentally sent off=
-list.
>
> Apologies for the delayed response, and thank you
> all for the detailed feedback.
>
> Regarding the concern about breaking functionality,
> I did compile and boot the kernel successfully with
> this change, and everything appeared to work as
> expected during basic testing. However, I agree
> that this is not a substitute for thorough
> benchmarking.
>
> You're absolutely right that applying
> __randomize_layout to net_device will shuffle
> structure fields and likely incur a performance
> penalty. As mentioned, this is a trade-off that
> targets hardening over performance. It's worth
> noting that CONFIG_RANDSTRUCT has two options:
> RANDSTRUCT_FULL and RANDSTRUCT_PERFORMANCE, with
> the latter aiming to minimize the impact by only
> shuffling less performance-critical members.
>
> I=E2=80=99d appreciate guidance on which specific
> benchmarking tests would be most appropriate to
> quantify the performance impact. Based on your
> suggestions, I plan to run benchmarks on a small
> SoC (ARM/MIPS/RISC-V) with 1G NICs. However, I
> currently don=E2=80=99t have access to high-end server
> hardware with 10G/40G+ NICs, so I=E2=80=99ll start with the
> systems I have and clearly note the limitations in
> the revised commit message.
>
> I=E2=80=99ll also update the commit message to reflect the
> security vs performance trade-offs, mention
> RANDSTRUCT_PERFORMANCE, and add a reference to
> net_cachelines/net_device.rst to document the
> assumption of structure layout.
>
> Thanks again for the thoughtful review=E2=80=94I=E2=80=99ll revise
> the patch accordingly.
>

Do you have evidence of added security on this particular structure ?

What particular bug could have been avoided with __randomize_layout ?

Most distros use CONFIG_RANDSTRUCT_NONE=3Dy, I do not think
__randomize_layout has a future.


Return-Path: <linux-kernel+bounces-675964-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AB4D941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:45:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0497717B407
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:44:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C04F2289358;
Fri, 6 Jun 2025 15:43:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aDiBo5fn"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01425289825;
Fri, 6 Jun 2025 15:43:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224590; cv=none; b=U7lnAmbKv9M80dSGDGpBckYau4CKjEOCCssiuf4bpM4Yt9TBs0FuM6EWJudh4vpTSqEOMgB+DGYiKRAD5qpi9jnZXOL9eHVADAnBJ206PApHy63cQLkzoiERC+ZjSdCjMZGz2maA26Rdb5Jv6qYeMMupYSAvJlgMqIGr+HLrPpw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224590; c=relaxed/simple;
bh=JvxKiUvZup5FCydVPN8K3QMiW0hQscyESTJprVJQzbg=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=sGP31ZE7GrRa/T+6hdXjqXHiH6mPZ+vWMP/nqO8K2uEPT0rsdNKgyJ8ochNqPRs3gW90tRfwvtUGArUPQCrNVXeZihWt2c3suiLDCisrzMQqAHDQC03syxW1R+IVntHHF58suA5RBuNLl6EKljGxaZuNIm87MtdwbknNEqjK/uc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aDiBo5fn; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13D36C4CEED;
Fri, 6 Jun 2025 15:43:08 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224589;
bh=JvxKiUvZup5FCydVPN8K3QMiW0hQscyESTJprVJQzbg=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=aDiBo5fnPz9Z5Z2r3DonuQ4eyCC6NTIYiQ6zdIBTuNfGL7WoDlhe/KueCp+HsBDO1
IP/QvsNwhCAKrEW1dbRwBmYXr5XiD64YtjPiRSyf8fHbjSTs7fo5v9Rwyws0/0xhQ+
YAnGso4oZ/kgRzQgT5WFua/fuPsYA+zICG1MsyOsVaF4xzjtf9QUgAqF1OmFiF+owi
9y41TAGZG7r66Qd9elCHpJMKLfo7XMEhCuWdohlLL5cOzP+hjMZs3uC5i9goqkxoWl
JmCPnWEBShLQPF5ggVXaeW3XRK/E0NACIlZfrmVUb8egcg634uKzL4ZRJJ0dyCCUds
ocVYrH45rmBMw==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Peng Fan <peng.fan@xxxxxxx>,
Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.12 07/15] mailbox: Not protect module_put with spin_lock_irqsave
Date: Fri, 6 Jun 2025 11:42:50 -0400
Message-Id: <20250606154259.547394-7-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154259.547394-1-sashal@xxxxxxxxxx>
References: <20250606154259.547394-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.12.32
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peng Fan <peng.fan@xxxxxxx>

[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]

&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
Signed-off-by: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES** This commit should be backported to stable kernel trees.
**Analysis:** 1. **Clear Bug Fix**: The commit fixes an improper use of
`module_put()` under a spinlock in `mbox_free_channel()`. Looking at the
current code in `/home/sasha/linux/drivers/mailbox/mailbox.c:489`,
`module_put()` is called while holding `&chan->lock` with
`spin_lock_irqsave()`. 2. **Locking Inconsistency**: The commit message
correctly identifies that `&chan->lock` is not supposed to protect
`chan->mbox`. In `__mbox_bind_client()` (line 324),
`try_module_get(chan->mbox->dev->driver->owner)` is called **outside**
the spinlock protection, making the current `module_put()` placement
inconsistent. 3. **Minimal Risk Change**: The fix is extremely simple
and low-risk - it just moves one line (`module_put()`) outside the
spinlock region. This maintains the same operation order but fixes the
locking issue. 4. **No Side Effects**: Moving `module_put()` outside the
lock doesn't change the functionality or introduce new race conditions.
The `module_put()` implementation uses `atomic_dec_if_positive()`, so
it's safe to call without additional locking. 5. **Follows Stable
Rules**: This commit: - Fixes a real locking issue that could
potentially cause problems - Is small and contained (single line move) -
Has minimal regression risk - Doesn't introduce new features or
architectural changes 6. **Similar Pattern**: Looking at similar commits
in the historical references, commits that fix locking issues (like
Similar Commit #5 which fixed a locking bug in mailbox-test) were marked
as YES for backporting. The commit addresses a legitimate kernel locking
violation where `module_put()` should not be called under a spinlock,
making it a suitable candidate for stable tree backporting.

drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index cb174e788a96c..92c2fb618c8e1 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -490,8 +490,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;

- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);

--
2.39.5



Return-Path: <linux-kernel+bounces-675966-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 98B6B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:45:19 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8CA853B24FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:44:57 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B15B928A1EA;
Fri, 6 Jun 2025 15:43:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AeuQf6AY"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD37828B3FF;
Fri, 6 Jun 2025 15:43:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224591; cv=none; b=l+mDcVtg5H1NUeofPtIiWo4ULHWphnY7kZXpRi1pLN1Q0dTwGCsiiRFEHYsD4FUz1N0m8vLhxb64d0KIwpNGxmx8oIRbJBTSvmMZneCaNzOpVk7MR2IS8rKJzcb2VpbG+HHELfzyIB3ur1Zr9IeRgWWUDYemFW2EeBXd+c5iea0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224591; c=relaxed/simple;
bh=cSV2s7RixPkjrBSQuDprrXa/GlT3m+vYjOcot1cKvq8=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=JfXVKtUi02kYHnlowaLxmdT+wBfn9pe04uP/QhbSaaS8FEliMvb7K/7HXH/aOO+dkzR9y2RWbPteW2O3drOXg+71JYVmphcIW4dvaO1rlLvqr7nBJFQ6ICE1urfua5wRyvCh45j90C5lajCw8NY4awHoZLk5ZjjAxwzeYX9Pk9Y=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AeuQf6AY; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49B74C4CEF1;
Fri, 6 Jun 2025 15:43:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224591;
bh=cSV2s7RixPkjrBSQuDprrXa/GlT3m+vYjOcot1cKvq8=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=AeuQf6AYZI9NX3+tAafm8u7m2iw/FtWELWtzJlh8mOHoJpl8JU08A9sn3f+1rAURi
SQWK2SwUCmx2cxbUSrQovKjWKL82J4tOKbjlm/FsPE4IBAijiVFHFhWm82+opkIYP+
8oEbg65LZvGWnsOHYnIknAUeuwHXfSACV87Qv5zlCENVju6e2dWacuKoVPRR5zWp26
QQBkJU/kAC2GP+vvBWd3dQc/CQlfRJ1DrR5T0dQFKa4munYMZVzUYzcpgzbNCiLBp7
cA4M++C+qA/MCJ71i4G6qZaOMfyVk7sJaLL6qkHrjb8L6gHM6BHreuXeOrokzFUgk+
6rmtG66bQoiag==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.12 08/15] mfd: max14577: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:42:51 -0400
Message-Id: <20250606154259.547394-8-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154259.547394-1-sashal@xxxxxxxxxx>
References: <20250606154259.547394-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.12.32
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-3-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

Now let me understand the difference between the fixes - the historical
commits show two patterns:
1. Using `devm_device_init_wakeup()` - automatically handles cleanup
2. Manual cleanup by calling `device_init_wakeup(dev, false)` in remove
functions

Let me check if this specific commit has `Cc: stable@xxxxxxxxxxxxxxx` in
the message:

Based on my analysis of this commit and comparison with the similar
historical commits, here is my assessment:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Analysis

### **Code Change Analysis**
The commit adds a single line in the `max14577_i2c_remove()` function:
```c
+ device_init_wakeup(max14577->dev, false);
```

This addition occurs at drivers/mfd/max14577.c:459, right before
`mfd_remove_devices()` is called.

### **Bug Fix Characteristics**
1. **Memory Leak Fix**: The commit fixes a wakeup source memory leak
that occurs when the device is unbound. When `device_init_wakeup(dev,
true)` is called during probe (line 442), it allocates memory for
wakeup source structures. Without the corresponding cleanup call,
this memory is leaked on device removal.

2. **Small and Contained**: The fix is minimal - a single line addition
that mirrors the cleanup pattern used throughout the kernel.

3. **Low Risk**: The change has extremely low regression risk since it
only adds proper cleanup that should have been there originally.

### **Comparison with Historical Similar Commits**
Looking at the provided historical commits, there are two categories:

**YES commits (backported)**:
- `gpio: mpc8xxx: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`
- `gpio: zynq: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`

**NO commits (not backported)**:
- IIO driver commits that use `devm_device_init_wakeup()` instead of
manual cleanup

The key difference is that the YES commits use the same fix pattern as
this MFD commit - manual cleanup in the remove function, while the NO
commits use the `devm_` managed approach that automatically handles
cleanup.

### **Impact Assessment**
- **User Impact**: Memory leaks on device unbind affect systems where
MFD devices are frequently bound/unbound
- **Subsystem**: MFD (Multi-Function Device) is a core kernel subsystem
used by many embedded systems
- **Regression Risk**: Minimal - adding proper cleanup cannot cause
functional regression

### **Stable Tree Criteria Met**
1. â?? Fixes an important bug (memory leak)
2. â?? Small and contained change
3. â?? No architectural changes
4. â?? Minimal risk of regression
5. â?? Follows established patterns seen in other backported commits

The commit follows the exact same pattern as the GPIO driver commits
that were successfully backported to stable trees (commits #1 and #2 in
the historical examples), making it a clear candidate for backporting.

drivers/mfd/max14577.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 6fce79ec2dc64..7e7e8af9af224 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -456,6 +456,7 @@ static void max14577_i2c_remove(struct i2c_client *i2c)
{
struct max14577 *max14577 = i2c_get_clientdata(i2c);

+ device_init_wakeup(max14577->dev, false);
mfd_remove_devices(max14577->dev);
regmap_del_irq_chip(max14577->irq, max14577->irq_data);
if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
--
2.39.5



Return-Path: <linux-kernel+bounces-675967-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 452FF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:47:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 3FB731889457
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:46:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4472028BA82;
Fri, 6 Jun 2025 15:43:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M9ArHDEw"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 837C8EEB5;
Fri, 6 Jun 2025 15:43:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224616; cv=none; b=ZCV/z67PSDr66VEkOsc4CG39NgQTpFilnRLR9yX8otPYCmPjQNibjOR8hKFpTGIgn+K20yhUpLCYQPPlmVuzg4FjYWUVZO9jkBzb4YxU9XI7vW4d7A85Ki5XF1ZVqTXCA1q1YlEl9fPA8LhaQqo+5alLUW58nCq0k02KC1PjCw8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224616; c=relaxed/simple;
bh=yBasjdLbILx5emK1wfV/acnTnriWBCg/8x+dDas1FYw=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=cEciJzlYLZT1XbW3QqqeKoqs8gwEcZxKxta+RA5KAkefrjNnsxgvVJbBe8+fVwJIf+ZQauD0WnlTD4hDp1LNFRH/S5SnfGqNKckhc4f3JYC7e+0w2fXfAJV9B6XEl5/a5A6IbSO5j67vh31DT7fgC2ktFiVy1Jmw2t4sB09g0V8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M9ArHDEw; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9972BC4CEF0;
Fri, 6 Jun 2025 15:43:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224616;
bh=yBasjdLbILx5emK1wfV/acnTnriWBCg/8x+dDas1FYw=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=M9ArHDEw8DYp/6noE6EkwnwfieSENbDhkwoK8kqq5XZXfLG+bLO/oVcGrK0bspaKj
2ZAwueh+htArG00qQ9Dzo9gfEBPDJtQvPqPosq8ebupztSd5gjjRxoV6ulgrZcRfpt
YjboXbT4ODkuxa816952Lk32EuKL326j7ZaRXqk7Tte6dI14+ndZf7GE135Kp/fARz
PTgvhiBbi3eDSA8Nxo70zaRH8zakkMOlIgIn/5FOPRXo7JbjIQ8ry5Cy1qTY0G8yYu
1S+oR6DK2WE70I34C1GGreDkgKr25+pZ85VV/rMy9llbMAKIMu+6m3PxYsWirIm03v
4mwUqc98PRFBA==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Peng Fan <peng.fan@xxxxxxx>,
Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.6 06/13] mailbox: Not protect module_put with spin_lock_irqsave
Date: Fri, 6 Jun 2025 11:43:19 -0400
Message-Id: <20250606154327.547792-6-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154327.547792-1-sashal@xxxxxxxxxx>
References: <20250606154327.547792-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.6.93
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peng Fan <peng.fan@xxxxxxx>

[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]

&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
Signed-off-by: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES** This commit should be backported to stable kernel trees.
**Analysis:** 1. **Clear Bug Fix**: The commit fixes an improper use of
`module_put()` under a spinlock in `mbox_free_channel()`. Looking at the
current code in `/home/sasha/linux/drivers/mailbox/mailbox.c:489`,
`module_put()` is called while holding `&chan->lock` with
`spin_lock_irqsave()`. 2. **Locking Inconsistency**: The commit message
correctly identifies that `&chan->lock` is not supposed to protect
`chan->mbox`. In `__mbox_bind_client()` (line 324),
`try_module_get(chan->mbox->dev->driver->owner)` is called **outside**
the spinlock protection, making the current `module_put()` placement
inconsistent. 3. **Minimal Risk Change**: The fix is extremely simple
and low-risk - it just moves one line (`module_put()`) outside the
spinlock region. This maintains the same operation order but fixes the
locking issue. 4. **No Side Effects**: Moving `module_put()` outside the
lock doesn't change the functionality or introduce new race conditions.
The `module_put()` implementation uses `atomic_dec_if_positive()`, so
it's safe to call without additional locking. 5. **Follows Stable
Rules**: This commit: - Fixes a real locking issue that could
potentially cause problems - Is small and contained (single line move) -
Has minimal regression risk - Doesn't introduce new features or
architectural changes 6. **Similar Pattern**: Looking at similar commits
in the historical references, commits that fix locking issues (like
Similar Commit #5 which fixed a locking bug in mailbox-test) were marked
as YES for backporting. The commit addresses a legitimate kernel locking
violation where `module_put()` should not be called under a spinlock,
making it a suitable candidate for stable tree backporting.

drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index f13d705f7861a..cb59b4dbad626 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -500,8 +500,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;

- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);

--
2.39.5



Return-Path: <linux-kernel+bounces-675969-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BE76441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:47:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id CAD683B1EB0
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:46:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0636F28C02D;
Fri, 6 Jun 2025 15:43:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PTss1BfY"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 375D828A413;
Fri, 6 Jun 2025 15:43:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224634; cv=none; b=XyxeZyCIE5lXv6brClUoROIZr/SMgNBU83Empts/fL7iHpZfh9/jsfB2aMZEZe/pquvhOCQVv4iYvx/KfTPNrS7jPujP5n4JfuQ6h6o1/gdkiBRCvDKYITd9w6O9CI37Ansz1UeaE9wHghTd3+pZhAMxyVpMTD+v5Zj9xj+lTY8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224634; c=relaxed/simple;
bh=iGO8SORWMUFTmXITj8rFdTt1r4Y7ccbtUi/G+XcmSPQ=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=ZUkESuXle3bcXzrPguCWbXSGER1DqRUrPcrQSdejSTNpxGFQPa3z/W9y8C4t89V1Sz6IAA1QgjJ/I1Bi+lyQmi/BNH65NqmsFjoDHf06+gWMe/aPNK/dJrMFpvQDw141Ukbz4qsaHlv2wAbM8dCZZ0VnxQ+YFStTtJMjjgWrLhk=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PTss1BfY; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 306E5C4CEEB;
Fri, 6 Jun 2025 15:43:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224634;
bh=iGO8SORWMUFTmXITj8rFdTt1r4Y7ccbtUi/G+XcmSPQ=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=PTss1BfYfzjfeaCqJHcIk9rN1rVP6zXkr1BE1bV8Xagd0K1cu1pVspxN6qSManx3u
YDUt408omxAIU2Mkz4EfnaJAMVRhaSx2BiS1lDp4KDyO9eEzDKNXXcfI3F67xyEwX9
33HLAp1gkNbRkWgEcEvjtoDcnfEG5hk0gtz9wCmcUynJgftSY9yI0sOsudk8pqMbTP
EtXYjQ6UOh/tESGOEf3usNNX8t1mKGJxekjDwLMyGIrxWtRxvDdohG7vhOJYitGZ1L
qNVyQkNhYqBh7VqbIFFojGffPr3LL/OV9obY09apIGhNI4y32HtjTxwA/kQdQtetGJ
4q6zcBsugBs/g==
Date: Fri, 6 Jun 2025 16:43:48 +0100
From: Conor Dooley <conor@xxxxxxxxxx>
To: Stefan Eichenberger <eichest@xxxxxxxxx>
Cc: jagan@xxxxxxxxxxxxxxxxxxxx, neil.armstrong@xxxxxxxxxx,
quic_jesszhan@xxxxxxxxxxx, airlied@xxxxxxxxx, simona@xxxxxxxx,
maarten.lankhorst@xxxxxxxxxxxxxxx, mripard@xxxxxxxxxx,
tzimmermann@xxxxxxx, robh@xxxxxxxxxx, krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v1 2/2] dt-bindings: display: st7701: Add Winstar
wf40eswaa6mnn0 panel
Message-ID: <20250606-copious-cubbyhole-28f5b9ad2e8b@spud>
References: <20250606114644.105371-1-eichest@xxxxxxxxx>
<20250606114644.105371-3-eichest@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="HKMTKpwMG6GAESTE"
Content-Disposition: inline
In-Reply-To: <20250606114644.105371-3-eichest@xxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--HKMTKpwMG6GAESTE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jun 06, 2025 at 01:45:51PM +0200, Stefan Eichenberger wrote:
> The Winstar wf40eswaa6mnn0 panel is a square 4.0" TFT LCD with a
> resolution of 480x480 pixels.
>=20
> Signed-off-by: Stefan Eichenberger <eichest@xxxxxxxxx>

Acked-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>

--HKMTKpwMG6GAESTE
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaEMMtAAKCRB4tDGHoIJi
0sZnAP0YfqTWoNBCd0YPO96H53A8CzEWr6Lzx1kGpGPNbT6O0AD/UcDVG79r85Mk
+8pxO2VNo4Vjkv73P8wTe+vfaNevgw8=
=CCyf
-----END PGP SIGNATURE-----

--HKMTKpwMG6GAESTE--


Return-Path: <linux-kernel+bounces-675968-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8310241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:47:20 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 4CFB6188C708
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:46:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AE24428BA95;
Fri, 6 Jun 2025 15:43:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B1ORjN2d"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7B8F28BA84;
Fri, 6 Jun 2025 15:43:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224618; cv=none; b=DgJIUDpxW+cCB6k5zcLMXnUXuAB2QxKiCBUNwwfYFJG3iRQiRTd9kXxCsOQBMoIqNBSDb6oBasKBrSwVP4LvZmQNCEZY2SoCamNWe20Bb6uYQtBes3OC9MlDQQXMveaysk1mn4LQQdVSL4jmbaAY+4SfmbP5H8e4ybrvBd3v1iU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224618; c=relaxed/simple;
bh=Hi9Va3IbJdcHxxft8GD9HKET7LbgH6Wb2VdwhoAf29M=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=PPv58AFU0uU5iGM7CjI6HxXsg8j3old6jVcwzYi57hjNSOOte4sekCO3kCOy9/bBdFjsSao8229ZZy5jIjViVSAidHMbBWIFwU+m7dsds9T1JS5af2P0L1gCw0MyKtPCZt8Pr3UJQgeqnQk/TFiTB40+9GShrClRPRQ/XcFOypg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B1ORjN2d; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCFD4C4CEED;
Fri, 6 Jun 2025 15:43:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224617;
bh=Hi9Va3IbJdcHxxft8GD9HKET7LbgH6Wb2VdwhoAf29M=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=B1ORjN2dBazmv0Q+nBMbsYmGJ3Fav0l75aFeA5SzISmcjxSFpWhbVSu6oz3z6bNN5
aJxx4gjIERXVvqbfhfrT38nvRrIIskrUaXykWOYF1kTIs2ej5AnPFZf+iwvC55wd29
IwmUbA+67XqbtiMmD5H7hMtkL7COLP29v5Y12xtmct7k+Hy5258bDmJMhd62zVr/qX
QQaFtsNcrAx5koQ1bR0RmWN+3S2nEylLFknCEJ22j5jYl8qzGbuznRVyQA8gt+e3Wk
8WNB+hOJgWKa5nXhn2mOQLRHuKYcxckik8031SHNlSNbAcjYRndZkJk91HVeu/kmjr
RXt2inRcxkRkA==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.6 07/13] mfd: max14577: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:43:20 -0400
Message-Id: <20250606154327.547792-7-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154327.547792-1-sashal@xxxxxxxxxx>
References: <20250606154327.547792-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.6.93
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-3-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

Now let me understand the difference between the fixes - the historical
commits show two patterns:
1. Using `devm_device_init_wakeup()` - automatically handles cleanup
2. Manual cleanup by calling `device_init_wakeup(dev, false)` in remove
functions

Let me check if this specific commit has `Cc: stable@xxxxxxxxxxxxxxx` in
the message:

Based on my analysis of this commit and comparison with the similar
historical commits, here is my assessment:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Analysis

### **Code Change Analysis**
The commit adds a single line in the `max14577_i2c_remove()` function:
```c
+ device_init_wakeup(max14577->dev, false);
```

This addition occurs at drivers/mfd/max14577.c:459, right before
`mfd_remove_devices()` is called.

### **Bug Fix Characteristics**
1. **Memory Leak Fix**: The commit fixes a wakeup source memory leak
that occurs when the device is unbound. When `device_init_wakeup(dev,
true)` is called during probe (line 442), it allocates memory for
wakeup source structures. Without the corresponding cleanup call,
this memory is leaked on device removal.

2. **Small and Contained**: The fix is minimal - a single line addition
that mirrors the cleanup pattern used throughout the kernel.

3. **Low Risk**: The change has extremely low regression risk since it
only adds proper cleanup that should have been there originally.

### **Comparison with Historical Similar Commits**
Looking at the provided historical commits, there are two categories:

**YES commits (backported)**:
- `gpio: mpc8xxx: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`
- `gpio: zynq: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`

**NO commits (not backported)**:
- IIO driver commits that use `devm_device_init_wakeup()` instead of
manual cleanup

The key difference is that the YES commits use the same fix pattern as
this MFD commit - manual cleanup in the remove function, while the NO
commits use the `devm_` managed approach that automatically handles
cleanup.

### **Impact Assessment**
- **User Impact**: Memory leaks on device unbind affect systems where
MFD devices are frequently bound/unbound
- **Subsystem**: MFD (Multi-Function Device) is a core kernel subsystem
used by many embedded systems
- **Regression Risk**: Minimal - adding proper cleanup cannot cause
functional regression

### **Stable Tree Criteria Met**
1. â?? Fixes an important bug (memory leak)
2. â?? Small and contained change
3. â?? No architectural changes
4. â?? Minimal risk of regression
5. â?? Follows established patterns seen in other backported commits

The commit follows the exact same pattern as the GPIO driver commits
that were successfully backported to stable trees (commits #1 and #2 in
the historical examples), making it a clear candidate for backporting.

drivers/mfd/max14577.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 1f4f5002595c0..17672eeb1732a 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -463,6 +463,7 @@ static void max14577_i2c_remove(struct i2c_client *i2c)
{
struct max14577 *max14577 = i2c_get_clientdata(i2c);

+ device_init_wakeup(max14577->dev, false);
mfd_remove_devices(max14577->dev);
regmap_del_irq_chip(max14577->irq, max14577->irq_data);
if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
--
2.39.5



Return-Path: <linux-kernel+bounces-675971-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AC70841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:47:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3BAB67A6B57
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:46:14 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 414FC28C5A9;
Fri, 6 Jun 2025 15:44:01 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O29seNfh"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6064F28C2C6;
Fri, 6 Jun 2025 15:44:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224640; cv=none; b=sajkWJol2BXWUxzkCDtNK6iXq0Tgckk6ieuHeQnUWucRg2PRdgIdPQtUfegaemCTiYBfvby8twBED81hxxyDev1CZWZz/xp6h1BOylY+N3A9x5eEKLtx962IlRnj1W3216kgORFSIoKvsY7ya2OdryUyIVDa/wKAwZUzEfq4FoU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224640; c=relaxed/simple;
bh=TWYUR8+KfzBSjWVeNsMY+yekTspNxom3KPu2CmP2RCY=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=h51FyLFNVbcDV1Au7NZT8Dgm+uVnzYpxQIjfHmwqfC+bSKckpJvrxWfTMCY2cN4X2EH6RYhvb6PV4nTLd/eNFuEsD4l89hhBMBxG9Kvz+RcVpRcBmbXNoX+X42uVhokGAOxy7jSZ75uqRTbPCMuIEXOAHFO4r3VvDWWZwKfDiXQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O29seNfh; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40108C4CEF1;
Fri, 6 Jun 2025 15:43:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224640;
bh=TWYUR8+KfzBSjWVeNsMY+yekTspNxom3KPu2CmP2RCY=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=O29seNfhJ0vhUzxBK6PBR77QLa+1w6zxLapXMgJRfS1r6qDT8mBxuIWqgDtOExzOs
eC65vqcun3WKWAnNR2CWxNmrHlxsawPEo7ExakaImniZJlWXZLLwwZjgyO6HiTLkSt
E25grokjvaSwtITeMpPIyVhgzvokJ+yo74M77LYOpLJw7jmyHfEjk6vYFJFWKd6uvL
7gXQ0ajcpELFORgYk26EPjOEac8tYKL/KlC/r28IHIEKXnHarVhID8TP6Eya8yaIkE
ktZrXi/LpE4aOsOYhbduByL12hY1sGOZ2F0m0rkEOwYF8Xkl16mHYYzp0mkkpRnPEQ
pjcZrtrJ5roeA==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.1 6/9] mfd: max14577: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:43:47 -0400
Message-Id: <20250606154350.548104-6-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154350.548104-1-sashal@xxxxxxxxxx>
References: <20250606154350.548104-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.1.141
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-3-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

Now let me understand the difference between the fixes - the historical
commits show two patterns:
1. Using `devm_device_init_wakeup()` - automatically handles cleanup
2. Manual cleanup by calling `device_init_wakeup(dev, false)` in remove
functions

Let me check if this specific commit has `Cc: stable@xxxxxxxxxxxxxxx` in
the message:

Based on my analysis of this commit and comparison with the similar
historical commits, here is my assessment:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Analysis

### **Code Change Analysis**
The commit adds a single line in the `max14577_i2c_remove()` function:
```c
+ device_init_wakeup(max14577->dev, false);
```

This addition occurs at drivers/mfd/max14577.c:459, right before
`mfd_remove_devices()` is called.

### **Bug Fix Characteristics**
1. **Memory Leak Fix**: The commit fixes a wakeup source memory leak
that occurs when the device is unbound. When `device_init_wakeup(dev,
true)` is called during probe (line 442), it allocates memory for
wakeup source structures. Without the corresponding cleanup call,
this memory is leaked on device removal.

2. **Small and Contained**: The fix is minimal - a single line addition
that mirrors the cleanup pattern used throughout the kernel.

3. **Low Risk**: The change has extremely low regression risk since it
only adds proper cleanup that should have been there originally.

### **Comparison with Historical Similar Commits**
Looking at the provided historical commits, there are two categories:

**YES commits (backported)**:
- `gpio: mpc8xxx: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`
- `gpio: zynq: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`

**NO commits (not backported)**:
- IIO driver commits that use `devm_device_init_wakeup()` instead of
manual cleanup

The key difference is that the YES commits use the same fix pattern as
this MFD commit - manual cleanup in the remove function, while the NO
commits use the `devm_` managed approach that automatically handles
cleanup.

### **Impact Assessment**
- **User Impact**: Memory leaks on device unbind affect systems where
MFD devices are frequently bound/unbound
- **Subsystem**: MFD (Multi-Function Device) is a core kernel subsystem
used by many embedded systems
- **Regression Risk**: Minimal - adding proper cleanup cannot cause
functional regression

### **Stable Tree Criteria Met**
1. â?? Fixes an important bug (memory leak)
2. â?? Small and contained change
3. â?? No architectural changes
4. â?? Minimal risk of regression
5. â?? Follows established patterns seen in other backported commits

The commit follows the exact same pattern as the GPIO driver commits
that were successfully backported to stable trees (commits #1 and #2 in
the historical examples), making it a clear candidate for backporting.

drivers/mfd/max14577.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index d44ad6f337425..61a5ccafa18e0 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -467,6 +467,7 @@ static void max14577_i2c_remove(struct i2c_client *i2c)
{
struct max14577 *max14577 = i2c_get_clientdata(i2c);

+ device_init_wakeup(max14577->dev, false);
mfd_remove_devices(max14577->dev);
regmap_del_irq_chip(max14577->irq, max14577->irq_data);
if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
--
2.39.5



Return-Path: <linux-kernel+bounces-675970-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id DC07C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:47:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id C6DD03B3EC2
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:46:59 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B08E828C2BC;
Fri, 6 Jun 2025 15:43:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tnOqCJbx"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECEC0289E3D;
Fri, 6 Jun 2025 15:43:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224639; cv=none; b=ZKOAN8uL+FyV3+pNL2s2LfUNcy4Ahqdj2JJOk3Njgygz/xulIKk+UdskFVfaF+guNnhpRvurOKfBJG8CjXxE68Oggqp/Jb1OXYJqI/+eCqhHPwOb37iRxOgsJYznI3kUknEVA8MLZCG7h/VZD0C5B6BSr19Li5YBixCwRmhLYHY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224639; c=relaxed/simple;
bh=4hZWSSBiBmXgCZRjHUQHX6vSbzo+EvjVtjI/uIdFtzg=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=P5Jk/IdWEjBDoTykb18RWgztM66W3b3Sg6cr9daKrtPWAJXSxF/rL0AactCWB/5cYCH4o9TjOAVdzY3WI5wYh8yqmMlCiJl4n8e2iWPyC/gyJTPWvqxQorYSNuT/DZGJ6Yz/yT/IHFV2ta2LxX7KVE2u0uj5JbUVVghbKsVYkzU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tnOqCJbx; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E3B7C4CEF0;
Fri, 6 Jun 2025 15:43:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224638;
bh=4hZWSSBiBmXgCZRjHUQHX6vSbzo+EvjVtjI/uIdFtzg=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=tnOqCJbxjRAgV+kvNR1yMwu3Cby8ngFgnzCzZ4hxQUjCXnRfZvgly8xgal02SU8kT
xduT1KpuDYSZjQWunbWublfOzEusd1GCHNA+iyNM1PmDYzsQ8KH+OfAp85Iylj1e/T
QmGK2OHriM9gN0BqWlAxacpSsEFsHXUueY5yEoIoipbWYo3ekTTT7RXS072UGzHwor
Ob4Yw6fJ0S3Q++nC0+H3r+4v6qMoGOaYVTUh4MqsvTlH301L57tE/E2luKQ1JHxaED
qtGqTzRLF20J3MTzW0GYvkSV22nJvfXlxXqOg3JY84LPBPfAdlIuj0EKkfkwpvTOQ3
LoT9Z2OJ6mGNA==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Peng Fan <peng.fan@xxxxxxx>,
Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 6.1 5/9] mailbox: Not protect module_put with spin_lock_irqsave
Date: Fri, 6 Jun 2025 11:43:46 -0400
Message-Id: <20250606154350.548104-5-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154350.548104-1-sashal@xxxxxxxxxx>
References: <20250606154350.548104-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 6.1.141
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peng Fan <peng.fan@xxxxxxx>

[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]

&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
Signed-off-by: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES** This commit should be backported to stable kernel trees.
**Analysis:** 1. **Clear Bug Fix**: The commit fixes an improper use of
`module_put()` under a spinlock in `mbox_free_channel()`. Looking at the
current code in `/home/sasha/linux/drivers/mailbox/mailbox.c:489`,
`module_put()` is called while holding `&chan->lock` with
`spin_lock_irqsave()`. 2. **Locking Inconsistency**: The commit message
correctly identifies that `&chan->lock` is not supposed to protect
`chan->mbox`. In `__mbox_bind_client()` (line 324),
`try_module_get(chan->mbox->dev->driver->owner)` is called **outside**
the spinlock protection, making the current `module_put()` placement
inconsistent. 3. **Minimal Risk Change**: The fix is extremely simple
and low-risk - it just moves one line (`module_put()`) outside the
spinlock region. This maintains the same operation order but fixes the
locking issue. 4. **No Side Effects**: Moving `module_put()` outside the
lock doesn't change the functionality or introduce new race conditions.
The `module_put()` implementation uses `atomic_dec_if_positive()`, so
it's safe to call without additional locking. 5. **Follows Stable
Rules**: This commit: - Fixes a real locking issue that could
potentially cause problems - Is small and contained (single line move) -
Has minimal regression risk - Doesn't introduce new features or
architectural changes 6. **Similar Pattern**: Looking at similar commits
in the historical references, commits that fix locking issues (like
Similar Commit #5 which fixed a locking bug in mailbox-test) were marked
as YES for backporting. The commit addresses a legitimate kernel locking
violation where `module_put()` should not be called under a spinlock,
making it a suitable candidate for stable tree backporting.

drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 6f54501dc7762..cb31ad917b352 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -459,8 +459,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;

- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);

--
2.39.5



Return-Path: <linux-kernel+bounces-675972-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id F110241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:48:01 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 03FB9167BA6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:47:54 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AC98928C860;
Fri, 6 Jun 2025 15:44:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dMGAp+k5"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16])
(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 B3FF428C2D8;
Fri, 6 Jun 2025 15:44:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224642; cv=none; b=lGq9+UCEpGYHCS32qScp8wsTQ/h7kYkmIr4LHcgozPWWOCRCfiSg887ci+JfhFPnmTAWLtsP6fWXRFCqKpcjbJzaKFjoSJTSJhf/AanQ2KM88S7aXQh5KHrORb6XOMb15q58oxdHJ/KNswLAbKNZMJu5ZCNpsjo0Z38VyuutHT4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224642; c=relaxed/simple;
bh=lB7lYnSbEiy3QlbxWlsGm9NoOotpmKsaXkCsatuLtCU=;
h=Content-Type:Message-ID:Date:MIME-Version:Subject:To:Cc:
References:From:In-Reply-To; b=j5MS2ph4PlloO8GF4KZCjOUw9DIiyI9H7am2oY/efr229Pa6+zTSE5gMlC8VvVylX7H0tkDDfmEYKtZmPqqeZmOev7/e71QWsmPOoSRxrrY/ZmnDITNHjRYPTKi4D9FLNVZeEDBabIO2Gn3BAhqlft8XDaY4DwBRVwIc/UROVBU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dMGAp+k5; arc=none smtp.client-ip=198.175.65.16
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749224641; x=1780760641;
h=message-id:date:mime-version:subject:to:cc:references:
from:in-reply-to;
bh=lB7lYnSbEiy3QlbxWlsGm9NoOotpmKsaXkCsatuLtCU=;
b=dMGAp+k5q9eIA56QE3vf+mjdl1tNwg8QY8i7qtE8Xf4XpxIShrerWI6f
l+BbffjZvLhPPvwVfIJP++M8m/qsqjMoqHYwsLDImZiiSvUBqmrzkoKoE
rq52BzQEyQRdc4lm/XR7yR9BgyNy/QSVp/khR04BvG/nEURVWfG+3WDyx
S1ppBAbDoH4tV4e9zRVOMCXvjou+7KQAU7JDEEFIXlrSQv6/TLybKdEy2
cnHJbsXB5nqTthGy5GWsCPi+4HohwdL8xHw1fZ1J7B2UU5A9dOzBStqWw
5R+zOxJZPD1wa+/0KlkbMG/1B20JDHVHdpthXD/c5WmQ/OLLDevjvJOne
g==;
X-CSE-ConnectionGUID: Hx6NfXDoQV2rFOW5onEi2g==
X-CSE-MsgGUID: KOLghiviTI6+vjqhqKbxPA==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="51456348"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208,223";a="51456348"
Received: from fmviesa003.fm.intel.com ([10.60.135.143])
by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:44:00 -0700
X-CSE-ConnectionGUID: ENqPB+5XQGiQY/yi1cX9fQ==
X-CSE-MsgGUID: AsKefRFdRIGewsNhJnZ6bg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208,223";a="149693365"
Received: from iherna2-mobl4.amr.corp.intel.com (HELO [10.125.111.31]) ([10.125.111.31])
by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:43:58 -0700
Content-Type: multipart/mixed; boundary="------------N9L4FQ8octb0E0gpQ8FX8oQZ"
Message-ID: <6412d84a-edc3-4723-89f1-b2017fb0d1ea@xxxxxxxxx>
Date: Fri, 6 Jun 2025 08:43:57 -0700
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Large modules with 6.15 [was: [PATCH v4 6/6] percpu/x86: Enable
strict percpu checks via named AS qualifiers]
To: Jiri Slaby <jirislaby@xxxxxxxxxx>, Uros Bizjak <ubizjak@xxxxxxxxx>
Cc: x86@xxxxxxxxxx, linux-mm@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-bcachefs@xxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx, Nadav Amit <nadav.amit@xxxxxxxxx>,
Dennis Zhou <dennis@xxxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>,
Christoph Lameter <cl@xxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>,
Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>,
Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>,
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>,
Andy Lutomirski <luto@xxxxxxxxxx>, Brian Gerst <brgerst@xxxxxxxxx>,
Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Shung-Hsi Yu <shung-hsi.yu@xxxxxxxx>,
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
References: <20250127160709.80604-1-ubizjak@xxxxxxxxx>
<20250127160709.80604-7-ubizjak@xxxxxxxxx>
<02c00acd-9518-4371-be2c-eb63e5d11d9c@xxxxxxxxxx>
<b27d96fc-b234-4406-8d6e-885cd97a87f3@xxxxxxxxx>
<CAFULd4Ygz8p8rD1=c-S2MjJniP6vjVNMsWG_B=OjCVpthk0fBg@xxxxxxxxxxxxxx>
<9767d411-81dc-491b-b6da-419240065ffe@xxxxxxxxxx>
From: Dave Hansen <dave.hansen@xxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=dave.hansen@xxxxxxxxx; keydata=
xsFNBE6HMP0BEADIMA3XYkQfF3dwHlj58Yjsc4E5y5G67cfbt8dvaUq2fx1lR0K9h1bOI6fC
oAiUXvGAOxPDsB/P6UEOISPpLl5IuYsSwAeZGkdQ5g6m1xq7AlDJQZddhr/1DC/nMVa/2BoY
2UnKuZuSBu7lgOE193+7Uks3416N2hTkyKUSNkduyoZ9F5twiBhxPJwPtn/wnch6n5RsoXsb
ygOEDxLEsSk/7eyFycjE+btUtAWZtx+HseyaGfqkZK0Z9bT1lsaHecmB203xShwCPT49Blxz
VOab8668QpaEOdLGhtvrVYVK7x4skyT3nGWcgDCl5/Vp3TWA4K+IofwvXzX2ON/Mj7aQwf5W
iC+3nWC7q0uxKwwsddJ0Nu+dpA/UORQWa1NiAftEoSpk5+nUUi0WE+5DRm0H+TXKBWMGNCFn
c6+EKg5zQaa8KqymHcOrSXNPmzJuXvDQ8uj2J8XuzCZfK4uy1+YdIr0yyEMI7mdh4KX50LO1
pmowEqDh7dLShTOif/7UtQYrzYq9cPnjU2ZW4qd5Qz2joSGTG9eCXLz5PRe5SqHxv6ljk8mb
ApNuY7bOXO/A7T2j5RwXIlcmssqIjBcxsRRoIbpCwWWGjkYjzYCjgsNFL6rt4OL11OUF37wL
QcTl7fbCGv53KfKPdYD5hcbguLKi/aCccJK18ZwNjFhqr4MliQARAQABzUVEYXZpZCBDaHJp
c3RvcGhlciBIYW5zZW4gKEludGVsIFdvcmsgQWRkcmVzcykgPGRhdmUuaGFuc2VuQGludGVs
LmNvbT7CwXgEEwECACIFAlQ+9J0CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEGg1
lTBwyZKwLZUP/0dnbhDc229u2u6WtK1s1cSd9WsflGXGagkR6liJ4um3XCfYWDHvIdkHYC1t
MNcVHFBwmQkawxsYvgO8kXT3SaFZe4ISfB4K4CL2qp4JO+nJdlFUbZI7cz/Td9z8nHjMcWYF
IQuTsWOLs/LBMTs+ANumibtw6UkiGVD3dfHJAOPNApjVr+M0P/lVmTeP8w0uVcd2syiaU5jB
aht9CYATn+ytFGWZnBEEQFnqcibIaOrmoBLu2b3fKJEd8Jp7NHDSIdrvrMjYynmc6sZKUqH2
I1qOevaa8jUg7wlLJAWGfIqnu85kkqrVOkbNbk4TPub7VOqA6qG5GCNEIv6ZY7HLYd/vAkVY
E8Plzq/NwLAuOWxvGrOl7OPuwVeR4hBDfcrNb990MFPpjGgACzAZyjdmYoMu8j3/MAEW4P0z
F5+EYJAOZ+z212y1pchNNauehORXgjrNKsZwxwKpPY9qb84E3O9KYpwfATsqOoQ6tTgr+1BR
CCwP712H+E9U5HJ0iibN/CDZFVPL1bRerHziuwuQuvE0qWg0+0SChFe9oq0KAwEkVs6ZDMB2
P16MieEEQ6StQRlvy2YBv80L1TMl3T90Bo1UUn6ARXEpcbFE0/aORH/jEXcRteb+vuik5UGY
5TsyLYdPur3TXm7XDBdmmyQVJjnJKYK9AQxj95KlXLVO38lczsFNBFRjzmoBEACyAxbvUEhd
GDGNg0JhDdezyTdN8C9BFsdxyTLnSH31NRiyp1QtuxvcqGZjb2trDVuCbIzRrgMZLVgo3upr
MIOx1CXEgmn23Zhh0EpdVHM8IKx9Z7V0r+rrpRWFE8/wQZngKYVi49PGoZj50ZEifEJ5qn/H
Nsp2+Y+bTUjDdgWMATg9DiFMyv8fvoqgNsNyrrZTnSgoLzdxr89FGHZCoSoAK8gfgFHuO54B
lI8QOfPDG9WDPJ66HCodjTlBEr/Cwq6GruxS5i2Y33YVqxvFvDa1tUtl+iJ2SWKS9kCai2DR
3BwVONJEYSDQaven/EHMlY1q8Vln3lGPsS11vSUK3QcNJjmrgYxH5KsVsf6PNRj9mp8Z1kIG
qjRx08+nnyStWC0gZH6NrYyS9rpqH3j+hA2WcI7De51L4Rv9pFwzp161mvtc6eC/GxaiUGuH
BNAVP0PY0fqvIC68p3rLIAW3f97uv4ce2RSQ7LbsPsimOeCo/5vgS6YQsj83E+AipPr09Caj
0hloj+hFoqiticNpmsxdWKoOsV0PftcQvBCCYuhKbZV9s5hjt9qn8CE86A5g5KqDf83Fxqm/
vXKgHNFHE5zgXGZnrmaf6resQzbvJHO0Fb0CcIohzrpPaL3YepcLDoCCgElGMGQjdCcSQ+Ci
FCRl0Bvyj1YZUql+ZkptgGjikQARAQABwsFfBBgBAgAJBQJUY85qAhsMAAoJEGg1lTBwyZKw
l4IQAIKHs/9po4spZDFyfDjunimEhVHqlUt7ggR1Hsl/tkvTSze8pI1P6dGp2XW6AnH1iayn
yRcoyT0ZJ+Zmm4xAH1zqKjWplzqdb/dO28qk0bPso8+1oPO8oDhLm1+tY+cOvufXkBTm+whm
+AyNTjaCRt6aSMnA/QHVGSJ8grrTJCoACVNhnXg/R0g90g8iV8Q+IBZyDkG0tBThaDdw1B2l
asInUTeb9EiVfL/Zjdg5VWiF9LL7iS+9hTeVdR09vThQ/DhVbCNxVk+DtyBHsjOKifrVsYep
WpRGBIAu3bK8eXtyvrw1igWTNs2wazJ71+0z2jMzbclKAyRHKU9JdN6Hkkgr2nPb561yjcB8
sIq1pFXKyO+nKy6SZYxOvHxCcjk2fkw6UmPU6/j/nQlj2lfOAgNVKuDLothIxzi8pndB8Jju
KktE5HJqUUMXePkAYIxEQ0mMc8Po7tuXdejgPMwgP7x65xtfEqI0RuzbUioFltsp1jUaRwQZ
MTsCeQDdjpgHsj+P2ZDeEKCbma4m6Ez/YWs4+zDm1X8uZDkZcfQlD9NldbKDJEXLIjYWo1PH
hYepSffIWPyvBMBTW2W5FRjJ4vLRrJSUoEfJuPQ3vW9Y73foyo/qFoURHO48AinGPZ7PC7TF
vUaNOTjKedrqHkaOcqB185ahG2had0xnFsDPlx5y
In-Reply-To: <9767d411-81dc-491b-b6da-419240065ffe@xxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

This is a multi-part message in MIME format.
--------------N9L4FQ8octb0E0gpQ8FX8oQZ
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On 6/6/25 02:17, Jiri Slaby wrote:
> Given this is the second time I hit a bug with this, perhaps introduce
> an EXPERIMENTAL CONFIG option, so that random users can simply disable
> it if an issue occurs? Without the need of patching random userspace and
> changing random kernel headers?

What about something like the attached (untested) patch? That should at
least get folks back to the old, universal working behavior even when
using new compilers.
--------------N9L4FQ8octb0E0gpQ8FX8oQZ
Content-Type: text/x-patch; charset=UTF-8; name="CC_USE_TYPEOF_UNQUAL1.patch"
Content-Disposition: attachment; filename="CC_USE_TYPEOF_UNQUAL1.patch"
Content-Transfer-Encoding: base64

RnJvbSAwOGQ5OGI0ZmEwOGJhNzZiZTk2ZTQwNmI1M2FlNjk5NDY4NDJmNmE5IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBEYXZlIEhhbnNlbiA8ZGF2ZS5oYW5zZW5AbGludXgu
aW50ZWwuY29tPgpEYXRlOiBGcmksIDYgSnVuIDIwMjUgMDg6MzM6MjkgLTA3MDAKU3ViamVj
dDogW1BBVENIXSBjb21waWxlci5oOiBFbmFibGUgY29uZmlnIGNob2ljZSBmb3IgdXNpbmcg
dW5xdWFsaWZpZWQgY2FzdHMKClRZUEVPRl9VTlFVQUwoKSBoYXMgYSBub2JsZSBnb2FsIG9m
IGxldHRpbmcgbm9ybWFsIGNvbXBpbGVycyBkbyBtb3JlCm9mIHRoZSBqb2Igbm9ybWFsbHkg
cmVzZXJ2ZWQgZm9yIHNwYXJzZS4gQnV0IGl0IGhhcyBjYXVzZWQgKG9yCmV4cG9zZWQpIGEg
bnVtYmVyIG9mIG5hc3R5IGJ1Z3MgYW5kIGlzIG5vdCBxdWl0ZSByZWFkeSBmb3IgcHJpbWUg
dGltZS4KRXZlbiBuYXN0aWVyLCBzb21lIG9mIHRoZXNlIGlzc3VlcyBuZWVkIHNlcGFyYXRl
IHVzZXJzcGFjZSBmaXhlcy4KClJpZ2h0IG5vdywgX190eXBlb2ZfdW5xdWFsX18gd2lsbCBi
ZSB3aGVuZXZlciB0aGUgY29tcGlsZXIgc3VwcG9ydHMKaXQuIFJlc3RyaWN0IGl0IHRvIGNh
c2VzIHdoZXJlIHVzZXJzIGhhdmUgb3B0ZWQgaW4gd2l0aCBhIG5ldyBLY29uZmlnCm9wdGlv
bi4gVGhpcyBvcHRpb24gY2FuIGVpdGhlciBiZSByZW1vdmVkIG9yIGhhdmUgaXRzIGRlZmF1
bHQgcG9sYXJpdHkKZmxpcHBlZCB3aGVuIHVzZXJzcGFjZSBpcyB3aWRlbHkgZml4ZWQgdXAu
CgpTaWduZWQtb2ZmLWJ5OiBEYXZlIEhhbnNlbiA8ZGF2ZS5oYW5zZW5AbGludXguaW50ZWwu
Y29tPgotLS0KIGluY2x1ZGUvbGludXgvY29tcGlsZXIuaCB8ICAyICstCiBpbml0L0tjb25m
aWcgICAgICAgICAgICAgfCAxMSArKysrKysrKysrKwogMiBmaWxlcyBjaGFuZ2VkLCAxMiBp
bnNlcnRpb25zKCspLCAxIGRlbGV0aW9uKC0pCgpkaWZmIC0tZ2l0IGEvaW5jbHVkZS9saW51
eC9jb21waWxlci5oIGIvaW5jbHVkZS9saW51eC9jb21waWxlci5oCmluZGV4IDI3NzI1ZjFh
YjVhYmMuLjNlZmE5M2Y4ZWNhNjYgMTAwNjQ0Ci0tLSBhL2luY2x1ZGUvbGludXgvY29tcGls
ZXIuaAorKysgYi9pbmNsdWRlL2xpbnV4L2NvbXBpbGVyLmgKQEAgLTIzMiw3ICsyMzIsNyBA
QCB2b2lkIGZ0cmFjZV9saWtlbHlfdXBkYXRlKHN0cnVjdCBmdHJhY2VfbGlrZWx5X2RhdGEg
KmYsIGludCB2YWwsCiAgKiBYWFg6IFJlbW92ZSB0ZXN0IGZvciBfX0NIRUNLRVJfXyBvbmNl
CiAgKiBzcGFyc2UgbGVhcm5zIGFib3V0IF9fdHlwZW9mX3VucXVhbF9fKCkuCiAgKi8KLSNp
ZiBDQ19IQVNfVFlQRU9GX1VOUVVBTCAmJiAhZGVmaW5lZChfX0NIRUNLRVJfXykKKyNpZiBk
ZWZpbmVkKENPTkZJR19DQ19VU0VfVFlQRU9GX1VOUVVBTCkgJiYgQ0NfSEFTX1RZUEVPRl9V
TlFVQUwgJiYgIWRlZmluZWQoX19DSEVDS0VSX18pCiAjIGRlZmluZSBVU0VfVFlQRU9GX1VO
UVVBTCAxCiAjZW5kaWYKIApkaWZmIC0tZ2l0IGEvaW5pdC9LY29uZmlnIGIvaW5pdC9LY29u
ZmlnCmluZGV4IDYzZjU5NzRiOWZhNmUuLjc0ZTVlOGQ2NDA3NTAgMTAwNjQ0Ci0tLSBhL2lu
aXQvS2NvbmZpZworKysgYi9pbml0L0tjb25maWcKQEAgLTE0ODksNiArMTQ4OSwxNyBAQCBj
b25maWcgQ0NfT1BUSU1JWkVfRk9SX1NJWkUKIAogZW5kY2hvaWNlCiAKK2NvbmZpZyBDQ19V
U0VfVFlQRU9GX1VOUVVBTAorCWJvb2wgIlVzZSBjb21waWxlci1wcm92aWRlZCB1bnF1YWxp
ZmllZCBjYXN0cyAoRVhQRVJJTUVOVEFMKSIKKwlkZXBlbmRzIG9uIEVYUEVSVAorCWhlbHAK
KwkgIE5ld2VyIGNvbXBpbGVycyBoYXZlIHRoZSBhYmlsaXR5IHRvIGRvICJ1bnF1YWxpZmll
ZCIgY2FzdHMgd2hpY2gKKwkgIHN0cmlwIG91dCB0eXBlIHF1YWxpZmllcnMgbGlrZSAnY29u
c3QnLiBLZXJuZWwgYnVpbGRzIGNhbgorCSAgbGV2ZXJhZ2UgdGhlc2UgdG8gZG8gbW9yZSBz
dHJpY3QgdHlwZSBjaGVja2luZyB3aXRoIG5vcm1hbAorCSAgY29tcGlsZXJzIGluc3RlYWQg
b2YgcmVzb3J0aW5nIHRvIHVzaW5nIHNwYXJzZS4KKworCSAgSWYgdW5zdXJlLCBzYXkgTiBo
ZXJlLgorCiBjb25maWcgSEFWRV9MRF9ERUFEX0NPREVfREFUQV9FTElNSU5BVElPTgogCWJv
b2wKIAloZWxwCi0tIAoyLjM0LjEKCg==

--------------N9L4FQ8octb0E0gpQ8FX8oQZ--


Return-Path: <linux-kernel+bounces-675973-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5480F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:48:59 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3B59B1779B9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:48:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 77DFF28A725;
Fri, 6 Jun 2025 15:44:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZJiIRsPN"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9C2E28A411;
Fri, 6 Jun 2025 15:44:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224654; cv=none; b=O8/Swk9uRo9mnqHl7KEFOVsGdNtt19LjOZ/er1Tv8Ep9g/Dh0V+VV+h61p20FFDErFUOWsV5Zxz0DsgGuPqSP1Pdt//MlNWMS/2EaENAWlEZ9516ywAVfisiGsuZ53XiY5WmW4irzV1DshEafTkvXA9WpBV5pu9tmS3oFoy8xBA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224654; c=relaxed/simple;
bh=4hZWSSBiBmXgCZRjHUQHX6vSbzo+EvjVtjI/uIdFtzg=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=WIz3uqRNTzih6D921OCtKnjX3bEg4Z2Jl0BtXnpxminBpNnF/4u1qrZsG1v2VOq85aJONBNM/KN0thhqtVMpp/qGMz6DDNqA33jil7oIFNumFk5BtRT2+R2KGb1kXKUz0/ny/UdG/zXLwPX3uixWd8CvbpzI6k6GUxIfQ0DE098=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZJiIRsPN; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAB77C4CEEB;
Fri, 6 Jun 2025 15:44:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224654;
bh=4hZWSSBiBmXgCZRjHUQHX6vSbzo+EvjVtjI/uIdFtzg=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=ZJiIRsPN9lKEs+00mT7wk1mGLVbzqP2MGEKDxM/XsTiwEsZoKIGhwEnXfL9VgH08o
llhboz7YTKVtq9muUS87RcaTlx9lU3L+n7AUzpWThyj5ahI3eBgGO6G10ehq/ANpfj
6Q21i6rbOmOOEu0MQ8S9vUQZu3PclHaBHOa9tcWD1cgQDhls4QZ/j7C2AnlM8j2O2g
aN4E+vSz8++Q41vMvGpdHC+FWSL0XW2iFE03axjmyHnEVrC6wAmF26CfaZAgfXVEaR
rct7bBrDk/dWcpXoDDMx9f/7ZjTc/L3MLJhmRHB3oixRpQOkqViIe5Vw5RHfHsoGAn
dyzNlnUHe1zIg==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Peng Fan <peng.fan@xxxxxxx>,
Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 5.15 4/7] mailbox: Not protect module_put with spin_lock_irqsave
Date: Fri, 6 Jun 2025 11:44:04 -0400
Message-Id: <20250606154408.548320-4-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154408.548320-1-sashal@xxxxxxxxxx>
References: <20250606154408.548320-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 5.15.185
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peng Fan <peng.fan@xxxxxxx>

[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]

&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
Signed-off-by: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES** This commit should be backported to stable kernel trees.
**Analysis:** 1. **Clear Bug Fix**: The commit fixes an improper use of
`module_put()` under a spinlock in `mbox_free_channel()`. Looking at the
current code in `/home/sasha/linux/drivers/mailbox/mailbox.c:489`,
`module_put()` is called while holding `&chan->lock` with
`spin_lock_irqsave()`. 2. **Locking Inconsistency**: The commit message
correctly identifies that `&chan->lock` is not supposed to protect
`chan->mbox`. In `__mbox_bind_client()` (line 324),
`try_module_get(chan->mbox->dev->driver->owner)` is called **outside**
the spinlock protection, making the current `module_put()` placement
inconsistent. 3. **Minimal Risk Change**: The fix is extremely simple
and low-risk - it just moves one line (`module_put()`) outside the
spinlock region. This maintains the same operation order but fixes the
locking issue. 4. **No Side Effects**: Moving `module_put()` outside the
lock doesn't change the functionality or introduce new race conditions.
The `module_put()` implementation uses `atomic_dec_if_positive()`, so
it's safe to call without additional locking. 5. **Follows Stable
Rules**: This commit: - Fixes a real locking issue that could
potentially cause problems - Is small and contained (single line move) -
Has minimal regression risk - Doesn't introduce new features or
architectural changes 6. **Similar Pattern**: Looking at similar commits
in the historical references, commits that fix locking issues (like
Similar Commit #5 which fixed a locking bug in mailbox-test) were marked
as YES for backporting. The commit addresses a legitimate kernel locking
violation where `module_put()` should not be called under a spinlock,
making it a suitable candidate for stable tree backporting.

drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 6f54501dc7762..cb31ad917b352 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -459,8 +459,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;

- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);

--
2.39.5



Return-Path: <linux-kernel+bounces-675974-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9CF9A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:49:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9DA8C17BFAE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:48:32 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CD5B528D839;
Fri, 6 Jun 2025 15:44:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Knytcgqs"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12D7928CF75;
Fri, 6 Jun 2025 15:44:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224656; cv=none; b=atQOCYYUFQ3yIEd9w5GctZe9NUzI8haSnW9gVDOhA8Q1nwm4X6Lu4Xl6oVLjnzVwr7ienpgl/GuYX4ebaxPEnfqRR7La7Bc8KBdJTgQRN6qujkeZyD274Af/BqUGx4f9L6XQfXyzr1mibeOQD50Mgcp7cw72Lki4kZoL0DPRyys=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224656; c=relaxed/simple;
bh=Xe4B3UwB3KrFzWPqln+xwgkGXyE/YS3pctsagI8BKFs=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=STFa1JDopkMGsoWXs157SwAMKR1HNprxLPdm/ZREO2vuYRNcj+L2UqZfJbPoINlJfptqiNok4GuHbPIdh4NQPH3cUaMcgnmpWM/mA1z7bFpVqQievp8MsUvPLtx/fZSf1J4yOEcR8IQxgNbcekLJEc60b2IRMfYYMkafa//yacw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Knytcgqs; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED8DBC4CEEB;
Fri, 6 Jun 2025 15:44:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224655;
bh=Xe4B3UwB3KrFzWPqln+xwgkGXyE/YS3pctsagI8BKFs=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=KnytcgqsmHte2WMMd5oCSNYySJps1Y1bcRr4DUSU70OozisIDeb7JEGoNyaEUz/Ov
DdSLYW2RDoYfaDkvtaqd1PbFKkxhezIbQHotUVrAZdftS1M/jIXTAmxQ0joJ8kUdCO
fz8RiyO5nvB2ejEk2eERtS8Bz3PS4Q5vUEkvPYaWrwXt9st7NXCr9FV/tbBIt7YU7k
aQFkrjxSV+AwB0ggy52N6OyJ0FXauhKvBCUE3gkBbEtTXXeosoKgj3wz5iBs/lMgCt
/ilFAAUKvE78e3QEFSwP48tUiuRBI10fayxQm0DzlLQAyJJVtpkouWIVw19vdHUtLN
lJS7QeD1Nq9lg==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 5.15 5/7] mfd: max14577: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:44:05 -0400
Message-Id: <20250606154408.548320-5-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154408.548320-1-sashal@xxxxxxxxxx>
References: <20250606154408.548320-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 5.15.185
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-3-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

Now let me understand the difference between the fixes - the historical
commits show two patterns:
1. Using `devm_device_init_wakeup()` - automatically handles cleanup
2. Manual cleanup by calling `device_init_wakeup(dev, false)` in remove
functions

Let me check if this specific commit has `Cc: stable@xxxxxxxxxxxxxxx` in
the message:

Based on my analysis of this commit and comparison with the similar
historical commits, here is my assessment:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Analysis

### **Code Change Analysis**
The commit adds a single line in the `max14577_i2c_remove()` function:
```c
+ device_init_wakeup(max14577->dev, false);
```

This addition occurs at drivers/mfd/max14577.c:459, right before
`mfd_remove_devices()` is called.

### **Bug Fix Characteristics**
1. **Memory Leak Fix**: The commit fixes a wakeup source memory leak
that occurs when the device is unbound. When `device_init_wakeup(dev,
true)` is called during probe (line 442), it allocates memory for
wakeup source structures. Without the corresponding cleanup call,
this memory is leaked on device removal.

2. **Small and Contained**: The fix is minimal - a single line addition
that mirrors the cleanup pattern used throughout the kernel.

3. **Low Risk**: The change has extremely low regression risk since it
only adds proper cleanup that should have been there originally.

### **Comparison with Historical Similar Commits**
Looking at the provided historical commits, there are two categories:

**YES commits (backported)**:
- `gpio: mpc8xxx: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`
- `gpio: zynq: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`

**NO commits (not backported)**:
- IIO driver commits that use `devm_device_init_wakeup()` instead of
manual cleanup

The key difference is that the YES commits use the same fix pattern as
this MFD commit - manual cleanup in the remove function, while the NO
commits use the `devm_` managed approach that automatically handles
cleanup.

### **Impact Assessment**
- **User Impact**: Memory leaks on device unbind affect systems where
MFD devices are frequently bound/unbound
- **Subsystem**: MFD (Multi-Function Device) is a core kernel subsystem
used by many embedded systems
- **Regression Risk**: Minimal - adding proper cleanup cannot cause
functional regression

### **Stable Tree Criteria Met**
1. â?? Fixes an important bug (memory leak)
2. â?? Small and contained change
3. â?? No architectural changes
4. â?? Minimal risk of regression
5. â?? Follows established patterns seen in other backported commits

The commit follows the exact same pattern as the GPIO driver commits
that were successfully backported to stable trees (commits #1 and #2 in
the historical examples), making it a clear candidate for backporting.

drivers/mfd/max14577.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index be185e9d5f16b..c9e56145b08bd 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -467,6 +467,7 @@ static int max14577_i2c_remove(struct i2c_client *i2c)
{
struct max14577 *max14577 = i2c_get_clientdata(i2c);

+ device_init_wakeup(max14577->dev, false);
mfd_remove_devices(max14577->dev);
regmap_del_irq_chip(max14577->irq, max14577->irq_data);
if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
--
2.39.5



Return-Path: <linux-kernel+bounces-675976-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6E07541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:49:40 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 843D8175B9F
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:49:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A655928D8F1;
Fri, 6 Jun 2025 15:44:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ha+fWjjk"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D889528D8DE;
Fri, 6 Jun 2025 15:44:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224668; cv=none; b=NeI1TTk8vvuuGSqjhEi1JRUs6/yywmeV9w3jLeXuU0qK/TUvt72NY37gY4E8JZiu1cpkH/vPYE1/E/XUPmmgkzKoRdKhaglvCJNQ+X9JJHUI4Y6QXdVxihomnCDa3pn2Wr0afpNnDFdmskH2MooXHbp9BPtymtQ9av4ZX5OxUd4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224668; c=relaxed/simple;
bh=Xe4B3UwB3KrFzWPqln+xwgkGXyE/YS3pctsagI8BKFs=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=fX+es7HnyMLNGRBGV5dDjy4zkxJig4Cof6sPBnTgmVSqWB6IERDDOr7rU6bAlHX/x4Z99u3YdtbSGgDrA6hwTKpO5PNSa+AaUabKw8JBrYJH6ohoItyOCAVhkgUWPm1sdExEL+LWnwDvaD0PTNkfajxsiKqB73l0U4TBEDNXCgs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ha+fWjjk; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7420C4CEF0;
Fri, 6 Jun 2025 15:44:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224667;
bh=Xe4B3UwB3KrFzWPqln+xwgkGXyE/YS3pctsagI8BKFs=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=ha+fWjjkAP/XRZz0MAh1AM2s+m60UknDHwRRWx9cAek89vY1B1Y1w8pnzrUVPBCH6
xUdhR/EnOYfTHzuNSaXi2+jy+RazDL3GP/DHsTVkAJFEnOd3wFTyjn5SiObspeNLuY
wEj5E3spe86HsIKAXpBRF9N1E2RGLPJXglsG27ynvva4rm3Wyuu+5alAJXpj7hM3zx
yoh2ypvtqZi2x85bOzlQ92dZpZNHLwP7GYs98Mh7sttOuqImQdHSSoVRVepXRgQq16
pRXKKVKFe74gUobnIKfLA6YNiltynZkyL/YHybNBEnB95dhiSvuTT8Rd01Ih2v+G6Z
AV95lboH4KKgQ==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 5.10 4/6] mfd: max14577: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:44:18 -0400
Message-Id: <20250606154421.548570-4-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154421.548570-1-sashal@xxxxxxxxxx>
References: <20250606154421.548570-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 5.10.238
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-3-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

Now let me understand the difference between the fixes - the historical
commits show two patterns:
1. Using `devm_device_init_wakeup()` - automatically handles cleanup
2. Manual cleanup by calling `device_init_wakeup(dev, false)` in remove
functions

Let me check if this specific commit has `Cc: stable@xxxxxxxxxxxxxxx` in
the message:

Based on my analysis of this commit and comparison with the similar
historical commits, here is my assessment:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Analysis

### **Code Change Analysis**
The commit adds a single line in the `max14577_i2c_remove()` function:
```c
+ device_init_wakeup(max14577->dev, false);
```

This addition occurs at drivers/mfd/max14577.c:459, right before
`mfd_remove_devices()` is called.

### **Bug Fix Characteristics**
1. **Memory Leak Fix**: The commit fixes a wakeup source memory leak
that occurs when the device is unbound. When `device_init_wakeup(dev,
true)` is called during probe (line 442), it allocates memory for
wakeup source structures. Without the corresponding cleanup call,
this memory is leaked on device removal.

2. **Small and Contained**: The fix is minimal - a single line addition
that mirrors the cleanup pattern used throughout the kernel.

3. **Low Risk**: The change has extremely low regression risk since it
only adds proper cleanup that should have been there originally.

### **Comparison with Historical Similar Commits**
Looking at the provided historical commits, there are two categories:

**YES commits (backported)**:
- `gpio: mpc8xxx: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`
- `gpio: zynq: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`

**NO commits (not backported)**:
- IIO driver commits that use `devm_device_init_wakeup()` instead of
manual cleanup

The key difference is that the YES commits use the same fix pattern as
this MFD commit - manual cleanup in the remove function, while the NO
commits use the `devm_` managed approach that automatically handles
cleanup.

### **Impact Assessment**
- **User Impact**: Memory leaks on device unbind affect systems where
MFD devices are frequently bound/unbound
- **Subsystem**: MFD (Multi-Function Device) is a core kernel subsystem
used by many embedded systems
- **Regression Risk**: Minimal - adding proper cleanup cannot cause
functional regression

### **Stable Tree Criteria Met**
1. â?? Fixes an important bug (memory leak)
2. â?? Small and contained change
3. â?? No architectural changes
4. â?? Minimal risk of regression
5. â?? Follows established patterns seen in other backported commits

The commit follows the exact same pattern as the GPIO driver commits
that were successfully backported to stable trees (commits #1 and #2 in
the historical examples), making it a clear candidate for backporting.

drivers/mfd/max14577.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index be185e9d5f16b..c9e56145b08bd 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -467,6 +467,7 @@ static int max14577_i2c_remove(struct i2c_client *i2c)
{
struct max14577 *max14577 = i2c_get_clientdata(i2c);

+ device_init_wakeup(max14577->dev, false);
mfd_remove_devices(max14577->dev);
regmap_del_irq_chip(max14577->irq, max14577->irq_data);
if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
--
2.39.5



Return-Path: <linux-kernel+bounces-675975-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C644941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 693213B47DC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:48:31 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F06717C219;
Fri, 6 Jun 2025 15:44:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WxQXL1gg"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DAD9289800;
Fri, 6 Jun 2025 15:44:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224666; cv=none; b=ZVl5U0XXYkfjHyxZrv5k9k/oa1j2drpiCyg3+IBFSFphdwLbQnsRKwnyBONcwrtzVU8Jljo7f+CUEo2idTdEZ00I6Cy1Eg8ldP6SoGzwa1di9W9dfCm2ngTz8fnm08yCk2gLaQQYRSHvcvWV7Udk3tY4ipBfNC0C/zOzDuRYads=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224666; c=relaxed/simple;
bh=4hZWSSBiBmXgCZRjHUQHX6vSbzo+EvjVtjI/uIdFtzg=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=QPWhuA6r3ylJwOmizknwowQzrWS4H8HbJvmOGiO9G9BZX55g7ToM//CFqTBv3lnu2ZZc8+wa4PMMVhzKo/eGlDrH5HnzxSEWqzEfkUiECHI/p6Qq2mCmylE1wTcapxCMQEqihq4OuWAd+9JxrcjpQ2F0qleoFWVc1fjPBxyiFU8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WxQXL1gg; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80517C4CEED;
Fri, 6 Jun 2025 15:44:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224666;
bh=4hZWSSBiBmXgCZRjHUQHX6vSbzo+EvjVtjI/uIdFtzg=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=WxQXL1ggiZWiq+CZF8uNE3H51s/MrUN7LOEYGtaxumSgp5xfnlF/CRb/2PGLJqzLy
lNGozZNx7mdeHRN4SFqHWPITOzDeVNXpIq4LXd73Wrq59BHeARPa3BRtRZKtY/R1mM
Ezi5F41ZWKQUxOxrE5uCvAUZJEhvJMFDuqYyk/o2cfmbMFOytw4bM+hd461kyAJszE
jRDjzHS6MxFHazLrz7baig0NFsUONYQqZMJB324hz83VwLal9Bm7OVgO1eQTgDa2I0
PkWEAGOUyLcEOBQdQ1+gF983lwixeYm0Xl7MhknUBx+waII3scCM3AhwYrkHwFL9dR
jBt4ZynZUAZJA==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Peng Fan <peng.fan@xxxxxxx>,
Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 5.10 3/6] mailbox: Not protect module_put with spin_lock_irqsave
Date: Fri, 6 Jun 2025 11:44:17 -0400
Message-Id: <20250606154421.548570-3-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154421.548570-1-sashal@xxxxxxxxxx>
References: <20250606154421.548570-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 5.10.238
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peng Fan <peng.fan@xxxxxxx>

[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]

&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
Signed-off-by: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES** This commit should be backported to stable kernel trees.
**Analysis:** 1. **Clear Bug Fix**: The commit fixes an improper use of
`module_put()` under a spinlock in `mbox_free_channel()`. Looking at the
current code in `/home/sasha/linux/drivers/mailbox/mailbox.c:489`,
`module_put()` is called while holding `&chan->lock` with
`spin_lock_irqsave()`. 2. **Locking Inconsistency**: The commit message
correctly identifies that `&chan->lock` is not supposed to protect
`chan->mbox`. In `__mbox_bind_client()` (line 324),
`try_module_get(chan->mbox->dev->driver->owner)` is called **outside**
the spinlock protection, making the current `module_put()` placement
inconsistent. 3. **Minimal Risk Change**: The fix is extremely simple
and low-risk - it just moves one line (`module_put()`) outside the
spinlock region. This maintains the same operation order but fixes the
locking issue. 4. **No Side Effects**: Moving `module_put()` outside the
lock doesn't change the functionality or introduce new race conditions.
The `module_put()` implementation uses `atomic_dec_if_positive()`, so
it's safe to call without additional locking. 5. **Follows Stable
Rules**: This commit: - Fixes a real locking issue that could
potentially cause problems - Is small and contained (single line move) -
Has minimal regression risk - Doesn't introduce new features or
architectural changes 6. **Similar Pattern**: Looking at similar commits
in the historical references, commits that fix locking issues (like
Similar Commit #5 which fixed a locking bug in mailbox-test) were marked
as YES for backporting. The commit addresses a legitimate kernel locking
violation where `module_put()` should not be called under a spinlock,
making it a suitable candidate for stable tree backporting.

drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 6f54501dc7762..cb31ad917b352 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -459,8 +459,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;

- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);

--
2.39.5



Return-Path: <linux-kernel+bounces-675982-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 487EB41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:38 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 28A3E7A96DF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:49:17 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 79B4F193077;
Fri, 6 Jun 2025 15:45:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b="cHkiLrbk";
dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b="CSFEcP07"
Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68])
(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 AD12E45009;
Fri, 6 Jun 2025 15:45:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.151.68
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224739; cv=fail; b=mbh6CD5rkLUyDglcWI6krlU2/H7GNVAzTZfIzuI5EURBEW5IvTic1X0vEefz2yeaCwot4kzacguJrCeNcUHkysgSo4y6zHkXy0e29S+W/pNp8E21T+nZiOUKJ5KemnLmEBfIckAp3W0mi/ss5FffhL7VYNZH3wVbgujttO3ivWE=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224739; c=relaxed/simple;
bh=J/sZYcIWtV8RMt3wyyAPl6QNpmqggyhK/UQZVw9NB3o=;
h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
Content-Type:MIME-Version; b=ZrIRSfjW61vDFYch0X8BwMXMh4XQDeAQerW99Ioh6AohlXlEpOWZXTE1qo0WLQLDpNau7IzfIP1m6zp/Ssx/nvqG6yJzzdD/F4XYJidrxplYHkjkpXkJ3rWriIvS+zNfbBn9/aCBBieeL0zttcKeppjdn/IfAk9hb/9QXx/J12Y=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nutanix.com; spf=pass smtp.mailfrom=nutanix.com; dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b=cHkiLrbk; dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b=CSFEcP07; arc=fail smtp.client-ip=148.163.151.68
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nutanix.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nutanix.com
Received: from pps.filterd (m0127839.ppops.net [127.0.0.1])
by mx0a-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5567L1RS008912;
Fri, 6 Jun 2025 08:45:26 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=
cc:content-id:content-transfer-encoding:content-type:date:from
:in-reply-to:message-id:mime-version:references:subject:to; s=
proofpoint20171006; bh=J/sZYcIWtV8RMt3wyyAPl6QNpmqggyhK/UQZVw9NB
3o=; b=cHkiLrbkZ2yOTjkjdsaa1cPPccQ5p/pLUoeVBMCu59YysdrU8hbFzYTld
OYXMDfwYTF5K4SoreoNNbgcoMcEUq/xXMjGlF5LWyl3xLQoIvy74q4UUYKNf/onJ
RfjSgTlCiK8w5HOAjQXl1eLVoY/IS1+iJjA+mjWvRTI/YCuVSljRe9gRBmaMbV/h
NOVoebKCjTjqaUUdlmmKRQ1SuL5Mh7Rx7f2nnhTG1roha9PyAa0uqC30rgg862Up
64HVtJvCtb2S9rls43zI8/G8bpaE0xmii4Yb/zCWTCRWcN1Gi7E0zW5CTqhSnWKv
qScyvMfijN1yBl/+ssphhfh+OSG0Q==
Received: from dm1pr04cu001.outbound.protection.outlook.com (mail-centralusazon11020105.outbound.protection.outlook.com [52.101.61.105])
by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 472t28d3wp-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Fri, 06 Jun 2025 08:45:26 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=sYtqfHk7ClS23wAsaWp1MHwbP3n9wQdAavH2CCvniA/2t8KQEqXY7B+fFLHQPWI9wDMLN0HNG/5fkcS+HclmLsbUDGPHnfPpsBOkyHCTWKhJ1W9zCoNMs9yv+c9r7zU9HI4cs4imjJxFehwTMfYHhEFf3kds+2NDw6+RLW13rGC2gzkWLqOM+zGjnhB51j7ZjsTDf4XxYc7TW/olv5EPLv23p4yPlDGmtBzNmj1BAnxIvJrCB51a3G4y6MYgR9VXdj0pngHYOaQPH+bgFjW8gnOP9BFsfGou/whX3NXoDz9iDgWZ1gSLdUZuQ2utzlSfNqrNQFIRCt28wd6Oup5nDg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=J/sZYcIWtV8RMt3wyyAPl6QNpmqggyhK/UQZVw9NB3o=;
b=tTZVHJimAzPc4W6WUOr1ZXDC+SJAjA5CCmCT8R3T5wIx1vq9p4lGVkP4o4dGIJhkLDl9FjSKRpSBgTWi4XuJvIB+ZQadgrGOoqeo8ieEATdVHXlaIDwUTiMSN/sXxT2/drRiqdoNdJ+9wYGyBByo5Lq2siyQk11WXDru/hhKWrFJV3nv+dlcp+/NJJdnuUzJ9IG98PrepytvDbH8MDlzxjMKp+JkLljX+QWtGkg+FkQr0XjDlDkzwBVaHtTYou7G5Rca5aMimcVxdLZ9wj206pPSxwWB+7lRnTq8npHiG1qYy/SAryqkYhZ3FBjDPhxcwhpjM+RmNVDRbJlK8e8o4w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com;
dkim=pass header.d=nutanix.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com;
s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=J/sZYcIWtV8RMt3wyyAPl6QNpmqggyhK/UQZVw9NB3o=;
b=CSFEcP07hqwgrTD8TB/RpAe5dAGhSIYKUJKuHPPtmpLv4n8+tv6O0W0zm9CiDCpkTMnHM1QJHBl+viptLYO9Wy/WeaF4rx/6JPT43cflRSsPdbBF+zygIW5rPlXFCEN/C7h7gXyyt3Hk7LbnLUJpP+XzozTw7ZJ/chDWo4LzKexbt8+16Oa5y6vvtEFtgSb4iH4oYoS0u5XehPYqzF9r3ghwSz2Pn0S/WSW9BpX9yFGozpjzreTAqbLT2Gys3n6cMCRfjP9NRohCxh5ncRP2Y2OLUqGfO6q14YD3VnbWfShgdb2Vh+strga/mh1qfOgfahIPo7+SysNnAqR7EWR0YA==
Received: from LV8PR02MB10287.namprd02.prod.outlook.com
(2603:10b6:408:1fa::10) by PH0PR02MB7704.namprd02.prod.outlook.com
(2603:10b6:510:53::6) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.24; Fri, 6 Jun
2025 15:45:21 +0000
Received: from LV8PR02MB10287.namprd02.prod.outlook.com
([fe80::b769:6234:fd94:5054]) by LV8PR02MB10287.namprd02.prod.outlook.com
([fe80::b769:6234:fd94:5054%6]) with mapi id 15.20.8813.020; Fri, 6 Jun 2025
15:45:21 +0000
From: Jon Kohler <jon@xxxxxxxxxxx>
To: Sean Christopherson <seanjc@xxxxxxxxxx>
CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>,
"kvm@xxxxxxxxxxxxxxx"
<kvm@xxxxxxxxxxxxxxx>,
"linux-kernel@xxxxxxxxxxxxxxx"
<linux-kernel@xxxxxxxxxxxxxxx>,
Sergey Dyasli <sergey.dyasli@xxxxxxxxxxx>
Subject: Re: [PATCH] KVM: x86/mmu: Exempt nested EPT page tables from !USER,
CR0.WP=0 logic
Thread-Topic: [PATCH] KVM: x86/mmu: Exempt nested EPT page tables from !USER,
CR0.WP=0 logic
Thread-Index: AQHb1BjpL7ey8iXfDkWgZ+PYbYD1nLP2S3+A
Date: Fri, 6 Jun 2025 15:45:20 +0000
Message-ID: <AB0DED95-EAE9-4371-AEBF-9BE212AE3B05@xxxxxxxxxxx>
References: <20250602234851.54573-1-seanjc@xxxxxxxxxx>
In-Reply-To: <20250602234851.54573-1-seanjc@xxxxxxxxxx>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-mailer: Apple Mail (2.3826.600.51.1.1)
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: LV8PR02MB10287:EE_|PH0PR02MB7704:EE_
x-ms-office365-filtering-correlation-id: 50a07e9b-3fd6-44ac-6a55-08dda51124fe
x-proofpoint-crosstenant: true
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
BCL:0;ARA:13230040|366016|376014|10070799003|1800799024|38070700018;
x-microsoft-antispam-message-info:
=?utf-8?B?VFk5cmUxK0NqRUdJVGJ4MjlqM3FuUlltR21LcGErV1NjSE9UYi9ZSUp1N21k?=
=?utf-8?B?OGlxbkxrYWZUNnAzeVp4STVnNFd1WXZyRmlyeGdaMlM4RHJGbDdnNmo5U3Rw?=
=?utf-8?B?aUxlNW85ZVhYVE1jZUtuSE5NaXo5dUxGUTZVREI0UjdhcnNoOFdWU25JeitJ?=
=?utf-8?B?RkJxc1ZPaU9MamlneithSE9RbFRWMnZ2N09hTHpCc3hkWm10VCtQa3ZLNGp3?=
=?utf-8?B?RFJuZjQxS2hMTXJXb1BnWFBhUUZyL1g1c2xYWS9rMm0zOHFyVHZlL1MwK0t2?=
=?utf-8?B?UjhBSEZIOWNrdm5ZRG03QWRyOGdYb1kyNzV1MHhjUjhHd0daUTA4MXltaENR?=
=?utf-8?B?V3dVdDd6L1lmTWk0R1p5bjU2cXg4ZG1sVnRCSzdTbUdkTkZVcDZnMkFkdHZh?=
=?utf-8?B?NWVOd1psTnNlS3JISjErNXhjS2NDeUx6c0NhenBnenNSRTdTK0pDVlJCNzVF?=
=?utf-8?B?WWNnK3hGOCtucytCaFZFNm9mREJTOGMwcWF0aXFMYkRNOVlTY2VnSUQxQk9Z?=
=?utf-8?B?QmZhQ1lWYVVpWVRDYVJxQklGOUZMV3dpUDBTODFCamtIZWtUZDF2OW90Qm93?=
=?utf-8?B?cXp2ZzRENm5na0E2M0UxQ0VwL2poZXRLQ2w0Ym9NY015NDFUVnIyb2xuZUJQ?=
=?utf-8?B?RHF6UGlBVHFOTithZWNKSWJBdW8xeitmUjErVmo2REZDK2JneFpXcTdZS25L?=
=?utf-8?B?VEtQM1B4MWhBU2VqUUJIWFZzcytLS2I5UlFCNHB4YXNqdUU5czRjakxNOVBa?=
=?utf-8?B?b0hld21vN3NZVlhCa0ZYb0syL3pPOHdEYzgxWTdtU0NDRW13VG1mVXFXZjdG?=
=?utf-8?B?RUUvQURobUlYUUdvUVIxRHYvdVFSc2dZRVBIQVpvUE80ZmMzNzFaZlNPS2Ny?=
=?utf-8?B?Z2h0M1dMaXdkSnpvRGQ2YU1IOVJ2emFsNkt3V09NaGJDbVl1RjhubHlHbGp4?=
=?utf-8?B?R0s0ZW54NUVmWEpLYXZqV1ZKRExlNHRYaWJoV0UwTGFyR3BrMk5TWHMyVTJB?=
=?utf-8?B?ejBITnJRWmx5MnBtaTZZRkg1R3BoNDVhY2UrN0J3aG12YzlVRyt3dEtpdEdI?=
=?utf-8?B?Z1JXd0FIVmRtSjcxOXlRaFY2WGZPNzk3Mittd3pOVGVwbEF6cUNwUTJUTlI4?=
=?utf-8?B?R1lUUjhodnpsWVJrMWlIdU45UktZY3pQelNEODdyQ2VvYVN3Qk5RcnZINjNH?=
=?utf-8?B?YUR2enNydDk5eXFhOVV3SlRxQUpKcTNHdjNmdUJ6cDk3bnZDWW9VNVRIV3hQ?=
=?utf-8?B?dnF4WWxDMTJPdjZUanRmR0lOZDJ2NGk2d0RlTXZxVGpEb3RoRDg2MURmUXpG?=
=?utf-8?B?b3MvTk9OUjQzWlcyQnFPU2JsNXFscUIzQ1RFMURhbWpvNmJ3M2NKR0pWd2hp?=
=?utf-8?B?V09TVnZYb0lvTlhmVG9xZHE5MTUvOWpmZ0kxQWQwcURmZ2FoZHdRRTIvUkNR?=
=?utf-8?B?Q0l6cUlJSENJeVZ0WVl1cW5hMDU3N1JJK2JEcEdkMFd3aGhqd2VNU3dHQzhK?=
=?utf-8?B?QWREaThraERUeVZuSDA1ZUpET29jZHE2ZWZad0QwUlNaQ0hwdjIrQkJVRzhR?=
=?utf-8?B?SkptZzA1blU2KzFSMy90bmlYQjZPcUtoUEsrbGZxSFBlQUNHRnk5TUREWjZD?=
=?utf-8?B?aGwvRU1qb0REd2JQWEE0T2NweGNXSXVObUFxZUIwZW1Lc0xIR3VoVEhFZGk5?=
=?utf-8?B?dkdRU0xoaW1LelVuWTd2TVgzNmtrTjF5TjJWVDlMSHJCNHpkWFNBT1BqeUlJ?=
=?utf-8?B?d0RoeEVzaXp0VmMvNXpWOEpyRHphYnh1NkFmYUtkOWFERlVUa1l6Q1krM0Nr?=
=?utf-8?B?eDBVdzFxdllJWk1SVElreDkyQ0R6RXR5RlRjSjNGVGRtUmpwdytzVlFhLzN5?=
=?utf-8?B?RTM2UFVJU0pTOFhNK2VXaHJlTmFXbGswbHp1Wm1LM0t2djBaMG5udjFrTVdM?=
=?utf-8?B?b0UvTkNINEROU1VsTHc4eEZoeGpsSnBLTFFGRExwd240NWhiMm80b0xCNTFE?=
=?utf-8?Q?vppVPq7XAIC/M4DiF7qZLUKn1hP0ig=3D?=
x-forefront-antispam-report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV8PR02MB10287.namprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(10070799003)(1800799024)(38070700018);DIR:OUT;SFP:1102;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
=?utf-8?B?cU90cUUrNk5xZ3hWWGZON2c3UEExdVZDK1h0NFlwaDJ0UVdsdmU1RWFpTDZ2?=
=?utf-8?B?aFNyeWhBMHRUNXpKcmtwMGFnQ1BtZnlHQUZHUEk3YjVmNTVlZ2swb3lWWHBq?=
=?utf-8?B?MmFFbkxkbFhFQURjUXpMa1E0SXVINitXVGNucXU4dG5hUXdsSHR0L1IxRmE2?=
=?utf-8?B?bHBsam4vZytac2Vubm9sK25icHZ2eEFxdmxsZkxRbjRWcEU3Wk1OVFBJMEZa?=
=?utf-8?B?QVk3Y3R4MTNGbkNDRDk1UkNQSllaL0Z0ZGZqZlBVZEkxbHNiVTZTYm03dlhs?=
=?utf-8?B?dUJDazAwcTl4TCs3SHM2Tmg5TmV4SzVSd0tNdTdZa2p2bVY0Smpod3RGeGNk?=
=?utf-8?B?cTNJeW1nU243RHZpaWVxb0puYnpNS2MrODZ5bStGS3lpOWE4THB2akFZajZl?=
=?utf-8?B?MkhqQk40OVUyVmU4aHN0SnVkNjFSZWFQWmtSSTVsdzk2TTdPUFl4Vkl4cDAx?=
=?utf-8?B?NCt2aHlOZjAwaUpLS2ZTbkx3Q1Q1VVJjSTJRTmhmSEliN29ReVlyTm1uSWQz?=
=?utf-8?B?SkptSUFyeTJEZ3lQVlVnM2tmMVdoWHF4dkl5VzYrNXZtZk9iWldtcEU2Vm1w?=
=?utf-8?B?MnYvbEtuOFRiUHlpS2ZPa1d2STZlT1UzZTJ1WnkwQWprYVNNbkJ2SkVCUlpY?=
=?utf-8?B?ZWRKMkEyUUR2WGZEVW5BSVFkUENqMmlTMjNDYU85alZyR0NyODE4R2h0SDBU?=
=?utf-8?B?OEIvb2RaRFhPU3lCV1docHBqcTE4Y0V2blF6MU5LMGlGbmFVTElLUjU2YXhq?=
=?utf-8?B?d2hReWRZZVZoYVIzR1NBakk4RnZBdTYrc29lczhjZGg3cFBOVkR6QmY5UFFx?=
=?utf-8?B?WmdXNnFya25DaGxFdkZxUllDRjZxeVlwYnExZzZ6Ujhzdlk1OFZEUVVUUDFF?=
=?utf-8?B?MjMxUCtFU0dnSk11OWtkMzhXR1lxeGhOcTlsbDFUUG91Y0FBMVU0TGo3MEtD?=
=?utf-8?B?SXE2K3p3V1JiR3pJTVFYZW1nY0UxM3RrQ2FUZmxFQjA3MWZsRTFKNzBzY1pJ?=
=?utf-8?B?dXl3VDBMUHRpRnFHTDBnbVg4WTJDTVhFVlQ2ajJSc2tKWlN6b3VQTGJ1Ym5G?=
=?utf-8?B?cDNuZmxWbmNPZkY5eXBER2ZSaFZlRmIxbUVkSzFxRlhYNnBaYjlpUC90RTdq?=
=?utf-8?B?OXJHRWl1eXA5SGtEblNYRDhmTm9VSEErQUVIVmdzczUyOTNkY2s5eGJ5Y1h1?=
=?utf-8?B?ckdqbmNqZkFpcERzTkFCNWgrWDM2QVlEYkF0WVF1R1hhN0thSnlSUUc0RTUr?=
=?utf-8?B?d2cwY1dsQUlCMWJTQ1BSL0V6R1FBSVBJRFBlaTl1NFlSM1dUdU9DSjJaaHkx?=
=?utf-8?B?OUFRZUpIbUdvaEgzVDRhVk02OU9yanBlWjNjb2doODM3b2xBalh6YVVUa09K?=
=?utf-8?B?WGVFT3oyWVBPV1RkQ3luRkIzdVV6Y2J5QTArVmxWZldEUGVmQXlQUGw0UTIx?=
=?utf-8?B?MGx1Ym9JZ01TTU0wcW9uV3k1bHRGWHByamg1UmYzdGlZblBBdHowY0FsWUlF?=
=?utf-8?B?WWpmUVhLQkdsYTA0cGdDRjByaWgxRzl4RmY4QUFIVmNSaUk5bnN4bUhVTkw3?=
=?utf-8?B?Wmx5K0R6dStPUytBM25ZVGorVXY4enQ1UE4ranlqVW43WG9JQ1ZlRTJ4OWpj?=
=?utf-8?B?NHhibVNhQms2dTg0WXJRRi9LdXdCb0IzRnd2bE05K0JZWDR2ZGVwNTBLdmZM?=
=?utf-8?B?OUhYcDdBamRXQVltTGI5bG1Id1YwU2xrbFdwQ000MldIc3IyRytxZFZtNjho?=
=?utf-8?B?UHpXcmFkUnFENWt0aTdWa09hcVV3ZmpFampac1dXdWplL08ySGxXL3B0anIx?=
=?utf-8?B?L3dDNTRXaHg3K2hZc3A0eW1rQnc1ajVrSktqS0EzSlJWbU9QSVo1OXJQYlVU?=
=?utf-8?B?QXVpWDN4d2o3NU9IZDBMZldsUVdMYk5BeWF6Q09UQUd3bHpDUjMrSjhsaENm?=
=?utf-8?B?bVUxYkJaTy9BS0lXOS9MWXNEazhQdkNmTmw0ekd0NmVPaEtqK25zcTVmYkZZ?=
=?utf-8?B?YnpTcXdnZGNwS0puZWcxNSs0Z3p0ekxzZHlEUnFPWlIrSGQzSEQ0bEZBUlpt?=
=?utf-8?B?KzRyK2NaQkl3RndSYzZ6dGZrckhUbm9ORjFxWVJTenQyUGZPQ0t4eWpDMDVZ?=
=?utf-8?B?V1NLYTZ1VjdpSEdDYVRpQ0gwMmRFbFAwSW1aK3hhM3N1MldGNkFqNWgwSG9F?=
=?utf-8?B?cHNHVzYxVHIyKzlDckE5Z2RMdzRsc0tLZi9DWXJkdXcwYjZWZ2ZGN1MxN2VO?=
=?utf-8?B?cFpwV3RDSS9oS2R6blBtWEpXMmlnPT0=?=
Content-Type: text/plain; charset="utf-8"
Content-ID: <3813D8DDFF82CC43A7C51B1A9E4950E3@xxxxxxxxxxxxxxxxxxxxxxxxx>
Content-Transfer-Encoding: base64
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-OriginatorOrg: nutanix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: LV8PR02MB10287.namprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 50a07e9b-3fd6-44ac-6a55-08dda51124fe
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jun 2025 15:45:20.9923
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: dRO4MqVXeTNePmDk3jFzREKswrjd/HD0Bu2drIJpp8qzgr+kKb4ZSBoY/mFk+xvYy2mHCnPz3TZYZS/7wqlIMIgJY1lBp05hbacKSXwWa8E=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7704
X-Authority-Analysis: v=2.4 cv=ON0n3TaB c=1 sm=1 tr=0 ts=68430d16 cx=c_pps a=SfbXOumlQYQ7ptoTXzRROw==:117 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10
a=6IFa9wvqVegA:10 a=0kUYKlekyDsA:10 a=1XWaLZrsAAAA:8 a=64Cc0HZtAAAA:8 a=Ja9HPyursiWi4vRtUWwA:9 a=QEXdDO2ut3YA:10
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA2MDEzOCBTYWx0ZWRfXzc1IjTzZ4a7w 7AGscKlch3lor9ssxzR7xnNiTyk0UQ0kZWYSW6bm57w/+F5fFwQtArkoxKSSvF6X9JiVAuIwmwJ jEZFpuWC1yh/xvs8hT3mURNIvW7n2OwbVzP1gXWcbmPkgaYx6Q+9YiuiIsxQhlrjLr9Rm7ML0kA
TdP1fDBMFo9h+2boihOza90cCTltLzxshOzXS7A9+7k+/Xst63tQBAsqLhlYAAR0QG/mhKQbcwJ 1sA1dSUMIfRCWWx3sIeG7YeUHRO6Jfr0Eh0bI6HaQQHaHteQZbY38D7AVcBJkl23SaTdZAPxx1W 96jpDp/YPvP3YTLTnPUuvjnJgtuhKM6Wi52CrtfluECDNED8ZQoIqm8YTk/ccPk2bR8X2E3hPEw
TBtdemA9LoMdqQFd2c2/Q5tX/m+0KWSQvpAVyQyEHLQuAVWDzsgfzE1DgBvxWl3qRhL5vdLE
X-Proofpoint-GUID: R-smGXwu74-FTNOW-nvDHCN0LfRss6cH
X-Proofpoint-ORIG-GUID: R-smGXwu74-FTNOW-nvDHCN0LfRss6cH
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-06_05,2025-06-05_01,2025-03-28_01
X-Proofpoint-Spam-Reason: safe
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

DQoNCj4gT24gSnVuIDIsIDIwMjUsIGF0IDc6NDjigK9QTSwgU2VhbiBDaHJpc3RvcGhlcnNvbiA8
c2VhbmpjQGdvb2dsZS5jb20+IHdyb3RlOg0KPiANCj4gRXhlbXB0IG5lc3RlZCBFUFQgc2hhZG93
IHBhZ2VzIHRhYmxlcyBmcm9tIHRoZSBDUjAuV1A9MCBoYW5kbGluZyBvZg0KPiBzdXBlcnZpc29y
IHdyaXRlcywgYXMgRVBUIGRvZXNuJ3QgaGF2ZSBhIFUvUyBiaXQgYW5kIGlzbid0IGFmZmVjdGVk
IGJ5DQo+IENSMC5XUCAob3IgQ1I0LlNNRVAgaW4gdGhlIGV4Y2VwdGlvbiB0byB0aGUgZXhjZXB0
aW9uKS4NCj4gDQo+IE9wcG9ydHVuaXN0aWNhbGx5IHJlZnJlc2ggdGhlIGNvbW1lbnQgdG8gZXhw
bGFpbiB3aGF0IEtWTSBpcyBkb2luZywgYXMNCj4gdGhlIG9ubHkgcmVjb3JkIG9mIHdoeSBLVk0g
c2hvdmVzIGluIFdSSVRFIGFuZCBkcm9wcyBVU0VSIGlzIGJ1cmllZCBpbg0KPiB5ZWFycy1vbGQg
Y2hhbmdlbG9ncy4NCj4gDQo+IENjOiBKb24gS29obGVyIDxqb25AbnV0YW5peC5jb20+DQo+IENj
OiBTZXJnZXkgRHlhc2xpIDxzZXJnZXkuZHlhc2xpQG51dGFuaXguY29tPg0KPiBTaWduZWQtb2Zm
LWJ5OiBTZWFuIENocmlzdG9waGVyc29uIDxzZWFuamNAZ29vZ2xlLmNvbT4NCj4gLS0tDQo+IGFy
Y2gveDg2L2t2bS9tbXUvcGFnaW5nX3RtcGwuaCB8IDggKysrKysrLS0NCj4gMSBmaWxlIGNoYW5n
ZWQsIDYgaW5zZXJ0aW9ucygrKSwgMiBkZWxldGlvbnMoLSkNCj4gDQo+IGRpZmYgLS1naXQgYS9h
cmNoL3g4Ni9rdm0vbW11L3BhZ2luZ190bXBsLmggYi9hcmNoL3g4Ni9rdm0vbW11L3BhZ2luZ190
bXBsLmgNCj4gaW5kZXggNjhlMzIzNTY4ZTk1Li5lZDc2MmJiNGIwMDcgMTAwNjQ0DQo+IC0tLSBh
L2FyY2gveDg2L2t2bS9tbXUvcGFnaW5nX3RtcGwuaA0KPiArKysgYi9hcmNoL3g4Ni9rdm0vbW11
L3BhZ2luZ190bXBsLmgNCj4gQEAgLTgwNCw5ICs4MDQsMTIgQEAgc3RhdGljIGludCBGTkFNRShw
YWdlX2ZhdWx0KShzdHJ1Y3Qga3ZtX3ZjcHUgKnZjcHUsIHN0cnVjdCBrdm1fcGFnZV9mYXVsdCAq
ZmF1bHQNCj4gaWYgKHIgIT0gUkVUX1BGX0NPTlRJTlVFKQ0KPiByZXR1cm4gcjsNCj4gDQo+ICsj
aWYgUFRUWVBFICE9IFBUVFlQRV9FUFQNCj4gLyoNCj4gLSAqIERvIG5vdCBjaGFuZ2UgcHRlX2Fj
Y2VzcyBpZiB0aGUgcGZuIGlzIGEgbW1pbyBwYWdlLCBvdGhlcndpc2UNCj4gLSAqIHdlIHdpbGwg
Y2FjaGUgdGhlIGluY29ycmVjdCBhY2Nlc3MgaW50byBtbWlvIHNwdGUuDQo+ICsgKiBUcmVhdCB0
aGUgZ3Vlc3QgUFRFIHByb3RlY3Rpb25zIGFzIHdyaXRhYmxlLCBzdXBlcnZpc29yLW9ubHkgaWYg
dGhpcw0KPiArICogaXMgYSBzdXBlcnZpc29yIHdyaXRlIGZhdWx0IGFuZCBDUjAuV1A9MCAoc3Vw
ZXJ2aXNvciBhY2Nlc3NlcyBpZ25vcmUNCj4gKyAqIFBURS5XIGlmIENSMC5XUD0wKS4gIERvbid0
IGNoYW5nZSB0aGUgYWNjZXNzIHR5cGUgZm9yIGVtdWxhdGVkIE1NSU8sDQo+ICsgKiBvdGhlcndp
c2UgS1ZNIHdpbGwgY2FjaGUgaW5jb3JyZWN0IGFjY2VzcyBpbmZvcm1hdGlvbiBpbiB0aGUgU1BU
RS4NCj4gKi8NCj4gaWYgKGZhdWx0LT53cml0ZSAmJiAhKHdhbGtlci5wdGVfYWNjZXNzICYgQUND
X1dSSVRFX01BU0spICYmDQo+ICAgICFpc19jcjBfd3AodmNwdS0+YXJjaC5tbXUpICYmICFmYXVs
dC0+dXNlciAmJiBmYXVsdC0+c2xvdCkgew0KPiBAQCAtODIyLDYgKzgyNSw3IEBAIHN0YXRpYyBp
bnQgRk5BTUUocGFnZV9mYXVsdCkoc3RydWN0IGt2bV92Y3B1ICp2Y3B1LCBzdHJ1Y3Qga3ZtX3Bh
Z2VfZmF1bHQgKmZhdWx0DQo+IGlmIChpc19jcjRfc21lcCh2Y3B1LT5hcmNoLm1tdSkpDQo+IHdh
bGtlci5wdGVfYWNjZXNzICY9IH5BQ0NfRVhFQ19NQVNLOw0KPiB9DQo+ICsjZW5kaWYNCj4gDQo+
IHIgPSBSRVRfUEZfUkVUUlk7DQo+IHdyaXRlX2xvY2soJnZjcHUtPmt2bS0+bW11X2xvY2spOw0K
PiANCj4gYmFzZS1jb21taXQ6IDNmN2IzMDc3NTdlY2ZmYzFjMThlZGU5ZWUzY2Y5Y2U4MTAxZjNj
YzkNCj4gLS0gDQo+IDIuNDkuMC4xMjA0Lmc3MTY4N2M3YzFkLWdvb2cNCj4gDQoNClRoYW5rcywg
SeKAmWxsIGdpdmUgaXQgYSBnbywgYnV0IExHVE0gaW4gZ2VuZXJhbA0KDQpSZXZpZXdlZC1ieTog
Sm9uIEtvaGxlciA8am9uQG51dGFuaXguY29tPg0KDQo=


Return-Path: <linux-kernel+bounces-675977-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 2464941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:50:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 878D43B431B
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:48:59 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B37F228D8DE;
Fri, 6 Jun 2025 15:44:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pGqFH4ZL"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id F31AE288CB7;
Fri, 6 Jun 2025 15:44:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224677; cv=none; b=k59api/5joUWKiWrVI/M6OEOdWO8dkGvog4rCo4BCzw8s6DkF2bbXO5keXHznvoxq14wx8pQCCkorvWa1ZoDy59EBO9Ft2tdb5F1loNsAXsTtghRPN5eqpoe/8rlWXiRSoUqY6j3q96JIVxwv+tjXLYIqZQ+szx0xqNFvSUgHP8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224677; c=relaxed/simple;
bh=4hZWSSBiBmXgCZRjHUQHX6vSbzo+EvjVtjI/uIdFtzg=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=nW1vS6bHMnTWys2YOrB8ecQigEclYimuNTa7rwpUPz7hYZ8SHsaSwzftaaozYT24j2m61Z1W9YGg74XDHNl4CCACfPeTk5WSK1Xg6LA/imu3fC/BgBafSCc94zRB/i3t483EuVsgTPOQFxl/ivstd8KzQVFPjDfd+si+5bq/8Yc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pGqFH4ZL; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12CD5C4CEF0;
Fri, 6 Jun 2025 15:44:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224676;
bh=4hZWSSBiBmXgCZRjHUQHX6vSbzo+EvjVtjI/uIdFtzg=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=pGqFH4ZLFN96FnGqa80FLFze15Fnb7Lv+LiHilorHz0kgobniy+su4n/3P/fnfoU8
myTeLm+6UK4RzQUUGCcKB1aWt0OkjKehTEqc70YAzeMJp1QPYNBxZQo0JPuV1irRH2
exMdKfPqik7bpsRFrodUQWxwQWZdqSiCCDbW34Uc0XtREMMcjQDSeDulw5Vt6h6XMh
rGVGdsY2j1U+JA5sQn9xBhod0Mqk2W8dh2MA2/e3igJfctJLqkJrBYiTl0P0f8s0BV
BrDN6IEwyjemnkUGd206BJf0/0HVVAijXSV/QZJvDN98iouFQLFplqMXSn2q/SyRme
xILYqNGzOCjUw==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Peng Fan <peng.fan@xxxxxxx>,
Jassi Brar <jassisinghbrar@xxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 5.4 2/3] mailbox: Not protect module_put with spin_lock_irqsave
Date: Fri, 6 Jun 2025 11:44:31 -0400
Message-Id: <20250606154433.548697-2-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154433.548697-1-sashal@xxxxxxxxxx>
References: <20250606154433.548697-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 5.4.294
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peng Fan <peng.fan@xxxxxxx>

[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]

&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
Signed-off-by: Jassi Brar <jassisinghbrar@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

**YES** This commit should be backported to stable kernel trees.
**Analysis:** 1. **Clear Bug Fix**: The commit fixes an improper use of
`module_put()` under a spinlock in `mbox_free_channel()`. Looking at the
current code in `/home/sasha/linux/drivers/mailbox/mailbox.c:489`,
`module_put()` is called while holding `&chan->lock` with
`spin_lock_irqsave()`. 2. **Locking Inconsistency**: The commit message
correctly identifies that `&chan->lock` is not supposed to protect
`chan->mbox`. In `__mbox_bind_client()` (line 324),
`try_module_get(chan->mbox->dev->driver->owner)` is called **outside**
the spinlock protection, making the current `module_put()` placement
inconsistent. 3. **Minimal Risk Change**: The fix is extremely simple
and low-risk - it just moves one line (`module_put()`) outside the
spinlock region. This maintains the same operation order but fixes the
locking issue. 4. **No Side Effects**: Moving `module_put()` outside the
lock doesn't change the functionality or introduce new race conditions.
The `module_put()` implementation uses `atomic_dec_if_positive()`, so
it's safe to call without additional locking. 5. **Follows Stable
Rules**: This commit: - Fixes a real locking issue that could
potentially cause problems - Is small and contained (single line move) -
Has minimal regression risk - Doesn't introduce new features or
architectural changes 6. **Similar Pattern**: Looking at similar commits
in the historical references, commits that fix locking issues (like
Similar Commit #5 which fixed a locking bug in mailbox-test) were marked
as YES for backporting. The commit addresses a legitimate kernel locking
violation where `module_put()` should not be called under a spinlock,
making it a suitable candidate for stable tree backporting.

drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 6f54501dc7762..cb31ad917b352 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -459,8 +459,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;

- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);

--
2.39.5



Return-Path: <linux-kernel+bounces-675979-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8374C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id BD3BF3A5C9A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:49:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D0B7028DF0F;
Fri, 6 Jun 2025 15:44:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="L/tWR5mM"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 6C786289E2E;
Fri, 6 Jun 2025 15:44:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224686; cv=none; b=FTX3EU7TLjeNAVAdZGiHAcIGdpRLyuqr8XQsktCvstNBlL6aNSEC8uL2WOYPWf11sV4lWcsIfPDya0lKFf8mdGCVVDPgDEs+TswuHfTQqQvLwLQqCG9EeIJpoipTDh9ZLNpBDQbJzeZHLvRHXIAU/jOQ/Mp464/AAkDNP1paBbw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224686; c=relaxed/simple;
bh=7SbusbtCH84+e5OYmyU2EqnTJRP7YU9cbC518hgfyjQ=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iH4CgfY0h3DiLcN35SC6yadJspAgr4DmihkOilCjttK9qJUKo7sTOhjlkcInnHDwdsn41DFwIbf2h59mUU9jlru8I+4ps/Xb1eEEN+ScRKz9ZfAyL+A3fxQ6D83WVMTLa+SlvZWhJYZOyBiE82qwQAAfBpQm44Cv+yFtpGDWnA4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=L/tWR5mM; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from isaac-ThinkPad-T16-Gen-2.localdomain (cpc90716-aztw32-2-0-cust408.18-1.cable.virginm.net [86.26.101.153])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id EA457446;
Fri, 6 Jun 2025 17:44:36 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749224677;
bh=7SbusbtCH84+e5OYmyU2EqnTJRP7YU9cbC518hgfyjQ=;
h=From:To:Cc:Subject:Date:From;
b=L/tWR5mM89JaJkR3vHQ19HSAPwApL8uCIo6+RyKggBWbLW2BChyqxx8XMyLX9uT7H
cYhPxuPaGERpzS/h9tMjr1OSduyHh/Y10gq0FirKNveRogp5PL6VnSYVKC7CUm2u2O
rSfiQ2gQHWiXYEftUuM7SQxw7JrBzfa1ebQoODAU=
From: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
To: laurent.pinchart@xxxxxxxxxxxxxxxx
Cc: kieran.bingham@xxxxxxxxxxxxxxxx,
rmfrfs@xxxxxxxxx,
martink@xxxxxxxxx,
kernel@xxxxxxx,
mchehab@xxxxxxxxxx,
shawnguo@xxxxxxxxxx,
s.hauer@xxxxxxxxxxxxxx,
kernel@xxxxxxxxxxxxxx,
festevam@xxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx,
imx@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Subject: [PATCH v2 0/2] media: Add line end IRQ to imx-mipi-csis driver
Date: Fri, 6 Jun 2025 16:44:12 +0100
Message-ID: <20250606154414.540290-1-isaac.scott@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Many boards, such as the NXP i.MX 8M Plus, feature multiple interrupt
registers. This series refactors interrupt status register debug handling to make
it more intuitive to add other registers such as LINE_END, which has an
entire register containing only one interrupt. Previously, the
mipi_csi_events[] list contained a debug enable field, and this replaces
that with a status_index, which indicates which status register contains
the mask for the interrupt.

The second patch adds the user line interrupt, which is useful for
debugging, as it allows a user to trigger an interrupt after the MIPI
CSI receiver has counted a configurable number of lines. This can make
it possible to discern the true resolution of the image stream reaching
the CSI receiver. It adds an entry to debugfs which lets users choose
how many lines are needed to trigger the interrupt, and can be disabled
both within and outside streaming by setting the value to 0.

---

Changes since v1:
- Moved from magic number to enum in status_index
- Clear INT_MSK_1 in enable_interrupts() when on == false
- use local variable in set_params() as in the interrupt handler
- move interrupt handling code outside of spinlock

Isaac Scott (2):
media: platform: Refactor interrupt status registers
media: platform: Add user line interrupt to imx-mipi-csis driver

drivers/media/platform/nxp/imx-mipi-csis.c | 107 ++++++++++++++-------
1 file changed, 74 insertions(+), 33 deletions(-)

--
2.43.0



Return-Path: <linux-kernel+bounces-675985-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7E42241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:29 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1E5FB7A507A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:50:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F388289823;
Fri, 6 Jun 2025 15:49:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="GVOmtQja";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="mJXMCgBF";
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="GVOmtQja";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="mJXMCgBF"
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFFD2289812
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:49:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224996; cv=none; b=sXHLNvj0ZMrc/CXw44Ir207zZg0HNDVsTpCXDEbungAABcSDIlN6E2NlfCZlVMXn7vVtTtcHEj8XdH1pXeeaV0DBLEY3yMc1NraUyCaNsL917QgrP+k4WN2ETZc0ZgddOLDPiXFXb8HRif1pl+jtZx9orOwJgqNnz8CqqmlDRKQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224996; c=relaxed/simple;
bh=C1fPIfSvCf7biycHCXokhdlMw6EgSYTxT2r/WPM0lPU=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=XKOBNbxLKFzUm0ZvG1ck+JoyHB9xM8sryucv9V1QKnmBgcGl21DVPC5uyAYDeV/h7/9cMn7Ha4aC64OZBTlSFL8hO/eJz00C8bfsINTmB6JyaLDlGPLHy+5E0X46byqtr+hShEHh3d9JuP+cLDPnoMtlMbBQutecb75oeon9FZw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=GVOmtQja; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=mJXMCgBF; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=GVOmtQja; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=mJXMCgBF; arc=none smtp.client-ip=195.135.223.130
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz
Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by smtp-out1.suse.de (Postfix) with ESMTPS id 078C9227E3;
Fri, 6 Jun 2025 15:49:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749224993; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=ZSWsxV1nkp/hvTP+MxBmCkCJfNEuWV54k5bdoI12Pbk=;
b=GVOmtQjaTtivUrlAFBo5NzjvDTzOs402fkt5bF+F6cDGEuIpsM9GN6k3FY+1pj7wyJbhao
pv+PShCgSZsb2osi7oJ4GYiwROiysfcJiOwSPaMeSlftlZRa//QeaXiooM4TdbrMjIZzVx
MWASfEr8zJ8J9lpA1Pj0LtrmvK8NSMA=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749224993;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=ZSWsxV1nkp/hvTP+MxBmCkCJfNEuWV54k5bdoI12Pbk=;
b=mJXMCgBFZof5TuVLm5I33eW+BFqQUlRIegFxxa+MaR0mZIp0+YMd1SW+y/ioSAdIHXcmPM
LFB//K1oU7Vt3pCA==
Authentication-Results: smtp-out1.suse.de;
dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=GVOmtQja;
dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=mJXMCgBF
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749224993; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=ZSWsxV1nkp/hvTP+MxBmCkCJfNEuWV54k5bdoI12Pbk=;
b=GVOmtQjaTtivUrlAFBo5NzjvDTzOs402fkt5bF+F6cDGEuIpsM9GN6k3FY+1pj7wyJbhao
pv+PShCgSZsb2osi7oJ4GYiwROiysfcJiOwSPaMeSlftlZRa//QeaXiooM4TdbrMjIZzVx
MWASfEr8zJ8J9lpA1Pj0LtrmvK8NSMA=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749224993;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=ZSWsxV1nkp/hvTP+MxBmCkCJfNEuWV54k5bdoI12Pbk=;
b=mJXMCgBFZof5TuVLm5I33eW+BFqQUlRIegFxxa+MaR0mZIp0+YMd1SW+y/ioSAdIHXcmPM
LFB//K1oU7Vt3pCA==
Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DF2FE1336F;
Fri, 6 Jun 2025 15:49:52 +0000 (UTC)
Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
by imap1.dmz-prg2.suse.org with ESMTPSA
id 2WiuNSAOQ2gjMgAAD6G6ig
(envelope-from <vbabka@xxxxxxx>); Fri, 06 Jun 2025 15:49:52 +0000
Message-ID: <65773983-19b7-47bb-a1bf-d9fde3a9957c@xxxxxxx>
Date: Fri, 6 Jun 2025 17:49:52 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/2] mm/memory: ensure fork child sees coherent memory
snapshot
Content-Language: en-US
To: Jann Horn <jannh@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>,
David Hildenbrand <david@xxxxxxxxxx>,
Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
"Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>, Mike Rapoport
<rppt@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>,
Michal Hocko <mhocko@xxxxxxxx>, linux-mm@xxxxxxxxx
Cc: Peter Xu <peterx@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
References: <20250603-fork-tearing-v1-0-a7f64b7cfc96@xxxxxxxxxx>
<20250603-fork-tearing-v1-1-a7f64b7cfc96@xxxxxxxxxx>
<CAG48ez0eGkBCNSy1Lp7Fz41uyQym0UMvik9vVVjD1GKGhvGpqQ@xxxxxxxxxxxxxx>
From: Vlastimil Babka <vbabka@xxxxxxx>
Autocrypt: addr=vbabka@xxxxxxx; keydata=
xsFNBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB
KxRWDHX0R2tgpFDXHnzZcQywawu8eSq0LxzxFNYMvtB7sV1pxYwej2qx9B75qW2plBs+7+YB
87tMFA+u+L4Z5xAzIimfLD5EKC56kJ1CsXlM8S/LHcmdD9Ctkn3trYDNnat0eoAcfPIP2OZ+
9oe9IF/R28zmh0ifLXyJQQz5ofdj4bPf8ecEW0rhcqHfTD8k4yK0xxt3xW+6Exqp9n9bydiy
tcSAw/TahjW6yrA+6JhSBv1v2tIm+itQc073zjSX8OFL51qQVzRFr7H2UQG33lw2QrvHRXqD
Ot7ViKam7v0Ho9wEWiQOOZlHItOOXFphWb2yq3nzrKe45oWoSgkxKb97MVsQ+q2SYjJRBBH4
8qKhphADYxkIP6yut/eaj9ImvRUZZRi0DTc8xfnvHGTjKbJzC2xpFcY0DQbZzuwsIZ8OPJCc
LM4S7mT25NE5kUTG/TKQCk922vRdGVMoLA7dIQrgXnRXtyT61sg8PG4wcfOnuWf8577aXP1x
6mzw3/jh3F+oSBHb/GcLC7mvWreJifUL2gEdssGfXhGWBo6zLS3qhgtwjay0Jl+kza1lo+Cv
BB2T79D4WGdDuVa4eOrQ02TxqGN7G0Biz5ZLRSFzQSQwLn8fbwARAQABzSBWbGFzdGltaWwg
QmFia2EgPHZiYWJrYUBzdXNlLmN6PsLBlAQTAQoAPgIbAwULCQgHAwUVCgkICwUWAgMBAAIe
AQIXgBYhBKlA1DSZLC6OmRA9UCJPp+fMgqZkBQJnyBr8BQka0IFQAAoJECJPp+fMgqZkqmMQ
AIbGN95ptUMUvo6aAdhxaOCHXp1DfIBuIOK/zpx8ylY4pOwu3GRe4dQ8u4XS9gaZ96Gj4bC+
jwWcSmn+TjtKW3rH1dRKopvC07tSJIGGVyw7ieV/5cbFffA8NL0ILowzVg8w1ipnz1VTkWDr
2zcfslxJsJ6vhXw5/npcY0ldeC1E8f6UUoa4eyoskd70vO0wOAoGd02ZkJoox3F5ODM0kjHu
Y97VLOa3GG66lh+ZEelVZEujHfKceCw9G3PMvEzyLFbXvSOigZQMdKzQ8D/OChwqig8wFBmV
QCPS4yDdmZP3oeDHRjJ9jvMUKoYODiNKsl2F+xXwyRM2qoKRqFlhCn4usVd1+wmv9iLV8nPs
2Db1ZIa49fJet3Sk3PN4bV1rAPuWvtbuTBN39Q/6MgkLTYHb84HyFKw14Rqe5YorrBLbF3rl
M51Dpf6Egu1yTJDHCTEwePWug4XI11FT8lK0LNnHNpbhTCYRjX73iWOnFraJNcURld1jL1nV
r/LRD+/e2gNtSTPK0Qkon6HcOBZnxRoqtazTU6YQRmGlT0v+rukj/cn5sToYibWLn+RoV1CE
Qj6tApOiHBkpEsCzHGu+iDQ1WT0Idtdynst738f/uCeCMkdRu4WMZjteQaqvARFwCy3P/jpK
uvzMtves5HvZw33ZwOtMCgbpce00DaET4y/UzsBNBFsZNTUBCACfQfpSsWJZyi+SHoRdVyX5
J6rI7okc4+b571a7RXD5UhS9dlVRVVAtrU9ANSLqPTQKGVxHrqD39XSw8hxK61pw8p90pg4G
/N3iuWEvyt+t0SxDDkClnGsDyRhlUyEWYFEoBrrCizbmahOUwqkJbNMfzj5Y7n7OIJOxNRkB
IBOjPdF26dMP69BwePQao1M8Acrrex9sAHYjQGyVmReRjVEtv9iG4DoTsnIR3amKVk6si4Ea
X/mrapJqSCcBUVYUFH8M7bsm4CSxier5ofy8jTEa/CfvkqpKThTMCQPNZKY7hke5qEq1CBk2
wxhX48ZrJEFf1v3NuV3OimgsF2odzieNABEBAAHCwXwEGAEKACYCGwwWIQSpQNQ0mSwujpkQ
PVAiT6fnzIKmZAUCZ8gcVAUJFhTonwAKCRAiT6fnzIKmZLY8D/9uo3Ut9yi2YCuASWxr7QQZ
lJCViArjymbxYB5NdOeC50/0gnhK4pgdHlE2MdwF6o34x7TPFGpjNFvycZqccSQPJ/gibwNA
zx3q9vJT4Vw+YbiyS53iSBLXMweeVV1Jd9IjAoL+EqB0cbxoFXvnjkvP1foiiF5r73jCd4PR
rD+GoX5BZ7AZmFYmuJYBm28STM2NA6LhT0X+2su16f/HtummENKcMwom0hNu3MBNPUOrujtW
khQrWcJNAAsy4yMoJ2Lw51T/5X5Hc7jQ9da9fyqu+phqlVtn70qpPvgWy4HRhr25fCAEXZDp
xG4RNmTm+pqorHOqhBkI7wA7P/nyPo7ZEc3L+ZkQ37u0nlOyrjbNUniPGxPxv1imVq8IyycG
AN5FaFxtiELK22gvudghLJaDiRBhn8/AhXc642/Z/yIpizE2xG4KU4AXzb6C+o7LX/WmmsWP
Ly6jamSg6tvrdo4/e87lUedEqCtrp2o1xpn5zongf6cQkaLZKQcBQnPmgHO5OG8+50u88D9I
rywqgzTUhHFKKF6/9L/lYtrNcHU8Z6Y4Ju/MLUiNYkmtrGIMnkjKCiRqlRrZE/v5YFHbayRD
dJKXobXTtCBYpLJM4ZYRpGZXne/FAtWNe4KbNJJqxMvrTOrnIatPj8NhBVI0RSJRsbilh6TE
m6M14QORSWTLRg==
In-Reply-To: <CAG48ez0eGkBCNSy1Lp7Fz41uyQym0UMvik9vVVjD1GKGhvGpqQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Server: rspamd2.dmz-prg2.suse.org
X-Rspamd-Queue-Id: 078C9227E3
X-Rspamd-Action: no action
X-Spamd-Result: default: False [-4.51 / 50.00];
BAYES_HAM(-3.00)[100.00%];
NEURAL_HAM_LONG(-1.00)[-1.000];
R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];
NEURAL_HAM_SHORT(-0.20)[-1.000];
MIME_GOOD(-0.10)[text/plain];
MX_GOOD(-0.01)[];
RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received];
RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from];
ARC_NA(0.00)[];
RCVD_VIA_SMTP_AUTH(0.00)[];
RCPT_COUNT_TWELVE(0.00)[12];
MIME_TRACE(0.00)[0:+];
RCVD_TLS_ALL(0.00)[];
FUZZY_BLOCKED(0.00)[rspamd.com];
TO_DN_SOME(0.00)[];
SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];
FROM_EQ_ENVFROM(0.00)[];
FROM_HAS_DN(0.00)[];
MID_RHS_MATCH_FROM(0.00)[];
RCVD_COUNT_TWO(0.00)[2];
TO_MATCH_ENVRCPT_ALL(0.00)[];
DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo];
DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];
DKIM_TRACE(0.00)[suse.cz:+]
X-Spam-Score: -4.51
X-Spam-Level:
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 14:49, Jann Horn wrote:
> On Tue, Jun 3, 2025 at 8:21â?¯PM Jann Horn <jannh@xxxxxxxxxx> wrote:
>> @@ -917,7 +917,25 @@ copy_present_page(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma
>> /*
>> * We have a prealloc page, all good! Take it
>> * over and copy the page & arm it.
>> + *
>> + * One nasty aspect is that we could be in a multithreaded process or
>> + * such, where another thread is in the middle of writing to memory
>> + * while this thread is forking. As long as we're just marking PTEs as
>> + * read-only to make copy-on-write happen *later*, that's easy; we just
>> + * need to do a single TLB flush before dropping the mmap/VMA locks, and
>> + * that's enough to guarantee that the child gets a coherent snapshot of
>> + * memory.
>> + * But here, where we're doing an immediate copy, we must ensure that
>> + * threads in the parent process can no longer write into the page being
>> + * copied until we're done forking.
>> + * This means that we still need to mark the source PTE as read-only,
>> + * with an immediate TLB flush.
>> + * (To make the source PTE writable again after fork() is done, we can
>> + * rely on the page fault handler to do that lazily, thanks to
>> + * PageAnonExclusive().)
>> */
>> + ptep_set_wrprotect(src_vma->vm_mm, addr, src_pte);
>> + flush_tlb_page(src_vma, addr);
>
> Hmm... this is actually wrong, because we did
> arch_enter_lazy_mmu_mode() up in copy_pte_range(). So I guess I
> actually have to do:
>
> arch_leave_lazy_mmu_mode();
> ptep_set_wrprotect(src_vma->vm_mm, addr, src_pte);
> flush_tlb_page(src_vma, addr);
> arch_enter_lazy_mmu_mode();
>
> (arch_flush_lazy_mmu_mode() would look a bit nicer, but powerpc
> doesn't implement that.)

Hm isn't that kinda weird that an arch can
#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE and then just not implement an
important part of it?
IIUC think it's the same with arch/sparc/include/asm/tlbflush_64.h ?
Should be possible to implement reusing part of the code from the respective
arch_leave_lazy_mmu_mode() right?



Return-Path: <linux-kernel+bounces-675980-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7896241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id EA7273B3F60
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:49:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C935D28DF41;
Fri, 6 Jun 2025 15:44:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ovxbnmE2"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 5AB1828AAE9;
Fri, 6 Jun 2025 15:44:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224688; cv=none; b=Hy9T9c0m5OCjlN4/WIFaZ8lCxpXAx9SISn6p+m5Jsl+QWG4rOwoya0AZd+d6o8Kzox/ZBkL46kPWhKAs/efJWQw+MVNiT0CxqJqyn6zyzYKgt0lhyPSzPHaPwFcnFBFRempftHAHHfNuLMJbgMJIYBbYzVGcZu9jqaDBZD+LV/o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224688; c=relaxed/simple;
bh=bejcWE6MQotWr+1JFHVSPWJJJKLq7InC7Ch4izqVrXg=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=FNYuMeJTPOk3873knxMnDJgoafD08jV5UGxKAF3VcXSjUHvoX3Ud07hZOA4xfBX+qvAv1g4AX8PtpBUxa1SXGFaNPcAnLRTMpont8D1Qf1OcCguDGt8TBRYm3KToMceTsLOOrIklsrFk9kkjkOuPMsxS/loZbQUDO4QaZz8PaMM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ovxbnmE2; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from isaac-ThinkPad-T16-Gen-2.localdomain (cpc90716-aztw32-2-0-cust408.18-1.cable.virginm.net [86.26.101.153])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id EE79B8DB;
Fri, 6 Jun 2025 17:44:38 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749224679;
bh=bejcWE6MQotWr+1JFHVSPWJJJKLq7InC7Ch4izqVrXg=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=ovxbnmE2VtCRNGFFn6Y/Y28e3TS0gul1iMWvBZ0oTl7cf9sUFP6M+uI4eLle45qJD
vHIbnvVtJMTg79zG+VAXFXoq5ys84rNlNsoSH25B0ne0nApxLYHFTSILfc22ie+Bwg
IwkOYYkr3ztwgBG/8xH20EflANXJ3CyfACzuTVo4=
From: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
To: laurent.pinchart@xxxxxxxxxxxxxxxx
Cc: kieran.bingham@xxxxxxxxxxxxxxxx,
rmfrfs@xxxxxxxxx,
martink@xxxxxxxxx,
kernel@xxxxxxx,
mchehab@xxxxxxxxxx,
shawnguo@xxxxxxxxxx,
s.hauer@xxxxxxxxxxxxxx,
kernel@xxxxxxxxxxxxxx,
festevam@xxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx,
imx@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Subject: [PATCH v2 1/2] media: platform: Refactor interrupt status registers
Date: Fri, 6 Jun 2025 16:44:13 +0100
Message-ID: <20250606154414.540290-2-isaac.scott@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606154414.540290-1-isaac.scott@xxxxxxxxxxxxxxxx>
References: <20250606154414.540290-1-isaac.scott@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The NXP i.MX 8 MP CSI-2 receiver features multiple interrupt and debug
status sources which span multiple registers. The driver currently
supports two interrupt source registers, and attributes the
mipi_csis_event event entries to those registers through a boolean debug
field that indicate if the event relates to the main interrupt status
(false) or debug interrupt status (true) register. To make it easier to
add new event fields, replace the debug bool with a 'status index'
integer than indicates the index of the corresponding status register.

Signed-off-by: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

---

Changes since v1:
- Switched from magic numbers to enum.
---
drivers/media/platform/nxp/imx-mipi-csis.c | 69 +++++++++++-----------
1 file changed, 36 insertions(+), 33 deletions(-)

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index d060eadebc7a..394987d72c64 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -248,8 +248,13 @@
#define MIPI_CSI2_DATA_TYPE_RAW14 0x2d
#define MIPI_CSI2_DATA_TYPE_USER(x) (0x30 + (x))

+enum mipi_csis_event_type {
+ MAIN = 0,
+ DEBUG = 1,
+};
+
struct mipi_csis_event {
- bool debug;
+ enum mipi_csis_event_type status_index;
u32 mask;
const char * const name;
unsigned int counter;
@@ -257,30 +262,30 @@ struct mipi_csis_event {

static const struct mipi_csis_event mipi_csis_events[] = {
/* Errors */
- { false, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO Overflow Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong Configuration Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error" },
- { false, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error" },
- { true, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type Not Supported" },
- { true, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type Ignored" },
- { true, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame Size Error" },
- { true, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame" },
- { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early Frame End" },
- { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early Frame Start" },
+ { MAIN, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT Error"},
+ { MAIN, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error"},
+ { MAIN, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error"},
+ { MAIN, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO Overflow Error"},
+ { MAIN, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong Configuration Error"},
+ { MAIN, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error"},
+ { MAIN, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error"},
+ { MAIN, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error"},
+ { DEBUG, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type Not Supported"},
+ { DEBUG, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type Ignored"},
+ { DEBUG, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame Size Error"},
+ { DEBUG, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame"},
+ { DEBUG, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early Frame End"},
+ { DEBUG, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early Frame Start"},
/* Non-image data receive events */
- { false, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even frame" },
- { false, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image data after even frame" },
- { false, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image data before odd frame" },
- { false, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image data after odd frame" },
+ { MAIN, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even frame"},
+ { MAIN, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image data after even frame"},
+ { MAIN, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image data before odd frame"},
+ { MAIN, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image data after odd frame"},
/* Frame start/end */
- { false, MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start" },
- { false, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End" },
- { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge" },
- { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge" },
+ { MAIN, MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start"},
+ { MAIN, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End"},
+ { DEBUG, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge"},
+ { DEBUG, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge"},
};

#define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
@@ -765,32 +770,30 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)
struct mipi_csis_device *csis = dev_id;
unsigned long flags;
unsigned int i;
- u32 status;
- u32 dbg_status;
+ u32 status[2];

- status = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
- dbg_status = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
+ status[MAIN] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
+ status[DEBUG] = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);

spin_lock_irqsave(&csis->slock, flags);

/* Update the event/error counters */
- if ((status & MIPI_CSIS_INT_SRC_ERRORS) || csis->debug.enable) {
+ if ((status[MAIN] & MIPI_CSIS_INT_SRC_ERRORS) || csis->debug.enable) {
for (i = 0; i < MIPI_CSIS_NUM_EVENTS; i++) {
struct mipi_csis_event *event = &csis->events[i];

- if ((!event->debug && (status & event->mask)) ||
- (event->debug && (dbg_status & event->mask)))
+ if (status[event->status_index] & event->mask)
event->counter++;
}
}

- if (status & MIPI_CSIS_INT_SRC_FRAME_START)
+ if (status[MAIN] & MIPI_CSIS_INT_SRC_FRAME_START)
mipi_csis_queue_event_sof(csis);

spin_unlock_irqrestore(&csis->slock, flags);

- mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status);
- mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, dbg_status);
+ mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status[MAIN]);
+ mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, status[DEBUG]);

return IRQ_HANDLED;
}
--
2.43.0



Return-Path: <linux-kernel+bounces-675984-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 27F7D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:44 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B6CA417C554
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:51:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A5B3228A1D9;
Fri, 6 Jun 2025 15:49:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NW9nvpxe"
Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51865289801;
Fri, 6 Jun 2025 15:49:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224943; cv=none; b=SlwTT0kdBa83VR/RJjThsoyOIzXuJNe5L6VGpZoZKIj2r9FLsZPxoDmp+EPCXBOGZX30xdoFV5PKneGkrd/VyCiYfBkQFqJQsTMDGSVKgvlp47otz3lbFC2xwZ+P7Hyo0gr8BkIXDr1g/TpOxTjHWm1AVy4bLzYh75htl1nNZss=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224943; c=relaxed/simple;
bh=qteTWSdXmGXbvSh/VWtVvDyFhQzDEAd2cyVRYJIO0yg=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=Su3JyLeECc9POlaqsV9NX0mmffc6oUpvIirGytxKxBJdXwaDIi95Q0A2Hs79ilI6ebuxGfUXr1n1Xwe3wbtxYTucZHwzZYjE5eDMO2934KS23fp+hzgtKA597hKMjHNEllwl0P6hlKZO1kgBVQ/sjd8Do/0gQ403xKfGfMRXBI4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NW9nvpxe; arc=none smtp.client-ip=209.85.216.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-3122368d7cfso1909446a91.1;
Fri, 06 Jun 2025 08:49:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749224941; x=1749829741; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=SFAXCqQFrPjFZs7s5flyQDRDOg704B5o+gINoyafWfw=;
b=NW9nvpxeAQP5ozos0dNMFjHsOTDiHhdYnfFRH5y1LXmTH6P+GQBmavLMlYGU+UunS1
dx/9ZTX9qlvIen5rJDoEr2CXjZ4KGcZB/OJJL+XaTEf6PLxFZREjbCyi91q3CafQeXse
SLELgwWo9HWSH7hqRcNH11fuMGOUiRldPyHpgqHybibseAqzqk4e+VPLipDl/SbxVnyN
GQffJNiJnGmOgMGg1FYlWYN9auyOkf1V4wDZeNVTl2OvexSZxRuNv7OtrdcfPIqY0dPA
6AXACvLe5NZbMGw/d/CAWPQRRtHcoSuanMQmHpAFxULAFAIpOM+Cj2HedtotFwExwKse
KQbw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749224941; x=1749829741;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=SFAXCqQFrPjFZs7s5flyQDRDOg704B5o+gINoyafWfw=;
b=IK1f7+fkfSZf8+x0Od3jjyQhV2w/xAAUtfTZQu7NKxdRpT50iA+Wh5cgypyZV4oeiU
3HdZaT2Fj7infffm+6EOeuFaWmFJazcCKnjF/nra0M8NnIwMD1r/tjQPa+3xZyh4Bsrn
m/h3dv1bhN8RxLehpjiiL3NtdSGzwW6KqKd5NRryJ0cs3Q0Au9taYvyv0/zclHkUZx60
E/aqqSaifp8D87U2ltyFQRN5vgNik2cusRACSDKuRUEtlGOKIziQYF2na5gO29HtlJbq
FpLIC1s6axLnFWJEXwXq+krUncbfFRguF0/NppxmDUvtcQhrpval14725zVqzP0cGEKE
kR+w==
X-Forwarded-Encrypted: i=1; AJvYcCV8inONVebNTMWFS1+jxo9bIYBi4c4AcKuCFhreyDSg2mWspDzJtI4U2YqwOsI7dTxTOoM=@vger.kernel.org, AJvYcCW/LL05J10mLnP/BYgqStfgz/INlTnZdDd53W8ShtzcbskgsLHbATBVYrcqSuhoMbYM9JF3NBxRgt+OqJnc@xxxxxxxxxxxxxxx, AJvYcCWjCAG8g4RmS/wzUdPNQmpLTpS1wB3pCbLt5GibjD0wBroDlEJLHMSCFvxTAFs51Hz2NaLt0hRB@xxxxxxxxxxxxxxx, AJvYcCWrdoseY7tsDAWVhKDXYAFMV7X6VffmJoufiusExI3nfMdqAorpfehwBX84aGTdYOVNV+nTrtYa@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YwZ5jYDd+1BxHKRc3i5P1n1FMRbPKlLP4wF2vpw9ot5CAfIZXkc
2Ug/lJx9jMeWVxAzs2NOpnxt+eYk63VNg1QlLxWeZBzfcCczySLhWLA+
X-Gm-Gg: ASbGncsU4LcebNuK3HsVUbOkQePPdccZiN4wjr0V7A/XEEJ5We9eOvckS9ip91mnZKl
AG2JAJb28czfo4d9Z7/4PtmaLarvZs03KgKcXoTdE9X/B7rd09j+JneAJatIvB4vrPHW4YH3Nbq
wmZFjIow6iBMxBqDtfqj1W+U+pjW8J5wZAm0nq6otio7I2bT+EOJCdY7GcCMtUEUyYk/Uvnq/0R
hwHegOb8DhgfZ+pAsAhCO5yrOQOjNw+G3MtZ3GpCA6kNGJeIUrYyfOmyuN/KOdsmbb2c6WmOmmf
kzx0KUUJaaEde+AN3qhFfmm2JkkFHLuNyxD7cslC0xrg23i0MGLOF/bE29NkGObfP232M0dNd7X
Wita23ATLZrhE3lFkRr7X33s7pqpndPFlEPcbDH8y
X-Google-Smtp-Source: AGHT+IHG/4StZ2v8LodTRZ+tFEEY1GEgtwGds0NXN4+D7wj3obn0sPwJ9Edgk7OM0j71WGZIu3Rb6w==
X-Received: by 2002:a17:90b:4b09:b0:313:2adc:b4c4 with SMTP id 98e67ed59e1d1-31347678bbcmr5917844a91.24.1749224941467;
Fri, 06 Jun 2025 08:49:01 -0700 (PDT)
Received: from ?IPV6:2001:ee0:4f0e:fb30:e7b6:944a:261d:ef5a? ([2001:ee0:4f0e:fb30:e7b6:944a:261d:ef5a])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-236032fcf53sm13827705ad.129.2025.06.06.08.48.54
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 08:49:00 -0700 (PDT)
Message-ID: <f073b150-b2e9-43db-aa61-87eee4755a2f@xxxxxxxxx>
Date: Fri, 6 Jun 2025 22:48:53 +0700
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH net] virtio-net: drop the multi-buffer XDP packet in
zerocopy
To: Jakub Kicinski <kuba@xxxxxxxxxx>
Cc: Paolo Abeni <pabeni@xxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx,
"Michael S. Tsirkin" <mst@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>,
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>, =?UTF-8?Q?Eugenio_P=C3=A9rez?=
<eperezma@xxxxxxxxxx>, Andrew Lunn <andrew+netdev@xxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>,
Alexei Starovoitov <ast@xxxxxxxxxx>, Daniel Borkmann <daniel@xxxxxxxxxxxxx>,
Jesper Dangaard Brouer <hawk@xxxxxxxxxx>,
John Fastabend <john.fastabend@xxxxxxxxx>, virtualization@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, bpf@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
References: <20250603150613.83802-1-minhquangbui99@xxxxxxxxx>
<dd087fdf-5d6c-4015-bed3-29760002f859@xxxxxxxxxx>
<f6d7610b-abfe-415d-adf8-08ce791e4e72@xxxxxxxxx>
<20250605074810.2b3b2637@xxxxxxxxxx>
Content-Language: en-US
From: Bui Quang Minh <minhquangbui99@xxxxxxxxx>
In-Reply-To: <20250605074810.2b3b2637@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/5/25 21:48, Jakub Kicinski wrote:
> On Thu, 5 Jun 2025 21:33:26 +0700 Bui Quang Minh wrote:
>> On 6/5/25 18:03, Paolo Abeni wrote:
>>> On 6/3/25 5:06 PM, Bui Quang Minh wrote:
>>>> In virtio-net, we have not yet supported multi-buffer XDP packet in
>>>> zerocopy mode when there is a binding XDP program. However, in that
>>>> case, when receiving multi-buffer XDP packet, we skip the XDP program
>>>> and return XDP_PASS. As a result, the packet is passed to normal network
>>>> stack which is an incorrect behavior.
>>> Why? AFAICS the multi-buffer mode depends on features negotiation, which
>>> is not controlled by the VM user.
>>>
>>> Let's suppose the user wants to attach an XDP program to do some per
>>> packet stats accounting. That suddenly would cause drop packets
>>> depending on conditions not controlled by the (guest) user. It looks
>>> wrong to me.
>> But currently, if a multi-buffer packet arrives, it will not go through
>> XDP program so it doesn't increase the stats but still goes to network
>> stack. So I think it's not a correct behavior.
> Sounds fair, but at a glance the normal XDP path seems to be trying to
> linearize the frame. Can we not try to flatten the frame here?
> If it's simply to long for the chunk size that's a frame length error,
> right?

Here we are in the zerocopy path, so the buffers for the frame to fill
in are allocated from XDP socket's umem. And if the frame spans across
multiple buffers then the total frame size is larger than the chunk
size. Furthermore, we are in the zerocopy so we cannot linearize by
allocating a large enough buffer to cover the whole frame then copy the
frame data to it. That's not zerocopy anymore. Also, XDP socket zerocopy
receive has assumption that the packet it receives must from the umem
pool. AFAIK, the generic XDP path is for copy mode only.

Thanks,
Quang Minh.



Return-Path: <linux-kernel+bounces-675981-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7187E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:51:55 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id A3C703B4831
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:49:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 80CEE28AB00;
Fri, 6 Jun 2025 15:44:51 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="d4cS8iDY"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 B7C6028DF3B;
Fri, 6 Jun 2025 15:44:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224690; cv=none; b=bg4VJtx8be1g9LHmYWVmiKLq8FU2EmsTO6eZsdpulo/sOTDobWxVIxGwBIM1ZGqIurEudYlNWMhxm2GhWrU6Dq+1cotlxObJ3G5xBoPxIX3DDmSqzuoXwTuswsVBdllzOnlM99jAB4ZLVB1f3ViiZNjC/pGHkIgSxNORJuWZUGQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224690; c=relaxed/simple;
bh=JufAzRLKwdF7p6LD7Zi2lXLBjYvC7TdfCa99ZsqFE1I=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=kY7F93qfk/AEOZTACbonq8neTf4dmZle64FwA2hantAyXij1XoDZUqOstxXFovDwyjwJXWCPW5CrTOmg66ZgTPm2+WWd1o9Vgkc9gfrN7KkGKHnhgo3oBCoytIo3HZb6iMUCdIbYDDQZM6dechYwtzws7Jt91hFap1kjahMW0fg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=d4cS8iDY; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from isaac-ThinkPad-T16-Gen-2.localdomain (cpc90716-aztw32-2-0-cust408.18-1.cable.virginm.net [86.26.101.153])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 39FC711DD;
Fri, 6 Jun 2025 17:44:42 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749224683;
bh=JufAzRLKwdF7p6LD7Zi2lXLBjYvC7TdfCa99ZsqFE1I=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=d4cS8iDY9Vay0JBQwOMtv9K2pq35drIUecmkmGPsRZbivIF+wpunE7NXSyov4EQjD
AIkzTQq1ToL7EFqzbkWKy3odfGc+FRfO2ByARpL/ZeJxdUwQxCZLzpCyjFEaMFCTu7
4TJ7w2ABB/PsNZuGGt5bJRy/N39iVKavOYNAnV2k=
From: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
To: laurent.pinchart@xxxxxxxxxxxxxxxx
Cc: kieran.bingham@xxxxxxxxxxxxxxxx,
rmfrfs@xxxxxxxxx,
martink@xxxxxxxxx,
kernel@xxxxxxx,
mchehab@xxxxxxxxxx,
shawnguo@xxxxxxxxxx,
s.hauer@xxxxxxxxxxxxxx,
kernel@xxxxxxxxxxxxxx,
festevam@xxxxxxxxx,
linux-media@xxxxxxxxxxxxxxx,
imx@xxxxxxxxxxxxxxx,
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
Subject: [PATCH v2 2/2] media: platform: Add user line interrupt to imx-mipi-csis driver
Date: Fri, 6 Jun 2025 16:44:14 +0100
Message-ID: <20250606154414.540290-3-isaac.scott@xxxxxxxxxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606154414.540290-1-isaac.scott@xxxxxxxxxxxxxxxx>
References: <20250606154414.540290-1-isaac.scott@xxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

The NXP i.MX 8M Plus features an interrupt that triggers after the MIPI
CSI receiver counts a user-configurable number of lines. This is useful
for debugging, as it allows users to check if the amount of lines per
frame equals what they are expecting.

Add support for this interrupt in the driver, and an entry into debugfs
to allow the user to configure whether the interrupt is enabled, as well
as the number of lines after which to trigger the interrupt.

This debugfs control can be altered while a stream is in progress, with
0 disabling the interrupt and >0 setting a new desired line count.

Signed-off-by: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>

---

Changes since v1:
- Moved from magic number to enum in status_index
- Clear INT_MSK_1 in enable_interrupts() when on == false
- use local variable in set_params() as in the interrupt handler
- move interrupt handling code outside of spinlock
---
drivers/media/platform/nxp/imx-mipi-csis.c | 40 +++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index 394987d72c64..1b71f6c19fa8 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -88,6 +88,10 @@
#define MIPI_CSIS_INT_MSK_ERR_CRC BIT(1)
#define MIPI_CSIS_INT_MSK_ERR_UNKNOWN BIT(0)

+/* CSIS Interrupt mask 1 */
+#define MIPI_CSIS_INT_MSK_1 0x18
+#define MIPI_CSIS_INT_MSK_1_LINE_END BIT(0)
+
/* CSIS Interrupt source */
#define MIPI_CSIS_INT_SRC 0x14
#define MIPI_CSIS_INT_SRC_EVEN_BEFORE BIT(31)
@@ -109,6 +113,10 @@
#define MIPI_CSIS_INT_SRC_ERR_UNKNOWN BIT(0)
#define MIPI_CSIS_INT_SRC_ERRORS 0xfffff

+/* CSIS Interrupt source 1 */
+#define MIPI_CSIS_INT_SRC_1 0x1c
+#define MIPI_CSIS_INT_SRC_1_LINE_END BIT(0)
+
/* D-PHY status control */
#define MIPI_CSIS_DPHY_STATUS 0x20
#define MIPI_CSIS_DPHY_STATUS_ULPS_DAT BIT(8)
@@ -221,6 +229,7 @@
#define MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE BIT(0)

#define MIPI_CSIS_FRAME_COUNTER_CH(n) (0x0100 + (n) * 4)
+#define MIPI_CSIS_LINE_INTERRUPT_RATIO(n) (0x0110 + (n) * 4)

/* Non-image packet data buffers */
#define MIPI_CSIS_PKTDATA_ODD 0x2000
@@ -251,6 +260,7 @@
enum mipi_csis_event_type {
MAIN = 0,
DEBUG = 1,
+ USER = 2,
};

struct mipi_csis_event {
@@ -286,6 +296,8 @@ static const struct mipi_csis_event mipi_csis_events[] = {
{ MAIN, MIPI_CSIS_INT_SRC_FRAME_END, "Frame End"},
{ DEBUG, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC Falling Edge"},
{ DEBUG, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC Rising Edge"},
+ /* User Line interrupt */
+ { USER, MIPI_CSIS_INT_SRC_1_LINE_END, "Line End"}
};

#define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
@@ -338,11 +350,14 @@ struct mipi_csis_device {

spinlock_t slock; /* Protect events */
struct mipi_csis_event events[MIPI_CSIS_NUM_EVENTS];
+
struct dentry *debugfs_root;
struct {
bool enable;
u32 hs_settle;
u32 clk_settle;
+ u32 int_line;
+ u32 last_int_line;
} debug;
};

@@ -533,6 +548,8 @@ static void mipi_csis_enable_interrupts(struct mipi_csis_device *csis, bool on)
{
mipi_csis_write(csis, MIPI_CSIS_INT_MSK, on ? 0xffffffff : 0);
mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_MSK, on ? 0xffffffff : 0);
+ mipi_csis_write(csis, MIPI_CSIS_INT_MSK_1,
+ on ? MIPI_CSIS_INT_MSK_1_LINE_END : 0);
}

static void mipi_csis_sw_reset(struct mipi_csis_device *csis)
@@ -655,6 +672,7 @@ static void mipi_csis_set_params(struct mipi_csis_device *csis,
const struct csis_pix_format *csis_fmt)
{
int lanes = csis->bus.num_data_lanes;
+ u32 int_lines;
u32 val;

val = mipi_csis_read(csis, MIPI_CSIS_CMN_CTRL);
@@ -691,6 +709,13 @@ static void mipi_csis_set_params(struct mipi_csis_device *csis,
MIPI_CSIS_DPHY_BCTRL_L_B_DPHYCTRL(20000000));
mipi_csis_write(csis, MIPI_CSIS_DPHY_BCTRL_H, 0);

+ int_lines = READ_ONCE(csis->debug.int_line);
+ if (int_lines > 0)
+ mipi_csis_write(csis, MIPI_CSIS_LINE_INTERRUPT_RATIO(0),
+ max(int_lines, 1U) - 1);
+
+ csis->debug.last_int_line = int_lines;
+
/* Update the shadow register. */
val = mipi_csis_read(csis, MIPI_CSIS_CMN_CTRL);
mipi_csis_write(csis, MIPI_CSIS_CMN_CTRL,
@@ -770,10 +795,12 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)
struct mipi_csis_device *csis = dev_id;
unsigned long flags;
unsigned int i;
- u32 status[2];
+ u32 int_lines;
+ u32 status[3];

status[MAIN] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
status[DEBUG] = mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
+ status[USER] = mipi_csis_read(csis, MIPI_CSIS_INT_SRC_1);

spin_lock_irqsave(&csis->slock, flags);

@@ -792,8 +819,16 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)

spin_unlock_irqrestore(&csis->slock, flags);

+ int_lines = READ_ONCE(csis->debug.int_line);
+ if (int_lines != csis->debug.last_int_line) {
+ mipi_csis_write(csis, MIPI_CSIS_LINE_INTERRUPT_RATIO(0),
+ max(int_lines, 1U) - 1);
+ csis->debug.last_int_line = int_lines;
+ }
+
mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status[MAIN]);
mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, status[DEBUG]);
+ mipi_csis_write(csis, MIPI_CSIS_INT_SRC_1, status[USER]);

return IRQ_HANDLED;
}
@@ -933,6 +968,7 @@ static void mipi_csis_debugfs_init(struct mipi_csis_device *csis)
{
csis->debug.hs_settle = UINT_MAX;
csis->debug.clk_settle = UINT_MAX;
+ csis->debug.int_line = 0;

csis->debugfs_root = debugfs_create_dir(dev_name(csis->dev), NULL);

@@ -944,6 +980,8 @@ static void mipi_csis_debugfs_init(struct mipi_csis_device *csis)
&csis->debug.clk_settle);
debugfs_create_u32("ths_settle", 0600, csis->debugfs_root,
&csis->debug.hs_settle);
+ debugfs_create_u32("int_line_0", 0600, csis->debugfs_root,
+ &csis->debug.int_line);
}

static void mipi_csis_debugfs_exit(struct mipi_csis_device *csis)
--
2.43.0



Return-Path: <linux-kernel+bounces-675978-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id ECEE341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:52:19 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id B1E34188C8A3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:49:45 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2637028DEEC;
Fri, 6 Jun 2025 15:44:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UOjQkB2J"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61D2728DB6C;
Fri, 6 Jun 2025 15:44:38 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224678; cv=none; b=CqGzUeiF//oo01QeZTIE/+071ehenDYsY5tkkWGkVzq16bmDyC6LZfYb7p4BR5ay+YHmVqtGGswMowMRT+SanNebkwkQlyULU8ytfIupNOOBuW8CHHlhBtOJb9jDTJifsx2LMQPSaeHQCi4d2HzUSH4a1JIN6c9e+adLfNtmRF8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224678; c=relaxed/simple;
bh=6Sm7ymWtoHJosH4+YzkKyWHfIGUysELQV0AaRyLsSwI=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version:Content-Type; b=tovzYcs+w6TQelBZZGYeEGyqR2Y7SkavWBpqYd4L7n9iXO7BpaTk9/XN9a6yQt4L/dqO1A3e1tGazl7d/poH2A6rJ8zW+vgslzgbLeJbyxQd7m9ZRTbA2yZE/J2d4pq4/mfz8q1gKA87sPpccy5thOdXCtCXq7q/A8D/N3Fdu/M=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UOjQkB2J; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 488DBC4CEF0;
Fri, 6 Jun 2025 15:44:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749224678;
bh=6Sm7ymWtoHJosH4+YzkKyWHfIGUysELQV0AaRyLsSwI=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=UOjQkB2J+RGFxVZmkiw8pMVCNCusqzhQ6Gx2IkGimFdBdgsjoeaMwoQAIFdM2A63o
uqs68I0VNC1+tjbN01gRQiK37HL58mYp6s/c+zbdnYd5VyYOQavaQRL0Gh4rhj8CV1
oVC6ErPwMVq7XqXC0PzbYoOZdboHyAToRcihvuHVqkPyeMjTyMIOWYTVrusUix+e98
jdzmasZTj7RRVo9V7pS68EVO1Q5dEmjB1KTlsIioV9oGK4HE6nXRAi9DOmz20tuM+C
0cJxfvmgMBYxC2ETjlAZsKtKAv61lPPjd24RUfnEtvU/s57hvaCc55JcTGk/YCierU
BW8QI5+wYxO5w==
From: Sasha Levin <sashal@xxxxxxxxxx>
To: patches@xxxxxxxxxxxxxxx,
stable@xxxxxxxxxxxxxxx
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>,
Lee Jones <lee@xxxxxxxxxx>,
Sasha Levin <sashal@xxxxxxxxxx>,
cw00.choi@xxxxxxxxxxx,
krzk@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH AUTOSEL 5.4 3/3] mfd: max14577: Fix wakeup source leaks on device unbind
Date: Fri, 6 Jun 2025 11:44:32 -0400
Message-Id: <20250606154433.548697-3-sashal@xxxxxxxxxx>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250606154433.548697-1-sashal@xxxxxxxxxx>
References: <20250606154433.548697-1-sashal@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-stable: review
X-Patchwork-Hint: Ignore
X-stable-base: Linux 5.4.294
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20250406-mfd-device-wakekup-leak-v1-3-318e14bdba0a@xxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

Now let me understand the difference between the fixes - the historical
commits show two patterns:
1. Using `devm_device_init_wakeup()` - automatically handles cleanup
2. Manual cleanup by calling `device_init_wakeup(dev, false)` in remove
functions

Let me check if this specific commit has `Cc: stable@xxxxxxxxxxxxxxx` in
the message:

Based on my analysis of this commit and comparison with the similar
historical commits, here is my assessment:

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

## Analysis

### **Code Change Analysis**
The commit adds a single line in the `max14577_i2c_remove()` function:
```c
+ device_init_wakeup(max14577->dev, false);
```

This addition occurs at drivers/mfd/max14577.c:459, right before
`mfd_remove_devices()` is called.

### **Bug Fix Characteristics**
1. **Memory Leak Fix**: The commit fixes a wakeup source memory leak
that occurs when the device is unbound. When `device_init_wakeup(dev,
true)` is called during probe (line 442), it allocates memory for
wakeup source structures. Without the corresponding cleanup call,
this memory is leaked on device removal.

2. **Small and Contained**: The fix is minimal - a single line addition
that mirrors the cleanup pattern used throughout the kernel.

3. **Low Risk**: The change has extremely low regression risk since it
only adds proper cleanup that should have been there originally.

### **Comparison with Historical Similar Commits**
Looking at the provided historical commits, there are two categories:

**YES commits (backported)**:
- `gpio: mpc8xxx: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`
- `gpio: zynq: Fix wakeup source leaks on device unbind` - Same exact
pattern and includes `Cc: stable@xxxxxxxxxxxxxxx`

**NO commits (not backported)**:
- IIO driver commits that use `devm_device_init_wakeup()` instead of
manual cleanup

The key difference is that the YES commits use the same fix pattern as
this MFD commit - manual cleanup in the remove function, while the NO
commits use the `devm_` managed approach that automatically handles
cleanup.

### **Impact Assessment**
- **User Impact**: Memory leaks on device unbind affect systems where
MFD devices are frequently bound/unbound
- **Subsystem**: MFD (Multi-Function Device) is a core kernel subsystem
used by many embedded systems
- **Regression Risk**: Minimal - adding proper cleanup cannot cause
functional regression

### **Stable Tree Criteria Met**
1. â?? Fixes an important bug (memory leak)
2. â?? Small and contained change
3. â?? No architectural changes
4. â?? Minimal risk of regression
5. â?? Follows established patterns seen in other backported commits

The commit follows the exact same pattern as the GPIO driver commits
that were successfully backported to stable trees (commits #1 and #2 in
the historical examples), making it a clear candidate for backporting.

drivers/mfd/max14577.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index fd8864cafd25c..4d87b429a7bad 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -467,6 +467,7 @@ static int max14577_i2c_remove(struct i2c_client *i2c)
{
struct max14577 *max14577 = i2c_get_clientdata(i2c);

+ device_init_wakeup(max14577->dev, false);
mfd_remove_devices(max14577->dev);
regmap_del_irq_chip(max14577->irq, max14577->irq_data);
if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
--
2.39.5



Return-Path: <linux-kernel+bounces-675983-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 0A05741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:53:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 839A61BA0D76
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:51:05 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 99355289E02;
Fri, 6 Jun 2025 15:47:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GphpJ9oc"
Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64])
(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 1C35C13DBA0;
Fri, 6 Jun 2025 15:47:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749224833; cv=none; b=RxSFoXpaIkPU7uzIQ1Pwq/6LjuBB7SWowFWbnXVDcJk6DtprRJNGhAm6uzy59QSyygJmIxYl8bg94SMZCxY1/03Yhliz7NKdbzaTC+U7RimVfFTuMkDTEHjDqbJQJqfDdpKjX9es4EMr9uiC1z5hLGQi6RMCIWSUaVca03mfUMo=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749224833; c=relaxed/simple;
bh=RdiDBtVhuf4nlhpFoArx/0tGuceAeEnMRGYWVVGgEW8=;
h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:MIME-Version; b=tvK58hcs+pOLzdyT25tWG7pgANJEdFFgW09g9b1yr3obalDe+Xl/RgjbZtUzuBMReBXtYBAlAxixLoKhqrm7QHVWF1VGEFp7fOD9pU0mvsym0AVS03KxwRADjIHr2ezMn6zc8jvkh6uEflPm8aFFKMGqsk7eNzoMlKYXofKNk54=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=GphpJ9oc; arc=none smtp.client-ip=213.167.242.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com
Received: from isaac-ThinkPad-T16-Gen-2.localdomain (cpc90716-aztw32-2-0-cust408.18-1.cable.virginm.net [86.26.101.153])
by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A74A8DB;
Fri, 6 Jun 2025 17:47:03 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
s=mail; t=1749224824;
bh=RdiDBtVhuf4nlhpFoArx/0tGuceAeEnMRGYWVVGgEW8=;
h=Subject:From:To:Cc:Date:In-Reply-To:References:From;
b=GphpJ9ocRRaSKmBGaMe0GY9T6CO1Vr1c30fqd1NVudiCktufhnnq7f2rRPh2/hAxF
8DvNnG5L25nYfAg8FnDOBMJXOQGZy9iAs6aoMq0rfQZIYt+XYxoJk9T+MMkiXM004e
+R3mMgu+29H29kJnrlqV3LEhgSd8rdxh2HOlEZqQ=
Message-ID: <8e950dd3c54a363d8e2d7252e3f3d93301076b50.camel@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH 1/2] media: platform: Refactor interrupt status registers
From: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
To: Rui Miguel Silva <rmfrfs@xxxxxxxxx>, laurent.pinchart@xxxxxxxxxxxxxxxx
Cc: kieran.bingham@xxxxxxxxxxxxxxxx, martink@xxxxxxxxx, kernel@xxxxxxx,
mchehab@xxxxxxxxxx, shawnguo@xxxxxxxxxx, s.hauer@xxxxxxxxxxxxxx,
kernel@xxxxxxxxxxxxxx, festevam@xxxxxxxxx, linux-media@xxxxxxxxxxxxxxx,
imx@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Date: Fri, 06 Jun 2025 16:47:04 +0100
In-Reply-To: <DAFI37JD827I.KWPZ7XCTWPBD@xxxxxxxxxx>
References: <20250606121403.498153-1-isaac.scott@xxxxxxxxxxxxxxxx>
<20250606121403.498153-2-isaac.scott@xxxxxxxxxxxxxxxx>
<DAFI37JD827I.KWPZ7XCTWPBD@xxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.56.1 (by Flathub.org)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Rui,

On Fri, 2025-06-06 at 14:56 +0100, Rui Miguel Silva wrote:
> Hey Isaac,
> Thanks for the patch.
>=20
> On Fri Jun 6, 2025 at 1:14 PM WEST, Isaac Scott wrote:
>=20
> > The NXP i.MX 8 MP CSI-2 receiver features multiple interrupt and
> > debug
> > status sources which span multiple registers. The driver currently
> > supports two interrupt source registers, and attributes the
> > mipi_csis_event event entries to those registers through a boolean
> > debug
> > field that indicate if the event relates to the main interrupt
> > status
> > (false) or debug interrupt status (true) register. To make it
> > easier to
> > add new event fields, replace the debug bool with a 'status index'
> > integer than indicates the index of the corresponding status
> > register.
> >=20
> > Signed-off-by: Isaac Scott <isaac.scott@xxxxxxxxxxxxxxxx>
> > ---
> > =C2=A0drivers/media/platform/nxp/imx-mipi-csis.c | 64 +++++++++++------=
-
> > ----
> > =C2=A01 file changed, 31 insertions(+), 33 deletions(-)
> >=20
> > diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c
> > b/drivers/media/platform/nxp/imx-mipi-csis.c
> > index d060eadebc7a..bbc549c22aff 100644
> > --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> > +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> > @@ -249,7 +249,7 @@
> > =C2=A0#define MIPI_CSI2_DATA_TYPE_USER(x) (0x30 + (x))
> > =C2=A0
> > =C2=A0struct mipi_csis_event {
> > - bool debug;
> > + unsigned int status_index;
> > =C2=A0 u32 mask;
> > =C2=A0 const char * const name;
> > =C2=A0 unsigned int counter;
> > @@ -257,30 +257,30 @@ struct mipi_csis_event {
> > =C2=A0
> > =C2=A0static const struct mipi_csis_event mipi_csis_events[] =3D {
> > =C2=A0 /* Errors */
> > - { false, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT
> > Error" },
> > - { false,
> > MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost Frame Start Error" },
> > - { false,
> > MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost Frame End Error" },
> > - { false, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO
> > Overflow Error" },
> > - { false, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong
> > Configuration Error" },
> > - { false, MIPI_CSIS_INT_SRC_ERR_ECC, "ECC
> > Error" },
> > - { false, MIPI_CSIS_INT_SRC_ERR_CRC, "CRC
> > Error" },
> > - { false,
> > MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown Error" },
> > - { true, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type
> > Not Supported" },
> > - { true, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type
> > Ignored" },
> > - { true, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame
> > Size Error" },
> > - { true,
> > MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated Frame" },
> > - { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early
> > Frame End" },
> > - { true, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early
> > Frame Start" },
> > + { 0, MIPI_CSIS_INT_SRC_ERR_SOT_HS, "SOT
> > Error"},
>=20
> Maybe instead of 0,1,2 (magic indexes)... we could give a meaningful
> index
> enums names, don't know, like: main, debug, user??? or something that
> you think is better.

Thanks for the review! I have updated v2 to include an enum instead of
magic numbers.

Best wishes,

Isaac

>=20
> Cheers,
> =C2=A0=C2=A0=C2=A0 Rui
>=20
> > + { 0, MIPI_CSIS_INT_SRC_ERR_LOST_FS, "Lost
> > Frame Start Error"},
> > + { 0, MIPI_CSIS_INT_SRC_ERR_LOST_FE, "Lost
> > Frame End Error"},
> > + { 0, MIPI_CSIS_INT_SRC_ERR_OVER, "FIFO
> > Overflow Error"},
> > + { 0, MIPI_CSIS_INT_SRC_ERR_WRONG_CFG, "Wrong
> > Configuration Error"},
> > + { 0,
> > MIPI_CSIS_INT_SRC_ERR_ECC, "ECC Error"},
> > + { 0,
> > MIPI_CSIS_INT_SRC_ERR_CRC, "CRC Error"},
> > + { 0, MIPI_CSIS_INT_SRC_ERR_UNKNOWN, "Unknown
> > Error"},
> > + { 1, MIPI_CSIS_DBG_INTR_SRC_DT_NOT_SUPPORT, "Data Type
> > Not Supported"},
> > + { 1, MIPI_CSIS_DBG_INTR_SRC_DT_IGNORE, "Data Type
> > Ignored"},
> > + { 1, MIPI_CSIS_DBG_INTR_SRC_ERR_FRAME_SIZE, "Frame
> > Size Error"},
> > + { 1, MIPI_CSIS_DBG_INTR_SRC_TRUNCATED_FRAME, "Truncated
> > Frame"},
> > + { 1, MIPI_CSIS_DBG_INTR_SRC_EARLY_FE, "Early
> > Frame End"},
> > + { 1, MIPI_CSIS_DBG_INTR_SRC_EARLY_FS, "Early
> > Frame Start"},
> > =C2=A0 /* Non-image data receive events */
> > - { false,
> > MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image data before even frame" },
> > - { false, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image
> > data after even frame" },
> > - { false, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image
> > data before odd frame" },
> > - { false, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image
> > data after odd frame" },
> > + { 0, MIPI_CSIS_INT_SRC_EVEN_BEFORE, "Non-image
> > data before even frame"},
> > + { 0, MIPI_CSIS_INT_SRC_EVEN_AFTER, "Non-image
> > data after even frame"},
> > + { 0, MIPI_CSIS_INT_SRC_ODD_BEFORE, "Non-image
> > data before odd frame"},
> > + { 0, MIPI_CSIS_INT_SRC_ODD_AFTER, "Non-image
> > data after odd frame"},
> > =C2=A0 /* Frame start/end */
> > - { false,
> > MIPI_CSIS_INT_SRC_FRAME_START, "Frame Start" },
> > - { false, MIPI_CSIS_INT_SRC_FRAME_END, "Frame
> > End" },
> > - { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC
> > Falling Edge" },
> > - { true, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC
> > Rising Edge" },
> > + { 0, MIPI_CSIS_INT_SRC_FRAME_START, "Frame
> > Start"},
> > + { 0, MIPI_CSIS_INT_SRC_FRAME_END, "Frame
> > End"},
> > + { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_FALL, "VSYNC
> > Falling Edge"},
> > + { 1, MIPI_CSIS_DBG_INTR_SRC_CAM_VSYNC_RISE, "VSYNC
> > Rising Edge"},
> > =C2=A0};
> > =C2=A0
> > =C2=A0#define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
> > @@ -765,32 +765,30 @@ static irqreturn_t mipi_csis_irq_handler(int
> > irq, void *dev_id)
> > =C2=A0 struct mipi_csis_device *csis =3D dev_id;
> > =C2=A0 unsigned long flags;
> > =C2=A0 unsigned int i;
> > - u32 status;
> > - u32 dbg_status;
> > + u32 status[2];
> > =C2=A0
> > - status =3D mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
> > - dbg_status =3D mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
> > + status[0] =3D mipi_csis_read(csis, MIPI_CSIS_INT_SRC);
> > + status[1] =3D mipi_csis_read(csis, MIPI_CSIS_DBG_INTR_SRC);
> > =C2=A0
> > =C2=A0 spin_lock_irqsave(&csis->slock, flags);
> > =C2=A0
> > =C2=A0 /* Update the event/error counters */
> > - if ((status & MIPI_CSIS_INT_SRC_ERRORS) || csis-
> > >debug.enable) {
> > + if ((status[0] & MIPI_CSIS_INT_SRC_ERRORS) || csis-
> > >debug.enable) {
> > =C2=A0 for (i =3D 0; i < MIPI_CSIS_NUM_EVENTS; i++) {
> > =C2=A0 struct mipi_csis_event *event =3D &csis-
> > >events[i];
> > =C2=A0
> > - if ((!event->debug && (status & event-
> > >mask)) ||
> > - =C2=A0=C2=A0=C2=A0 (event->debug && (dbg_status & event-
> > >mask)))
> > + if (status[event->status_index] & event-
> > >mask)
> > =C2=A0 event->counter++;
> > =C2=A0 }
> > =C2=A0 }
> > =C2=A0
> > - if (status & MIPI_CSIS_INT_SRC_FRAME_START)
> > + if (status[0] & MIPI_CSIS_INT_SRC_FRAME_START)
> > =C2=A0 mipi_csis_queue_event_sof(csis);
> > =C2=A0
> > =C2=A0 spin_unlock_irqrestore(&csis->slock, flags);
> > =C2=A0
> > - mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status);
> > - mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, dbg_status);
> > + mipi_csis_write(csis, MIPI_CSIS_INT_SRC, status[0]);
> > + mipi_csis_write(csis, MIPI_CSIS_DBG_INTR_SRC, status[1]);
> > =C2=A0
> > =C2=A0 return IRQ_HANDLED;
> > =C2=A0}
> > --=20
> > 2.43.0
>=20
>=20


Return-Path: <linux-kernel+bounces-675986-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 31EA641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:54:39 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9EAA03A78FC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:51:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 087F1288C96;
Fri, 6 Jun 2025 15:51:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jvK7vjnP"
Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11012019.outbound.protection.outlook.com [52.101.66.19])
(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 5500914F98;
Fri, 6 Jun 2025 15:51:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.19
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225097; cv=fail; b=W10cx6/jPrOyfMOek6686XmPvejsnh4V+c0onLxjR+1r0iLLstACkZ8N91kUVB6IFSHE9yTKqWVOFf1rkmtOW+CVItrtiB51FDaKeKSrYGFgh8gzdvi+BrLYFgKATNthxo0Vpa1gqooJGBVbxXiqlWCZAwdmSE4jywSjc0VFxE8=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225097; c=relaxed/simple;
bh=Z2nZxw7xlM74pEjcBNcRtdgv+G7nkPYLvLnnzYd7qKU=;
h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=mXPBPB7GooizgEofQ/aYf329i278Xo9A5079/XKD/axPn0mYWeKw46sASqYNSZTvxRYwNWwWXxMR4uYQb5bUtsKtijzbow+g0cvo+SHhmJd2SxMZ5svSNlc/nsKs7Z63PpV8KMR0ks28FSBGcwlQmZ1VGwwQ5aY8NmQGHd5jLcs=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=jvK7vjnP; arc=fail smtp.client-ip=52.101.66.19
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=tWonhWv1o7kQitC2W1FPbQg8B4jf5CpnOoCPsiYtFoO0ksijMDuMTmWLIVLEBxccqarAboedc+FmDcZSBWaGtyGzMOBrX4I8+cDFOqKkiy7T0t90Ljt7Y+Z6VH/1/uEIkAIrBQPijuwwEgiuTbqf/utoqSDlnKYiCewTb5YjQJe6bJTS6vcl/egf2+e4riXpFh6iTFQ0/J+RsbBYQ95y3FFixW6qfFqDyDYY6dz+fPVTYtbuMa7GQ76Di5SZDLb7WAUsn5b/Y7vW7a7UDGXa/mwalc+molMBI/DWlMF1omEjE4r8fxoWxa80kZgzKQDd/Bp7DVaz5eZ3d5mta5NAlA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=e1Mo5uKBiQLLM8CnQZ+YBABLMtKSGePxDMPREtCC8Ag=;
b=VpVoEXS0BKmTMMCYHnklSNFCRHVt/DlBnQLwTQfjuWsKpnlHr0X1tWm3Yo1DZdfox+CwZr8MyL/lA7GXg2zbj19XiC0+uwxZNjD0gqk9oK7eGo1b5DmrVaHTyfPDeyBfigCHMKONYW82ja8sI1paV7DREIA2DSeouxKzPS3M8lvnRWppNYbNzVuepMtoZzTGyFrFisSz4ATl5qvgd29qaLVEReD++KC8/9o7H1HCL7sF9ur/AhWqb598iYwTeuHgU8IjzWxhNH7WMzsOGxeffw/Y4aP2vP7p9D99tIhBSWM1tNnzqURixpP/6ASXE4/9lWUpCfAFXwR7R+SUJdeicQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=e1Mo5uKBiQLLM8CnQZ+YBABLMtKSGePxDMPREtCC8Ag=;
b=jvK7vjnPTa8C0tDqpfA5Bs9t2xIVlYgtOcRe1yDQ59mG514Muj634DuGzvZrjcmmCR7cKeJpz685VjpBm7nSdTtyLmVyuhVkuADmL5PSTFWHDynvh0hF7kiCkNJhtDP+UhQCok3rANer0LikS2fdYmIlh/fwav9UAXvx5nzF47MBoz86jtiXxGl45HcBag5WPRwnRhMdsTdpsCTlt5coSlZCXchwR8MY4rADipUhz65hGz2xkmCCxp0hmKvWh+X7SYQVsoR2XOCvqD/nqIKylEgH3bsBR1g9iAniZ+3S9CziJDAYA0GhcCVl6aL5hJJBzMnQ1Px3zBI+MxonS+Sqng==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14)
by PA1PR04MB10796.eurprd04.prod.outlook.com (2603:10a6:102:48e::14) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.23; Fri, 6 Jun
2025 15:51:32 +0000
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06%6]) with mapi id 15.20.8769.025; Fri, 6 Jun 2025
15:51:31 +0000
From: Frank Li <Frank.Li@xxxxxxx>
To: Andrew Lunn <andrew+netdev@xxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>,
Paolo Abeni <pabeni@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Stefan Wahren <wahrenst@xxxxxxx>,
netdev@xxxxxxxxxxxxxxx (open list:NETWORKING DRIVERS),
devicetree@xxxxxxxxxxxxxxx (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS),
linux-kernel@xxxxxxxxxxxxxxx (open list)
Cc: imx@xxxxxxxxxxxxxxx
Subject: [PATCH v3 1/1] dt-bindings: net: convert qca,qca7000.txt yaml format
Date: Fri, 6 Jun 2025 11:51:17 -0400
Message-Id: <20250606155118.1355413-1-Frank.Li@xxxxxxx>
X-Mailer: git-send-email 2.34.1
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: BY3PR10CA0002.namprd10.prod.outlook.com
(2603:10b6:a03:255::7) To PAXPR04MB9642.eurprd04.prod.outlook.com
(2603:10a6:102:240::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA1PR04MB10796:EE_
X-MS-Office365-Filtering-Correlation-Id: 99339302-6916-4283-ae3b-08dda51201ec
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|921020|38350700014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?T+WT4VZuTq9dBb7KNzD+KLMbiShbknNyt3rVcA8lpuUZQdYD7UR4HiNQ6fdP?=
=?us-ascii?Q?or+tENdEdbyOxHc+pYIqKP0T2kvtN94S5SeDKBTvX2drAt8V6VqP8DfePAFx?=
=?us-ascii?Q?mm7ttTi7fUA58+y2s3zr7tgxzvy0xt7h3EcAi2J/rffAWJpduQrG4hT+DYKx?=
=?us-ascii?Q?j2Oj4pqQNGesIVaio/+ypvLh/bnbGoqCufGGPRN4Pc5fUmOpckrKATNyXZIs?=
=?us-ascii?Q?+bOlGxGSME06bnfEWnj7q9sYw6JiJIejauSABp+u/vSQKc9mgIAFlfJsuLwN?=
=?us-ascii?Q?tOZ1GFoFa9DUBrwCJt91O3TUmXvB2GSUs32XSzqjb+aiK50SK8V+n0gInN5X?=
=?us-ascii?Q?mfeRv9Ts0nrKS5jVDRd4lUwiLmSCtfHTJOdf9EDrvuYS6dosocx0gal4VVEy?=
=?us-ascii?Q?1k+2iUPk2FQSRKyU2J8A0XYzssFcwEBzQg1IclOHRDnAff0BkzzApZlxLhKa?=
=?us-ascii?Q?xRpwolqCXxQxYItcXZurVclevwwIbpz8c5KWjCY6Qtg9AoASZtfesVTG6eHq?=
=?us-ascii?Q?MhYcR0o2RAohrC6/oQQgJZzMUbNpuJfirtd6gUBL33sT6/1CxrPSepT19OzB?=
=?us-ascii?Q?4LczT9RNNnSsGvOY6LJpdVinTF/3UBcnMXtmaEMa/fmu8PPsK0YOaxNhnoo1?=
=?us-ascii?Q?8bsPMbRzBys9vN6gv2pMImh0KRdIYU3fgVe0fjW5H1q67Ii4zYC5OOwa1gY6?=
=?us-ascii?Q?9GRYG/bC7ZyWRqh1ZZfAM2ndukTE0iP9p2dMeyNUWdXqxaXqKJtAVmIYfT4v?=
=?us-ascii?Q?Fl8D25mfDPIhNXbxtQDSTw2CDg0oMvSG7mu9R1Q3b2PT9ZlmqNcLJngPLdEA?=
=?us-ascii?Q?B2dDtPCiA8tx4tnWzZQc7jbvHsyqj6VPcgcoZb+AUFE7JrJw3s7G0bbYNi5O?=
=?us-ascii?Q?X0VVoumb6bDLn8GioIgkS4kTD7hk9F3pFGa/L3Z+ar7gh7YXVkQ01MqUYMY6?=
=?us-ascii?Q?JJUz82CUPrngjJQY0y6dg8XxCxRcxXgel9yGsI/hOFHSHTErFdCu/HrwxOju?=
=?us-ascii?Q?Oy7g8MU01OyM6vSZ+/gEc8GJ4BAHYmIeE0RWkOlPrrx/P6DgYh/4IHRyn0ZH?=
=?us-ascii?Q?4vnLgEzZmtaQTEgbkQw+Id//9b7JoFcn4p9cJLhYx2rVV3vstlnkyh1Lzpf4?=
=?us-ascii?Q?9Xe7kWtmQqkJz/xBSlIhVIbw/1/y+bfR36C6Vr9/0JqmuPYybAfXXZ5lbhiR?=
=?us-ascii?Q?aiV85DymMTLgycEKseviCOuvRVUtt2Bc6Ev2HdImipizJsqv50HlKQuATwkG?=
=?us-ascii?Q?12wex3aOr4I1H5xRLlHasMfVL9+73oENTmvj/+Ik5/52jIBKkklNqT5p1eCq?=
=?us-ascii?Q?lsaiXfmovcHwQ7a85OD1sGklk8LJrxXUcKmZCoGpjtv1woXQkROpqO57GYjF?=
=?us-ascii?Q?sP7Kr0oCI05ey2z5jEeb3ieLrXjAciW859w1wC8/T3tJhmkyThi800H9sXNo?=
=?us-ascii?Q?vidu4ikjCV/nFtRPaqywgMo+7XYE8yi6?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014)(52116014)(921020)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?KtTup7c+xT5VGvGYn4RYh62oL3b4o9hWz+N2utWGbCahg1YhLeuBoI2hn3mg?=
=?us-ascii?Q?dP2MZAggHJKSEkMfeOSJpbouAd2mwMlgVxHyAQ8EKDGIe73aa7SJ8YoIx33b?=
=?us-ascii?Q?LJ4zZu/4D0b7Xnfz8T/KFQULCyMpXcK/VwuW7oSj6DlLdD9yDPRP1dGEfMki?=
=?us-ascii?Q?g/+y6A1f1EGalP2RiX0vcPNZtXXhSshh9Lob4Ou1y3byZKAlfOooFHlSh23+?=
=?us-ascii?Q?PIukWRVAKPUK7k7KVnbDucLhM3hvA7ZThX5V3gfQqfR5d4mltzdkSJNFe7Xn?=
=?us-ascii?Q?l6eIx8I/k7Z37QaB70jivoywIpMBP4Ygi04yk73dG+YRLbHwf8mkRvMXRln6?=
=?us-ascii?Q?I56gnALTx+RKM1V6SfhEUGz5mER9Pbjc5IWAusgNuy6Q5hLRWT32VrHQ0HPm?=
=?us-ascii?Q?mZ1n80bq+UuYnBF+Yn8MPj7Xz2jxRayEXiVhfIH6w4YgHN3gH+BAkzxVLNzJ?=
=?us-ascii?Q?hsFgbRH/8IpIiaLjsu9sFkgsXaJfnRwoYsiQMcgDahY0rHRIfcRT4t+SKHal?=
=?us-ascii?Q?azMUXQ4E8A7ybgOF3AN+HzLAfG4FOTgvnkBib0BaAfjOjNzjl94d+bsu1RkJ?=
=?us-ascii?Q?DcvAab887MaXbeApLll6p1ja5dm8BqhAqy4aZOxbYaW4Ls8OHfl1mKX0Gy8y?=
=?us-ascii?Q?hgITs8XIcaFqapEL+f6U4rBtYt9cxVaQGqRBKlkcmhxObWujiYvtHGnMlegw?=
=?us-ascii?Q?S4UqGnQf3PKGaq9hXX4s2EECdQIDiFatUp3tUfhJDdBbkKhWiSfDGaUUCeP8?=
=?us-ascii?Q?l24oDC9UbIxzwhpVUXNA47yc8PRn559a8GCWpZU/hdmLnz07sPXRm27Z8T7h?=
=?us-ascii?Q?mkjJZCI8C0smIGawjdz990pzsck2Kjg9MfYdH7H2gzEc33EwhMjCiS3n4n3a?=
=?us-ascii?Q?ef6QWWzsJu3lWTzXfD2pSZ7Dc8otGYixjNan13bLck8oE0i2PjbfmmOqRMDF?=
=?us-ascii?Q?sPE0C0wcPTePbdZqT2mYu+vAKKsbbMM7GDyabh2fbAlAdvajUWpK6EpYhXhn?=
=?us-ascii?Q?tR4+wtMReP5qgDJdQxqVl+7WWfe+hgRUQQ9n21p2CyRSW0F9h0L+YaHFK7to?=
=?us-ascii?Q?5Eto9vTe2gBafXM7/GVsYAy8OpH4E2WIYDci6OCDuY4119+i/F5yPkUKB9Sz?=
=?us-ascii?Q?mk2PfB9eAUc8kjCs01Dqhbp4OoRzmowEpVXnj8j/yh23l6qlEaQKKCF5YWyO?=
=?us-ascii?Q?BEYOOdi4D9MBjbebzRzbUahOLOTTofQn/SKqkBXkZVzGWnR932jWLPdUf+3A?=
=?us-ascii?Q?ioxc7daMk7+w/L0TOmhx/i0B8hlQMv1D+RPlLwQcq2+uG+rpPBEcF2ap6lj+?=
=?us-ascii?Q?OEJAwK1I7PaJ4HyX+aN+Gf6EYYtlwmVAAAHk2QPb3meGHeULt7VnmEBwLw3c?=
=?us-ascii?Q?z8mX7s9KUz0A4Uc4CgEw1UEf3JTdwC18o3RSgD9RcnYcdOi343B35461eZKT?=
=?us-ascii?Q?P7+vlYazGu8IbeF2JOEtKqAUf2fftA7+YMjKSQdTLVjp9NvRkQIrfU+N/CaN?=
=?us-ascii?Q?0yYFc9yJP2OR/OCBmqN1ojZ+spDKnEU0jYhlWXzu9YqamBtb8sDxWhbmem3s?=
=?us-ascii?Q?uvf/xODVC3JTAux2GaeRJ2FiFMTN5rX+G1OtUY4o?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 99339302-6916-4283-ae3b-08dda51201ec
X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 15:51:31.8731
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 7cF9oQMRx/9sY9iP3j0w3ZGTLTqcPHE7+mG7w3FzAb0wO3SIZkuWI7i8MpDio/mXCcTfJF2BYBYwr8kskBJuLQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10796
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Convert qca,qca7000.txt yaml format.

Additional changes:
- add refs: spi-peripheral-props.yaml, serial-peripheral-props.yaml and
ethernet-controller.yaml.
- simple spi and uart node name.
- use low case for mac address in examples.
- add check reg choose spi-peripheral-props.yaml or
spi-peripheral-props.yaml.

Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
---
change in v3
- move ethernet-controller.yaml# out of if branch

change in v2
- add Ethernet over UART" description here back
- add add check reg choose spi-peripheral-props.yaml
- move spi related properties in if-then branch
- move uart related properies in if-else branch
---
.../devicetree/bindings/net/qca,qca7000.txt | 87 ---------------
.../devicetree/bindings/net/qca,qca7000.yaml | 105 ++++++++++++++++++
MAINTAINERS | 2 +-
3 files changed, 106 insertions(+), 88 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/net/qca,qca7000.txt
create mode 100644 Documentation/devicetree/bindings/net/qca,qca7000.yaml

diff --git a/Documentation/devicetree/bindings/net/qca,qca7000.txt b/Documentation/devicetree/bindings/net/qca,qca7000.txt
deleted file mode 100644
index 8f5ae0b84eec2..0000000000000
--- a/Documentation/devicetree/bindings/net/qca,qca7000.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-* Qualcomm QCA7000
-
-The QCA7000 is a serial-to-powerline bridge with a host interface which could
-be configured either as SPI or UART slave. This configuration is done by
-the QCA7000 firmware.
-
-(a) Ethernet over SPI
-
-In order to use the QCA7000 as SPI device it must be defined as a child of a
-SPI master in the device tree.
-
-Required properties:
-- compatible : Should be "qca,qca7000"
-- reg : Should specify the SPI chip select
-- interrupts : The first cell should specify the index of the source
- interrupt and the second cell should specify the trigger
- type as rising edge
-- spi-cpha : Must be set
-- spi-cpol : Must be set
-
-Optional properties:
-- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at.
- Numbers smaller than 1000000 or greater than 16000000
- are invalid. Missing the property will set the SPI
- frequency to 8000000 Hertz.
-- qca,legacy-mode : Set the SPI data transfer of the QCA7000 to legacy mode.
- In this mode the SPI master must toggle the chip select
- between each data word. In burst mode these gaps aren't
- necessary, which is faster. This setting depends on how
- the QCA7000 is setup via GPIO pin strapping. If the
- property is missing the driver defaults to burst mode.
-
-The MAC address will be determined using the optional properties
-defined in ethernet.txt.
-
-SPI Example:
-
-/* Freescale i.MX28 SPI master*/
-ssp2: spi@80014000 {
- #address-cells = <1>;
- #size-cells = <0>;
- compatible = "fsl,imx28-spi";
- pinctrl-names = "default";
- pinctrl-0 = <&spi2_pins_a>;
-
- qca7000: ethernet@0 {
- compatible = "qca,qca7000";
- reg = <0x0>;
- interrupt-parent = <&gpio3>; /* GPIO Bank 3 */
- interrupts = <25 0x1>; /* Index: 25, rising edge */
- spi-cpha; /* SPI mode: CPHA=1 */
- spi-cpol; /* SPI mode: CPOL=1 */
- spi-max-frequency = <8000000>; /* freq: 8 MHz */
- local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
- };
-};
-
-(b) Ethernet over UART
-
-In order to use the QCA7000 as UART slave it must be defined as a child of a
-UART master in the device tree. It is possible to preconfigure the UART
-settings of the QCA7000 firmware, but it's not possible to change them during
-runtime.
-
-Required properties:
-- compatible : Should be "qca,qca7000"
-
-Optional properties:
-- local-mac-address : see ./ethernet.txt
-- current-speed : current baud rate of QCA7000 which defaults to 115200
- if absent, see also ../serial/serial.yaml
-
-UART Example:
-
-/* Freescale i.MX28 UART */
-auart0: serial@8006a000 {
- compatible = "fsl,imx28-auart", "fsl,imx23-auart";
- reg = <0x8006a000 0x2000>;
- pinctrl-names = "default";
- pinctrl-0 = <&auart0_2pins_a>;
-
- qca7000: ethernet {
- compatible = "qca,qca7000";
- local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
- current-speed = <38400>;
- };
-};
diff --git a/Documentation/devicetree/bindings/net/qca,qca7000.yaml b/Documentation/devicetree/bindings/net/qca,qca7000.yaml
new file mode 100644
index 0000000000000..1851055a86af6
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/qca,qca7000.yaml
@@ -0,0 +1,105 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/qca,qca7000.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm QCA7000
+
+maintainers:
+ - Frank Li <Frank.Li@xxxxxxx>
+
+description: |
+ The QCA7000 is a serial-to-powerline bridge with a host interface which could
+ be configured either as SPI or UART slave. This configuration is done by
+ the QCA7000 firmware.
+
+ (a) Ethernet over SPI
+
+ In order to use the QCA7000 as SPI device it must be defined as a child of a
+ SPI master in the device tree.
+
+ (b) Ethernet over UART
+
+ In order to use the QCA7000 as UART slave it must be defined as a child of a
+ UART master in the device tree. It is possible to preconfigure the UART
+ settings of the QCA7000 firmware, but it's not possible to change them during
+ runtime
+
+properties:
+ compatible:
+ const: qca,qca7000
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+if:
+ required:
+ - reg
+
+then:
+ properties:
+ spi-cpha: true
+
+ spi-cpol: true
+
+ spi-max-frequency:
+ default: 8000000
+ maximum: 16000000
+ minimum: 1000000
+
+ qca,legacy-mode:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ Set the SPI data transfer of the QCA7000 to legacy mode.
+ In this mode the SPI master must toggle the chip select
+ between each data word. In burst mode these gaps aren't
+ necessary, which is faster. This setting depends on how
+ the QCA7000 is setup via GPIO pin strapping. If the
+ property is missing the driver defaults to burst mode.
+
+ allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+else:
+ properties:
+ current-speed:
+ default: 115200
+
+ allOf:
+ - $ref: /schemas/serial/serial-peripheral-props.yaml#
+
+allOf:
+ - $ref: ethernet-controller.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethernet@0 {
+ compatible = "qca,qca7000";
+ reg = <0x0>;
+ interrupt-parent = <&gpio3>; /* GPIO Bank 3 */
+ interrupts = <25 0x1>; /* Index: 25, rising edge */
+ spi-cpha; /* SPI mode: CPHA=1 */
+ spi-cpol; /* SPI mode: CPOL=1 */
+ spi-max-frequency = <8000000>; /* freq: 8 MHz */
+ local-mac-address = [ a0 b0 c0 d0 e0 f0 ];
+ };
+ };
+
+ - |
+ serial {
+ ethernet {
+ compatible = "qca,qca7000";
+ local-mac-address = [ a0 b0 c0 d0 e0 f0 ];
+ current-speed = <38400>;
+ };
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index c14da518a214c..6416ada9900af 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20295,7 +20295,7 @@ QUALCOMM ATHEROS QCA7K ETHERNET DRIVER
M: Stefan Wahren <wahrenst@xxxxxxx>
L: netdev@xxxxxxxxxxxxxxx
S: Maintained
-F: Documentation/devicetree/bindings/net/qca,qca7000.txt
+F: Documentation/devicetree/bindings/net/qca,qca7000.yaml
F: drivers/net/ethernet/qualcomm/qca*

QUALCOMM BAM-DMUX WWAN NETWORK DRIVER
--
2.34.1



Return-Path: <linux-kernel+bounces-675987-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D97C341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:55:24 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id F2A2B3AEA2D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:53:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 075E01B040D;
Fri, 6 Jun 2025 15:53:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b3OT9DNn"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40EB32A8D0;
Fri, 6 Jun 2025 15:53:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225205; cv=none; b=NUGwLPkTWsz4ehXvfRR09p7eDzwGIWf+jAYIMPhGruMbPaSHnINTqvbGAYeD0VJdIWWL7+sO2sBhMuZOnim65SRUcPwpqrMzTdvi++ZDsgBBzRgnnB/HOjKZDgW1dhGNMW7UqtCI80zYwWC09xykyLyFDffoyI6Hl8pUlE7/HxY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225205; c=relaxed/simple;
bh=ZffmP67iCxIRYWii/TFpM7JL7F9vyh8RFszEdPO/+Hs=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=cpsM7csr1U7Gw5v+7RfMZG8OUsVZCFJwqRZrIXIU0TgqteGkzOGa3oifoSC3wbYcJUxh7lVwZqrwXMbTYjkUCU+dsnN483XBGW+2FomEjZSiyQbPLJ30ELFng1FJavJOZf7OBN9tqdOAIjX7no7CdQa3LRZOCJU1hp6JMQisELg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b3OT9DNn; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id C176BC4AF0B;
Fri, 6 Jun 2025 15:53:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749225204;
bh=ZffmP67iCxIRYWii/TFpM7JL7F9vyh8RFszEdPO/+Hs=;
h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
b=b3OT9DNnXO5osD4dJlnoyI4sFZc6IAYmkIkPppRJN9y4+1OfB57nSX9FRApm7m62l
PbAZJP4LoUmrIOQPtLxXgcm89KiaOLxuOqQx2qH/BP2wIolqCh9qWnT9spfg7D8BWj
8/OxwCNljX3iAThB5iKR7pLM1YDA3aDcb9AHCl8Xqm/j6HTqzI09w+QEidilv7ewYN
ai1pEREFmx5Q5EVXTMrdKaO66lSRdW2+ZAVZ8FA/x4h44RPsPM4LsKsxB7+Pljq8K4
Xltt9jkNa42MAVJPxnHiwtSeXjR/ldwbgUW3H/H7LkLq4QLXWYdFavAwj9nRQudZke
7PHl6AzrFgmTw==
Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-606440d92eeso1047646eaf.2;
Fri, 06 Jun 2025 08:53:24 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCU5sQH6skdmi5lE3tcQQLeM8iPtyf4sL27aEtharf0YYB6pZnn5YtBhB67EyYCxD8KjqRGDa8r3BQ==@vger.kernel.org, AJvYcCXt8miAJVs+yD/MTPfaU43cEyZCs9EU2Qq918Hw7YYIsfsIcIQTX8sxyRrI7OEpZOih2IP0yh3MYiL64M9J5afVcS1c@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YypGi6HCtq2edY9wQB8YnTus/BZ5v8UxmniluQuyLG3sFyrlrVm
0Uuqy+f6i4umn0RcnYf+TwO6hMXetGSQnyzVECYzhw4nMqW9uxIf96ICGQXbMwZOZnRUiCh1Tb/
ekxvaC/cXKHl+5bEuo+NPCecsDaKTA3A=
X-Google-Smtp-Source: AGHT+IHBSME4mlhGbIZWonHHrlJr7EgE5rjgS6F7nUJqSApeJe5WcvW3GCMdvtQHJSXOLL/eLJNs6DSTGvoI7zCAw8Y=
X-Received: by 2002:a05:6820:1898:b0:60b:c6c6:f69e with SMTP id
006d021491bc7-60f3cf1d259mr2209450eaf.6.1749225204064; Fri, 06 Jun 2025
08:53:24 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250605162106.1a459dad@xxxxxxxxxxxxxxxxxx>
In-Reply-To: <20250605162106.1a459dad@xxxxxxxxxxxxxxxxxx>
From: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 17:53:12 +0200
X-Gmail-Original-Message-ID: <CAJZ5v0hd_vCvmX9+__0M=aB437P-dxhYYEFnF2EaMe=XLTQiUw@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFsDgwpPXDpz0mMHZAFjnJVZ7FG-ShjXzJgXHh-KI0TNkQ3yTdfKt6UL3sI
Message-ID: <CAJZ5v0hd_vCvmX9+__0M=aB437P-dxhYYEFnF2EaMe=XLTQiUw@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] tracing: PM: Remove unused clock events
To: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>,
Linux Trace Kernel <linux-trace-kernel@xxxxxxxxxxxxxxx>, linux-pm@xxxxxxxxxxxxxxx,
Masami Hiramatsu <mhiramat@xxxxxxxxxx>, Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>,
Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>,
Kajetan Puchalski <kajetan.puchalski@xxxxxxx>,
"Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, Jun 5, 2025 at 10:19=E2=80=AFPM Steven Rostedt <rostedt@xxxxxxxxxxx=
> wrote:
>
> From: Steven Rostedt <rostedt@xxxxxxxxxxx>
>
> The events clock_enable, clock_disable, and clock_set_rate were added bac=
k
> in 2010. In 2011 they were used by the arm architecture but removed in
> 2013. These events add around 7K of memory which was wasted for the last =
12
> years.
>
> Remove them.
>
> Link: https://lore.kernel.org/all/20250529130138.544ffec4@gandalf.local.h=
ome/
>
> Fixes: 74704ac6ea402 ("tracing, perf: Add more power related events")
> Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>

Acked-by: Rafael J. Wysocki <rafael@xxxxxxxxxx>

> ---
> include/trace/events/power.h | 47 ------------------------------------
> 1 file changed, 47 deletions(-)
>
> diff --git a/include/trace/events/power.h b/include/trace/events/power.h
> index 9253e83b9bb4..6c631eec23e3 100644
> --- a/include/trace/events/power.h
> +++ b/include/trace/events/power.h
> @@ -337,53 +337,6 @@ DEFINE_EVENT(wakeup_source, wakeup_source_deactivate=
,
> TP_ARGS(name, state)
> );
>
> -/*
> - * The clock events are used for clock enable/disable and for
> - * clock rate change
> - */
> -DECLARE_EVENT_CLASS(clock,
> -
> - TP_PROTO(const char *name, unsigned int state, unsigned int cpu_i=
d),
> -
> - TP_ARGS(name, state, cpu_id),
> -
> - TP_STRUCT__entry(
> - __string( name, name )
> - __field( u64, state )
> - __field( u64, cpu_id )
> - ),
> -
> - TP_fast_assign(
> - __assign_str(name);
> - __entry->state =3D state;
> - __entry->cpu_id =3D cpu_id;
> - ),
> -
> - TP_printk("%s state=3D%lu cpu_id=3D%lu", __get_str(name),
> - (unsigned long)__entry->state, (unsigned long)__entry->cp=
u_id)
> -);
> -
> -DEFINE_EVENT(clock, clock_enable,
> -
> - TP_PROTO(const char *name, unsigned int state, unsigned int cpu_i=
d),
> -
> - TP_ARGS(name, state, cpu_id)
> -);
> -
> -DEFINE_EVENT(clock, clock_disable,
> -
> - TP_PROTO(const char *name, unsigned int state, unsigned int cpu_i=
d),
> -
> - TP_ARGS(name, state, cpu_id)
> -);
> -
> -DEFINE_EVENT(clock, clock_set_rate,
> -
> - TP_PROTO(const char *name, unsigned int state, unsigned int cpu_i=
d),
> -
> - TP_ARGS(name, state, cpu_id)
> -);
> -
> /*
> * The power domain events are used for power domains transitions
> */
> --
> 2.47.2
>
>


Return-Path: <linux-kernel+bounces-675988-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E284841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:55:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9A5AF3B2054
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:53:21 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0042319D071;
Fri, 6 Jun 2025 15:53:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lTo/71Ty"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 405FF2A8D0;
Fri, 6 Jun 2025 15:53:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225213; cv=none; b=r9syyv3LI5NnDIV2EF/MdqsJWUB3zzcv8qEpGthW9kjD+YVCS10y2ayuOf8y3F8C2biYkjx1Q1yB7FYquNwICQIYg+pLSTY6nHQWR+8dDS9d+KLcNXT+D08xlJzUD9W1ooyCpsZLkewwGpfwC6C30sBfUzzDROOjJg2DFGvbGa8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225213; c=relaxed/simple;
bh=u7+1jKk4U/xWJB4Zo5+Sz+607XUjRbfyHpGhkVYPutc=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=o7No4IbKll43ZrKY7KXOl4wVxGEABpa7ZOfniq0o++b35MNKbTKXFXVlewlV0LOj4eXLjrF8lcjzKuOpqJ50sXB9cb9ywo1tV92HvRCK53IpcUchgHoa9ELxVd/aRJjMXg4B6QcIub4H+5+iKP8SVESN52b+0yew9SxfTSPHmdc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lTo/71Ty; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9436C4AF09;
Fri, 6 Jun 2025 15:53:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749225212;
bh=u7+1jKk4U/xWJB4Zo5+Sz+607XUjRbfyHpGhkVYPutc=;
h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
b=lTo/71Ty+kIgPWVH5Ky6R0qfVki+z+evRjbbeZyQTBOmilmbtjsR6MT0YktZZSSpx
6z2Ol/jnRNaNDKZm/4SdhjQNJY601IFbzbteSa3/1WCcDOa/qIyKUemNgQrPOKnpG6
oOCCTpSWuvLcAO5+EyL1EGlXHEfaisWBbJi/NN1kHuwUClE4WXtlwPDcyt1CviXoIv
+IxsM343ms5ROGIlD51/Rb9nWMg0VzFT3clVjwyHGnadgxPxI0/mmCBl9lktfXp0Hy
WyLkmONaRd9UTk+9aD1wqvT7bWsoNWt7b4OeDDL51bLxF1c3dUrbIf10hpMU8tcziu
7ms+FxylfQ3Pw==
Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-32a7256ba04so11786551fa.1;
Fri, 06 Jun 2025 08:53:32 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCWw4K3Ooti4pc5JH80b64AiqgTFBSMyQ04frO/FVIXhU7RY2jcBXfXXraf7olzRqvcIu+vuZaEjXfHa9aWO@xxxxxxxxxxxxxxx, AJvYcCXu/5WL7XSqv03zCfEYVms7Mo8JNLkGuFzWkMaEytaB1bY6to2gxqQQvPBP4H/NAU0dhi1P61k2bPM=@vger.kernel.org
X-Gm-Message-State: AOJu0YweGksVQb2JC2uSrX7dBPlSU7NTPXzoJbhvZY0MuN1cCtxJ+hMj
CFK5osW0EsqtdZDQw93Qdt0Ewq7a/WruFwYQIFCuODm38WJ0Pi+bI7LGO6xz7k5KG0N37RtwqW2
+lexmBeAt6Z23xZvlDBNBNPROTfAbWDM=
X-Google-Smtp-Source: AGHT+IGjf30pjqgeFcxZcc9nje3zz3QRM+dSgZnGbpycrmsPTO+F/5DIfFuml+ST3gPpgrAY+WLHfJipmFbHLyFlz1o=
X-Received: by 2002:a2e:be8d:0:b0:32a:7666:80e0 with SMTP id
38308e7fff4ca-32adfc0d983mr11518971fa.10.1749225211108; Fri, 06 Jun 2025
08:53:31 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250606154112.311565-1-vkuznets@xxxxxxxxxx>
In-Reply-To: <20250606154112.311565-1-vkuznets@xxxxxxxxxx>
From: Ard Biesheuvel <ardb@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 17:53:19 +0200
X-Gmail-Original-Message-ID: <CAMj1kXGQP5w+st3ijsmPABih+ukA4p3KEwb-tMdMfY9-PuVgtQ@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFsJfeXsrOvTxgMTy_bG62Q9j2hbWCjL8sp7IyzG0hpadb0axosWdl0M_9E
Message-ID: <CAMj1kXGQP5w+st3ijsmPABih+ukA4p3KEwb-tMdMfY9-PuVgtQ@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] efi: Drop preprocessor directives from zboot.lds
To: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
Cc: Luiz Capitulino <luizcap@xxxxxxxxxx>, linux-efi@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, 6 Jun 2025 at 17:41, Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> wrote:
>
> Older versions of `ld` don't seem to support preprocessor directives in
> linker scripts, e.g. on RHEL9's ld-2.35.2-63.el9 the build fails with:
>
> ld:./drivers/firmware/efi/libstub/zboot.lds:32: ignoring invalid character `#' in expression
> ld:./drivers/firmware/efi/libstub/zboot.lds:33: syntax error
>
> We don't seem to need these '#ifdef', no empty .sbat section is created
> when CONFIG_EFI_SBAT_FILE="":
>
> # objdump -h arch/arm64/boot/vmlinuz.efi
>
> arch/arm64/boot/vmlinuz.efi: file format pei-aarch64-little
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00b94000 0000000000001000 0000000000001000 00001000 2**2
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 .data 00000200 0000000000b95000 0000000000b95000 00b95000 2**2
> CONTENTS, ALLOC, LOAD, DATA
>
> Fixes: 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>

Ah yes, I failed to realize that zboot.lds is never preprocessed - I
did notice that the #ifdef is unnecessary here as LD ignores empty
sections.

So the fix is

Reviewed-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

I'll queue this as a fix.

> ---
> Note: not-yet-merged x86 version of 0f9a1739dd0e does not seem to be affected
> as vmlinux.lds script is a pre-processed version of vmlinux.lds.S.
> ---
> drivers/firmware/efi/libstub/zboot.lds | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/zboot.lds b/drivers/firmware/efi/libstub/zboot.lds
> index c3a166675450..4b8d5cd3dfa2 100644
> --- a/drivers/firmware/efi/libstub/zboot.lds
> +++ b/drivers/firmware/efi/libstub/zboot.lds
> @@ -29,14 +29,12 @@ SECTIONS
> . = _etext;
> }
>
> -#ifdef CONFIG_EFI_SBAT
> .sbat : ALIGN(4096) {
> _sbat = .;
> *(.sbat)
> _esbat = ALIGN(4096);
> . = _esbat;
> }
> -#endif
>
> .data : ALIGN(4096) {
> _data = .;
> --
> 2.49.0
>
>


Return-Path: <linux-kernel+bounces-675990-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1E0C841E003FB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:56:08 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 434781748F3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:56:09 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B86B0289819;
Fri, 6 Jun 2025 15:55:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="X57Dy0Ic"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
(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 49FFB28937A
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:55:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225358; cv=none; b=Gq/2qkaWA3YTTtbzDP7WeAztzdO43bMbmKAQKP2fYqLQeg/GA5hlLqvG/bSvfof/u9kCRTkqc8gEzvQ639WChcAeuwI4xEax7hQYRrNq7o960qRQ+RcEAbI/FaySmS7Bf7G2KWJXKRCdMhcf3wIoqT4MPTIKNKdpgzSA1SkDAR0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225358; c=relaxed/simple;
bh=jc0tWlW3poGCs9I7QlcyCKaGlhaRWGW9bX1l7hil6K4=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=bP09LH3Or2D6Bd0f8kCJV7Eith7Dpu3vSzFMexIQKtCC2vS4N4DsrF1D58N+toI0YBta9gF36zH0JxAThyq5NKxPy380LGnuy3TkYChn/+6M6thOXZtT4k63YbyJa6jJmOPS+p1pRWewMnd+gcssMA4uVw4dmGaZ/Z2Vse2ykX8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=X57Dy0Ic; arc=none smtp.client-ip=170.10.133.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749225354;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=hfQokHHUXGOQjxz/5AuJ61NClHmro/6qokU3ot4Jqhk=;
b=X57Dy0IcP71sVZYxBO5S/2gjWt/V3z2GXSTAy1geUkIrc7lxtZHo7EGtfvNFsCN3CF9iRb
BI3T0wiZVYBGXmJWD3XyvnEnXhn5PzWJ/7Jt93nG92LhQscUfwrP28if6/249lNBKi0Y1i
ztEVA2i4NLkPDMy7KEoDw+q9y33VshI=
Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com
[209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-480-ju-tH5rjP0-1d_OhrL87oQ-1; Fri, 06 Jun 2025 11:55:53 -0400
X-MC-Unique: ju-tH5rjP0-1d_OhrL87oQ-1
X-Mimecast-MFC-AGG-ID: ju-tH5rjP0-1d_OhrL87oQ_1749225352
Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7c9305d29abso360929585a.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:55:53 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749225352; x=1749830152;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=hfQokHHUXGOQjxz/5AuJ61NClHmro/6qokU3ot4Jqhk=;
b=fkYhF8ilGDFymGf8pYYKBzlAbWk2yZCtfWYy+avA+gUag06XhWNMhZciM/Ya9TMbU9
DW6IhtRKj7+Ct5eK5suoVPoxH/MaMOhNuVOphxPJ0/Bwt+NjgE0s465aEMD0lI/BFhZA
usGPM6L4MS2AG4BpAawKcrwvalM8NN3qm96birR1qs99aFf5BOTPJiVhXcFvZa+dDkFL
Kt4lgAzyilM4qRPvhS7IiDWHa2Y9Dq1f5Hz0iQrEmENPiHz1F8jCXzI8TU7tyVpIJyUT
Qup/8ZSJcA5/Wj+1r9zjF69FHDwrWdQei+BMO71M8yCc2ebc3OHbTAlWBBogC67x0+js
4hEw==
X-Forwarded-Encrypted: i=1; AJvYcCX1ygwdWgBa342iZVtOQDVZLJq9zywlKI3x8BEL1ugC3BeCMSSwcFd8v11GXVtzB/Z56KVmRGiWz0dIMJY=@vger.kernel.org
X-Gm-Message-State: AOJu0YzTPTV0KQXEpD/cL4Nw5In3r19lM+cnIeLyBPAcNTARla/0cWRe
KTKIBnpz1mKaeMv0e5v/WNWmuGKV5kTGJ/M/gEEwDkpvktWBkR/7Jq9ApEUpprOHuvlxHoZmD0f
ijSHYvz636LdJvbrF22Ab8oWcWhQUHpNsTfDsT0AMzuVYcLaoXRV09lq6lQQzoQGb5g==
X-Gm-Gg: ASbGncuEfHYPESAxyXd+dU27yMprHrfslMBvy+EGJdnV0/wl3u3WJZoImWvT5/+hpt3
LzsnwOkyr64ZbosjOda05zqSdUaUkw7a4/2vG+600sD8YG9nMvrVwr2FcV1LyIEdTLOgmwAcKut
8TXf4zrpveAMxwmXy3qfvbDRPqriKf7euU2P7pe2vN4zoS9mNDIU0IoRreLA1lqRzGEMqx4s+R2
tBgEe2TbSt37BZhTjwEeGiXpbtKdymjneBIaYm26w6xW2rrHDlal659tkXAXH8/XYEL5eVUPxqy
/If1ma+S4QUvRAY=
X-Received: by 2002:a05:622a:90e:b0:494:b251:d216 with SMTP id d75a77b69052e-4a5b9a29356mr73621491cf.18.1749225352614;
Fri, 06 Jun 2025 08:55:52 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IEuOyO5kabPQZM7spveJfj/HNOoyNh+ZrupHbDyKgLpVySZrx0OECv0h4zkDFJ84/rW+XA9DQ==
X-Received: by 2002:a05:622a:90e:b0:494:b251:d216 with SMTP id d75a77b69052e-4a5b9a29356mr73621001cf.18.1749225352261;
Fri, 06 Jun 2025 08:55:52 -0700 (PDT)
Received: from [192.168.2.110] ([69.159.169.234])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fb09ab948dsm12887176d6.11.2025.06.06.08.55.51
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 08:55:52 -0700 (PDT)
Message-ID: <256ad7fc-c6d4-470d-a434-7b5556c3b8f6@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 11:55:41 -0400
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] efi: Drop preprocessor directives from zboot.lds
To: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>, Ard Biesheuvel <ardb@xxxxxxxxxx>
Cc: linux-efi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
References: <20250606154112.311565-1-vkuznets@xxxxxxxxxx>
Content-Language: en-US, en-CA
From: Luiz Capitulino <luizcap@xxxxxxxxxx>
In-Reply-To: <20250606154112.311565-1-vkuznets@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 2025-06-06 11:41, Vitaly Kuznetsov wrote:
> Older versions of `ld` don't seem to support preprocessor directives in
> linker scripts, e.g. on RHEL9's ld-2.35.2-63.el9 the build fails with:
>
> ld:./drivers/firmware/efi/libstub/zboot.lds:32: ignoring invalid character `#' in expression
> ld:./drivers/firmware/efi/libstub/zboot.lds:33: syntax error
>
> We don't seem to need these '#ifdef', no empty .sbat section is created
> when CONFIG_EFI_SBAT_FILE="":
>
> # objdump -h arch/arm64/boot/vmlinuz.efi
>
> arch/arm64/boot/vmlinuz.efi: file format pei-aarch64-little
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00b94000 0000000000001000 0000000000001000 00001000 2**2
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 .data 00000200 0000000000b95000 0000000000b95000 00b95000 2**2
> CONTENTS, ALLOC, LOAD, DATA
>
> Fixes: 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>

Thanks for fixing Vitaly:

Tested-by: Luiz Capitulino <luizcap@xxxxxxxxxx>

(this is for the build test, not SBAT testing).

> ---
> Note: not-yet-merged x86 version of 0f9a1739dd0e does not seem to be affected
> as vmlinux.lds script is a pre-processed version of vmlinux.lds.S.
> ---
> drivers/firmware/efi/libstub/zboot.lds | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/zboot.lds b/drivers/firmware/efi/libstub/zboot.lds
> index c3a166675450..4b8d5cd3dfa2 100644
> --- a/drivers/firmware/efi/libstub/zboot.lds
> +++ b/drivers/firmware/efi/libstub/zboot.lds
> @@ -29,14 +29,12 @@ SECTIONS
> . = _etext;
> }
>
> -#ifdef CONFIG_EFI_SBAT
> .sbat : ALIGN(4096) {
> _sbat = .;
> *(.sbat)
> _esbat = ALIGN(4096);
> . = _esbat;
> }
> -#endif
>
> .data : ALIGN(4096) {
> _data = .;



Return-Path: <linux-kernel+bounces-675989-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 078D941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:56:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 144AA3B2E0A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:53:53 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D2C5919E96D;
Fri, 6 Jun 2025 15:54:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="AYUQyrpJ"
Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5ECF188734
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:54:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225246; cv=none; b=Aoq57oxbYbZvfKeAL6HTZZncO1xx1G+lakuzMAag3k4yN4Y/uo3DBKgcuE2ablCYZ/Vro2fC5vR9BpOsZ13T8KjIlmsK2fprGL5vR0w8UIKEBY8kqNAMZNRF0g8BhDZG9V4Pi3jqrpSpiXYkC159tAkO5uLe2y7EMZXevWZTXjs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225246; c=relaxed/simple;
bh=O2w1aGCd7C7nRuZWq3b6fRfyCi62Sqnl7KSt5CA2X8w=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=RlfFRm7XIKVZYImgx7u3WgUEQOXNbbZB74RWusbjgOnuwzjOghGhsxn/07NEajDBWRWU9uoIQpSB00KQWRwuVcT4y7NwFarGX+VzVTu5oeAMTmLZGNnE53Xo8i8l3DFF1sgWzIn3D3+Iqd7Y+fhSLgawJ0W4a5C7SvOh95bQhUs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=AYUQyrpJ; arc=none smtp.client-ip=209.85.161.52
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com
Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-605f7d3215cso1057075eaf.0
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 08:54:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749225242; x=1749830042; darn=vger.kernel.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=A6luCcbvYtAg5246XTNS1y7oe/JVdrZSN0lM+hMsBHc=;
b=AYUQyrpJ6qulxlVQnD1JLnpGuwnIh/7UsTChtQcV/q9NeDQt0x9A7BFwiSjBetb9Ov
ygGOGuhOEWgfMBbYFX7VVU63A8TdFEH1TKWhymZqpP9O4gShv22PVE+AfBS3oPoDmjzx
DPHWKcZoXw/iPnusIw6ZpQq8+ui/ya6K6r5NFOHC9hW+Qs4rTSsK1UqCwrSgeCH9If9m
UeZNfNAO/ziM9lj+uG25UAnk5g3g+IZxWeElWyBLoqTU5VeZdRRAYfJgIVZ8oKpuaeHm
WzxTzYUFmHkV3N6c8pyNVOidms9/+vZFZX8iBYvF4jZ8dAIo6cL8yupYqozEd3P3xNL+
b+5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749225242; x=1749830042;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=A6luCcbvYtAg5246XTNS1y7oe/JVdrZSN0lM+hMsBHc=;
b=Va42c+TdrbEtVAgZu/m4e7WtYiaNo9hAh5YLCmRKUUhMAl2sC4Kebk8qvP6HDMx8XE
K0UpY37CqR4vn5KOHH0vmgK0aMk0AYrQ4Ll9DVlyHRVOJPJ7ZM1iO0Ji9HCUm6OLgS87
OqshqAFC9TIVOZe2kTJr8uaW2pxTkUH2zsRv5TchjsM5vfUiNLFZzfJyWPYzFytxrnXp
4/lg8znVD35Q5dZ3Fa/jabX+qAKLN/xQt0/65TAxpb5+VH7WWmiESVdWfpDhcUZ6XhN4
IzFB/9tBDuPhgCXBn3gIlsRkjqNwSV84qAG11r4dvQFO/40cmu4CusIbWXZs8WLw/eU2
eBFQ==
X-Forwarded-Encrypted: i=1; AJvYcCXr98Lum9CIr4Fe8hnS8VHOuvO81W8DVc1fZlDQ4L1+6N9Hmg8CmpNcjGp5KoHTvegFcpS8X0BtDXiEZ4E=@vger.kernel.org
X-Gm-Message-State: AOJu0Yy48pLTtNL8I6I9EmvYustW7XqUomipi5TRhxmD9XnQlJ0yfTLv
DBMwgDifHTCpu507tiOBVPEwamusGYNaNnvnYeyWFwxLZVowiTAEH2GfUtB5Mca6jdM=
X-Gm-Gg: ASbGnctlQs4sibgTsE2J2g+BaDxNnERtE6Xa5t0h1G3YPXky+W6Ehk3U001dMjmL6rN
oHuV0nN9hyUQGhpGYKrcEFU0zVQRtn6nMfIFwPUzF0SHk3c2NB0QZA9YCkxEjE+SeYwJ9oEId9S
Ny2jIx7y3BnzoK1+Z7wLTU58wZGkx2qLJ2Yebi3c8yzLKQH3JxbWHyaF8x61wYN/Q+BwC60z575
GKHYi8ZdgA5Lg1sPWu835EUKbvAHA+3mlrZUS9G8rqdsTuiB6eOu6XYYlKRcINYdGMp1PnJkP6u
TiuPBteuyliGiAkCFGGxeCoUTuZi1F4ZJ0GrRh2QzTfMht1cxr19xlUIJJS6qiX4E7tc2byPaZz
djuNSCxMbKyvx6z91pH7ALt0KPkom
X-Google-Smtp-Source: AGHT+IGRDl1iuFLSRQRDz5i+NYDOwmM7to35b2jr13pv5tXn4xtKTNZw7AvPXElLkQBKingqq9hJnQ==
X-Received: by 2002:a05:6820:1992:b0:603:f981:5fe4 with SMTP id 006d021491bc7-60f3ce462d5mr2533571eaf.1.1749225241844;
Fri, 06 Jun 2025 08:54:01 -0700 (PDT)
Received: from ?IPV6:2600:8803:e7e4:1d00:6192:9921:d60e:1609? ([2600:8803:e7e4:1d00:6192:9921:d60e:1609])
by smtp.gmail.com with ESMTPSA id 006d021491bc7-60f3e8274c8sm251935eaf.30.2025.06.06.08.53.59
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Jun 2025 08:54:00 -0700 (PDT)
Message-ID: <92c36ad9-5f8e-4ba7-9af4-9cb640f0aa5c@xxxxxxxxxxxx>
Date: Fri, 6 Jun 2025 10:53:59 -0500
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: adding support for PAC194X
To: marius.cristea@xxxxxxxxxxxxx, jic23@xxxxxxxxxx, nuno.sa@xxxxxxxxxx,
andy@xxxxxxxxxx
Cc: robh@xxxxxxxxxx, krzk+dt@xxxxxxxxxx, conor+dt@xxxxxxxxxx,
broonie@xxxxxxxxxx, linux-iio@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250606093929.100118-1-marius.cristea@xxxxxxxxxxxxx>
<20250606093929.100118-2-marius.cristea@xxxxxxxxxxxxx>
Content-Language: en-US
From: David Lechner <dlechner@xxxxxxxxxxxx>
In-Reply-To: <20250606093929.100118-2-marius.cristea@xxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 4:39 AM, marius.cristea@xxxxxxxxxxxxx wrote:
> From: Marius Cristea <marius.cristea@xxxxxxxxxxxxx>
>
> This is the device tree schema for iio driver for Microchip PAC194X
> and PAC195X series of Power Monitors with Accumulator. The PAC194X
> family supports 9V Full-Scale Range and the PAC195X supports 32V
> Full-Scale Range.
>
> There are two versions of the PAC194X/5X: the PAC194X/5X-1 devices
> are for high-side current sensing and the PAC194X/5X-2 devices are
> for low-side current sensing or floating VBUS applications.
>
> The PAC194X/5X-1 is named shortly PAC194X/5X.
>
> Signed-off-by: Marius Cristea <marius.cristea@xxxxxxxxxxxxx>
> ---
> .../bindings/iio/adc/microchip,pac1944.yaml | 204 ++++++++++++++++++
> 1 file changed, 204 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml
> new file mode 100644
> index 000000000000..4a2cf6b64055
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/microchip,pac1944.yaml
> @@ -0,0 +1,204 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/adc/microchip,pac1944.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Microchip PAC1944 and PAC1954 Power Monitors with Accumulator
> +
> +maintainers:
> + - Marius Cristea <marius.cristea@xxxxxxxxxxxxx>
> +
> +description: |
> + This device is part of the Microchip family of Power Monitors with
> + Accumulator. The datasheet for PAC1941-1, PAC1941-1, PAC1942-1, PAC1942-2,
> + PAC1943-1 and PAC1944-1 can be found here:
> + https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/PAC194X-Family-Data-Sheet-DS20006543.pdf
> + The datasheet for PAC1951-1, PAC1951-1, PAC1952-1, PAC1952-2, PAC1953-1 and
> + PAC1954-1 can be found here:
> + https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/PAC195X-Family-Data-Sheet-DS20006539.pdf
> +
> +properties:
> + compatible:
> + enum:
> + - microchip,pac1941
> + - microchip,pac19412
> + - microchip,pac1942
> + - microchip,pac19422
> + - microchip,pac1943
> + - microchip,pac1944
> + - microchip,pac1951
> + - microchip,pac19512
> + - microchip,pac1952
> + - microchip,pac19522
> + - microchip,pac1953
> + - microchip,pac1954
> +
> + reg:
> + maxItems: 1
> +
> + vdd-supply: true
> +
> + "#address-cells":
> + const: 1
> +
> + "#size-cells":
> + const: 0
> +
> + interrupts:
> + maxItems: 2
> +
> + interrupt-names:

Needs minItems: 1 if we want to allow a single named interrupt.

> + description:
> + alert1 indicates a HIGH or LOW limit was exceeded.
> + alert2 indicates a THERM limit was exceeded.
> + items:
> + - const: alert1
> + - const: alert2
> +

I am having deja vu. I just commented on an identical interrupts binding
in a different series [1]. In this case though, alert1 and alert2 are
the actual pin names, so that is fine. But each pin can be programmed
to indicate lots of different things, so drop descriptions or change
them to describe the pin, not an arbitrary function. I don't even
see THERM in the datasheet, so I'm guessing that was just a copy/
paste from something else anyway.

[1]: https://lore.kernel.org/linux-iio/0f68e3f9-cba5-4df3-8e56-2cccbccf35ce@xxxxxxxxxxxx/


---

Even if the driver doesn't use them (yet), we could consider adding
gpio-controller and #gpio-cells properties since these chips have pins
that can operate as GPIOs.

And we could add a powerdown-gpios property for the /PWRDN pin.

We want to try to make the bindings as complete as possible, if we can [2].

[2]: https://docs.kernel.org/devicetree/bindings/writing-bindings.html

> +patternProperties:
> + "^channel@[1-4]+$":

Drop the +. Only 1 to 4 are allowed, not 11, 111, etc.

Also, we could further restrict things based on the actual number of
channels on a chip like this:

allOf:
- if:
properties:
compatible:
pattern: "^pac19[45]1"
then:
properties:
channel@1:
reg:
items:
maximum: 1
patternProperties:
^channel@[2-4]$": false
- if:
properties:
compatible:
pattern: "^pac19[45]2"
then:
patternProperties:
^channel@[1-2]$":
reg:
items:
maximum: 2
patternProperties:
^channel@[3-4]$": false
- if:
properties:
compatible:
pattern: "^pac19[45]3"
then:
patternProperties:
^channel@[1-3]$":
reg:
items:
maximum: 3
properties:
channel@4: false



> + type: object
> + $ref: adc.yaml
> + description:
> + Represents the external channels which are connected to the ADC.
> +
> + properties:
> + reg:
> + items:
> + minimum: 1
> + maximum: 4
> +
> + shunt-resistor-micro-ohms:
> + description:
> + Value in micro Ohms of the shunt resistor connected between
> + the SENSE+ and SENSE- inputs, across which the current is measured.
> + Value is needed to compute the scaling of the measured current.
> +
> + microchip,vbus-half-range:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description: |
> + In order to increase measurement resolution and keeping the same
> + number the of bits the device has a configurable VBUS full range scale
> + (FSR). The range should be set by hardware design and it should not be
> + changed during runtime. The bipolar capability for VBUS enables
> + accurate offset measurement and correction.
> + The VBUS could be configured into the following full scale range:
> + - VBUS has unipolar 0V to 32V FSR (default) for PAC195X or 0V to 9V
> + (default) for PAC194X.
> + - VBUS has bipolar -32V to 32V FSR for PAC195X or -9V to 9V for
> + PAC194X. The actual range is limited to about -200 mV due to the
> + impact of the ESD structures.
> + - VBUS has bipolar -16V to 16V FSR for PAC195X or -4.5V to 4.5V for
> + PAC194X. The actual range is limited to about -200 mV due to the
> + impact of the ESD structures.
> +
> + microchip,vbus-bipolar:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description:
> + If provided, the channel is to be used in bipolar mode. The
> + actual range is limited to about -200 mV due to the impact of the ESD
> + structures.
> +

Using Jonathan's suggestion from v2 to just have a single property with 3 different
ranges to chose from seems simpler that this. It would only require one property
and would be self-documenting. The description could be shortened to just a couple
of lines.

Otherwise, we also need to add:

- if:
required:
microchip,vbus-half-range
then:
required:
microchip,vbus-bipolar

to validate that that there are only 3 possibilities.

Also, swapping the word order to range-half would be more consistent with
the existing adi,range-double property that serves a similar purpose.

Same applies to vsense.

> + microchip,vsense-half-range:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description: |
> + In order to decrease the power dissipation on the shunt resistor and
> + in the same time to increase measurement resolution by keeping the
> + same number the of bits the device has a configurable VSENSE full
> + range scale (FSR). The range should be set by hardware design and it
> + should not be changed during runtime.
> + The VSENSE could be configured into the following full scale range:
> + - VSENSE has unipolar 0V to 100 mV FSR (default)
> + - VSENSE has bipolar -100 mV to 100 mV FSR
> + - VSENSE has bipolar -50 mV to 50 mV FSR
> +
> + microchip,vsense-bipolar:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description:
> + If provided, the channel is to be used in bipolar mode.
> +
> + microchip,accumulation-mode:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + The Hardware Accumulator may be used to accumulate VPOWER, VSENSE or
> + VBUS values for any channel. By setting the accumulator for a channel
> + to accumulate the VPOWER values gives a measure of accumulated power
> + into a time period, which is equivalent to energy. Setting the
> + accumulator for a channel to accumulate VSENSE values gives a measure
> + of accumulated current, which is equivalent to charge. This allows the
> + accumulator to be used as a coulomb counter. For either VSENSE or
> + VBUS, many samples may be accumulated on chip and the result collected
> + by the host and divided by the accumulator counter count value to
> + yield an average value with a very long integration time to reduce
> + noise. This feature is also very useful for system calibration,
> + allowing many averages to be accumulated for fast averaging/noise
> + reduction.
> + This functionality needs to be setup once and must not be changed
> + during the runtime,

Why not? The datasheet says there is a REFRESH command to allow changing it
at runtime.

> just in case the user wants to measure the charge
> + or the energy consumed from board power up till the user has control
> + or during a reboot of the system.
> + The Hardware Accumulator could be configured to accumulate
> + VPOWER, VSENSE or VBUS
> + <0> - Accumulator accumulates VPOWER (default)
> + <1> - Accumulator accumulates VSENSE
> + <2> - Accumulator accumulates VBUS
> + maximum: 2
> + default: 0
> +
> + required:
> + - reg
> + - shunt-resistor-micro-ohms
> +
> + unevaluatedProperties: false
> +
> +required:
> + - compatible
> + - reg
> + - vdd-supply
> + - "#address-cells"
> + - "#size-cells"
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + power-monitor@10 {
> + compatible = "microchip,pac1954";
> + reg = <0x10>;
> + vdd-supply = <&vdd>;
> +
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + channel@1 {
> + reg = <0x1>;
> + shunt-resistor-micro-ohms = <24900>;
> + label = "CPU";
> + microchip,vsense-half-range;
> + microchip,vsense-bipolar;
> + };

Seems odd to leave a channel unconfigured since the shunt resistor
value is required and there is a 3 channel version of the chip that
could be used if only 3 channels were wired up.

> +
> + channel@3 {
> + reg = <0x3>;
> + shunt-resistor-micro-ohms = <75000>;
> + label = "MEM";
> + microchip,vbus-half-range;
> + microchip,vbus-bipolar;
> + microchip,vsense-half-range;
> + };
> +
> + channel@4 {
> + reg = <0x4>;
> + shunt-resistor-micro-ohms = <100000>;
> + label = "NET";
> + microchip,vbus-bipolar;
> + };
> + };
> + };
> +
> +...



Return-Path: <linux-kernel+bounces-675991-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 829DF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:57:28 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 603113A9E06
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:56:47 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B6CB289801;
Fri, 6 Jun 2025 15:56:59 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jJdQIME9"
Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazon11013056.outbound.protection.outlook.com [40.107.159.56])
(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 51A201B040D;
Fri, 6 Jun 2025 15:56:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.159.56
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225418; cv=fail; b=HXaCO1NnG0hkahCRf9xgpNDInKnmSvKezhTx0AcxRSVmCYBAPY2jKyKn/39V/WDi6S2d9BcUW6vOzfqyP5lckIymYyfQWPiI1E4V0sHbLowms6cjU+bWfPAtKT62BG9pWm/PeHgEkefaY7r8agmGGDvn9PfKI1SFQo9loVTNwiY=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225418; c=relaxed/simple;
bh=DjWqW1kdl7gJc5laNidO5V0DJUqKyAu+sQ+WhKYK3Dw=;
h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=L1b2hZwIPtsMwIFaErUBJzl9o65fxguxXP0RuLrpYLNMY5fjTnxF5NgT8lVKftOuOxHZko++fAWSsh7PAXSXVYG5RIKlbv5NFBsBfSxs0ngjka5pmxYV2SiST6GpbN2HIg830dSBn7aBAsnzPBivzfBqPtlucfyqDWpAWQXwWtk=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=jJdQIME9; arc=fail smtp.client-ip=40.107.159.56
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=JAgqgOhHaCswN4uSRfzjqb5Q53t0n7JvAqmazHb2/Qn9Q5sva15pJvAXzNwbEhfzjZtzXGj7cy7IJnmCZyi/EIIt6Q9zaOwcOo4NzxcA8PEzHnFCiPwc+LSyk6IEzX1T13JOLYfrwgOlRGQTjlfdLJZkaWl7uus/eBEiho/b4K9PNQyxj3kCPKc1AWCg89+PQ/vPRGr/UwnaYU8D1/uZAA87VxQz72u3giRAfrT/T1AXAiuoktmJLZesUW/nfA9SY5gwGUK5q4ph6deva+8dvDM0WimhSMb6dDMCyUpsJ1JcdZAT0IZw4EckAXcWUkPhHstXpTT2N0gaz6iPOYff9w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=fKKpqt7bYD8BpfCD9Jy07xmrYOoRXiaa/RTP9F++AfA=;
b=w0kv1SeXQWUlHXgVel1egmW6NUYTEk2/A0YGLxLHoOGOSocO+icQjvoxscITg4+vw7n4DiojMQAdwihV223aOd4scH780Bm8b7YJKxV2CLisc0Q57QlYoVO1SO5kL5Vul5fYWar0sDML6F0WAPbFo8xA9NBYwUCTI8j9a3gj5wbY+zRlEulF8rjkoI8t/0eja5e/ae8HgnoSUyRpWogH8ReB6st8S4Uh3gvZcX8sIE8gif1DofGgmtDpKChMj+rth3FAcNkVDX0JIbDM6o3Fx/ITdD8v8GcWKN0m4Sc2RZydDqOdVAHO4w+yFiBSht4O7iosLWespqp6WLSjKl9TxQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=fKKpqt7bYD8BpfCD9Jy07xmrYOoRXiaa/RTP9F++AfA=;
b=jJdQIME91m0kd17GrCT8bpp/DFVOF3dk+J5fge7IT9IBWpg+/oe51XZKbVYRcFFeGCv6OrY7czxET+ropaEdJ//4qxiHgav7Cr4pwQK+iy6fL7FdjdXpzju/CjPQ0EgZIHC4Rh5p6tvel0UfiEDSaNb8RnmPa+4ra3UJ/XeXpB8WiN58f7wcEc3MZid+IBXjaOW6CpOS7YqPmBXE8Ze/aWDPBqLF7aw/Pkqbf8D12c4cQuio+oXGu7OlUqQRxJ31CcqFIZJPA7488QNHJJHPh6AzPLU6f7AHMEVwUtwaEN0ZwmLw+cP6LMFyEJjciPzPEAhMneEE5j8o8h47qeGYwQ==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14)
by AM0PR04MB7187.eurprd04.prod.outlook.com (2603:10a6:208:196::17) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.20; Fri, 6 Jun
2025 15:56:52 +0000
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06%6]) with mapi id 15.20.8769.025; Fri, 6 Jun 2025
15:56:52 +0000
From: Frank Li <Frank.Li@xxxxxxx>
To: Andrew Lunn <andrew+netdev@xxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>,
Paolo Abeni <pabeni@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>,
Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>,
Claudiu Beznea <claudiu.beznea@xxxxxxxxx>,
netdev@xxxxxxxxxxxxxxx (open list:NETWORKING DRIVERS),
devicetree@xxxxxxxxxxxxxxx (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS),
linux-kernel@xxxxxxxxxxxxxxx (open list),
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx (moderated list:ARM/Microchip (AT91) SoC support)
Cc: imx@xxxxxxxxxxxxxxx
Subject: [PATCH v3 1/1] dt-bindings: ieee802154: Convert at86rf230.txt yaml format
Date: Fri, 6 Jun 2025 11:56:33 -0400
Message-Id: <20250606155638.1355908-1-Frank.Li@xxxxxxx>
X-Mailer: git-send-email 2.34.1
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: BYAPR07CA0017.namprd07.prod.outlook.com
(2603:10b6:a02:bc::30) To PAXPR04MB9642.eurprd04.prod.outlook.com
(2603:10a6:102:240::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB7187:EE_
X-MS-Office365-Filtering-Correlation-Id: d79e7142-1794-4c2a-4e29-08dda512c0d3
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|1800799024|366016|376014|52116014|7416014|921020|38350700014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?5kD/Rnr8GNDaR+rp7xCaHXeTXIX36D4e0ldasvewbBBgqba2xGF9uPVHJ/i2?=
=?us-ascii?Q?UpbUrkV75W1F2FagyIlX6rB272lTJCZ9vngL//K4rB0qOz8RFbfxgBfj4WF/?=
=?us-ascii?Q?rSMc9UJ51beCAG4HrSWL3l0epq/ygg6TLf1wBUMEIpB+zziSwNFaUlNfp1VD?=
=?us-ascii?Q?aVjjJe5ul+lIEvuBgFE1k4WsIyCJ2joBEcRJq2BFNQulTv5yIbnN9HVPs2Sr?=
=?us-ascii?Q?p4ix6+YpEOoTwAbnEgUsm3yS9grkEY4uPmVYHVhGY8TZct/P/cComXy/Ij8l?=
=?us-ascii?Q?dieYqrbFmbj02a7yjufkp5gO2at1hmhir86GOYVryKiOY0wNGRk/0WSrbJp4?=
=?us-ascii?Q?BtmCj+QTEk3eH5CpGZqGPPYi0yhxDCO3CLHdR/gnby2QC0oJSkI1YXpEz6J6?=
=?us-ascii?Q?dJZg0sYZCaR6OiBVs9Q/NGWdvOguy2+glz6TbXxpfWaY1FFfOeZzQm2gphMP?=
=?us-ascii?Q?0j5baGAI1U2EKndkDY+dhFRBNjXN7/+rijLVM8JYEA169HuuJQmB3K1syRPt?=
=?us-ascii?Q?pRz2oH2x0jeF1dxtVlU8odL9FQjHAWKXitE+c/h3DHg7f3li91L76gITbkTV?=
=?us-ascii?Q?6ONTr6hxy24mqkaPAnjXnVxRJlNHk5DW0923n2P56qL64CF0u+0Jf2MFzGMx?=
=?us-ascii?Q?qSDo+dG5Iv/HqwxrTBL/bbdwnJW1OF+6BPPpwcuW5bAOLTVoVPag+4D3i5Lo?=
=?us-ascii?Q?7fnSIOSxnP7jLo/qM+UROHqjYO2/O5fyEWyn/M24615M5LpUydIHVTbTQuCG?=
=?us-ascii?Q?ZtitOIgr+2X99X4zSMEyHYf6fG/rBBfR8gbjEukPyijwC9E5qKSL3hgCY1gS?=
=?us-ascii?Q?6KojWeJ4wCMIPdU7ufsNyeSkiNL/plqD8rqC2yE3AFWpymyD/w70Oiv/apJZ?=
=?us-ascii?Q?qD52aOiRHff25I9Q8U4uR0HPmhMWeOiIBVlEt64F6tcm7D/QO0vKYpxmHEOX?=
=?us-ascii?Q?fQBHb4qZr3CDaMDE8H14uVqlROkA2QwbhAz+SVhCophB1OcHwvF9zVk2uZ8i?=
=?us-ascii?Q?wGWtXcifq7K+3ebpE3edMTO8B9CBGB6Y+cT3Eb/xXExqyky/zXT1bVKtuuK3?=
=?us-ascii?Q?SDwKspeOXTx7EbG0znaV5QRZVkT0oJbuVdN1R+oUmdN94W3Cmu6d+GiKzbuN?=
=?us-ascii?Q?P2YZT1/c+Fhd6YLk1CT/6SVfkcx6QpA3Rm8TwcGQULhEAEZf7nEhu6aYB/Yn?=
=?us-ascii?Q?rkONsiI4IAyj1Ow6wvrsQT1o4f4QjJOE+K9BJjKOTvDw18hOgrzGKGUU5EQO?=
=?us-ascii?Q?L0Z1SoLKWTx088EmT3NvSjSqKeTBVFvXyXtvY+B95mo0UxPqU54GWwBYhTXu?=
=?us-ascii?Q?8UamXsx6RbpzIOwyuMZLj0xRU6X3K3+NYp3iEvhyaNviNh586iA9wPNtzzsZ?=
=?us-ascii?Q?Rsv+zfu6ok5i0gWYR0w7UNYGuU7Mo95I7W88iWTVi5VsBDINeG4Auz4Rc10O?=
=?us-ascii?Q?JybUVYLJUJji/OccVvEkCHqHfLnlUYDd?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?sZ5h64Je3wuHLu6sVthYs8Hp3d1/J10DJtjWe/mVGfwU54ws112n3AKa9GfR?=
=?us-ascii?Q?o9dXC7NTWYS6FQ/KqLLD5gbTCAlYXCXKzKK8qDssiJm/qyhA+9zRGPY3pkBZ?=
=?us-ascii?Q?loQsMyIgTGZDqt/wZcJ4CTerY+XSq8a72N9Iv2uNQu9w3DkmDahGUMZEyvPe?=
=?us-ascii?Q?KNZlKUhNtsTci2zIo0PEvZeZu+iQi9546diPwb+rZS5QhKzIRtU+3kRHtEz6?=
=?us-ascii?Q?1f4qGLlm2u6Fx1C1ZQMxkTYqnf8Iom3KXYwg2aKzS/Dq6h/W1XWF2vTmUadR?=
=?us-ascii?Q?DHSQCn/AF3hIAfoKGo6QdHxB6CgsLeQ7kwuMfj9rB4deNeo9PF9ovGWkbRtD?=
=?us-ascii?Q?ycJ+Hd0cLG1ffHYWX5keyFyeRgJup8IZCOC04OGprvUscerSVi8J+Z2QanuP?=
=?us-ascii?Q?7pjT/kC0md8Mqt0/2UP0n0Z1L/rBlk9aJw+4ZOItdhnouEkcc10ExjsgSWOy?=
=?us-ascii?Q?vPyBayr5YMhzyA8GhtdqJySanBBey4H8WBOuwZTS/66fi/36T6ROy+XDzaKq?=
=?us-ascii?Q?GUZWPx7BDHfisbplsdD5+jpzPrFyieB5w1IAfMXRDnH/T2K/T/pAFzky8VWk?=
=?us-ascii?Q?EAwGJG9X4ep+OTXf65KVvRTta0EwVbcqe97s4j7rlKZra540G+HPYcFtQ7IO?=
=?us-ascii?Q?apgTmI/GV1pOHeVIKVSEYCeoh05o+d/j82v0YkGD4Ns2fjBx++EFk0WAjP5q?=
=?us-ascii?Q?vjbaPjrixXFwF3XWYaVVANAvyS3RTFLAV1baCOhw8GQRdEESIOHG0N5FVqUd?=
=?us-ascii?Q?aUtSKlml6TkTMGidqyW3sv7Mn/qyU0zRSRZFn288wIwZ71Km5P6YMjohjryJ?=
=?us-ascii?Q?K1IEw7+BkEyiLRpbSD5SEqsToobaPbeS/FMbZ5uP9xGnEdrfK5g9W4kSQ/8o?=
=?us-ascii?Q?/Rj7fhaicVCcEn+s47FktQZkXHZb/ubZjQseOtC2UVMi2mcHhv0YYwJBxqMJ?=
=?us-ascii?Q?t9fD3wAE8jyfqWZgkW3aopVmmYspTsIQWSWRjTUAvqF9dXVyynvyIMOWcv4b?=
=?us-ascii?Q?/W3vNOOak0unEP8tblrBeXiniAl0qtxuPGL8vJ171Mv1sILzixKvl+XjfsDD?=
=?us-ascii?Q?2mrVqhikRDM6YQrgfZxJoK3XHDzx1UP8tNQTfuNuaxhTm6I21wS7TqF5/MYf?=
=?us-ascii?Q?DXS0Tb8AY5NuqbVNKUjMF2RhKXvQXiC53dJ5WdGi01BOzHOfL9KOaZdXVw2J?=
=?us-ascii?Q?wcQFOqLfv+wSia0fLu1WFpfndIT4LT8+sXf+pRf2B4I3U2DijJW0GcpSDu7Y?=
=?us-ascii?Q?h4lA1TezpJEfb/GVuptvnrBaOX+G4q9nvnsEkgQkejlMI2Xcd0ojBLy+DzyD?=
=?us-ascii?Q?5nqQaoy78+mLslV7EWfjqqAIK45Q4X0+ze16nFbbUr13lkcBQCwbxoNdC03y?=
=?us-ascii?Q?J70TYX8vskyumABw+TzF32cjF4pU1aNfniPfaoTSICH62xK40K6dV7s14Biz?=
=?us-ascii?Q?OFcHKHsUCLal+Ldr9A2fLjFpH0Wrh6BbLcPgalLnEw0dYOXXjKmNof4kEfMT?=
=?us-ascii?Q?et9IOVvg9pc6A5u4WalkKy7IYuOYAlZe15Ljzdm0MbkqEIn/2i80Lp1fvJmP?=
=?us-ascii?Q?3fO4/esQeTop/G0o1R0Hx72ErobFlTDu0aX2CP5y?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: d79e7142-1794-4c2a-4e29-08dda512c0d3
X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 15:56:52.1904
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: +NKeSpYSG41nOjC5jr8Ya3B78+3ypnTQrnpLIEXDWgFP1026YIMoq3i1qaKle2Aqx2LTjt1aP08tdEx8Y+Jk9A==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7187
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Convert at86rf230.txt yaml format.

Additional changes:
- Add ref to spi-peripheral-props.yaml.
- Add parent spi node in examples.

Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
---
change in v3
- add maximum: 0xf for xtal-trim
- drop 'u8 value ...' for xtal-trim's description

change in v2
- xtal-trim to uint8
---
.../bindings/net/ieee802154/at86rf230.txt | 27 --------
.../net/ieee802154/atmel,at86rf233.yaml | 66 +++++++++++++++++++
2 files changed, 66 insertions(+), 27 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt
create mode 100644 Documentation/devicetree/bindings/net/ieee802154/atmel,at86rf233.yaml

diff --git a/Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt b/Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt
deleted file mode 100644
index 168f1be509126..0000000000000
--- a/Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-* AT86RF230 IEEE 802.15.4 *
-
-Required properties:
- - compatible: should be "atmel,at86rf230", "atmel,at86rf231",
- "atmel,at86rf233" or "atmel,at86rf212"
- - spi-max-frequency: maximal bus speed, should be set to 7500000 depends
- sync or async operation mode
- - reg: the chipselect index
- - interrupts: the interrupt generated by the device. Non high-level
- can occur deadlocks while handling isr.
-
-Optional properties:
- - reset-gpio: GPIO spec for the rstn pin
- - sleep-gpio: GPIO spec for the slp_tr pin
- - xtal-trim: u8 value for fine tuning the internal capacitance
- arrays of xtal pins: 0 = +0 pF, 0xf = +4.5 pF
-
-Example:
-
- at86rf231@0 {
- compatible = "atmel,at86rf231";
- spi-max-frequency = <7500000>;
- reg = <0>;
- interrupts = <19 4>;
- interrupt-parent = <&gpio3>;
- xtal-trim = /bits/ 8 <0x06>;
- };
diff --git a/Documentation/devicetree/bindings/net/ieee802154/atmel,at86rf233.yaml b/Documentation/devicetree/bindings/net/ieee802154/atmel,at86rf233.yaml
new file mode 100644
index 0000000000000..32cdc30009cc0
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ieee802154/atmel,at86rf233.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/ieee802154/atmel,at86rf233.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AT86RF230 IEEE 802.15.4
+
+maintainers:
+ - Frank Li <Frank.Li@xxxxxxx>
+
+properties:
+ compatible:
+ enum:
+ - atmel,at86rf212
+ - atmel,at86rf230
+ - atmel,at86rf231
+ - atmel,at86rf233
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ reset-gpio:
+ maxItems: 1
+
+ sleep-gpio:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 7500000
+
+ xtal-trim:
+ $ref: /schemas/types.yaml#/definitions/uint8
+ maximum: 0xf
+ description: |
+ Fine tuning the internal capacitance arrays of xtal pins:
+ 0 = +0 pF, 0xf = +4.5 pF
+
+required:
+ - compatible
+ - reg
+ - interrupts
+
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ zigbee@0 {
+ compatible = "atmel,at86rf231";
+ reg = <0>;
+ spi-max-frequency = <7500000>;
+ interrupts = <19 4>;
+ interrupt-parent = <&gpio3>;
+ xtal-trim = /bits/ 8 <0x06>;
+ };
+ };
--
2.34.1



Return-Path: <linux-kernel+bounces-675992-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 9224441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:58:14 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1AF0A175760
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:58:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 60D7A289371;
Fri, 6 Jun 2025 15:58:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CzhH64CR"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10])
(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 722141A38F9;
Fri, 6 Jun 2025 15:58:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225483; cv=none; b=cTHRavLkNlieogZwc87J3Q61pZiMiXPOJroYwFCVDmXxYMrHT5ArgfZZHhzNuUOWkHVrHU7JgwSXfNklhT0pWNb67P8ovJwJwvmcmkR2BgVKe+yGJGsA/MD0Zy/DGWyNwNJjdicTT53HGHY9ViIY2e1kpdWtCknD2J0AY4IcUfQ=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225483; c=relaxed/simple;
bh=OiozlLL9RTQihrBWBPSYKMdKrV/leB8h+XdwldIP0AI=;
h=Message-ID:Date:MIME-Version:Subject:To:References:From:
In-Reply-To:Content-Type; b=gOW5+mxTWztzAWGHyHdlMLwYBqRmgp5vhAuvphZ6eUn26OvDPzcibDQuRBm7jSapZBv7MY7RIMYgqrFXKQxM+CBdIJSP0zL2P6HkCZUSFA8ih8VeRDBJx6qDv6x8Ocqmdeq19vW7mmuKM91pR8/gJBmpcyYkNgUn1C8vewkkeyQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CzhH64CR; arc=none smtp.client-ip=192.198.163.10
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749225482; x=1780761482;
h=message-id:date:mime-version:subject:to:references:from:
in-reply-to:content-transfer-encoding;
bh=OiozlLL9RTQihrBWBPSYKMdKrV/leB8h+XdwldIP0AI=;
b=CzhH64CR3eSfYVTDjhn13LnP/O3ff0OVox7tIhKOiQdX/oJ3hb5ZYuEc
khYf6RThs4J9X9bRrWxA4rZ8sBSuCaSB39oJh3IPB0iuLZeFLglcPWnZB
LoLtO3tAjk4/VVycmmcXuA4csku4HT5LJMNSwbqVNsrIhh3WClfvTnNzM
Ya7UPj6Xg3dKAWMs8f03Uwf/SMZJaY5Ie1vcSq8TEYjlKJiQ73UbT18df
AZdlGZcB2+Y0wSWH+T0X2l5FkBKEDwsjAXRTPovSNE90CFQ+5Ru7rfD4m
Ul5i0hoBh6Zx4kGGqdJlMh8v/bS3LVbO5OWDNaA3YLHHqmJRRHjVrhYER
g==;
X-CSE-ConnectionGUID: fvy2mPFvQPCgEz8sVCz5RQ==
X-CSE-MsgGUID: fd+a7EMcSk2y45qWmQCdMg==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="62739122"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="62739122"
Received: from orviesa001.jf.intel.com ([10.64.159.141])
by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:58:00 -0700
X-CSE-ConnectionGUID: P49d5TheSQuwycFxw51GJw==
X-CSE-MsgGUID: x5PaQq3MTxayUd46UHVsYw==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="183054068"
Received: from spandruv-desk1.amr.corp.intel.com (HELO [10.125.111.33]) ([10.125.111.33])
by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:57:58 -0700
Message-ID: <81214183-fd94-428b-abeb-3ec3d2688030@xxxxxxxxx>
Date: Fri, 6 Jun 2025 08:57:54 -0700
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v9 04/16] PCI/AER: Dequeue forwarded CXL error
To: Terry Bowman <terry.bowman@xxxxxxx>, PradeepVineshReddy.Kodamati@xxxxxxx,
dave@xxxxxxxxxxxx, jonathan.cameron@xxxxxxxxxx, alison.schofield@xxxxxxxxx,
vishal.l.verma@xxxxxxxxx, ira.weiny@xxxxxxxxx, dan.j.williams@xxxxxxxxx,
bhelgaas@xxxxxxxxxx, bp@xxxxxxxxx, ming.li@xxxxxxxxxxxx,
shiju.jose@xxxxxxxxxx, dan.carpenter@xxxxxxxxxx,
Smita.KoralahalliChannabasappa@xxxxxxx, kobayashi.da-06@xxxxxxxxxxx,
yanfei.xu@xxxxxxxxx, rrichter@xxxxxxx, peterz@xxxxxxxxxxxxx,
coly.li@xxxxxxx, uaisheng.ye@xxxxxxxxx,
fabio.m.de.francesco@xxxxxxxxxxxxxxx, ilpo.jarvinen@xxxxxxxxxxxxxxx,
yazen.ghannam@xxxxxxx, linux-cxl@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx
References: <20250603172239.159260-1-terry.bowman@xxxxxxx>
<20250603172239.159260-5-terry.bowman@xxxxxxx>
Content-Language: en-US
From: Dave Jiang <dave.jiang@xxxxxxxxx>
In-Reply-To: <20250603172239.159260-5-terry.bowman@xxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu



On 6/3/25 10:22 AM, Terry Bowman wrote:
> The AER driver is now designed to forward CXL protocol errors to the CXL
> driver. Update the CXL driver with functionality to dequeue the forwarded
> CXL error from the kfifo. Also, update the CXL driver to begin the protocol
> error handling processing using the work received from the FIFO.
>
> Introduce function cxl_prot_err_work_fn() to dequeue work forwarded by the
> AER service driver. This will begin the CXL protocol error processing
> with a call to cxl_handle_prot_error().
>
> Update cxl/core/ras.c by adding cxl_rch_handle_error_iter() that was
> previously in the AER driver.
>
> Introduce sbdf_to_pci() to take the SBDF values from 'struct cxl_prot_error_info'
> and use in discovering the erring PCI device. Make scope based reference
> increments/decrements for the discovered PCI device and the associated
> CXL device.
>
> Implement cxl_handle_prot_error() to differentiate between Restricted CXL
> Host (RCH) protocol errors and CXL virtual host (VH) protocol errors.
> RCH errors will be processed with a call to walk the associated Root
> Complex Event Collector's (RCEC) secondary bus looking for the Root Complex
> Integrated Endpoint (RCiEP) to handle the RCH error. Export pcie_walk_rcec()
> so the CXL driver can walk the RCEC's downstream bus, searching for
> the RCiEP.
>
> VH correctable error (CE) processing will call the CXL CE handler. VH
> uncorrectable errors (UCE) will call cxl_do_recovery(), implemented as a
> stub for now and to be updated in future patch. Export pci_aer_clean_fatal_status()
> and pci_clean_device_status() used to clean up AER status after handling.
>
> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx>
> ---
> drivers/cxl/core/ras.c | 92 +++++++++++++++++++++++++++++++++++++++++
> drivers/pci/pci.c | 1 +
> drivers/pci/pci.h | 8 ----
> drivers/pci/pcie/aer.c | 1 +
> drivers/pci/pcie/rcec.c | 1 +
> include/linux/aer.h | 2 +
> include/linux/pci.h | 10 +++++
> 7 files changed, 107 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/cxl/core/ras.c b/drivers/cxl/core/ras.c
> index d35525e79e04..9ed5c682e128 100644
> --- a/drivers/cxl/core/ras.c
> +++ b/drivers/cxl/core/ras.c
> @@ -110,8 +110,100 @@ static DECLARE_WORK(cxl_cper_prot_err_work, cxl_cper_prot_err_work_fn);
>
> #ifdef CONFIG_PCIEAER_CXL
>
> +static void cxl_do_recovery(struct pci_dev *pdev)
> +{
> +}
> +
> +static int cxl_rch_handle_error_iter(struct pci_dev *pdev, void *data)
> +{
> + struct cxl_prot_error_info *err_info = data;
> + struct pci_dev *pdev_ref __free(pci_dev_put) = pci_dev_get(pdev);
> + struct cxl_dev_state *cxlds;
> +
> + /*
> + * The capability, status, and control fields in Device 0,
> + * Function 0 DVSEC control the CXL functionality of the
> + * entire device (CXL 3.0, 8.1.3).
> + */
> + if (pdev->devfn != PCI_DEVFN(0, 0))
> + return 0;
> +
> + /*
> + * CXL Memory Devices must have the 502h class code set (CXL
> + * 3.0, 8.1.12.1).
> + */
> + if ((pdev->class >> 8) != PCI_CLASS_MEMORY_CXL)

Should use FIELD_GET() to be consistent with the rest of CXL code base

> + return 0;
> +
> + if (!is_cxl_memdev(&pdev->dev) || !pdev->dev.driver)

I think you need to hold the pdev->dev lock while checking if the driver exists.

> + return 0;
> +
> + cxlds = pci_get_drvdata(pdev);
> + struct device *dev __free(put_device) = get_device(&cxlds->cxlmd->dev);

Maybe a comment on why cxlmd->dev ref is needed here.

> +
> + if (err_info->severity == AER_CORRECTABLE)
> + cxl_cor_error_detected(pdev);
> + else
> + cxl_do_recovery(pdev);
> +
> + return 1;
> +}
> +
> +static struct pci_dev *sbdf_to_pci(struct cxl_prot_error_info *err_info)
> +{
> + unsigned int devfn = PCI_DEVFN(err_info->device,
> + err_info->function);
> + struct pci_dev *pdev __free(pci_dev_put) =
> + pci_get_domain_bus_and_slot(err_info->segment,
> + err_info->bus,
> + devfn);

Looks like DanC already caught that. Maybe have this function return with a ref held. I would also add a comment for the function mention that the caller need to put the device.

> + return pdev;
> +}
> +
> +static void cxl_handle_prot_error(struct cxl_prot_error_info *err_info)
> +{
> + struct pci_dev *pdev __free(pci_dev_put) = pci_dev_get(sbdf_to_pci(err_info));
> +
> + if (!pdev) {
> + pr_err("Failed to find the CXL device\n");
> + return;
> + }
> +
> + /*
> + * Internal errors of an RCEC indicate an AER error in an
> + * RCH's downstream port. Check and handle them in the CXL.mem
> + * device driver.
> + */
> + if (pci_pcie_type(pdev) == PCI_EXP_TYPE_RC_EC)
> + return pcie_walk_rcec(pdev, cxl_rch_handle_error_iter, err_info);
> +

cxl_rch_handle_error_iter() holds the pdev device lock when handling errors. Does the code block below need locking?

DJ

> + if (err_info->severity == AER_CORRECTABLE) {
> + int aer = pdev->aer_cap;
> + struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
> + struct device *dev __free(put_device) = get_device(&cxlds->cxlmd->dev);
> +
> + if (aer)
> + pci_clear_and_set_config_dword(pdev,
> + aer + PCI_ERR_COR_STATUS,
> + 0, PCI_ERR_COR_INTERNAL);
> +
> + cxl_cor_error_detected(pdev);
> +
> + pcie_clear_device_status(pdev);
> + } else {
> + cxl_do_recovery(pdev);
> + }
> +}
> +
> static void cxl_prot_err_work_fn(struct work_struct *work)
> {
> + struct cxl_prot_err_work_data wd;
> +
> + while (cxl_prot_err_kfifo_get(&wd)) {
> + struct cxl_prot_error_info *err_info = &wd.err_info;
> +
> + cxl_handle_prot_error(err_info);
> + }
> }
>
> #else
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index e77d5b53c0ce..524ac32b744a 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2328,6 +2328,7 @@ void pcie_clear_device_status(struct pci_dev *dev)
> pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &sta);
> pcie_capability_write_word(dev, PCI_EXP_DEVSTA, sta);
> }
> +EXPORT_SYMBOL_NS_GPL(pcie_clear_device_status, "CXL");
> #endif
>
> /**
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index d6296500b004..3c54a5ed803e 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -649,16 +649,10 @@ static inline bool pci_dpc_recovered(struct pci_dev *pdev) { return false; }
> void pci_rcec_init(struct pci_dev *dev);
> void pci_rcec_exit(struct pci_dev *dev);
> void pcie_link_rcec(struct pci_dev *rcec);
> -void pcie_walk_rcec(struct pci_dev *rcec,
> - int (*cb)(struct pci_dev *, void *),
> - void *userdata);
> #else
> static inline void pci_rcec_init(struct pci_dev *dev) { }
> static inline void pci_rcec_exit(struct pci_dev *dev) { }
> static inline void pcie_link_rcec(struct pci_dev *rcec) { }
> -static inline void pcie_walk_rcec(struct pci_dev *rcec,
> - int (*cb)(struct pci_dev *, void *),
> - void *userdata) { }
> #endif
>
> #ifdef CONFIG_PCI_ATS
> @@ -967,7 +961,6 @@ void pci_no_aer(void);
> void pci_aer_init(struct pci_dev *dev);
> void pci_aer_exit(struct pci_dev *dev);
> extern const struct attribute_group aer_stats_attr_group;
> -void pci_aer_clear_fatal_status(struct pci_dev *dev);
> int pci_aer_clear_status(struct pci_dev *dev);
> int pci_aer_raw_clear_status(struct pci_dev *dev);
> void pci_save_aer_state(struct pci_dev *dev);
> @@ -976,7 +969,6 @@ void pci_restore_aer_state(struct pci_dev *dev);
> static inline void pci_no_aer(void) { }
> static inline void pci_aer_init(struct pci_dev *d) { }
> static inline void pci_aer_exit(struct pci_dev *d) { }
> -static inline void pci_aer_clear_fatal_status(struct pci_dev *dev) { }
> static inline int pci_aer_clear_status(struct pci_dev *dev) { return -EINVAL; }
> static inline int pci_aer_raw_clear_status(struct pci_dev *dev) { return -EINVAL; }
> static inline void pci_save_aer_state(struct pci_dev *dev) { }
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 5350fa5be784..6e88331c6303 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -290,6 +290,7 @@ void pci_aer_clear_fatal_status(struct pci_dev *dev)
> if (status)
> pci_write_config_dword(dev, aer + PCI_ERR_UNCOR_STATUS, status);
> }
> +EXPORT_SYMBOL_GPL(pci_aer_clear_fatal_status);
>
> /**
> * pci_aer_raw_clear_status - Clear AER error registers.
> diff --git a/drivers/pci/pcie/rcec.c b/drivers/pci/pcie/rcec.c
> index d0bcd141ac9c..fb6cf6449a1d 100644
> --- a/drivers/pci/pcie/rcec.c
> +++ b/drivers/pci/pcie/rcec.c
> @@ -145,6 +145,7 @@ void pcie_walk_rcec(struct pci_dev *rcec, int (*cb)(struct pci_dev *, void *),
>
> walk_rcec(walk_rcec_helper, &rcec_data);
> }
> +EXPORT_SYMBOL_NS_GPL(pcie_walk_rcec, "CXL");
>
> void pci_rcec_init(struct pci_dev *dev)
> {
> diff --git a/include/linux/aer.h b/include/linux/aer.h
> index 550407240ab5..c9a18eca16f8 100644
> --- a/include/linux/aer.h
> +++ b/include/linux/aer.h
> @@ -77,12 +77,14 @@ struct cxl_prot_err_work_data {
>
> #if defined(CONFIG_PCIEAER)
> int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
> +void pci_aer_clear_fatal_status(struct pci_dev *dev);
> int pcie_aer_is_native(struct pci_dev *dev);
> #else
> static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
> {
> return -EINVAL;
> }
> +static inline void pci_aer_clear_fatal_status(struct pci_dev *dev) { }
> static inline int pcie_aer_is_native(struct pci_dev *dev) { return 0; }
> #endif
>
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index bff3009f9ff0..cd53715d53f3 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1806,6 +1806,9 @@ extern bool pcie_ports_native;
>
> int pcie_set_target_speed(struct pci_dev *port, enum pci_bus_speed speed_req,
> bool use_lt);
> +void pcie_walk_rcec(struct pci_dev *rcec,
> + int (*cb)(struct pci_dev *, void *),
> + void *userdata);
> #else
> #define pcie_ports_disabled true
> #define pcie_ports_native false
> @@ -1816,8 +1819,15 @@ static inline int pcie_set_target_speed(struct pci_dev *port,
> {
> return -EOPNOTSUPP;
> }
> +
> +static inline void pcie_walk_rcec(struct pci_dev *rcec,
> + int (*cb)(struct pci_dev *, void *),
> + void *userdata) { }
> +
> #endif
>
> +void pcie_clear_device_status(struct pci_dev *dev);
> +
> #define PCIE_LINK_STATE_L0S (BIT(0) | BIT(1)) /* Upstr/dwnstr L0s */
> #define PCIE_LINK_STATE_L1 BIT(2) /* L1 state */
> #define PCIE_LINK_STATE_L1_1 BIT(3) /* ASPM L1.1 state */



Return-Path: <linux-kernel+bounces-675993-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5DD2D41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:58:25 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 303B9188142D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:58:33 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A857528981C;
Fri, 6 Jun 2025 15:58:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=collabora.com header.i=nfraprado@xxxxxxxxxxxxx header.b="QH1vKODG"
Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112])
(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 193021A5BBF;
Fri, 6 Jun 2025 15:58:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225485; cv=pass; b=FtbsgFIRfOGO84xXTTFurRPTTIjrdUN+5Pvng3vk98E1vMhRCQ4b6k8VAvO3kGlS5Z7OhOyUHEI83rFXvsCyatOyAGp2UvBvstD8xsDv/Y/giFE7PVMpsK60/0Zn4SU8d7uw1ESbrLlmvW4FALmSuVxyg+E85tXSC7iHQBpC6n0=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225485; c=relaxed/simple;
bh=vycj8gjcEZ+bm23D5leWAwXb3RRniPJSFGDD7+kMt9s=;
h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:MIME-Version; b=GwmT9j9b8F0rysRv7zz/80OpKT2OK+bC6fXzXJdF2mLd1nBR9ddeNSYCVV77lr4uC6Mqkk7t+vwSMum+bX5lSc80Apuvvcp/rtIIsLn0dRf+dQSxBh/5UTOa2o0lswq9nWXpy/2Cf3shpza8u9Y2NLkHVELB6CPuEt5k/7SI67I=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nfraprado@xxxxxxxxxxxxx header.b=QH1vKODG; arc=pass smtp.client-ip=136.143.188.112
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com
ARC-Seal: i=1; a=rsa-sha256; t=1749225476; cv=none;
d=zohomail.com; s=zohoarc;
b=NYZ7f8leMzC2ymDf3ysaAlOhnBwwfo+ICLpMWRoC8PrrI0qAwJ5NbQnxtgOP/OosZ1QrMQA59r9AghzbbcrmNUOqfeESizPsSoGFooTDpvnRQDSAiCclLClyCXznY9jSUjCbZr/Enjp26BSTrhWfYpqqa6wAPZRQosy7v6Dtkkw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc;
t=1749225476; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;
bh=UBFyDDLc1XMNjUwKbv/5YR9uucwhhwGf+YONUGBjl8g=;
b=I+eMS1tc5tmRURjI70XxKj6enoKvFOPz7hPJFOC9b1XNbLfcdKITykSJDhVGPDKJ21Z1IcKaHoPCE0f0aFrgvfPdKZFHNzCM82QohxMsEbBtFaV0Zvwk/WoL7QtAdsPc0hcrRNoiz9r6vm0Sc5Ll1Rgk9wMjLM7f8bT7H59+kAA=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass header.i=collabora.com;
spf=pass smtp.mailfrom=nfraprado@xxxxxxxxxxxxx;
dmarc=pass header.from=<nfraprado@xxxxxxxxxxxxx>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1749225476;
s=zohomail; d=collabora.com; i=nfraprado@xxxxxxxxxxxxx;
h=Message-ID:Subject:Subject:From:From:To:To:Cc:Cc:Date:Date:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:MIME-Version:Message-Id:Reply-To;
bh=UBFyDDLc1XMNjUwKbv/5YR9uucwhhwGf+YONUGBjl8g=;
b=QH1vKODGwgXA+YBqRmYjQxTmkO1kXSDZhxvktEsX79WdRhgSqOCz7D8kV5WzXtrl
DRojKpWVnwF6bOpE5/2T55q7l3N/WmG/sZ1BmdiWCkkJCBJZ5nDl42hZ+O1nzArN+od
jj84BxhpK6BCSyTC22BnWNBI1UK0yRJKg93dJAHE=
Received: by mx.zohomail.com with SMTPS id 1749225474614216.59788784587943;
Fri, 6 Jun 2025 08:57:54 -0700 (PDT)
Message-ID: <24f62de7a5560d6dc093ba57af5271b5aa03d244.camel@xxxxxxxxxxxxx>
Subject: Re: [PATCH v2 0/3] docs: some automarkup improvements
From: =?ISO-8859-1?Q?N=EDcolas?= "F. R. A. Prado" <nfraprado@xxxxxxxxxxxxx>
To: Jonathan Corbet <corbet@xxxxxxx>
Cc: linux-doc@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Mauro Carvalho
Chehab <mchehab+huawei@xxxxxxxxxx>
Date: Fri, 06 Jun 2025 11:57:41 -0400
In-Reply-To: <8734cegndo.fsf@xxxxxxxxxxxxxx>
References: <20250604143645.78367-1-corbet@xxxxxxx>
<ebeb020a-8403-441b-ab02-f017ffcb7b83@notapiano>
<8734cegndo.fsf@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.56.2
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-ZohoMailClient: External
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Thu, 2025-06-05 at 10:32 -0600, Jonathan Corbet wrote:
> N=C3=ADcolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx> writes:
>=20
> > The only other thing I noticed is that the links in the sidebar
> > still use the
> > old style, since they rely on a different CSS selector for some
> > reason:
> >=20
> > =C2=A0 div.sphinxsidebar a {
> > =C2=A0=C2=A0=C2=A0 text-decoration: none;
> > =C2=A0=C2=A0=C2=A0 border-bottom: 1px dotted #999;
> > =C2=A0 }
> >=20
> > That makes it a bit inconsistent style-wise, so I think it'd be
> > sensible to
> > update that selector as well to follow suit.
>=20
> Sigh.=C2=A0 Of course, making it exactly the same doesn't work well due t=
o
> the shading that we already use in the sidebar.=C2=A0 Since we know
> everything in the sidebar is a link, I suggest something like this:
>=20
> =C2=A0=C2=A0=C2=A0 a.sphinxsidebar a { border-bottom: none; }
> =C2=A0=C2=A0=C2=A0 a.sphinxsidebar a:hover {
> =C2=A0=C2=A0=C2=A0=C2=A0 border-bottom: none;
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text-decoration: underline;
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text-underline-offset: 0.3em;
> =C2=A0=C2=A0=C2=A0 }
>=20
> That makes the sidebar relatively uncluttered, but still lights up
> the
> links in a visible way when the pointer passes over them.

Personally I'm fine with either approach. Just note that there's a typo
there, should be div. not a.:

div.sphinxsidebar a { border-bottom: none; }
div.sphinxsidebar a:hover {
border-bottom: none;
text-decoration: underline;
text-underline-offset: 0.3em;
}

--=20
Thanks,
N=C3=ADcolas


Return-Path: <linux-kernel+bounces-675994-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 52DBF41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:58:52 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 07BE9188420D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:58:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CF58C288CBA;
Fri, 6 Jun 2025 15:58:22 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bwDQfOsu"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10])
(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 A4D5F1A38F9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:58:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225502; cv=none; b=uMap9M9pq7y9dNXSXj+34UsHDdtKNuviDeCUuE1G+GQj/uE8e5RV0BYk9vQEyfCdVjs7IUzZ69twpLbUnpxohhuaRNJ8XQ/PRoIH2zPJ+4Qf2fr2J6bzXgZSshslktRBTA3Sdl96nJKK21bsYvMHhiLrAMPrgYrB9YwNTuHi4Vg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225502; c=relaxed/simple;
bh=i6VgH1PkSyX6JYvtRIoBdYOXYjwcPe1MsZt/6jpKVu0=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=psUZDbDmJAa9EABmGOrzmMeuooBpu0rK3RZdnMjstFQb3q8Nskpw8oEaBM5GRyLps9gCttwI02ikWupYhZgxR0iUWZDBKC2jewSPTz+tgNSB2B5GuwvIKC4UKvt8DCZOO/VM7JgHooR6lJaVnnHltTFsNtmxMv9mHvdJkOgbcp0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bwDQfOsu; arc=none smtp.client-ip=198.175.65.10
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749225501; x=1780761501;
h=message-id:date:mime-version:subject:to:cc:references:
from:in-reply-to:content-transfer-encoding;
bh=i6VgH1PkSyX6JYvtRIoBdYOXYjwcPe1MsZt/6jpKVu0=;
b=bwDQfOsuspI43oyaeDKBH5SRp80Mkmc7TKIuAdEzliWyO5qvK3tYkqoa
QY8ETJJYkNnwLIf5naKC6ntvajM1oWkIdCuHJgDPVrC691gT0SIBtg1tK
PhqRwPPRrbY9YI0k7xT4DMBTDpxBO6FIoJIsWTx4VTrMyIgQLwEXZoQpu
scAOD1qWiwiq2aouFev/LTwci4OsY2j2P2XC+cQUwMDBaomB2U/bYX//S
h1WnNZeoPCdcLYVIOPCSq5goqRlIH3TQT+SiVbKhwr6G/Ofk70ym1SFFr
Mflo2l9LV8tpa6L9ACQXSesQfM+UH/2LJZwpuJ/nHh6RFne2AhEnIgseI
A==;
X-CSE-ConnectionGUID: UyneHoKtQjusMm0MnPp++w==
X-CSE-MsgGUID: GKc+VJLvRVaLOKMNLRdCzw==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="68821241"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="68821241"
Received: from orviesa002.jf.intel.com ([10.64.159.142])
by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:58:21 -0700
X-CSE-ConnectionGUID: 1M6ojOgnSJ223/q1IXO8ng==
X-CSE-MsgGUID: OSpIJxdjTMaQi4oha9s2dQ==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="176811066"
Received: from iherna2-mobl4.amr.corp.intel.com (HELO [10.125.111.31]) ([10.125.111.31])
by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:58:20 -0700
Message-ID: <ade8a82a-23c6-4a7e-968c-e4b0d4bcbc46@xxxxxxxxx>
Date: Fri, 6 Jun 2025 08:58:18 -0700
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v3] x86/virt/tdx: Enforce no indirect calls of TDX
assembly
To: Kai Huang <kai.huang@xxxxxxxxx>, peterz@xxxxxxxxxxxxx,
tglx@xxxxxxxxxxxxx, bp@xxxxxxxxx, mingo@xxxxxxxxxx, hpa@xxxxxxxxx,
kirill.shutemov@xxxxxxxxxxxxxxx
Cc: rick.p.edgecombe@xxxxxxxxx, x86@xxxxxxxxxx, samitolvanen@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250606130737.30713-1-kai.huang@xxxxxxxxx>
From: Dave Hansen <dave.hansen@xxxxxxxxx>
Content-Language: en-US
Autocrypt: addr=dave.hansen@xxxxxxxxx; keydata=
xsFNBE6HMP0BEADIMA3XYkQfF3dwHlj58Yjsc4E5y5G67cfbt8dvaUq2fx1lR0K9h1bOI6fC
oAiUXvGAOxPDsB/P6UEOISPpLl5IuYsSwAeZGkdQ5g6m1xq7AlDJQZddhr/1DC/nMVa/2BoY
2UnKuZuSBu7lgOE193+7Uks3416N2hTkyKUSNkduyoZ9F5twiBhxPJwPtn/wnch6n5RsoXsb
ygOEDxLEsSk/7eyFycjE+btUtAWZtx+HseyaGfqkZK0Z9bT1lsaHecmB203xShwCPT49Blxz
VOab8668QpaEOdLGhtvrVYVK7x4skyT3nGWcgDCl5/Vp3TWA4K+IofwvXzX2ON/Mj7aQwf5W
iC+3nWC7q0uxKwwsddJ0Nu+dpA/UORQWa1NiAftEoSpk5+nUUi0WE+5DRm0H+TXKBWMGNCFn
c6+EKg5zQaa8KqymHcOrSXNPmzJuXvDQ8uj2J8XuzCZfK4uy1+YdIr0yyEMI7mdh4KX50LO1
pmowEqDh7dLShTOif/7UtQYrzYq9cPnjU2ZW4qd5Qz2joSGTG9eCXLz5PRe5SqHxv6ljk8mb
ApNuY7bOXO/A7T2j5RwXIlcmssqIjBcxsRRoIbpCwWWGjkYjzYCjgsNFL6rt4OL11OUF37wL
QcTl7fbCGv53KfKPdYD5hcbguLKi/aCccJK18ZwNjFhqr4MliQARAQABzUVEYXZpZCBDaHJp
c3RvcGhlciBIYW5zZW4gKEludGVsIFdvcmsgQWRkcmVzcykgPGRhdmUuaGFuc2VuQGludGVs
LmNvbT7CwXgEEwECACIFAlQ+9J0CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEGg1
lTBwyZKwLZUP/0dnbhDc229u2u6WtK1s1cSd9WsflGXGagkR6liJ4um3XCfYWDHvIdkHYC1t
MNcVHFBwmQkawxsYvgO8kXT3SaFZe4ISfB4K4CL2qp4JO+nJdlFUbZI7cz/Td9z8nHjMcWYF
IQuTsWOLs/LBMTs+ANumibtw6UkiGVD3dfHJAOPNApjVr+M0P/lVmTeP8w0uVcd2syiaU5jB
aht9CYATn+ytFGWZnBEEQFnqcibIaOrmoBLu2b3fKJEd8Jp7NHDSIdrvrMjYynmc6sZKUqH2
I1qOevaa8jUg7wlLJAWGfIqnu85kkqrVOkbNbk4TPub7VOqA6qG5GCNEIv6ZY7HLYd/vAkVY
E8Plzq/NwLAuOWxvGrOl7OPuwVeR4hBDfcrNb990MFPpjGgACzAZyjdmYoMu8j3/MAEW4P0z
F5+EYJAOZ+z212y1pchNNauehORXgjrNKsZwxwKpPY9qb84E3O9KYpwfATsqOoQ6tTgr+1BR
CCwP712H+E9U5HJ0iibN/CDZFVPL1bRerHziuwuQuvE0qWg0+0SChFe9oq0KAwEkVs6ZDMB2
P16MieEEQ6StQRlvy2YBv80L1TMl3T90Bo1UUn6ARXEpcbFE0/aORH/jEXcRteb+vuik5UGY
5TsyLYdPur3TXm7XDBdmmyQVJjnJKYK9AQxj95KlXLVO38lczsFNBFRjzmoBEACyAxbvUEhd
GDGNg0JhDdezyTdN8C9BFsdxyTLnSH31NRiyp1QtuxvcqGZjb2trDVuCbIzRrgMZLVgo3upr
MIOx1CXEgmn23Zhh0EpdVHM8IKx9Z7V0r+rrpRWFE8/wQZngKYVi49PGoZj50ZEifEJ5qn/H
Nsp2+Y+bTUjDdgWMATg9DiFMyv8fvoqgNsNyrrZTnSgoLzdxr89FGHZCoSoAK8gfgFHuO54B
lI8QOfPDG9WDPJ66HCodjTlBEr/Cwq6GruxS5i2Y33YVqxvFvDa1tUtl+iJ2SWKS9kCai2DR
3BwVONJEYSDQaven/EHMlY1q8Vln3lGPsS11vSUK3QcNJjmrgYxH5KsVsf6PNRj9mp8Z1kIG
qjRx08+nnyStWC0gZH6NrYyS9rpqH3j+hA2WcI7De51L4Rv9pFwzp161mvtc6eC/GxaiUGuH
BNAVP0PY0fqvIC68p3rLIAW3f97uv4ce2RSQ7LbsPsimOeCo/5vgS6YQsj83E+AipPr09Caj
0hloj+hFoqiticNpmsxdWKoOsV0PftcQvBCCYuhKbZV9s5hjt9qn8CE86A5g5KqDf83Fxqm/
vXKgHNFHE5zgXGZnrmaf6resQzbvJHO0Fb0CcIohzrpPaL3YepcLDoCCgElGMGQjdCcSQ+Ci
FCRl0Bvyj1YZUql+ZkptgGjikQARAQABwsFfBBgBAgAJBQJUY85qAhsMAAoJEGg1lTBwyZKw
l4IQAIKHs/9po4spZDFyfDjunimEhVHqlUt7ggR1Hsl/tkvTSze8pI1P6dGp2XW6AnH1iayn
yRcoyT0ZJ+Zmm4xAH1zqKjWplzqdb/dO28qk0bPso8+1oPO8oDhLm1+tY+cOvufXkBTm+whm
+AyNTjaCRt6aSMnA/QHVGSJ8grrTJCoACVNhnXg/R0g90g8iV8Q+IBZyDkG0tBThaDdw1B2l
asInUTeb9EiVfL/Zjdg5VWiF9LL7iS+9hTeVdR09vThQ/DhVbCNxVk+DtyBHsjOKifrVsYep
WpRGBIAu3bK8eXtyvrw1igWTNs2wazJ71+0z2jMzbclKAyRHKU9JdN6Hkkgr2nPb561yjcB8
sIq1pFXKyO+nKy6SZYxOvHxCcjk2fkw6UmPU6/j/nQlj2lfOAgNVKuDLothIxzi8pndB8Jju
KktE5HJqUUMXePkAYIxEQ0mMc8Po7tuXdejgPMwgP7x65xtfEqI0RuzbUioFltsp1jUaRwQZ
MTsCeQDdjpgHsj+P2ZDeEKCbma4m6Ez/YWs4+zDm1X8uZDkZcfQlD9NldbKDJEXLIjYWo1PH
hYepSffIWPyvBMBTW2W5FRjJ4vLRrJSUoEfJuPQ3vW9Y73foyo/qFoURHO48AinGPZ7PC7TF
vUaNOTjKedrqHkaOcqB185ahG2had0xnFsDPlx5y
In-Reply-To: <20250606130737.30713-1-kai.huang@xxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

It doesn't really "enforce" anything. But, oh well, I'll just fix it up
when I apply it early next week. Here's what I'll probably apply:

x86/virt/tdx: Avoid indirect calls to TDX assembly functions

Two 'static inline' TDX helper functions (sc_retry() and
sc_retry_prerr()) take function pointer arguments which refer to
assembly functions. Normally, the compiler inlines the TDX helper,
realizes that the function pointer targets are completely static -- thus
can be resolved at compile time -- and generates direct call instructions.

But, other times (like when CONFIG_CC_OPTIMIZE_FOR_SIZE=y), the compiler
declines to inline the helpers and will instead generate indirect call
instructions.

Indirect calls to assembly functions require special annotation (for
various Control Flow Integrity mechanisms). But TDX assembly functions
lack the special annotations and can only be called directly.

Annotate both the helpers as '__always_inline' to prod the compiler into
maintaining the direct calls. There is no guarantee here, but Peter has
volunteered to report the compiler bug if this assumption ever breaks[1].

...

> This was found through randconfig testing, presumably setting
> CONFIG_CC_OPTIMIZE_FOR_SIZE=1 when objtool spewed a bunch of these:
>
> vmlinux.o: warning: objtool: tdh_mem_range_block+0x7e: relocation to
> !ENDBR: __seamcall_ret+0x0
>
> Link: https://lore.kernel.org/lkml/20250605145914.GW39944@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ [1]


Return-Path: <linux-kernel+bounces-675996-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3368341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:59:07 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9F13E3AAB6A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:58:41 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4DF7C289343;
Fri, 6 Jun 2025 15:58:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kF5cE0eV"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 937D6EEB5
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:58:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225537; cv=none; b=EIqBoEhn7EkDkaab4JCinjq74eIu73J69PVR2hYUCv5Z+fwXM4WLlK4zw73TprbtHKS7O0QAd9w56WtCxWYE/PPVzE4cZ0Rv1rtc145QgXUcq977YROzlJT+fPStZHWsR1ePZ+Bppo2p0US1Chng5lLutDBu/kCJ9EnppWhLDcY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225537; c=relaxed/simple;
bh=j5TPzlQxuBV7D2im7ELoEsLQzI/C4gvKm5ZmyQfItgg=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=hvrTZWOMwbIneveZ+sOucAOS0vSGzDNkhV6+Ucc6umg1s+6YKzNHkgzuA2pQWokYnNErBKxh4POSITgMEwRFO6Ja3hsDqv3knDkXaFZgaSbqqcyUTvFo86g5+jQ307G2VczgFKErxgoxOs4QrwI0ow22HfB507M77+WW3A/0qg4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kF5cE0eV; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25827C4CEEB;
Fri, 6 Jun 2025 15:58:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749225537;
bh=j5TPzlQxuBV7D2im7ELoEsLQzI/C4gvKm5ZmyQfItgg=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=kF5cE0eVIrQ137Xbv0R/q4SW2Otl5PALvUgLPM63wnD2r0zDoChMBeP98jlyRDuIo
0pVMMQkriDcltThKwSY5j9PnTgj44QIQg8niB/1gOATubkaEBJDegM3/TBkdTZ7dIi
UmaF0QiU4s4x89TkmB6taoN3MCK/KLYvpuIbniQTX+ffpTytkpt3KcSDER0pN8caqp
aDt8Tl3f6evYEGkxO34SmbmPA20e0WjmbwadELUt/WJ8MPiHu3gWqdn/wHrh7gd1J+
2ld6XvYIBtOEE619E+YvnCFDjwvJT8ZmYSB/KKGSmnVxn9RwKMyhbzhGE3FRAVbhqd
lufoEAUnof2FA==
Date: Fri, 6 Jun 2025 08:58:54 -0700
From: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
To: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, mingo@xxxxxxxxxx, peterz@xxxxxxxxxxxxx
Subject: Re: [RFC 00/13] objtool: Function validation tracing
Message-ID: <cqfgywnwfjnyujvgcz63drka47glxj2n7fq5xvhrt74st6xa5w@2bf4vp6duotr>
References: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20250606153440.865808-1-alexandre.chartre@xxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 05:34:27PM +0200, Alexandre Chartre wrote:
> Hi,
>
> This RFC provides two changes to objtool.
>
> - Disassemble code with libopcodes instead of running objdump
>
> objtool executes the objdump command to disassemble code. In particular,
> if objtool fails to validate a function then it will use objdump to
> disassemble the entire file which is not very helpful when processing
> a large file (like vmlinux.o).
>
> Using libopcodes provides more control about the disassembly scope and
> output, and it is possible to disassemble a single instruction or
> a single function. Now when objtool fails to validate a function it
> will disassemble that single function instead of disassembling the
> entire file.

Ah, nice to get rid of that awful objdump hack.

> - Add the --trace <function> option to trace function validation
>
> Figuring out why a function validation has failed can be difficult because
> objtool checks all code flows (including alternatives) and maintains
> instructions states (in particular call frame information).
>
> The trace option allows to follow the function validation done by objtool
> instruction per instruction, see what objtool is doing and get function
> validation information. An output example is shown below.

This is pretty freaking awesome!

I assume we could eventually build on this work to have an "objtool
disas" subcommand, which would basically be an improved "objdump -d"
which annotates alternatives and other runtime patching.

--
Josh


Return-Path: <linux-kernel+bounces-675995-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E6F6F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:59:24 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 77A291882C27
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:59:00 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 10F2BEEB5;
Fri, 6 Jun 2025 15:58:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OFTt35IO"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14D541A38F9;
Fri, 6 Jun 2025 15:58:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225515; cv=none; b=pFFbO3F7i4VRMHynhyYlXvLT77Gss/m9GV8P4lYb61POiNlbaGiy+EaPaq8o5GF4xnU45tUd6SMdpLnZGM4IvTIaadLxGmxzJzdLndptrIvrNKQGWPGUqIX4gDTYfAY+kefWJpRMRMzQI7vK9dazB0bee75RpjJC+uje7+0T+38=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225515; c=relaxed/simple;
bh=AL9QLyGrPiB1rKESmOFNM9nstIUPTufyq9r7kW0msVE=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=PyBdFD2WS0Ib28V65a6L5GtEVXaVmJfIafGpgJjGAD09wUmvKY5MDgSqfUW3zvfoVL+O7NPLLSaIhgkXCJzqXFHG7yMI/jP/Wx2rnZ0ZnhTd6sUvdeENiR5h+nUyw2Yvot7/9z9W5bbPso+HMSkvjPmSXkpClQ2GcF9ViUHgBK0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OFTt35IO; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C3C9C4CEEB;
Fri, 6 Jun 2025 15:58:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749225513;
bh=AL9QLyGrPiB1rKESmOFNM9nstIUPTufyq9r7kW0msVE=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=OFTt35IOAIC/mybfp6f42KZChNyZFl6qHw3JH5bSMseFWQa4H75nB9oZDpHrI+apS
WvY/aG3eIw4e6QK4eGF2a4YLhB51rwFsRqRsWsdCQiH1E4SDEC1MvaD9SZDYC5xShi
CyB0/xr5WMe/6zW0JcZbpjPh5ZOmGSXCIu6cv6zA=
Date: Fri, 6 Jun 2025 17:58:30 +0200
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
Cc: arnd@xxxxxxxx, conor+dt@xxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
krzk+dt@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, robh@xxxxxxxxxx
Subject: Re: [PATCH v3 2/3] misc: add driver for ST M24LR series RFID/NFC
EEPROM chips
Message-ID: <2025060657-nemeses-perpetual-c70f@gregkh>
References: <2025060650-tried-widen-4443@gregkh>
<20250606142456.3140225-1-abd.masalkhi@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606142456.3140225-1-abd.masalkhi@xxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 02:24:56PM +0000, Abd-Alrhman Masalkhi wrote:
> >> + if (unlikely(!is_power_of_2(reg_size) || reg_size > 8)) {
> >> + dev_dbg(dev,
> >> + "Invalid register size: must be a power of 2 and <= 8 bytes (%u)\n",
> >> + reg_size);
> >> + return -EIO;
> >
> > Not -EINVAL? This isn't an I/O error.
>
> The last if statement is primarily for debugging purposes. The reg_size
> value is specified internally by the driver (not user-controlled), so
> this check helps catch potential mistakes in the driver's sysfs entry
> definitions. That's why I used -EIO instead of -EINVAL, as it's not due
> to invalid user input but rather an internal misconfiguration.

But you just leaked your internal check to userspace in a potential
error code, so you must justify why userspace would ever see it and what
it should do with it :)

Just make it EINVAL please. And if this is something that can't
actually happen, don't check it at all.

> >> + for (i = 0; i < n_sss; i++) {
> >> + char *name = devm_kasprintf(dev, GFP_KERNEL, "sss%d", i);
> >> +
> >> + sss[i].reg_size = 1;
> >> + sss[i].reg_addr = i;
> >> + sss[i].attr.attr.name = name;
> >> + sss[i].attr.attr.mode = 0600;
> >> + sss[i].attr.show = m24lr_ctl_show;
> >> + sss[i].attr.store = m24lr_ctl_store;
> >> +
> >> + err = device_create_file(dev, &sss[i].attr);
> >
> > You just raced with userspace and lost. This is not how to do this,
> > please do not dynamically create attributes (hint, this should have
> > errored out as you didn't correctly initialize them), but also:
>
> I didn't fully understand where the race condition comes from. Is
> the issue caused by calling device_create_file() from within the
> probe() function, or is it due to the fact that the attributes
> are being allocated dynamically rather than defined statically?

>From calling device_create_file() at any point in time. The driver core
should be doing that, not individual drivers.

thanks,

greg k-h


Return-Path: <linux-kernel+bounces-675997-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 134CD41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 11:59:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 6A085188CDE6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 15:59:30 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CA08328937E;
Fri, 6 Jun 2025 15:59:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TsbMtZCo"
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18])
(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 45F5D288C93;
Fri, 6 Jun 2025 15:59:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225547; cv=none; b=oTIIv2ssW6vVIdWWkBxRU8fvYyyTh5aOiWRC1DxAWIHLlkaCpMwoWnDrcQeR5UxNGvU7UpRn7NSfhgRPkRrBBX5VLN927u5ZHsuFOSFfAzFoLgaKuyjpCGhFGrXrV4tsSnz9cyDdLCgYZ/RVeH8yfwStSqOx34Ga+byELgPFHsU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225547; c=relaxed/simple;
bh=DqILrp7MAmIHBHpVhQPDe90I9D1u0u26u1bnK5dDg38=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=Ca3e5TGHTMaKcz3Zb7lmS2bkeZWGBuTJgGtyjHXu2EAv6+9uK7HEPjtNzTSQDssApjR2G9qm9mYnYaXZmcHUQ5BgWXLn1itdC9ldQTdPVqYQNcR8gxmlYYc71rFL/JYoMoHU5YFZd0glW+n+yVZOc0+6nw72BIAzr4NiwtIeT0k=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TsbMtZCo; arc=none smtp.client-ip=198.175.65.18
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749225545; x=1780761545;
h=date:from:to:cc:subject:message-id:references:
mime-version:in-reply-to;
bh=DqILrp7MAmIHBHpVhQPDe90I9D1u0u26u1bnK5dDg38=;
b=TsbMtZCoduM1sxMFrHH7pI8RIMh/6aFAQUogt/xFqKsStFglorQhHQH7
MjmM9ez1vNzBxMRktIAmzZ0Eq3wzQfw7/rkhA9WLy1DI3ETnw+crSO3+J
f3/BRYF18Btquo8hFk6ruadTZ4o4c/ul78T10kc3X2QIJOGsOLHeB2dqq
XyCFJpwX33kFOBtlHKfKFqbXicP08wzejlAcQUis/7nFI/L1A+2pDjOXm
XyWLYalWduLhC6XecGAvUj6TgvoNHKK5VPb1A0mFeEtjRSiVYEXSVDjtM
J/TCwRf0gOwPAqnVXKcY+hKovQ0jC7IcUfdCyehB7OKGrZpQQpLezZXHc
w==;
X-CSE-ConnectionGUID: Aq6Y4urORS2+jJtmwBmbiQ==
X-CSE-MsgGUID: PPY+fI+3TEWLs8oZrTv3Jg==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="51525633"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="51525633"
Received: from fmviesa004.fm.intel.com ([10.60.135.144])
by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 08:59:04 -0700
X-CSE-ConnectionGUID: oZVF5Z4hQXmdJLGOaHW+Wg==
X-CSE-MsgGUID: AjXvMA79Q3u8y2LSr675og==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="151020215"
Received: from lkp-server01.sh.intel.com (HELO e8142ee1dce2) ([10.239.97.150])
by fmviesa004.fm.intel.com with ESMTP; 06 Jun 2025 08:59:01 -0700
Received: from kbuild by e8142ee1dce2 with local (Exim 4.96)
(envelope-from <lkp@xxxxxxxxx>)
id 1uNZT9-00055V-0u;
Fri, 06 Jun 2025 15:58:59 +0000
Date: Fri, 6 Jun 2025 23:58:50 +0800
From: kernel test robot <lkp@xxxxxxxxx>
To: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
Cc: oe-kbuild-all@xxxxxxxxxxxxxxx, ilpo.jarvinen@xxxxxxxxxxxxxxx,
hdegoede@xxxxxxxxxx, corbet@xxxxxxx, ikepanhc@xxxxxxxxx,
hmh@xxxxxxxxxx, W_Armin@xxxxxx, andriy.shevchenko@xxxxxxxxxxxxxxx,
linux-doc@xxxxxxxxxxxxxxx, platform-driver-x86@xxxxxxxxxxxxxxx,
ibm-acpi-devel@xxxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v2] platform/x86: Move Lenovo files into lenovo subdir
Message-ID: <202506062319.F0IpDxF6-lkp@xxxxxxxxx>
References: <20250604173702.3025074-1-mpearson-lenovo@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250604173702.3025074-1-mpearson-lenovo@xxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Mark,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20250606]
[cannot apply to v6.15]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Mark-Pearson/platform-x86-Move-Lenovo-files-into-lenovo-subdir/20250605-013934
base: linus/master
patch link: https://lore.kernel.org/r/20250604173702.3025074-1-mpearson-lenovo%40squebb.ca
patch subject: [PATCH v2] platform/x86: Move Lenovo files into lenovo subdir
config: x86_64-randconfig-078-20250606 (https://download.01.org/0day-ci/archive/20250606/202506062319.F0IpDxF6-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/202506062319.F0IpDxF6-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506062319.F0IpDxF6-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/platform/x86/lenovo/think-lmi.c: In function 'certificate_store':
>> drivers/platform/x86/lenovo/think-lmi.c:661:47: warning: '%s' directive argument is null [-Wformat-overflow=]
661 | return kasprintf(GFP_KERNEL, "%s,%s", arg1, arg2);
| ^~
drivers/platform/x86/lenovo/think-lmi.c:657:50: warning: '%s' directive argument is null [-Wformat-overflow=]
657 | return kasprintf(GFP_KERNEL, "%s,%s,%s",
| ^~


vim +661 drivers/platform/x86/lenovo/think-lmi.c

640a5fa50a42b9 drivers/platform/x86/think-lmi.c Mark Pearson 2021-11-17 652
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 653 static char *cert_command(struct tlmi_pwd_setting *setting, const char *arg1, const char *arg2)
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 654 {
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 655 /* Prepend with SVC or SMC if multicert supported */
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 656 if (tlmi_priv.pwdcfg.core.password_mode >= TLMI_PWDCFG_MODE_MULTICERT)
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 657 return kasprintf(GFP_KERNEL, "%s,%s,%s",
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 658 setting == tlmi_priv.pwd_admin ? "SVC" : "SMC",
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 659 arg1, arg2);
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 660 else
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 @661 return kasprintf(GFP_KERNEL, "%s,%s", arg1, arg2);
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 662 }
5dcb5ef125907d drivers/platform/x86/think-lmi.c Mark Pearson 2024-10-24 663

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Return-Path: <linux-kernel+bounces-675998-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id BDA9241E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:00:22 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 5AD6818830E9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:00:29 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ED207289E02;
Fri, 6 Jun 2025 16:00:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k9UA2sTy"
Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA05A28937F;
Fri, 6 Jun 2025 16:00:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.45
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225604; cv=none; b=pC72WFmPudjiyv8RTvNtypd2bxj8FPlU4FwLqMd4qgFEGRdY9syQTDsiOzBOUu9Za5blsQ/k4TQ3UDWMEK7Atgf3oZuXb6mtgc7FPuOWD//bX7l6e7ka0P7TLMTdbDQ/786QoCNFMYvbNVY3vNx0PU9ej1+6V7ms1WlOS7Swp0o=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225604; c=relaxed/simple;
bh=0dJFOIZZI3h9+CUlJttgkI830u/vDy1QTXEgLX9l6xU=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=sQ8YSrjtWrQhtuNgt0II0BODNcf4AvzgGWaf/T/VDBBPtgQYeWJncS3yJ014q0RMfnxN/rrHYXJkCLtXQlnxyZr0eWHKozYFlpV1Sv9wQOzM7XoZFXQkag9LyqTdwaqDeJJM47qjdQuU8+TKWk+3RT1OP5gzIf3iB9yfNz0LTHU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k9UA2sTy; arc=none smtp.client-ip=209.85.222.45
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-ua1-f45.google.com with SMTP id a1e0cc1a2514c-87dfe906a87so733435241.0;
Fri, 06 Jun 2025 09:00:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749225601; x=1749830401; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=0dJFOIZZI3h9+CUlJttgkI830u/vDy1QTXEgLX9l6xU=;
b=k9UA2sTygpXiiMr5DZFITuw3wrV2wyh1PV5Yt0arRjCOfauVccM6aD5By2zsT/fN0N
SV/1ygvXF4P+GfcNShRLDauYsoN0v4aa2H+pVFo7TiCEAKJk8A2fbv5Nbk/J1iAxacl8
3TwaulPXZgj/rs0sy7mKTbDbYQxzctBYXxZq7DmaRJ+df1XWi1M4VTZM9dyzCueA+UEF
Sb2CYBiejgdqd4sdhBqfKbKXAeQKSUqn+Wh3L7lt/Is7vw3S5/CF2bzWEHiD9H+7G/Xx
unqEZROhsikJC3bASkMfTTUOzBRLIhXIYypufeq50fMdcS80V+QEszoQ9t44mRbaPZqO
Hmnw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749225601; x=1749830401;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=0dJFOIZZI3h9+CUlJttgkI830u/vDy1QTXEgLX9l6xU=;
b=rawh2I2m9UuUM00VicD74gh0cU0n9mvlFf6BTLHaGGCrnBOqrTcnI+Nh/nkcXUkNvG
9bAq5+ufsXjG7xfG5M4+rnMSYkxXEOGL21ZevV4MHJJHnomFOQgh2iAAXks59jhVRvpV
ePGvyg+4kbiNbygNnm6JIrVVfe71GONiHCn1yPVej12oeaA1a3ro5DF5leWoNjUv/T1w
rg4qfUrWqyXg3O9M5G96SrmWyhWEUS4wksBN/tJok4GzyzfE3e4klbWQbLwzDcICuxzN
Hww7FmXIbAiOwPIvmpHK0w2Ag4aoGmwk37Y3q4BYys9l/bz39FqfOGHy7P6W3jYFSnqL
Q7oA==
X-Forwarded-Encrypted: i=1; AJvYcCU44jj+nuY1rIPBX7dFr1euhg7eMUd9vMRJOe4iCkYAspkfDUAUNKArrUSEfdgNlgbM3AhiDedQVy9INAHe@xxxxxxxxxxxxxxx, AJvYcCU8B0V93UQGqgTBYItprKoeSPgB4EAjCsSlbfXEOMxerWSPvN6XvEveLZxpd9/+DWjzKCEY5xER5de9EA==@vger.kernel.org, AJvYcCUsCM6NEp/TXluanTlqcrRHfeZMm4GTi3uCx5b87e6oAQDy9C3iEZX93vUPztzsWGXA8td6tc7qjgm7@xxxxxxxxxxxxxxx, AJvYcCWPLbf+5zzuVTa2KizUCJkeBXI7PeBjiek1lYDBIgHesd6Qv56nNaW0VYiCq9jom0vuIKNQ9Hp/VD0nrvjRrA4=@vger.kernel.org
X-Gm-Message-State: AOJu0YycjXjK4VXyqlVbrNT+/mYE7IAh2n947280rtG5xHpNHTzkNsac
1WZTs6BI5Vsl5kHXCYQuWQNzlyC6qrEHtmgEp868dbVZdjj12G52Rfp5tlMOqUv0qZsRCU2/bMA
xw2QhrqHZHxEAaPhG55XrY75czpxL/o0=
X-Gm-Gg: ASbGnctifktE0K3uvnVbVLUiIj772e7/+yzF4fZ10L5xC4z5u4amOfmhFkMu5Yvk/VL
/n1HkCDcuWxNoTMJbmLLSiaPYv0HU/FbtzTQ4idnwnQMFUTsmaMTbVUGBwJZBTBlQtet+RcX3b9
oo1JSMNT5chgNOzzdHAFqH4r/ojwm61Q==
X-Google-Smtp-Source: AGHT+IGIT8pKAwvT3E053ka5rCKmDZMWVRQ8M3uHmHMzX5aPj1CCrXxaJlYwiNxduBr8mvHv8BvYl+bYAcSqHDeOWjo=
X-Received: by 2002:a05:6102:fa7:b0:4e2:ecd8:a1a with SMTP id
ada2fe7eead31-4e7728cd536mr3574282137.4.1749225601602; Fri, 06 Jun 2025
09:00:01 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250605161956.3658374-1-igor.korotin.linux@xxxxxxxxx>
<20250605162726.3659792-1-igor.korotin@xxxxxxxxx> <aELyEqg0GrkC8oZY@pollux>
<CAG7QV91AWpOk7VUcE-B1MLkEQPDB0Y=zsBOBf6MhHVYh1aEGQA@xxxxxxxxxxxxxx>
<2025060635-unleveled-drowsily-a192@gregkh> <ce134894-f33e-4810-97ab-76270438fff7@xxxxxxxxxx>
In-Reply-To: <ce134894-f33e-4810-97ab-76270438fff7@xxxxxxxxxx>
From: Igor Korotin <igor.korotin.linux@xxxxxxxxx>
Date: Fri, 6 Jun 2025 16:59:49 +0100
X-Gm-Features: AX0GCFvSY0Jr_aDmFg6bKOfCHKOl-4OvqCPqVnrQ__eHQ2WfgIUMY8esXLD5Y0I
Message-ID: <CAG7QV91opwxQ=VH4A_4f8NdopW9zFuw8EnknRX1YrTpMSw5AiA@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v2 3/5] rust: driver: Add ACPI id table support to Adapter trait
To: Danilo Krummrich <dakr@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Igor Korotin <igor.korotin@xxxxxxxxx>,
Miguel Ojeda <ojeda@xxxxxxxxxx>, Alex Gaynor <alex.gaynor@xxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Saravana Kannan <saravanak@xxxxxxxxxx>, "Rafael J . Wysocki" <rafael@xxxxxxxxxx>, rust-for-linux@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, Boqun Feng <boqun.feng@xxxxxxxxx>,
Gary Guo <gary@xxxxxxxxxxx>, =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@xxxxxxxxxxxxxx>,
Benno Lossin <benno.lossin@xxxxxxxxx>, Andreas Hindborg <a.hindborg@xxxxxxxxxx>,
Alice Ryhl <aliceryhl@xxxxxxxxxx>, Trevor Gross <tmgross@xxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>,
Viresh Kumar <viresh.kumar@xxxxxxxxxx>, Wedson Almeida Filho <wedsonaf@xxxxxxxxx>,
Alex Hung <alex.hung@xxxxxxx>, Tamir Duberstein <tamird@xxxxxxxxx>,
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>, Xiangfei Ding <dingxiangfei2009@xxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 4:39=E2=80=AFPM Danilo Krummrich <dakr@xxxxxxxxxx> w=
rote:
>
> On 6/6/25 5:29 PM, Greg Kroah-Hartman wrote:
> > On Fri, Jun 06, 2025 at 03:26:13PM +0100, Igor Korotin wrote:
> >> On Fri, Jun 6, 2025 at 2:50=E2=80=AFPM Danilo Krummrich <dakr@kernel.o=
rg> wrote:
> >>> However, I don't understand why we need this and the subsequent
> >>> is_acpi_device_node() and is_of_node() checks.
> >>
> >> The idea is to avoid unnecessary table lookups when both OF and ACPI
> >> match tables are present. If we already know the fwnode type, these
> >> simple pointer comparisons (is_acpi_device_node() / is_of_node()) let
> >> us skip the irrelevant match function.
> >>
> >> Those checks are cheap (just pointer comparisons), while
> >> acpi_match_device() and of_match_device() iterate over tables.
> >>
> >> So yeah, it=E2=80=99s a bit ugly, but it can save some CPU cycles duri=
ng enumeration.
> >
> > You have loads of CPU cycles during enumeration, keep things simple
> > first, only attempt to optimize things later on if it is actually
> > measureable.
>
> I'm fine either way, I don't expect much value in optimizing this and at =
the
> same time I don't see doing it adds significant complexity either.
>
> If Greg prefers not to have this optimization to begin with, let's go wit=
hout
> it please.

I'm ok with this as well. Will remove those checks. I assume that I
don't need to align with `FwNode` abstractions in that case. Also I'll
drop `is_of_node` rust helper in v3.

Thanks for the review and your comments, guys

Cheers
Igor


Return-Path: <linux-kernel+bounces-675999-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 8776C41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:00:27 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id BFDBF179AF3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:00:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5960F28937E;
Fri, 6 Jun 2025 16:00:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PGySD9tq"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84A2B1DEFD2;
Fri, 6 Jun 2025 16:00:12 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225612; cv=none; b=RU5Bc6wrKldcs9pH2g7mjrHuCz4JHrjvf3CKUOXfWf4SvrZDiLSv+7jBaOzrzWfcQgfIt4pcxK86R8kS35nc+4MYCTe1DXJ7DQGcTJWZg173HpqrfY6Fu88V477ayAB1MwGytE3M2+ESCnWk0j85X9TB2JX7bY3NMl+CWDbS0u4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225612; c=relaxed/simple;
bh=Y1KQtPS81IExz4pchO3Uiy9RWFy+znuf0PIIHykxx+U=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=HtXjK15/LZoLkc3YOoXeakWyZJg/LjGP6b6GXCI0n60HQ5aQaC/F19f5UJlNVPzpFCPFXRs8DdQWv4Z++VOd9gAbcJWwayFdCOMonabMUXdM+bpbnnndHbMd9wwHWneIaAnak7J7QWrpQd1l8f0Jx9q1DLydgoJyv1IoUST9VGc=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PGySD9tq; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E375C4CEEB;
Fri, 6 Jun 2025 16:00:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749225612;
bh=Y1KQtPS81IExz4pchO3Uiy9RWFy+znuf0PIIHykxx+U=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=PGySD9tq4ZQpSu/Wtj4XFkBDmmsKZGnIVxxl1oj7eYsTqQuRu23KRSHoeD85Vspgy
qxr+RhnwQFbveIX9CanFdBmFn8T/0wkywf65ZQIyrbHCzJnLpH6UpTcJbS3go7IGSe
7s6DuAYrZ200X3NBJxDFBQ5CdA5SSzLA5vhHCPYcuP5/H4aPZavwJcedFv7BS53s6z
o5izOMHe7gmyuWPWE1uGR4QhhMprbnqP1t3OncMPMCS0+8Hz/10g/w9QUUSi1mRSYX
1U8CS6d3aoF3I1AUnB8P546Ro7jroNxfuLYz6CVoVtk+Jhya/c1o93fFEqxvwUvGon
bqkT0VtUHxX0Q==
Date: Fri, 6 Jun 2025 17:00:06 +0100
From: Conor Dooley <conor@xxxxxxxxxx>
To: Ben Zong-You Xie <ben717@xxxxxxxxxxxxx>
Cc: paul.walmsley@xxxxxxxxxx, palmer@xxxxxxxxxxx, aou@xxxxxxxxxxxxxxxxx,
alex@xxxxxxxx, robh@xxxxxxxxxx, krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx, tglx@xxxxxxxxxxxxx, daniel.lezcano@xxxxxxxxxx,
prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
tim609@xxxxxxxxxxxxx
Subject: Re: [PATCH v5 0/8] add Voyager board support
Message-ID: <20250606-booth-icky-b416c1827a43@spud>
References: <20250602060747.689824-1-ben717@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="XnSn4wlHT+08Cik0"
Content-Disposition: inline
In-Reply-To: <20250602060747.689824-1-ben717@xxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--XnSn4wlHT+08Cik0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 02, 2025 at 02:07:39PM +0800, Ben Zong-You Xie wrote:
> The Voyager is a 9.6=E2=80=9D x 9.6=E2=80=9D Micro ATX form factor develo=
pment board
> including Andes QiLai SoC. This patch series adds minimal device tree
> files for the QiLai SoC and the Voyager board [1].
>=20
> Now only support basic uart drivers to boot up into a basic console. Other
> features will be added later.
>=20
> [1] https://www.andestech.com/en/products-solutions/andeshape-platforms/q=
ilai-chip/

Ball is in your court now, after rc1 make a tree and get it in
linux-next, and then send a pr to soc@xxxxxxxxxx with this new content.
Perhaps the defconfig should go separately, I can take that one if you
want.

Cheers,
Conor.

> ---
> Changelog from v4 to v5:
> - Rebase the series on torvalds/master
> - Clarify the patch dependencies (2 <- 4 <- 5 <- 6) in the patch descri=
ption
>=20
> v4: https://lore.kernel.org/all/20250514095350.3765716-1-ben717@andestech=
=2Ecom/
>=20
> Changelog from v3 to v4:
> - Restore the modification to cache-sets and cache-size in patch 6
> - Do not constrain renesas,r9a07g043f-ax45mp-cache since it's independe=
nt to
> this series.
> - Delete the redundant example added by patch 6
>=20
> v3: https://lore.kernel.org/all/20250513094933.1631493-1-ben717@andestech=
=2Ecom/
>=20
> Changelog from v2 to v3:
> - Rebase the series on Conor/riscv-soc-for-next
> - Reform patch 6 as suggested by Conor
> - Modify l2_cache's compatible in qilai.dtsi due to patch 6
> - Add Conor's Acked-by tag to patch 4
> - Add Conor's Acked-by tag to patch 5
> - Add Conor's Acked-by tag to patch 9
>=20
> v2: https://lore.kernel.org/all/20250503151829.605006-5-ben717@andestech.=
com/
>=20
> Changelog from v1 to v2:
> - Add detailed descriptions to PLIC_SW and PLMT0
> - Move the aliases node and memory node from qilai.dtsi to qilai-voyage=
r.dts
> - Drop "status =3D okay" in each CPU node since the status property is =
by
> default "okay"
> - Reorder the nodes in qilai.dtsi by unit address in ascending order
> - Add myself as the maintainer of Andes's SoC tree
> - Add Rob's Reviewed-by tag to patch 2
> - Add Rob's Acked-by tag to patch 3
> - Add Rob's Acked-by tag to patch 6.
>=20
> v1: https://lore.kernel.org/all/20250407104937.315783-1-ben717@andestech.=
com/
>=20
> ---
> Ben Zong-You Xie (8):
> riscv: add Andes SoC family Kconfig support
> dt-bindings: riscv: add Andes QiLai SoC and the Voyager board bindings
> dt-bindings: interrupt-controller: add Andes QiLai PLIC
> dt-bindings: interrupt-controller: add Andes machine-level software
> interrupt controller
> dt-bindings: timer: add Andes machine timer
> riscv: dts: andes: add QiLai SoC device tree
> riscv: dts: andes: add Voyager board device tree
> riscv: defconfig: enable Andes SoC
>=20
> .../andestech,plicsw.yaml | 54 +++++
> .../sifive,plic-1.0.0.yaml | 1 +
> .../devicetree/bindings/riscv/andes.yaml | 25 +++
> .../bindings/timer/andestech,plmt0.yaml | 53 +++++
> MAINTAINERS | 9 +
> arch/riscv/Kconfig.errata | 2 +-
> arch/riscv/Kconfig.socs | 9 +
> arch/riscv/boot/dts/Makefile | 1 +
> arch/riscv/boot/dts/andes/Makefile | 2 +
> arch/riscv/boot/dts/andes/qilai-voyager.dts | 28 +++
> arch/riscv/boot/dts/andes/qilai.dtsi | 186 ++++++++++++++++++
> arch/riscv/configs/defconfig | 1 +
> 12 files changed, 370 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/devicetree/bindings/interrupt-controlle=
r/andestech,plicsw.yaml
> create mode 100644 Documentation/devicetree/bindings/riscv/andes.yaml
> create mode 100644 Documentation/devicetree/bindings/timer/andestech,plm=
t0.yaml
> create mode 100644 arch/riscv/boot/dts/andes/Makefile
> create mode 100644 arch/riscv/boot/dts/andes/qilai-voyager.dts
> create mode 100644 arch/riscv/boot/dts/andes/qilai.dtsi
>=20
> --
> 2.34.1
>=20

--XnSn4wlHT+08Cik0
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaEMQhgAKCRB4tDGHoIJi
0iR/AP9kPQhWU7yiu4elPR9CbPEUL9giMIDGnTOMdYaas3PcgwEAsiTkRJcBi9T7
Y/QETMvnZHsQfGe/qM/xmH2VNJ/ZQAE=
=6So4
-----END PGP SIGNATURE-----

--XnSn4wlHT+08Cik0--


Return-Path: <linux-kernel+bounces-676000-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id C0F7141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:00:58 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id B154E18821D1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:01:11 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 09DB1288CBC;
Fri, 6 Jun 2025 16:00:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aN/v7igt"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FBBE19D06A;
Fri, 6 Jun 2025 16:00:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225647; cv=none; b=JQSbAhwkHxIdOmtXyUs0q/NJP2NolcshPPTYkRAVExTd9mafPbIXTdyJde+vivKb9sIZQ68KGWjyOr2avQtv0D12lunt4093QmQcLS3s8sxNWp9cco0F0m6wuMDichj5Wxx6zG6zbgy6uAm3lR1lalBwueiik34aielky8d9GQU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225647; c=relaxed/simple;
bh=0+E08hRwywKhkjx7JnQt4se8cvECsmAoG8+aEI0QaTw=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=V+gHVu9XlfDjPuOPCDEXE52RoG6V3UoQ7uPaA5q3TyDJbbGz7jkkNd47EEV1GMXn1+sZcVo3c2rGwtvVR2ksyXxoECv8TqNvLJe7no83ZzlByEC8bA5SmyZIgrpOZqnI69iHX2CjUWoZm2nrJoPQCoIr++Ld070Ql9WT6AlpPvU=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aN/v7igt; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id D41F6C4CEF6;
Fri, 6 Jun 2025 16:00:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749225646;
bh=0+E08hRwywKhkjx7JnQt4se8cvECsmAoG8+aEI0QaTw=;
h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
b=aN/v7igtpEDVhwIJFRhxmY7E4gZfzp/s4XbROI0iBLJbLV+MylVl6it9hyqNkQiWg
Fjol823KWKYUP+c4P4B0Ldc3JaOCL2RUHcG6umTiCiwD2ve0ZNuRuuk8d95c4pOL8j
SB9jsu67mvFHyYraWhBQWv33/WRdXBEj5jbsoTy/k2UkluRNhoy55ThC2M8Ahk1SYj
5Keo1BaKYkYgjA9TxHzyWPHygXFTR6cOrSnIDaPI1Sb/r0CqrG7JsGjdNCylI1A39/
MfWVpv2CReJ8CXeN1A+Q8eZoL17vdRV6eiGMnvaVetJ935abpTNtMIrIpVH6SWp0SB
NiUR6Y/fmo7PQ==
Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-4074997ce2bso650153b6e.3;
Fri, 06 Jun 2025 09:00:46 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AJvYcCUFBI4OuEr0M23yJvo2SH+0HIjiYpOyZvWZl5J0Rnz1NeDSi43/9pYKxC6T25SuFRxzFgwChzseD8iLfCtd@xxxxxxxxxxxxxxx, AJvYcCUQQe9pXdosMGvRooK2J3vDWNP86dNnxZLouBEOjHvAP99kFGKxeEEOn0QTh331nDQZPVL/X+hvPuY=@vger.kernel.org, AJvYcCWP1DHMU6+aIdTXD5BcZqBD+x2FhpM0ajgHYM2MckLma8c3ZrbPouipTvv1YpXDGYLnP/+KYakdRAAFESR5Kgzwk+8=@vger.kernel.org, AJvYcCX8GJ1ptLXKF1O4sV1vZeOw10yIBBjB2CbTQrRrxySiwGSKnQ7G4mMhCHwOP4l3sHB10nq7nDAAUS4=@vger.kernel.org
X-Gm-Message-State: AOJu0YxNxsEKcLbCh4dCGqisl3st1LPfBAeZLahvFGp4DTpvW6r9uCgH
PUeLjT/cFUaKDzHQBu8jKj2gk+lJx0fCiuQ6V3AwUaqUDrrldCLjZzrcXNqtX0KKcowBbsm6S65
UxSaYHIaBgD2FVVf03Hmk7fVbiddOwm0=
X-Google-Smtp-Source: AGHT+IG+/p8dPlsG+i+bKyi4+OPGxOvAlCFygsy2kq8Yd4lHK8Rtxzkc4gi25tmt3K47CNUiAhq8jyV80f/PLw6impg=
X-Received: by 2002:a05:6808:288f:b0:402:b0f:4ccc with SMTP id
5614622812f47-409051d725bmr1988228b6e.16.1749225645925; Fri, 06 Jun 2025
09:00:45 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250606111749.3142348-1-claudiu.beznea.uj@xxxxxxxxxxxxxx> <20250606111749.3142348-2-claudiu.beznea.uj@xxxxxxxxxxxxxx>
In-Reply-To: <20250606111749.3142348-2-claudiu.beznea.uj@xxxxxxxxxxxxxx>
From: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 18:00:34 +0200
X-Gmail-Original-Message-ID: <CAJZ5v0i_Ey+OVpSZHXru=tubMaZi=y-uOh_0M6zmWZ2DqqA7Vg@xxxxxxxxxxxxxx>
X-Gm-Features: AX0GCFuO1uRWb5NWOssOUUfHKn6m_s_TDNlqKwT50_Lx4DRONBgPCZFQvedB7Bs
Message-ID: <CAJZ5v0i_Ey+OVpSZHXru=tubMaZi=y-uOh_0M6zmWZ2DqqA7Vg@xxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 1/2] PM: domains: Add devres variant for dev_pm_domain_attach()
To: Claudiu <claudiu.beznea@xxxxxxxxx>
Cc: gregkh@xxxxxxxxxxxxxxxxxxx, rafael@xxxxxxxxxx, dakr@xxxxxxxxxx,
len.brown@xxxxxxxxx, pavel@xxxxxxxxxx, ulf.hansson@xxxxxxxxxx,
jic23@xxxxxxxxxx, daniel.lezcano@xxxxxxxxxx, dmitry.torokhov@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, bhelgaas@xxxxxxxxxx,
geert@xxxxxxxxxxxxxx, linux-iio@xxxxxxxxxxxxxxx,
linux-renesas-soc@xxxxxxxxxxxxxxx, fabrizio.castro.jz@xxxxxxxxxxx,
Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 1:18=E2=80=AFPM Claudiu <claudiu.beznea@xxxxxxxxx> w=
rote:
>
> From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
>
> The dev_pm_domain_attach() function is typically used in bus code alongsi=
de
> dev_pm_domain_detach(), often following patterns like:
>
> static int bus_probe(struct device *_dev)
> {
> struct bus_driver *drv =3D to_bus_driver(dev->driver);
> struct bus_device *dev =3D to_bus_device(_dev);
> int ret;
>
> // ...
>
> ret =3D dev_pm_domain_attach(_dev, true);
> if (ret)
> return ret;
>
> if (drv->probe)
> ret =3D drv->probe(dev);
>
> // ...
> }
>
> static void bus_remove(struct device *_dev)
> {
> struct bus_driver *drv =3D to_bus_driver(dev->driver);
> struct bus_device *dev =3D to_bus_device(_dev);
>
> if (drv->remove)
> drv->remove(dev);
> dev_pm_domain_detach(_dev);
> }
>
> When the driver's probe function uses devres-managed resources that depen=
d
> on the power domain state, those resources are released later during
> device_unbind_cleanup().
>
> Releasing devres-managed resources that depend on the power domain state
> after detaching the device from its PM domain can cause failures.
>
> For example, if the driver uses devm_pm_runtime_enable() in its probe
> function, and the device's clocks are managed by the PM domain, then
> during removal the runtime PM is disabled in device_unbind_cleanup() afte=
r
> the clocks have been removed from the PM domain. It may happen that the
> devm_pm_runtime_enable() action causes the device to be runtime-resumed.

Don't use devm_pm_runtime_enable() then.

> If the driver specific runtime PM APIs access registers directly, this
> will lead to accessing device registers without clocks being enabled.
> Similar issues may occur with other devres actions that access device
> registers.
>
> Add devm_pm_domain_attach(). When replacing the dev_pm_domain_attach() an=
d
> dev_pm_domain_detach() in bus probe and bus remove, it ensures that the
> device is detached from its PM domain in device_unbind_cleanup(), only
> after all driver's devres-managed resources have been release.
>
> For flexibility, the implemented devm_pm_domain_attach() has 2 state
> arguments, one for the domain state on attach, one for the domain state o=
n
> detach.

dev_pm_domain_attach() is not part driver API and I'm not convinced at
all by the arguments above.

Thanks!

> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
> ---
>
> Changes in v3:
> - dropped devm_pm_domain_detach_off(), devm_pm_domain_detach_on()
> and use a single function devm_pm_domain_detach()
>
> Changes in v2:
> - none; this patch is new
>
> drivers/base/power/common.c | 50 +++++++++++++++++++++++++++++++++++++
> include/linux/pm_domain.h | 6 +++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
> index 781968a128ff..82ea20b343f5 100644
> --- a/drivers/base/power/common.c
> +++ b/drivers/base/power/common.c
> @@ -115,6 +115,56 @@ int dev_pm_domain_attach(struct device *dev, bool po=
wer_on)
> }
> EXPORT_SYMBOL_GPL(dev_pm_domain_attach);
>
> +/**
> + * devm_pm_domain_detach - devres action for devm_pm_domain_attach() to
> + * detach a device from its domain.
> + * @dev: device to detach.
> + * @res: indicate if the device should be powered off
> + *
> + * This function reverse the actions from devm_pm_domain_attach().
> + * It will be invoked during the remove phase from drivers implicitly.
> + */
> +static void devm_pm_domain_detach(struct device *dev, void *res)
> +{
> + bool *power_off =3D res;
> +
> + dev_pm_domain_detach(dev, *power_off);
> +}
> +
> +/**
> + * devm_pm_domain_attach - devres-enabled version of dev_pm_domain_attac=
h()
> + * @dev: Device to attach.
> + * @power_on: Use to indicate whether we should power on the device
> + * when attaching.
> + *
> + * NOTE: this will also handle calling dev_pm_domain_detach() for
> + * you during remove phase.
> + *
> + * Returns 0 on successfully attached PM domain, or a negative error cod=
e in
> + * case of a failure.
> + */
> +int devm_pm_domain_attach(struct device *dev, bool power_on)
> +{
> + bool *power_off;
> + int ret;
> +
> + power_off =3D devres_alloc(devm_pm_domain_detach, sizeof(*power_o=
ff), GFP_KERNEL);
> + if (!power_off)
> + return -ENOMEM;
> +
> + ret =3D dev_pm_domain_attach(dev, power_on);
> + if (ret) {
> + devres_free(power_off);
> + return ret;
> + }
> +
> + *power_off =3D power_on;
> + devres_add(dev, power_off);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(devm_pm_domain_attach);
> +
> /**
> * dev_pm_domain_attach_by_id - Associate a device with one of its PM do=
mains.
> * @dev: The device used to lookup the PM domain.
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 0b18160901a2..f78b6b4dd734 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -509,6 +509,7 @@ struct device *dev_pm_domain_attach_by_name(struct de=
vice *dev,
> int dev_pm_domain_attach_list(struct device *dev,
> const struct dev_pm_domain_attach_data *dat=
a,
> struct dev_pm_domain_list **list);
> +int devm_pm_domain_attach(struct device *dev, bool power_on);
> int devm_pm_domain_attach_list(struct device *dev,
> const struct dev_pm_domain_attach_data *da=
ta,
> struct dev_pm_domain_list **list);
> @@ -539,6 +540,11 @@ static inline int dev_pm_domain_attach_list(struct d=
evice *dev,
> return 0;
> }
>
> +static inline int devm_pm_domain_attach(struct device *dev, bool power_o=
n)
> +{
> + return 0;
> +}
> +
> static inline int devm_pm_domain_attach_list(struct device *dev,
> const struct dev_pm_domain_a=
ttach_data *data,
> struct dev_pm_domain_list **=
list)
> --
> 2.43.0
>


Return-Path: <linux-kernel+bounces-676001-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4B74441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:01:51 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 92E18175A5A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:01:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C6851DF749;
Fri, 6 Jun 2025 16:01:44 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PfkkAK4D"
Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4628082866;
Fri, 6 Jun 2025 16:01:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225703; cv=none; b=sw5QkmZfrww3JdmN9rj5wus6FxZIOfHtu/3g06awg8r+6xT5W+8vCVxt5SFH/n45ho2IKRESuzVOAR5Xu4C0XMTyIGSgsgPH8H5JftRbMui8UlKqLNuoi7mZ7WAYLS4fQ68knu/euIyczYnIHhW8iFq9K42802lPjkqvGD0Nmwg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225703; c=relaxed/simple;
bh=nm25pcAcVJI0cheKsvQKjVyk6CHa+YZoF+h1z7RNn5I=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=ttn2amiJECnhcBABZAhUwbiGRW2H0McvU+4x6uXDCaxnlZ4R5lw26/Ozl+6ipnD4K5LzqhqT5c+K+PoninmWBIvozRuw3jiB1zt6Z8W5UPw5U4SbJp0/ju6kzwx5kSuX6lPHCKRif+DcnNjt5rSnP4eW59wGQXw0awBAgyKhkf8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PfkkAK4D; arc=none smtp.client-ip=209.85.221.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3a51481a598so1382263f8f.3;
Fri, 06 Jun 2025 09:01:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749225700; x=1749830500; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=BUbXR0bwQGiCRtW9GFJ1y1yZl1gXhHCz0DArJw0qNw0=;
b=PfkkAK4DI3HQluxkSzfniXwNaIw6cbP93T56+KRPGNca5sryICWEUY8w59lDMXcHGv
2nnxLxXGSAWAd4nlYWDthYM3afubzbziPzi1AvCgYYJCY3scYZUgOj8Nv+v1hJJytyu8
IZ2WBge1Hx2eTFq/myY/QDyk3uUEyWyWZpA6wMM+uf+WSCaVtxK8vsTEqs8x0IgQq4mA
JnSNR6UULOBUsTcf6lwSa1q85oLorgTZZsioAu9mxUY27moawr6fP+txXvN7cPvMSkJT
tLdjnYJDMJA2d8jlZrhw3IA9zPJcIeV11ujJV0/knzoitKwOC4z9FiWtoRHsJ6GRGVOj
FfsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749225700; x=1749830500;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=BUbXR0bwQGiCRtW9GFJ1y1yZl1gXhHCz0DArJw0qNw0=;
b=mWvN0stnwmnWF9oLoMeXfTjun1InNJj1eOA4j/+Y3k6dSkrjttuwpgw+OzX3/1++Ge
N3TvQzBXfPyiy7w0X/qowwD7MGWe+kmxVxrHJvl0lts0PRpU99TZ8PV4W9KujMOy8+bL
X3GW97xvw8azTMRJko+gX4fiLiBmkN3Cr07JOOWQgEG/sI7dBZVWw0VDflZr9UtYqjf+
FXWz1cmk7giXVgO9jKD5AuA+HugpEePKxokepCBK/pIgdRae0HSpHzwP9DBNGbiZWH2Q
5Tn1aMdijO+lsb7C9GwGQvxKH5IhNpwzpYS0l3SvBYFF5yZw/WAmVsNqyK4t65d/arVY
BMjQ==
X-Forwarded-Encrypted: i=1; AJvYcCVjAkTXCuXh3vvqvP2V3GFQfSPwGbo3QzMJp2vJUYM5GU3pKF3P+a47dG5OTmsvPh5sb0qOJz6TOmiO@xxxxxxxxxxxxxxx, AJvYcCXqwTFzvsKVd3WRCugIX5in/kzvthnv+kaGp/2aStisJzmdHEfKd1xRBq2wAXOgy+8XKWlsmzBeukQ4hiIE@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzHJr1etv0SVdCseETSc5RIEa88KZIW5vRifENzfcYlH77SqT80
coj8P2gh6qwr5lEcshqHrdKU6envWCFk7JPXpKXENAVFLPMwwAzWKXUd
X-Gm-Gg: ASbGnct+ROyqT+KZOFRd6na8v+kFRA5xUPi1/POIpeYEO5YVntut8447+9+YdmdnmMQ
T1bt604DHnJ310izjBoacrj4knC6gW8gNLghW1A6tSK84fWrNmmqsMfLuxanaD0Amf7206nrdpH
BN4Mx1UrtxtdbSJShLMyCYv8yIIwCSx/N4IcYxePSWP4wjE7f4nPvAHeN2H67gfBO0YubFidnEk
ZRjjpv4+Jb1ZhA89aa/7PU+IUbpIVZGM1J5gjkXYbs9XGH6XfWQXgvBocTT2Ix5pAELESARPXXx
Xr5eHTi5GZgayKbt9hST1FHYIOWFeHbEwihqsnYlTXFRNNv10dJrtSXo3A+FbqW5TXiKcylqViB
Tf6yxfmungiD8ckzxCLl628cb
X-Google-Smtp-Source: AGHT+IEmqmuKj6FXn9i/uI9zQy+znVxChGqy5qwFVVuIhtY5rcMLHOtTf0zBBGAfuZkiaQUGnO+8Zg==
X-Received: by 2002:a5d:4fd1:0:b0:3a5:3930:f57 with SMTP id ffacd0b85a97d-3a539300f8fmr652283f8f.51.1749225700083;
Fri, 06 Jun 2025 09:01:40 -0700 (PDT)
Received: from masalkhi.. (ip-109-43-113-198.web.vodafone.de. [109.43.113.198])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45209bc6c6csm29070975e9.2.2025.06.06.09.01.38
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 09:01:39 -0700 (PDT)
From: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
To: krzk@xxxxxxxxxx
Cc: abd.masalkhi@xxxxxxxxx,
arnd@xxxxxxxx,
conor+dt@xxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx,
gregkh@xxxxxxxxxxxxxxxxxxx,
krzk+dt@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx,
robh@xxxxxxxxxx
Subject: Re: [PATCH v3 1/3] dt-bindings: eeprom: Add ST M24LR support
Date: Fri, 6 Jun 2025 15:06:41 +0000
Message-ID: <20250606150641.3140295-1-abd.masalkhi@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <8ac3c2da-2824-44fe-942c-fceb8b6f5332@xxxxxxxxxx>
References: <8ac3c2da-2824-44fe-942c-fceb8b6f5332@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Krzysztof,

thank you for the feedback.

> How did you implement this feedback:
>
> "That's not a misc device, but eeprom. Place it in appropriate directory."
> ?
>
> There is no such device as a misc device.

I will move it to the eeprom dirctory

>> + reg:
>> + description:
>> + Two I2C address, the primary for control registers, the secondary
>> + for EEPROM access.
>> + minItems: 2
>> + maxItems: 2
>
> Replace this all with items and description:
> items:
> - description: foo
> - description: bar

I will do that.


>> +
>> +required:
>> + - compatible
>> + - reg
>> +
>> +unevaluatedProperties: false
>> +
>> +examples:
>> + - |
>> + i2c {
>> + #address-cells = <1>;
>> + #size-cells = <0>;
>> +
>> + eeprom@57 {
>> + compatible = "st,m24lr04e-r";
>> + reg = <0x57>, /* primary-device */
>> + <0x53>; /* secondary-device */
>
> Where is the rest of at24 properties? Not relevant? Not correct? I had
> impression this is fully at24 compatible.

The driver does not currently accept at24-style configuration properties
(e.g., pagesize, address-width) because the EEPROM access is handled
internally using fixed parameters per device variant. Let me know if
adding support for these via DT is preferred, I'm happy to extend it
for flexibility.

Best regards,
Abd-Alrhman Masalkhi


Return-Path: <linux-kernel+bounces-676002-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 267AA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:02:03 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 73881179DA1
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:02:03 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AE9B528983D;
Fri, 6 Jun 2025 16:01:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j2BcI4Ml"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA88E82866;
Fri, 6 Jun 2025 16:01:47 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225708; cv=none; b=AuWxapbFg0uMcl0ObBoryKkE6twDCcohI7ZpQJrCJemOhNlhBh6+OHKY34qBdHGyV7qtitEG0ne07hcCtrMTfN6IpCzB4KNX89VTp7YTMamWDOYbEnAfhR9LA79SLeqDsJRnB2EiWv/mzYQ4BN/STpe0yiQKpl9J4aMhMAo0cyA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225708; c=relaxed/simple;
bh=vhVShy+skVnHFGzfDTJtn4TVEa894a3+Y2xjxqrM850=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=PWa7nzmfXSojpTC/sd7g3LitX5UCDNrBB+dB0pgG/O1AODdEOrYEl8WjXA+YZcqyHjLTnS6baX6ejPB0KvNWX3y5PivL8tWgVOTuSMBPA1qG2Qw3Q+pl6cvPEfH0c06Q/bEAFXdlj121tVec3KerQX0g7p6gGLsNA/McYFDCZU0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j2BcI4Ml; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCB77C4CEEB;
Fri, 6 Jun 2025 16:01:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749225707;
bh=vhVShy+skVnHFGzfDTJtn4TVEa894a3+Y2xjxqrM850=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=j2BcI4Mlhm7S2wN2qr+fzTsG6NZqxkE/MjmXsyG2VIRIXTUJvnYAj6v7DCMkWYQpM
9zSNy4itoSohUNXsmhyMXu+UmGtp5TGOEaPmRoVKvAk/d/fdgx8BwTx1MRCuZXVCwb
fAUHe5HmjbwdrO4Js2VMuYfTuYQYtGrIufqKnJ+RGdrFtdUOU6RGDlk3fCLGYLaWUA
LRQMDy9tjmVGux8bWFDXHfYaT7BNBEYpI3hzDpRDNR0qyvzZlEgj1OEwsNlFGmbCeq
oOa0CM32BjqEiTb/qaTKY/xPBUkxm4pZutRd3v5sL+7i8WDRpNhnNZRNBYL7Ayn17s
jZlsYvn+8Gjnw==
Date: Fri, 6 Jun 2025 17:01:42 +0100
From: Conor Dooley <conor@xxxxxxxxxx>
To: Chen Wang <unicorn_wang@xxxxxxxxxxx>
Cc: Inochi Amaoto <inochiama@xxxxxxxxx>, Han Gao <rabenda.cn@xxxxxxxxx>,
devicetree@xxxxxxxxxxxxxxx, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
Paul Walmsley <paul.walmsley@xxxxxxxxxx>,
Palmer Dabbelt <palmer@xxxxxxxxxxx>,
Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Alexandre Ghiti <alex@xxxxxxxx>,
linux-riscv@xxxxxxxxxxxxxxxxxxx, sophgo@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v2 3/3] riscv: dts: sophgo: add zfh for sg2042
Message-ID: <20250606-viable-guts-13687b1fbcdc@spud>
References: <cover.1747235487.git.rabenda.cn@xxxxxxxxx>
<104dde6002c268a39fab6fcf469adc26d49ba364.1747235487.git.rabenda.cn@xxxxxxxxx>
<MA0P287MB226290B908D3209E5C890BFAFE90A@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<CAAT7Ki-33DcA7xeBzzv1hm0wR_ebcVdux5fQxGVrLs45RbGM9A@xxxxxxxxxxxxxx>
<MA0P287MB226265FFA15A808221629848FE64A@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
<4vuneynwhmsyokkuw3wlabxij6kobl6j7bbbcymlcmsdc2hhb7@u5mhb7je74km>
<MA0P287MB226230791E82A7A4D566C224FE60A@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="9oQ+77yUoZqjb+2M"
Content-Disposition: inline
In-Reply-To: <MA0P287MB226230791E82A7A4D566C224FE60A@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--9oQ+77yUoZqjb+2M
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, May 31, 2025 at 10:49:58AM +0800, Chen Wang wrote:
>=20
> On 2025/5/31 9:34, Inochi Amaoto wrote:
> > On Tue, May 27, 2025 at 06:22:05PM +0800, Chen Wang wrote:
> > > On 2025/5/27 17:34, Han Gao wrote:
> > > > On Thu, May 15, 2025 at 9:33=E2=80=AFAM Chen Wang <unicorn_wang@out=
look.com> wrote:
> > > > > On 2025/5/14 23:15, Han Gao wrote:
> > > > > > sg2042 support Zfh ISA extension [1].
> > > > > >=20
> > > > > > Link: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resourc=
e//1737721869472/%E7%8E%84%E9%93%81C910%E4%B8%8EC920R1S6%E7%94%A8%E6%88%B7%=
E6%89%8B%E5%86%8C%28xrvm%29_20250124.pdf [1]
> > > > > >=20
> > > > > > Signed-off-by: Han Gao <rabenda.cn@xxxxxxxxx>
> > > > > > ---
> > > > > > arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi | 256 +++++++++=
+----------
> > > > > > 1 file changed, 128 insertions(+), 128 deletions(-)
> > > > > >=20
> > > > > > diff --git a/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi b/arch=
/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> > > > > > index f483f62ab0c4..8dd1a3c60bc4 100644
> > > > > > --- a/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> > > > > > +++ b/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> > > > > > @@ -256,11 +256,11 @@ core3 {
> > > > > > cpu0: cpu@0 {
> > > > > > compatible =3D "thead,c920", "riscv";
> > > > > > device_type =3D "cpu";
> > > > > > - riscv,isa =3D "rv64imafdc";
> > > > > > + riscv,isa =3D "rv64imafdc_zfh";
> > > > > Need not touch this. "riscv,isa" is deprecated and replaced by
> > > > > "riscv,isa-base" & "riscv,isa-extensions".
> > > > >=20
> > > > > And only adding zfh for this looks a bit werid.
> > > > >=20
> > > > > Actually, I plan to remove "riscv,isa" later, so please don't tou=
ch this
> > > > > from now on.
> > > > I think that since the linux kernel is the upstream for devicetree,=
it
> > > > cannot yet remove riscv, isa needs to maintain compatibility.
> > > OK, maybe it's not good to remove "riscv,isa".
> > >=20
> > > Can this patch not modify "riscv,isa", but only add something for
> > > "riscv,isa-extensions"?
> > >=20
> > I can remove this while merging the patch, is it OK for you?

> Han does not want to remove this "riscv,isa"=EF=BC=8Che said some other c=
omponents,
> such as u-boot may have dependency on this.

U-Boot shouldn't, what actually needs it, opensbi?

--9oQ+77yUoZqjb+2M
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaEMQ5gAKCRB4tDGHoIJi
0svJAP9Sj+tPyw/qgj7Nuqwdlm3h9SJL2W8YJeG/9/7t7SMLmAD/QshrFinvdV9O
0fyCldiYSrBiW7dQFbTy4jBpo492ag4=
=3AHM
-----END PGP SIGNATURE-----

--9oQ+77yUoZqjb+2M--


Return-Path: <linux-kernel+bounces-676003-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 11B3941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:02:43 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 562C73AB0A4
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:02:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 88183286897;
Fri, 6 Jun 2025 16:02:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ah0N+mt0"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5D4A19D06A;
Fri, 6 Jun 2025 16:02:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225753; cv=none; b=XShAB/UVHOSOISs9ur+4bDGdp9rakbg57XsWagaBxiz1ZYAn+XTA+l1KhFAVrAoASoZUOLMEOurwQsOaM57JU84VGqyhDNt+o5WIDvJwD3F8pK6ILQNudLSnwAmFtFU+71QwqHGkkSTMR97mHiFCXmE+6crYJZZV5e1v6GHQ5Zs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225753; c=relaxed/simple;
bh=FtkFOsUKZ50tzy1J+drSGlG/kc9vt2gh8BH5UXSXY54=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=aP6E34tzBvLHIWjt4ZXGvHS0mPJgpCwV9bvAmoQ1otwmaqa+K+cXqWxWWvjtGzzcerl0li59I3ZDcqEWZEguv8899/j5EYOGXYiCzsSJrrA+Oa2mAD2ydD3vMepRTnZbNbstLjAQkkU8fuEbanJ1AadpMbYSl4/yJPkgxeuZAHg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ah0N+mt0; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0539C4CEEB;
Fri, 6 Jun 2025 16:02:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;
s=korg; t=1749225753;
bh=FtkFOsUKZ50tzy1J+drSGlG/kc9vt2gh8BH5UXSXY54=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=ah0N+mt0bQyWUkfcpnipbskj7vUEjySkVJ0bp2NR45zIm74a94uwf0b+LiJ7UtBF7
Qa9mvMmo0XHnUroIDAd/bxSQOtwjn9+4Nf2Bm+BYTDJ0k172aNq5ZUC7I3PB6jsw3m
dtl+0Y/e8KH2I68dTn/gAa41DVeCbknazdlErEL8=
Date: Fri, 6 Jun 2025 18:02:30 +0200
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
Cc: arnd@xxxxxxxx, conor+dt@xxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx,
krzk+dt@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, robh@xxxxxxxxxx
Subject: Re: [PATCH v3 3/3] ABI: sysfs: add documentation for ST M24LR EEPROM
and control interface
Message-ID: <2025060618-errant-audible-4c52@gregkh>
References: <2025060632-luridness-carpool-bf90@gregkh>
<20250606144657.3140262-1-abd.masalkhi@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606144657.3140262-1-abd.masalkhi@xxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 06, 2025 at 02:46:57PM +0000, Abd-Alrhman Masalkhi wrote:
> Hi greg,
>
> Thanks for the feedback.
>
> >> + Behavior:
> >> + - If the password matches the internal stored value,
> >> + access to protected memory/configuration is granted
> >> + - If the password does not match the internally stored value,
> >> + it will fail silently
> >
> > Why is the kernel in the business of adding passwords to devices? That
> > feels wrong, and a way to just flood the device with a "try all the
> > values" attempt if needed.
>
> You're absolutely right, implementing password-based access in kernel
> space isn't ideal. However, this behavior is defined by the hardware
> itself. The M24LR chips require the user to "unlock" the device by writing
> a password before certain registers become writable (such as the Sector
> Security Status registors) and unfortunately, the chip does not provide
> any status or feedback to indicate whether the unlock was successful,
> which limits what the driver can safely report or validate.
>
> >> +What: /sys/bus/i2c/devices/<busnum>-<primary-addr>/sss<N>
> >> +Date: 2025-05-31
> >> +KernelVersion: 6.16
> >> +Contact: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
> >> +Description:
> >> + Read/write attribute representing the Sector Security Status
> >> + (SSS) byte for EEPROM sector <N> in the M24LR chips. Each sector
> >> + has one SSS byte, which defines I2c and RF access control via a
> >> + combination of protection and password settings.
> >> + Format:
> >> + - Read: returns a 8-bit hexadecimal value followed by a
> >> + newline
> >> + - Write: requires exactly one or two hexadecimal digits
> >> + - No "0x" prefix, whitespace, or trailing newline
> >> + - Case-insensitive
> >> +
> >> + Notes:
> >> + - Refer to the M24LR chip datasheet for full bit definitions
> >> + and usage
> >> + - Write access requires prior password authentication in I2C
> >> + mode
> >
> > How "deep" does this sysfs tree get here? This feels like the wrong api
> > for read/write to the device, just do it with a single binary file if
> > you really want a "passthrough" way to get to the hardware.
>
> The depth of the sysfs tree depends on the M24LR variant. For example,
> the M24LR04E-R has 4 sectors, resulting in 4 entries: sss0 through sss3.
>
> I understand the concern about exposing multiple sysfs entries. The
> reason for this design is that each sector has its own SSS byte, and
> separating them helps reflect the per-sector nature of the access
> control. That said, I'm open to refactoring this to expose the SSS
> area via a single binary file if that's more in line with expected
> kernel interfaces.

Who and what is going to be talking to this device through this
interface? Is this unique and special to ONLY this one chip/device or
does it fit in with all other types of this device (i.e. eeproms)? You
can't create a userspace api without actually having a user at all, so
if there is no userspace code using this, why even have this?

thanks,

greg k-h


Return-Path: <linux-kernel+bounces-676004-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 844C141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:04:26 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 059C13AA6BF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:04:04 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 940891DE2BD;
Fri, 6 Jun 2025 16:04:19 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="bsTP1r+R"
Received: from AS8PR03CU001.outbound.protection.outlook.com (mail-westeuropeazon11012034.outbound.protection.outlook.com [52.101.71.34])
(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 4ABE219D071;
Fri, 6 Jun 2025 16:04:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.71.34
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749225858; cv=fail; b=Vl313PcFtgobIDbG5O2vLEGas+QB78F93GkO8nmMRAnXKH0LqXv4nwZNPbzA5JIytzud7NFtNxY6twVaZrU6Pn2i4rV6v6PoCg3NLo+Tz4tA+UnZTI3NikRMQLQK7iVguNoSyDmoKMvoDohKPpjp6MEhvzFszYc2Ph2TIsEe9xw=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749225858; c=relaxed/simple;
bh=hg8c2ZcafLgh7IISbDqwjy3Ld4mQU+pb59/OBfCQS4I=;
h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=SL9/V67zToeq29ijdhDkDSWQw1IYtk86QVeI00Hvw7UoVhAGle6RG0pY19bkT9IFWB0JJGf1aM5F3iFTyR0b42BnFhmN5p9QsIOyxk6fTEOl1tLNv8j4BDydG3/HWNI4Y24ILxq0NWB7tY0+UhZN1aLnud6Ufd2w7fzh77KMRq0=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=bsTP1r+R; arc=fail smtp.client-ip=52.101.71.34
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=P1cIL+lZaYux/akZJnbW7M8gs+JZL+PerAb+FWzuyZAyNYJcByzs5LsoI88kZfRll7/GFolmSSP9O/HNaYQ4/Atys/HMc2duMkO1e3k5tIX0oPis9YzN5Ml0/F5WnwVb9XXUFv/RMMOC0mee6iKjEmIv2xzlS2eqsPuZFiLlURGy7Ll+dnzOVsy/dk5BfSLNjtw+XTUAOeQOPay4hlPPOQw1gHYrCoXE3vuhMtyqvp39D7QZjKIaxMOU9egxCpQCxAF6fLeJoiTNyHXnBTXhxshNamdw9OWWI5WZdttHtILCF2xPqE+ZLUj52fVG3mOxDEeEGY+gA5l6F8EEDXc6OA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=G3yFRJpNj4ljKDXeHGNibszkf+FPY81/fdf3l7w51N4=;
b=kUjLvlq2yPfbGFkepcH/s9pe/hySXgHBDbB/SZ03Gcpjv80YOyLpBMnSkvN3lyoFy22CofX7AUqtgOq7LAlOEg63whvsWSZ9AZnfpGh2NHiX826oMXm2+hWCdWiQqFAxgWuZC94AHcOkndgHzzFi6LhsDn8RXPVobQAXe/7XcZ5vTWIyqEwrFP056GYsxhNy7tnsywqbSUuZQ0zJZZtOrhhX2Dqspx/ycMK+EWWpxZ4BRBszgoXMpIdQRURgJS5D8FIx+UVjUalRNVIMDWBO0L01UgYQHa1SRCMAkLDD52DsqNQK/+xzTAC08jNTWHA+0yZRBXEKgGW4RO4ueVQi1Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=G3yFRJpNj4ljKDXeHGNibszkf+FPY81/fdf3l7w51N4=;
b=bsTP1r+R/1qrNot80a4sEtqR4rRbN0AE+KyF0SWOpe9K24cHnZU6qRWPB0ACuXzG9uEuNIPAuByOjnzHMVtPi3cNheEkq2DmC01PokEc7LjaoQEqk21us3+5+7AMAFMJqdokEfjuxkaTK5YDS/CTSVPPBSFU1BbEidfm9iOttPakadqmNE1QFssdGBsm/jXuRJQwjqE2WVW2D0h2iI4ltOcmYcd1pTLWMhplZsWk/MvrpnszWV84EgmqP1a87GRtHDvDTydfKeQulsULqFtDc0vws4lKiEAgBREet6yJzEwjlrI6//od3cZHwna3oxmNSSB7WfUe0kIcrLwoyhn4QQ==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14)
by GVXPR04MB10045.eurprd04.prod.outlook.com (2603:10a6:150:11a::10) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8769.37; Fri, 6 Jun
2025 16:04:11 +0000
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06%6]) with mapi id 15.20.8769.025; Fri, 6 Jun 2025
16:04:11 +0000
From: Frank Li <Frank.Li@xxxxxxx>
To: Linus Walleij <linus.walleij@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
linux-gpio@xxxxxxxxxxxxxxx (open list:PIN CONTROL SUBSYSTEM),
devicetree@xxxxxxxxxxxxxxx (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS),
linux-kernel@xxxxxxxxxxxxxxx (open list)
Cc: imx@xxxxxxxxxxxxxxx
Subject: [PATCH v2 1/1] dt-bindings: pinctrl: convert nxp,lpc1850-scu.txt to yaml format
Date: Fri, 6 Jun 2025 12:03:58 -0400
Message-Id: <20250606160359.1356555-1-Frank.Li@xxxxxxx>
X-Mailer: git-send-email 2.34.1
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: SJ0PR03CA0216.namprd03.prod.outlook.com
(2603:10b6:a03:39f::11) To PAXPR04MB9642.eurprd04.prod.outlook.com
(2603:10a6:102:240::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|GVXPR04MB10045:EE_
X-MS-Office365-Filtering-Correlation-Id: d6a91ef2-3dce-4cfd-570b-08dda513c6b7
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?04YluEjFDxiUr/8qtEslzW3lLMVENM9hKwQxkKTkiMyQV/Vhm/xEdjLWKtBV?=
=?us-ascii?Q?r0hqEcbmZagaUt0LR+x/uFw8kDG/Q0LlKNFkIXjFyJRQZgfX/BMGqd47JyNX?=
=?us-ascii?Q?OJV/+A8NYzpOcnthWNIukuNjfDFcOThW+W1cbv1xQJT8FyKdJiT5IvZvt46+?=
=?us-ascii?Q?Lnwxp6SpqpjwSNBhHOcWQXiLuCFzUR4Z9lg4eqaHoUdrFSyRMWLmYAE9MyX4?=
=?us-ascii?Q?LWoFLdAGFaoK3HQM0BHIY8qm79a0u+nd852lYaGMRKKDjEvH5WGOwNx3T5+R?=
=?us-ascii?Q?ECHsAJvE+RsDtwMRyY31S4i0UBC8vWi5THGBOlU6eKsu/yTnQGHVX7AaRt31?=
=?us-ascii?Q?1EsateANlUGBLLUgVNxz2WV2NQkZ+tgrI916C0ymUx2RCVzkYJC2eTn5k0JN?=
=?us-ascii?Q?tO6w7y6eoea0NO5ddsDmzz6gYp20GjbQjlTYELPw2Gz8DFCiiQ/F3JasJH4h?=
=?us-ascii?Q?zFr4lMv4L/8Fwktb050yBQRmDLstvY4Y1BsvORHgv922bnA3W0hf1lElsxbo?=
=?us-ascii?Q?ychktPg4VDkc5ohOImgYt8wU/noFMIkTiE2hCuy2VWN8Ruw8SluZ3eraSwkZ?=
=?us-ascii?Q?aise+ozlWx14Br7cGur4dAr9i70pEFga7gtNY344yHwLBXdF7nJhoJccdTlp?=
=?us-ascii?Q?6qsImnb0Yn4H/WFIQFDOmJjHv3OJbvMAszt9llsk+Pt1lN71X3ODSmBUy5CA?=
=?us-ascii?Q?zFjMnZOGv8TOhrx6OWe/9WJ1+CNflSJ7Vpvb8AxDx4pCBqEZO7P3XXRocv5c?=
=?us-ascii?Q?XiUu0illIMF/8XAAjrYoHP/KkiWnJEc+OFA+5mgAR26dQbz2IXxQ3vTbsi3t?=
=?us-ascii?Q?PNoFM14DATKkfzQzOAqusmT20wSxTQ7Uw9JU5oaEyoYdclZrlNbZZ41dQyKb?=
=?us-ascii?Q?bs07Z7+pvPnpFaTsQNxLkUIKJt2+fFyfia+1b2wcUK6BTL2391ZsxY+CYzm/?=
=?us-ascii?Q?1Y8I6w6Za6x1YRhD88+DHoUZ12KWxJDVf3mIgUhAiA+p94IpVDuq8yWkdWuW?=
=?us-ascii?Q?Mx64+wybReZGSFuMTge+APk2j42j3Mjqfglm1NLbBb/JaS0gZwc+eEX3RLiY?=
=?us-ascii?Q?Wv/+osaGE3PIEcJDOMeVN92C6dszaEjpUFlN2o+rQ8g+qGEvYjIVMvXe0Ssv?=
=?us-ascii?Q?KLmpKDIegu1iG7EmZCxAhoKqhDvBRQctxLbtps+VHYKSqaKZF6IpgocauLnV?=
=?us-ascii?Q?j5+z1ZlfdTXnCvYkL2NpX+wwQ+QzOK8LPy9WVVD8xqbqbeYc+Rx5mwIFN/gn?=
=?us-ascii?Q?gZIEBeWYIXTeIk6ly3OXeaO8yFOIlUxnleGfk1quUgpFO6VKSM+Idq6gb/Si?=
=?us-ascii?Q?lk3vvNfbNj2sdWHhzU20jlQq1VAWZG+Oa+lQ2gBdHHA23tPc8eJuSs3qerkG?=
=?us-ascii?Q?TD76lf4/d8qNged/jl9GJhUjytUP5L9rB7RITue/fsECN/e3KxzzuQJyW/lG?=
=?us-ascii?Q?N5VNxrHyGxfSBZFEpszH4Gvn7MdHr1mC?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?7ASvrZm/UEmCAtq5zJ8xJxPfzv2TKkpMcUJDYJ3Fos5+tWa8+rpK93t7ZdqR?=
=?us-ascii?Q?BWo5VhealQssHGRhC6EMvYL0s1uLybun20s/UbE69j+0ZoeJLhFbdLdR5ljn?=
=?us-ascii?Q?6qmFwE4+m+sjM7A0KdVF1Bb1lXgnzWXKx83SZon8HmOSsJI+elxsBBtBcbcT?=
=?us-ascii?Q?gwGMAq+AW5D363CT/UfGhHqdvIjCaM8j0TryCxWNnrPijtbxkep+JEVhAD/u?=
=?us-ascii?Q?ZaWM9LBUbb9MMFcaunlWRLwsfBat2ZL2a8nnQ96D7rqZT+OYOUEW17gnGtJI?=
=?us-ascii?Q?vjO8t0Yznf5xQ1cmGF7PjNEbuYTsj5L1jZtktJYW0NVL2+3X22f1Gxji0x25?=
=?us-ascii?Q?HXpxK7zhaFsvVEWVfkNODeXdy8oZUM0c8k2qCS68zEx7MMRbcg/kpgGF2r5v?=
=?us-ascii?Q?Sc3GOztZsjimfHxXqavT1Gi0/OJAmvzDnHPLCzaiAhk7GUif6Kp3d4Senmc6?=
=?us-ascii?Q?fms0YqgADW0GVuMNqOc2GwR0wbdkbvub0nuxWtKFN0NMMK+5ynpD2UlnnzZt?=
=?us-ascii?Q?TdfI3PSUdjzTBS82lywA/Kf+yV3Hjkv1cTuXKBjJgFIf9hrU03aQ6IA7e01k?=
=?us-ascii?Q?AW3dYox4mGj85DCyT6NDrFFGsUA3JuUfG2jOfQgX4PUQmznbf6dblJH55Ul7?=
=?us-ascii?Q?/XJiATjFkWXqPCK9L1Hr+3oMiAIAoDntJCjcPmxfkSebWCGQhKugTUR4ZwSG?=
=?us-ascii?Q?MGoD9zcuKguvYawp+KQiyBVUGEfpZ2WaRbZ/SFtPDcgsXT/1axlmWrovTAkD?=
=?us-ascii?Q?/T5i2jVF2NjY5n+HQtJJllY0fX9mbOTUrf5l+dLJ+/o8AfeaLqU/YzG6K8ix?=
=?us-ascii?Q?hURELXHoJSKM7f8CpTloqP2k/naKzQfVucdZGaF2dZ06wwVWFjK7q1N0Rbbn?=
=?us-ascii?Q?9HQDE82iXl1k+PAOFtmngEIUmi4XjKpezmZE9id+Af+t7MQ5tsCHFsjGEc/0?=
=?us-ascii?Q?0FQpKp4Ljo+R47JoS5TLLr49FAhhwCtymT+wHXzWkTzql3Bj8SBuu2Gyhz2y?=
=?us-ascii?Q?dPMBMxurnnhbn42C5uHPC+47h6vggoNaeq3QCO1+uWHBfR8o+O/TJ7LgpB7+?=
=?us-ascii?Q?pyHQb6cDjHGaCSS5U1YQ183R3PZ1IItNVAFrnPM999gZYp6VtL59Bluv/f7h?=
=?us-ascii?Q?qSnYNWtHWfmRTz8dLN1suBTA7kDa4nx67R2bnhy5eSRjujAGph//atrWBKKy?=
=?us-ascii?Q?RdccBDXe+nk5mK6OWeOorNo3tXBzqvUEo1V0N1bBrr52lSxbTvEzsQfaAjce?=
=?us-ascii?Q?RSbStffu4gvLvPkhWDQX2r8agfDg19kCsrf/Lx9A36rHqVD4TmpiewzzFbgp?=
=?us-ascii?Q?ENUlBrXBClAjhlIIow67FuW0mLaqgY+wHkGZ8g0XH12ICxhti2ruxeokiwsE?=
=?us-ascii?Q?MxDQKJrXYMQMRkOm3DNOLFPJjRZtvFKZnqG2Rr/M+1ITQlSfPu5FdMnE/zp+?=
=?us-ascii?Q?4o1TvROcAlcsD/X62oNBD9m4Hqu3H3W0w/9ucYuRpRbsKhL5eq/DoxYnwJF8?=
=?us-ascii?Q?qRS+jZZfXYc2OMuOoDMQ9glXMvIAq71M3mivNafRNuVgvmtc745GwYhxDnau?=
=?us-ascii?Q?o5zIJfDl40ot8Y+GomDSkgWJ7wZDWfHFl8iXhofE?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: d6a91ef2-3dce-4cfd-570b-08dda513c6b7
X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 16:04:11.5142
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: wTBfuVwn8abw2FpATyqiEogREAzp45qj+Rq/ddmWKZWZU1fIiaE2LD1K7wDxZf5710DbNYVfpxYl6Q4cf2xLzw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10045
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Convert nxp,lpc1850-scu.txt to yaml format.

Additional changes:
- keep child name *_cfg to align legancy very old platform dts file.
- remove label in examples.
- just keep one examples.

Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
---
change in v2
- drop generic pin list at top description
- fix subject miss n at vendor prefix
---
.../bindings/pinctrl/nxp,lpc1850-scu.txt | 71 -----------------
.../bindings/pinctrl/nxp,lpc1850-scu.yaml | 79 +++++++++++++++++++
2 files changed, 79 insertions(+), 71 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.txt
create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.yaml

diff --git a/Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.txt b/Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.txt
deleted file mode 100644
index bd8b0c69fa447..0000000000000
--- a/Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-NXP LPC18xx/43xx SCU pin controller Device Tree Bindings
---------------------------------------------------------
-
-Required properties:
-- compatible : Should be "nxp,lpc1850-scu"
-- reg : Address and length of the register set for the device
-- clocks : Clock specifier (see clock bindings for details)
-
-The lpc1850-scu driver uses the generic pin multiplexing and generic pin
-configuration documented in pinctrl-bindings.txt.
-
-The following generic nodes are supported:
- - function
- - pins
- - bias-disable
- - bias-pull-up
- - bias-pull-down
- - drive-strength
- - input-enable
- - input-disable
- - input-schmitt-enable
- - input-schmitt-disable
- - slew-rate
-
-NXP specific properties:
- - nxp,gpio-pin-interrupt : Assign pin to gpio pin interrupt controller
- irq number 0 to 7. See example below.
-
-Not all pins support all properties so either refer to the NXP 1850/4350
-user manual or the pin table in the pinctrl-lpc18xx driver for supported
-pin properties.
-
-Example:
-pinctrl: pinctrl@40086000 {
- compatible = "nxp,lpc1850-scu";
- reg = <0x40086000 0x1000>;
- clocks = <&ccu1 CLK_CPU_SCU>;
-
- i2c0_pins: i2c0-pins {
- i2c0_pins_cfg {
- pins = "i2c0_scl", "i2c0_sda";
- function = "i2c0";
- input-enable;
- };
- };
-
- uart0_pins: uart0-pins {
- uart0_rx_cfg {
- pins = "pf_11";
- function = "uart0";
- bias-disable;
- input-enable;
- };
-
- uart0_tx_cfg {
- pins = "pf_10";
- function = "uart0";
- bias-disable;
- };
- };
-
- gpio_joystick_pins: gpio-joystick-pins {
- gpio_joystick_1_cfg {
- pins = "p9_0";
- function = "gpio";
- nxp,gpio-pin-interrupt = <0>;
- input-enable;
- bias-disable;
- };
- };
-};
diff --git a/Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.yaml b/Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.yaml
new file mode 100644
index 0000000000000..11f41359b5c8b
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.yaml
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/nxp,lpc1850-scu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP LPC18xx/43xx SCU pin controller
+
+description:
+ Not all pins support all pin generic node properties so either refer to
+ the NXP 1850/4350 user manual or the pin table in the pinctrl-lpc18xx
+ driver for supported pin properties.
+
+maintainers:
+ - Frank Li <Frank.Li@xxxxxxx>
+
+properties:
+ compatible:
+ const: nxp,lpc1850-scu
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+patternProperties:
+ '-pins$':
+ type: object
+ additionalProperties: false
+
+ patternProperties:
+ '_cfg$':
+ type: object
+
+ allOf:
+ - $ref: pincfg-node.yaml#
+ - $ref: pinmux-node.yaml#
+
+ unevaluatedProperties: false
+
+ properties:
+ nxp,gpio-pin-interrupt:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ minimum: 0
+ maximum: 7
+ description:
+ Assign pin to gpio pin interrupt controller
+ irq number 0 to 7. See example below.
+
+required:
+ - compatible
+ - reg
+ - clocks
+
+allOf:
+ - $ref: pinctrl.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/lpc18xx-ccu.h>
+
+ pinctrl@40086000 {
+ compatible = "nxp,lpc1850-scu";
+ reg = <0x40086000 0x1000>;
+ clocks = <&ccu1 CLK_CPU_SCU>;
+
+ gpio-joystick-pins {
+ gpio-joystick-1_cfg {
+ pins = "p9_0";
+ function = "gpio";
+ nxp,gpio-pin-interrupt = <0>;
+ input-enable;
+ bias-disable;
+ };
+ };
+ };
--
2.34.1



Return-Path: <linux-kernel+bounces-676005-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AB82341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:07:58 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id EE10D162301
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:07:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E3E3289832;
Fri, 6 Jun 2025 16:07:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NmV6czw6"
Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0A5314AD2B;
Fri, 6 Jun 2025 16:07:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226059; cv=none; b=rTFIzEzBYYHMPAJ/Y4VPWEDVUpO/E8TKzU7wfZ23Klwfwoh/+muaVftgUrzdp2eE37ZgwvvVlGxvt8awRBs6s58G74+tc1Ff8T0uK3EcnhPTEWFuTm6GHFxvRH2b21Oq3OkR53RScQIwooxEwaBJVEielpdi+w0ABJPp2/QjqB0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226059; c=relaxed/simple;
bh=aCBYs3HYbqHCtSKb89ZiDyardqdxI2f1i3HiuFqwWtE=;
h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TqvAHktPJv8ke2iqPbNuNMbblq0nS5RJ3dr/ZHJNKnal+4B1AoF1SRdbu2H44b9Zmwn4B9qN5pHi+AUQi/9IpN/P1/rtENpYX3DCyRxsBeKsku8+OkFXvP+RluTSEHcSZnQLlDHLF8JuxIsajwgH6MzyWCbBXEgTAkEBgMF46Zo=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NmV6czw6; arc=none smtp.client-ip=209.85.128.50
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-450cfb6a794so15901545e9.1;
Fri, 06 Jun 2025 09:07:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749226056; x=1749830856; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=GmxqTl8zXhUJWzbEhSbM4iH/Woj92FmKhTvp/ZOVPhY=;
b=NmV6czw6ejLXnlWyTEEJFLctsgsE/QRFzEzZJ8WwO984vySQX34oUffkyLsc6t6Efq
73Muksj0CijOTRtE+qZAATBcYWeE3jxF2nY7wgyHsu++ZeYUukVZ5RlEn6fyTMiLaPRI
yYRsOqUtOKlGj0kRkN9pi84gx1+FOIe7NhiIi5Gdd7YirbAqY5VqDyc3l3Z3bl4+cIQy
vbYF5iDIBfNlD8ZD8h9F4N1KDI4VKarkkc8+yHaoNG5Jg+WHy3w5no8xJ+XDF9kKDkPa
RsD+2cwfzflvUgrbOXqIUfw/I93pQwKCKZ+5aKutRcfGH/+L1lcoTeUo2L5JHNk1LUiB
Lo/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226056; x=1749830856;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=GmxqTl8zXhUJWzbEhSbM4iH/Woj92FmKhTvp/ZOVPhY=;
b=KyEaaHXnIe3aawiPOyFxLS3tuVMXUDr5hfS4gzKKJSJEpaxfZH6Af/suu5Y2ZyFI5G
x9o4m9otwMGwWbjvdUjUbnt5UsLkvl7Vx2PtAT9I0ZFK25TP+xzSPtIQY8II9kDoY8BJ
8ksWa49eHYgQjILcwvHvEoO7bpBLk5gj6lrmYJvqHOD+h1i3J9C59joIpIQ3TDZ5KAsz
1/GIrvMaHnxPQjR5x6IiBZFXE+iXO63wXUJbYFDUQSgTQTEkqsY+Ko4FfIvPYP6i0UZt
ttQiN6OsAv4hdLnUejfhFH2sOUlemy2Z3IvByYHe2GtxQzqhwjRF4Ed688yrewRegLXE
Wcsg==
X-Forwarded-Encrypted: i=1; AJvYcCWNtX43m4eFTlwqHzxI+FbBbZPAyFJQUOBVGf1akfG+PvIRajN09nnN+Uce5QHXgLmP5iKy/aj3IH6n6Ac=@vger.kernel.org, AJvYcCWyDxNGmDWQoQaGBKLDgUof0MfeTeXQ4Y78u3Po+srRClJqvTmlHUbyX1AqOgR1Apb1JQ/6VXkf@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YwByEYvl8iUMquLOS1EcEZZHNCe9fXAy8nNiY3W+3g6tGb0Yz1L
NdKMi7r6BGfLaa2zFq3CJP/t+C/VMux9QTQsK/I1pY8jr2MupcBLweiYIcpx9g==
X-Gm-Gg: ASbGncsAzQx1T7aOgNxM3PEsbZ5T98tVGCtLdsaxyWnmi2CPTDbUbtwUmWwZ0960mSQ
/JtKC4ZtT+G7vABrRNqQRPH4jUA9+VR6+yoCH1D6VSG1qxbr5a5idX18Fy2k1fA9LtfIX/K9yK5
P0uu8Ihn+upWWZw7hsuM0u12ZDjUtoiXd03k+zvLQgC/q2f+tq2aGDGbcI54r65R/qs0s0oLRjx
SsrrFOfWuTvLkZft8QRsLKyhQ94L6RR7ah/O8vdsrc/u9a2Hym5WIRM+jrylSNwQ9JIJJ/a4Mmn
cMoAB/CFwBiHZwCuM0PrJxsigMg6gZSC17cqy5uSEIikUzKnuxurI3KYtxxdnLw=
X-Google-Smtp-Source: AGHT+IHSPmMAHUVKafg9JMqrfsTW9IVMgChgGgQ5N7vYRn20mw+68UMyYTnoSjJ3+qTqY0HgNX2N0A==
X-Received: by 2002:a05:600c:a49:b0:43c:fceb:91a with SMTP id 5b1f17b1804b1-452013512a3mr41720205e9.11.1749226055624;
Fri, 06 Jun 2025 09:07:35 -0700 (PDT)
Received: from qasdev.Home ([2a02:c7c:6696:8300:44e7:a1ae:b1f1:d5a4])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45209ce458bsm28732025e9.15.2025.06.06.09.07.34
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 09:07:35 -0700 (PDT)
From: Qasim Ijaz <qasdev00@xxxxxxxxx>
To: andrew+netdev@xxxxxxx,
davem@xxxxxxxxxxxxx,
edumazet@xxxxxxxxxx,
kuba@xxxxxxxxxx,
pabeni@xxxxxxxxxx
Cc: linux-usb@xxxxxxxxxxxxxxx,
netdev@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] net: ch9200: use BIT macro for bitmask constants
Date: Fri, 6 Jun 2025 17:07:23 +0100
Message-Id: <20250606160723.12679-1-qasdev00@xxxxxxxxx>
X-Mailer: git-send-email 2.39.5
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Use the BIT() macro for bitmask constants.

Signed-off-by: Qasim Ijaz <qasdev00@xxxxxxxxx>
---
drivers/net/usb/ch9200.c | 50 ++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/net/usb/ch9200.c b/drivers/net/usb/ch9200.c
index a206ffa76f1b..bfe27a7dcbb4 100644
--- a/drivers/net/usb/ch9200.c
+++ b/drivers/net/usb/ch9200.c
@@ -59,42 +59,42 @@
*
* Note: bits 13 and 15 are reserved
*/
-#define LOOPBACK (0x01 << 14)
-#define BASE100X (0x01 << 12)
-#define MBPS_10 (0x01 << 11)
-#define DUPLEX_MODE (0x01 << 10)
-#define PAUSE_FRAME (0x01 << 9)
-#define PROMISCUOUS (0x01 << 8)
-#define MULTICAST (0x01 << 7)
-#define BROADCAST (0x01 << 6)
-#define HASH (0x01 << 5)
-#define APPEND_PAD (0x01 << 4)
-#define APPEND_CRC (0x01 << 3)
-#define TRANSMITTER_ACTION (0x01 << 2)
-#define RECEIVER_ACTION (0x01 << 1)
-#define DMA_ACTION (0x01 << 0)
+#define LOOPBACK BIT(14)
+#define BASE100X BIT(12)
+#define MBPS_10 BIT(11)
+#define DUPLEX_MODE BIT(10)
+#define PAUSE_FRAME BIT(9)
+#define PROMISCUOUS BIT(8)
+#define MULTICAST BIT(7)
+#define BROADCAST BIT(6)
+#define HASH BIT(5)
+#define APPEND_PAD BIT(4)
+#define APPEND_CRC BIT(3)
+#define TRANSMITTER_ACTION BIT(2)
+#define RECEIVER_ACTION BIT(1)
+#define DMA_ACTION BIT(0)

/* Status register bits
*
* Note: bits 7-15 are reserved
*/
-#define ALIGNMENT (0x01 << 6)
-#define FIFO_OVER_RUN (0x01 << 5)
-#define FIFO_UNDER_RUN (0x01 << 4)
-#define RX_ERROR (0x01 << 3)
-#define RX_COMPLETE (0x01 << 2)
-#define TX_ERROR (0x01 << 1)
-#define TX_COMPLETE (0x01 << 0)
+#define ALIGNMENT BIT(6)
+#define FIFO_OVER_RUN BIT(5)
+#define FIFO_UNDER_RUN BIT(4)
+#define RX_ERROR BIT(3)
+#define RX_COMPLETE BIT(2)
+#define TX_ERROR BIT(1)
+#define TX_COMPLETE BIT(0)

/* FIFO depth register bits
*
* Note: bits 6 and 14 are reserved
*/

-#define ETH_TXBD (0x01 << 15)
-#define ETN_TX_FIFO_DEPTH (0x01 << 8)
-#define ETH_RXBD (0x01 << 7)
-#define ETH_RX_FIFO_DEPTH (0x01 << 0)
+#define ETH_TXBD BIT(15)
+#define ETN_TX_FIFO_DEPTH BIT(8)
+#define ETH_RXBD BIT(7)
+#define ETH_RX_FIFO_DEPTH BIT(0)

static int control_read(struct usbnet *dev,
unsigned char request, unsigned short value,
--
2.39.5



Return-Path: <linux-kernel+bounces-676006-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D036F41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:08:56 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id A15273AF12A
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:08:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BF79B289820;
Fri, 6 Jun 2025 16:08:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AF+/+ynG"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 075211B040D;
Fri, 6 Jun 2025 16:08:49 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226130; cv=none; b=pm0RnuPQkXmA5T0UnH2SBh7YvfbqNe4cOQF3CUsfN3aVR0F/mtoGV0o3r+cDn38qRqmdStdF9xznrYwsKomC+0nLCX6brDVI1u77Pj87dofwcSW3J2gV23TCI6FuYzB2zo3dyTX0Y0WhwBgq4KxM/QAqE9CTLN8tANab5mKWn9A=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226130; c=relaxed/simple;
bh=m2TJ06NSfnjbzVgJp7+Aa4QRI/goAHsiXLyozAXhKBc=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=dHeW7jUV0Sbl8CB16bNMmVQDTLiPcGEhadPi5he0sriMhaB58EPuib8xoSJxvtV+ZD3ta2J/w+7zljg9E2xm4IrTR43RGfCM4orzwDyZWWhTk++RcjcLNo7fB1hE+GvpWmUNhlOAeA7dnuTleWSadvmzfhLj5jaAbmdmhVyBg9M=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AF+/+ynG; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9CF1C4CEEB;
Fri, 6 Jun 2025 16:08:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749226129;
bh=m2TJ06NSfnjbzVgJp7+Aa4QRI/goAHsiXLyozAXhKBc=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=AF+/+ynGBC9CqRuCphqPdWg19oKQBNefs5Uo86usrjuiyCzqXTz3arq/QRBB2kE++
WBYvqNa7gNTEV/V0/yaRnCRPEvR/T2etKdB1i7c6cdn3/OLhGg4/x+8NXs/Twzk5ID
5sidnesVZvfKDRX5IaC1qbNkEeLXxgJ8Ra40cCWABoVBFMUJEl5GME7FLU36gpRaaf
hLQScvfH7On4uCXpvL98u8/TyVLM8jvaqK0/WtemhWMzGZ+xlvH/LSvj7pQv64QrR+
2IZ1njtV5REZXtoj6KOUOcAh2Lirj9gyQRkJOxdrDNHCAaSH+UUJq+xn2MIXBWlOVK
nUabw3G++wPVQ==
Date: Fri, 6 Jun 2025 17:08:45 +0100
From: Conor Dooley <conor@xxxxxxxxxx>
To: Jorge Marques <jorge.marques@xxxxxxxxxx>
Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>,
Frank Li <Frank.Li@xxxxxxx>, Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>, linux-i3c@xxxxxxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v2 1/2] dt-bindings: i3c: Add adi-i3c-master
Message-ID: <20250606-sliver-freeing-d01268258c25@spud>
References: <20250606-adi-i3c-master-v2-0-e68b9aad2630@xxxxxxxxxx>
<20250606-adi-i3c-master-v2-1-e68b9aad2630@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="6hQ4mkac1n7o3C5/"
Content-Disposition: inline
In-Reply-To: <20250606-adi-i3c-master-v2-1-e68b9aad2630@xxxxxxxxxx>
X-Spam-Status: No, score=-1.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLACK
autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--6hQ4mkac1n7o3C5/
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jun 06, 2025 at 03:21:02PM +0200, Jorge Marques wrote:
> Add bindings doc for ADI I3C Controller IP core, a FPGA synthesizable IP
> core that implements the MIPI I3C Basic controller specification.
>=20
> Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
> ---
> .../devicetree/bindings/i3c/adi,i3c-master.yaml | 63 ++++++++++++++++=
++++++
> MAINTAINERS | 5 ++
> 2 files changed, 68 insertions(+)
>=20
> diff --git a/Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml b/=
Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..e7fae394ad8fd4143eb1fffb9=
591a30a2d6cc6ac
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
> @@ -0,0 +1,63 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/i3c/adi,i3c-master.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices I3C Controller
> +
> +description: |
> + The ADI I3C controller implements a subset of the I3C-basic specificat=
ion to
> + interface I3C and I2C peripherals [1].
> +
> + [1] https://analogdevicesinc.github.io/hdl/library/i3c_controller
> +
> +maintainers:
> + - Jorge Marques <jorge.marques@xxxxxxxxxx>
> +
> +properties:
> + compatible:
> + const: adi,i3c-master

Seeing this with no versioning info is pretty suspect.
The adi spi, pwm, axi-dmac etc all have versioning info, please try to
emulate that.

Otherwise, I think this is okay.

Cheers,
Conor.

> +
> + reg:
> + maxItems: 1
> +
> + clocks:
> + minItems: 1
> + items:
> + - description: The AXI interconnect clock.
> + - description: The I3C controller clock.
> +
> + clock-names:
> + items:
> + - const: axi
> + - const: i3c
> +
> + interrupts:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> + - clocks
> + - clock-names
> + - interrupts
> +
> +allOf:
> + - $ref: i3c.yaml#
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + i3c@44a00000 {
> + compatible =3D "adi,i3c-master";
> + reg =3D <0x44a00000 0x1000>;
> + interrupts =3D <0 56 4>;
> + clocks =3D <&clkc 15>, <&clkc 15>;
> + clock-names =3D "axi", "i3c";
> + #address-cells =3D <3>;
> + #size-cells =3D <0>;
> +
> + /* I3C and I2C devices */
> + };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 96b82704950184bd71623ff41fc4df31e4c7fe87..6f56e17dcecf902c6812827c1=
ec3e067c65e9894 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11243,6 +11243,11 @@ S: Maintained
> F: Documentation/devicetree/bindings/i3c/aspeed,ast2600-i3c.yaml
> F: drivers/i3c/master/ast2600-i3c-master.c
> =20
> +I3C DRIVER FOR ANALOG DEVICES I3C CONTROLLER IP
> +M: Jorge Marques <jorge.marques@xxxxxxxxxx>
> +S: Maintained
> +F: Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml
> +
> I3C DRIVER FOR CADENCE I3C MASTER IP
> M: Przemys=C5=82aw Gaj <pgaj@xxxxxxxxxxx>
> S: Maintained
>=20
> --=20
> 2.43.0
>=20

--6hQ4mkac1n7o3C5/
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaEMSjQAKCRB4tDGHoIJi
0rbTAP4spTJrUASLewamc2NSPCBtIjPY8qbsTcW2CmsKLmo9OwEAlhaoy3iBc6BX
xk8rWner/IjjAMNN64diVOneBUcjbgE=
=gjg3
-----END PGP SIGNATURE-----

--6hQ4mkac1n7o3C5/--


Return-Path: <linux-kernel+bounces-676007-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 723F841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:10:18 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 829D216B0BE
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:10:19 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1881D28982A;
Fri, 6 Jun 2025 16:10:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WUI86Mlg"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7])
(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 6C9D528540B;
Fri, 6 Jun 2025 16:10:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226209; cv=none; b=ACrP+aRZ5h/OuSMteK6a60Npxcz9XzSGPIl9Hjl3ranCRbN/YidZOfEyxGcl636Qoy6GNL7fRV0zdtrgTbIq3WnNTe+aPAxHIYzKpy56rkl8aGyiP+uSuj5+eDkc6ZWjtuU4w4AQaVZQCsO9jQ3DkZHKLuugw/aJaWxTC6+DpJ0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226209; c=relaxed/simple;
bh=+IX4WKBZZKukb5l31BrwLrifavSSKeTEFgSJhIO2aPo=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=ANII8rMjBhf3KN2OVKakR8LP7NLcl61efaffkGz5WskCj1G6e7hT7dMDMYCHYk5c9mAMrEC79aiQo9HP0lOM+EQ+2lqFor+1KEiMyofXxPsquLQny+AIjOT2uAl9l8Es1NfzRSvs+IsLXgMHtcniw9KLXkoh5C4nrStxO49dhjM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WUI86Mlg; arc=none smtp.client-ip=192.198.163.7
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749226207; x=1780762207;
h=date:from:to:cc:subject:message-id:references:
mime-version:in-reply-to;
bh=+IX4WKBZZKukb5l31BrwLrifavSSKeTEFgSJhIO2aPo=;
b=WUI86MlgIgMVk1BknhGdq//F+O+VPlhooHMZb6m7EJ6twl1ICg9rLP1H
+Jg0VG9zIe6p2Ft9QsJtIBbq6sK2Ws89+9/Ah1ZhWW0dQv06aOjgRth5S
k/Pwi+w4OosX1xdVBt8cpCDYCKgTkokik4SivGGN7kRTR2x2Wu1+aFje5
GM8Wa6/Z3S0zE6XmS++GcfbTRJWfkYfwC60EpYYWFELGbKI9nOUgUPWbD
yAM5+GcgSWwa9BzSnnZPggd/G2Gdc3Er0UCpW46+qmAGVxb8UN9mSs+SC
1uwIm9V33D8NZZHsW8jCZPvf3pSBoFlHWj6S4p3ieMyJ0+FbYlKLh7/Dt
w==;
X-CSE-ConnectionGUID: 69Uz32lHSWW61d6+jnMi1w==
X-CSE-MsgGUID: iAUI6EraQLGf/9rFrw2rQA==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="76777635"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="76777635"
Received: from fmviesa007.fm.intel.com ([10.60.135.147])
by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 09:10:07 -0700
X-CSE-ConnectionGUID: nyWXBveVRTC3UmUgbte1Lg==
X-CSE-MsgGUID: JZH4q7TNQBStGKrcbMx7Sg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="145798292"
Received: from lkp-server01.sh.intel.com (HELO e8142ee1dce2) ([10.239.97.150])
by fmviesa007.fm.intel.com with ESMTP; 06 Jun 2025 09:10:02 -0700
Received: from kbuild by e8142ee1dce2 with local (Exim 4.96)
(envelope-from <lkp@xxxxxxxxx>)
id 1uNZdo-00056d-2U;
Fri, 06 Jun 2025 16:10:00 +0000
Date: Sat, 7 Jun 2025 00:09:04 +0800
From: kernel test robot <lkp@xxxxxxxxx>
To: Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx>,
Peter Zijlstra <peterz@xxxxxxxxxxxxx>,
Ingo Molnar <mingo@xxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>,
Boqun Feng <boqun.feng@xxxxxxxxx>, Waiman Long <longman@xxxxxxxxxx>,
Kees Cook <kees@xxxxxxxxxx>,
Joel Granados <joel.granados@xxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: oe-kbuild-all@xxxxxxxxxxxxxxx,
Linux Memory Management List <linux-mm@xxxxxxxxx>,
Konstantin Khorenko <khorenko@xxxxxxxxxxxxx>,
Denis Lunev <den@xxxxxxxxxxxxx>,
Aleksandr Mikhalitsyn <aleksandr.mikhalitsyn@xxxxxxxxxxxxx>,
Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx>,
linux-kernel@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx,
kernel@xxxxxxxxxx
Subject: Re: [PATCH] locking: detect spin_lock_irq() call with disabled
interrupts
Message-ID: <202506062318.7g54PAh3-lkp@xxxxxxxxx>
References: <20250606095741.46775-1-ptikhomirov@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20250606095741.46775-1-ptikhomirov@xxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Pavel,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/locking/core]
[also build test ERROR on sysctl/sysctl-next akpm-mm/mm-nonmm-unstable tip/master linus/master v6.15 next-20250606]
[cannot apply to mcgrof/sysctl-next tip/auto-latest]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Pavel-Tikhomirov/locking-detect-spin_lock_irq-call-with-disabled-interrupts/20250606-175911
base: tip/locking/core
patch link: https://lore.kernel.org/r/20250606095741.46775-1-ptikhomirov%40virtuozzo.com
patch subject: [PATCH] locking: detect spin_lock_irq() call with disabled interrupts
config: riscv-randconfig-002-20250606 (https://download.01.org/0day-ci/archive/20250606/202506062318.7g54PAh3-lkp@xxxxxxxxx/config)
compiler: riscv64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/202506062318.7g54PAh3-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506062318.7g54PAh3-lkp@xxxxxxxxx/

All error/warnings (new ones prefixed by >>):

In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from arch/riscv/kernel/asm-offsets.c:8:
>> include/linux/spinlock.h:375:1: warning: data definition has no type or storage class
DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT,
^~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock.h:375:1: error: type defaults to 'int' in declaration of 'DECLARE_STATIC_KEY_MAYBE' [-Werror=implicit-int]
>> include/linux/spinlock.h:376:5: warning: parameter names (without types) in function declaration
debug_spin_lock_irq_with_disabled_interrupts);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/spinlock.h: In function 'spin_lock_irq':
>> include/linux/spinlock.h:382:6: error: implicit declaration of function 'static_branch_unlikely' [-Werror=implicit-function-declaration]
if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock.h:382:30: error: 'debug_spin_lock_irq_with_disabled_interrupts' undeclared (first use in this function)
if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/spinlock.h:382:30: note: each undeclared identifier is reported only once for each function it appears in
>> include/linux/spinlock.h:384:4: error: implicit declaration of function 'static_branch_disable'; did you mean 'stack_trace_save'? [-Werror=implicit-function-declaration]
static_branch_disable(&debug_spin_lock_irq_with_disabled_interrupts);
^~~~~~~~~~~~~~~~~~~~~
stack_trace_save
include/linux/spinlock.h: In function 'spin_unlock_irq':
include/linux/spinlock.h:415:30: error: 'debug_spin_lock_irq_with_disabled_interrupts' undeclared (first use in this function)
if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:98: arch/riscv/kernel/asm-offsets.s] Error 1 shuffle=2202685202
make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1275: prepare0] Error 2 shuffle=2202685202
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=2202685202
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=2202685202
make: Target 'prepare' not remade because of errors.


vim +375 include/linux/spinlock.h

373
374 #ifdef CONFIG_DEBUG_SPINLOCK
> 375 DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT,
> 376 debug_spin_lock_irq_with_disabled_interrupts);
377 #endif
378
379 static __always_inline void spin_lock_irq(spinlock_t *lock)
380 {
381 #ifdef CONFIG_DEBUG_SPINLOCK
> 382 if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
383 if (raw_irqs_disabled()) {
> 384 static_branch_disable(&debug_spin_lock_irq_with_disabled_interrupts);
385 WARN(1, "spin_lock_irq() called with irqs disabled!\n");
386 }
387 }
388 #endif
389 raw_spin_lock_irq(&lock->rlock);
390 }
391

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Return-Path: <linux-kernel+bounces-676008-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 3E12A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:11:17 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7B90E16A15C
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:11:18 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ACB23289372;
Fri, 6 Jun 2025 16:11:11 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="gjjAtE1N"
Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2068.outbound.protection.outlook.com [40.107.94.68])
(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 3366B1A38F9;
Fri, 6 Jun 2025 16:11:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.68
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226270; cv=fail; b=JaHzuqsyvM2LrTs3sG8p+zJqMO2Gk8x7RQZwG7hbyKBMPD4L3kVsxhTYVwlCBySLssP/V0Xf4g8KC/05pZSYjWI6i3dBfffpXfuJ7kV92s7x11qU3P2scy4O7HORN0aPalqgLFrtDJt5n7pUgDCuMdFAoEwovZrvZLakn9gJUCs=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226270; c=relaxed/simple;
bh=PxOPp+dTfMwP6HOSkWnSpYp3JTDUt2QTOgRWSeDxfy0=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
Content-Type:MIME-Version; b=iAPK9FbyxCJUE9Uo6tNsh7/IxtJU1AUX/JA0nSVJJ72b4BUt65/B4h1lt3fMTrUIc9IpIW8jtPXbg3cuXs5ZJfFKmG9OJtjdwMaGdHLbGOJT3DtFVCftA7ZcFEgEyg9BCqH5LC26t0zhWxI90DREyvP6L2OlMKglr5hCPFoWxmI=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=gjjAtE1N; arc=fail smtp.client-ip=40.107.94.68
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=B/pwwt5LB2twGYEcQpxU5nOWl8m5n+XinMfBrZbAhtdBts9tFIoo8VOJVfA00Lv4Xc2lI690i/2oTleS8PRs6jcmXEnxZoDBKNFhEDUKA0dSXi0qfUnFlDZMZ//1737bGvsDfNrDt1gszYbrUWgAqJJQJeInovMnA0uZHxx8HlgYD4ZisXOUqjLOdvU0L0HT+3h5xra9m5BJwiWdcuYaPBTWgDctsb8vgElWWGVgDtw1Zuu9s2+Ct+fy3fiQPRpSF/aBiJgJxtcf9izUaepb6MryJRqV+uA6molup5pwqHbYdrA4rbFrWtOFGMKZ19VuMm3w9CRFQGvQZVIikyT/jA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=L3EAxmgg/6atJ6qXXkw0VvpEAxbaN1VBsyLJsohHUR4=;
b=tfyuHZlflAVeZx4+nV1BPuxVaRZNDHOqmPpmkouP0rQgE/pnckxPyDOAlC+kO9wjISOzElT/ESTHSeA6zFrLBMOiIP+tJ0EHFUh4U4We6H0v6sW5zxLoHQGA6Hfq4NgPcCbG7kwSMkEH1JEi+iry/4J1EN2xkWdGJcbVlLTeDGDRBbaCiBhpjQgDV4qP+5Pq4Mfa6/n1ELFEn3UI1lf/uFzrtnHCXt3S2hh43FARLLs7t40Y5JOG2Gvi+cQeRT2+wQVstLgJkoj+5ViIdzIz/T7rvkCnXIU1fp0S4/jXOkOCM8qqv8Z1GVrv+X4URzuXxeMjPH9Tf5w0xC7SYknCZw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
dkim=pass header.d=nvidia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=L3EAxmgg/6atJ6qXXkw0VvpEAxbaN1VBsyLJsohHUR4=;
b=gjjAtE1Nf1+MHHiZujFGzWAaQGRc3xgUY5akcdByfhX6lrQ5an8Zna5Ce8643ukO9v0VT/osGT0kRzvZ3ZC54bA3KC0KKfNFJUAIHV4acK6IHgViT+pPR4WPNFIEPsq8PZACg4ALT+J05MtuRkoRFDi+uNIr+ZPD5Mri52aKw1lIHL6mg5yoKGP2rjafDXavTGIkGkGnFiN12Ik3Ed933n+JqGvA4j5AnYCkjLWmv50DXMNa1xQrpAWIfZHoTgdmHWBB8uCiKOiiWt5AqWfpxmisb67769TdRVRw3hZUMEmVmS9plWqwEIBJ+tV5cqRAT2FpBVgdtkNzFzV1NF4dZg==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nvidia.com;
Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by
SN7PR12MB6839.namprd12.prod.outlook.com (2603:10b6:806:265::21) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.34; Fri, 6 Jun
2025 16:11:04 +0000
Received: from DS7PR12MB9473.namprd12.prod.outlook.com
([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com
([fe80::5189:ecec:d84a:133a%5]) with mapi id 15.20.8792.034; Fri, 6 Jun 2025
16:11:04 +0000
From: Zi Yan <ziy@xxxxxxxxxx>
To: Usama Arif <usamaarif642@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, david@xxxxxxxxxx,
linux-mm@xxxxxxxxx, hannes@xxxxxxxxxxx, shakeel.butt@xxxxxxxxx,
riel@xxxxxxxxxxx, baolin.wang@xxxxxxxxxxxxxxxxx, lorenzo.stoakes@xxxxxxxxxx,
Liam.Howlett@xxxxxxxxxx, npache@xxxxxxxxxx, ryan.roberts@xxxxxxx,
dev.jain@xxxxxxx, hughd@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
linux-doc@xxxxxxxxxxxxxxx, kernel-team@xxxxxxxx,
Juan Yescas <jyescas@xxxxxxxxxx>, Breno Leitao <leitao@xxxxxxxxxx>
Subject: Re: [RFC] mm: khugepaged: use largest enabled hugepage order for
min_free_kbytes
Date: Fri, 06 Jun 2025 12:10:43 -0400
X-Mailer: MailMate (2.0r6255)
Message-ID: <35A3819F-C8EE-48DB-8EB4-093C04DEF504@xxxxxxxxxx>
In-Reply-To: <b807deec-99a9-4691-9001-c2f3adf586b9@xxxxxxxxx>
References: <20250606143700.3256414-1-usamaarif642@xxxxxxxxx>
<A409F7B3-A901-40F9-A694-DC3FB00B57FE@xxxxxxxxxx>
<b807deec-99a9-4691-9001-c2f3adf586b9@xxxxxxxxx>
Content-Type: text/plain
X-ClientProxiedBy: MN0PR05CA0001.namprd05.prod.outlook.com
(2603:10b6:208:52c::6) To DS7PR12MB9473.namprd12.prod.outlook.com
(2603:10b6:8:252::5)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|SN7PR12MB6839:EE_
X-MS-Office365-Filtering-Correlation-Id: 32a90bb8-a9e4-4c1c-bc96-08dda514bc2c
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|376014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?g2aTDIR+ehSWXYQxvAfBAEAqQ3409QWn4G+1IjJzRevIejv9Snp9bJOp/EJb?=
=?us-ascii?Q?S9pMo9WwUYpnijZb+ed5RxFR7Z4ZL7LCmGU7AyDvN3CUXTejuPgN2ThCuymC?=
=?us-ascii?Q?8YbiQO6UtTnfY949UZ/CuV+HkxK29/BI3mNk0CBZXehSJt0fmvP9ZBpgLiLR?=
=?us-ascii?Q?zSp0OGrReI6MI1i0EBrsNB2wn4Uehu7DYemcaY6XBAAdIsxFoxkxxwT3S1pR?=
=?us-ascii?Q?bDsHSIKoMszxm67M391xTNSzI2L1/6qBIj5mCbXYOwuUbJ0/YPLCAUaaLXhu?=
=?us-ascii?Q?Z5ve+ZJL0c0bwJnDEa3kV85mh4ubqcBKhnC1Rww6m6WbjHtsXc4Dm6NLV8Vb?=
=?us-ascii?Q?05f42SmjWfo4Z6AoDVf48Aa3wvW8ieX2sNjdwWCsaNDkkruH4WIF/nD7yCBv?=
=?us-ascii?Q?VA8RiCvc2XEG4UuVXOR+nJteGkRezLD2AMxgXgVtr2EyjIrYEc+VJDHg9JNm?=
=?us-ascii?Q?VUKirBgqskiPmlErp1CpmQEF38MhbIjZDPD45G69zw5KhYnzYRFyka8advO+?=
=?us-ascii?Q?xMY4oGxIbXYrwB0NjDEXl1ZIFad2y6MJIRfqX6ODY6oq9wf1kwdAQA1HjY1z?=
=?us-ascii?Q?SDmvhoLLldLkBNw9dBuReAO1f1Eiqd0h2TEZchX6lg/nDJDPDC+UYm2SzmV8?=
=?us-ascii?Q?6/EU6SJ+O7t20I/KpmvroSv9Hesc1YAfJvcvdRTkxMr9+GpIOxEdnakO12rE?=
=?us-ascii?Q?xvLrxTmIZlT3OJAhCedvumhPLR2RaDO0rUDlDXgsV/2TCS7DsTvbO9EtreL6?=
=?us-ascii?Q?NKnmHWw332+ZXxU51mlcIssgLldeSGJOA+/BOJx5C8uCrJX4U3Y/8uMnL1GL?=
=?us-ascii?Q?cm+3Zi6wGZiDlM2T0VgfWvHXkeyb9rYA6FhNSrmwyEAICp9hHs2KvJZKy1Gy?=
=?us-ascii?Q?3IZAJpP0/HaR89Hys9tL2uB5epfIBwf+8XHHx3piQwbojd6MytW2NRyqM2cP?=
=?us-ascii?Q?iCsu5EDT+hr+JPHbIUagTJ5C4m1zk7/xgBst+sYO8CcZeotw7YMFEn81plOs?=
=?us-ascii?Q?nrSr+jkCyCCv4meHILD4acNmpMwhrCeqbcAsCTXC9tSZewNPvNn7Mw/54gVt?=
=?us-ascii?Q?QLGzZkQ2F/2/o0qoQ5SIjeFfjc/Aw/mV8pJia3azVCULrJYIO64TIQ4uOa1K?=
=?us-ascii?Q?IAw7GpFM5EThZLr1ldv37rVHpQIn6HUNB3zu13E406BJUO0KQzvHzE3m7YeW?=
=?us-ascii?Q?0G6W7FMQWw8XEzin+b7Ai//rZvWQGiJoth3MggC0OuSRYAFr8QshJxS8lj09?=
=?us-ascii?Q?QhP36ahMxFCrBX0UtdenldFlu8sYTB/VG0tqGQMJjhNCArUrK+dP84g8aBWh?=
=?us-ascii?Q?BFY4ysy5wYVOGGCKv26rtmroYWr6UUdkgpOnO8UKB7LXEJX9m/g64VE9iisG?=
=?us-ascii?Q?BWvnqwBdxe89lCNPUfllnP/mXyImEfN6ZAJ4zj3KXmVpBzjvnyf4DaZ6nHJj?=
=?us-ascii?Q?VP7B4eXVrHw=3D?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(7416014)(376014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?ITfT5Hlh5/BhRCKBYb91AHGoPnDx/H7LT+a24n5t+5ysMZMyGPFrTn4P+7bg?=
=?us-ascii?Q?+HbnqS59UstW66wNp/2bmk6ezN64V9InnhVS/M5xfOSX81FpbgA2kfOBBiQ5?=
=?us-ascii?Q?SJZKW9p7bdkg/Oe9ZGJZVIp3wuk8cMtodTKplDC+VWsdKfAFXzJRsJwi6/Mk?=
=?us-ascii?Q?lE95Pkg+Go5wsQ2YtjVggsYyTrQVifC0WB7E0nLmRMldE5kDEFijr9IZWBO8?=
=?us-ascii?Q?6Bm7deNdlUNJH5OioJFMOv3HNWD73yHkk/zGexIgmxCEJT0Da9V5cv62wrtx?=
=?us-ascii?Q?MTR8LSF2BV6yXd4d5OgrwgzVN/Hcz+EmgezEOe/fCge+arBR+uLZAYhbSZ0y?=
=?us-ascii?Q?UlmqZu4ANVghEeuR9W8x0ssbuofj8C/TiykJvCesgAzmonxYJhw3HZLxRw2h?=
=?us-ascii?Q?QX7/zgTpVMYL+b8U2SpHospoHqGVGM+L7nyMwjleiAwZC34zTUtPGtY52h2n?=
=?us-ascii?Q?HQW7ThfWJqkhxwstjCzfDdgaqEOaXIJsVaseun5msLhr7Jv1WJ9Uk4DEoTOz?=
=?us-ascii?Q?nM8/25SgW37JFIBtV17FrkuKtB79r1THRe4kGa/zRkyhRDB4HWV7bWH/AxEK?=
=?us-ascii?Q?C+T9TthEnx0+xQoD8b7N9MEPZVkqiflFuKOXYTG0nI3ooGXzyb4Rp2vd28u+?=
=?us-ascii?Q?umYFUTtVs+rukLtgofS0OVdcW6HSYfxmlvds30nB8Y8A+tjAT2jOw2UrxqjM?=
=?us-ascii?Q?cAc8yYYhaSdqxbxWxa3TSXNiInsyncPu4Dd1AWZZdFlXCEkYddFdLWd/J551?=
=?us-ascii?Q?z9ngnL2KygQD4PuoUMq+uKSTgTHC6aL65O9LzY46eyVYOfOg0TrBJIdpUxbe?=
=?us-ascii?Q?4nporRAnCpx4gqibjLdOmeuZetHQJhO6qwjJqiQlEvv0Fa0Ahe6JN9J+cl29?=
=?us-ascii?Q?KbND3oIkSt6eSCObQ+MHIL8XmDUYquOSPpcMedVjLFHrUi38t0yrq/3ryavQ?=
=?us-ascii?Q?3nsjseQ4Q1/OC2sVY6ULlFm1bioEhps/eGWxzHO9ZnWmkjq/DrsgMVviyRtI?=
=?us-ascii?Q?VfCeM+lO1u4ODZhIp9hH0aymXCbLbbj3Bf0q92ggbY+GZENFhaBOP2SNJbus?=
=?us-ascii?Q?61Bnri8EcdaDuicaRbT0IFNvnIT7jUWHC3eWN6KydynTv1hr98A1u/VTqU+o?=
=?us-ascii?Q?xknGI2UGAcAa/RhxTOli05xIDeMpmaVtC0a+Qmd0GRzrYoDwKSzwuFGaSw1M?=
=?us-ascii?Q?7YPq7aWzCvS6sR7BdcMBFtc6wL9XfDbNZEWJsj2UI9bzDAXnl3MppIstFrlV?=
=?us-ascii?Q?dHRTYAgxoSnoMz2UoAgA8Y4tUJQhCwnRVcdfeF1tzj/yBVGomu5TIJq2JGSW?=
=?us-ascii?Q?qAIVmqoZe+4WMcZs5zz43AnFG/M+9uPA8CQPW848OPqD+H+G3rMnqmtXTW8s?=
=?us-ascii?Q?X4Dxwg6DqdtJKFAkHpDIXgH+xDakj8dY+4tpmam0RA00nv2hIwm19C7BDR5J?=
=?us-ascii?Q?hBpH9annpyBKVMCnMwwmsf/kn1SBUvXOIZMzQEyrze7IctRyeTLv5wyXpeHA?=
=?us-ascii?Q?L6XqRp3Ypd9QcPsI/EKJPlb8ZJlNIDEFt8JLYwFk/WuWSc+GCdafVPxbqfIq?=
=?us-ascii?Q?FDcFZc+hRtDRuHbmtLHzUYIv0SQUQPBcyL8yWdEI?=
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 32a90bb8-a9e4-4c1c-bc96-08dda514bc2c
X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 16:11:04.1527
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: NU7rOQh5AH7oijgt5djbSeWSdmnjMpwP+Lps5jV1eH+Z29ulFB6WnDYO58Q4a3yy
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6839
X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6 Jun 2025, at 11:38, Usama Arif wrote:

> On 06/06/2025 16:18, Zi Yan wrote:
>> On 6 Jun 2025, at 10:37, Usama Arif wrote:
>>
>>> On arm64 machines with 64K PAGE_SIZE, the min_free_kbytes and hence the
>>> watermarks are evaluated to extremely high values, for e.g. a server with
>>> 480G of memory, only 2M mTHP hugepage size set to madvise, with the rest
>>> of the sizes set to never, the min, low and high watermarks evaluate to
>>> 11.2G, 14G and 16.8G respectively.
>>> In contrast for 4K PAGE_SIZE of the same machine, with only 2M THP hugepage
>>> size set to madvise, the min, low and high watermarks evaluate to 86M, 566M
>>> and 1G respectively.
>>> This is because set_recommended_min_free_kbytes is designed for PMD
>>> hugepages (pageblock_order = min(HPAGE_PMD_ORDER, PAGE_BLOCK_ORDER)).
>>> Such high watermark values can cause performance and latency issues in
>>> memory bound applications on arm servers that use 64K PAGE_SIZE, eventhough
>>> most of them would never actually use a 512M PMD THP.
>>>
>>> Instead of using HPAGE_PMD_ORDER for pageblock_order use the highest large
>>> folio order enabled in set_recommended_min_free_kbytes.
>>> With this patch, when only 2M THP hugepage size is set to madvise for the
>>> same machine with 64K page size, with the rest of the sizes set to never,
>>> the min, low and high watermarks evaluate to 2.08G, 2.6G and 3.1G
>>> respectively. When 512M THP hugepage size is set to madvise for the same
>>> machine with 64K page size, the min, low and high watermarks evaluate to
>>> 11.2G, 14G and 16.8G respectively, the same as without this patch.
>>
>> Getting pageblock_order involved here might be confusing. I think you just
>> want to adjust min, low and high watermarks to reasonable values.
>> Is it OK to rename min_thp_pageblock_nr_pages to min_nr_free_pages_per_zone
>> and move MIGRATE_PCPTYPES * MIGRATE_PCPTYPES inside? Otherwise, the changes
>> look reasonable to me.
>
> Hi Zi,
>
> Thanks for the review!
>
> I forgot to change it in another place, sorry about that! So can't move
> MIGRATE_PCPTYPES * MIGRATE_PCPTYPES into the combined function.
> Have added the additional place where min_thp_pageblock_nr_pages() is called
> as a fixlet here:
> https://lore.kernel.org/all/a179fd65-dc3f-4769-9916-3033497188ba@xxxxxxxxx/
>
> I think atleast in this context the orginal name pageblock_nr_pages isn't
> correct as its min(HPAGE_PMD_ORDER, PAGE_BLOCK_ORDER).
> The new name min_thp_pageblock_nr_pages is also not really good, so happy
> to change it to something appropriate.

Got it. pageblock is the defragmentation granularity. If user only wants
2MB mTHP, maybe pageblock order should be adjusted. Otherwise,
kernel will defragment at 512MB granularity, which might not be efficient.
Maybe make pageblock_order a boot time parameter?

In addition, we are mixing two things together:
1. min, low, and high watermarks: they affect when memory reclaim and compaction
will be triggered;
2. pageblock order: it is the granularity of defragmentation for creating
mTHP/THP.

In your use case, you want to lower watermarks, right? Considering what you
said below, I wonder if we want a way of enforcing vm.min_free_kbytes,
like a new sysctl knob, vm.force_min_free_kbytes (yeah the suggestion
is lame, sorry).

I think for 2, we might want to decouple pageblock order from defragmentation
granularity.


>>
>> Another concern on tying watermarks to highest THP order is that if
>> user enables PMD THP on such systems with 2MB mTHP enabled initially,
>> it could trigger unexpected memory reclaim and compaction, right?
>> That might surprise user, since they just want to adjust availability
>> of THP sizes, but the whole system suddenly begins to be busy.
>> Have you experimented with it?
>>
>
> Yes I would imagine it would trigger reclaim and compaction if the system memory
> is too low, but that should hopefully be expected? If the user is enabling 512M
> THP, they should expect changes by kernel to allow them to give hugepage of
> that size.
> Also hopefully, no one is enabling PMD THPs when the system is so low on
> memory that it triggers reclaim! There would be an OOM after just a few
> of those are faulted in.



Best Regards,
Yan, Zi


Return-Path: <linux-kernel+bounces-676009-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 224A941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:13:35 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0615D3B0120
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:13:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C6DE289372;
Fri, 6 Jun 2025 16:13:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b="UvFYjfJ7"
Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55ACD1A38F9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:13:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.182
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226408; cv=none; b=SmbB1Ob7HAG5/aRm6sHtORQDMcI8xzVB2t+fQX3mx6xaHTH5eYQyhwGmcHeB7h2zZ3xr3bn/JLyPgZlhcInGpDLGOHkqhmqkeTtRwqf0JpHCu4bFCD24rCH348yyT6PNUFui8HdUJ4Yi56oOROn9aVc+eXSv18Sbe1R0oEvAXyg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226408; c=relaxed/simple;
bh=3c+OLiucfxV1ODvVU6ZZSFapIkuKRd0oSKGghYOHS4Y=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=QfqKj6H2Ux+WTQHe7+XmGukjl/VqHt2PKqKFMBUkpi8x0v+kJGolmyL7u820kloYFegGomsZqMW8jDgKWeVQdDV9LJ3RGi9z7iJXhfj1qloieRZSJqV7Aybf0zMRuUtELzCgJsjkLQkfL7UvO23n8DQzEPC41CgTkdV7bU4bHTA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b=UvFYjfJ7; arc=none smtp.client-ip=209.85.160.182
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com
Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-4a58f79d6e9so21728681cf.2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 09:13:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1749226406; x=1749831206; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=3c+OLiucfxV1ODvVU6ZZSFapIkuKRd0oSKGghYOHS4Y=;
b=UvFYjfJ7E1AYqFNifHJ5vAD1nNFuopa6CqxKS7CzMVV/zdci4oALssnI+fKuU0bZIE
54K38UM6kiDb+UTarbiwFst1UU/sCv4W62u2CH6v4wUWp9qQluFTFNwyyJWlWmkdiBh3
9nIsaak6uIFKEiO9EkDUqZNIEG08+hZUo5QBI1ESMZQgyhNaKdzsNETC0YmFExWflKoB
JKUwscRQ0Y3/bI5WU5lZeHUQPRsnAYBj0fDOMUEFpAhFqdGHnYVZHDf/7EaWeyrr/sP0
OrrCoJiE+ra/XIZkh8DIXwXjZwtMJ026l1OZPG6mrgDcufElcIM41E0/iDYQA+7bkf6C
YXaA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226406; x=1749831206;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=3c+OLiucfxV1ODvVU6ZZSFapIkuKRd0oSKGghYOHS4Y=;
b=dnB3XBzWn5N1zbClBEcE3EENBcTKUUO6zhUQ2ni8S40YFUfvY876cUVqyODeVPNGTI
E5lf/NFRk9+nEkUbw/qstcjDZgwamNNj1ikghlq3wRRz9z1dWFAB4AKvnxOfSRiz7XD7
jINzNGLTKL1WJNCwMDMZ9xR4CHc0KWNvZKuttVUczTGSJpA06syzMZjvF2ykuNw+9YXA
EoKXkHkKGn01tlyZ9m4Q2Ae8b466agd5xR2hyoosU0Gi0gCb5xQPVoTJnhcRY0PUlAuH
UKs7zTnmhFHhtkn2EHMXcUAg1PCNtOlQN5aAHb/CpbIsNBx6QMmGy7SQMYGjrBGySlQO
qgdQ==
X-Forwarded-Encrypted: i=1; AJvYcCW3nShEPr3S3i+WihgCP56hVRN8d0RggwlP7LplHLfizCEFCmRhR6b2dKK7lYvHaK7pP2OBI15CWgNMmUE=@vger.kernel.org
X-Gm-Message-State: AOJu0YycIFAcFtqmMdlm4tF7/AqMnRk/BNT1hSWCUeDGHBidD5aaTUc0
eqmv4aHolN5/udHzTroMjuklvES/VGuzYntioJUvN6uS84vtaxazZknkQ3XFnBxgCA/hE8Qpd8l
bJLhyrE4mz8IGJqRfxnhPeGIBF0ExMir15eJyU9btRQ==
X-Gm-Gg: ASbGnctPJey65RMWj4XBBlt3ZL4YixT/Voe98Mn3/vxHXz/2mA3G68ruBsLQ3PKziTc
8x7px8VizshJHmRMVH1WnChPsLrkUnvblW7fW4m1pjBdTEmUorfQoee68AIo2CP37Go4najcpgD
nzFYr4QC/keEqceJ8VegSXL3S0Xu0q189KERfOFBCa
X-Google-Smtp-Source: AGHT+IFvzMrq1D8K+hzBBEnf8MX2QMLz487m/utY5M5EEZJ2BtgId21E4drPVwNqY3sPf1S055BglVV7u01P7fkvw7c=
X-Received: by 2002:ac8:4f83:0:b0:4a6:b603:c37e with SMTP id
d75a77b69052e-4a6b603c3d3mr34513811cf.2.1749226406222; Fri, 06 Jun 2025
09:13:26 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250515182322.117840-1-pasha.tatashin@xxxxxxxxxx>
<20250515182322.117840-2-pasha.tatashin@xxxxxxxxxx> <mafs0msantryd.fsf@xxxxxxxxxx>
In-Reply-To: <mafs0msantryd.fsf@xxxxxxxxxx>
From: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:12:49 -0400
X-Gm-Features: AX0GCFuCUPrJe40udzBKChlGW4OEJnp5DLFei3Onke-YT3nN79_JOUAzGKiEZOg
Message-ID: <CA+CK2bAc6joxJPCTdNkn8JxWA0MWtQfASiwNuHA68Nqt+7O61A@xxxxxxxxxxxxxx>
Subject: Re: [RFC v2 01/16] kho: make debugfs interface optional
To: Pratyush Yadav <pratyush@xxxxxxxxxx>
Cc: jasonmiu@xxxxxxxxxx, graf@xxxxxxxxxx, changyuanl@xxxxxxxxxx,
rppt@xxxxxxxxxx, dmatlack@xxxxxxxxxx, rientjes@xxxxxxxxxx, corbet@xxxxxxx,
rdunlap@xxxxxxxxxxxxx, ilpo.jarvinen@xxxxxxxxxxxxxxx, kanie@xxxxxxxxxxxxxxxxx,
ojeda@xxxxxxxxxx, aliceryhl@xxxxxxxxxx, masahiroy@xxxxxxxxxx,
akpm@xxxxxxxxxxxxxxxxxxxx, tj@xxxxxxxxxx, yoann.congal@xxxxxxxx,
mmaurer@xxxxxxxxxx, roman.gushchin@xxxxxxxxx, chenridong@xxxxxxxxxx,
axboe@xxxxxxxxx, mark.rutland@xxxxxxx, jannh@xxxxxxxxxx,
vincent.guittot@xxxxxxxxxx, hannes@xxxxxxxxxxx, dan.j.williams@xxxxxxxxx,
david@xxxxxxxxxx, joel.granados@xxxxxxxxxx, rostedt@xxxxxxxxxxx,
anna.schumaker@xxxxxxxxxx, song@xxxxxxxxxx, zhangguopeng@xxxxxxxxxx,
linux@xxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-doc@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx,
mingo@xxxxxxxxxx, bp@xxxxxxxxx, dave.hansen@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx,
hpa@xxxxxxxxx, rafael@xxxxxxxxxx, dakr@xxxxxxxxxx,
bartosz.golaszewski@xxxxxxxxxx, cw00.choi@xxxxxxxxxxx,
myungjoo.ham@xxxxxxxxxxx, yesanishhere@xxxxxxxxx, Jonathan.Cameron@xxxxxxxxxx,
quic_zijuhu@xxxxxxxxxxx, aleksander.lobakin@xxxxxxxxx, ira.weiny@xxxxxxxxx,
andriy.shevchenko@xxxxxxxxxxxxxxx, leon@xxxxxxxxxx, lukas@xxxxxxxxx,
bhelgaas@xxxxxxxxxx, wagi@xxxxxxxxxx, djeffery@xxxxxxxxxx,
stuart.w.hayes@xxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, Jun 4, 2025 at 12:03=E2=80=AFPM Pratyush Yadav <pratyush@xxxxxxxxxx=
> wrote:
>
> On Thu, May 15 2025, Pasha Tatashin wrote:
>
> > Currently, KHO is controlled via debugfs interface, but once LUO is
> > introduced, it can control KHO, and the debug interface becomes
> > optional.
> >
> > Add a separate config CONFIG_KEXEC_HANDOVER_DEBUG that enables
> > the debugfs interface, and allows to inspect the tree.
> >
> > Move all debufs related code to a new file to keep the .c files
>
> Nit: s/debufs/debugfs/

Done.

Thanks,
Pasha


Return-Path: <linux-kernel+bounces-676010-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B590B41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:14:21 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 85E7D3B0467
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:13:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A39F289834;
Fri, 6 Jun 2025 16:14:12 +0000 (UTC)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C8271A38F9;
Fri, 6 Jun 2025 16:14:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226451; cv=none; b=ZRXzA5S4Q7pzWrvdxe9jdgSs7X+2lwH+w+b0Lfgi/bZRf5fTZEynL7YbqmFeI9HzUK0u2n+amFEcbrAuD5CX147UxBV297Pt/BZGHZrMhbDFkesJWLPKZ84D5kIcipbyCinpAMgKRpDpK3sKfF0XLb9zmatStt4deVHCroVlsQA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226451; c=relaxed/simple;
bh=4NCQ1duxdKBQozPwIGVzN4NmGuxP4WE8hhC8wCpppwI=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=fAPLqDBtH9JQkSDURjBr3ziCiJyr0wJGTHPTUiFWkKoNhOKwz8rITvBKKuzIOdDwg3RsC5Qq3LRvHLKRofiGg8JWg1I45/wdzBr/Q6TKBv6yWJq0A7RbMA4XDFoxPnDaXV+EHuWJs62OWqMOa2/jxzthxxi7k/BDyAVEej3vQKM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7926C153B;
Fri, 6 Jun 2025 09:13:50 -0700 (PDT)
Received: from localhost (e132581.arm.com [10.1.196.87])
by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EAAAC3F673;
Fri, 6 Jun 2025 09:14:07 -0700 (PDT)
Date: Fri, 6 Jun 2025 17:14:06 +0100
From: Leo Yan <leo.yan@xxxxxxx>
To: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Lorenz Bauer <lmb@xxxxxxxxxxxxx>, Andrii Nakryiko <andrii@xxxxxxxxxx>,
Alan Maguire <alan.maguire@xxxxxxxxxx>,
Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>,
bpf@xxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx
Subject: Re: BTF loading failing on perf
Message-ID: <20250606161406.GH8020@xxxxxxxxxxxxxxx>
References: <aEMLU2li1x2bAO4w@x1>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <aEMLU2li1x2bAO4w@x1>
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Arnaldo,

On Fri, Jun 06, 2025 at 12:37:55PM -0300, Arnaldo Carvalho de Melo wrote:
> root@number:~# perf trace -e openat --max-events=1
> libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV
> libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV
> 0.000 ( 0.016 ms): ptyxis-agent/4375 openat(dfd: CWD, filename: "/proc/6593/cmdline", flags: RDONLY|CLOEXEC) = 13
> root@number:~#
>
> openat(AT_FDCWD, "/sys/kernel/btf/vmlinux", O_RDONLY) = 258
> mmap(NULL, 6519699, PROT_READ, MAP_PRIVATE, 258, 0) = -1 ENODEV (No such device)
> libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV

Have you included the commit below in the kernel side?

commit a539e2a6d51d1c12d89eec149ccc72ec561639bc
Author: Lorenz Bauer <lmb@xxxxxxxxxxxxx>
Date: Tue May 20 14:01:17 2025 +0100

btf: Allow mmap of vmlinux btf

User space needs access to kernel BTF for many modern features of BPF.
Right now each process needs to read the BTF blob either in pieces or
as a whole. Allow mmaping the sysfs file so that processes can directly
access the memory allocated for it in the kernel.

remap_pfn_range is used instead of vm_insert_page due to aarch64
compatibility issues.

Signed-off-by: Lorenz Bauer <lmb@xxxxxxxxxxxxx>
Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
Tested-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
Reviewed-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
Link: https://lore.kernel.org/bpf/20250520-vmlinux-mmap-v5-1-e8c941acc414@xxxxxxxxxxxxx

Thanks,
Leo


Return-Path: <linux-kernel+bounces-676011-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id AB54941E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:16:28 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id EB1F0188FAFC
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:16:41 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AB7191DF247;
Fri, 6 Jun 2025 16:16:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="QlyJ72SN";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="meyKTMOF";
dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="QlyJ72SN";
dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="meyKTMOF"
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AFD229A2
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:16:18 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226580; cv=none; b=QbAkgRJV9mzBSrDGMYdZ5LXXXzgKokBKizcPeTfUoJtMeMiCyv33CwzBIgxB6IKwJFZy/sVejiPkToSLBoW2XoFug22439Y7fz5C0ql/S6qxP/IjDCAaFV+ns4a3MyLZa5FCJSLddONTAlUqukCWPtohNpUHZLrDotqHcCe9HkA=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226580; c=relaxed/simple;
bh=8H/VCzplXKUBZOF313iKsB6xpBniNPQjYp2oot0Da6E=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
In-Reply-To:Content-Type; b=jCz7m58x7eNuvU5reR1kxhAIClfXV9sn+dk6VuBW8qJFPsmSxvj/0yyJEk0cdQUCFT7PcVoQmUDVW4U0FECNYYWWFErlblAbfz5wU8jxI+7m0kLlw7eSslxW6EoS8oACt42RwxvJHFlqkLwDxcomtIB557Urciwg78KpxJUktSE=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=QlyJ72SN; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=meyKTMOF; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=QlyJ72SN; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=meyKTMOF; arc=none smtp.client-ip=195.135.223.130
Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz
Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by smtp-out1.suse.de (Postfix) with ESMTPS id 3240522D41;
Fri, 6 Jun 2025 16:16:17 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749226577; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=KmX6k6ykMpKa7Vw6PmwuNM7YaceN5+edcU5ngSZkNDU=;
b=QlyJ72SNoaD5AoknDntbBw0UFL67rxA/8cuyJKcaH+0SpTj94DjAePV0QXHeRrM2jbzFz+
x8j8HM/jp9QKXxIXQCuC+O6JGbVi3iWWnaiM8ciRnCbTS1rO5JawEKnz1m/yHNwm3mIYpD
8KWzyOtilnaHDOwH9h9km594opCwt20=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749226577;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=KmX6k6ykMpKa7Vw6PmwuNM7YaceN5+edcU5ngSZkNDU=;
b=meyKTMOFImRwBV7mLEYKpDqvYrQR9ntF1879lBHac0chi6OZZRqcY3y89ZPh/g9K4+fDZp
+RUbwGOxlFhOeDBQ==
Authentication-Results: smtp-out1.suse.de;
none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa;
t=1749226577; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=KmX6k6ykMpKa7Vw6PmwuNM7YaceN5+edcU5ngSZkNDU=;
b=QlyJ72SNoaD5AoknDntbBw0UFL67rxA/8cuyJKcaH+0SpTj94DjAePV0QXHeRrM2jbzFz+
x8j8HM/jp9QKXxIXQCuC+O6JGbVi3iWWnaiM8ciRnCbTS1rO5JawEKnz1m/yHNwm3mIYpD
8KWzyOtilnaHDOwH9h9km594opCwt20=
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;
s=susede2_ed25519; t=1749226577;
h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
bh=KmX6k6ykMpKa7Vw6PmwuNM7YaceN5+edcU5ngSZkNDU=;
b=meyKTMOFImRwBV7mLEYKpDqvYrQR9ntF1879lBHac0chi6OZZRqcY3y89ZPh/g9K4+fDZp
+RUbwGOxlFhOeDBQ==
Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1864F1336F;
Fri, 6 Jun 2025 16:16:17 +0000 (UTC)
Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
by imap1.dmz-prg2.suse.org with ESMTPSA
id u4tKBVEUQ2jpOgAAD6G6ig
(envelope-from <vbabka@xxxxxxx>); Fri, 06 Jun 2025 16:16:17 +0000
Message-ID: <10e36f9f-5318-40bf-9f64-e254c7ccfbb9@xxxxxxx>
Date: Fri, 6 Jun 2025 18:16:16 +0200
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] mm/vma: reset VMA iterator on commit_merge() OOM failure
Content-Language: en-US
To: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: "Liam R . Howlett" <Liam.Howlett@xxxxxxxxxx>, Jann Horn
<jannh@xxxxxxxxxx>, Pedro Falcato <pfalcato@xxxxxxx>, linux-mm@xxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
References: <20250606125032.164249-1-lorenzo.stoakes@xxxxxxxxxx>
From: Vlastimil Babka <vbabka@xxxxxxx>
Autocrypt: addr=vbabka@xxxxxxx; keydata=
xsFNBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB
KxRWDHX0R2tgpFDXHnzZcQywawu8eSq0LxzxFNYMvtB7sV1pxYwej2qx9B75qW2plBs+7+YB
87tMFA+u+L4Z5xAzIimfLD5EKC56kJ1CsXlM8S/LHcmdD9Ctkn3trYDNnat0eoAcfPIP2OZ+
9oe9IF/R28zmh0ifLXyJQQz5ofdj4bPf8ecEW0rhcqHfTD8k4yK0xxt3xW+6Exqp9n9bydiy
tcSAw/TahjW6yrA+6JhSBv1v2tIm+itQc073zjSX8OFL51qQVzRFr7H2UQG33lw2QrvHRXqD
Ot7ViKam7v0Ho9wEWiQOOZlHItOOXFphWb2yq3nzrKe45oWoSgkxKb97MVsQ+q2SYjJRBBH4
8qKhphADYxkIP6yut/eaj9ImvRUZZRi0DTc8xfnvHGTjKbJzC2xpFcY0DQbZzuwsIZ8OPJCc
LM4S7mT25NE5kUTG/TKQCk922vRdGVMoLA7dIQrgXnRXtyT61sg8PG4wcfOnuWf8577aXP1x
6mzw3/jh3F+oSBHb/GcLC7mvWreJifUL2gEdssGfXhGWBo6zLS3qhgtwjay0Jl+kza1lo+Cv
BB2T79D4WGdDuVa4eOrQ02TxqGN7G0Biz5ZLRSFzQSQwLn8fbwARAQABzSBWbGFzdGltaWwg
QmFia2EgPHZiYWJrYUBzdXNlLmN6PsLBlAQTAQoAPgIbAwULCQgHAwUVCgkICwUWAgMBAAIe
AQIXgBYhBKlA1DSZLC6OmRA9UCJPp+fMgqZkBQJnyBr8BQka0IFQAAoJECJPp+fMgqZkqmMQ
AIbGN95ptUMUvo6aAdhxaOCHXp1DfIBuIOK/zpx8ylY4pOwu3GRe4dQ8u4XS9gaZ96Gj4bC+
jwWcSmn+TjtKW3rH1dRKopvC07tSJIGGVyw7ieV/5cbFffA8NL0ILowzVg8w1ipnz1VTkWDr
2zcfslxJsJ6vhXw5/npcY0ldeC1E8f6UUoa4eyoskd70vO0wOAoGd02ZkJoox3F5ODM0kjHu
Y97VLOa3GG66lh+ZEelVZEujHfKceCw9G3PMvEzyLFbXvSOigZQMdKzQ8D/OChwqig8wFBmV
QCPS4yDdmZP3oeDHRjJ9jvMUKoYODiNKsl2F+xXwyRM2qoKRqFlhCn4usVd1+wmv9iLV8nPs
2Db1ZIa49fJet3Sk3PN4bV1rAPuWvtbuTBN39Q/6MgkLTYHb84HyFKw14Rqe5YorrBLbF3rl
M51Dpf6Egu1yTJDHCTEwePWug4XI11FT8lK0LNnHNpbhTCYRjX73iWOnFraJNcURld1jL1nV
r/LRD+/e2gNtSTPK0Qkon6HcOBZnxRoqtazTU6YQRmGlT0v+rukj/cn5sToYibWLn+RoV1CE
Qj6tApOiHBkpEsCzHGu+iDQ1WT0Idtdynst738f/uCeCMkdRu4WMZjteQaqvARFwCy3P/jpK
uvzMtves5HvZw33ZwOtMCgbpce00DaET4y/UzsBNBFsZNTUBCACfQfpSsWJZyi+SHoRdVyX5
J6rI7okc4+b571a7RXD5UhS9dlVRVVAtrU9ANSLqPTQKGVxHrqD39XSw8hxK61pw8p90pg4G
/N3iuWEvyt+t0SxDDkClnGsDyRhlUyEWYFEoBrrCizbmahOUwqkJbNMfzj5Y7n7OIJOxNRkB
IBOjPdF26dMP69BwePQao1M8Acrrex9sAHYjQGyVmReRjVEtv9iG4DoTsnIR3amKVk6si4Ea
X/mrapJqSCcBUVYUFH8M7bsm4CSxier5ofy8jTEa/CfvkqpKThTMCQPNZKY7hke5qEq1CBk2
wxhX48ZrJEFf1v3NuV3OimgsF2odzieNABEBAAHCwXwEGAEKACYCGwwWIQSpQNQ0mSwujpkQ
PVAiT6fnzIKmZAUCZ8gcVAUJFhTonwAKCRAiT6fnzIKmZLY8D/9uo3Ut9yi2YCuASWxr7QQZ
lJCViArjymbxYB5NdOeC50/0gnhK4pgdHlE2MdwF6o34x7TPFGpjNFvycZqccSQPJ/gibwNA
zx3q9vJT4Vw+YbiyS53iSBLXMweeVV1Jd9IjAoL+EqB0cbxoFXvnjkvP1foiiF5r73jCd4PR
rD+GoX5BZ7AZmFYmuJYBm28STM2NA6LhT0X+2su16f/HtummENKcMwom0hNu3MBNPUOrujtW
khQrWcJNAAsy4yMoJ2Lw51T/5X5Hc7jQ9da9fyqu+phqlVtn70qpPvgWy4HRhr25fCAEXZDp
xG4RNmTm+pqorHOqhBkI7wA7P/nyPo7ZEc3L+ZkQ37u0nlOyrjbNUniPGxPxv1imVq8IyycG
AN5FaFxtiELK22gvudghLJaDiRBhn8/AhXc642/Z/yIpizE2xG4KU4AXzb6C+o7LX/WmmsWP
Ly6jamSg6tvrdo4/e87lUedEqCtrp2o1xpn5zongf6cQkaLZKQcBQnPmgHO5OG8+50u88D9I
rywqgzTUhHFKKF6/9L/lYtrNcHU8Z6Y4Ju/MLUiNYkmtrGIMnkjKCiRqlRrZE/v5YFHbayRD
dJKXobXTtCBYpLJM4ZYRpGZXne/FAtWNe4KbNJJqxMvrTOrnIatPj8NhBVI0RSJRsbilh6TE
m6M14QORSWTLRg==
In-Reply-To: <20250606125032.164249-1-lorenzo.stoakes@xxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Score: -4.30
X-Spamd-Result: default: False [-4.30 / 50.00];
BAYES_HAM(-3.00)[100.00%];
NEURAL_HAM_LONG(-1.00)[-1.000];
NEURAL_HAM_SHORT(-0.20)[-1.000];
MIME_GOOD(-0.10)[text/plain];
RCVD_VIA_SMTP_AUTH(0.00)[];
RCPT_COUNT_SEVEN(0.00)[7];
ARC_NA(0.00)[];
MIME_TRACE(0.00)[0:+];
MID_RHS_MATCH_FROM(0.00)[];
RCVD_TLS_ALL(0.00)[];
DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];
FUZZY_BLOCKED(0.00)[rspamd.com];
FROM_HAS_DN(0.00)[];
TO_DN_SOME(0.00)[];
FROM_EQ_ENVFROM(0.00)[];
TO_MATCH_ENVRCPT_ALL(0.00)[];
RCVD_COUNT_TWO(0.00)[2];
DBL_BLOCKED_OPENRESOLVER(0.00)[oracle.com:email]
X-Spam-Level:
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On 6/6/25 14:50, Lorenzo Stoakes wrote:
> While an OOM failure in commit_merge() isn't really feasible due to the
> allocation which might fail (a maple tree pre-allocation) being 'too small
> to fail', we do need to handle this case correctly regardless.
>
> In vma_merge_existing_range(), we can theoretically encounter failures
> which result in an OOM error in two ways - firstly dup_anon_vma() might
> fail with an OOM error, and secondly commit_merge() failing, ultimately, to
> pre-allocate a maple tree node.
>
> The abort logic for dup_anon_vma() resets the VMA iterator to the initial
> range, ensuring that any logic looping on this iterator will correctly
> proceed to the next VMA.
>
> However the commit_merge() abort logic does not do the same thing. This
> resulted in a syzbot report occurring because mlockall() iterates through
> VMAs, is tolerant of errors, but ended up with an incorrect previous VMA
> being specified due to incorrect iterator state.
>
> While making this change, it became apparent we are duplicating logic - the
> logic introduced in commit 41e6ddcaa0f1 ("mm/vma: add give_up_on_oom option
> on modify/merge, use in uffd release") duplicates the vmg->give_up_on_oom
> check in both abort branches.
>
> Additionally, we observe that we can perform the anon_dup check safely on
> dup_anon_vma() failure, as this will not be modified should this call fail.
>
> Finally, we need to reset the iterator in both cases, so now we can simply
> use the exact same code to abort for both.
>
> We remove the VM_WARN_ON(err != -ENOMEM) as it would be silly for this to
> be otherwise and it allows us to implement the abort check more neatly.
>
> Reported-by: syzbot+d16409ea9ecc16ed261a@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://lore.kernel.org/linux-mm/6842cc67.a00a0220.29ac89.003b.GAE@xxxxxxxxxx/
> Fixes: 47b16d0462a4 ("mm: abort vma_modify() on merge out of memory failure")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>

Nice.

Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>


Return-Path: <linux-kernel+bounces-676012-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7724041E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:17:33 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id ADEEB1705BB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:17:34 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E20BC289832;
Fri, 6 Jun 2025 16:17:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J80/7doU"
Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B46025776;
Fri, 6 Jun 2025 16:17:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226645; cv=none; b=svis3XUg5FGuVP4eTTmo2jCqOOXMJOT+S3KsLLKMWvTDa+9tgW/b1yptSy14UBCS8/isjUGVV50o4LFfv6ou5eCrlJ/0G+7K2E2a2BIfSXtrPF4XgdIbimp41ubSRnCekSg0MBMLW43WiqSsSFr5PYR5xzxUxYNkLu5YHuciC2s=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226645; c=relaxed/simple;
bh=AJH8Xht7LgFTcE3HlorlUpcubTIYPJN2EmtJ6m0tPCc=;
h=From:Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:To:
References:In-Reply-To; b=l2+YkJl5O4GLFFSTnLblIAIu/ajHhPBGs+wIySuhkXlskWh0QPDCxbUyjzHiUWfhfa9b1OmDH1WJpmEVJzxluhwCHqPg5XJALl7X/fjt9ttrxzpsvr08GpDmOlaCZJouhw+e+HoZ189ZQvyWO67Wk9oiQMv0v07lg+EhcFRctus=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J80/7doU; arc=none smtp.client-ip=209.85.221.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3a36748920cso2198239f8f.2;
Fri, 06 Jun 2025 09:17:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749226642; x=1749831442; darn=vger.kernel.org;
h=in-reply-to:references:to:subject:cc:message-id:date
:content-transfer-encoding:mime-version:from:from:to:cc:subject:date
:message-id:reply-to;
bh=4NlKIg2a1lGubO5sNSfmyFBsfmLI6eZhDm94jolhDTQ=;
b=J80/7doUL8IsXjXPpZ61qYwSmdiZjhVT2U1y7/Z99iIE1cCRUAEJ8ovDLOSYNiLkrq
Ghfl3PRimXRiQ2UGtp+0LL9lvYbwtN0j7/EVyQIRdp2e/KVzbAyeQsl0xlyROBh1oChq
k+kIcVi7B0gFzhiezV8hsrJj/Kt6MenbVN0mnrwVXd9Gk0mARMuaQ0/6tRT70zeGsuIw
NS06jmm8gSjYBHGgDdh/lwZdlAEPWu7gxXx8UjnLA4NXd+rr/PUMR6CvJZDNrVjbQhvf
ONlPsDQgRokjhYi4X+3d2+U7vsy7QcKFs+A59zpMg4GzsRVnEyy99c6Uo4pa6icZSaPG
zjbQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226642; x=1749831442;
h=in-reply-to:references:to:subject:cc:message-id:date
:content-transfer-encoding:mime-version:from:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to;
bh=4NlKIg2a1lGubO5sNSfmyFBsfmLI6eZhDm94jolhDTQ=;
b=WUUJJ5lsTOrGwzAo9Hq7hajESfcccv1UnNRHKdF/AE4A/bws2EgMimXd9Z3+Vc+J96
phN73gaecKGC0P3esW9qbIOc5TeA1iO76dB9MYYmkTGQCsuIFSp5UevsFHJo0SUDK1ST
0KhUWoRsDNB/WFcaAa4aS2T5sHsxeNDxIA9UkQfDchqvfCs0VS6F/IBzG6R4lE3Gbes7
51H9WZi4LAVaOc/JhCBhti3eIKUjfZobRL+IyFMfY7IELP/ZduZo2pf6C6K/Z2df4evS
ZvggFJtiG4i7DUILEOKyCMgLRthk+5rcB4m5VdIZBRUF6RAtGkuOP1jtwWmInZqOG3fl
XUdg==
X-Forwarded-Encrypted: i=1; AJvYcCVney0csTk4+cMwl2BGSFBjCS0BWw4jlaEmwDi7Zw4mlZeRGIdKhtvI1iGkrs4pW6nCXManDjORmNwZFFs=@vger.kernel.org, AJvYcCWBHba2jFJFg9rza9qLGAx10XNB6BGvW4qt6WVad36UN87QV9xoz+3P3SaY0xFi0fokgVE8WoU8JssIFjE=@vger.kernel.org
X-Gm-Message-State: AOJu0Yzll+3hA2mGD8qcEco3dZbGDuk2+/X+ouca2Ec5NbtqEpdSnoRX
hYOs1QnUH0XQVo3EW8VX7ueZWpYNbXiqJ2kji+MoG4nGlXzAkfT/vcNG
X-Gm-Gg: ASbGncuzW0kLrkzSFCJ70cjXawTK5LtOj3OYp5eqjDhRce7XwjriZvD1Oa74dt1SsCM
OttYFnrJR5RP1vbanF5bLdvj52PhSP9Ucq1ym8k4o3C8zP00eoTndVITRKwJjOGYYataQq1DsJE
6DVwWs72cs6S0gFeVUqWuE01k+7dyKdpIgw/QsxEYijEajiYodJttKwBp2IlB8Mykt/COXlcToQ
oOKoCcRPMN6ASbYAisFQdMm8/rn1neb1hOJPzUrn/JMtfNBYbatL2t36eLTgJDtXrAiQz2o1Bvp
o8FtHG2nJgxQd/7z9NnoOo8OaAvKRQRjfxZCLSbAwpifL3S/Ou2+NOVJEEgPhoYACEqDK3E5rCT
MWLorD0CEhVtj9g==
X-Google-Smtp-Source: AGHT+IFEPwne2ttMNKIa+n0ICE8jkRX3AQsfZ+fAiNXrpYKRs5y4Ypd8txsA2x6HPfCUIi/0m2BD+g==
X-Received: by 2002:a05:6000:25c7:b0:3a4:ee36:ee4b with SMTP id ffacd0b85a97d-3a53188238cmr3679704f8f.11.1749226641555;
Fri, 06 Jun 2025 09:17:21 -0700 (PDT)
Received: from localhost (a95-94-245-170.cpe.netcabo.pt. [95.94.245.170])
by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a5322ae43fsm2281609f8f.25.2025.06.06.09.17.20
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 09:17:21 -0700 (PDT)
From: Rui Miguel Silva <rmfrfs@xxxxxxxxx>
X-Google-Original-From: "Rui Miguel Silva" <rui.silva@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
Mime-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Date: Fri, 06 Jun 2025 17:17:20 +0100
Message-Id: <DAFL3CTS8R5D.1FIGCAM5SXJPL@xxxxxxxxxx>
Cc: <kieran.bingham@xxxxxxxxxxxxxxxx>, <rmfrfs@xxxxxxxxx>,
<martink@xxxxxxxxx>, <kernel@xxxxxxx>, <mchehab@xxxxxxxxxx>,
<shawnguo@xxxxxxxxxx>, <s.hauer@xxxxxxxxxxxxxx>, <kernel@xxxxxxxxxxxxxx>,
<festevam@xxxxxxxxx>, <linux-media@xxxxxxxxxxxxxxx>, <imx@xxxxxxxxxxxxxxx>,
<linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH v2 0/2] media: Add line end IRQ to imx-mipi-csis driver
To: "Isaac Scott" <isaac.scott@xxxxxxxxxxxxxxxx>,
<laurent.pinchart@xxxxxxxxxxxxxxxx>
References: <20250606154414.540290-1-isaac.scott@xxxxxxxxxxxxxxxx>
In-Reply-To: <20250606154414.540290-1-isaac.scott@xxxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Isaac,
Many thanks for the patches.

On Fri Jun 6, 2025 at 4:44 PM WEST, Isaac Scott wrote:

> Many boards, such as the NXP i.MX 8M Plus, feature multiple interrupt
> registers. This series refactors interrupt status register debug handling=
to make
> it more intuitive to add other registers such as LINE_END, which has an
> entire register containing only one interrupt. Previously, the
> mipi_csi_events[] list contained a debug enable field, and this replaces
> that with a status_index, which indicates which status register contains
> the mask for the interrupt.
>
> The second patch adds the user line interrupt, which is useful for
> debugging, as it allows a user to trigger an interrupt after the MIPI
> CSI receiver has counted a configurable number of lines. This can make
> it possible to discern the true resolution of the image stream reaching
> the CSI receiver. It adds an entry to debugfs which lets users choose
> how many lines are needed to trigger the interrupt, and can be disabled
> both within and outside streaming by setting the value to 0.

LGTM.
for the all series:

Reviewed-by: Rui Miguel Silva <rui.silva@xxxxxxxxxx>

Cheers,
Rui

>
> ---
>
> Changes since v1:
> - Moved from magic number to enum in status_index
> - Clear INT_MSK_1 in enable_interrupts() when on =3D=3D false
> - use local variable in set_params() as in the interrupt handler
> - move interrupt handling code outside of spinlock
>
> Isaac Scott (2):
> media: platform: Refactor interrupt status registers
> media: platform: Add user line interrupt to imx-mipi-csis driver
>
> drivers/media/platform/nxp/imx-mipi-csis.c | 107 ++++++++++++++-------
> 1 file changed, 74 insertions(+), 33 deletions(-)
>
> --=20
> 2.43.0





Return-Path: <linux-kernel+bounces-676013-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 295F741E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:18:40 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5765717B142
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:18:41 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B9AC27E7CF;
Fri, 6 Jun 2025 16:18:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JRFIrEW1"
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 A065778F2F
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:18:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226713; cv=none; b=Zy0B92HF0XTDvTv76G/fIi17vwZCnZ8uJUNhi7rRaSktK5U5tBJpB6fUFyCPgFeDUykZr4ENZTvYa6DFojbeYGQDV0YKv7lYeHKg0CQ4fhCcrg/ApEbdBs9PmrCuCCWLm3WZQJnm86gWoRqlEno8cCrK4pbXcTsinjQthlN78Ik=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226713; c=relaxed/simple;
bh=NNLzJ+PAgzMkCRPjs969McDPkBUd5D8rkcuMPGyC2+A=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=KLUa45kvfvG5JDFe88RIQ8dvEBIEjgCdtmjNivK0D4+QzMAvwezMEplU1cGU/k0FpzuO2wW6S24EkMhNubbsgClY+6DR1+PgYQCPEtFF6dQJfGwMuuUXVJitu2j/kPa+PCAWkR/1b9QS0xOCq4MJgPrR0noSQz2u4Qc59C4AQy8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JRFIrEW1; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1749226710;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=8qAyPxag6dIVRowyQgYi5Fq3KS0p/re+LlLSWy5HXCw=;
b=JRFIrEW1UJ9/gaSOL14QRRvys6xeOC8+0qHPK/5IbYtYVRF7l7IS1P3J2HryQ8KD2bhZnT
1GPpcnz+dEGU3Uy0Bijq4JYnvfOfIFEX3VtMmJSISmCo8hDpFEXkNy+BJipMX+gAY0XO7E
eD3GFWq85InRCdf8nHtJAq1NoRmGg7o=
Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-ee_a-SlhNXGRgANhOQfgDw-1; Fri,
06 Jun 2025 12:18:27 -0400
X-MC-Unique: ee_a-SlhNXGRgANhOQfgDw-1
X-Mimecast-MFC-AGG-ID: ee_a-SlhNXGRgANhOQfgDw_1749226705
Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AAB731956089;
Fri, 6 Jun 2025 16:18:25 +0000 (UTC)
Received: from pauld.westford.csb (unknown [10.22.64.168])
by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E59B418003FD;
Fri, 6 Jun 2025 16:18:22 +0000 (UTC)
Date: Fri, 6 Jun 2025 12:18:20 -0400
From: Phil Auld <pauld@xxxxxxxxxx>
To: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>, mingo@xxxxxxxxxx,
juri.lelli@xxxxxxxxxx, dietmar.eggemann@xxxxxxx,
rostedt@xxxxxxxxxxx, bsegall@xxxxxxxxxx, mgorman@xxxxxxx,
vschneid@xxxxxxxxxx, clm@xxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [RFC][PATCH 5/5] sched: Add ttwu_queue support for delayed tasks
Message-ID: <20250606161820.GA224542@xxxxxxxxxxxxxxxxxx>
References: <20250520094538.086709102@xxxxxxxxxxxxx>
<20250520101727.984171377@xxxxxxxxxxxxx>
<CAKfTPtDOQVEMRWaK9xEVqSDKcvUfai4CUck6G=oOdaeRBhZQUw@xxxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAKfTPtDOQVEMRWaK9xEVqSDKcvUfai4CUck6G=oOdaeRBhZQUw@xxxxxxxxxxxxxx>
X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93
X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


Hi Peter,

On Fri, Jun 06, 2025 at 05:03:36PM +0200 Vincent Guittot wrote:
> On Tue, 20 May 2025 at 12:18, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > One of the things lost with introduction of DELAY_DEQUEUE is the
> > ability of TTWU to move those tasks around on wakeup, since they're
> > on_rq, and as such, need to be woken in-place.
>
> I was thinking that you would call select_task_rq() somewhere in the
> wake up path of delayed entity to get a chance to migrate it which was
> one reason for the perf regression (and which would have also been
> useful for EAS case) but IIUC, the task is still enqueued on the same
> CPU but the target cpu will do the enqueue itself instead on the local
> CPU. Or am I missing something ?

Yeah, this one still bites us. We ran these patches on our perf
tests (with out twiddling any FEATs) and it was basically a wash.

The fs regression we saw due to always waking up on the same cpu
was still present as expected based on this patch I suppose.

Thanks,
Phil

>
> >
> > Doing the in-place thing adds quite a bit of cross-cpu latency, add a
> > little something that gets remote CPUs to do their own in-place
> > wakeups, significantly reducing the rq->lock contention.
> >
> > Reported-by: Chris Mason <clm@xxxxxxxx>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > ---
> > kernel/sched/core.c | 74 ++++++++++++++++++++++++++++++++++++++++++------
> > kernel/sched/fair.c | 5 ++-
> > kernel/sched/features.h | 1
> > kernel/sched/sched.h | 1
> > 4 files changed, 72 insertions(+), 9 deletions(-)
> >
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -3784,6 +3784,8 @@ static int __ttwu_runnable(struct rq *rq
> > return 1;
> > }
> >
> > +static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags);
> > +
> > /*
> > * Consider @p being inside a wait loop:
> > *
> > @@ -3811,6 +3813,33 @@ static int __ttwu_runnable(struct rq *rq
> > */
> > static int ttwu_runnable(struct task_struct *p, int wake_flags)
> > {
> > +#ifdef CONFIG_SMP
> > + if (sched_feat(TTWU_QUEUE_DELAYED) && READ_ONCE(p->se.sched_delayed)) {
> > + /*
> > + * Similar to try_to_block_task():
> > + *
> > + * __schedule() ttwu()
> > + * prev_state = prev->state if (p->sched_delayed)
> > + * if (prev_state) smp_acquire__after_ctrl_dep()
> > + * try_to_block_task() p->state = TASK_WAKING
> > + * ... set_delayed()
> > + * RELEASE p->sched_delayed = 1
> > + *
> > + * __schedule() and ttwu() have matching control dependencies.
> > + *
> > + * Notably, once we observe sched_delayed we know the task has
> > + * passed try_to_block_task() and p->state is ours to modify.
> > + *
> > + * TASK_WAKING controls ttwu() concurrency.
> > + */
> > + smp_acquire__after_ctrl_dep();
> > + WRITE_ONCE(p->__state, TASK_WAKING);
> > +
> > + if (ttwu_queue_wakelist(p, task_cpu(p), wake_flags | WF_DELAYED))
> > + return 1;
> > + }
> > +#endif
> > +
> > CLASS(__task_rq_lock, guard)(p);
> > return __ttwu_runnable(guard.rq, p, wake_flags);
> > }
> > @@ -3830,12 +3859,41 @@ void sched_ttwu_pending(void *arg)
> > update_rq_clock(rq);
> >
> > llist_for_each_entry_safe(p, t, llist, wake_entry.llist) {
> > + struct rq *p_rq = task_rq(p);
> > + int ret;
> > +
> > + /*
> > + * This is the ttwu_runnable() case. Notably it is possible for
> > + * on-rq entities to get migrated -- even sched_delayed ones.
>
> I haven't found where the sched_delayed task could migrate on another cpu.
>
> > + */
> > + if (unlikely(p_rq != rq)) {
> > + rq_unlock(rq, &rf);
> > + p_rq = __task_rq_lock(p, &rf);
> > + }
> > +
> > + ret = __ttwu_runnable(p_rq, p, WF_TTWU);
> > +
> > + if (unlikely(p_rq != rq)) {
> > + if (!ret)
> > + set_task_cpu(p, cpu_of(rq));
> > +
> > + __task_rq_unlock(p_rq, &rf);
> > + rq_lock(rq, &rf);
> > + update_rq_clock(rq);
> > + }
> > +
> > + if (ret) {
> > + // XXX ttwu_stat()
> > + continue;
> > + }
> > +
> > + /*
> > + * This is the 'normal' case where the task is blocked.
> > + */
> > +
> > if (WARN_ON_ONCE(p->on_cpu))
> > smp_cond_load_acquire(&p->on_cpu, !VAL);
> >
> > - if (WARN_ON_ONCE(task_cpu(p) != cpu_of(rq)))
> > - set_task_cpu(p, cpu_of(rq));
> > -
> > ttwu_do_activate(rq, p, p->sched_remote_wakeup ? WF_MIGRATED : 0, &rf);
> > }
> >
> > @@ -3974,7 +4032,7 @@ static inline bool ttwu_queue_cond(struc
> >
> > static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
> > {
> > - bool def = sched_feat(TTWU_QUEUE_DEFAULT);
> > + bool def = sched_feat(TTWU_QUEUE_DEFAULT) || (wake_flags & WF_DELAYED);
> >
> > if (!ttwu_queue_cond(p, cpu, def))
> > return false;
> > @@ -4269,8 +4327,8 @@ int try_to_wake_up(struct task_struct *p
> > * __schedule(). See the comment for smp_mb__after_spinlock().
> > *
> > * Form a control-dep-acquire with p->on_rq == 0 above, to ensure
> > - * schedule()'s deactivate_task() has 'happened' and p will no longer
> > - * care about it's own p->state. See the comment in __schedule().
> > + * schedule()'s try_to_block_task() has 'happened' and p will no longer
> > + * care about it's own p->state. See the comment in try_to_block_task().
> > */
> > smp_acquire__after_ctrl_dep();
> >
> > @@ -6712,8 +6770,8 @@ static void __sched notrace __schedule(i
> > preempt = sched_mode == SM_PREEMPT;
> >
> > /*
> > - * We must load prev->state once (task_struct::state is volatile), such
> > - * that we form a control dependency vs deactivate_task() below.
> > + * We must load prev->state once, such that we form a control
> > + * dependency vs try_to_block_task() below.
> > */
> > prev_state = READ_ONCE(prev->__state);
> > if (sched_mode == SM_IDLE) {
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -5395,7 +5395,10 @@ static __always_inline void return_cfs_r
> >
> > static void set_delayed(struct sched_entity *se)
> > {
> > - se->sched_delayed = 1;
> > + /*
> > + * See TTWU_QUEUE_DELAYED in ttwu_runnable().
> > + */
> > + smp_store_release(&se->sched_delayed, 1);
> >
> > /*
> > * Delayed se of cfs_rq have no tasks queued on them.
> > --- a/kernel/sched/features.h
> > +++ b/kernel/sched/features.h
> > @@ -82,6 +82,7 @@ SCHED_FEAT(TTWU_QUEUE, false)
> > SCHED_FEAT(TTWU_QUEUE, true)
> > #endif
> > SCHED_FEAT(TTWU_QUEUE_ON_CPU, true)
> > +SCHED_FEAT(TTWU_QUEUE_DELAYED, false)
>
> I'm not sure that the feature will be tested as people mainly test
> default config
>
> > SCHED_FEAT(TTWU_QUEUE_DEFAULT, false)
> >
> > /*
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -2313,6 +2313,7 @@ static inline int task_on_rq_migrating(s
> > #define WF_RQ_SELECTED 0x80 /* ->select_task_rq() was called */
> >
> > #define WF_ON_CPU 0x0100
> > +#define WF_DELAYED 0x0200
> >
> > #ifdef CONFIG_SMP
> > static_assert(WF_EXEC == SD_BALANCE_EXEC);
> >
> >
>

--



Return-Path: <linux-kernel+bounces-676014-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id D2F9E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:19:00 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id AED783B1F8D
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:18:38 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3303C28982A;
Fri, 6 Jun 2025 16:18:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bOncAOwa"
Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DD1925776;
Fri, 6 Jun 2025 16:18:50 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226732; cv=none; b=RNy16OPQhg24FTFNM02LfDi6HflQ0T+9AdRgJLSFY6PWB2rVhhAPi6GcOzmWFANk5tG3B6Dr8HpUMF2ST4qhNConbUOZ1DKtqDJZOAhCwK36Nva9myONu/mQ2ck3+e0+4SgT9Qw+y+3ibXNdvW2OdNJxdVJfvMB+dEN591EPRic=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226732; c=relaxed/simple;
bh=dWnFfR86+yRV1AqMW+1ZmDq/fHzV4eGNUZ9bqCtwo0k=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=b7C8HKXiFVPQ4nvu9bVNbsBcXBM4769xMTBeGMHbjy0oj7W03uGXDAXvhHTDa+ObihCAt/Lkv+jRQlscBzwtyLSnWNc/xVjentPZOWnTkk6b5EcIfg+7JYtxbun6OT0Ati2W886gUQBHLfdzZZt7l26A51BB69IvcEy7QUpUXEs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bOncAOwa; arc=none smtp.client-ip=209.85.210.176
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-742caef5896so2032843b3a.3;
Fri, 06 Jun 2025 09:18:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749226730; x=1749831530; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=khnZK0HxH+RVmPgUu4L2j9Kp/5clVYx6qzOMk6qDvaI=;
b=bOncAOwazRTmIzUAIAxu58VNoRBHlmYHrtIwc1ugWcNoNFd32MdOHtrt/aLn/Evvw8
Ri9dkTC5ZobMrilzNhwBDmvZ4FGRX9M9PzpSPhGogFDexwWXB3kE1g5VRIZtxF/zFc1/
16I2uaL8NEzbfNZiQOl/iiJRrPlD20Xi8HzIaiPzoFvrX2MOLBKw6Xga2GNYxxAfeCyl
w42NQ7cGU29Hoxk45w+A1XDyF1Xnxufx/UMiOqBPIkfzaqEfGTRxZh4RlyTG4KtjoBlP
xeJi3ir8vjpoFd/VYQDDMK40GAlwpy1GDyW4ao5GJ852P3mpDnJYoWISRU/iJ2iEVZ/Q
QI3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226730; x=1749831530;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=khnZK0HxH+RVmPgUu4L2j9Kp/5clVYx6qzOMk6qDvaI=;
b=D11jYeaharIC3iN7QgWCG715TyV0iLJ2drZUxJxP/K9Fstoisn+FyL3YtHxTjX7ufD
hvFdDONmaWVrzLwhs+YkCw5406SVfRCOSLby9n0FrkmzNixPEc7qarLJAHkpBRW/YgAT
+CBJ40OMeEeLDKc4MqZcMWPfV7cTCC9iFN5aLOygSAhmqJD5RdlGPTvUC4A7225mAdmZ
Nh9Y+Tn5EoOrNKKOr94B3ZnN/yEEtCXqOcwKGpUvT399OhV2N7Om2RpjsVYWWz5129KB
k5ktcArvd5vGw77S0R4D6kj/LpxCiNj/9vgiNc+m2VgOIKFUFYFtsGwt5C7fMSDo9LkV
FJ2Q==
X-Forwarded-Encrypted: i=1; AJvYcCU4XP3CuY+BIEoJsIpiV287+HyN5zyQBpjpdZ8j12JrE5qGsan9wdl7VyH+aCWpm8Kd5mycqBqG@xxxxxxxxxxxxxxx, AJvYcCWmv77Irmw/3Al5JewN7UlsUVG59nlnTw84TO/VzHj0yDQU/WSiMu19NvlnytINasVnP/0b1pvDQQ+uJs9T@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YzY+59qcTsbakGZUxXjIVwVuvYjzB+5z+sBSJXRuNynvN7Y/rVo
tieW+LvDY08tQf0bvzJDNEQmDZ8nJ0V7gISw792d2h2fDU6MC249kXfR
X-Gm-Gg: ASbGncsxZRFv0NPgHNOPKYlZU+GRYim9Hy3LhOkq8h8EcVbARy6ejJar9ZLpFQpLapt
Jkb49arShKksMc2VKK28DwbvUpJQZmSDMV80oZr8glj8b8nv7iCYyVS2ZRZ1m0ez5KLnyx5zHsH
W3h9E4IxOt21N6B2lGxxrK/VrCQcz9z9ocZoYC76rdRA/eYI5fAXegm0FPy4XKIVQj7rQE8Mmgh
OycuyYe6HaWiM443eXV8vhkQgMA+AkvPU5caPFunaH4oSwujvEO3K8xpq9vmU1yXeNiK3w6OjDw
A9TOfW6bbkxi8nuYOVbdiRgpZabDvJdOCyD+A6w8q+1j4h6OkfZ05LSsqSN1Pw==
X-Google-Smtp-Source: AGHT+IHg3rn/J5WiRw4n46BOfiR1gQXAzMgYDco05ru6GjD/i//8yDpuC7tIQ7TeWHWyfqVEqAso9g==
X-Received: by 2002:a05:6a00:3c88:b0:742:3fb4:f992 with SMTP id d2e1a72fcca58-74827fd5f47mr5154507b3a.10.1749226730178;
Fri, 06 Jun 2025 09:18:50 -0700 (PDT)
Received: from jemmy.. ([180.172.46.169])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482af38353sm1518675b3a.10.2025.06.06.09.18.47
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 09:18:49 -0700 (PDT)
From: Jemmy Wong <jemmywong512@xxxxxxxxx>
To: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@xxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>,
Johannes Weiner <hannes@xxxxxxxxxxx>,
Waiman Long <longman@xxxxxxxxxx>,
cgroups@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 0/3] cgroup: Add lock guard support
Date: Sat, 7 Jun 2025 00:18:38 +0800
Message-ID: <20250606161841.44354-1-jemmywong512@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

v1 changes:
- remove guard support for BPF
- split patch into parts

v0 link:
https://lore.kernel.org/all/20250605211053.19200-1-jemmywong512@xxxxxxxxx/

Jemmy Wong (3):
cgroup: add lock guard support for cgroup_muetx
cgroup: add lock guard support for css_set_lock and rcu
cgroup: add lock guard support for others

include/linux/cgroup.h | 7 +
kernel/cgroup/cgroup-internal.h | 8 +-
kernel/cgroup/cgroup-v1.c | 56 ++-
kernel/cgroup/cgroup.c | 720 +++++++++++++++-----------------
kernel/cgroup/cpuset-v1.c | 16 +-
kernel/cgroup/debug.c | 185 ++++----
kernel/cgroup/freezer.c | 28 +-
kernel/cgroup/namespace.c | 8 +-
8 files changed, 483 insertions(+), 545 deletions(-)

--
2.43.0



Return-Path: <linux-kernel+bounces-676015-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 12EEA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:19:19 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 189DC7AB722
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:17:56 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A234C289E3A;
Fri, 6 Jun 2025 16:18:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NC11wwJK"
Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12D1B289E05;
Fri, 6 Jun 2025 16:18:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226735; cv=none; b=Blh0JsjdMCrxblE4soSAkQ3/Mz/VyFHM6bpTa8tfUmAVE5MJpbqZhWhtPQr7KFrGHFRaCjKE5oe1fDIxDb3l6++gneuZrF6v/d36hxZyWieTydREFv7N3ZZQSR3KIhFogfm3OC4tzy1oo7XIqXrKRHQoGLovB6WH4ukTCVABbFU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226735; c=relaxed/simple;
bh=Ys6phxAi1yCzadfLuMIMyyXTOESVHhFvpOJF7AGYjSk=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=Vr7ifI0g1gYu1FGQfmIuwo5aewNPg0kjVZSVMz+b2+zSvWOZ1u2YknH6hwrDMn7a2ziYR1sCB8bL0LqsxbrKxB1aG7XrLBQUEBn8TizTsz4baAC4CD2l0GWSQ/ody8UzIOlEcS6zaehrJpXvaHeP3Ubd1S9qsl1Ogl++v5fn788=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NC11wwJK; arc=none smtp.client-ip=209.85.210.179
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-747fc7506d4so2370869b3a.0;
Fri, 06 Jun 2025 09:18:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749226733; x=1749831533; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=B1D/UwBfO9rb1qi8d6FbfGYivA4b5vNq0TisU6WUgjI=;
b=NC11wwJK+oN7ZRJ6VurdDcWObuKIGMy8+yg86LRol7Tto12d+bFTeiLT83iU5vQLcH
TEC28Bw6WIBUNpz+IMuH/a9rptnDxsMcI2ZBnS33fNkbMIEt5l48Xage3Tjk8T15iQb7
ngKe2FK8S32Ln3utrPnCGrrgJhcNqwveFvxVz2J+B7/rWxQa6ruGLwlMhumqNeisvPUA
SYmErGR5SwjFt7F176jMaLLZg/ZWnmEeXc5McMR0CcG485T6LbMet2cSgz+PfEp+w/2Y
ApBcF50OkKyDaW8fJJMwyRM+XYcRj9EKPl9XgiH9Uf4m3g78mLZ5P9ri3cR9f5K4nmF6
QgRw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226733; x=1749831533;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=B1D/UwBfO9rb1qi8d6FbfGYivA4b5vNq0TisU6WUgjI=;
b=ZBHBkm+/zcpfRhJXXnU5P+d+ZUU1KuDjWrqMoGe8GX0ADqVHQdmVLEIDEx32M11mAb
EW4r8dQbP/Yi45k0S5P5UXNflhB45dOkttGGi+dEe0BI4RxWOhUgApTEJhzpPJARF0U4
9+rJdZF8QyxJS4ePJIqF+NEeUKvwMO1bd5+Tdi3+qdf3dZTa7D0dA6GKyA7c/KnhAV+t
FHuBnSpbk/InyqqlUZHZILZnQNO7W4wBuel6NkTIUKoTogXaSSUVze97Re/F+2ZH+MOb
k1lnIObrl2ons5iGMd5lL4nnEZiIUXs65kdcRI94rgP+SSfoxgMpwFmas1auqlPPk4BK
ad3A==
X-Forwarded-Encrypted: i=1; AJvYcCVl+3JrhTz3SOB4XJrdoI0rYvPpTex0HTE1WVLmXu3zBia7eiWOBWPWWeWdBPakRNDy0AbTUHEa@xxxxxxxxxxxxxxx, AJvYcCX/s9Ae70YhE+OxO6qcybbLPwMvW179772Hy/CY29AMO5+yavJfUMvKeJBl/DleXg2WdPCk90dXdi8/Sp9C@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Yz5ZxWKFfbsuLfCv0+mHyh68P4npQWdJCa2+trm5UryOXdOy8EL
S8INQJKmVYuq9NZ2ntneDHXyJnfEay8fGytj3KeUa4WPQACWxoJPBJBkuk4hJpnwGuE=
X-Gm-Gg: ASbGnctHUhDbTdy+H4sP7oLDyXmRG1g42dLAiOywH0wxbMul5FWtYGioXjis1XCsbrd
HgClQ7bLAeY9JjP8P6/PvWqFRW6u52E/2k0GGfsgRyBW41c1zWE4e2dfvw3vBgu3RtUDC8lognL
TYFg4bXi1hpkEEJu69dPRpizLwq4HYvdjl1DcKc89Gu6i1CrMW8QNo83vIZpYvGXmh8R1EFuJWD
qQeyS+D4JYA1UQ0ahZQgPAWr7JOuJS6xkZKcK3Aue9ICSaG7zooQr44Vj6Ln5dasLa1P5tWMvXL
sG0oInFl3AUMR8tLND+xRzxISipMq0Dd4VNG05UpNQajTQUUSrw=
X-Google-Smtp-Source: AGHT+IFAIDJwYl1tg2vjnywkbJPdZQ9Xx5bwB7Cih6rVhVZKDzc36c6HegpZFRbjInSIIK5CEsY+FA==
X-Received: by 2002:a05:6a20:db0c:b0:215:e818:9fe5 with SMTP id adf61e73a8af0-21ee2500408mr5198758637.18.1749226733054;
Fri, 06 Jun 2025 09:18:53 -0700 (PDT)
Received: from jemmy.. ([180.172.46.169])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482af38353sm1518675b3a.10.2025.06.06.09.18.50
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 09:18:52 -0700 (PDT)
From: Jemmy Wong <jemmywong512@xxxxxxxxx>
To: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@xxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>,
Johannes Weiner <hannes@xxxxxxxxxxx>,
Waiman Long <longman@xxxxxxxxxx>,
cgroups@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 1/3] cgroup: add lock guard support for cgroup_muetx
Date: Sat, 7 Jun 2025 00:18:39 +0800
Message-ID: <20250606161841.44354-2-jemmywong512@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606161841.44354-1-jemmywong512@xxxxxxxxx>
References: <20250606161841.44354-1-jemmywong512@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Signed-off-by: Jemmy Wong <jemmywong512@xxxxxxxxx>

---
include/linux/cgroup.h | 7 ++++
kernel/cgroup/cgroup-v1.c | 16 ++++----
kernel/cgroup/cgroup.c | 81 +++++++++++++++++++--------------------
3 files changed, 54 insertions(+), 50 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b18fb5fcb38e..979f827452ad 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -382,6 +382,10 @@ static inline void cgroup_put(struct cgroup *cgrp)

extern struct mutex cgroup_mutex;

+DEFINE_LOCK_GUARD_0(cgroup_mutex,
+ mutex_lock(&cgroup_mutex),
+ mutex_unlock(&cgroup_mutex))
+
static inline void cgroup_lock(void)
{
mutex_lock(&cgroup_mutex);
@@ -656,6 +660,9 @@ struct cgroup *cgroup_get_from_id(u64 id);
struct cgroup_subsys_state;
struct cgroup;

+extern struct mutex cgroup_mutex;
+DEFINE_LOCK_GUARD_0(cgroup_mutex, , ,)
+
static inline u64 cgroup_id(const struct cgroup *cgrp) { return 1; }
static inline void css_get(struct cgroup_subsys_state *css) {}
static inline void css_put(struct cgroup_subsys_state *css) {}
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index fa24c032ed6f..f4658eda4445 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -64,7 +64,8 @@ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)
struct cgroup_root *root;
int retval = 0;

- cgroup_lock();
+ guard(cgroup_mutex)();
+
cgroup_attach_lock(true);
for_each_root(root) {
struct cgroup *from_cgrp;
@@ -78,7 +79,6 @@ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)
break;
}
cgroup_attach_unlock(true);
- cgroup_unlock();

return retval;
}
@@ -862,13 +862,11 @@ static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent
kernfs_break_active_protection(new_parent);
kernfs_break_active_protection(kn);

- cgroup_lock();
-
- ret = kernfs_rename(kn, new_parent, new_name_str);
- if (!ret)
- TRACE_CGROUP_PATH(rename, cgrp);
-
- cgroup_unlock();
+ scoped_guard(cgroup_mutex) {
+ ret = kernfs_rename(kn, new_parent, new_name_str);
+ if (!ret)
+ TRACE_CGROUP_PATH(rename, cgrp);
+ }

kernfs_unbreak_active_protection(kn);
kernfs_unbreak_active_protection(new_parent);
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index a723b7dc6e4e..54f80afe4f65 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2224,13 +2224,13 @@ int cgroup_do_get_tree(struct fs_context *fc)
struct super_block *sb = fc->root->d_sb;
struct cgroup *cgrp;

- cgroup_lock();
- spin_lock_irq(&css_set_lock);
+ scoped_guard(cgroup_mutex) {
+ spin_lock_irq(&css_set_lock);

- cgrp = cset_cgroup_from_root(ctx->ns->root_cset, ctx->root);
+ cgrp = cset_cgroup_from_root(ctx->ns->root_cset, ctx->root);

- spin_unlock_irq(&css_set_lock);
- cgroup_unlock();
+ spin_unlock_irq(&css_set_lock);
+ }

nsdentry = kernfs_node_dentry(cgrp->kn, sb);
dput(fc->root);
@@ -2440,13 +2440,12 @@ int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen,
{
int ret;

- cgroup_lock();
+ guard(cgroup_mutex)();
spin_lock_irq(&css_set_lock);

ret = cgroup_path_ns_locked(cgrp, buf, buflen, ns);

spin_unlock_irq(&css_set_lock);
- cgroup_unlock();

return ret;
}
@@ -4472,9 +4471,10 @@ int cgroup_rm_cftypes(struct cftype *cfts)
if (!(cfts[0].flags & __CFTYPE_ADDED))
return -ENOENT;

- cgroup_lock();
- cgroup_rm_cftypes_locked(cfts);
- cgroup_unlock();
+ scoped_guard(cgroup_mutex) {
+ cgroup_rm_cftypes_locked(cfts);
+ }
+
return 0;
}

@@ -4506,14 +4506,13 @@ int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
if (ret)
return ret;

- cgroup_lock();
-
- list_add_tail(&cfts->node, &ss->cfts);
- ret = cgroup_apply_cftypes(cfts, true);
- if (ret)
- cgroup_rm_cftypes_locked(cfts);
+ scoped_guard(cgroup_mutex) {
+ list_add_tail(&cfts->node, &ss->cfts);
+ ret = cgroup_apply_cftypes(cfts, true);
+ if (ret)
+ cgroup_rm_cftypes_locked(cfts);
+ }

- cgroup_unlock();
return ret;
}

@@ -5489,14 +5488,14 @@ static void css_free_rwork_fn(struct work_struct *work)
}
}

-static void css_release_work_fn(struct work_struct *work)
+static inline void css_release_work_fn_locked(struct work_struct *work)
{
struct cgroup_subsys_state *css =
container_of(work, struct cgroup_subsys_state, destroy_work);
struct cgroup_subsys *ss = css->ss;
struct cgroup *cgrp = css->cgroup;

- cgroup_lock();
+ guard(cgroup_mutex)();

css->flags |= CSS_RELEASED;
list_del_rcu(&css->sibling);
@@ -5550,8 +5549,14 @@ static void css_release_work_fn(struct work_struct *work)
NULL);
}

- cgroup_unlock();
+}
+
+static void css_release_work_fn(struct work_struct *work)
+{
+ struct cgroup_subsys_state *css =
+ container_of(work, struct cgroup_subsys_state, destroy_work);

+ css_release_work_fn_locked(work);
INIT_RCU_WORK(&css->destroy_rwork, css_free_rwork_fn);
queue_rcu_work(cgroup_destroy_wq, &css->destroy_rwork);
}
@@ -5914,7 +5919,7 @@ static void css_killed_work_fn(struct work_struct *work)
struct cgroup_subsys_state *css =
container_of(work, struct cgroup_subsys_state, destroy_work);

- cgroup_lock();
+ guard(cgroup_mutex)();

do {
offline_css(css);
@@ -5922,8 +5927,6 @@ static void css_killed_work_fn(struct work_struct *work)
/* @css can't go away while we're holding cgroup_mutex */
css = css->parent;
} while (css && atomic_dec_and_test(&css->online_cnt));
-
- cgroup_unlock();
}

/* css kill confirmation processing requires process context, bounce */
@@ -6115,7 +6118,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early)

pr_debug("Initializing cgroup subsys %s\n", ss->name);

- cgroup_lock();
+ guard(cgroup_mutex)();

idr_init(&ss->css_idr);
INIT_LIST_HEAD(&ss->cfts);
@@ -6161,8 +6164,6 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early)
BUG_ON(!list_empty(&init_task.tasks));

BUG_ON(online_css(css));
-
- cgroup_unlock();
}

/**
@@ -6224,20 +6225,18 @@ int __init cgroup_init(void)

get_user_ns(init_cgroup_ns.user_ns);

- cgroup_lock();
-
- /*
- * Add init_css_set to the hash table so that dfl_root can link to
- * it during init.
- */
- hash_add(css_set_table, &init_css_set.hlist,
- css_set_hash(init_css_set.subsys));
-
- cgroup_bpf_lifetime_notifier_init();
+ scoped_guard(cgroup_mutex) {
+ /*
+ * Add init_css_set to the hash table so that dfl_root can link to
+ * it during init.
+ */
+ hash_add(css_set_table, &init_css_set.hlist,
+ css_set_hash(init_css_set.subsys));

- BUG_ON(cgroup_setup_root(&cgrp_dfl_root, 0));
+ cgroup_bpf_lifetime_notifier_init();

- cgroup_unlock();
+ BUG_ON(cgroup_setup_root(&cgrp_dfl_root, 0));
+ }

for_each_subsys(ss, ssid) {
if (ss->early_init) {
@@ -6289,9 +6288,9 @@ int __init cgroup_init(void)
if (ss->bind)
ss->bind(init_css_set.subsys[ssid]);

- cgroup_lock();
- css_populate_dir(init_css_set.subsys[ssid]);
- cgroup_unlock();
+ scoped_guard(cgroup_mutex) {
+ css_populate_dir(init_css_set.subsys[ssid]);
+ }
}

/* init_css_set.subsys[] has been updated, re-hash */
--
2.43.0



Return-Path: <linux-kernel+bounces-676017-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 5167A41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:19:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 117B03B200E
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:19:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2226428A1DD;
Fri, 6 Jun 2025 16:19:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JvfOMurp"
Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8287628A1CE;
Fri, 6 Jun 2025 16:19:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226742; cv=none; b=Q02eMB5WQN/efE4OvnIR6SUSknxpogN25O/LTGyJRF2VpzShogqHe4jgg+dWTGTPBoTVZWJMaWlzh/VMlfTtSHl0Uqq585T3ct75dNKNss/ZizMd/qghHzhRI8g1FFMDyezgnU+AAzA8KKdfQpW374yMYQX9vQgvYWcl1w+3OOU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226742; c=relaxed/simple;
bh=lLb+jNOrtfcqwgNscb056qIBxvga8xPQUWy2hvwYULk=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=kv3YVW3lgYZJoyRLRMTuhllY5n85asDFThUerTbmrK3XJi4l+pSx4jnhC3LEgUnLBOrVwjXpf4Ed/frHCD9IxXlGvHNXLbp3chCswOsrE27Vx9KmgX832ohhJfKxV0xDEZ7T+8xZdg7gvg9CsTgwOgdgAu1RTjU1S6ZazkmGXmw=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JvfOMurp; arc=none smtp.client-ip=209.85.210.181
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-72d3b48d2ffso1912247b3a.2;
Fri, 06 Jun 2025 09:19:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749226740; x=1749831540; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=WmddC+fvugcNh6NPL5Z6V5D8fMLub+35xnJ4f4NuuCY=;
b=JvfOMurpwNZkdo5/SkBpxrhg7n1NReDOujg2lnxmifhJ3zThO6fnSOiZv2L1KmTO13
4OLlmAWhz9GmC7T/RRMRQetl5UsWT8G0AGzYDEUAbN5NIqOprard2nTtVVAwvGzU4lFI
8q43M5m1jpioPfu0AxgmFmi6ieFiz5aIcBdkiDcbnww7/CO7bA6SPR5gMhO9oaX2DYDf
/UXxFwiVSELirSkpMD2oKWdvJDJTZrpOYS3zxbua0mj/SgHKLdkOZhpzU8XmjKd4+7He
aVDdo2nHURy7kVVJJpOO4q5hyO/y/oo3Kcfx51jhm5a/CXoi/r6uVfKyFMDxGUtfkyHZ
sNgA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226740; x=1749831540;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=WmddC+fvugcNh6NPL5Z6V5D8fMLub+35xnJ4f4NuuCY=;
b=Rz4/X62ozB8MM0JudsOZETocJ9I3QgwpMvqS2RBHtUQcozIXaKnark066tZeAoAS/E
YLBcQMcw3qfz6Hq4rvki1U5dOQqkanR5Lpc+mSXgkLzbAImLiXR3ydtY00VAORcXhf/L
yyxnSVYxSXTbqOfvTni5kvLPe2K5uZrDX0wiJBg1yyh/+o6HwAiNExaYkf7e6G4/Hs0H
yWpvgzj38R1IzasSLHe+yTJQfkRd9gfP/C/A167aGwcWS5d3OGqYNJYahyWCeQ5cnIT6
gejxIACPKUwpVEXPsQvpbn8/jwoXNWvtSD0xER3d45e3h7bYk1v3+JtaFeu2wcUS2h//
oDsg==
X-Forwarded-Encrypted: i=1; AJvYcCV1Gr4k06cbg1Etx70if3399gHw4xwo/W5xdvvGy8dv+6qBIKMfX6RC/qJjfUW2Fma27Di0dtlfXAbBRzUu@xxxxxxxxxxxxxxx, AJvYcCWQklR7TqNtjESjFp3v13ZpXkv+EbFOMdLm0izv2L8ihr2fn6CjgqkbkaFZB4DKdtWVgGyZM+s3@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0Ywg1LqKXP38TQtVk7RJXjurUEc++RVE+tpVi9ZSmYJ/Iby3Ny0x
9lKtwMaYAkpNd5UhvunBwrHVM+Ir97bct4c24tqYHcVMEX+bJTe9wRKd
X-Gm-Gg: ASbGncvpRSHkXfqav0egCunitZ8nsfOmeCw7T18/CN5/pwe0zkc5a29b9TojNGDTurF
3AXj/8TBnV1/aimswrA8NfvhiY4EP6fYB/FtEcgl5YDje6l8Ez3UYh50ekYuwhxN8Ni2CK4Dbi8
DTYBKCfuMqwZ6Ud2Hq2eOKXYtrHhP886hhIupbcaQST3yGMxR/zMKW9lrpKq9jPn2m3P4hvXjVM
wIaRzvk1zvfBa3BaArhGp7dXAdsACLEPnMDmrqNJ1tAt4aEz+r4/1RoCCoR2/UHibWJbb1c3kug
/LDADIhjsmCfkUYfWFXUbeY76gxmDeYTqzWeP6Ae/Fz+bwGYvXK023lTph22cA==
X-Google-Smtp-Source: AGHT+IFcXtPfFGYXvkgSpvJ7vtSOpxnnhRLikBp1U3gJWE6ad36suuVrBjAV85Ov9GEOGtdfNwEpHg==
X-Received: by 2002:a05:6a00:4646:b0:73e:1566:5960 with SMTP id d2e1a72fcca58-748280ab71bmr6362559b3a.19.1749226739523;
Fri, 06 Jun 2025 09:18:59 -0700 (PDT)
Received: from jemmy.. ([180.172.46.169])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482af38353sm1518675b3a.10.2025.06.06.09.18.56
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 09:18:59 -0700 (PDT)
From: Jemmy Wong <jemmywong512@xxxxxxxxx>
To: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@xxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>,
Johannes Weiner <hannes@xxxxxxxxxxx>,
Waiman Long <longman@xxxxxxxxxx>,
cgroups@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 3/3] cgroup: add lock guard support for others
Date: Sat, 7 Jun 2025 00:18:41 +0800
Message-ID: <20250606161841.44354-4-jemmywong512@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606161841.44354-1-jemmywong512@xxxxxxxxx>
References: <20250606161841.44354-1-jemmywong512@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Signed-off-by: Jemmy Wong <jemmywong512@xxxxxxxxx>

---
kernel/cgroup/cgroup-internal.h | 8 ++--
kernel/cgroup/cgroup-v1.c | 11 +++--
kernel/cgroup/cgroup.c | 73 ++++++++++++---------------------
3 files changed, 35 insertions(+), 57 deletions(-)

diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h
index b14e61c64a34..5430454d38ca 100644
--- a/kernel/cgroup/cgroup-internal.h
+++ b/kernel/cgroup/cgroup-internal.h
@@ -198,8 +198,6 @@ void put_css_set_locked(struct css_set *cset);

static inline void put_css_set(struct css_set *cset)
{
- unsigned long flags;
-
/*
* Ensure that the refcount doesn't hit zero while any readers
* can see it. Similar to atomic_dec_and_lock(), but for an
@@ -208,9 +206,9 @@ static inline void put_css_set(struct css_set *cset)
if (refcount_dec_not_one(&cset->refcount))
return;

- spin_lock_irqsave(&css_set_lock, flags);
- put_css_set_locked(cset);
- spin_unlock_irqrestore(&css_set_lock, flags);
+ scoped_guard(spinlock_irqsave, &css_set_lock) {
+ put_css_set_locked(cset);
+ }
}

/*
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index fcc2d474b470..91c6ba4e441d 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -1291,7 +1291,6 @@ struct cgroup *task_get_cgroup1(struct task_struct *tsk, int hierarchy_id)
{
struct cgroup *cgrp = ERR_PTR(-ENOENT);
struct cgroup_root *root;
- unsigned long flags;

guard(rcu)();
for_each_root(root) {
@@ -1300,11 +1299,11 @@ struct cgroup *task_get_cgroup1(struct task_struct *tsk, int hierarchy_id)
continue;
if (root->hierarchy_id != hierarchy_id)
continue;
- spin_lock_irqsave(&css_set_lock, flags);
- cgrp = task_cgroup_from_root(tsk, root);
- if (!cgrp || !cgroup_tryget(cgrp))
- cgrp = ERR_PTR(-ENOENT);
- spin_unlock_irqrestore(&css_set_lock, flags);
+ scoped_guard(spinlock_irqsave, &css_set_lock) {
+ cgrp = task_cgroup_from_root(tsk, root);
+ if (!cgrp || !cgroup_tryget(cgrp))
+ cgrp = ERR_PTR(-ENOENT);
+ }
break;
}

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 46b677a066d1..ea98679b01e1 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -335,28 +335,23 @@ static int cgroup_idr_alloc(struct idr *idr, void *ptr, int start, int end,
int ret;

idr_preload(gfp_mask);
- spin_lock_bh(&cgroup_idr_lock);
- ret = idr_alloc(idr, ptr, start, end, gfp_mask & ~__GFP_DIRECT_RECLAIM);
- spin_unlock_bh(&cgroup_idr_lock);
+ scoped_guard(spinlock_bh, &cgroup_idr_lock) {
+ ret = idr_alloc(idr, ptr, start, end, gfp_mask & ~__GFP_DIRECT_RECLAIM);
+ }
idr_preload_end();
return ret;
}

static void *cgroup_idr_replace(struct idr *idr, void *ptr, int id)
{
- void *ret;
-
- spin_lock_bh(&cgroup_idr_lock);
- ret = idr_replace(idr, ptr, id);
- spin_unlock_bh(&cgroup_idr_lock);
- return ret;
+ guard(spinlock_bh)(&cgroup_idr_lock);
+ return idr_replace(idr, ptr, id);
}

static void cgroup_idr_remove(struct idr *idr, int id)
{
- spin_lock_bh(&cgroup_idr_lock);
+ guard(spinlock_bh)(&cgroup_idr_lock);
idr_remove(idr, id);
- spin_unlock_bh(&cgroup_idr_lock);
}

static bool cgroup_has_tasks(struct cgroup *cgrp)
@@ -583,20 +578,19 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgrp,
if (!CGROUP_HAS_SUBSYS_CONFIG)
return NULL;

- rcu_read_lock();
+ guard(rcu)();

do {
css = cgroup_css(cgrp, ss);

if (css && css_tryget_online(css))
- goto out_unlock;
+ return css;
cgrp = cgroup_parent(cgrp);
} while (cgrp);

css = init_css_set.subsys[ss->id];
css_get(css);
-out_unlock:
- rcu_read_unlock();
+
return css;
}
EXPORT_SYMBOL_GPL(cgroup_get_e_css);
@@ -1691,9 +1685,9 @@ static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft)
struct cgroup_subsys_state *css = cgroup_css(cgrp, cft->ss);
struct cgroup_file *cfile = (void *)css + cft->file_offset;

- spin_lock_irq(&cgroup_file_kn_lock);
- cfile->kn = NULL;
- spin_unlock_irq(&cgroup_file_kn_lock);
+ scoped_guard(spinlock_irq, &cgroup_file_kn_lock) {
+ cfile->kn = NULL;
+ }

timer_delete_sync(&cfile->notify_timer);
}
@@ -4277,9 +4271,9 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,

timer_setup(&cfile->notify_timer, cgroup_file_notify_timer, 0);

- spin_lock_irq(&cgroup_file_kn_lock);
- cfile->kn = kn;
- spin_unlock_irq(&cgroup_file_kn_lock);
+ scoped_guard(spinlock_irq, &cgroup_file_kn_lock) {
+ cfile->kn = kn;
+ }
}

return 0;
@@ -4534,9 +4528,7 @@ int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
*/
void cgroup_file_notify(struct cgroup_file *cfile)
{
- unsigned long flags;
-
- spin_lock_irqsave(&cgroup_file_kn_lock, flags);
+ guard(spinlock_irqsave)(&cgroup_file_kn_lock);
if (cfile->kn) {
unsigned long last = cfile->notified_at;
unsigned long next = last + CGROUP_FILE_NOTIFY_MIN_INTV;
@@ -4548,7 +4540,6 @@ void cgroup_file_notify(struct cgroup_file *cfile)
cfile->notified_at = jiffies;
}
}
- spin_unlock_irqrestore(&cgroup_file_kn_lock, flags);
}

/**
@@ -4560,10 +4551,10 @@ void cgroup_file_show(struct cgroup_file *cfile, bool show)
{
struct kernfs_node *kn;

- spin_lock_irq(&cgroup_file_kn_lock);
- kn = cfile->kn;
- kernfs_get(kn);
- spin_unlock_irq(&cgroup_file_kn_lock);
+ scoped_guard(spinlock_irq, &cgroup_file_kn_lock) {
+ kn = cfile->kn;
+ kernfs_get(kn);
+ }

if (kn)
kernfs_show(kn, show);
@@ -4987,11 +4978,10 @@ static void css_task_iter_advance(struct css_task_iter *it)
void css_task_iter_start(struct cgroup_subsys_state *css, unsigned int flags,
struct css_task_iter *it)
{
- unsigned long irqflags;

memset(it, 0, sizeof(*it));

- spin_lock_irqsave(&css_set_lock, irqflags);
+ guard(spinlock_irqsave)(&css_set_lock);

it->ss = css->ss;
it->flags = flags;
@@ -5004,8 +4994,6 @@ void css_task_iter_start(struct cgroup_subsys_state *css, unsigned int flags,
it->cset_head = it->cset_pos;

css_task_iter_advance(it);
-
- spin_unlock_irqrestore(&css_set_lock, irqflags);
}

/**
@@ -5018,14 +5006,12 @@ void css_task_iter_start(struct cgroup_subsys_state *css, unsigned int flags,
*/
struct task_struct *css_task_iter_next(struct css_task_iter *it)
{
- unsigned long irqflags;
-
if (it->cur_task) {
put_task_struct(it->cur_task);
it->cur_task = NULL;
}

- spin_lock_irqsave(&css_set_lock, irqflags);
+ guard(spinlock_irqsave)(&css_set_lock);

/* @it may be half-advanced by skips, finish advancing */
if (it->flags & CSS_TASK_ITER_SKIPPED)
@@ -5038,8 +5024,6 @@ struct task_struct *css_task_iter_next(struct css_task_iter *it)
css_task_iter_advance(it);
}

- spin_unlock_irqrestore(&css_set_lock, irqflags);
-
return it->cur_task;
}

@@ -5051,13 +5035,10 @@ struct task_struct *css_task_iter_next(struct css_task_iter *it)
*/
void css_task_iter_end(struct css_task_iter *it)
{
- unsigned long irqflags;
-
if (it->cur_cset) {
- spin_lock_irqsave(&css_set_lock, irqflags);
+ guard(spinlock_irqsave)(&css_set_lock);
list_del(&it->iters_node);
put_css_set_locked(it->cur_cset);
- spin_unlock_irqrestore(&css_set_lock, irqflags);
}

if (it->cur_dcset)
@@ -6737,10 +6718,10 @@ void cgroup_post_fork(struct task_struct *child,
* too. Let's set the JOBCTL_TRAP_FREEZE jobctl bit to
* get the task into the frozen state.
*/
- spin_lock(&child->sighand->siglock);
- WARN_ON_ONCE(child->frozen);
- child->jobctl |= JOBCTL_TRAP_FREEZE;
- spin_unlock(&child->sighand->siglock);
+ scoped_guard(spinlock, &child->sighand->siglock) {
+ WARN_ON_ONCE(child->frozen);
+ child->jobctl |= JOBCTL_TRAP_FREEZE;
+ }

/*
* Calling cgroup_update_frozen() isn't required here,
--
2.43.0



Return-Path: <linux-kernel+bounces-676016-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A183141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:19:49 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id DCBF01890A52
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:19:46 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6041628A1D5;
Fri, 6 Jun 2025 16:19:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VCdCwFXC"
Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65CFC289E1E;
Fri, 6 Jun 2025 16:18:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226740; cv=none; b=TZPC7wivowUtTaNerXPLkKy4MmTzVynduCjuRFDTbKqPMw6e6eoG2hoX5JofwTfEAJIKJB7xJc414yy6Ua7BCNajV2+apb23DjTiMus8oW3QtTEPygChHpDyWBB3ZHqc8EcTdsDLZJY8+DHWpefNpoP+GTO907J6BkP62qItqF8=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226740; c=relaxed/simple;
bh=66uE4ADvwMO+JAwbLytri/SGyTvQWdDnR/8WUrZcnu0=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=c8VjlXAVpkVcgGBHuEE3atcLSV5oX2vNFceDTncxYi72jkoDVsWk0OepHIuB4TJXKbCT3Vd+oE53OwnabSpBISmNP8gXrzAObARpRYOg5248tQUWL2clby/NU/5TCfodVVBVqHBgnvthEcwIv5kEtf2RO9/qPIelaijUQN8hli0=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VCdCwFXC; arc=none smtp.client-ip=209.85.210.179
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-73972a54919so2126966b3a.3;
Fri, 06 Jun 2025 09:18:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749226737; x=1749831537; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=qOGlw03uEXEglmTbHf49Wqe0F7+bcmF9jdey3sgb7do=;
b=VCdCwFXCqdYkcY4Xq72a5XGaAaTHxnmGlUPl8rw9aBbrluZMJyGl8ATazOgK3G1mmJ
Z2ggp1yyhxy0YqfXK5VvdJjay309dzIHpxcV2zxkBVnzAVX2ucT2gh8Hps+6//c2hbbC
1ZbhaKQmQiZceN4DExLSjVanRwrXKmB4Hg4qpRQgUMD5fZP2p4ywcbKSMskyRhky92Q6
le1n8xkkl0WHp9L31nDFSjD/P1XWOqDAvZjGixcE0PukAJ92BnIuOQtsiR/aMTDr0Wp1
Zc4VUBU16V9KXG2wiSBmOLORHdVZMHQNmca9mjypJ5qEzorb50lQ6hEdJguyzgqwGRM1
EXeQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226737; x=1749831537;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=qOGlw03uEXEglmTbHf49Wqe0F7+bcmF9jdey3sgb7do=;
b=KirRaNWPOlUKlLwuPbR9vjsbQHW0dU30GCuCNuttXJum1Rw0wqKBCH//4UpSm9Uoe4
Z2H+uFD2Fkvb7Nhm7hIfY9YjnhukrEbr5uNKRztRjG1jckiG6BM2LZpiOhxqCFXVD700
7R5EdlivtupSBIuuff0eMcbG3EkEnkfhx0pMLsjshW1qpLjVI4G4vhgz9E5t8FJzLsQh
36GFD6kZBqvlDs1bCX8k/7CMwRrkAflffr8TuZmjX4+VwSlh4hKKCLg8D9hTj+k49DpV
5Y67Kr03567yOUr4dRWwAUcbL5zYO4NilMnx9R4I9gNWAAjMeJ/HuNlL4H2aVEEVPzaV
WRew==
X-Forwarded-Encrypted: i=1; AJvYcCVDez6guwNmq/Bc6PaRC81gVeRGox90DUkSkSftw4cniqrH3hx9Fx0YNi5N0JI5Fj0Re3YvNWFvcHFbm6ii@xxxxxxxxxxxxxxx, AJvYcCXV+ubV0XfNYzwXAB5BZDHxYboDdsBNj0Pq3Ze4F9jV4fttUFWOfLvlHEptUB/o/LBfcwezCXGp@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YxG8zqeZkbyMlEPY7JCXUZsOUxeZHY4x4+wqOmbT3HC9uygPAGm
fjjcguSfaB99bnWo+Zb8hHGF4iT7q5QINmrd8f+ZmCDqiqHr8/cWpKLP
X-Gm-Gg: ASbGncs0tY+NUbaMgXdyHWP3H3WYnpqtDNF07iPyDNMbF8DeHqlZkkGn4Jsga6tZY5Q
hNkhd6R3vIwSwr4VuzhX3TkdfYi/XUcah6gUw/4vTimdcCopjgVJM61d5AGwZI0BtmRysdqUAci
LYdx+FoyVtcMKS4TeYkf61ooCP2oX2QOJF2gsW6eyl/GBuwBzbWyzJJvfe0bQxNHvKY7LsLp1Qx
3nLvEY15V5ox9/GJIFLVNjzYB0DmQIeSsRg/fsmHqjeCc39PrSdubIpd7VMKQzaHefWwXVc3Kwu
GKjKFcfSVI80Cg0AVP2dVg2o2M+6TM4kJCJe9lfLCN4QSbOO8mcHwi2b53uaiw==
X-Google-Smtp-Source: AGHT+IGe3M+8qdP4zCxVxsd9uyxwdFMpt1ozi68ZkJe0eF5GPp6N9qZ+dH1oZ8S4SSjZyF69rqE6WA==
X-Received: by 2002:a05:6a00:993:b0:73e:23be:11fc with SMTP id d2e1a72fcca58-74827f379b0mr5443465b3a.22.1749226736294;
Fri, 06 Jun 2025 09:18:56 -0700 (PDT)
Received: from jemmy.. ([180.172.46.169])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482af38353sm1518675b3a.10.2025.06.06.09.18.53
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 09:18:55 -0700 (PDT)
From: Jemmy Wong <jemmywong512@xxxxxxxxx>
To: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@xxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>,
Johannes Weiner <hannes@xxxxxxxxxxx>,
Waiman Long <longman@xxxxxxxxxx>,
cgroups@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 2/3] cgroup: add lock guard support for css_set_lock and rcu
Date: Sat, 7 Jun 2025 00:18:40 +0800
Message-ID: <20250606161841.44354-3-jemmywong512@xxxxxxxxx>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250606161841.44354-1-jemmywong512@xxxxxxxxx>
References: <20250606161841.44354-1-jemmywong512@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Signed-off-by: Jemmy Wong <jemmywong512@xxxxxxxxx>

---
kernel/cgroup/cgroup-v1.c | 29 +-
kernel/cgroup/cgroup.c | 580 ++++++++++++++++++--------------------
kernel/cgroup/cpuset-v1.c | 16 +-
kernel/cgroup/debug.c | 185 ++++++------
kernel/cgroup/freezer.c | 28 +-
kernel/cgroup/namespace.c | 8 +-
6 files changed, 401 insertions(+), 445 deletions(-)

diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index f4658eda4445..fcc2d474b470 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -70,9 +70,9 @@ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)
for_each_root(root) {
struct cgroup *from_cgrp;

- spin_lock_irq(&css_set_lock);
- from_cgrp = task_cgroup_from_root(from, root);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ from_cgrp = task_cgroup_from_root(from, root);
+ }

retval = cgroup_attach_task(from_cgrp, tsk, false);
if (retval)
@@ -117,10 +117,10 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from)
cgroup_attach_lock(true);

/* all tasks in @from are being moved, all csets are source */
- spin_lock_irq(&css_set_lock);
- list_for_each_entry(link, &from->cset_links, cset_link)
- cgroup_migrate_add_src(link->cset, to, &mgctx);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ list_for_each_entry(link, &from->cset_links, cset_link)
+ cgroup_migrate_add_src(link->cset, to, &mgctx);
+ }

ret = cgroup_migrate_prepare_dst(&mgctx);
if (ret)
@@ -728,13 +728,12 @@ int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry)
* @kn->priv's validity. For this and css_tryget_online_from_dir(),
* @kn->priv is RCU safe. Let's do the RCU dancing.
*/
- rcu_read_lock();
- cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
- if (!cgrp || !cgroup_tryget(cgrp)) {
- rcu_read_unlock();
- return -ENOENT;
+ scoped_guard(rcu) {
+ cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
+ if (!cgrp || !cgroup_tryget(cgrp)) {
+ return -ENOENT;
+ }
}
- rcu_read_unlock();

css_task_iter_start(&cgrp->self, 0, &it);
while ((tsk = css_task_iter_next(&it))) {
@@ -1294,7 +1293,7 @@ struct cgroup *task_get_cgroup1(struct task_struct *tsk, int hierarchy_id)
struct cgroup_root *root;
unsigned long flags;

- rcu_read_lock();
+ guard(rcu)();
for_each_root(root) {
/* cgroup1 only*/
if (root == &cgrp_dfl_root)
@@ -1308,7 +1307,7 @@ struct cgroup *task_get_cgroup1(struct task_struct *tsk, int hierarchy_id)
spin_unlock_irqrestore(&css_set_lock, flags);
break;
}
- rcu_read_unlock();
+
return cgrp;
}

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 54f80afe4f65..46b677a066d1 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -631,13 +631,8 @@ int __cgroup_task_count(const struct cgroup *cgrp)
*/
int cgroup_task_count(const struct cgroup *cgrp)
{
- int count;
-
- spin_lock_irq(&css_set_lock);
- count = __cgroup_task_count(cgrp);
- spin_unlock_irq(&css_set_lock);
-
- return count;
+ guard(spinlock_irq)(&css_set_lock);
+ return __cgroup_task_count(cgrp);
}

static struct cgroup *kn_priv(struct kernfs_node *kn)
@@ -1202,11 +1197,11 @@ static struct css_set *find_css_set(struct css_set *old_cset,

/* First see if we already have a cgroup group that matches
* the desired set */
- spin_lock_irq(&css_set_lock);
- cset = find_existing_css_set(old_cset, cgrp, template);
- if (cset)
- get_css_set(cset);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ cset = find_existing_css_set(old_cset, cgrp, template);
+ if (cset)
+ get_css_set(cset);
+ }

if (cset)
return cset;
@@ -1238,34 +1233,33 @@ static struct css_set *find_css_set(struct css_set *old_cset,
* find_existing_css_set() */
memcpy(cset->subsys, template, sizeof(cset->subsys));

- spin_lock_irq(&css_set_lock);
- /* Add reference counts and links from the new css_set. */
- list_for_each_entry(link, &old_cset->cgrp_links, cgrp_link) {
- struct cgroup *c = link->cgrp;
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ /* Add reference counts and links from the new css_set. */
+ list_for_each_entry(link, &old_cset->cgrp_links, cgrp_link) {
+ struct cgroup *c = link->cgrp;

- if (c->root == cgrp->root)
- c = cgrp;
- link_css_set(&tmp_links, cset, c);
- }
+ if (c->root == cgrp->root)
+ c = cgrp;
+ link_css_set(&tmp_links, cset, c);
+ }

- BUG_ON(!list_empty(&tmp_links));
+ BUG_ON(!list_empty(&tmp_links));

- css_set_count++;
+ css_set_count++;

- /* Add @cset to the hash table */
- key = css_set_hash(cset->subsys);
- hash_add(css_set_table, &cset->hlist, key);
+ /* Add @cset to the hash table */
+ key = css_set_hash(cset->subsys);
+ hash_add(css_set_table, &cset->hlist, key);

- for_each_subsys(ss, ssid) {
- struct cgroup_subsys_state *css = cset->subsys[ssid];
+ for_each_subsys(ss, ssid) {
+ struct cgroup_subsys_state *css = cset->subsys[ssid];

- list_add_tail(&cset->e_cset_node[ssid],
- &css->cgroup->e_csets[ssid]);
- css_get(css);
+ list_add_tail(&cset->e_cset_node[ssid],
+ &css->cgroup->e_csets[ssid]);
+ css_get(css);
+ }
}

- spin_unlock_irq(&css_set_lock);
-
/*
* If @cset should be threaded, look up the matching dom_cset and
* link them up. We first fully initialize @cset then look for the
@@ -1281,11 +1275,11 @@ static struct css_set *find_css_set(struct css_set *old_cset,
return NULL;
}

- spin_lock_irq(&css_set_lock);
- cset->dom_cset = dcset;
- list_add_tail(&cset->threaded_csets_node,
- &dcset->threaded_csets);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ cset->dom_cset = dcset;
+ list_add_tail(&cset->threaded_csets_node,
+ &dcset->threaded_csets);
+ }
}

return cset;
@@ -1362,16 +1356,14 @@ static void cgroup_destroy_root(struct cgroup_root *root)
* Release all the links from cset_links to this hierarchy's
* root cgroup
*/
- spin_lock_irq(&css_set_lock);
-
- list_for_each_entry_safe(link, tmp_link, &cgrp->cset_links, cset_link) {
- list_del(&link->cset_link);
- list_del(&link->cgrp_link);
- kfree(link);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ list_for_each_entry_safe(link, tmp_link, &cgrp->cset_links, cset_link) {
+ list_del(&link->cset_link);
+ list_del(&link->cgrp_link);
+ kfree(link);
+ }
}

- spin_unlock_irq(&css_set_lock);
-
WARN_ON_ONCE(list_empty(&root->root_list));
list_del_rcu(&root->root_list);
cgroup_root_count--;
@@ -1437,13 +1429,10 @@ current_cgns_cgroup_from_root(struct cgroup_root *root)

lockdep_assert_held(&css_set_lock);

- rcu_read_lock();
-
- cset = current->nsproxy->cgroup_ns->root_cset;
- res = __cset_cgroup_from_root(cset, root);
-
- rcu_read_unlock();
-
+ scoped_guard(rcu) {
+ cset = current->nsproxy->cgroup_ns->root_cset;
+ res = __cset_cgroup_from_root(cset, root);
+ }
/*
* The namespace_sem is held by current, so the root cgroup can't
* be umounted. Therefore, we can ensure that the res is non-NULL.
@@ -1867,25 +1856,25 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)
rcu_assign_pointer(dcgrp->subsys[ssid], css);
ss->root = dst_root;

- spin_lock_irq(&css_set_lock);
- css->cgroup = dcgrp;
- WARN_ON(!list_empty(&dcgrp->e_csets[ss->id]));
- list_for_each_entry_safe(cset, cset_pos, &scgrp->e_csets[ss->id],
- e_cset_node[ss->id]) {
- list_move_tail(&cset->e_cset_node[ss->id],
- &dcgrp->e_csets[ss->id]);
- /*
- * all css_sets of scgrp together in same order to dcgrp,
- * patch in-flight iterators to preserve correct iteration.
- * since the iterator is always advanced right away and
- * finished when it->cset_pos meets it->cset_head, so only
- * update it->cset_head is enough here.
- */
- list_for_each_entry(it, &cset->task_iters, iters_node)
- if (it->cset_head == &scgrp->e_csets[ss->id])
- it->cset_head = &dcgrp->e_csets[ss->id];
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ css->cgroup = dcgrp;
+ WARN_ON(!list_empty(&dcgrp->e_csets[ss->id]));
+ list_for_each_entry_safe(cset, cset_pos, &scgrp->e_csets[ss->id],
+ e_cset_node[ss->id]) {
+ list_move_tail(&cset->e_cset_node[ss->id],
+ &dcgrp->e_csets[ss->id]);
+ /*
+ * all css_sets of scgrp together in same order to dcgrp,
+ * patch in-flight iterators to preserve correct iteration.
+ * since the iterator is always advanced right away and
+ * finished when it->cset_pos meets it->cset_head, so only
+ * update it->cset_head is enough here.
+ */
+ list_for_each_entry(it, &cset->task_iters, iters_node)
+ if (it->cset_head == &scgrp->e_csets[ss->id])
+ it->cset_head = &dcgrp->e_csets[ss->id];
+ }
}
- spin_unlock_irq(&css_set_lock);

/* default hierarchy doesn't enable controllers by default */
dst_root->subsys_mask |= 1 << ssid;
@@ -1921,10 +1910,10 @@ int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node,
if (!buf)
return -ENOMEM;

- spin_lock_irq(&css_set_lock);
- ns_cgroup = current_cgns_cgroup_from_root(kf_cgroot);
- len = kernfs_path_from_node(kf_node, ns_cgroup->kn, buf, PATH_MAX);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ ns_cgroup = current_cgns_cgroup_from_root(kf_cgroot);
+ len = kernfs_path_from_node(kf_node, ns_cgroup->kn, buf, PATH_MAX);
+ }

if (len == -E2BIG)
len = -ERANGE;
@@ -2175,13 +2164,13 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)
* Link the root cgroup in this hierarchy into all the css_set
* objects.
*/
- spin_lock_irq(&css_set_lock);
- hash_for_each(css_set_table, i, cset, hlist) {
- link_css_set(&tmp_links, cset, root_cgrp);
- if (css_set_populated(cset))
- cgroup_update_populated(root_cgrp, true);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ hash_for_each(css_set_table, i, cset, hlist) {
+ link_css_set(&tmp_links, cset, root_cgrp);
+ if (css_set_populated(cset))
+ cgroup_update_populated(root_cgrp, true);
+ }
}
- spin_unlock_irq(&css_set_lock);

BUG_ON(!list_empty(&root_cgrp->self.children));
BUG_ON(atomic_read(&root->nr_cgrps) != 1);
@@ -2225,11 +2214,8 @@ int cgroup_do_get_tree(struct fs_context *fc)
struct cgroup *cgrp;

scoped_guard(cgroup_mutex) {
- spin_lock_irq(&css_set_lock);
-
+ guard(spinlock_irq)(&css_set_lock);
cgrp = cset_cgroup_from_root(ctx->ns->root_cset, ctx->root);
-
- spin_unlock_irq(&css_set_lock);
}

nsdentry = kernfs_node_dentry(cgrp->kn, sb);
@@ -2438,16 +2424,10 @@ int cgroup_path_ns_locked(struct cgroup *cgrp, char *buf, size_t buflen,
int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen,
struct cgroup_namespace *ns)
{
- int ret;
-
guard(cgroup_mutex)();
- spin_lock_irq(&css_set_lock);
-
- ret = cgroup_path_ns_locked(cgrp, buf, buflen, ns);
-
- spin_unlock_irq(&css_set_lock);
+ guard(spinlock_irq)(&css_set_lock);

- return ret;
+ return cgroup_path_ns_locked(cgrp, buf, buflen, ns);
}
EXPORT_SYMBOL_GPL(cgroup_path_ns);

@@ -2629,27 +2609,27 @@ static int cgroup_migrate_execute(struct cgroup_mgctx *mgctx)
* the new cgroup. There are no failure cases after here, so this
* is the commit point.
*/
- spin_lock_irq(&css_set_lock);
- list_for_each_entry(cset, &tset->src_csets, mg_node) {
- list_for_each_entry_safe(task, tmp_task, &cset->mg_tasks, cg_list) {
- struct css_set *from_cset = task_css_set(task);
- struct css_set *to_cset = cset->mg_dst_cset;
-
- get_css_set(to_cset);
- to_cset->nr_tasks++;
- css_set_move_task(task, from_cset, to_cset, true);
- from_cset->nr_tasks--;
- /*
- * If the source or destination cgroup is frozen,
- * the task might require to change its state.
- */
- cgroup_freezer_migrate_task(task, from_cset->dfl_cgrp,
- to_cset->dfl_cgrp);
- put_css_set_locked(from_cset);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ list_for_each_entry(cset, &tset->src_csets, mg_node) {
+ list_for_each_entry_safe(task, tmp_task, &cset->mg_tasks, cg_list) {
+ struct css_set *from_cset = task_css_set(task);
+ struct css_set *to_cset = cset->mg_dst_cset;
+
+ get_css_set(to_cset);
+ to_cset->nr_tasks++;
+ css_set_move_task(task, from_cset, to_cset, true);
+ from_cset->nr_tasks--;
+ /*
+ * If the source or destination cgroup is frozen,
+ * the task might require to change its state.
+ */
+ cgroup_freezer_migrate_task(task, from_cset->dfl_cgrp,
+ to_cset->dfl_cgrp);
+ put_css_set_locked(from_cset);

+ }
}
}
- spin_unlock_irq(&css_set_lock);

/*
* Migration is committed, all target tasks are now on dst_csets.
@@ -2682,13 +2662,13 @@ static int cgroup_migrate_execute(struct cgroup_mgctx *mgctx)
} while_each_subsys_mask();
}
out_release_tset:
- spin_lock_irq(&css_set_lock);
- list_splice_init(&tset->dst_csets, &tset->src_csets);
- list_for_each_entry_safe(cset, tmp_cset, &tset->src_csets, mg_node) {
- list_splice_tail_init(&cset->mg_tasks, &cset->tasks);
- list_del_init(&cset->mg_node);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ list_splice_init(&tset->dst_csets, &tset->src_csets);
+ list_for_each_entry_safe(cset, tmp_cset, &tset->src_csets, mg_node) {
+ list_splice_tail_init(&cset->mg_tasks, &cset->tasks);
+ list_del_init(&cset->mg_node);
+ }
}
- spin_unlock_irq(&css_set_lock);

/*
* Re-initialize the cgroup_taskset structure in case it is reused
@@ -2746,7 +2726,7 @@ void cgroup_migrate_finish(struct cgroup_mgctx *mgctx)

lockdep_assert_held(&cgroup_mutex);

- spin_lock_irq(&css_set_lock);
+ guard(spinlock_irq)(&css_set_lock);

list_for_each_entry_safe(cset, tmp_cset, &mgctx->preloaded_src_csets,
mg_src_preload_node) {
@@ -2765,8 +2745,6 @@ void cgroup_migrate_finish(struct cgroup_mgctx *mgctx)
list_del_init(&cset->mg_dst_preload_node);
put_css_set_locked(cset);
}
-
- spin_unlock_irq(&css_set_lock);
}

/**
@@ -2909,14 +2887,14 @@ int cgroup_migrate(struct task_struct *leader, bool threadgroup,
* section to prevent tasks from being freed while taking the snapshot.
* spin_lock_irq() implies RCU critical section here.
*/
- spin_lock_irq(&css_set_lock);
- task = leader;
- do {
- cgroup_migrate_add_task(task, mgctx);
- if (!threadgroup)
- break;
- } while_each_thread(leader, task);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ task = leader;
+ do {
+ cgroup_migrate_add_task(task, mgctx);
+ if (!threadgroup)
+ break;
+ } while_each_thread(leader, task);
+ }

return cgroup_migrate_execute(mgctx);
}
@@ -2937,16 +2915,15 @@ int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader,
int ret = 0;

/* look up all src csets */
- spin_lock_irq(&css_set_lock);
- rcu_read_lock();
- task = leader;
- do {
- cgroup_migrate_add_src(task_css_set(task), dst_cgrp, &mgctx);
- if (!threadgroup)
- break;
- } while_each_thread(leader, task);
- rcu_read_unlock();
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ guard(rcu)();
+ task = leader;
+ do {
+ cgroup_migrate_add_src(task_css_set(task), dst_cgrp, &mgctx);
+ if (!threadgroup)
+ break;
+ } while_each_thread(leader, task);
+ }

/* prepare dst csets and commit */
ret = cgroup_migrate_prepare_dst(&mgctx);
@@ -3088,23 +3065,23 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
lockdep_assert_held(&cgroup_mutex);

/* look up all csses currently attached to @cgrp's subtree */
- spin_lock_irq(&css_set_lock);
- cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) {
- struct cgrp_cset_link *link;
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) {
+ struct cgrp_cset_link *link;

- /*
- * As cgroup_update_dfl_csses() is only called by
- * cgroup_apply_control(). The csses associated with the
- * given cgrp will not be affected by changes made to
- * its subtree_control file. We can skip them.
- */
- if (dsct == cgrp)
- continue;
+ /*
+ * As cgroup_update_dfl_csses() is only called by
+ * cgroup_apply_control(). The csses associated with the
+ * given cgrp will not be affected by changes made to
+ * its subtree_control file. We can skip them.
+ */
+ if (dsct == cgrp)
+ continue;

- list_for_each_entry(link, &dsct->cset_links, cset_link)
- cgroup_migrate_add_src(link->cset, dsct, &mgctx);
+ list_for_each_entry(link, &dsct->cset_links, cset_link)
+ cgroup_migrate_add_src(link->cset, dsct, &mgctx);
+ }
}
- spin_unlock_irq(&css_set_lock);

/*
* We need to write-lock threadgroup_rwsem while migrating tasks.
@@ -3120,16 +3097,16 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
if (ret)
goto out_finish;

- spin_lock_irq(&css_set_lock);
- list_for_each_entry(src_cset, &mgctx.preloaded_src_csets,
- mg_src_preload_node) {
- struct task_struct *task, *ntask;
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ list_for_each_entry(src_cset, &mgctx.preloaded_src_csets,
+ mg_src_preload_node) {
+ struct task_struct *task, *ntask;

- /* all tasks in src_csets need to be migrated */
- list_for_each_entry_safe(task, ntask, &src_cset->tasks, cg_list)
- cgroup_migrate_add_task(task, &mgctx);
+ /* all tasks in src_csets need to be migrated */
+ list_for_each_entry_safe(task, ntask, &src_cset->tasks, cg_list)
+ cgroup_migrate_add_task(task, &mgctx);
+ }
}
- spin_unlock_irq(&css_set_lock);

ret = cgroup_migrate_execute(&mgctx);
out_finish:
@@ -3734,7 +3711,8 @@ static int cgroup_stat_show(struct seq_file *seq, void *v)
* Without proper lock protection, racing is possible. So the
* numbers may not be consistent when that happens.
*/
- rcu_read_lock();
+ guard(rcu)();
+
for (ssid = 0; ssid < CGROUP_SUBSYS_COUNT; ssid++) {
dying_cnt[ssid] = -1;
if ((BIT(ssid) & cgrp_dfl_inhibit_ss_mask) ||
@@ -3753,7 +3731,6 @@ static int cgroup_stat_show(struct seq_file *seq, void *v)
seq_printf(seq, "nr_dying_subsys_%s %d\n",
cgroup_subsys[ssid]->name, dying_cnt[ssid]);
}
- rcu_read_unlock();
return 0;
}

@@ -3771,11 +3748,10 @@ static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
{
struct cgroup_subsys_state *css;

- rcu_read_lock();
+ guard(rcu)();
css = cgroup_css(cgrp, ss);
if (css && !css_tryget_online(css))
css = NULL;
- rcu_read_unlock();

return css;
}
@@ -4056,9 +4032,9 @@ static void __cgroup_kill(struct cgroup *cgrp)

lockdep_assert_held(&cgroup_mutex);

- spin_lock_irq(&css_set_lock);
- cgrp->kill_seq++;
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ cgrp->kill_seq++;
+ }

css_task_iter_start(&cgrp->self, CSS_TASK_ITER_PROCS | CSS_TASK_ITER_THREADED, &it);
while ((task = css_task_iter_next(&it))) {
@@ -4187,9 +4163,9 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
* doesn't need to be pinned. The RCU locking is not necessary
* either. It's just for the convenience of using cgroup_css().
*/
- rcu_read_lock();
- css = cgroup_css(cgrp, cft->ss);
- rcu_read_unlock();
+ scoped_guard(rcu) {
+ css = cgroup_css(cgrp, cft->ss);
+ }

if (cft->write_u64) {
unsigned long long v;
@@ -4815,14 +4791,14 @@ bool css_has_online_children(struct cgroup_subsys_state *css)
struct cgroup_subsys_state *child;
bool ret = false;

- rcu_read_lock();
+ guard(rcu)();
css_for_each_child(child, css) {
if (child->flags & CSS_ONLINE) {
ret = true;
break;
}
}
- rcu_read_unlock();
+
return ret;
}

@@ -5247,9 +5223,9 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf,
goto out_unlock;

/* find the source cgroup */
- spin_lock_irq(&css_set_lock);
- src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root);
+ }

/*
* Process and thread migrations follow same delegation rule. Check
@@ -5531,11 +5507,11 @@ static inline void css_release_work_fn_locked(struct work_struct *work)

css_rstat_flush(&cgrp->self);

- spin_lock_irq(&css_set_lock);
- for (tcgrp = cgroup_parent(cgrp); tcgrp;
- tcgrp = cgroup_parent(tcgrp))
- tcgrp->nr_dying_descendants--;
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ for (tcgrp = cgroup_parent(cgrp); tcgrp;
+ tcgrp = cgroup_parent(tcgrp))
+ tcgrp->nr_dying_descendants--;
+ }

/*
* There are two control paths which try to determine
@@ -5790,20 +5766,20 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name,
goto out_psi_free;

/* allocation complete, commit to creation */
- spin_lock_irq(&css_set_lock);
- for (i = 0; i < level; i++) {
- tcgrp = cgrp->ancestors[i];
- tcgrp->nr_descendants++;
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ for (i = 0; i < level; i++) {
+ tcgrp = cgrp->ancestors[i];
+ tcgrp->nr_descendants++;

- /*
- * If the new cgroup is frozen, all ancestor cgroups get a new
- * frozen descendant, but their state can't change because of
- * this.
- */
- if (cgrp->freezer.e_freeze)
- tcgrp->freezer.nr_frozen_descendants++;
+ /*
+ * If the new cgroup is frozen, all ancestor cgroups get a new
+ * frozen descendant, but their state can't change because of
+ * this.
+ */
+ if (cgrp->freezer.e_freeze)
+ tcgrp->freezer.nr_frozen_descendants++;
+ }
}
- spin_unlock_irq(&css_set_lock);

list_add_tail_rcu(&cgrp->self.sibling, &cgroup_parent(cgrp)->self.children);
atomic_inc(&root->nr_cgrps);
@@ -6047,10 +6023,10 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
*/
cgrp->self.flags &= ~CSS_ONLINE;

- spin_lock_irq(&css_set_lock);
- list_for_each_entry(link, &cgrp->cset_links, cset_link)
- link->cset->dead = true;
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ list_for_each_entry(link, &cgrp->cset_links, cset_link)
+ link->cset->dead = true;
+ }

/* initiate massacre of all css's */
for_each_css(css, ssid, cgrp)
@@ -6063,18 +6039,18 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
if (cgroup_is_threaded(cgrp))
parent->nr_threaded_children--;

- spin_lock_irq(&css_set_lock);
- for (tcgrp = parent; tcgrp; tcgrp = cgroup_parent(tcgrp)) {
- tcgrp->nr_descendants--;
- tcgrp->nr_dying_descendants++;
- /*
- * If the dying cgroup is frozen, decrease frozen descendants
- * counters of ancestor cgroups.
- */
- if (test_bit(CGRP_FROZEN, &cgrp->flags))
- tcgrp->freezer.nr_frozen_descendants--;
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ for (tcgrp = parent; tcgrp; tcgrp = cgroup_parent(tcgrp)) {
+ tcgrp->nr_descendants--;
+ tcgrp->nr_dying_descendants++;
+ /*
+ * If the dying cgroup is frozen, decrease frozen descendants
+ * counters of ancestor cgroups.
+ */
+ if (test_bit(CGRP_FROZEN, &cgrp->flags))
+ tcgrp->freezer.nr_frozen_descendants--;
+ }
}
- spin_unlock_irq(&css_set_lock);

cgroup1_check_for_release(parent);

@@ -6356,13 +6332,12 @@ struct cgroup *cgroup_get_from_id(u64 id)
return ERR_PTR(-ENOENT);
}

- rcu_read_lock();
-
- cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
- if (cgrp && !cgroup_tryget(cgrp))
- cgrp = NULL;
+ scoped_guard(rcu) {
+ cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
+ if (cgrp && !cgroup_tryget(cgrp))
+ cgrp = NULL;
+ }

- rcu_read_unlock();
kernfs_put(kn);

if (!cgrp)
@@ -6539,14 +6514,14 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs)

cgroup_threadgroup_change_begin(current);

- spin_lock_irq(&css_set_lock);
- cset = task_css_set(current);
- get_css_set(cset);
- if (kargs->cgrp)
- kargs->kill_seq = kargs->cgrp->kill_seq;
- else
- kargs->kill_seq = cset->dfl_cgrp->kill_seq;
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ cset = task_css_set(current);
+ get_css_set(cset);
+ if (kargs->cgrp)
+ kargs->kill_seq = kargs->cgrp->kill_seq;
+ else
+ kargs->kill_seq = cset->dfl_cgrp->kill_seq;
+ }

if (!(kargs->flags & CLONE_INTO_CGROUP)) {
kargs->cset = cset;
@@ -6736,56 +6711,53 @@ void cgroup_post_fork(struct task_struct *child,
cset = kargs->cset;
kargs->cset = NULL;

- spin_lock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ /* init tasks are special, only link regular threads */
+ if (likely(child->pid)) {
+ if (kargs->cgrp) {
+ cgrp_flags = kargs->cgrp->flags;
+ cgrp_kill_seq = kargs->cgrp->kill_seq;
+ } else {
+ cgrp_flags = cset->dfl_cgrp->flags;
+ cgrp_kill_seq = cset->dfl_cgrp->kill_seq;
+ }

- /* init tasks are special, only link regular threads */
- if (likely(child->pid)) {
- if (kargs->cgrp) {
- cgrp_flags = kargs->cgrp->flags;
- cgrp_kill_seq = kargs->cgrp->kill_seq;
+ WARN_ON_ONCE(!list_empty(&child->cg_list));
+ cset->nr_tasks++;
+ css_set_move_task(child, NULL, cset, false);
} else {
- cgrp_flags = cset->dfl_cgrp->flags;
- cgrp_kill_seq = cset->dfl_cgrp->kill_seq;
+ put_css_set(cset);
+ cset = NULL;
}

- WARN_ON_ONCE(!list_empty(&child->cg_list));
- cset->nr_tasks++;
- css_set_move_task(child, NULL, cset, false);
- } else {
- put_css_set(cset);
- cset = NULL;
- }
-
- if (!(child->flags & PF_KTHREAD)) {
- if (unlikely(test_bit(CGRP_FREEZE, &cgrp_flags))) {
- /*
- * If the cgroup has to be frozen, the new task has
- * too. Let's set the JOBCTL_TRAP_FREEZE jobctl bit to
- * get the task into the frozen state.
- */
- spin_lock(&child->sighand->siglock);
- WARN_ON_ONCE(child->frozen);
- child->jobctl |= JOBCTL_TRAP_FREEZE;
- spin_unlock(&child->sighand->siglock);
+ if (!(child->flags & PF_KTHREAD)) {
+ if (unlikely(test_bit(CGRP_FREEZE, &cgrp_flags))) {
+ /*
+ * If the cgroup has to be frozen, the new task has
+ * too. Let's set the JOBCTL_TRAP_FREEZE jobctl bit to
+ * get the task into the frozen state.
+ */
+ spin_lock(&child->sighand->siglock);
+ WARN_ON_ONCE(child->frozen);
+ child->jobctl |= JOBCTL_TRAP_FREEZE;
+ spin_unlock(&child->sighand->siglock);
+
+ /*
+ * Calling cgroup_update_frozen() isn't required here,
+ * because it will be called anyway a bit later from
+ * do_freezer_trap(). So we avoid cgroup's transient
+ * switch from the frozen state and back.
+ */
+ }

/*
- * Calling cgroup_update_frozen() isn't required here,
- * because it will be called anyway a bit later from
- * do_freezer_trap(). So we avoid cgroup's transient
- * switch from the frozen state and back.
+ * If the cgroup is to be killed notice it now and take the
+ * child down right after we finished preparing it for
+ * userspace.
*/
+ kill = kargs->kill_seq != cgrp_kill_seq;
}
-
- /*
- * If the cgroup is to be killed notice it now and take the
- * child down right after we finished preparing it for
- * userspace.
- */
- kill = kargs->kill_seq != cgrp_kill_seq;
}
-
- spin_unlock_irq(&css_set_lock);
-
/*
* Call ss->fork(). This must happen after @child is linked on
* css_set; otherwise, @child might change state between ->fork()
@@ -6824,25 +6796,23 @@ void cgroup_exit(struct task_struct *tsk)
struct css_set *cset;
int i;

- spin_lock_irq(&css_set_lock);
-
- WARN_ON_ONCE(list_empty(&tsk->cg_list));
- cset = task_css_set(tsk);
- css_set_move_task(tsk, cset, NULL, false);
- cset->nr_tasks--;
- /* matches the signal->live check in css_task_iter_advance() */
- if (thread_group_leader(tsk) && atomic_read(&tsk->signal->live))
- list_add_tail(&tsk->cg_list, &cset->dying_tasks);
-
- if (dl_task(tsk))
- dec_dl_tasks_cs(tsk);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ WARN_ON_ONCE(list_empty(&tsk->cg_list));
+ cset = task_css_set(tsk);
+ css_set_move_task(tsk, cset, NULL, false);
+ cset->nr_tasks--;
+ /* matches the signal->live check in css_task_iter_advance() */
+ if (thread_group_leader(tsk) && atomic_read(&tsk->signal->live))
+ list_add_tail(&tsk->cg_list, &cset->dying_tasks);

- WARN_ON_ONCE(cgroup_task_frozen(tsk));
- if (unlikely(!(tsk->flags & PF_KTHREAD) &&
- test_bit(CGRP_FREEZE, &task_dfl_cgroup(tsk)->flags)))
- cgroup_update_frozen(task_dfl_cgroup(tsk));
+ if (dl_task(tsk))
+ dec_dl_tasks_cs(tsk);

- spin_unlock_irq(&css_set_lock);
+ WARN_ON_ONCE(cgroup_task_frozen(tsk));
+ if (unlikely(!(tsk->flags & PF_KTHREAD) &&
+ test_bit(CGRP_FREEZE, &task_dfl_cgroup(tsk)->flags)))
+ cgroup_update_frozen(task_dfl_cgroup(tsk));
+ }

/* see cgroup_post_fork() for details */
do_each_subsys_mask(ss, i, have_exit_callback) {
@@ -6860,10 +6830,9 @@ void cgroup_release(struct task_struct *task)
} while_each_subsys_mask();

if (!list_empty(&task->cg_list)) {
- spin_lock_irq(&css_set_lock);
+ guard(spinlock_irq)(&css_set_lock);
css_set_skip_task_iters(task_css_set(task), task);
list_del_init(&task->cg_list);
- spin_unlock_irq(&css_set_lock);
}
}

@@ -6944,7 +6913,7 @@ struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
!kn || kernfs_type(kn) != KERNFS_DIR)
return ERR_PTR(-EBADF);

- rcu_read_lock();
+ guard(rcu)();

/*
* This path doesn't originate from kernfs and @kn could already
@@ -6958,7 +6927,6 @@ struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
if (!css || !css_tryget_online(css))
css = ERR_PTR(-ENOENT);

- rcu_read_unlock();
return css;
}

@@ -7001,13 +6969,11 @@ struct cgroup *cgroup_get_from_path(const char *path)
goto out_kernfs;
}

- rcu_read_lock();
-
- cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
- if (!cgrp || !cgroup_tryget(cgrp))
- cgrp = ERR_PTR(-ENOENT);
-
- rcu_read_unlock();
+ scoped_guard(rcu) {
+ cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
+ if (!cgrp || !cgroup_tryget(cgrp))
+ cgrp = ERR_PTR(-ENOENT);
+ }

out_kernfs:
kernfs_put(kn);
@@ -7106,28 +7072,28 @@ void cgroup_sk_alloc(struct sock_cgroup_data *skcd)
{
struct cgroup *cgroup;

- rcu_read_lock();
- /* Don't associate the sock with unrelated interrupted task's cgroup. */
- if (in_interrupt()) {
- cgroup = &cgrp_dfl_root.cgrp;
- cgroup_get(cgroup);
- goto out;
- }
+ scoped_guard(rcu) {
+ /* Don't associate the sock with unrelated interrupted task's cgroup. */
+ if (in_interrupt()) {
+ cgroup = &cgrp_dfl_root.cgrp;
+ cgroup_get(cgroup);
+ break;
+ }

- while (true) {
- struct css_set *cset;
+ while (true) {
+ struct css_set *cset;

- cset = task_css_set(current);
- if (likely(cgroup_tryget(cset->dfl_cgrp))) {
- cgroup = cset->dfl_cgrp;
- break;
+ cset = task_css_set(current);
+ if (likely(cgroup_tryget(cset->dfl_cgrp))) {
+ cgroup = cset->dfl_cgrp;
+ break;
+ }
+ cpu_relax();
}
- cpu_relax();
+
+ skcd->cgroup = cgroup;
+ cgroup_bpf_get(cgroup);
}
-out:
- skcd->cgroup = cgroup;
- cgroup_bpf_get(cgroup);
- rcu_read_unlock();
}

void cgroup_sk_clone(struct sock_cgroup_data *skcd)
diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c
index b69a7db67090..114a63432d23 100644
--- a/kernel/cgroup/cpuset-v1.c
+++ b/kernel/cgroup/cpuset-v1.c
@@ -140,9 +140,8 @@ int cpuset_memory_pressure_enabled __read_mostly;

void __cpuset_memory_pressure_bump(void)
{
- rcu_read_lock();
+ guard(rcu)();
fmeter_markevent(&task_cs(current)->fmeter);
- rcu_read_unlock();
}

static int update_relax_domain_level(struct cpuset *cs, s64 val)
@@ -393,13 +392,12 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
if (!buf)
goto out;

- rcu_read_lock();
- spin_lock_irq(&css_set_lock);
- css = task_css(tsk, cpuset_cgrp_id);
- retval = cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX,
- current->nsproxy->cgroup_ns);
- spin_unlock_irq(&css_set_lock);
- rcu_read_unlock();
+ scoped_guard(rcu) {
+ guard(spinlock_irq)(&css_set_lock);
+ css = task_css(tsk, cpuset_cgrp_id);
+ retval = cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX,
+ current->nsproxy->cgroup_ns);
+ }

if (retval == -E2BIG)
retval = -ENAMETOOLONG;
diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c
index 80aa3f027ac3..2f04db56c8ac 100644
--- a/kernel/cgroup/debug.c
+++ b/kernel/cgroup/debug.c
@@ -48,27 +48,26 @@ static int current_css_set_read(struct seq_file *seq, void *v)
if (!cgroup_kn_lock_live(of->kn, false))
return -ENODEV;

- spin_lock_irq(&css_set_lock);
- rcu_read_lock();
- cset = task_css_set(current);
- refcnt = refcount_read(&cset->refcount);
- seq_printf(seq, "css_set %pK %d", cset, refcnt);
- if (refcnt > cset->nr_tasks)
- seq_printf(seq, " +%d", refcnt - cset->nr_tasks);
- seq_puts(seq, "\n");
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ guard(rcu)();
+ cset = task_css_set(current);
+ refcnt = refcount_read(&cset->refcount);
+ seq_printf(seq, "css_set %pK %d", cset, refcnt);
+ if (refcnt > cset->nr_tasks)
+ seq_printf(seq, " +%d", refcnt - cset->nr_tasks);
+ seq_puts(seq, "\n");

- /*
- * Print the css'es stored in the current css_set.
- */
- for_each_subsys(ss, i) {
- css = cset->subsys[ss->id];
- if (!css)
- continue;
- seq_printf(seq, "%2d: %-4s\t- %p[%d]\n", ss->id, ss->name,
- css, css->id);
+ /*
+ * Print the css'es stored in the current css_set.
+ */
+ for_each_subsys(ss, i) {
+ css = cset->subsys[ss->id];
+ if (!css)
+ continue;
+ seq_printf(seq, "%2d: %-4s\t- %p[%d]\n", ss->id, ss->name,
+ css, css->id);
+ }
}
- rcu_read_unlock();
- spin_unlock_irq(&css_set_lock);
cgroup_kn_unlock(of->kn);
return 0;
}
@@ -76,12 +75,8 @@ static int current_css_set_read(struct seq_file *seq, void *v)
static u64 current_css_set_refcount_read(struct cgroup_subsys_state *css,
struct cftype *cft)
{
- u64 count;
-
- rcu_read_lock();
- count = refcount_read(&task_css_set(current)->refcount);
- rcu_read_unlock();
- return count;
+ guard(rcu)();
+ return refcount_read(&task_css_set(current)->refcount);
}

static int current_css_set_cg_links_read(struct seq_file *seq, void *v)
@@ -94,18 +89,17 @@ static int current_css_set_cg_links_read(struct seq_file *seq, void *v)
if (!name_buf)
return -ENOMEM;

- spin_lock_irq(&css_set_lock);
- rcu_read_lock();
- cset = task_css_set(current);
- list_for_each_entry(link, &cset->cgrp_links, cgrp_link) {
- struct cgroup *c = link->cgrp;
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ guard(rcu)();
+ cset = task_css_set(current);
+ list_for_each_entry(link, &cset->cgrp_links, cgrp_link) {
+ struct cgroup *c = link->cgrp;

- cgroup_name(c, name_buf, NAME_MAX + 1);
- seq_printf(seq, "Root %d group %s\n",
- c->root->hierarchy_id, name_buf);
+ cgroup_name(c, name_buf, NAME_MAX + 1);
+ seq_printf(seq, "Root %d group %s\n",
+ c->root->hierarchy_id, name_buf);
+ }
}
- rcu_read_unlock();
- spin_unlock_irq(&css_set_lock);
kfree(name_buf);
return 0;
}
@@ -117,74 +111,73 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v)
struct cgrp_cset_link *link;
int dead_cnt = 0, extra_refs = 0, threaded_csets = 0;

- spin_lock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ list_for_each_entry(link, &css->cgroup->cset_links, cset_link) {
+ struct css_set *cset = link->cset;
+ struct task_struct *task;
+ int count = 0;
+ int refcnt = refcount_read(&cset->refcount);
+
+ /*
+ * Print out the proc_cset and threaded_cset relationship
+ * and highlight difference between refcount and task_count.
+ */
+ seq_printf(seq, "css_set %pK", cset);
+ if (rcu_dereference_protected(cset->dom_cset, 1) != cset) {
+ threaded_csets++;
+ seq_printf(seq, "=>%pK", cset->dom_cset);
+ }
+ if (!list_empty(&cset->threaded_csets)) {
+ struct css_set *tcset;
+ int idx = 0;
+
+ list_for_each_entry(tcset, &cset->threaded_csets,
+ threaded_csets_node) {
+ seq_puts(seq, idx ? "," : "<=");
+ seq_printf(seq, "%pK", tcset);
+ idx++;
+ }
+ } else {
+ seq_printf(seq, " %d", refcnt);
+ if (refcnt - cset->nr_tasks > 0) {
+ int extra = refcnt - cset->nr_tasks;
+
+ seq_printf(seq, " +%d", extra);
+ /*
+ * Take out the one additional reference in
+ * init_css_set.
+ */
+ if (cset == &init_css_set)
+ extra--;
+ extra_refs += extra;
+ }
+ }
+ seq_puts(seq, "\n");

- list_for_each_entry(link, &css->cgroup->cset_links, cset_link) {
- struct css_set *cset = link->cset;
- struct task_struct *task;
- int count = 0;
- int refcnt = refcount_read(&cset->refcount);
+ list_for_each_entry(task, &cset->tasks, cg_list) {
+ if (count++ <= MAX_TASKS_SHOWN_PER_CSS)
+ seq_printf(seq, " task %d\n",
+ task_pid_vnr(task));
+ }

- /*
- * Print out the proc_cset and threaded_cset relationship
- * and highlight difference between refcount and task_count.
- */
- seq_printf(seq, "css_set %pK", cset);
- if (rcu_dereference_protected(cset->dom_cset, 1) != cset) {
- threaded_csets++;
- seq_printf(seq, "=>%pK", cset->dom_cset);
- }
- if (!list_empty(&cset->threaded_csets)) {
- struct css_set *tcset;
- int idx = 0;
-
- list_for_each_entry(tcset, &cset->threaded_csets,
- threaded_csets_node) {
- seq_puts(seq, idx ? "," : "<=");
- seq_printf(seq, "%pK", tcset);
- idx++;
+ list_for_each_entry(task, &cset->mg_tasks, cg_list) {
+ if (count++ <= MAX_TASKS_SHOWN_PER_CSS)
+ seq_printf(seq, " task %d\n",
+ task_pid_vnr(task));
}
- } else {
- seq_printf(seq, " %d", refcnt);
- if (refcnt - cset->nr_tasks > 0) {
- int extra = refcnt - cset->nr_tasks;
-
- seq_printf(seq, " +%d", extra);
- /*
- * Take out the one additional reference in
- * init_css_set.
- */
- if (cset == &init_css_set)
- extra--;
- extra_refs += extra;
+ /* show # of overflowed tasks */
+ if (count > MAX_TASKS_SHOWN_PER_CSS)
+ seq_printf(seq, " ... (%d)\n",
+ count - MAX_TASKS_SHOWN_PER_CSS);
+
+ if (cset->dead) {
+ seq_puts(seq, " [dead]\n");
+ dead_cnt++;
}
- }
- seq_puts(seq, "\n");
-
- list_for_each_entry(task, &cset->tasks, cg_list) {
- if (count++ <= MAX_TASKS_SHOWN_PER_CSS)
- seq_printf(seq, " task %d\n",
- task_pid_vnr(task));
- }

- list_for_each_entry(task, &cset->mg_tasks, cg_list) {
- if (count++ <= MAX_TASKS_SHOWN_PER_CSS)
- seq_printf(seq, " task %d\n",
- task_pid_vnr(task));
+ WARN_ON(count != cset->nr_tasks);
}
- /* show # of overflowed tasks */
- if (count > MAX_TASKS_SHOWN_PER_CSS)
- seq_printf(seq, " ... (%d)\n",
- count - MAX_TASKS_SHOWN_PER_CSS);
-
- if (cset->dead) {
- seq_puts(seq, " [dead]\n");
- dead_cnt++;
- }
-
- WARN_ON(count != cset->nr_tasks);
}
- spin_unlock_irq(&css_set_lock);

if (!dead_cnt && !extra_refs && !threaded_csets)
return 0;
diff --git a/kernel/cgroup/freezer.c b/kernel/cgroup/freezer.c
index bf1690a167dd..01134b3af176 100644
--- a/kernel/cgroup/freezer.c
+++ b/kernel/cgroup/freezer.c
@@ -108,12 +108,12 @@ void cgroup_enter_frozen(void)
if (current->frozen)
return;

- spin_lock_irq(&css_set_lock);
+ guard(spinlock_irq)(&css_set_lock);
+
current->frozen = true;
cgrp = task_dfl_cgroup(current);
cgroup_inc_frozen_cnt(cgrp);
cgroup_update_frozen(cgrp);
- spin_unlock_irq(&css_set_lock);
}

/*
@@ -129,7 +129,8 @@ void cgroup_leave_frozen(bool always_leave)
{
struct cgroup *cgrp;

- spin_lock_irq(&css_set_lock);
+ guard(spinlock_irq)(&css_set_lock);
+
cgrp = task_dfl_cgroup(current);
if (always_leave || !test_bit(CGRP_FREEZE, &cgrp->flags)) {
cgroup_dec_frozen_cnt(cgrp);
@@ -142,7 +143,6 @@ void cgroup_leave_frozen(bool always_leave)
set_thread_flag(TIF_SIGPENDING);
spin_unlock(&current->sighand->siglock);
}
- spin_unlock_irq(&css_set_lock);
}

/*
@@ -178,12 +178,12 @@ static void cgroup_do_freeze(struct cgroup *cgrp, bool freeze)

lockdep_assert_held(&cgroup_mutex);

- spin_lock_irq(&css_set_lock);
- if (freeze)
- set_bit(CGRP_FREEZE, &cgrp->flags);
- else
- clear_bit(CGRP_FREEZE, &cgrp->flags);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ if (freeze)
+ set_bit(CGRP_FREEZE, &cgrp->flags);
+ else
+ clear_bit(CGRP_FREEZE, &cgrp->flags);
+ }

if (freeze)
TRACE_CGROUP_PATH(freeze, cgrp);
@@ -206,10 +206,10 @@ static void cgroup_do_freeze(struct cgroup *cgrp, bool freeze)
* Cgroup state should be revisited here to cover empty leaf cgroups
* and cgroups which descendants are already in the desired state.
*/
- spin_lock_irq(&css_set_lock);
- if (cgrp->nr_descendants == cgrp->freezer.nr_frozen_descendants)
- cgroup_update_frozen(cgrp);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ if (cgrp->nr_descendants == cgrp->freezer.nr_frozen_descendants)
+ cgroup_update_frozen(cgrp);
+ }
}

/*
diff --git a/kernel/cgroup/namespace.c b/kernel/cgroup/namespace.c
index 144a464e45c6..3e2454a106aa 100644
--- a/kernel/cgroup/namespace.c
+++ b/kernel/cgroup/namespace.c
@@ -71,10 +71,10 @@ struct cgroup_namespace *copy_cgroup_ns(unsigned long flags,
return ERR_PTR(-ENOSPC);

/* It is not safe to take cgroup_mutex here */
- spin_lock_irq(&css_set_lock);
- cset = task_css_set(current);
- get_css_set(cset);
- spin_unlock_irq(&css_set_lock);
+ scoped_guard(spinlock_irq, &css_set_lock) {
+ cset = task_css_set(current);
+ get_css_set(cset);
+ }

new_ns = alloc_cgroup_ns();
if (IS_ERR(new_ns)) {
--
2.43.0



Return-Path: <linux-kernel+bounces-676018-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 6F6F341E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:21:36 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 95BC87A62D8
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:20:16 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 12314289E12;
Fri, 6 Jun 2025 16:21:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N2WbI4JF"
Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6BF21DE3C7;
Fri, 6 Jun 2025 16:21:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226883; cv=none; b=S2lJiVMbOKv6mTtm5WSfTQBgxbxgLF4i0ZUiUqKbXuqpvdB4ekpwWgKPAsOaHBG1ReLOEi4TL/w9Q+QqwKgNs+eFxVk0ukW74yEcPRuMptv47Vdo05pNP5AFvVCVHkR3zLoSWakkwwyffe5zHnmFMv+oPPi7a19JIBX9HhKUhFU=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226883; c=relaxed/simple;
bh=SsABznqS+74Ku7nIalgWQ6r5XRamMp7UZkh/psf+9Kw=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=vDYq6o5CmK9pKW6vv35JBBnTBhpVxDlxErkU0QzzRhFyq+orgWNbXtBtwCHrVSLzuqyEjhs5w7E6CkSOaFsqNM79uzyRlUBUarmL9lzpdMWkNd/N9vVO+HwEFEj8MmNSoPcHahRQL4km+nDpZQ4FnOmLya7QWu61WUhaeyoMvJY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N2WbI4JF; arc=none smtp.client-ip=209.85.161.54
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-60ef6bf2336so1651651eaf.0;
Fri, 06 Jun 2025 09:21:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749226881; x=1749831681; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=0JA6lc95yGfo9qkQDGqCiJRxdLRQP3UK8ri3kJPzAPU=;
b=N2WbI4JF3w3EA9UJgkWvMFTQ2bVl8oNgttV8Ej4S5RBZIN2vdhkisTGaty8wngUiY4
LHEeAltvtAHfRb570Y4bo9HG5Th3zs6vGtF+imAzVX9RZZ7XATusrcNJykTz8cbhjR0R
QzQoyRe0fYHZ4YmMANUUcwX5U+gLdB8Gshd5aNTOIoEqHZwVsoTsaNDZBvXKzewCMyhL
DY4a4zWiTXxBBXcHCTBPLQtXqwFdxA+1K1AyUURLgjfSl1RuMo8tvuMJGvMcuqq7Myng
YQoGcGikfsUb8VNy+L+QTP0IhEOmGUqyFxqGsA8iRzrX1d/gfkMv55nQqlVSqeS9HXtq
NQng==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226881; x=1749831681;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=0JA6lc95yGfo9qkQDGqCiJRxdLRQP3UK8ri3kJPzAPU=;
b=rP1vvip3dblsHW6GkUewKmPhisPDkuBvyVUnI3Pmx9Cn9Re6cvd3xX6PKh4CAbKMld
h5DqjnC0FT/tJqeYRK/nTCZV0Ld8qwCVtTnn2n9ehEcyvxSuvXxw5Vmv7C7n6iwcmDdD
nVL97BS+Wt2F4kkOFCPdMsnXhRgaDlYJeY6XBsISGJ74qcPMJBwfYh2m+GflCvLtvR9I
S1cHr++mKTHN+UpN1ioXFisfGkbFwcW747yHgf3amDKRlTTUWVuXd8xhvggwXa4+nA7v
jwjPBaPww0YIVDnkX88za7I2GtxKpdlPc+8uuJ64G/DrEnVu4CGySgQZG9x8LgVVcOB8
q26w==
X-Forwarded-Encrypted: i=1; AJvYcCU5s0Eu5dOlJdViK1kzl2omw3YNa2ZIkhb56osdPKFhNxQ3W3YBMONou3aGodp23bsms2FQaK+MloRBTVyR@xxxxxxxxxxxxxxx, AJvYcCUXKAkAtfzXq4yGta0nBRTH7cwYFzVQC9Buih0EDx1jr+mt4Q9lg9RZSvIRN5h6QwWXTlQ=@vger.kernel.org, AJvYcCUqB29CaP9qPybkSFYFcRB+vxCz+H54n30VAKQjCzfON2ZSnz1NNP9F3wnuAHs9764paf4ZBqxGA185m3D02PyUTQ==@vger.kernel.org
X-Gm-Message-State: AOJu0YwcdH2KGDlew4zttOokwb7UrRwh+tVSRrdqPpUhI/P0ECpRLZEl
lY8BPWHRlJ3F4bsdKBBDDafuAohKMkMrpyvWdPQFY1MFQGCoWpPCZpsu9rlfBd2GQ7ymNa/Ezfj
RlPfbiLmnDqI1tOx+yH7QrTZ8QIsyamWNrJIt
X-Gm-Gg: ASbGnctweFQIPV66/Ddjum8E0w7JzrJnvqC+MtBnaPAsSYcdtoHWnfH/QI2xlNJFztm
wIsDbzbzblShzb9PDmZZm4NcKru3VfyAdkXj5uXTo2ZIXgSb/I1ZPxUKUSX8O+rEjc4G7KpCXfR
8h5Wtn/Cu9SUFLD3WukDcpgFGhfnpQZDLlqOAqDjbBQw==
X-Google-Smtp-Source: AGHT+IGCSqQp15n0QAdFL76AqBOrGxXPE6HwOt3EeXCbeyYM1elDNyrslevOvDrZHELS/En4ToKZPvY/UKYPR7KOVsc=
X-Received: by 2002:a17:90b:2252:b0:311:f684:d3cd with SMTP id
98e67ed59e1d1-313472fcd3dmr7263430a91.12.1749226869675; Fri, 06 Jun 2025
09:21:09 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <aEMLU2li1x2bAO4w@x1> <20250606161406.GH8020@xxxxxxxxxxxxxxx>
In-Reply-To: <20250606161406.GH8020@xxxxxxxxxxxxxxx>
From: Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx>
Date: Fri, 6 Jun 2025 09:20:57 -0700
X-Gm-Features: AX0GCFuUPtZk0JRK5pyxo55eADkqd6qDCZKEMFWm6cVuCiPqwkVJVPXOPFUNfQc
Message-ID: <CAEf4BzY2UEe9e53Ums=d-mMVgBdc5JnVAboKz1LLmvKRk5O=jA@xxxxxxxxxxxxxx>
Subject: Re: BTF loading failing on perf
To: Leo Yan <leo.yan@xxxxxxx>, Lorenz Bauer <lmb@xxxxxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>, Andrii Nakryiko <andrii@xxxxxxxxxx>,
Alan Maguire <alan.maguire@xxxxxxxxxx>,
Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, bpf@xxxxxxxxxxxxxxx,
linux-perf-users@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 9:14=E2=80=AFAM Leo Yan <leo.yan@xxxxxxx> wrote:
>
> Hi Arnaldo,
>
> On Fri, Jun 06, 2025 at 12:37:55PM -0300, Arnaldo Carvalho de Melo wrote:
> > root@number:~# perf trace -e openat --max-events=3D1
> > libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENOD=
EV
> > libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENOD=
EV
> > 0.000 ( 0.016 ms): ptyxis-agent/4375 openat(dfd: CWD, filename: "/=
proc/6593/cmdline", flags: RDONLY|CLOEXEC) =3D 13
> > root@number:~#
> >
> > openat(AT_FDCWD, "/sys/kernel/btf/vmlinux", O_RDONLY) =3D 258
> > mmap(NULL, 6519699, PROT_READ, MAP_PRIVATE, 258, 0) =3D -1 ENODEV (No s=
uch device)
> > libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENOD=
EV
>
> Have you included the commit below in the kernel side?

It doesn't matter, libbpf should silently fallback to non-mmap() way,
and it clearly doesn't.

We need something like this:

diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index f1d495dc66bb..37682908cb0f 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -1384,12 +1384,12 @@ static struct btf *btf_parse_raw_mmap(const
char *path, struct btf *base_btf)

fd =3D open(path, O_RDONLY);
if (fd < 0)
- return libbpf_err_ptr(-errno);
+ return ERR_PTR(-errno);

if (fstat(fd, &st) < 0) {
err =3D -errno;
close(fd);
- return libbpf_err_ptr(err);
+ return ERR_PTR(err);
}

data =3D mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
@@ -1397,7 +1397,7 @@ static struct btf *btf_parse_raw_mmap(const char
*path, struct btf *base_btf)
close(fd);

if (data =3D=3D MAP_FAILED)
- return libbpf_err_ptr(err);
+ return ERR_PTR(err);

btf =3D btf_new(data, st.st_size, base_btf, true);
if (IS_ERR(btf))

libbpf_err_ptr() should be used for user-facing API functions, they
return NULL on error and set errno, so checking for IS_ERR() is wrong
here.

Lorenz, can you please test and send a proper fix ASAP?

>
> commit a539e2a6d51d1c12d89eec149ccc72ec561639bc
> Author: Lorenz Bauer <lmb@xxxxxxxxxxxxx>
> Date: Tue May 20 14:01:17 2025 +0100
>
> btf: Allow mmap of vmlinux btf
>
> User space needs access to kernel BTF for many modern features of BPF=
.
> Right now each process needs to read the BTF blob either in pieces or
> as a whole. Allow mmaping the sysfs file so that processes can direct=
ly
> access the memory allocated for it in the kernel.
>
> remap_pfn_range is used instead of vm_insert_page due to aarch64
> compatibility issues.
>
> Signed-off-by: Lorenz Bauer <lmb@xxxxxxxxxxxxx>
> Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> Tested-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
> Reviewed-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
> Link: https://lore.kernel.org/bpf/20250520-vmlinux-mmap-v5-1-e8c941ac=
c414@xxxxxxxxxxxxx
>
> Thanks,
> Leo


Return-Path: <linux-kernel+bounces-676019-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id CFAA141E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:22:50 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 2D8AE18909F6
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:23:04 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D5A47289E16;
Fri, 6 Jun 2025 16:22:39 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AkgXZ7UD"
Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A9CD1A38F9;
Fri, 6 Jun 2025 16:22:37 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226959; cv=none; b=fm6bcHjXiVi9A3prklGc9FJzVHDh05S6JhT4KRG0YxDjUv/Ivtkgx98uSIr0IWiaCaby1RGDzsnOnFYN4SizgXoBYnuDG3VqxnBHijzfKLjbgyzPOluqeyaH1jH5lGRG+e9O/bhy7uTkuQCTtIggyI+iiys26pIPwP55ZrOjcvM=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226959; c=relaxed/simple;
bh=jn0A54m+AigrC0Kje3Ksl/fHLeDP7CfNeV5+EpwZARg=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=ucVkzGH6dyL7zsQDSNp9HaXFqWA9x/PoCGVtPI827VfKvkkfVtcXB+fQAyFvTCKLwuEgPGzXX7QqNaNX+9vcRVOs6A+aeE/mf6qrXTmcyf2S/UynX7nrCQ+/coGob4iBXn5CvjhxA80KGrwSUVOhbjoBzVlHMRWjt22UaNYHL1s=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AkgXZ7UD; arc=none smtp.client-ip=209.85.221.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3a503d9ef59so1842938f8f.3;
Fri, 06 Jun 2025 09:22:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749226956; x=1749831756; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=KP+8ZJbQ3Iy35rM91JKh8W2oEf1yzBugHuEwD4w/SXs=;
b=AkgXZ7UDFNmFeYGhbkVSl3n2NGvuvMlYq0xAE5qojNwJCIuj1h8CxGwj1sEbx3Sm9X
gAhku1mlnsCXc+oNOgKd9oy6DeT6OXAscJntKBGypIcpmMem8lkKSsNnJIhC3a+9HH9k
+92yRFDFdsK1Kf9E6lvHf4gVJ2T0xZn8fm2Km8G+St/p2rwGPH1oEvON1brbevZ+UrMP
ycTqgPHpWUFSQFocgicFUl0pKJLRuRJt7yXnIqQ7nVLdeaNCxqu/AcjqtXLoKdQhSYa6
CHfcBTCLj7uB/5fgQpX+ygypYTvCni65ByH8JhssS6sIzJus9rQEn6+7wqkumPfYVj+y
2z8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226956; x=1749831756;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=KP+8ZJbQ3Iy35rM91JKh8W2oEf1yzBugHuEwD4w/SXs=;
b=C9luDzNnwEj/qVwbg+hZDwbvQkRn+OSx7imKbIsjf5brvJxhSlf8g3xDleDVPP8ccy
W2m6soXzU6hWJww8rCos+Z0np2pps7itTnFPPXT6aUI4dG85dxNMz6mKxzSi5w8NgYK3
eGmRE6qoaAgo9KW9RqeTF2giuMx4Gsen6x50ULFjm7Tftw7/yW/fRMBH5Ndo9C5R5XK+
eUerEbdO7mYkuI+lGrN+BCzRMV/uhngKuuqG/2qX65IUqYK2IgyfKKsFiQPwb02vY81F
nw2il4r1JJYLSJX4eHxrnPscfPaPOoixpd0YzQpcZ9ZmNrdWifOrhYkT16EsiQ+bvvGH
3lLA==
X-Forwarded-Encrypted: i=1; AJvYcCUJbyizmhBsoQVseY5v6Obm4QSZ/vwxmy3cyZY2bzR+TOw60tG/GCfXdcsX0NOEE2dYH4kDJLpqPyiIJNkrAaRW@xxxxxxxxxxxxxxx, AJvYcCWfzbpivWrRUMsbWdttOB8g5Ys4PkXV3luJljFy9yKSDfleilrbxc1FkLEmwlqqbzfbcCmfQsrFAA==@vger.kernel.org, AJvYcCX/FfMbyS9bcZPDc7PkzsC0uleYO5MWU8m9iMCuu29TVd5nFxsR6PQwOBf12zHyNbO6mPA=@vger.kernel.org, AJvYcCX6TCrxZ0lb5eiU3Xwa2sytpqCixep6zVUjm+lIZ5YcWnmS92EVxiotd0s5/U5niLzwEHNSmSev+rCRdkzQ@xxxxxxxxxxxxxxx
X-Gm-Message-State: AOJu0YyYQ9ns578lsokB+R8bo+pWe0UiApeTD98NcSYhhOAmp8H4tn3J
7xDDlvTszRhjgwKweVhz/FWV8yBTxafaf9UWYa9ss7fvqPebvSA4hO1hhqF2/lO6rXW4QypNsG2
PY0Ay1//YIxj4yKQ19xgmkY7GPLFrjuo=
X-Gm-Gg: ASbGncvmLMLfmjTMW3A7SS1QZiaAxXAVfKkeI4+nDMC3KjPJG90joNpnYXD3gIVhtX5
GqZGpDU2l6VY0ZInLSZSFHnVv4QICM08GRPouRyTc/j5TeCNGBxZfs3zREtiavMA88JzHXhr6pO
j2V4gxZEOJFiphY90uFaGl/JYEdGIqPq2bkFJ5ZNyH8pjQVZC2OWSZ2offN4eWtg==
X-Google-Smtp-Source: AGHT+IGVEAky3KX3oy4NEAVyuC3jToJkW1CmYjw5OMscoOz7z7KXYJisj9AihaxTJFjuwXjoE5ERBeNQiq7yk/6UiSY=
X-Received: by 2002:a05:6000:288c:b0:3a4:db49:94aa with SMTP id
ffacd0b85a97d-3a531ab5272mr3524523f8f.21.1749226955387; Fri, 06 Jun 2025
09:22:35 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250411-many_args_arm64-v1-0-0a32fe72339e@xxxxxxxxxxx>
<20250411-many_args_arm64-v1-1-0a32fe72339e@xxxxxxxxxxx> <CAEf4Bzbn6BdXTOb0dTcsQmOMZpp5=DzGS2hHHQ3+dwcja=gv+w@xxxxxxxxxxxxxx>
<D98Q8BRNUVS9.11J60C67L1ALR@xxxxxxxxxxx> <CAEf4BzZHMYyGDZ4c4eNXG7Fm=ecxCCbKhKbQTbCjvWmKtdwvBw@xxxxxxxxxxxxxx>
<D9E9IQQ3QKXM.3UJ17G9CBS1FH@xxxxxxxxxxx> <DADMLIVHMSSO.3AXSI5216WCT6@xxxxxxxxxxx>
<9a2ba0ad-b34d-42f8-89a6-d9a44f007bdc@xxxxxxxxx> <DAEFD2WH7HRV.2SOG9Q00QSEXH@xxxxxxxxxxx>
<CAADnVQ+T_s6dAwJ5JKqNqA8tq1P+MdfPvPw0EoY5yOf8PnGT4g@xxxxxxxxxxxxxx> <DAFA7QSTVFQF.3MG5408HBVNT7@xxxxxxxxxxx>
In-Reply-To: <DAFA7QSTVFQF.3MG5408HBVNT7@xxxxxxxxxxx>
From: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
Date: Fri, 6 Jun 2025 09:22:24 -0700
X-Gm-Features: AX0GCFtcDPhEpzZqMjlQoxov485AHY3mrKKmWdCvVJeIQl1NL0jKc2KqPI-LVsc
Message-ID: <CAADnVQKr3ftNt1uQVrXBE0a2o37ZYRo2PHqCoHUnw6PE5T2LoA@xxxxxxxxxxxxxx>
Subject: Re: [Question] attributes encoding in BTF
To: =?UTF-8?Q?Alexis_Lothor=C3=A9?= <alexis.lothore@xxxxxxxxxxx>
Cc: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>, Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx>,
Alexei Starovoitov <ast@xxxxxxxxxx>, Daniel Borkmann <daniel@xxxxxxxxxxxxx>,
John Fastabend <john.fastabend@xxxxxxxxx>, Andrii Nakryiko <andrii@xxxxxxxxxx>,
Martin KaFai Lau <martin.lau@xxxxxxxxx>, Eduard Zingerman <eddyz87@xxxxxxxxx>, Song Liu <song@xxxxxxxxxx>,
Yonghong Song <yonghong.song@xxxxxxxxx>, KP Singh <kpsingh@xxxxxxxxxx>,
Stanislav Fomichev <sdf@xxxxxxxxxxx>, Hao Luo <haoluo@xxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>,
Puranjay Mohan <puranjay@xxxxxxxxxx>, Xu Kuohai <xukuohai@xxxxxxxxxxxxxxx>,
Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>,
Mykola Lysenko <mykolal@xxxxxx>, Shuah Khan <shuah@xxxxxxxxxx>,
Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>, Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>,
Florent Revest <revest@xxxxxxxxxxxx>, Bastien Curutchet <bastien.curutchet@xxxxxxxxxxx>,
ebpf@xxxxxxxxxxxxxxxxxxx, Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxx>,
bpf <bpf@xxxxxxxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>,
linux-arm-kernel <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@xxxxxxxxxxxxxxx>, linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx,
dwarves@xxxxxxxxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Fri, Jun 6, 2025 at 12:45=E2=80=AFAM Alexis Lothor=C3=A9
<alexis.lothore@xxxxxxxxxxx> wrote:
>
> Hi Alexei,
>
> On Thu Jun 5, 2025 at 6:09 PM CEST, Alexei Starovoitov wrote:
> > On Thu, Jun 5, 2025 at 12:35=E2=80=AFAM Alexis Lothor=C3=A9
> > <alexis.lothore@xxxxxxxxxxx> wrote:
> >>
> >> Hi Ihor,
> >>
> >> On Wed Jun 4, 2025 at 7:31 PM CEST, Ihor Solodrai wrote:
> >> > On 6/4/25 2:02 AM, Alexis Lothor=C3=83=C2=A9 wrote:
>
> [...]
>
> >> Thanks for the details ! I have missed this possibility, as I have bee=
n
> >> assuming that DWARF info was exposing the needed info. I'll take a loo=
k at
> >> it, but if those attributes can not be represented by DWARF, I'll have=
to
> >> find another way of getting those packing/alignment modifications on d=
ata
> >> type (eg: re-use/share btf__align_of from libbpf, as suggested by Andr=
ii,
> >> but it may not able to cover all cases).
> >
> > Not sure all the trouble is worth it.
> > I feel it's a corner case. Something we don't need to fix.
>
> TBH I don't own any specific use case really needing this handling, so if
> it does not feel worth the trouble, I'm fine with not trying to support
> this. My effort is rather motivated by the goal of aligning the ARM64
> features with other platform, and so of getting rid of
> tools/testing/selftests/bpf/DENYLIST.aarch64.
>
> For the record, this effort also showed that the same kind of issue affec=
ts
> other platforms already supporting many args + structs passed by value ([=
1])
> - structs alignment with specific alignment constraints are not
> specifically handled (eg: a struct with an __int128 as a top-level
> member, leading to a 16 byte alignment requirement)
> - packing and custom alignment is not handled
>
> From there, I could do two different things:
> 1. do nothing, keep ARM64 as-is with the current version which has been
> recently merged: ARM64 then denies attachment to any function trying to
> pass a struct by value on stack. We keep the tracing_struct tests denie=
d
> for ARM64. Other platforms still allow to attach such functions, but ma=
y
> be parsing wrongly arguments in those specific cases.
> 2. add the constraint applied on ARM64 (refusing attachment when structs =
are
> passed through stack) to other JIT compilers. Then update the
> tracing_struct test to ensure this specific case is properly denied on
> all platforms to avoid risking reading wrongly arguments passed through
> stack when structs or large types are involved.
>
> I tend to think 2. is better, but let me know if you have a different
> opinion here.

Agree. tracing_struct_many_args is working on x86, but assumptions
about BTF being able to express everything about calling convention
were not correct, so let's roll back.


Return-Path: <linux-kernel+bounces-676021-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A3E4441E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:23:37 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id E07E11891009
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:23:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 905F228A1C6;
Fri, 6 Jun 2025 16:23:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0TDxS94L"
Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F705289E1D
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:23:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749226993; cv=none; b=jSrCFF0nzmxKTOfa3q21wKzfew2/YJtaOprdIbEaHmANGao/d82jRy+yVH4nORyHyhuS0+zv6sR0uk3qaXVUcshF667mwmIdsCC1XFBodE20MwQYOMRFCMmIS0ezH2tuiRFH+NcWKenzL6HkRBmqWJoWGZQiB9NLCc33QMvJGt0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749226993; c=relaxed/simple;
bh=M1jOEuhivTZKy/mwihHb5k9W7LK7MVVycL5m83PizRY=;
h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:
To:Cc:Content-Type; b=tvCTbrmdtvrV5Of78JbFOcABn6GDXisxLzzmVsNsh8ZEYVE5TlX0zVPjN13AEiJUuXHdkLXqdN+7MYLZ5X2IK4KCssW4fZbKwi3vt21QRsAFl2Jxkl7obix7go3JbZsWRc5SI0E5lXfdN8iuuq3jCHdW+TlAORv/2KKg/YjSEW8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=0TDxS94L; arc=none smtp.client-ip=209.85.215.202
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com
Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-b2c38df7ed2so1648726a12.3
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 09:23:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20230601; t=1749226990; x=1749831790; darn=vger.kernel.org;
h=cc:to:from:subject:message-id:references:mime-version:in-reply-to
:date:from:to:cc:subject:date:message-id:reply-to;
bh=iqr00pI7lwlLVWJXPD39OYX7ZXcxb0u30DdjvVVkUqE=;
b=0TDxS94L+nmcB5yYQB7tpxOMLs7UB49L6oEYGdkvtwuXPeRNhNZ4ljFNT+rv1aB33/
DqrNBGsrmg0k6F0zIMxCVLq8xbBpuAWcZqnXjsNFW+//CrW24h3oNxIPtUGF3QRB+ujX
XXRBlZ02jlceqo6mTy9fLZb8tZQkmA0dc2r4dW/YBJ0OIzihYFQQv9dOhDyDGIve35nV
iv8qIB3Ah2eocrXfmA4TtSIvbmcTlGPnmE829mPXJTlm9lbvWhHKayJ9j7Q2jRTkPdM7
b3OtYyGj9LZmLZmCTwTvv952HOXO66tdpmssQzOVH0v+TI5HOzxtFHQmgodmbeAUSOEm
Si3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749226990; x=1749831790;
h=cc:to:from:subject:message-id:references:mime-version:in-reply-to
:date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=iqr00pI7lwlLVWJXPD39OYX7ZXcxb0u30DdjvVVkUqE=;
b=rWQ/FtkrLoJUGKV5We2e0iX5fS/zFywN82bQ7BFvq1SGXKJ1wcR1D2EfUOR4ubu/ti
9tbOrfwPccqNiW6pggHJlCb06Om3EC0oI0tCIwH/2HX6spZaf/MyJSun4a25QEngThCE
FstwUIU9ZcAyahUx8P28SKlgDVFGB8XVDbUkMn1DS86SWRYasmlJK1AQTSZEbsi1HJ3V
7/Q3RxPJXHlLh9r6aVKVoYP6ER5+JXj7d/TZVOa4cyCIit5B0jF/NQGgwtnIl+QVxJs/
JjwzuJcDl4ZPT00Xoq1LJZk1oD+JK6lja55U4MMgYhv/umby9Dq2b2yUzNrKPgH9fnND
BqVg==
X-Gm-Message-State: AOJu0YwtPF45HtDyReWYfKrRB6oQZ3gnKV7GRcr8MZRbde1/BQqkL4Vd
vk737OAF1X+BL110SdAPyZPgtjdOAerLMYmMdpvfiZRgaM5mv/LHQBQqFNFD/8qlWPOyFYSpJQd
vm2258Q==
X-Google-Smtp-Source: AGHT+IEbdeG1/EtRym+qW1Vn8WnmqKEc3a8Vg6fFl1bLllc5eruW4ye1N0jRNWJY9KZzuwW5IEBvBc5bSDQ=
X-Received: from plbmi16.prod.google.com ([2002:a17:902:fcd0:b0:234:dbbb:e786])
(user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2451:b0:234:aa98:7d41
with SMTP id d9443c01a7336-23601d977fcmr50980545ad.42.1749226990318; Fri, 06
Jun 2025 09:23:10 -0700 (PDT)
Date: Fri, 6 Jun 2025 09:23:09 -0700
In-Reply-To: <20250401161106.790710-11-pbonzini@xxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
Mime-Version: 1.0
References: <20250401161106.790710-1-pbonzini@xxxxxxxxxx> <20250401161106.790710-11-pbonzini@xxxxxxxxxx>
Message-ID: <aEMV7awKTSXEkLqu@xxxxxxxxxx>
Subject: Re: [PATCH 10/29] KVM: share statistics for same vCPU id on different planes
From: Sean Christopherson <seanjc@xxxxxxxxxx>
To: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, roy.hopkins@xxxxxxxx,
thomas.lendacky@xxxxxxx, ashish.kalra@xxxxxxx, michael.roth@xxxxxxx,
jroedel@xxxxxxx, nsaenz@xxxxxxxxxx, anelkz@xxxxxxxxx,
James.Bottomley@xxxxxxxxxxxxxxxxxxxxx
Content-Type: text/plain; charset="us-ascii"
X-Spam-Status: No, score=-11.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Tue, Apr 01, 2025, Paolo Bonzini wrote:
> Statistics are protected by vcpu->mutex; because KVM_RUN takes the
> plane-0 vCPU mutex, there is no race on applying statistics for all
> planes to the plane-0 kvm_vcpu struct.
>
> This saves the burden on the kernel of implementing the binary stats
> interface for vCPU plane file descriptors, and on userspace of gathering
> info from multiple planes. The disadvantage is a slight loss of
> information, and an extra pointer dereference when updating stats.
>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
> arch/arm64/kvm/arm.c | 2 +-
> arch/arm64/kvm/handle_exit.c | 6 +--
> arch/arm64/kvm/hyp/nvhe/gen-hyprel.c | 4 +-
> arch/arm64/kvm/mmio.c | 4 +-
> arch/loongarch/kvm/exit.c | 8 ++--
> arch/loongarch/kvm/vcpu.c | 2 +-
> arch/mips/kvm/emulate.c | 2 +-
> arch/mips/kvm/mips.c | 30 +++++++-------
> arch/mips/kvm/vz.c | 18 ++++-----
> arch/powerpc/kvm/book3s.c | 2 +-
> arch/powerpc/kvm/book3s_hv.c | 46 ++++++++++-----------
> arch/powerpc/kvm/book3s_hv_rm_xics.c | 8 ++--
> arch/powerpc/kvm/book3s_pr.c | 22 +++++-----
> arch/powerpc/kvm/book3s_pr_papr.c | 2 +-
> arch/powerpc/kvm/powerpc.c | 4 +-
> arch/powerpc/kvm/timing.h | 28 ++++++-------
> arch/riscv/kvm/vcpu.c | 2 +-
> arch/riscv/kvm/vcpu_exit.c | 10 ++---
> arch/riscv/kvm/vcpu_insn.c | 16 ++++----
> arch/riscv/kvm/vcpu_sbi.c | 2 +-
> arch/riscv/kvm/vcpu_sbi_hsm.c | 2 +-
> arch/s390/kvm/diag.c | 18 ++++-----
> arch/s390/kvm/intercept.c | 20 +++++-----
> arch/s390/kvm/interrupt.c | 48 +++++++++++-----------
> arch/s390/kvm/kvm-s390.c | 8 ++--
> arch/s390/kvm/priv.c | 60 ++++++++++++++--------------
> arch/s390/kvm/sigp.c | 50 +++++++++++------------
> arch/s390/kvm/vsie.c | 2 +-
> arch/x86/kvm/debugfs.c | 2 +-
> arch/x86/kvm/hyperv.c | 4 +-
> arch/x86/kvm/kvm_cache_regs.h | 4 +-
> arch/x86/kvm/mmu/mmu.c | 18 ++++-----
> arch/x86/kvm/mmu/tdp_mmu.c | 2 +-
> arch/x86/kvm/svm/sev.c | 2 +-
> arch/x86/kvm/svm/svm.c | 18 ++++-----
> arch/x86/kvm/vmx/tdx.c | 8 ++--
> arch/x86/kvm/vmx/vmx.c | 20 +++++-----
> arch/x86/kvm/x86.c | 40 +++++++++----------
> include/linux/kvm_host.h | 5 ++-
> virt/kvm/kvm_main.c | 19 ++++-----
> 40 files changed, 285 insertions(+), 283 deletions(-)

...

> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index dbca418d64f5..d2e0c0e8ff17 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -393,7 +393,8 @@ struct kvm_vcpu {
> bool ready;
> bool scheduled_out;
> struct kvm_vcpu_arch arch;
> - struct kvm_vcpu_stat stat;
> + struct kvm_vcpu_stat *stat;
> + struct kvm_vcpu_stat __stat;

Rather than special case invidiual fields, I think we should give kvm_vcpu the
same treatment as "struct kvm", and have kvm_vcpu represent the overall vCPU,
with an array of planes to hold the sub-vCPUs.

Having "kvm_vcpu" represent a plane, while "kvm" represents the overall VM, is
conceptually messy. And more importantly, I think the approach taken here will
be nigh impossible to maintain, and will have quite a bit of baggage. E.g. planes1+
will be filled with dead memory, and we also risk goofs where KVM could access
__stat in a plane1+ vCPU.

Documenting which fields are plane0-only, i.e. per-vCPU, via comments isn't
sustainable, whereas a hard split via structures will naturally what fields are
scope to the overall vCPU, versus what is per-plane, and will force us to more
explicitly audit the code. E.g. ____srcu_idx (and thus srcu_depth) is something
that I think should be shared by all planes. Ditto for preempt_notifier, vcpu_id,
vcpu_idx, pid, etc.

Aha! And to prove my point, this series breaks legacy signal handling, because
sigset_active and sigset are accessed using the plane1+ vCPU in kvm_vcpu_ioctl_run_plane(),
but KVM_SET_SIGNAL_MASK is only allowed to operated on plane0. And I definitely
don't think the answer is to let KVM_SET_SIGNAL_MASK operate on plane1+, because
forcing userspace to duplicate the sigmal masks to all planes is pointless.

Yeeeaaap. pid and pid_lock are also broken. As is vmx_hwapic_isr_update()
and kvm_sched_out()'s usage of wants_to_run. And guest_debug.

Long term, I just don't see this approach as being maintainable. We're pretty
much guaranteed to end up with bugs where KVM operates on the wrong kvm_vcpu
structure due to lack of explicit isolation in code. And those bugs are going
to absolutely brutal to debug (or even notice). E.g. failure to set "preempted"
on planes 1+ will mostly manifest as subtle performance issues.

Oof. And that would force us to document that duplicating cpuid and cpu_caps to
planes1+ is actually necessary, due to dynamic CPUID features (ugh). Though FWIW,
we could dodge that by special casing dynamic features, which isn't a bad idea
irrespective of planes.

Somewhat of a side topic: unless we need/want to explicitly support concurrent
GET/SET on planes of a vCPU, I think we should make vcpu->mutex per-vCPU, not
per-plane, so that there's zero chance of having bugs due to thinking that holding
vcpu->mutex provides protection against a race.

Extracing fields to a separate kvm_vcpu_plane will obviously require a *lot* more
churn, but I think in the long run it will be less work in total, because we won't
spend as much time chasing down bugs.

Very little per-plane state is in "struct kvm_vcpu", so I think we can do the big
conversion on a per-arch basis via a small amount of #ifdefs, i.e. not be force to
immediatedly convert all architectures to a kvm_vcpu vs. kvm_vcpu_plane world.


Return-Path: <linux-kernel+bounces-676022-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 7BFCA41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:23:48 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id B9D84169ED9
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:23:49 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C699B289E21;
Fri, 6 Jun 2025 16:23:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b="oQfDrnf1"
Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A0FE28980E
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:23:29 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.182
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749227011; cv=none; b=k9j8fX3EOoadukia7btoJHvCR2cYuEzF3/ne7N6RtRXEbgcV3UbLjKifsMYJaFNthL/ghtE5Z2OUQTrunZcQa6qw1aIM4kDzPoZzOLdCJwVKZP1A2olt5VzND5lOdEbagyCdRV4HaN29ZveWjOxa0waV6cHXVcO1nTulwcW3830=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749227011; c=relaxed/simple;
bh=g0LVpQxipeOCOXuAtAJhs14mbqA3NiYPX4nhcwbpzZw=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=NjzNVhRlH19ukdUqSz7xI9mec3uOesRtxqN2m1T1Mg1qeFRFRyO2lH+LH+WDHwJ3Yr4mjvUO/7S3QUnsqNLBLVeXppP/zTwye/5IsXZnu9E+WUHJDDo3TZfbPnLuAyPPpbSs59YWGHkwVt6fJ8PdD7Q2PWLWG1g8sqEqoopJBLg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b=oQfDrnf1; arc=none smtp.client-ip=209.85.160.182
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com
Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-4a3db0666f2so47520391cf.1
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 06 Jun 2025 09:23:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1749227008; x=1749831808; darn=vger.kernel.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=mFpeqJEhDacu967h49T3bcYqqSd1cDscEpckxmXpo1A=;
b=oQfDrnf1GHhy/Yfm+t50dRTNVkCkE+yZVcatrecWiCe8q37aUIjfNYV5GXxTN06KyJ
5/9ldkHF70sTN7w5sklsNmXQRJBn4VKA9j3pfxpOUVprJUCIqKbgILwlndgGEZ2SsMyg
K8B3oZflr0jCgfSEFukr31lOT4lRSUmpSRU8WWWYUfrUOTJo4oaUs1k5PBTRInGGzY7g
TbeyEDHASgFdyVeo0wLEzDa2V/3Objfqgb+re2QSod7CHS1Z8+QVx6mok/q7JffePFlh
nMK5kKCzQEkL3Lqm98b+/yKgwnz+18Bz8RUXH/dZ07CRKEX1eiTeLI8FTOlcqpBr8yTz
JtEw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749227008; x=1749831808;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=mFpeqJEhDacu967h49T3bcYqqSd1cDscEpckxmXpo1A=;
b=Sl/yOnO9b1NOzwUKu94IViorKYimotjnCIjgZIkT8njcxAXCsxd+qiZrq2y8IRRpGL
6rmgm0C2eLLHq0WJ0AhE8HF/J0GRy/VOL9qqmOjq6Z+FajYlJQTQAyno8CXC8kntaKxf
1ULORx2Sw7Lh219/s0MHeIRgYTZugDN7/El9IifO78jd6iHP8kEqsRr9++eokaFyomPE
k7imBg5MHewEKzD1oOE/zFFNvFIH1L7PzmWJec1N5HKZQVCNLRy4tDFdvmlk0gb9QxAk
OfyWURqnzLjVCX3aUTja5YWgjFhEh4kfKJcIJAGD/9Ucb9+ydAytxcTryYtNyRjHZjS8
hPgw==
X-Forwarded-Encrypted: i=1; AJvYcCU7XcYYiEP9H6fiXbdxvuAH6ay8YFZCo8t2ByyKXgvFR6UfSf7FZ1Qomnyws7BcrZ4TYGeqcvhot7hVjp4=@vger.kernel.org
X-Gm-Message-State: AOJu0YyE+S9trRvd+nu9VvBJVP2j3E1XAA5bkfebWnCvMNEmXNbDvuuD
bF3GBsF9ks5i08qrz4htiKARcZrRR5T0E3JKfTq3aEBN039Y7G+irimZtaAUBs/VdkIzDiU3EPm
k48pvh2GuHzpj9B/ifRGffcQ/OcJeljaNX14a/f+Z2g==
X-Gm-Gg: ASbGncshhJdtYsOZwDAJQYVE0cGci/xYyZrYLY7XSpdrJJ7R7XIrp+xkaZxnNEKDM2d
wvAS/7kp0De4mfe/WWjMYiHJ2BX8aDpM1s1kUGRTmKTQEnBlWAIC33zw3MDM6WHrSYeeUwCRsYN
zZHczlxTtZlxTQ0nT966KO9Wuee6BQNY+2l1FrUOn+
X-Google-Smtp-Source: AGHT+IGPsHSaGwXVvY8YZpTqOE2qMLkHKMqQkhbImGTUUVVWXZpV4mBeVtnt3fOpZqXUHctLEMLr/kgfyV+cty9EU04=
X-Received: by 2002:a05:622a:a044:b0:4a2:719b:1231 with SMTP id
d75a77b69052e-4a5b9d96135mr48575531cf.35.1749227008164; Fri, 06 Jun 2025
09:23:28 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
References: <20250515182322.117840-1-pasha.tatashin@xxxxxxxxxx>
<20250515182322.117840-4-pasha.tatashin@xxxxxxxxxx> <mafs05xhbv9fd.fsf@xxxxxxxxxx>
In-Reply-To: <mafs05xhbv9fd.fsf@xxxxxxxxxx>
From: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
Date: Fri, 6 Jun 2025 12:22:51 -0400
X-Gm-Features: AX0GCFutlDyG92JoXPnUdMDlv9OT8nRqcidR71SxEcHa0BYzPpqGY1tjEjK24Po
Message-ID: <CA+CK2bAZY7L20CwkHMKwThYj9nK8S4jHm-NXx-EhXpXntnv6Jw@xxxxxxxxxxxxxx>
Subject: Re: [RFC v2 03/16] kho: add kho_unpreserve_folio/phys
To: Pratyush Yadav <pratyush@xxxxxxxxxx>
Cc: jasonmiu@xxxxxxxxxx, graf@xxxxxxxxxx, changyuanl@xxxxxxxxxx,
rppt@xxxxxxxxxx, dmatlack@xxxxxxxxxx, rientjes@xxxxxxxxxx, corbet@xxxxxxx,
rdunlap@xxxxxxxxxxxxx, ilpo.jarvinen@xxxxxxxxxxxxxxx, kanie@xxxxxxxxxxxxxxxxx,
ojeda@xxxxxxxxxx, aliceryhl@xxxxxxxxxx, masahiroy@xxxxxxxxxx,
akpm@xxxxxxxxxxxxxxxxxxxx, tj@xxxxxxxxxx, yoann.congal@xxxxxxxx,
mmaurer@xxxxxxxxxx, roman.gushchin@xxxxxxxxx, chenridong@xxxxxxxxxx,
axboe@xxxxxxxxx, mark.rutland@xxxxxxx, jannh@xxxxxxxxxx,
vincent.guittot@xxxxxxxxxx, hannes@xxxxxxxxxxx, dan.j.williams@xxxxxxxxx,
david@xxxxxxxxxx, joel.granados@xxxxxxxxxx, rostedt@xxxxxxxxxxx,
anna.schumaker@xxxxxxxxxx, song@xxxxxxxxxx, zhangguopeng@xxxxxxxxxx,
linux@xxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-doc@xxxxxxxxxxxxxxx,
linux-mm@xxxxxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx,
mingo@xxxxxxxxxx, bp@xxxxxxxxx, dave.hansen@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx,
hpa@xxxxxxxxx, rafael@xxxxxxxxxx, dakr@xxxxxxxxxx,
bartosz.golaszewski@xxxxxxxxxx, cw00.choi@xxxxxxxxxxx,
myungjoo.ham@xxxxxxxxxxx, yesanishhere@xxxxxxxxx, Jonathan.Cameron@xxxxxxxxxx,
quic_zijuhu@xxxxxxxxxxx, aleksander.lobakin@xxxxxxxxx, ira.weiny@xxxxxxxxx,
andriy.shevchenko@xxxxxxxxxxxxxxx, leon@xxxxxxxxxx, lukas@xxxxxxxxx,
bhelgaas@xxxxxxxxxx, wagi@xxxxxxxxxx, djeffery@xxxxxxxxxx,
stuart.w.hayes@xxxxxxxxx
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Wed, Jun 4, 2025 at 11:00=E2=80=AFAM Pratyush Yadav <pratyush@xxxxxxxxxx=
> wrote:
>
> On Thu, May 15 2025, Pasha Tatashin wrote:
>
> > From: Changyuan Lyu <changyuanl@xxxxxxxxxx>
> >
> > Allow users of KHO to cancel the previous preservation by adding the
> > necessary interfaces to unpreserve folio.
> >
> > Signed-off-by: Changyuan Lyu <changyuanl@xxxxxxxxxx>
> > Co-developed-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
> > Signed-off-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
> > ---
> > include/linux/kexec_handover.h | 12 +++++
> > kernel/kexec_handover.c | 84 ++++++++++++++++++++++++++++------
> > 2 files changed, 83 insertions(+), 13 deletions(-)
> >
> [...]
> > diff --git a/kernel/kexec_handover.c b/kernel/kexec_handover.c
> > index 8ff561e36a87..eb305e7e6129 100644
> > --- a/kernel/kexec_handover.c
> > +++ b/kernel/kexec_handover.c
> > @@ -101,26 +101,33 @@ static void *xa_load_or_alloc(struct xarray *xa, =
unsigned long index, size_t sz)
> > return elm;
> > }
> >
> > -static void __kho_unpreserve(struct kho_mem_track *track, unsigned lon=
g pfn,
> > - unsigned long end_pfn)
> > +static void __kho_unpreserve_order(struct kho_mem_track *track, unsign=
ed long pfn,
> > + unsigned int order)
> > {
> > struct kho_mem_phys_bits *bits;
> > struct kho_mem_phys *physxa;
> > + const unsigned long pfn_high =3D pfn >> order;
> >
> > - while (pfn < end_pfn) {
> > - const unsigned int order =3D
> > - min(count_trailing_zeros(pfn), ilog2(end_pfn - pf=
n));
> > - const unsigned long pfn_high =3D pfn >> order;
> > + physxa =3D xa_load(&track->orders, order);
> > + if (!physxa)
> > + return;
> >
> > - physxa =3D xa_load(&track->orders, order);
> > - if (!physxa)
> > - continue;
> > + bits =3D xa_load(&physxa->phys_bits, pfn_high / PRESERVE_BITS);
> > + if (!bits)
> > + return;
> >
> > - bits =3D xa_load(&physxa->phys_bits, pfn_high / PRESERVE_=
BITS);
> > - if (!bits)
> > - continue;
> > + clear_bit(pfn_high % PRESERVE_BITS, bits->preserve);
> > +}
> >
> > - clear_bit(pfn_high % PRESERVE_BITS, bits->preserve);
> > +static void __kho_unpreserve(struct kho_mem_track *track, unsigned lon=
g pfn,
> > + unsigned long end_pfn)
> > +{
> > + unsigned int order;
> > +
> > + while (pfn < end_pfn) {
> > + order =3D min(count_trailing_zeros(pfn), ilog2(end_pfn - =
pfn));
>
> This is fragile. If the preserve call spans say 4 PFNs, then it gets
> preserved as a order 2 allocation, but if the PFNs are unpreserved
> one-by-one, __kho_unpreserve_order() will unpreserve from the order 0
> xarray, which will end up doing nothing, leaking those pages.
>
> It should either look through all orders to find the PFN, or at least
> have a requirement in the API that the same phys and size combination as
> the preserve call must be given to unpreserve.

Thank you Pratyush, this is an excellent point. I will add to the
comments of these functions, that it is a requirement to unpreserve
exactly the memory that was preserved, and subsections are not
allowed. I do not think this is needed, but in the future, if a use
case arises, we can relax this requirement.

Pasha


Return-Path: <linux-kernel+bounces-676023-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 4D88841E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:24:01 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 589003B20CB
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:23:39 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DDDB8289E05;
Fri, 6 Jun 2025 16:23:57 +0000 (UTC)
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77EE21A38F9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:23:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749227037; cv=none; b=CnVjwDKR9kK9xU4rw+F7ZdZ6CnuZSNE/QJu/4CCq5/+L5h3dl7UnZjOGUfFx8bUOucbLJtGQjrS+dfSsF+xYIlKrDGgKH92rYDLaL4qILIohiQA3HbL94im1LzS6U/mZYT8AOkwbotjnsBmTpZyW1hysuGracrWildeUdGfFZi0=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749227037; c=relaxed/simple;
bh=0stof6QFOE46hLM2pFqm0Nm4BC/nkP/IjekkdZqIOGU=;
h=Message-ID:Date:From:To:Cc:Subject; b=VO/HuNIHGHmFMz8OHFfHh6ZFBya17mr6lZzXMEeNFWjwUKiOAUj92DDl4c9bIe+3Kg0CWe6rGDmPyboQvCE+RxZG2hagtcDqNQ4EZbZoDZx0nxLd5wUSl/BXunPFE497M0EULtejwtsJ7PMmHdg16Uf+AXUaNMGbBaEBkUqsWCQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07654C4CEEB;
Fri, 6 Jun 2025 16:23:57 +0000 (UTC)
Received: from rostedt by gandalf with local (Exim 4.98.2)
(envelope-from <rostedt@xxxxxxxxxxx>)
id 1uNZsc-0000000Fwfp-2IPP;
Fri, 06 Jun 2025 12:25:18 -0400
Message-ID: <20250606162457.314220565@xxxxxxxxxxx>
User-Agent: quilt/0.68
Date: Fri, 06 Jun 2025 12:24:57 -0400
From: Steven Rostedt <rostedt@xxxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>,
Mark Rutland <mark.rutland@xxxxxxx>,
Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>,
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Subject: [for-linus][PATCH 0/3] tracing: Fixes for 6.16
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


tracing fixes:

- Fix regression of waiting a long time on updating trace event filters

When the faultable trace points were added, it needed task trace RCU
synchronization. This was added to the tracepoint_synchronize_unregister()
function. The filter logic always called this function whenever it
updated the trace event filters before freeing the old filters.
This increased the time of "trace-cmd record" from taking 13 seconds
to running over 2 minutes to complete.

Move the freeing of the filters to call_rcu*() logic, which brings the
time back down to 13 seconds.

- Fix ring_buffer_subbuf_order_set() error path lock protection

The error path of the ring_buffer_subbuf_order_set() released the
mutex too early and allowed subsequent accesses to setting the
subbuffer size to corrupt the data and cause a bug.

By moving the mutex locking to the end of the error path, it prevents
the reentrant access to the critical data and also allows the function
to convert the taking of the mutex over to the guard() logic.

- Remove unused power management clock events

The clock events were added in 2010 for power management. In 2011
arm used them. In 2013 the code they were used in was removed.
These events have been wasting memory since then.

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/fixes

Head SHA1: 28e6aecb1a79e178d870aee0b71f97cca669fd9b


Dmitry Antipov (1):
ring-buffer: Fix buffer locking in ring_buffer_subbuf_order_set()

Steven Rostedt (2):
tracing: Fix regression of filter waiting a long time on RCU synchronization
tracing: PM: Remove unused clock events

----
include/trace/events/power.h | 47 -----------
kernel/trace/ring_buffer.c | 4 +-
kernel/trace/trace_events_filter.c | 164 ++++++++++++++++++++++++++++---------
3 files changed, 128 insertions(+), 87 deletions(-)


Return-Path: <linux-kernel+bounces-676024-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id 1C70E41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:24:46 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sy.mirrors.kernel.org (Postfix) with ESMTPS id 851DC7A4E86
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:23:25 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 51FD2289E16;
Fri, 6 Jun 2025 16:24:34 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="ifGM3taB"
Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011069.outbound.protection.outlook.com [40.107.130.69])
(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 BD22228980E;
Fri, 6 Jun 2025 16:24:30 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.130.69
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749227073; cv=fail; b=Y5tMTcpgyjXYzkZSEtJEL9as4cTabd0UesYeMyaoRk0uRJ6BZXsLawQcTi7VDsGzCf9KtimfAoUEOgOWsPApTegzZLRPMnjpXxnBhJzr/8S8BLttwyCsdJfgzLcriHTKlxD3yHYezQyuZUbhA31fOGUIKFxPMRFYGJsdR4G37Y4=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749227073; c=relaxed/simple;
bh=DDX1ZU3D4PVLcFmSxciyhvu6xJOJDitlP/ulxH4oWSo=;
h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=M8Oiit1SVs5a4RaCPmGRNY4lpafiL+ysLXjNrpI5gsO2WEdjE46HK0krElDoAqEuARS/x9SaLcOpfmJdpEy018dDqVqACwUKQpd+nblKoHd53XLsbaTGTkbnS67HvGjOMKc4znIVvMC8hnTEEn58dzXP8xLnWDJQp5UyxL/0AXw=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=ifGM3taB; arc=fail smtp.client-ip=40.107.130.69
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=jdTJPHp+m1tT/4CItqN8hPdy6jsRRH/tBUQZR/vP1dYQzcrfmIUSVd12t38rtJToG0+f+TnfCroQpt/Kzi899Yo8zNd/jyte7aGNd8KpLNDUFsLA/YRL/0i3F8cGaLKXQ1cnzKKt6blX7auHnKJ1EgF5piMov0jjJYLidvFj0NYcvG/Uc6prWcRPR11karbq7x8eT5ofKu44wngjSIjPhgxThd/8LY1/0UcogO5b+wF5qKuh7nQovE9/bAowpEqp5sa7+UgGliBRdb1txy05m0IFQzpxuIestN0bSJ1iEDfEstUV4Ubjn15SOxGe3iUADxTrwzaijcXc0Ck8qQ3f1g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=wZ/AHrSz2OeB3HhiP4Bhi3nMPRHo1SK04MUNm2WbCZI=;
b=WJdrOpgXYAxYbJfPCFMcPk8TY8GDQku+mvlI234czG0ci3e3WeBhzBE3HvyyQc/A9M0uXdlDOE6tQZe2VYmaxViawk5sxpBPCH28Szr+qHOooujWy1RINQZZgKtXlClqYbGydKyWdDpvA9KLdVUstfNAvm0i+awu6EfbJRj/ibhkELI69Ch/lsCeTfr9ewDiGy7WRLg1mxkSU5xfY6xpjqGPUty8rw3rGdcLPnvXxZFiI123pV5oTEIY4i4E4X/BqC7ZlJdGqotFgj5RgeWA2dDE8jgVc6OWqyiw14Xolc3muv2aPnJAuZNnPm/Ezq/o4aPCtEkmLM6Ou1sihlHEMg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=wZ/AHrSz2OeB3HhiP4Bhi3nMPRHo1SK04MUNm2WbCZI=;
b=ifGM3taBlYXrSvhT3x1DskdKq6ib3LvE9QQ5AHrM2hOQ9dL/UvjeEeL3jSKd0QtASAb7j7rbPHhX26zDW5aMaSIhwENDPyzfHRjvMk+avYfwuSRnoGGPa+iQy96g9Ao2Ac4NCgq6Q2GiFPxTHjGN8kQiAfD/xI1Yqf/+zHf9rORpSSvtAMitKt4ATcMcEyU8ZAlPsIvac6C4XP/s/eMBMb9kOOAcGwQ1N+96taooHrtYjOoDrLXLoO6niN7MfXIphAHiHmZw+FUJPzfbEPvq86ID7c5489VOAN09cd50cYieyHcajCrN3LF3SpkXOOSqblB4QIO/kAdiB+1qBACftA==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14)
by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.21; Fri, 6 Jun
2025 16:24:25 +0000
Received: from PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com
([fe80::9126:a61e:341d:4b06%6]) with mapi id 15.20.8769.025; Fri, 6 Jun 2025
16:24:25 +0000
From: Frank Li <Frank.Li@xxxxxxx>
To: Michael Turquette <mturquette@xxxxxxxxxxxx>,
Stephen Boyd <sboyd@xxxxxxxxxx>,
Rob Herring <robh@xxxxxxxxxx>,
Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>,
Conor Dooley <conor+dt@xxxxxxxxxx>,
linux-clk@xxxxxxxxxxxxxxx (open list:COMMON CLK FRAMEWORK),
devicetree@xxxxxxxxxxxxxxx (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS),
linux-kernel@xxxxxxxxxxxxxxx (open list)
Cc: imx@xxxxxxxxxxxxxxx
Subject: [PATCH v2 1/1] dt-bindings: clock: convert lpc1850-cgu.txt to yaml format
Date: Fri, 6 Jun 2025 12:24:09 -0400
Message-Id: <20250606162410.1361169-1-Frank.Li@xxxxxxx>
X-Mailer: git-send-email 2.34.1
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: BY3PR10CA0016.namprd10.prod.outlook.com
(2603:10b6:a03:255::21) To PAXPR04MB9642.eurprd04.prod.outlook.com
(2603:10a6:102:240::14)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: e5284802-3c8f-4ebf-bd6a-08dda5169a5b
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|376014|1800799024|52116014|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
=?us-ascii?Q?/NK50BvY3FlHBBE+sRGIwY+wnpReMdB92XC6kkpxZ8DoUFw3b5Eo1HGMEcfj?=
=?us-ascii?Q?GkLWKs1cbBm42CL9RSEGorrwhALuW4ZPh329cDqQJEkD8mC5gph2YvmFc7As?=
=?us-ascii?Q?uH4Fzo1QPoQZDXzSFpI+NC+2ufPfC1ZtxESXktvUTPoYz+huDJc7TpjWHHUL?=
=?us-ascii?Q?B1Bxe2xQFvIW963aXnx7IADkkr6Lz5phE7Tm5xT6B9EJivi9J/ItDkCiy/nh?=
=?us-ascii?Q?RHWM+tDcTbFSx6OQhtasXDokz35X76uDq4pkge8baCYO05wPPQWlEaueZ+m1?=
=?us-ascii?Q?1r6U7RjVAJHO4EBH0zdcJeYyAnF18F4ZQJwi9is6qJESuYgTPrVvFJm9bXbL?=
=?us-ascii?Q?7oZurX7BM5MsPda1K69zRRYlQfOsee3zwiedMIIWoW6LskWWi4BLqHrp6b66?=
=?us-ascii?Q?qKFCZUE41eo/haA1q+FuroXkDqiD8LY9FaAnREnas3s77p3ra4UenCY6jWSd?=
=?us-ascii?Q?3cr06fJDzBpyPkbMSWoDw4D5GJPz8wIVJBebd2kY56KnASGSf9kz1nFRHh4H?=
=?us-ascii?Q?FFafD0jysBJ8JTRVvNNG8UnPmHK8MO9bi9tFK74v0JCwnA+bIFx+pD09oYH1?=
=?us-ascii?Q?3StY1TWyZTOIkUVOjALc9/JMqoG7+p1aLv2YBoW5sy+RzZwfVccVn6Vpwvgc?=
=?us-ascii?Q?Wa3VErBZW6xWwehoM6orYYQAOJS33008/JQbob7ZWkP2dYKgNXIjADQngJHp?=
=?us-ascii?Q?35V0h5meuDtHrab1tjZMqB6BGIbtzXY/iKRWgwg7yOtbmJMHiPnkb4epVc5J?=
=?us-ascii?Q?PO5S/j1S5+jmVjuFSetcdnMW8P7XxLy7joQLBgcGfQ0unZcgogqAInyLTIa9?=
=?us-ascii?Q?iiFzXNjc3pY1Wr1qOrzItiooH+3L+DJpEGyKdkmkvxW1GqfoS44At3Dx2mOB?=
=?us-ascii?Q?bj3qyH+ISmoqzhD97BFJRpgCN/OpiV5sKw1W58ksKLMcEfVbxbxMtyA7Rc5m?=
=?us-ascii?Q?3FEHOLNOi5yqfmtsReQCpzZ/mPrO0cxoUgWtC374SF8IxOtHgrn47+bx45JR?=
=?us-ascii?Q?EKQy9dL4h0s1I0GPNhTZ8PWTQaKlTefgEACbKA04vUj7aUV2Lr4r6KcO5uPQ?=
=?us-ascii?Q?CJayW/SLdf9kYD01LoroW4id3Hs1t8SlRWXyh5XZ91tSwLGf6zNhSkiuc1Mk?=
=?us-ascii?Q?tY3d2MAG7zzkLo8icAZaEz9CVW3BbgeuqridlHQ3gF6ft1/mGksh+yPViqLk?=
=?us-ascii?Q?9c01tvMZ6gS++D4EyIVWo3n1emfR6v8evXOusq0RiAC7PPOi8/qouUWQwlkJ?=
=?us-ascii?Q?9gNufi2uTpRPN8owZzjLba/8o4QgD6kyrcrDdQ65JTRs3RSvzTwvBWzTyC6v?=
=?us-ascii?Q?3mIGSob12HS/gPe2z91gq2cbaS5z8RBakv402RmSBmGa8dh0CLOTP1E4U3mA?=
=?us-ascii?Q?DgSCBw8qvSYBq6boJJganF0Y192d7FP24RXx2BID+WMyMcJIpJkwkixFlHMD?=
=?us-ascii?Q?wUQS6pK0Y/QHIRL/voyjx9Cl7swSwGKT?=
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
=?us-ascii?Q?vAhFUhRSlxUctw5J//xgcEpXw7m8PqY9vcSlNIu/PmNjRnXV3tlnm+1xFret?=
=?us-ascii?Q?PBz33DQ/3jSed6GwpydmnvEs7yqnFJgxT0aYtRCjpkR1OWTNE8OYpivcP1se?=
=?us-ascii?Q?FQxWcR0M+eirz6qUM7wO4UajhkjczDJkWCndibPYPTin5pMr2h91tQPGNVwf?=
=?us-ascii?Q?+07eiqWVhwspU9gjkz3sYqBUauaS7kB+DZUsp9WVR+1JZCn+DDKQ0HXLjpnq?=
=?us-ascii?Q?kc9fKX2yCnO3Ix+MN8cG1gxaQlvZVtHBq7/dYLNtHmDcGKPsQ+nResXniqsD?=
=?us-ascii?Q?ybnJKfmGgITlyb/0xT7Sr+S1/L5uKtF6esuG8FASDwP6txyfu1iNvhp0q+Xi?=
=?us-ascii?Q?SK+oc7V7jXDj4Vk7hqbn4KyYiVsMaKN5EP6BsJhFwADxrUoX76+IU8l/rN9N?=
=?us-ascii?Q?xK+10L47VIL4mVKTgGwQ6fmhC6HFxavJ6dDjmqO/hhrEy5TsCAUlan/Vee/V?=
=?us-ascii?Q?MxidvpN9At2PwJgqPiLMUDA3haWHrTWm00N+SHLVaJXTa0l4nc3FhCv8tWSC?=
=?us-ascii?Q?mSozxaNQ/1oO1Lmf5ZjGerjPlqf142KNObApS54plmDKT11SnrDg++sAXHqF?=
=?us-ascii?Q?QQHQrKOH9QAAan1BO2j7EAQHf/qbu7KSXsqPVI+/Yu8XoIIzF2LmnvB4PPnk?=
=?us-ascii?Q?zTX2ovBANnCXH6aQHvkm3Zbdoa1nJgikWcnq0Pjv0Vjws5Y/BlZF0F10kuzK?=
=?us-ascii?Q?3y6GqVW6zFU0VEtobehjPkRpk6QOoRHCn+BJk4wvPRl4sqdDuDni1TDX94Va?=
=?us-ascii?Q?HbqyK3v9++752lNciO2wVo9vW8B1SZL/QN4r3cS9BhnaFD3EjJCKMZ7sD9Ks?=
=?us-ascii?Q?Q5jWAxA1dQNkMVVtL7rUY8Y0xM63rY7c5asOydgE7kdLOrMApri/wtElJMer?=
=?us-ascii?Q?seo/mLH+/oY6zxOIJI0qwSt+KZaNN+YZVgS+UBrFHMTIrv207zNB2t8t+/qr?=
=?us-ascii?Q?TGMofAWX7+rQuk70gc0gt6Mt2A3odMeh3TXBmyVRFRWiO6p2NNorIACidRVE?=
=?us-ascii?Q?oTytrEusF813xaZrOmh7aHd5UpFAQR2pW2gDyVp/qOmpsYfXEj3Vs79Bu3io?=
=?us-ascii?Q?+qJF6h6XpCj2e0zypYLLVQ9N+YnI7OuRKWUy7QWjh13DyTvNMe45Pwc/pr6c?=
=?us-ascii?Q?w1pMryDhikUxYSMCkSdeYkBy6Aa/8XkWnO4d3CpDovqU6zmChmTGFqU+dL9g?=
=?us-ascii?Q?gC25lBifBR1rcPpv2UQSyWKqbUrvP7HBo1B2XSToODSBfm1i1D44kSXDYgpp?=
=?us-ascii?Q?jE2ab82S6aoOYEjwIdEucK45ZGuuKv6RWwRvSbJk6XjnF11WMMYYOEkyiDXT?=
=?us-ascii?Q?QTtzf5W8j0xH8xQFb7u2BZ40paXiMVuaLycqy+i33qUuZkUI3WbXX6MrDF/n?=
=?us-ascii?Q?NmBhQLn2E6PEbhyWmF/LaQqt/hebiRxXqjZlIe1kXTmqRXMI1Sa7nIKBRcjV?=
=?us-ascii?Q?4VWTIEGw7/wj7kl1nSLQXF1MIgfAy0Q6QYOYqA48fbE4RUzW+uAbGSJQKKz+?=
=?us-ascii?Q?R9bplt0WFnXoTe0YjF2a4ScwBKB7yzYBr27jJVW+1lfdazCziNeouYlx+SCh?=
=?us-ascii?Q?8SziaIAxaumYuQfZZdU=3D?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: e5284802-3c8f-4ebf-bd6a-08dda5169a5b
X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 16:24:25.6129
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: Z8bvAoQp1LGEAFzeQ+j1yP/qmsuiq3qQzHXOpKRWf5lB2XySX8dwkaTAOCbirD9vS0OHGIEyTKAT1pysoOmJyA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Convert lpc1850-cgu.txt to yaml format.

Additional changes:
- remove extra clock source nodes in example.
- remove clock consumer in example.
- remove clock-output-names and clock-clock-indices from required list to
match existed dts.

Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
---
change in v2
- fix clock-indice and clock-output-name allow 1-27 items
- add > at top decription according to rob's suggestion
---
.../devicetree/bindings/clock/lpc1850-cgu.txt | 131 ------------------
.../bindings/clock/nxp,lpc1850-cgu.yaml | 99 +++++++++++++
2 files changed, 99 insertions(+), 131 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/clock/lpc1850-cgu.txt
create mode 100644 Documentation/devicetree/bindings/clock/nxp,lpc1850-cgu.yaml

diff --git a/Documentation/devicetree/bindings/clock/lpc1850-cgu.txt b/Documentation/devicetree/bindings/clock/lpc1850-cgu.txt
deleted file mode 100644
index 2cc32a9a945a7..0000000000000
--- a/Documentation/devicetree/bindings/clock/lpc1850-cgu.txt
+++ /dev/null
@@ -1,131 +0,0 @@
-* NXP LPC1850 Clock Generation Unit (CGU)
-
-The CGU generates multiple independent clocks for the core and the
-peripheral blocks of the LPC18xx. Each independent clock is called
-a base clock and itself is one of the inputs to the two Clock
-Control Units (CCUs) which control the branch clocks to the
-individual peripherals.
-
-The CGU selects the inputs to the clock generators from multiple
-clock sources, controls the clock generation, and routes the outputs
-of the clock generators through the clock source bus to the output
-stages. Each output stage provides an independent clock source and
-corresponds to one of the base clocks for the LPC18xx.
-
- - Above text taken from NXP LPC1850 User Manual.
-
-
-This binding uses the common clock binding:
- Documentation/devicetree/bindings/clock/clock-bindings.txt
-
-Required properties:
-- compatible:
- Should be "nxp,lpc1850-cgu"
-- reg:
- Shall define the base and range of the address space
- containing clock control registers
-- #clock-cells:
- Shall have value <1>. The permitted clock-specifier values
- are the base clock numbers defined below.
-- clocks:
- Shall contain a list of phandles for the external input
- sources to the CGU. The list shall be in the following
- order: xtal, 32khz, enet_rx_clk, enet_tx_clk, gp_clkin.
-- clock-indices:
- Shall be an ordered list of numbers defining the base clock
- number provided by the CGU.
-- clock-output-names:
- Shall be an ordered list of strings defining the names of
- the clocks provided by the CGU.
-
-Which base clocks that are available on the CGU depends on the
-specific LPC part. Base clocks are numbered from 0 to 27.
-
-Number: Name: Description:
- 0 BASE_SAFE_CLK Base safe clock (always on) for WWDT
- 1 BASE_USB0_CLK Base clock for USB0
- 2 BASE_PERIPH_CLK Base clock for Cortex-M0SUB subsystem,
- SPI, and SGPIO
- 3 BASE_USB1_CLK Base clock for USB1
- 4 BASE_CPU_CLK System base clock for ARM Cortex-M core
- and APB peripheral blocks #0 and #2
- 5 BASE_SPIFI_CLK Base clock for SPIFI
- 6 BASE_SPI_CLK Base clock for SPI
- 7 BASE_PHY_RX_CLK Base clock for Ethernet PHY Receive clock
- 8 BASE_PHY_TX_CLK Base clock for Ethernet PHY Transmit clock
- 9 BASE_APB1_CLK Base clock for APB peripheral block # 1
-10 BASE_APB3_CLK Base clock for APB peripheral block # 3
-11 BASE_LCD_CLK Base clock for LCD
-12 BASE_ADCHS_CLK Base clock for ADCHS
-13 BASE_SDIO_CLK Base clock for SD/MMC
-14 BASE_SSP0_CLK Base clock for SSP0
-15 BASE_SSP1_CLK Base clock for SSP1
-16 BASE_UART0_CLK Base clock for UART0
-17 BASE_UART1_CLK Base clock for UART1
-18 BASE_UART2_CLK Base clock for UART2
-19 BASE_UART3_CLK Base clock for UART3
-20 BASE_OUT_CLK Base clock for CLKOUT pin
-24-21 - Reserved
-25 BASE_AUDIO_CLK Base clock for audio system (I2S)
-26 BASE_CGU_OUT0_CLK Base clock for CGU_OUT0 clock output
-27 BASE_CGU_OUT1_CLK Base clock for CGU_OUT1 clock output
-
-BASE_PERIPH_CLK and BASE_SPI_CLK is only available on LPC43xx.
-BASE_ADCHS_CLK is only available on LPC4370.
-
-
-Example board file:
-
-/ {
- clocks {
- xtal: xtal {
- compatible = "fixed-clock";
- #clock-cells = <0>;
- clock-frequency = <12000000>;
- };
-
- xtal32: xtal32 {
- compatible = "fixed-clock";
- #clock-cells = <0>;
- clock-frequency = <32768>;
- };
-
- enet_rx_clk: enet_rx_clk {
- compatible = "fixed-clock";
- #clock-cells = <0>;
- clock-frequency = <0>;
- clock-output-names = "enet_rx_clk";
- };
-
- enet_tx_clk: enet_tx_clk {
- compatible = "fixed-clock";
- #clock-cells = <0>;
- clock-frequency = <0>;
- clock-output-names = "enet_tx_clk";
- };
-
- gp_clkin: gp_clkin {
- compatible = "fixed-clock";
- #clock-cells = <0>;
- clock-frequency = <0>;
- clock-output-names = "gp_clkin";
- };
- };
-
- soc {
- cgu: clock-controller@40050000 {
- compatible = "nxp,lpc1850-cgu";
- reg = <0x40050000 0x1000>;
- #clock-cells = <1>;
- clocks = <&xtal>, <&creg_clk 1>, <&enet_rx_clk>, <&enet_tx_clk>, <&gp_clkin>;
- };
-
- /* A CGU and CCU clock consumer */
- lcdc: lcdc@40008000 {
- ...
- clocks = <&cgu BASE_LCD_CLK>, <&ccu1 CLK_CPU_LCD>;
- clock-names = "clcdclk", "apb_pclk";
- ...
- };
- };
-};
diff --git a/Documentation/devicetree/bindings/clock/nxp,lpc1850-cgu.yaml b/Documentation/devicetree/bindings/clock/nxp,lpc1850-cgu.yaml
new file mode 100644
index 0000000000000..ed178c7df00c3
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/nxp,lpc1850-cgu.yaml
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/nxp,lpc1850-cgu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP LPC1850 Clock Generation Unit (CGU)
+
+description: >
+ The CGU generates multiple independent clocks for the core and the
+ peripheral blocks of the LPC18xx. Each independent clock is called
+ a base clock and itself is one of the inputs to the two Clock
+ Control Units (CCUs) which control the branch clocks to the
+ individual peripherals.
+
+ The CGU selects the inputs to the clock generators from multiple
+ clock sources, controls the clock generation, and routes the outputs
+ of the clock generators through the clock source bus to the output
+ stages. Each output stage provides an independent clock source and
+ corresponds to one of the base clocks for the LPC18xx.
+
+ Above text taken from NXP LPC1850 User Manual.
+
+maintainers:
+ - Frank Li <Frank.Li@xxxxxxx>
+
+properties:
+ compatible:
+ const: nxp,lpc1850-cgu
+
+ reg:
+ maxItems: 1
+
+ '#clock-cells':
+ const: 1
+ description: |
+ Which base clocks that are available on the CGU depends on the
+ specific LPC part. Base clocks are numbered from 0 to 27.
+
+ Number: Name: Description:
+ 0 BASE_SAFE_CLK Base safe clock (always on) for WWDT
+ 1 BASE_USB0_CLK Base clock for USB0
+ 2 BASE_PERIPH_CLK Base clock for Cortex-M0SUB subsystem,
+ SPI, and SGPIO
+ 3 BASE_USB1_CLK Base clock for USB1
+ 4 BASE_CPU_CLK System base clock for ARM Cortex-M core
+ and APB peripheral blocks #0 and #2
+ 5 BASE_SPIFI_CLK Base clock for SPIFI
+ 6 BASE_SPI_CLK Base clock for SPI
+ 7 BASE_PHY_RX_CLK Base clock for Ethernet PHY Receive clock
+ 8 BASE_PHY_TX_CLK Base clock for Ethernet PHY Transmit clock
+ 9 BASE_APB1_CLK Base clock for APB peripheral block # 1
+ 10 BASE_APB3_CLK Base clock for APB peripheral block # 3
+ 11 BASE_LCD_CLK Base clock for LCD
+ 12 BASE_ADCHS_CLK Base clock for ADCHS
+ 13 BASE_SDIO_CLK Base clock for SD/MMC
+ 14 BASE_SSP0_CLK Base clock for SSP0
+ 15 BASE_SSP1_CLK Base clock for SSP1
+ 16 BASE_UART0_CLK Base clock for UART0
+ 17 BASE_UART1_CLK Base clock for UART1
+ 18 BASE_UART2_CLK Base clock for UART2
+ 19 BASE_UART3_CLK Base clock for UART3
+ 20 BASE_OUT_CLK Base clock for CLKOUT pin
+ 24-21 - Reserved
+ 25 BASE_AUDIO_CLK Base clock for audio system (I2S)
+ 26 BASE_CGU_OUT0_CLK Base clock for CGU_OUT0 clock output
+ 27 BASE_CGU_OUT1_CLK Base clock for CGU_OUT1 clock output
+
+ BASE_PERIPH_CLK and BASE_SPI_CLK is only available on LPC43xx.
+ BASE_ADCHS_CLK is only available on LPC4370.
+
+ clocks:
+ maxItems: 5
+
+ clock-indices:
+ minItems: 1
+ maxItems: 28
+
+ clock-output-names:
+ minItems: 1
+ maxItems: 28
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+ - |
+ clock-controller@40050000 {
+ compatible = "nxp,lpc1850-cgu";
+ reg = <0x40050000 0x1000>;
+ #clock-cells = <1>;
+ clocks = <&xtal>, <&creg_clk 1>, <&enet_rx_clk>, <&enet_tx_clk>, <&gp_clkin>;
+ };
+
--
2.34.1



Return-Path: <linux-kernel+bounces-676025-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id E27FC41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:24:57 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3369F179730
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:24:59 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DFFC28A1C5;
Fri, 6 Jun 2025 16:24:42 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OU290Q0G"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B7A678F2F;
Fri, 6 Jun 2025 16:24:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749227081; cv=none; b=M5MryAdyhWAbvClFwBqee9TywImvcDx41SP2HCjrWjpaTBggbOMMlyQm4qw8VFbqua8ozqZNx0nyieuZ+14E9CkdmWE397XPF6ZMJ+dwisS4kswCq8a6QwoVNgikqXKmpy7CpPzV5kWrglDtpmz36pSRlalDY7CPTyqKOhYUNDI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749227081; c=relaxed/simple;
bh=Xf9kmEEuLAigJEs+1EdF+1tvIYHiWd48C3uxpyoKTI8=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=WtH234RBBnrNdiBPz7WAx4yayM0OWIbrk9fshh6aSo7Fm2RYaDs47oI801eH1jr0JY5WJUDr52FORZDgTAG9EIftgPbjjLMpbJ3pWGEUtoPXRE/PsIN8EfZoXFIBtntqx1wjOXoMfjv8EM60JRRL7gswgx0xJuzr/antzxUME9c=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OU290Q0G; arc=none smtp.client-ip=10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AE14C4CEEB;
Fri, 6 Jun 2025 16:24:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
s=k20201202; t=1749227080;
bh=Xf9kmEEuLAigJEs+1EdF+1tvIYHiWd48C3uxpyoKTI8=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=OU290Q0G/h5Ed78E2BzJTMwLLTvS4tqe7v5CG0thtqv7Yfx7q4mYtW5sGJkyjYs5/
JAPYqfOZ+C+VtX6ixRzidSzk9Mt5VINGk1FJW6Req27BNa8L1YiKaTrqUPDGvcRXWE
/lPUt9ck1HBSovEfqVylPgIyjRIZPpH5HD9BBoXwBvTXJLGswfK+XQaIjanjQcjFP+
WHzdTzQIlOa/PLFjLsDD93vzppJN1o6+nQsVREJEYSh6PYRe86z1+PVMv4TKSRBiTr
mdVhKhTaXvNuUOz2T8hMyszteh4+m0Ka8aJ9skrCjmy1kqttmkMiL93n8nebgqlpoD
xCDk29IQqdjZw==
Date: Fri, 6 Jun 2025 17:24:36 +0100
From: Conor Dooley <conor@xxxxxxxxxx>
To: marius.cristea@xxxxxxxxxxxxx
Cc: jic23@xxxxxxxxxx, dlechner@xxxxxxxxxxxx, nuno.sa@xxxxxxxxxx,
andy@xxxxxxxxxx, robh@xxxxxxxxxx, krzk+dt@xxxxxxxxxx,
conor+dt@xxxxxxxxxx, broonie@xxxxxxxxxx, linux-iio@xxxxxxxxxxxxxxx,
devicetree@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: adding support for PAC194X
Message-ID: <20250606-olympics-limeade-fcf2421950d0@spud>
References: <20250606093929.100118-1-marius.cristea@xxxxxxxxxxxxx>
<20250606093929.100118-2-marius.cristea@xxxxxxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="lAMn5b7hs5L2diVG"
Content-Disposition: inline
In-Reply-To: <20250606093929.100118-2-marius.cristea@xxxxxxxxxxxxx>
X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,
RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham
autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu


--lAMn5b7hs5L2diVG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Jun 06, 2025 at 12:39:28PM +0300, marius.cristea@xxxxxxxxxxxxx wrote:

David had a bunch of comments, so much to say, but..

> + interrupt-names:
> + description:
> + alert1 indicates a HIGH or LOW limit was exceeded.
> + alert2 indicates a THERM limit was exceeded.

You should be able to merge this description into the items list,

> + items:
> + - const: alert1

by adding description: into these

> + - const: alert2

e.g.
items:
- const: sdmmc-3v3
description: pad configuration for 3.3 V
- const: sdmmc-1v8
description: pad configuration for 1.8 V
- const: sdmmc-3v3-drv
description: pull-up/down configuration for 3.3 V
- const: sdmmc-1v8-drv
description: pull-up/down configuration for 1.8 V


--lAMn5b7hs5L2diVG
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaEMWRAAKCRB4tDGHoIJi
0jnNAQCd79bl5UCEVJAis5y+8/ZqK2oNBPKpx0uJBqWl6FPJsQD/SqITyMib8f/4
N6lHcU6V3hbqjSWReVFsE635OzZ5QwA=
=P++d
-----END PGP SIGNATURE-----

--lAMn5b7hs5L2diVG--


Return-Path: <linux-kernel+bounces-676026-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id B9AA541E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:25:53 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 741991889EB3
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:26:07 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D5B5289E0E;
Fri, 6 Jun 2025 16:25:45 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NNWxxbnD"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13])
(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 560861A38F9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:25:43 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749227144; cv=none; b=dq1jABtgG89K6fZCZj4pxg/gu6SkytmF4KX69TqGAKrPL9hMQT3RASHdKmGANXSgLXSJSWdzygb/MIdU3rb14lOk6wvDye3uVK93UiPBRXRghVSuR5KYZZezbiL/f/6qncR4BtzvZhigp09XUgDEudSFOvPU37g6BeB6IwKDfDg=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749227144; c=relaxed/simple;
bh=oVXZg15NSmSTzHYB7TIMygNLt5CrLOPw+eUrgDEEOoI=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=YelDn6Oeq9qQHMgN3ODDCSwAh6r3C8hcmW4h9CyRL41BYjsYpGMBS9aIQxYSjmN1pZd1VF+V8TwzvJDgyiqi2e23TXpqxGFEl+Rn24K3Vt9r0QgjmbQNzX+zmT+QXbUXIw2F7kLOpIFF/3BJaEdl4JPkFOrcYEarBCyPKN5Lo7M=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NNWxxbnD; arc=none smtp.client-ip=192.198.163.13
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749227144; x=1780763144;
h=date:from:to:cc:subject:message-id:references:
mime-version:in-reply-to;
bh=oVXZg15NSmSTzHYB7TIMygNLt5CrLOPw+eUrgDEEOoI=;
b=NNWxxbnD2IvO5eIVX47Sa4FxXLTMFooKrwjX0ieXJJtfKiTLCVLjjmVw
5p3NClz7qp18XamQ0GrUIyWQLnnskVaVQw+9O+hVi5umQ09ewFtZXM962
1zLAs0tOHgWvCy6pXsbfWxWGs6fU72KasDD7uKdQg88Ud2AjP2yxPvQge
xYOQUmTX4mPyUfHaAo8Axu9kqY/1AerGdfLTN/DgmTpq00g9ppF8A/ydM
EQorCxh9QJa67uvg9u536mvADklcl/gZCZ2oM5k8NmHgax6Ov72lnu+gw
yHYs9WFJrfFPbtw0pWkPTfaHB7e/ML7hwGlINZbiy/JdkUox0yFTtHD6p
Q==;
X-CSE-ConnectionGUID: ajQFbEn8TQWJNVf9sX8+nQ==
X-CSE-MsgGUID: eejMPj0CRBicZOGbFGuoIA==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="54009935"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="54009935"
Received: from orviesa002.jf.intel.com ([10.64.159.142])
by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 09:25:43 -0700
X-CSE-ConnectionGUID: jeGBrprqQem9yr4AG2i7iw==
X-CSE-MsgGUID: YJ1vM9b8QSWwVcFyZfLMEg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="176817506"
Received: from agluck-desk3.sc.intel.com (HELO agluck-desk3) ([172.25.103.51])
by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 09:25:42 -0700
Date: Fri, 6 Jun 2025 09:25:40 -0700
From: "Luck, Tony" <tony.luck@xxxxxxxxx>
To: Reinette Chatre <reinette.chatre@xxxxxxxxx>
Cc: Fenghua Yu <fenghuay@xxxxxxxxxx>,
Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>,
Peter Newman <peternewman@xxxxxxxxxx>,
James Morse <james.morse@xxxxxxx>, Babu Moger <babu.moger@xxxxxxx>,
Drew Fustini <dfustini@xxxxxxxxxxxx>,
Dave Martin <Dave.Martin@xxxxxxx>,
Anil Keshavamurthy <anil.s.keshavamurthy@xxxxxxxxx>,
Chen Yu <yu.c.chen@xxxxxxxxx>, x86@xxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx, patches@xxxxxxxxxxxxxxx
Subject: Re: [PATCH v5 14/29] x86,fs/resctrl: Support binary fixed point
event counters
Message-ID: <aEMWhMbLpImmMBrL@agluck-desk3>
References: <20250521225049.132551-1-tony.luck@xxxxxxxxx>
<20250521225049.132551-15-tony.luck@xxxxxxxxx>
<f368c506-c479-4e8b-a5c6-b9bc5bcd5674@xxxxxxxxx>
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <f368c506-c479-4e8b-a5c6-b9bc5bcd5674@xxxxxxxxx>
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

On Tue, Jun 03, 2025 at 08:49:08PM -0700, Reinette Chatre wrote:
> > + sprintf(buf, "%0*llu", fp->decplaces, frac);
>
> I'm a bit confused here. I see fp->decplaces as the field width and the "0" indicates
> that the value is zero padded on the _left_. I interpret this to mean that, for example,
> if the value of frac is 42 then it will be printed as "0042". The fraction's value is modified
> (it is printed as "0.0042") and there are no trailing zeroes to remove. What am I missing?

An example may help. Suppose architecture is providing 18 binary place
numbers, and delivers the value 0x60000 to be displayed. With 18 binary
places filesystem chooses 6 decimal places (I'll document the rationale
for this choice in comments in next version). In binary the value looks
like this:

integer binary_places
1 100000000000000000

Running through my algorithm will end with "frac" = 500000 (decimal).

Thus there are *trailing* zeroes. The value should be displayed as
"1.5" not as "1.500000".

-Tony


Return-Path: <linux-kernel+bounces-676027-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id A1DFC41E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:26:34 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7EF6E3B2227
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:26:12 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 525AD289E04;
Fri, 6 Jun 2025 16:26:28 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Y+A9uz3a"
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17])
(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 966181A38F9
for <linux-kernel@xxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:26:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.17
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749227187; cv=fail; b=Kttf5KTJ8QQy9icAdRDzZy/Y5bCOIaDoPcndfiv/q2z3dd62/t8hrwywzwmeoUB6mns69GMvUCRPItslugzs73drRVL7o1WU8h+fy1376TFU6lvS2se/cmkyMmpc5c/RWoeg20/X2OSh/0qUhudEnswgfv1f4KR4Wx5ISUiVenw=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749227187; c=relaxed/simple;
bh=1fJkgnN7UtVLkbwJ9qwzpbjDGJrz7fen/1AbX/2eU1Y=;
h=Message-ID:Date:Subject:To:CC:References:From:In-Reply-To:
Content-Type:MIME-Version; b=EfzlA4yTvRH1lc3ZGwFaV67MqJdffYgwrSoqwjFoWUkBC6VNedjPL2p/6V6qg17Rtw3XeMoHKCSC75ceWK7l03/DPU5mia3fRgdNc3MAGM0401XSbRF8HsRQORLHvKaHhopoU81C7i/0zTa/KZriOueQnvOt03atoy4Ke4EGH3A=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Y+A9uz3a; arc=fail smtp.client-ip=192.198.163.17
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
t=1749227186; x=1780763186;
h=message-id:date:subject:to:cc:references:from:
in-reply-to:content-transfer-encoding:mime-version;
bh=1fJkgnN7UtVLkbwJ9qwzpbjDGJrz7fen/1AbX/2eU1Y=;
b=Y+A9uz3aPSUrISQPbJyWtkZCv3I9FpdsGjS1iTxEjIUPnMa5uVqneqWP
JOBfhtFMbc1q/iZ3aEfRIKgbF1HV5K0zlBQolqzctPyY6rIrlnDPw23cn
UecehUc2ZdHNZhV8EzST3Cx+aTDCNFsiC1A/qViAiiOWJxPMHaWKUgRM8
qxhiZ+DkjuV0HD4IukkiWb9iuDHxo0yW0FKxrJYy2F4F5oxjSulAgU5ZQ
uiSAjM/R0vOKVri+SWIWY+yXICuY9GT5M4kG03UqTsncHJ/gpIhPVklB4
TpImhY+AJkDhb7sTy6J2yuMdUL+IKvvi5hhRkxUXLBstkTIAOQ1PqsNMq
A==;
X-CSE-ConnectionGUID: wblQB12XR+6jU/AVSOKYDg==
X-CSE-MsgGUID: aBaBUVmWQO2MYFKRhHAk+Q==
X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="51290007"
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="51290007"
Received: from fmviesa002.fm.intel.com ([10.60.135.142])
by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 09:26:25 -0700
X-CSE-ConnectionGUID: CtZJsOP5SOGgG7XO5JXc1g==
X-CSE-MsgGUID: nBIjTqHFSl2FxQycd16WYA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.16,215,1744095600";
d="scan'208";a="169056465"
Received: from orsmsx901.amr.corp.intel.com ([10.22.229.23])
by fmviesa002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 09:26:24 -0700
Received: from ORSMSX901.amr.corp.intel.com (10.22.229.23) by
ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1544.25; Fri, 6 Jun 2025 09:26:23 -0700
Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by
ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.2.1544.25 via Frontend Transport; Fri, 6 Jun 2025 09:26:23 -0700
Received: from NAM04-BN8-obe.outbound.protection.outlook.com (40.107.100.50)
by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.1.2507.55; Fri, 6 Jun 2025 09:26:23 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=wcppfG/2On0l1JmPX4vneNQCKL/w03W5GCQ4MqaN8BJ7DxvOInqg/TkM5wuz3UEpjMYNo6hg06kVOEb1BIFmTttRCQpOR0HAjait7PPDBxUPRNYZ7EFqyIqsgNQoaeMsVUriXv8rGjrHqBRVRFruBv9bsvYfg70O1/mOz6D+NQr2okLjluPjTnbYdnxy7UxUg+vb70LpV08yVk7aOV1k7Y3KRdElUe05yWSQWrZHRFLhjZ77KZSxaHpgpA83zDhFnaEvAUYXsV0x/6/qJ7ei7/wQh1qW5kSFfNX2+2d4suJBJFWVXMDFVsDV0NoyP9+UQYNerC63aFBDURGKZdi3Dg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=bwlk0pE6Nx6EcHg8WqVACgjHkxxGrUF+bLCf8DRcPfU=;
b=PPtrgeAAnIfZ4skH3//vUYfdwLLGMcImVs6xSqOJvU4JhfeF4lOGJCvDR//POXzjFG3mVXg0F1u7Wp/cK22jizVQJ7kAdJTZB+RRx7HwM3fzD/RzHVT4ol6FxneLR7TdNyQ+CTBxUUTtkqJE0z1ewj8pBPAJUw4K+eZe+kZVdeTaQP8iEFufxXfkqaRjZbAuBcHojqh0qgFCqhKEGekKHCKwdFCokNN4/Psb1U3tD2Qcg0Yj2F9bpD930Q0npRkt7x/ggDtP6zp8AZomc19QjBXvEHGN6I3nlbOU0UAvzNPmSGGlo4tx6mxQ5mK//non5Nr2ovr9jUhxluktbL2TdA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
dkim=pass header.d=intel.com; arc=none
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=intel.com;
Received: from SJ2PR11MB7573.namprd11.prod.outlook.com (2603:10b6:a03:4d2::10)
by PH3PPFEC89C124F.namprd11.prod.outlook.com (2603:10b6:518:1::d5d) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8769.25; Fri, 6 Jun
2025 16:26:08 +0000
Received: from SJ2PR11MB7573.namprd11.prod.outlook.com
([fe80::61a:aa57:1d81:a9cf]) by SJ2PR11MB7573.namprd11.prod.outlook.com
([fe80::61a:aa57:1d81:a9cf%6]) with mapi id 15.20.8792.034; Fri, 6 Jun 2025
16:26:07 +0000
Message-ID: <9eb9a466-2895-405a-91f7-cda75e75f7ae@xxxxxxxxx>
Date: Fri, 6 Jun 2025 09:26:06 -0700
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v5 27/29] fs/resctrl: Add file system mechanism for
architecture info file
To: "Luck, Tony" <tony.luck@xxxxxxxxx>
CC: Fenghua Yu <fenghuay@xxxxxxxxxx>, Maciej Wieczor-Retman
<maciej.wieczor-retman@xxxxxxxxx>, Peter Newman <peternewman@xxxxxxxxxx>,
James Morse <james.morse@xxxxxxx>, Babu Moger <babu.moger@xxxxxxx>, "Drew
Fustini" <dfustini@xxxxxxxxxxxx>, Dave Martin <Dave.Martin@xxxxxxx>, "Anil
Keshavamurthy" <anil.s.keshavamurthy@xxxxxxxxx>, Chen Yu
<yu.c.chen@xxxxxxxxx>, <x86@xxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<patches@xxxxxxxxxxxxxxx>
References: <20250521225049.132551-1-tony.luck@xxxxxxxxx>
<20250521225049.132551-28-tony.luck@xxxxxxxxx>
<f25d136c-b1d3-483a-ac77-92464d7fe25c@xxxxxxxxx>
<aEIxzbuFybLBE3xt@agluck-desk3>
From: Reinette Chatre <reinette.chatre@xxxxxxxxx>
Content-Language: en-US
In-Reply-To: <aEIxzbuFybLBE3xt@agluck-desk3>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-ClientProxiedBy: BY3PR03CA0012.namprd03.prod.outlook.com
(2603:10b6:a03:39a::17) To SJ2PR11MB7573.namprd11.prod.outlook.com
(2603:10b6:a03:4d2::10)
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: SJ2PR11MB7573:EE_|PH3PPFEC89C124F:EE_
X-MS-Office365-Filtering-Correlation-Id: ba3de644-5c01-4c3a-fbe4-08dda516d754
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016;
X-Microsoft-Antispam-Message-Info: =?utf-8?B?cWZWUklqU21JUWFSTCszditKYnZEeVc2NnFIM3RCVmt6eXpHL2RMREo5Mm12?=
=?utf-8?B?TlJBYVlNMlYyV0pYcDJQWCszL2hQMmNTYS9DbnNnU2c2clczQ1NmeVQ3SGla?=
=?utf-8?B?VUVXREZWb3B1Zkl1cmlCOExOUzRWUXFrKzlXR1lqWUNKOHovUlZ2eCtmbWZp?=
=?utf-8?B?cDRYTFhmWW9rUnphbzdMeFNIcEpma00vcnYra3NvdGlLM2V0ZGRQanNCVHVL?=
=?utf-8?B?R1UzM2NGYURkK3lqT1ZZa2V2aUNGRk03VllVb1dYVzgzbDFrY0hpeG5FY3Vp?=
=?utf-8?B?RTdmaUlLREpNaVVqckRQWkJSWVI4VDVrU1hYTXdUczE0YzVxQXgvY1N3S2tQ?=
=?utf-8?B?d3VXbnQvMXlPY25RL0xvUHlhZTlKUzRXQlN6MnhNcXUxSGVqL0NaaU01YTl6?=
=?utf-8?B?WElGeUhUdHpHY2RvSWF6WHV1SklDVGlKdGdmam9qTk05Y20rZWdtNzhaWlJM?=
=?utf-8?B?bVIweTNtNjJBeGxERjdwOGNvakVrS2JUdVBwRmFEemoyMDZQZ2dMN0I2WnBB?=
=?utf-8?B?L1Z5MUJNWWpXVmU2aEJLMGxDci9MUTVGVlBhN2RvYjBoNzBXTmg4VS9JVnQ2?=
=?utf-8?B?amw4Q0FTTnNveGFBOXFxUlVvR0lPQ0NTYm9SK0VMdjFmcVVYKzJFYTJUOGFQ?=
=?utf-8?B?T2czTm1TVDc4NmNoV1FucUE4SUt3c0JUem04NFBhMFVaWGdNUkRJdkJXMVkr?=
=?utf-8?B?MTBXeE5GREVHWTM2alB2K3kwZGxYSzVYSi9EZkdkNnR3YTlBR1owUGdKU1lS?=
=?utf-8?B?OXU3N2ZsYnE0L04rUTRqd1JlTDF5MzFuMHR6YlhQTHZwU0tVU054Q2NUVllS?=
=?utf-8?B?TVZ2NVJNOENqcG1Fa1M5WnlYUWk1aDVYbTdGZ0JtTHRSWVZ3VXN1VkowM01w?=
=?utf-8?B?SjEzL1ZDQ0RWYiszb1hnek5CUFRjUVM3NURFR3dpY0ltNlpWQ2xEUjVhQ0xx?=
=?utf-8?B?cFl0RW5BeGphNUNnSEhYVWZvaHIwQzgvT2lnM3JjbDh5RmlPM0RtTU4zdkRj?=
=?utf-8?B?SWphWHJsbkFDdUhrS1U2cW5jeXNZRkFIc0FmMWNyYlZoaXhvK2lBSU9SR2J5?=
=?utf-8?B?K3AzRENvbXFNNytySCtFc3VJOFMrdEVCdFdkT1hPRGFxVjRvRzVsVFVjdG5q?=
=?utf-8?B?UjNVclRpZ0hYWENrdDFZZWhQKzFaNGFGTkFzWTNYRDR5Y0ExT2toejFLd1JU?=
=?utf-8?B?WE94YmM2MnBrMHJoVTBMeEJFSVpxK0NCMFBKNFFqR0JWTlVHTDIvd3pydEpX?=
=?utf-8?B?TGNmZFMreHloTFl3SG5PVUpDeGNKNjRCU1BPTkNpOTZkYzBUaHVEY1FVQnN2?=
=?utf-8?B?UUxBUnZmWUFUTFFrSllnVEtkVmZoL0dCT3hIKzJuNUV6TmRtQXJvOHRZdkFO?=
=?utf-8?B?RXpPcnJ5SC9Xak0vWjF5VnU2bzEwMmxjQlByZ0pRak90b3RQc0R4QTN0d2U1?=
=?utf-8?B?Q2l0YU1pYXBXUnBrK2tuaGN2KzFBRG1MejhIWmovcmFjWVpYdWdReW5HYW9M?=
=?utf-8?B?V3BGb2JJOVhLTXFzNW5iQ1AzenNjYzhDYUJBTXN6UlRlZmJ0eWUwRVg1aHZC?=
=?utf-8?B?cThSdkFsZnZvUVRpTnFadWsxeTh3N3V5RnNhL1hWVDhleVpRcVl0S0RMYlRC?=
=?utf-8?B?dDYwNmVHODNnZHBXdEk1Z3FuZUFESXJKSW1CbEg1ZGZtZGljZjRtOG1tRmo1?=
=?utf-8?B?MWpkMExZMjBXUm9yQS8rWVBsYnJYaE00Z0RJM2syL0l2ZW8zTFZKV0V4SGRQ?=
=?utf-8?B?TVJiMXdkdDVEd2JUbHBhSkNPUTg1eEdBMUlYM3VMSktla0NrNW41ZDI1YkUz?=
=?utf-8?B?bGRVZTFQSFdwNnZ4WjVBWDFocEcySVc0bEdaQ1dPVzNsSG5HcHQyL2ErWk9L?=
=?utf-8?B?d0RPOW82cmRHQ2xMamRKN2VJd1pSMS9BdThEcGp0bHF5UDhxUTRaQTBJdmw0?=
=?utf-8?Q?nY5LNDY66T4=3D?=
X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ2PR11MB7573.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ei9aMVhmd3RRRUZVTVlrY3pxRUtJZ0paL0lwUlFqM3Jrd2t4Um5xcEd1cjZq?=
=?utf-8?B?WXhxYXBKWTNDU2szNDJ6dlUybWNuM1hjRFFsWHBwek1ZbmY1Q08zMThVd2VU?=
=?utf-8?B?U1d3clFDeUduYndVS0xNRXdMditDYlM4YkczUTN4SC9URVJIU2NZczZIeGxn?=
=?utf-8?B?TjBCMTdGai9xSXpiM0R3cXZTWXZrVXZLNjBqTHc0VHcrcngyOEdKL3dhMkJj?=
=?utf-8?B?bTNSa0c1VmR2enBlMEczaEpuKzdsemVpR0p5andoMVdNcUtIN3YwK3pwWHM2?=
=?utf-8?B?WkpvU2JacUZxKzZ5VFNxanNhRC9lMExxTWNHdlZFR0lmWWQxQmdaMStTc2kx?=
=?utf-8?B?S3RDL3RPaHl3di8zc2djMU1KUEZCc0hPNHlBbjRSU01sK1BNT2RobDlTUXZI?=
=?utf-8?B?Mmg5VWpmaXA0MU9JNUVUR0hSOFZsUVNhZDZrWWI1MWhYR3J0TG1zcjlERnNQ?=
=?utf-8?B?L2JPa3ZHVnQ2cTQrYlJPZWpsQlY0TmZoVWpsdUp1MnZET0xGaFFNY0FRMGRh?=
=?utf-8?B?UjhzNlJ3K1loRXFaRGFQZzZCekNiaVBMdHZSQXFwYlp0eEZkLzV6cTQ3VlR6?=
=?utf-8?B?dEV1c2JNZG9MNnM0L3Zva1hJdnd5aWJNbjB6bXlwWUxRQWIybDhwUHpQcVVB?=
=?utf-8?B?M0F0VEFtRG9iaWU5bDVJa2k4dW5BZkNnM2lOd2Y0S3Jaekx3S251ckRSem01?=
=?utf-8?B?eHJlVzhzeEJwc2htSVIzcktwMkZNVGYwQmxFTmVyNmdERjUvTTNJSWtLNWlS?=
=?utf-8?B?Z0s5dmNFT05rLzBheFJORjcvZTU1TUNiMXNaYnhDbXdMZldKQWovQ0FpcWls?=
=?utf-8?B?enRZU3o1WFlPbUR0bmZTY2RRNDQwZUhOUFhZdnRZNk1LWFBGTnJ2U0hTYVRl?=
=?utf-8?B?STVVNWVBcmlpZUh0RE4wbW9DcmgxNW5GaG1sM21OSE8xdnMxTHJBS1ViZzBO?=
=?utf-8?B?ZGVzM3FLb0Y0aVJOcVR1Q1FPNitEVUM2bXFDWU9mQTRkQWV0YWFxdlBhQkhk?=
=?utf-8?B?cjF2MzUxcXEwcXJOUGxhM3JyeFBVRUFQem9ya3Bmcmt4VHg5WmFGMEtSRDZs?=
=?utf-8?B?cG81bmNmUjZvRmNXb0krS2QyNWZkWEJIbldxOEVzR2FSTnQxY25CLythSGZ5?=
=?utf-8?B?SWNBamJyY1ZmaTFlRFlBS29FWnpVd0lkS2ZBS3l4eGFxNzFDeFlwK3h0RzVz?=
=?utf-8?B?RHh0RDlzeGhmb0g3dUVOcTh2clR4eE9jZzQxZE5mSFlnYUtWU2ZCNDRValY4?=
=?utf-8?B?K2UzZnNla0haMzRVTnh4WXZERHIvVXlVRENEYXVOb01ENjlyRXZsODd0MEY5?=
=?utf-8?B?cUp4Rml4QkFJRGlWckQxWjJQN1ZpdlBYNkt5VmVPc0MvMVZRdVZLUmtiSk1P?=
=?utf-8?B?NGxKcjY4S2hLbWRZM2JTUUZhZGcrOTl0YnRvYzRqN0E2M0s0dE5zWjVjS0Q1?=
=?utf-8?B?ZWpxbEpjVTk3SXltWFUrdDBSWHZjMFRoUWFQTm5XL2JPVzBiMUZRTW03R2Jl?=
=?utf-8?B?bmJkK3hnN2hZMFJjWFZRL2tUaUpPWkhsdUlSZ1A5WHZYaFBlVkJ2SkdWMzF1?=
=?utf-8?B?R3VKc0xTUndGUXhwY0EwbkRsYnR3WTdOZUVLcGlKV2Fzc3RXUm9hTEsxYW1k?=
=?utf-8?B?UWZUemlJbGltaGVWQ25Ja0tiSXRXTDZ5UTVMcDQ3RXB1aXcrV2FjeEZwSjlH?=
=?utf-8?B?N3NSRDdPbmppZTNzRkFuRWlkWG1PTjZueEwxSzRaZnBOWUUvN3p5N0h2MWtu?=
=?utf-8?B?SHpNUDhGM1R5ZmFWMi9yT1FObUJ4N1FCcjZoMElJV0dkaU5VVHZYQ2lKTkdl?=
=?utf-8?B?VWZ5elExZ0xiTktNNjVmU21TaFVhcjcvM3RFdndkMFRHaHRYeGRweEFwdXB3?=
=?utf-8?B?ejh2VnYrZldLcXJUb25XZ0ZqL1VlaTV4UFJpanZ2Vy9rUEFtSEpzOHAwSEpx?=
=?utf-8?B?VUx4VDNqYkhQVVZlRTNGWDZjVkkvY1J5YlJ6TVBlN0ZDUm9mdmdONDh6QUsw?=
=?utf-8?B?L1VSb3Z5ZFJPZzN2YXA4a0UzYUsxUjZzcitvZ0JLUDNKZTBRdGx3OXRraTNQ?=
=?utf-8?B?bFlFRHBCdGEzVCtjeTNpTS9GTy9QNHFGelV6SnphT0NuVjgrWFVBVUZpeDFH?=
=?utf-8?B?VTU4ZmlsV2s0OVZKNGhzZDZIankvYnl2elVNOWdlUVJVNGJucE5DaDA1RWJv?=
=?utf-8?B?c0E9PQ==?=
X-MS-Exchange-CrossTenant-Network-Message-Id: ba3de644-5c01-4c3a-fbe4-08dda516d754
X-MS-Exchange-CrossTenant-AuthSource: SJ2PR11MB7573.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 16:26:07.8725
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: zWVZn+w4xeugiMT+hEVkgSQVxzKpjpubYCilTUJLtW0U3PQhbQduyskLpHB0GV6Q2HLm9vhsmVqYdTgz2+gE3pDatdMusnpe0KDbD6qNH0o=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH3PPFEC89C124F
X-OriginatorOrg: intel.com
X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

Hi Tony,

On 6/5/25 5:09 PM, Luck, Tony wrote:
> On Tue, Jun 03, 2025 at 09:15:02PM -0700, Reinette Chatre wrote:
>> Hi Tony,
>>
>> On 5/21/25 3:50 PM, Tony Luck wrote:
>>> Creation of all files in the resctrl file system is under control of
>>> the file system layer.
>>>
>>> But some resources may need to add a file to the info/{resource}
>>> directory for debug purposes.
>>>
>>> Add a new rdt_resource::info_file field for the resource to specify
>>> show() and/or write() operations. These will be called with the
>>> rdtgroup_mutex held.
>>>
>>> Architecture can note the file is only for debug using by setting
>>> the rftype::flags RFTYPE_DEBUG bit.
>>
>> This needs to change. This punches a crater through the separation
>> between fs and arch that we worked hard to achieve. Please make an attempt
>> to do so as I am sure you can.
>
> The file I want to create here amy only be of interest in debugging
> the telemetry h/w interface. So my next choice is debugfs.

I believe we can make either work but debugfs does indeed sound most
appropriate. I am not familiar with customs surrounding kernel support for
hardware debug interfaces though, so setting that aside for now.

>
> But creation of the debugfs "resctrl" directory is done by file
> system code and the debugfs_resctrl variable is only marked "extern" by
> fs/resctrl/internal.h, so currently not accessible to architecture code.

It would be best to stay this way.

>
> Is that a deliberate choice? Would it be OK to make that visible to
> architecture code to create files in /sys/kernel/debug/resctrl?

It should not be necessary to give an arch total control over
resctrl fs's debugfs.

>
> Or should I add my file in a new /sys/kernel/debug/x86/resctrl
> directory?

Since there is already a resctrl debugfs I think it will be less confusing
to keep all resctrl debug together within /sys/kernel/debug/resctrl.
There should be some bounds on what an arch can do here though.
There is already support for debugfs via the pseudo-locking
work where /sys/kernel/debug/resctrl contains directories with name
of resource group to provide debug for specific resource group. Giving
an arch total freedom on what can be created in /sys/kernel/debug/resctrl
thus runs the risk of exposing to corner cases where name of arch
debug cannot match resource group names and with ordering of these
directory creations it can become tricky.

With /sys/kernel/debug/resctrl potentially mirroring /sys/fs/resctrl to
support various debugging scenarios there may later be resource level
debugging for which a "/sys/kernel/debug/resctrl/info/<resource>/<debugfile>" can
be used. Considering this it looks to me as though one possible boundary could
be to isolate arch specific debug to, for example, a new directory named
"/sys/kernel/debug/resctrl/info/arch_debug_name_tbd/". By placing the
arch debug in a sub-directory named "info" it avoids collision with resource
group names with naming that also avoids collision with resource names since
all these names are controlled by resctrl fs.

To support this an architecture can request resctrl fs to create such directory
after resctrl_init() succeeds. Since it is custom to ignore errors for
debugfs dir creation the call is not expected to interfere with initialization
and existing arch initialization should not be impacted with this call
being after resctrl__init().

For example, for x86 it could be something like:

struct dentry *arch_priv_debug_fs_dir;

resctrl_arch_late_init(void) {

...
ret = resctrl_init();
if (ret) {
cpuhp_remove_state(state);
return ret;
}
rdt_online = state;

arch_priv_debug_fs_dir = resctrl_create_arch_debugfs(); /* all names up for improvement */
...

}

Note that the architecture does not pick the directory name.
On the resctrl fs side, resctrl_create_arch_debugfs() creates
"/sys/kernel/debug/resctrl/info/arch_debug_name_tbd", passing the
dentry back to the arch and with this gives the arch flexibility to create
new directories and files to match its debug requirements.
The arch has flexibility to manage the lifetimes of files/directories of
its debugfs area while resctrl fs still has the final control
with the debugfs_remove_recursive() of the top level /sys/kernel/debug/resctrl
on its exit.

What do you think?

It will need more work to support an arch-specific debug that is
connected to a resource or resource group, but this does not seem to be the
goal here. Even so, with a design like this it keeps the door open for
future resctrl fs and/or arch debug associated with resources and
resource groups.

Reinette


Return-Path: <linux-kernel+bounces-676028-lkml=lkml.rescloud.iu.edu@xxxxxxxxxxxxxxx>
X-Original-To: lkml@xxxxxxxxxxxxxxxxxxxx
Delivered-To: lkml@xxxxxxxxxxxxxxxxxxxx
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
by lkml.rescloud.iu.edu (Postfix) with ESMTPS id ECDD641E003FA
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 12:29:11 -0400 (EDT)
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by am.mirrors.kernel.org (Postfix) with ESMTPS id 3BDBF18927DF
for <lkml@xxxxxxxxxxxxxxxxxxxx>; Fri, 6 Jun 2025 16:29:23 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id BC156289E19;
Fri, 6 Jun 2025 16:28:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kmie6J7U"
Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A96ED1A38F9;
Fri, 6 Jun 2025 16:28:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1749227338; cv=none; b=ScwfA4CxTafmn6vWOiAZptvgqpb6BihVpoLR1HSIhCv1yjhP3Lfujdc4wEe2j9zK3l0JD9E2k+9zdGytdy2PiiEnQJMDLCEshGxkKTVJpq+juBdnTghAk+7fu1dmM7fz4NGjaQF1SP5I5wdK+sywU6EHY331DyIqp6/+3ABZkGw=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1749227338; c=relaxed/simple;
bh=lcZjw5NhrGSP8Fd/RXZZSsMKxRWJXSUvL3V+ujs52pw=;
h=From:To:Subject:Date:Message-Id:MIME-Version; b=SfHe0cDv2Le1DY21TytGigVnCMinoiUC8l93eEMlWS8sq+T80cuTt4RmvE958PTeQTUKr4xInw5vrJpV1cuc5SiPxBENlOAxLNorh2aLDa8nB8qKnaOX/XclKj4TNtLaxIwSBU0iCP8vYNsquf3VKkJt2fXxFfNR3E2zQj6Px8o=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kmie6J7U; arc=none smtp.client-ip=209.85.210.180
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-742af84818cso1728328b3a.1;
Fri, 06 Jun 2025 09:28:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1749227336; x=1749832136; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:to
:from:from:to:cc:subject:date:message-id:reply-to;
bh=QkuGPWcwShGZxELXQedLn34TZVaZiBOSzMW66deSoV4=;
b=kmie6J7UF/L+PF8IIRX2vEEIXOJtZ5eFpmByHscdTMUgVBNwmsPlLjvP459VC2oyOj
l1yXhiY/E2+C6+wOXoTr9lsKVdeT+oj/VcGoclGovUwlrOAJT4gdUK3uxqHMPnl8d5Uq
mAIrHiCQUpzMvF9HIbDea6hAF4H6QhMVPfmudbkGlnWkMnK6tHFOeM/58khl7Cr63G4I
PbwEzNThuouYifaUccAtv8uVkVZdiTmQJ6l4hUNfAN2czknXRovHjA1FLl7wE73DIUKR
u24gnhLTCSFImWouZjkJaYQYcD4z8kmW7ntUVV5F8rRk0DEQU1R3gOFCr+bT6kcPlRqr
/K8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1749227336; x=1749832136;
h=content-transfer-encoding:mime-version:message-id:date:subject:to
:from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=QkuGPWcwShGZxELXQedLn34TZVaZiBOSzMW66deSoV4=;
b=YKVGCS0+1dQSeexd0BP0bfi0sJZUlzhARSZL0WkLyioo75xpKlbPMiYPR4p3cBoIH6
9QtUGDpZKlf/bSAeUY/mOs975hKRC4mo7vaQEjaPvz7uWQkE51zyTNXtJIXc3VP0CFFk
Ep8tT5k7Qw5YNEBRRk86Xp8G0ayHThIeJ6NZkaEEyp0x0w3+yw59GVyoMs3fY9q+j+na
lARStsdJu+1BbA13F6KdNLJhaS3wQhYcG68PxX9D0SLRqTo9hl/8TXV7r2RrBlSLnMjX
lmElXONshpF+u2hDvGU3kZmXgPYcEJS2lDhNyB/4UnVNqUmCh4wtnf/ud1rMc5tRjQO5
VW7A==
X-Forwarded-Encrypted: i=1; AJvYcCUqdKkU9KVbeA+Vyg7YzBzlTiAQICfSqA6dPSYRdePIuBf+EQXg637y4tSlrULgqptYVDEunnPf@xxxxxxxxxxxxxxx, AJvYcCX4KS41t0L8z1r2Fz1fPqG4e6wGsbRNgBgfFcIcLJanMVddjehfY2ycrir8ehktxoCswY6njiIFooRhpFg=@vger.kernel.org
X-Gm-Message-State: AOJu0YyTXFSk8f+LkArsBh6ojlv/wwAT9XFnT5pde3rSUHgIqpIO1dNi
r8oYPQeUQ6DOdBffxp+RUCeUJc4YtThDsVhH/kp3kJ5xlJlzalN3mmJ4kKIkDw==
X-Gm-Gg: ASbGncsDX3ieOEVvtQp2CuCTPHZYfFl765MyBqpHksCzi+TGNi3H7R7b7c2k7D1gX39
cfv7kOKhN5IVNQPCf62+OmJk0PLNgrunIjEFJAxd5eZXwu/UT//eeKq0uAU1ZT7wZQeNHmiupLa
Y5okei3cCxoy5v52Ii0YhN+IVKwlIo8SsUKoCqxyHB634cbToI4UKP052wXbbm3OfkPrqHdOOm9
nOFjTVN9XX90jw0FT1WuZSDuJcTyt4pNkhWr2at31HXY+2nGfAthJo+VlmFdG30JGzqtnIZ3y5Y
HnbxPxFu8ST6678qeLID5IQW+zgtZ2bw5xtlbFwawGBkPGkscHHbxeHzX91TBhXnLyqB5RJcI74
sPogqWy7v1OpufJZw1/uU2ZhoHo/MMXxA6QB8LUXYFhxm
X-Google-Smtp-Source: AGHT+IH+metPkg/LraNFZUYfYpbf2anAcGQuwx6Lgl/tXUsyktwsOrhi6yQI+Pt7iLkFsIQYNIWtSg==
X-Received: by 2002:a05:6a20:a12c:b0:218:bcd3:6d2e with SMTP id adf61e73a8af0-21ee68a40e9mr6719638637.36.1749227335961;
Fri, 06 Jun 2025 09:28:55 -0700 (PDT)
Received: from localhost.localdomain (61-220-246-151.hinet-ip.hinet.net. [61.220.246.151])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7482fc43a1esm1105072b3a.38.2025.06.06.09.28.52
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 06 Jun 2025 09:28:55 -0700 (PDT)
From: Peter Yin <peteryin.openbmc@xxxxxxxxx>
To: Jeremy Kerr <jk@xxxxxxxxxxxxxxxxxxxx>,
Matt Johnston <matt@xxxxxxxxxxxxxxxxxxxx>,
"David S. Miller" <davem@xxxxxxxxxxxxx>,
Eric Dumazet <edumazet@xxxxxxxxxx>,
Jakub Kicinski <kuba@xxxxxxxxxx>,
Paolo Abeni <pabeni@xxxxxxxxxx>,
Simon Horman <horms@xxxxxxxxxx>,
Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>,
netdev@xxxxxxxxxxxxxxx,
linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH v1 1/1] mctp: fix mctp_dump_addrinfo due to unincremented ifindex
Date: Sat, 7 Jun 2025 00:26:50 +0800
Message-Id: <20250606162650.2063172-1-peteryin.openbmc@xxxxxxxxx>
X-Mailer: git-send-email 2.25.1
Precedence: bulk
X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,
SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lkml.rescloud.iu.edu

From: Peter Yin <peter.yin@xxxxxxxxxxxx>

The mctp_dump_addrinfo() function uses mcb->ifindex to track resume
progress when dumping MCTP device address information via netlink.
However, if mcb->ifindex is not updated after each iteration,
the dump restarts from the same net_device repeatedly, resulting
in an infinite loop.

This patch updates mcb->ifindex to dev->ifindex + 1 after
a successful call to mctp_dump_dev_addrinfo(), ensuring that
subsequent dump callbacks resume from the correct device.

This fixes the netlink dump hang observed during sequential
`ip mctp addr show` or similar operations.

Fixes: 2d20773 ("mctp: no longer rely on net->dev_index_head[]")
Signed-off-by: Peter Yin <peteryin.openbmc@xxxxxxxxx>
---
net/mctp/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mctp/device.c b/net/mctp/device.c
index 4d404edd7446..ddde938c7123 100644
--- a/net/mctp/device.c
+++ b/net/mctp/device.c
@@ -142,9 +142,9 @@ static int mctp_dump_addrinfo(struct sk_buff *skb, struct netlink_callback *cb)
if (rc < 0)
break;
mcb->a_idx = 0;
+ mcb->ifindex = dev->ifindex+1;
}
rcu_read_unlock();
-
return skb->len;
}

--
2.25.1