From nobody Mon Dec 1 21:33:25 2025 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 E2A3430FC2C for ; Mon, 1 Dec 2025 12:43:34 +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=1764593016; cv=none; b=acmsEe2IBaBipGdhy4s1wSdZNYmDvcoCEx9YrLmewn+UjrHkJRTQ/Dl88AwX31PSs6fqHk09gfKKBIq1HrFbt+5AOAyzPL/qLIzItr6RyWAW4l9Ob4HJ7ri79hMpT7kJ98CgeYk6fTJ5erpw5VpcMdR6qoctFRZsVCy6kfbpVaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764593016; c=relaxed/simple; bh=O1bfb49f81nWjSwl16Z6OQyKyPquLUwL1wCzDbmKlZQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k/Gbyp6mD6MOpprCXhUSliLJ6hZjuz0CE+n9vHr261wzSMf45wpysAy0+hXzGGqHxElBpPjitts3fGHFH7i58kBhKYsA4GNIo7IwpxXRNUXX1Rt6cGS4GoIT+6PEWZN1kwGvhD4tyinmeky88DhsKtMS5VTqYvQKxg5scPpJ5s8= 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=jmGcLuQj; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=bLlraItj; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="jmGcLuQj"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="bLlraItj" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B19MEHU3362428 for ; Mon, 1 Dec 2025 12:43:34 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= YC6FU3llCYxXh4VP04XbK7i9763mHcc9u/o//Iu96T4=; b=jmGcLuQjx1kSOQH8 znVK1DJ4FY7Ci3owB8HJ6D2/pr8V281Yz1rCRbBrV2Wwk8ACe/Dc0ecc1XTa/yfQ qym6y+ByyrSi6k26VkLVYCp5FiHut7QKKR/Gi8xqmnubfwpuX86qUuoaZbhrS6t+ +qmG6VfiIMvR8cFDX2EN6GSLIut0wO105sE12uxhad+lQKSRQABpBYPb4ZFa0GlT C4tFosIk3SsU7ljWUXllkYcKmvpSUd6CXq476tsEg2z0hsY2IjTSYmalJD+VllcX EpExd0XSH8AJzeKCvRP07ilxzjB7XGfYlwxcJXvTVLApdMUx2hXnrlDp0fazZyuP LCSW0g== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4as8b00j6v-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 01 Dec 2025 12:43:34 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-343806688cbso7928055a91.3 for ; Mon, 01 Dec 2025 04:43:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764593013; x=1765197813; 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=YC6FU3llCYxXh4VP04XbK7i9763mHcc9u/o//Iu96T4=; b=bLlraItj2P55/yiHytR5LwtMF06M5dAxheMLxJhESbzm1jtJX1wleBt/TqWkOGA0lB AFes89kdare6we/B/Bb+z/y6XWH7At1khP+v2xGMm9+K6Yom1eRNaHzSdzWQVu/T+QAm HJRdZP3fyK/33QmpN0z23rfnBh5Uakv3QfsuHJBoR1afL3k+c3NA8e1r24u5oOqqnHe/ SrmocA+0szUwhjqTSZyp0KBGq7eAqgb5xQNc3clHMWKT3gU9kboc0qJABEfosx6YFEZr pMNLCSs2NGS+bvcwXdSuTICGVCBT2gfglgQLarAqRZWG4G5689EU4YMYWsWRLd4el3g8 1dGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764593013; x=1765197813; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=YC6FU3llCYxXh4VP04XbK7i9763mHcc9u/o//Iu96T4=; b=s4zlJwXFdIEXz8V60/issypd2ipDT0DsJKFoDhLg5YvzWLp+k5ID56Y1al3/x15qUz LY/UNY/fU/vnWE5OAGZ5bdWgLn6r9kf46Pl5XBA6rtFNYNTtLQMaQoeDuVlRb/lY4d8p i+hWr/7s0Zb3HexvmQeKpgOIRfpM4G9ICcZM1mcqIt/x+IQwG5uO84IM/uk79z5ati0Z m5FSO5P9+NcH07YAlYPOxD1G2+X4hNpS/pgRDlxgRofB6V6zfJvSpex68/NNhnImqrGl W1eXkMyAb9ccPT3SUYBkYj9ETSbCl2R3DkCLFm73N1s5U4PBB+I/iOzQUTdVVWdaFboW dPXQ== X-Forwarded-Encrypted: i=1; AJvYcCXiAXNprejA6rKryLaJ+g67erCzfuKI5hZbEEvZd9nmFKOfd3ir6Ww5d7OSEpNNdeE4w6IEh6v+zwKUhxg=@vger.kernel.org X-Gm-Message-State: AOJu0YwcW+wVLwUdxvr9uiTnUXHWIoozPM0wqQQXdBbEKW0VXP6ie55p Ki4GFzTJR5d+CSGnHn5aClWJO6DwJ+O3RWTm+0GQxup1MJHPUez5mbi/fYWxtfKYccTg7KYrmhO eQvzIi3CFvBG1sqmg7x6+zX+UNZCBzcmKwcIJAxyW+VZ3dMnE65ay0NhofdD68LWkvy4= X-Gm-Gg: ASbGncsT1AMtQrUr/PCcwSFl6XW1RJgWJBQklmlQdn6UAK0DEAQSGwCernzrBJwnvP6 uXwzkWpumFjqXi5pTYL+68Jm7Ti3KPC7VMENW2wnkAJzGVeZJvmcAP6fXtcACRl3AN3XU3zWALZ mQ7s28tUdmCw7lkWV6/hdp4P4sbgl0zIcHFR6R5UwAOuN2y4G+VPwd8vfMbY8J9z6n3DMX6KDYd dX9ei3C3pj6lu+wsJHD0iwaHyy0C8Vbo6eQY6WzKaGOakbeJJjURmv3QgRYARAcKGnl+FAXvQpR Dx6TZ47dXLTCLRbo+hm84bMBRJqKF3r3G6NrQ+5OQ9tAAQ5d6NJuJqIL0mm8JYhAl5tAOOy6/2c MsEErmmrBNQA7SZtmWbMqSSXcJrvdwjs7O6ZYiAe8i1hb X-Received: by 2002:a17:90b:57cf:b0:340:5c27:a096 with SMTP id 98e67ed59e1d1-34733e55262mr35348007a91.6.1764593013380; Mon, 01 Dec 2025 04:43:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IElgDjDJHW2YDf+PAwc9iRI3ntCUsGwfUffpxrfbB3ePkiBM/khpNTD20UCrGFmP3x4X6p7TA== X-Received: by 2002:a17:90b:57cf:b0:340:5c27:a096 with SMTP id 98e67ed59e1d1-34733e55262mr35347954a91.6.1764593012680; Mon, 01 Dec 2025 04:43:32 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3477b733381sm13146374a91.12.2025.12.01.04.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 04:43:32 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 01 Dec 2025 18:13:17 +0530 Subject: [PATCH 1/4] bus: mhi: Replace controller runtime_get/put callbacks with direct PM runtime APIs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-mhi_runtimepm-v1-1-fab94399ca75@oss.qualcomm.com> References: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> In-Reply-To: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Jeff Johnson , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, netdev@vger.kernel.org, mayank.rana@oss.qualcomm.com, quic_vbadigan@quicinc.com, vivek.pernamitta@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764593001; l=4834; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=O1bfb49f81nWjSwl16Z6OQyKyPquLUwL1wCzDbmKlZQ=; b=yLM+3VZeO3i0vzTYNib15uacoRstISgcmAjNZBsE2uImwB5USfI0sbF6aT/yYbSsn9pqrY/4E WgFlDNvcU6+DI+bVnaoIPTkVXI/EG9ShgxobuhrFdniiGsg71jFlRYz X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=TcKbdBQh c=1 sm=1 tr=0 ts=692d8d76 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=-vyvwYMTLgQEoxk1dJgA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-ORIG-GUID: EmBhdlwN2QC4DpXsioiT5o7vuRJTo3HN X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAxMDEwMyBTYWx0ZWRfX4JgKK9QY9RWU ddYOG6q3pWh6A2/WnUGH4HkoVMkE7uQ3brv6k1r3yq/6slkDinsSyKvhp1qAKgNri9hZ+8hk+L5 Vy/xecpyEHIR27EnFH038C98r8f95pFO7nDoc1jbRQA85mFvOsn15DE8T/Yosd9Gm4dXUz/FTQB h4oGGsPU0Xpi0I6d7sXIzfC74KmMdaepOZQiFdtvILPSGb3E+m7zwP9RX1pg9kYPRAkdNwnF4S8 m28QNX+Rts+b7j8OH5HF5uEq9pNJNN9blEZuTPMMdXJwBqbfFRJbzXT0TjSdR7qW9jORW59mz2Q bEak6qq43CEFm+oZ1p7dmmEBl1P8cui6WldF3dN07aWFtoYaltz71snpKwLFZnq/8N8oqsIK2bU do1yXzlpW63ivvFpxFY/1EJtGW961g== X-Proofpoint-GUID: EmBhdlwN2QC4DpXsioiT5o7vuRJTo3HN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-28_08,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 malwarescore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512010103 Replace usage of runtime_get() and runtime_put() function pointers in the MHI core with direct calls to the pm_runtime APIs. As the controller drivers were not doing more than calling the PM runtime APIs in these callbacks. This refactoring simplifies the runtime PM handling and removes the need for drivers to provide no-op or duplicate implementations of these ops. Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/init.c | 1 - drivers/bus/mhi/host/internal.h | 7 +++++-- drivers/bus/mhi/host/main.c | 19 ++++++++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c index 099be8dd190078af4ca12cd7a1de739572feca9d..5b22808fd543f9febcaa9ea6231= 01d2d5d05b040 100644 --- a/drivers/bus/mhi/host/init.c +++ b/drivers/bus/mhi/host/init.c @@ -938,7 +938,6 @@ int mhi_register_controller(struct mhi_controller *mhi_= cntrl, int ret, i; =20 if (!mhi_cntrl || !mhi_cntrl->cntrl_dev || !mhi_cntrl->regs || - !mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put || !mhi_cntrl->status_cb || !mhi_cntrl->read_reg || !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs || !mhi_cntrl->irq || !mhi_cntrl->reg_len) diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/interna= l.h index 7937bb1f742ca8033c17a01f5cffbf103330f51f..61e03298e898e6dd02d2a977cdd= c4c87b21e3a6c 100644 --- a/drivers/bus/mhi/host/internal.h +++ b/drivers/bus/mhi/host/internal.h @@ -7,6 +7,8 @@ #ifndef _MHI_INT_H #define _MHI_INT_H =20 +#include + #include "../common.h" =20 extern const struct bus_type mhi_bus_type; @@ -353,8 +355,9 @@ static inline bool mhi_is_active(struct mhi_controller = *mhi_cntrl) static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl) { pm_wakeup_event(&mhi_cntrl->mhi_dev->dev, 0); - mhi_cntrl->runtime_get(mhi_cntrl); - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_get(mhi_cntrl->cntrl_dev); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); } =20 /* Register access methods */ diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index 8615512743199a59a58c3756d9cc3407079cee7e..7ac1162a0a81ae11245a2bbd9bf= 6fd6c0f86fbc1 100644 --- a/drivers/bus/mhi/host/main.c +++ b/drivers/bus/mhi/host/main.c @@ -661,7 +661,8 @@ static int parse_xfer_event(struct mhi_controller *mhi_= cntrl, if (mhi_chan->dir =3D=3D DMA_TO_DEVICE) { atomic_dec(&mhi_cntrl->pending_pkts); /* Release the reference got from mhi_queue() */ - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); } =20 /* @@ -1155,7 +1156,7 @@ static int mhi_queue(struct mhi_device *mhi_dev, stru= ct mhi_buf_info *buf_info, * for host->device buffer, balanced put is done on buffer completion * for device->host buffer, balanced put is after ringing the DB */ - mhi_cntrl->runtime_get(mhi_cntrl); + pm_runtime_get(mhi_cntrl->cntrl_dev); =20 /* Assert dev_wake (to exit/prevent M1/M2)*/ mhi_cntrl->wake_toggle(mhi_cntrl); @@ -1166,8 +1167,10 @@ static int mhi_queue(struct mhi_device *mhi_dev, str= uct mhi_buf_info *buf_info, if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) mhi_ring_chan_db(mhi_cntrl, mhi_chan); =20 - if (dir =3D=3D DMA_FROM_DEVICE) - mhi_cntrl->runtime_put(mhi_cntrl); + if (dir =3D=3D DMA_FROM_DEVICE) { + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); + } =20 read_unlock_irqrestore(&mhi_cntrl->pm_lock, flags); =20 @@ -1374,7 +1377,7 @@ static int mhi_update_channel_state(struct mhi_contro= ller *mhi_cntrl, ret =3D mhi_device_get_sync(mhi_cntrl->mhi_dev); if (ret) return ret; - mhi_cntrl->runtime_get(mhi_cntrl); + pm_runtime_get(mhi_cntrl->cntrl_dev); =20 reinit_completion(&mhi_chan->completion); ret =3D mhi_send_cmd(mhi_cntrl, mhi_chan, cmd); @@ -1405,7 +1408,8 @@ static int mhi_update_channel_state(struct mhi_contro= ller *mhi_cntrl, =20 trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, TPS("Updated= ")); exit_channel_update: - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); mhi_device_put(mhi_cntrl->mhi_dev); =20 return ret; @@ -1591,7 +1595,8 @@ static void mhi_reset_data_chan(struct mhi_controller= *mhi_cntrl, if (mhi_chan->dir =3D=3D DMA_TO_DEVICE) { atomic_dec(&mhi_cntrl->pending_pkts); /* Release the reference got from mhi_queue() */ - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); } =20 if (!buf_info->pre_mapped) --=20 2.34.1 From nobody Mon Dec 1 21:33:25 2025 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 D2A9831A7F6 for ; Mon, 1 Dec 2025 12:43: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=1764593022; cv=none; b=uXLHO1M9NY1zvXV0rH2R6JEfqkLga8vndz28NuyOKJbKxDhpSvP/DqcwiWuehgKA4MutFysMID5AziP55R3HBnaqRCyqXlkb00/3Vu/ny5ZWgAXZ8Frg9UfEEqbTpoKgEueNg82wRqQgbqdsQJxdXB8NQKmJKnJ49WQue0eXBqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764593022; c=relaxed/simple; bh=qc/vuexUJiBX8btbCsHgZ8uF0KFcot3K2uoQmn9qVn0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qq1m/Kr8PvZzkqcw3XcQa/3jF2G4Y+7CyRVI5I+OfA3YqUbvaZzs2a9j9u10YB6OP56kRcRMQgPkwuQ0rLqSjiRYdcWnnsXJTQDznjz+dlCEFyCS7XnszqiYplkweao+HzGs7S+N6+gXM1bP/mQGHWTCEzhi1qidP9XTgqYtYG4= 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=I6zc93mW; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UisuwfSk; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="I6zc93mW"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UisuwfSk" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B1BKEAW106828 for ; Mon, 1 Dec 2025 12:43:40 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= Kclx5aUfeE0Z1tsnWaGEfHCQHdHWqYTUl99Q34R7qJQ=; b=I6zc93mWd5fswOHV lqDPNAcYqJxYDl8xH7Q/SZTt9MQnpXAiuF4czJAafkqRhn15JD/pX8QinQcqfylq waUWqeUAbQuIkf4x+ANpKK/hc0uhdKmmQ1BlDRFNQQhHGjd6HYjU2PWJ1V8Y9GFN bKJYS28MZbLvH7aopGPNfi7HlGH+1NWetyFOpzXkIXFg/DyZXCVWQfagsjsv7mwH HyjpXpJQHUmSYiHumvOL5OITht3IzNsvp3s1cyfVIL6Kn75rKjWgsZKRTvOSZDhC Jt4GbpWZ9bx0SqbtXz2+tU0s4WHCoEG5x4JhPjFGEdQl2DejYObna4JHEMUagKN7 aVH5cQ== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4asa2386j6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 01 Dec 2025 12:43:39 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-3436d81a532so6453913a91.3 for ; Mon, 01 Dec 2025 04:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764593019; x=1765197819; 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=Kclx5aUfeE0Z1tsnWaGEfHCQHdHWqYTUl99Q34R7qJQ=; b=UisuwfSk8N39AnRTUauQdPf+hekXHetLx83sZJKs/aQ5KWC1ZizP5yvvck9ErcV23t HWOOTws0yKjX9M8fwngWrnvgf1SgB+Yt8DvYdf+JHm5vMXJa4aUEPetEEbGNVDXLJUpI k4Xtj7T36JkVYpCKs5sbyIrycZezpkjof+oA6HZ6dbqzImFkbWVJoB0l3yfOjrM2atd7 d8bjta3eDupbmksX0GwkWHaIvZdApUBN6sKRQb+p2nmVae8cBAMYm5dVqYGMRG8K2sXk k9dOUCWDhOOeINxcCMWDZx7nP+KlA7rJzb0A2KiuFPYjoYJ/w0rIM0MRu3N7Z3Ntgc9m OTlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764593019; x=1765197819; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Kclx5aUfeE0Z1tsnWaGEfHCQHdHWqYTUl99Q34R7qJQ=; b=OLVWlOB8r/J5W6ovTucuuz1/SoHHP7X9wvVNUZS7pmXuIfCSbOVjgBl83ClBrXgQ7j I9BEHJ28+sD9vFtuQHWE+obfSK/k/8L5MRR0wqmBUV9Z9PBGtOC2FkmbqSxFKAh3+VG0 +DAJv7LRqfLon+YXLrpcabNZ71nu91wJub2eJ2/ONKOiwUw8un68H2pNNMnim11Mb9Em FzTgp29PHEYJ50MdbVPDFrqcWNipDmLPTCl5fYEUtYQdhQ1ThTyn3xeygOC40W5Ht2Gu baBLwit/NpxyzGV2kW8dfgNy1Vb1vVWdwWPQd1xVsZkVhc4aGwWm9hpPhEIxAHNs0ZFc Cckg== X-Forwarded-Encrypted: i=1; AJvYcCUQJia2xhKzmTotLCGmK0qjUsunmlCoYg1iocBBJ9vJvuO7bDVFdAbmVSBdNtWWpDD9TUUZs9tNyJMprWk=@vger.kernel.org X-Gm-Message-State: AOJu0YygovzXXnxKl3Mhq4QD3pRSwmQBRDt8wIxe43nizTztsD0oGzoD kmo9iAjOGFC2EeTPUOuoCaNwPAuIaxQtPvbNEXhJVuxP3s37flezhohaPOw5gj5R/Wx8lsGoqJ7 R3cDGa1/jbcXJERZVmIdlKtnXsAI5jFC6Dpn40L/VuJ884+wtRNcRPZJv48FqBZWnsLg= X-Gm-Gg: ASbGnctJ3FCmu0MV3G69g/mfSXPyC9N5kCv6k4rWO/78zhKoosVl3x4f/0kw/eu0CYH 5G88Z7e/HyZD/Qpyga5ojXQo8TkuyYqXqakfJVBuaWvP3ErEvf0C8hQxLJXSKEajYaSDfbAkl7f Vq1pwv25ncugJg1swpdFCVMYalNdh8cVINKO1KESjeT+eu6ncPikVr6IK5Busih77asCe6Byqrm mJ5+2HrFYKxxdczTTA1x1URIKk27+dfgs/7XY0IloQTi4Wa7CSrSOOlHlNcfR0U3Wo1BFSxQ8ZT GYPpyxilwhq1vD4oGdCY80PChmFCOxmnX+mMLq1QPhqY7EmiPQavI37+qY3hAORAu1dCkMaUYkt JCFci4rOxcp04hDYNufYxPHnxYlhioWqD6tS4dgsUCxc6 X-Received: by 2002:a17:90b:2ecc:b0:32e:a10b:ce33 with SMTP id 98e67ed59e1d1-34733f306dbmr34662141a91.21.1764593019147; Mon, 01 Dec 2025 04:43:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpXToaAAMg9liEGygMd9CVV6y8KmXhe059ugemu/KQs6zGoiCMjUmEU//RbcblAKyJubsVfQ== X-Received: by 2002:a17:90b:2ecc:b0:32e:a10b:ce33 with SMTP id 98e67ed59e1d1-34733f306dbmr34662105a91.21.1764593018601; Mon, 01 Dec 2025 04:43:38 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3477b733381sm13146374a91.12.2025.12.01.04.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 04:43:38 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 01 Dec 2025 18:13:18 +0530 Subject: [PATCH 2/4] bus: mhi: Remove runtime PM callback ops from controller interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-mhi_runtimepm-v1-2-fab94399ca75@oss.qualcomm.com> References: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> In-Reply-To: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Jeff Johnson , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, netdev@vger.kernel.org, mayank.rana@oss.qualcomm.com, quic_vbadigan@quicinc.com, vivek.pernamitta@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764593001; l=7478; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=qc/vuexUJiBX8btbCsHgZ8uF0KFcot3K2uoQmn9qVn0=; b=6l4fcR7xQsfD87W6Fc04RoQBbA2SzZ/GlJtlqPacx2CneievN+IL0leOfp+hR7nAD5fUmwjYV FDDouGZK2jiCqWFWVNFQlM4lAUiXDyceAJMa2CouaPe6wk/Ad2TOcSI X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=dOurWeZb c=1 sm=1 tr=0 ts=692d8d7c cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=UDtOtXLn3dyDcuLNbMIA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-GUID: guRVWPVqzABFDQmnROZGXAebfej0NFFW X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAxMDEwMyBTYWx0ZWRfX/uU+8Wx0RSIJ ZHLfcyS+joDHNzdxB+25+P322iIHO3MpewAS1euTXiX9vUyIfAV0Lla+f3ps1n6QvqXpIvMk/jU 6Qc7THH4d00CtapcVFBxHDLuSAV6BwK3VKWsJGfyvVcDXXuE4VvdYqS9VcskhlhGg8GA8YSLxu3 V9SLHEFROHRyEgfOwGqOFwhchY7BIHxDF2LAtwMLdaT4DMJURfuk8/rjmK9LjFTsWJyFS4k53bc 4RMOgfg2XYIWWuGBxv8G0D9HeVFbi5tulo37KxDDawZBMD3scOdzxuYAJH/jvVBRlHcFBynHACJ oIxE912/bdqvxj4H4YpTG9SV4sr6KoQ6BcZ7pzPscikAZNI8McDpO5L8wyv2brCif4HhviPqBYr lyalR0ojMS7k3lwrNaFzL0MF49R+cg== X-Proofpoint-ORIG-GUID: guRVWPVqzABFDQmnROZGXAebfej0NFFW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-28_08,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 adultscore=0 phishscore=0 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512010103 Remove the runtime_get and runtime_put function pointers from the struct mhi_controller interface and all associated usage across the MHI host stack. These callbacks were previously required by MHI drivers to abstract runtime PM handling, but are now redundant. The MHI core has been updated to directly use standard pm_runtime_* APIs, eliminating the need for driver-specific indirection. Signed-off-by: Krishna Chaitanya Chundru --- drivers/accel/qaic/mhi_controller.c | 11 ----------- drivers/bus/mhi/host/pci_generic.c | 24 +++--------------------- drivers/net/wireless/ath/ath11k/mhi.c | 10 ---------- drivers/net/wireless/ath/ath12k/mhi.c | 11 ----------- include/linux/mhi.h | 4 ---- 5 files changed, 3 insertions(+), 57 deletions(-) diff --git a/drivers/accel/qaic/mhi_controller.c b/drivers/accel/qaic/mhi_c= ontroller.c index 13a14c6c61689fa4af47dade6d62b3cb1a148354..319344be658b38656f6e85e92be= 4b5473f43c897 100644 --- a/drivers/accel/qaic/mhi_controller.c +++ b/drivers/accel/qaic/mhi_controller.c @@ -820,15 +820,6 @@ static void mhi_write_reg(struct mhi_controller *mhi_c= ntrl, void __iomem *addr, writel_relaxed(val, addr); } =20 -static int mhi_runtime_get(struct mhi_controller *mhi_cntrl) -{ - return 0; -} - -static void mhi_runtime_put(struct mhi_controller *mhi_cntrl) -{ -} - static void mhi_status_cb(struct mhi_controller *mhi_cntrl, enum mhi_callb= ack reason) { struct qaic_device *qdev =3D pci_get_drvdata(to_pci_dev(mhi_cntrl->cntrl_= dev)); @@ -889,8 +880,6 @@ struct mhi_controller *qaic_mhi_register_controller(str= uct pci_dev *pci_dev, voi mhi_cntrl->iova_start =3D 0; mhi_cntrl->iova_stop =3D PHYS_ADDR_MAX - 1; mhi_cntrl->status_cb =3D mhi_status_cb; - mhi_cntrl->runtime_get =3D mhi_runtime_get; - mhi_cntrl->runtime_put =3D mhi_runtime_put; mhi_cntrl->read_reg =3D mhi_read_reg; mhi_cntrl->write_reg =3D mhi_write_reg; mhi_cntrl->regs =3D mhi_bar; diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_= generic.c index b188bbf7de042d8b9aa0dde1217d2c86558c3caf..7036b1654c550a79e53fb449b94= 4d67b68aad677 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -1173,23 +1173,6 @@ static int mhi_pci_get_irqs(struct mhi_controller *m= hi_cntrl, return 0; } =20 -static int mhi_pci_runtime_get(struct mhi_controller *mhi_cntrl) -{ - /* The runtime_get() MHI callback means: - * Do whatever is requested to leave M3. - */ - return pm_runtime_get(mhi_cntrl->cntrl_dev); -} - -static void mhi_pci_runtime_put(struct mhi_controller *mhi_cntrl) -{ - /* The runtime_put() MHI callback means: - * Device can be moved in M3 state. - */ - pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); - pm_runtime_put(mhi_cntrl->cntrl_dev); -} - static void mhi_pci_recovery_work(struct work_struct *work) { struct mhi_pci_device *mhi_pdev =3D container_of(work, struct mhi_pci_dev= ice, @@ -1277,7 +1260,7 @@ static int mhi_pci_generic_edl_trigger(struct mhi_con= troller *mhi_cntrl) } =20 pm_wakeup_event(&mhi_cntrl->mhi_dev->dev, 0); - mhi_cntrl->runtime_get(mhi_cntrl); + pm_runtime_get(mhi_cntrl->cntrl_dev); =20 ret =3D mhi_get_channel_doorbell_offset(mhi_cntrl, &val); if (ret) @@ -1291,7 +1274,8 @@ static int mhi_pci_generic_edl_trigger(struct mhi_con= troller *mhi_cntrl) mhi_soc_reset(mhi_cntrl); =20 err_get_chdb: - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); mhi_device_put(mhi_cntrl->mhi_dev); =20 return ret; @@ -1338,8 +1322,6 @@ static int mhi_pci_probe(struct pci_dev *pdev, const = struct pci_device_id *id) mhi_cntrl->read_reg =3D mhi_pci_read_reg; mhi_cntrl->write_reg =3D mhi_pci_write_reg; mhi_cntrl->status_cb =3D mhi_pci_status_cb; - mhi_cntrl->runtime_get =3D mhi_pci_runtime_get; - mhi_cntrl->runtime_put =3D mhi_pci_runtime_put; mhi_cntrl->mru =3D info->mru_default; mhi_cntrl->name =3D info->name; =20 diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/a= th/ath11k/mhi.c index acd76e9392d31192aca6776319ef0829a1c69628..18bac9e4bc35bffabef05171b88= bd5515e7df925 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -230,14 +230,6 @@ static int ath11k_mhi_get_msi(struct ath11k_pci *ab_pc= i) return 0; } =20 -static int ath11k_mhi_op_runtime_get(struct mhi_controller *mhi_cntrl) -{ - return 0; -} - -static void ath11k_mhi_op_runtime_put(struct mhi_controller *mhi_cntrl) -{ -} =20 static char *ath11k_mhi_op_callback_to_str(enum mhi_callback reason) { @@ -384,8 +376,6 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) mhi_ctrl->sbl_size =3D SZ_512K; mhi_ctrl->seg_len =3D SZ_512K; mhi_ctrl->fbc_download =3D true; - mhi_ctrl->runtime_get =3D ath11k_mhi_op_runtime_get; - mhi_ctrl->runtime_put =3D ath11k_mhi_op_runtime_put; mhi_ctrl->status_cb =3D ath11k_mhi_op_status_cb; mhi_ctrl->read_reg =3D ath11k_mhi_op_read_reg; mhi_ctrl->write_reg =3D ath11k_mhi_op_write_reg; diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/a= th/ath12k/mhi.c index 08f44baf182a5e34651e8c117fe279942f8ad8f4..99d8d9a8944cefa2561cd47d83b= beb53ef13044d 100644 --- a/drivers/net/wireless/ath/ath12k/mhi.c +++ b/drivers/net/wireless/ath/ath12k/mhi.c @@ -230,15 +230,6 @@ static int ath12k_mhi_get_msi(struct ath12k_pci *ab_pc= i) return 0; } =20 -static int ath12k_mhi_op_runtime_get(struct mhi_controller *mhi_cntrl) -{ - return 0; -} - -static void ath12k_mhi_op_runtime_put(struct mhi_controller *mhi_cntrl) -{ -} - static char *ath12k_mhi_op_callback_to_str(enum mhi_callback reason) { switch (reason) { @@ -386,8 +377,6 @@ int ath12k_mhi_register(struct ath12k_pci *ab_pci) mhi_ctrl->sbl_size =3D SZ_512K; mhi_ctrl->seg_len =3D SZ_512K; mhi_ctrl->fbc_download =3D true; - mhi_ctrl->runtime_get =3D ath12k_mhi_op_runtime_get; - mhi_ctrl->runtime_put =3D ath12k_mhi_op_runtime_put; mhi_ctrl->status_cb =3D ath12k_mhi_op_status_cb; mhi_ctrl->read_reg =3D ath12k_mhi_op_read_reg; mhi_ctrl->write_reg =3D ath12k_mhi_op_write_reg; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index dd372b0123a6da5107b807ff8fe940c567eb2030..312e5c4b9cf8a46ffb20e2afc70= 441a11ecf659c 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -347,8 +347,6 @@ struct mhi_controller_config { * @wake_get: CB function to assert device wake (optional) * @wake_put: CB function to de-assert device wake (optional) * @wake_toggle: CB function to assert and de-assert device wake (optional) - * @runtime_get: CB function to controller runtime resume (required) - * @runtime_put: CB function to decrement pm usage (required) * @map_single: CB function to create TRE buffer * @unmap_single: CB function to destroy TRE buffer * @read_reg: Read a MHI register via the physical link (required) @@ -427,8 +425,6 @@ struct mhi_controller { void (*wake_get)(struct mhi_controller *mhi_cntrl, bool override); void (*wake_put)(struct mhi_controller *mhi_cntrl, bool override); void (*wake_toggle)(struct mhi_controller *mhi_cntrl); - int (*runtime_get)(struct mhi_controller *mhi_cntrl); - void (*runtime_put)(struct mhi_controller *mhi_cntrl); int (*map_single)(struct mhi_controller *mhi_cntrl, struct mhi_buf_info *buf); void (*unmap_single)(struct mhi_controller *mhi_cntrl, --=20 2.34.1 From nobody Mon Dec 1 21:33:25 2025 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 ACFFB31B817 for ; Mon, 1 Dec 2025 12:43:46 +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=1764593028; cv=none; b=Q7NUeuopIfZIDu0dAiy2JC5U8V1MyiEOoAdMXV5YED7PQCS5RrYxNNgUzg0Wa6tGwkaQhwKvxrf0EpQeucRBZsljLxq1a+xvBjJ50znw2CyB9dFVW9rlCu8jFPxbLHP7qbEt17nu0NmSHRNM7VE0efl+XEj2V0j0jmCl11y/CS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764593028; c=relaxed/simple; bh=rbqwP2YI4CzGHgLkC6DPKf/HhJhVBMMGwEXYBUIoF6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OjrGtB0lzne677vbUkNsZwEYnbcXVNXfc5GcT1LFc1T7A2WuYHPr8DCp3KmH5QfgoXOv0XpHXc+BlMmqEHvRu9IIGh3qErcfh3/3dC8XpDx2VZoo15nLwuhT+gP79vsfW94gdw+9Ld7fyjGBC3d9GhGkPemeQOdy+Q5NYjEWkWA= 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=XR1PcdKX; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ePDStvoo; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="XR1PcdKX"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ePDStvoo" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B19MN1w3362623 for ; Mon, 1 Dec 2025 12:43:46 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= fpnTx2DCpn5NW+7UCBeMn/SqdtMDI0Y8uRPDmg+UDbk=; b=XR1PcdKXJkx1y7lP 1hl+9CzAqtSL+e2kFxF9sah35MGnmVSLivazrLvPrWo8zhkg7+7F3Yc0qBvAdw0D 0Rcx9XHoC33Q8YGhzsSr2ctUULz9VLVFpwG90cz3XFjuC08JTXw8+X8F//dQ6yUO EUI8HizI6XGSjaSydbEGKq/bfDn3etKvt+Y+kjdW42c124s11HPFXwt3c/iPxi9v LpGNA6GsTRNY+gUhwKKygIq+XJRpipG6W8++QY32QNS9U9UR5SeZ5Mud0gWSY+9U 3IzOsDms4kTgtONn4rgbYXruSqffW5sCfJeh2IzcdSiUw+glechcoP9Yr8sdEhnz gkzUyQ== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4as8b00j8g-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 01 Dec 2025 12:43:45 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-297dfae179bso85189585ad.1 for ; Mon, 01 Dec 2025 04:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764593025; x=1765197825; 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=fpnTx2DCpn5NW+7UCBeMn/SqdtMDI0Y8uRPDmg+UDbk=; b=ePDStvoogr9MtFo9amofY1dpQK+AMd5pUnt5aMUtWbOYYlKpu8HwcZtKUOZOtAt+aF GtQVWLa5IOKjhY53Do5WPieDxbqwWgtiozb5/jC2WQnX/RAwj1JtvuveFY5K+OVdRfff 2IchMF/RdeT9aPtLrL/3cIyFL2C33fjgjPwlZVUX7C/eWcCFWrgz4kkfC5BwIaWStn/J Xu8yFz/VwaYK9euJFNhaS+xzXkTwrDYDbVSk4ffL0bsQBy+3+zWp4PMY/DMMshxqpRvA aLEH/8Ss6qZEtWmkTonmiPuQlKeN3WqJMo26BLuT4G6WqPKXQlBm84gf6BcE2gvaDAX9 cEVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764593025; x=1765197825; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=fpnTx2DCpn5NW+7UCBeMn/SqdtMDI0Y8uRPDmg+UDbk=; b=Nx14p8V51BZI6dGnGDGE+8ZhCimkn1/xNUq3G7NrGObpNBxAlBawRRDj4Joz6qbqbZ FZo/1RMf4eNe/AOgqnb5ojkbr45jg7xc7Z21HHLm29Y4zZiDOPrLCbUIm8yy97OfZTeF Y4WNJThffzcglZzjlcst1lixvPhPiIykQGct+bpusC4/+CJAgHveaq4utlzsqRjrbETo WrOTAh8dpMb27xfn6cR7DLlzhMaYxiyIj1rZuHUBclQiS3iB/uM1QeA4EF4Whiwk6uZh xT/8WTPxs9RcK8Z3EmfuoIr5Xu6A6ExjgEGT5LRPE2EPDre8jtpXsVH0+r7rpcLCvm5G 4w0A== X-Forwarded-Encrypted: i=1; AJvYcCXQqiU+O3xsjN83XgdOdF4alcNfLV8sgC/mt1i3+iNj4vK655ydOaKNrAAWf7DU6/l/3Hwa3WRnky7m6Rw=@vger.kernel.org X-Gm-Message-State: AOJu0YwlbN6M89gOH6y/XO3chnqQXG3oV5Fo6GKMvy8mkwLTmS8RUmPG nyKkdCCbGwkQGE5EPaNMCAjO21NTeR66kMw1Ad697lT29gaii+cF1q33J2gV39HwWpmfbwjo+W2 6okQWr/bv6PnO1I+tL1wIV38IETT9k5YD7LOq9sutrbLlOnC77AHXKIZpU0qTljfWvtU= X-Gm-Gg: ASbGncugAzCs03IL/gIiy38l8Ch2EzWU241z30ZZ8HWlyIXy1UekCDZFJk6O1qlTsD6 J7LPaBcl0Hsk+n+XOSucLlLKtlu+8DcTXVyvC58xTVMvrqOte/KVbmypKgPsBkscKdAR6ipK2nD AYjGIRd7dcyXQbNN771YdY0tPwh+gqZbD0vLPqXt0Spqk50u0ZpRxLjhY1BWM2yYBdkvW0EPv9v UpxkbBG6Y5nDhOOnE0K7I2t8t8bz+Qcjy9Fc/FIy9mKiWS4xnNm1Q+/0dBaKGNxbAml9XgM2nRT SZhJlM+M2rNRy7r28bR7jTcCU0QCVyURxnFSo06abGi8uyop6mDD/Jqep7VfX1ATgYvWBi+s/Hf NTKGExIiM5kW1dLEBUGXv9EqNxLsHXDqPF+es+4cryNgJ X-Received: by 2002:a17:902:f712:b0:295:82c6:dac0 with SMTP id d9443c01a7336-29b6bf3b620mr427701555ad.36.1764593025067; Mon, 01 Dec 2025 04:43:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQRyQeaORqv6EIcBnGlMaq26A/hMlADJNn0YXR98fYBetj3iI8jUv1Ui+5YteXsBVLZPjwlA== X-Received: by 2002:a17:902:f712:b0:295:82c6:dac0 with SMTP id d9443c01a7336-29b6bf3b620mr427701135ad.36.1764593024474; Mon, 01 Dec 2025 04:43:44 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3477b733381sm13146374a91.12.2025.12.01.04.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 04:43:44 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 01 Dec 2025 18:13:19 +0530 Subject: [PATCH 3/4] net: mhi_net: Implement runtime PM support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-mhi_runtimepm-v1-3-fab94399ca75@oss.qualcomm.com> References: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> In-Reply-To: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Jeff Johnson , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, netdev@vger.kernel.org, mayank.rana@oss.qualcomm.com, quic_vbadigan@quicinc.com, vivek.pernamitta@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764593001; l=3344; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=rbqwP2YI4CzGHgLkC6DPKf/HhJhVBMMGwEXYBUIoF6k=; b=/Y2lIbKnoetk66YeT7B0yhq+Lp6V/NhqVD5b7G9I3ctKq/8126e4MtAa3KtI53yQh650IoAtH yDP4z6ZpJW+BDRVzLPVbyhcZhAeBx2UtPa+G7f/CG+yfkSzgm82tWqi X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=TcKbdBQh c=1 sm=1 tr=0 ts=692d8d81 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=FGecwo-O3dF_YbjdleMA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: 1hPo1ZJ4M268WFL_KHZDF-5iVBqgX3Vn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAxMDEwMyBTYWx0ZWRfX6OdAvTVXab6y Xlgd2CBZtN9SepjCBL3I5jVWb25PHW1LqaTCy/SeGcZrYh1/uChHA0z18qZB9UO2dUUaYXhVMHt L5E/lOSSGgj6vsiKDYPaL2wqUgB3Z3z/6yqeK5m+GtT3HvnLujNCz+CJstRraVB5WOYj16PY92E i2rW0AujyVcpbRk7DKXiz/q5LP00ZXG1dtd7BwoyBTna5171q9rM92qfv3YJfCdPppqQ3oQFi+N VrjhJzwPpgQpc2s+A7WQpcat4k+TCzN8GwY/vEBJEoimzmi4vF9plOKH4CJQWVBc8Tzvo/YJoZb QF1vXbsUWWwvPXZyfjDS7p2kXIoxWu+MWRrH2cZODxs2D10JBvJymWnreUVCUGTcD15dDBxLGSN sRXv4U60A1UQAT8Y393bLbCrCkWEiw== X-Proofpoint-GUID: 1hPo1ZJ4M268WFL_KHZDF-5iVBqgX3Vn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-28_08,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 malwarescore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512010103 Add runtime power management support to the mhi_net driver to align with the updated MHI framework, which expects runtime PM to be enabled by client drivers. This ensures the controller remains active during data transfers and can autosuspend when idle. The driver now uses pm_runtime_get() and pm_runtime_put() around transmit, receive, and buffer refill operations. Runtime PM is initialized during probe with autosuspend enabled and a 100ms delay. The device is marked with pm_runtime_no_callbacks() to notify PM framework that there are no callbacks for this driver. Signed-off-by: Krishna Chaitanya Chundru --- drivers/net/mhi_net.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c index ae169929a9d8e449b5a427993abf68e8d032fae2..c5c697f29e69e9bc874b6cfff46= 99de12a4af114 100644 --- a/drivers/net/mhi_net.c +++ b/drivers/net/mhi_net.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include =20 @@ -76,6 +77,7 @@ static netdev_tx_t mhi_ndo_xmit(struct sk_buff *skb, stru= ct net_device *ndev) struct mhi_device *mdev =3D mhi_netdev->mdev; int err; =20 + pm_runtime_get(&mdev->dev); err =3D mhi_queue_skb(mdev, DMA_TO_DEVICE, skb, skb->len, MHI_EOT); if (unlikely(err)) { net_err_ratelimited("%s: Failed to queue TX buf (%d)\n", @@ -94,6 +96,7 @@ static netdev_tx_t mhi_ndo_xmit(struct sk_buff *skb, stru= ct net_device *ndev) u64_stats_inc(&mhi_netdev->stats.tx_dropped); u64_stats_update_end(&mhi_netdev->stats.tx_syncp); =20 + pm_runtime_put_autosuspend(&mdev->dev); return NETDEV_TX_OK; } =20 @@ -261,6 +264,7 @@ static void mhi_net_ul_callback(struct mhi_device *mhi_= dev, } u64_stats_update_end(&mhi_netdev->stats.tx_syncp); =20 + pm_runtime_put_autosuspend(&mdev->dev); if (netif_queue_stopped(ndev) && !mhi_queue_is_full(mdev, DMA_TO_DEVICE)) netif_wake_queue(ndev); } @@ -277,6 +281,7 @@ static void mhi_net_rx_refill_work(struct work_struct *= work) =20 size =3D mhi_netdev->mru ? mhi_netdev->mru : READ_ONCE(ndev->mtu); =20 + pm_runtime_get_sync(&mdev->dev); while (!mhi_queue_is_full(mdev, DMA_FROM_DEVICE)) { skb =3D netdev_alloc_skb(ndev, size); if (unlikely(!skb)) @@ -296,6 +301,7 @@ static void mhi_net_rx_refill_work(struct work_struct *= work) cond_resched(); } =20 + pm_runtime_put_autosuspend(&mdev->dev); /* If we're still starved of rx buffers, reschedule later */ if (mhi_get_free_desc_count(mdev, DMA_FROM_DEVICE) =3D=3D mhi_netdev->rx_= queue_sz) schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2); @@ -362,12 +368,19 @@ static int mhi_net_probe(struct mhi_device *mhi_dev, =20 SET_NETDEV_DEV(ndev, &mhi_dev->dev); =20 + pm_runtime_no_callbacks(&mhi_dev->dev); + devm_pm_runtime_set_active_enabled(&mhi_dev->dev); + pm_runtime_set_autosuspend_delay(&mhi_dev->dev, 100); + pm_runtime_use_autosuspend(&mhi_dev->dev); + pm_runtime_get(&mhi_dev->dev); err =3D mhi_net_newlink(mhi_dev, ndev); if (err) { free_netdev(ndev); + pm_runtime_put_autosuspend(&mhi_dev->dev); return err; } =20 + pm_runtime_put_autosuspend(&mhi_dev->dev); return 0; } =20 --=20 2.34.1 From nobody Mon Dec 1 21:33:25 2025 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 7BE8F31ED82 for ; Mon, 1 Dec 2025 12:43:52 +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=1764593034; cv=none; b=At5XQmdQGkTEGDmCX4zi7aXAPr6gO2Ir0xd/HgUtcu9jaRwpeCDpce9JVhyDsqNLWLrpNQcRnyxHqnuHFRJ6hxh/OtW7JwjdbCp7D+GPtIk9G2EJOO6Ecns8PhOkdUZX6I0igPQWhrTjP4F8cfb3fHNKQDi/m+BFgkNjb8xBa7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764593034; c=relaxed/simple; bh=GH482HQseJW7R4QoliiIACcw54hmP3LITJI8fgJuTts=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rHmg2QNVd4+Dv+JLO91+AvWFs05EZOmVTyr+6qXiM3V04hSUWWgl+g6GL7+RUCE6mmOBAXlZTnDXrTOmn7bjUNTyJjQUjIturmHNj0PZia1njElDf+rQLzHtN4WhVt0OgUn5sYAtEvhIJZJ9Dea4zQKQLTlv4OHo3tzpaCWJBAI= 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=Gv12s/IH; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=RFBlkD0V; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Gv12s/IH"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RFBlkD0V" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B18OCCJ2563012 for ; Mon, 1 Dec 2025 12:43:51 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= g3eWAp1Uztlnh+JGWFxdF/vF9gNgmc6EwOi5LM6HCKM=; b=Gv12s/IHP5hSlfis zkDXZpDoYamcMTEOyJ1p0r9bM8Y/Puj1Ba5v1QbW66gJM65C5DN6JbercA1y2ldq L+G6uEw/hBvpwRCn5FIlG4qwn9yhQ+Gv95ANFSAAv6zTVyHy193kJ3zh7Lt9hv3N +j2iUG1JQpkggG+Grfn/zCN1oLMPTuOI5RTe1UxdRd57RaRxkOT6QfGGMBOJaffb kaC284BGLOz+3TgYmBwWjvRIskHXXTkI7/qCdvCYvN/zr7yruadYlpX0bgnir+KF AVy5Z5waXZt0KH2Ziw7eTTTKWxlHQkQ3iaaIAJ8iGkFBDVX7ywTeTE5NqJyJTQAR L5PYBQ== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4arwnvt005-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 01 Dec 2025 12:43:51 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-340c0604e3dso4298427a91.2 for ; Mon, 01 Dec 2025 04:43:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764593031; x=1765197831; 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=g3eWAp1Uztlnh+JGWFxdF/vF9gNgmc6EwOi5LM6HCKM=; b=RFBlkD0V2TDmgh+NIgAzFMqCVo5YGFkGU52x7CELdO3LfozUcGRalX6s29b/kWw00K 9fMCGJ5SU7WS+ZmJ/o7gDEMe863pAun14XkHEkB8Zpv+e+qbkC1VlW0nVKRmHYgAMIMK Q8AzvRaQvVMs56kcW0rIinnMF/a1tp/6/M3esGtry0X6ZHxlTa6b/StzGKFKJU9vFn3o aGgzvgsgnp+HeDUgP/wakE8Myws9K2YF49fsT4V2cZWzn2xqcM7i0EdahlVOcX7cJnb8 abiYW/lPByIru1JxMMm8HN22JQj5ET+ywWQNHwkiPmMwRkjypwwDviUIuInp0ulxUdRi dOpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764593031; x=1765197831; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=g3eWAp1Uztlnh+JGWFxdF/vF9gNgmc6EwOi5LM6HCKM=; b=rZbJXRQSW0Z9tunBurTDgiv/OFyp6E9HTTBWxLzG/aYRIL9NafrnW2uiyUqIYpPMye qaXZWMMb85QEgcK60Lg9ZI2x8QQvG/p6CWOATci7miWK/eQWcTMKSNYS09pDJF3uYQWb bSv6MoGBjlzBBbGiDSIFcMiQVmpa0PYtipc2BaTDolt9zBVFX2ou7gVsAw8Z0FJFD3FW m4xTIW3Ck9bzZdYuuSVAvzZQFnorlPwW2AJmHI0HCPfEovd2LDj6EW8kfVmlCL83wmwi 5oxVhqlWMb7Rk9Lsn9+6rICVAsKpE7ydkXBJurPJX6rTl2IiMlc/DEJZMQI4j3YLK+Ry jneQ== X-Forwarded-Encrypted: i=1; AJvYcCXUmt07fHLdlWpDXlnQgGmnoZk2Pp8sTh1ENscNrOtDSdUPPFwfO+dzE4fxGjGgKuE8GAUyU+jTVgmnzz0=@vger.kernel.org X-Gm-Message-State: AOJu0YyMyUtsADNoqHRLCgMGJCoer8UZjnuLpNmb+eYZXOcY9aBtsJLz D+jXTSzXdmMtx5ANAa1psF7CAVtg/u3tLvSdKRhCkncKvHnQRXig3GUS4A4KCYVgTr5zIpmbUYe zYdBsUT7+iGUWlxE/QA1baLbcnOcUWuEJLSiiWFBNzAGQtuA+3E8Q5f4Hj10+xmzuVLU= X-Gm-Gg: ASbGncsbJ1hsgmM0dukONcpPdB0jORTtvDIRZA1g1do2WFAzasSuPASWSAkWdcoBm75 IlUYbK4aN49/ggE981BFGSgg9yvBZWkdGl3eDMHzSpHUwpk0fapHtLVQ7tDi2vEyjP5YhRvhFSv dKx/IiQ0oobQq0Q+vd+eIAmUi08Khw06+EOGl3u8YVGOsKPoDsawK7R0WM5BNvnBbktbwHm/Fin FBPc01ROYAtlDR3SW7MzBFHUC8Tmvjg0JtvdnacBdcz/9AsHfFnxr1MVu7fLj7aKhInSps8/nty 4c5yUP4tGCiHPPERISoBN9ZKnTcR5OMwuddzDjwvlq2xmJVSsgw31dCMxi868y+geBaD7qDQVFX LCTPwh+EFhOxp41uj5dazHKdqUH+uG7lC1puUHO83Tl+z X-Received: by 2002:a17:90b:4ec7:b0:341:88d5:a74e with SMTP id 98e67ed59e1d1-34733f4ac35mr37194037a91.29.1764593030908; Mon, 01 Dec 2025 04:43:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+1AJmch3kW0mA+J5AWIFl5cR6CskMUYu3HyMBvIiPCYmUUTKrD3aXjJSClrHjHz/ZGceKoA== X-Received: by 2002:a17:90b:4ec7:b0:341:88d5:a74e with SMTP id 98e67ed59e1d1-34733f4ac35mr37194006a91.29.1764593030406; Mon, 01 Dec 2025 04:43:50 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3477b733381sm13146374a91.12.2025.12.01.04.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 04:43:50 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 01 Dec 2025 18:13:20 +0530 Subject: [PATCH 4/4] bus: mhi: Fix broken runtime PM design Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251201-mhi_runtimepm-v1-4-fab94399ca75@oss.qualcomm.com> References: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> In-Reply-To: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Jeff Johnson , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, netdev@vger.kernel.org, mayank.rana@oss.qualcomm.com, quic_vbadigan@quicinc.com, vivek.pernamitta@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764593001; l=7600; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=GH482HQseJW7R4QoliiIACcw54hmP3LITJI8fgJuTts=; b=6iTeiDENHrbVLHbi/ceLO/7iDY2j59zpb8UbDBQqB3y4mszKHxMTOmMfNQCmVJepmbVUaIH3P FIGaMVQ5N2wAm3TcemuMJi1WTt4sNs8Uya2mNRCAqG28Z03+njJQ/cu X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: -CQudDZtUkVhmwVo7u2VFNs1B72eZpm_ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAxMDEwMyBTYWx0ZWRfX7uLPloDf5XTX Gg4+WxHIQoUeULGMH0URLLfAN5ajWUfEtFv6GmlmLrqeTAGqjUSIkDlPR0IQr9A71WfLuckSK38 z38aIP51tTlhsuED/nUBkmHj21segdanRbQcQdQD0LYKbONAJSiNnyqOheqHdKh9X9n3rh2gZdx 2TUP0PVg2whNhroORooblFjk97Ew8qqIJKQ32iD25OzLiXA5tMsHh3MtXocfglgDR98A+h7NKbV D3pqnxtKkSCeNSHaKE28VGgVShz+Kor+w3D9aj6nlq/9VQuncDR8QMMbi3jIFLPaQj86ci8zIQa U7rXKggEg0qGlC29P3lslCKmtZxCY+IbdfQE2LCWU0i6mPENuhXJYsDdkjf3UIFHlKq01fT9hYA I/bOJf/tnj7sKOLyNk47a4lZ44BgkA== X-Authority-Analysis: v=2.4 cv=Urxu9uwB c=1 sm=1 tr=0 ts=692d8d87 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=A8rfxp3GyOsx1I41rDQA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-GUID: -CQudDZtUkVhmwVo7u2VFNs1B72eZpm_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-28_08,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512010103 The current MHI runtime PM design is flawed, as the MHI core attempts to manage power references internally via mhi_queue() and related paths. This is problematic because the controller drivers do not have the knowledge of the client PM status due to the broken PM topology. So when they runtime suspend the controller, the client drivers could no longer function. To address this, in the new design, the client drivers reports their own runtime PM status now and the PM framework makes sure that the parent (controller driver) and other components up in the chain remain active. This leverages the standard parent-child PM relationship. Since MHI creates a mhi_dev device without an associated driver, we explicitly enable runtime PM on it and mark it with pm_runtime_no_callbacks() to indicate the PM core that no callbacks exist for this device. This is only needed for MHI controller, since the controller driver uses the bus device just like PCI device. Also Update the MHI core to explicitly manage runtime PM references in __mhi_device_get_sync() and mhi_device_put() to ensure the controller does not enter suspend while a client device is active. Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/internal.h | 6 +++--- drivers/bus/mhi/host/main.c | 28 ++++------------------------ drivers/bus/mhi/host/pm.c | 18 ++++++++---------- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/interna= l.h index 61e03298e898e6dd02d2a977cddc4c87b21e3a6c..d6a3168bb3ecc34eab1036c0e74= f8d70cf422fed 100644 --- a/drivers/bus/mhi/host/internal.h +++ b/drivers/bus/mhi/host/internal.h @@ -355,9 +355,9 @@ static inline bool mhi_is_active(struct mhi_controller = *mhi_cntrl) static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl) { pm_wakeup_event(&mhi_cntrl->mhi_dev->dev, 0); - pm_runtime_get(mhi_cntrl->cntrl_dev); - pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); - pm_runtime_put(mhi_cntrl->cntrl_dev); + pm_runtime_get(&mhi_cntrl->mhi_dev->dev); + pm_runtime_mark_last_busy(&mhi_cntrl->mhi_dev->dev); + pm_runtime_put(&mhi_cntrl->mhi_dev->dev); } =20 /* Register access methods */ diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index 7ac1162a0a81ae11245a2bbd9bf6fd6c0f86fbc1..85a9a5a62a6d3f92b0e9dc35b13= fd867db89dd95 100644 --- a/drivers/bus/mhi/host/main.c +++ b/drivers/bus/mhi/host/main.c @@ -427,6 +427,8 @@ void mhi_create_devices(struct mhi_controller *mhi_cntr= l) if (ret) put_device(&mhi_dev->dev); } + pm_runtime_no_callbacks(&mhi_cntrl->mhi_dev->dev); + devm_pm_runtime_set_active_enabled(&mhi_cntrl->mhi_dev->dev); } =20 irqreturn_t mhi_irq_handler(int irq_number, void *dev) @@ -658,12 +660,8 @@ static int parse_xfer_event(struct mhi_controller *mhi= _cntrl, /* notify client */ mhi_chan->xfer_cb(mhi_chan->mhi_dev, &result); =20 - if (mhi_chan->dir =3D=3D DMA_TO_DEVICE) { + if (mhi_chan->dir =3D=3D DMA_TO_DEVICE) atomic_dec(&mhi_cntrl->pending_pkts); - /* Release the reference got from mhi_queue() */ - pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); - pm_runtime_put(mhi_cntrl->cntrl_dev); - } =20 /* * Recycle the buffer if buffer is pre-allocated, @@ -1152,12 +1150,6 @@ static int mhi_queue(struct mhi_device *mhi_dev, str= uct mhi_buf_info *buf_info, =20 read_lock_irqsave(&mhi_cntrl->pm_lock, flags); =20 - /* Packet is queued, take a usage ref to exit M3 if necessary - * for host->device buffer, balanced put is done on buffer completion - * for device->host buffer, balanced put is after ringing the DB - */ - pm_runtime_get(mhi_cntrl->cntrl_dev); - /* Assert dev_wake (to exit/prevent M1/M2)*/ mhi_cntrl->wake_toggle(mhi_cntrl); =20 @@ -1167,11 +1159,6 @@ static int mhi_queue(struct mhi_device *mhi_dev, str= uct mhi_buf_info *buf_info, if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) mhi_ring_chan_db(mhi_cntrl, mhi_chan); =20 - if (dir =3D=3D DMA_FROM_DEVICE) { - pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); - pm_runtime_put(mhi_cntrl->cntrl_dev); - } - read_unlock_irqrestore(&mhi_cntrl->pm_lock, flags); =20 return ret; @@ -1377,7 +1364,6 @@ static int mhi_update_channel_state(struct mhi_contro= ller *mhi_cntrl, ret =3D mhi_device_get_sync(mhi_cntrl->mhi_dev); if (ret) return ret; - pm_runtime_get(mhi_cntrl->cntrl_dev); =20 reinit_completion(&mhi_chan->completion); ret =3D mhi_send_cmd(mhi_cntrl, mhi_chan, cmd); @@ -1408,8 +1394,6 @@ static int mhi_update_channel_state(struct mhi_contro= ller *mhi_cntrl, =20 trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, TPS("Updated= ")); exit_channel_update: - pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); - pm_runtime_put(mhi_cntrl->cntrl_dev); mhi_device_put(mhi_cntrl->mhi_dev); =20 return ret; @@ -1592,12 +1576,8 @@ static void mhi_reset_data_chan(struct mhi_controlle= r *mhi_cntrl, while (tre_ring->rp !=3D tre_ring->wp) { struct mhi_buf_info *buf_info =3D buf_ring->rp; =20 - if (mhi_chan->dir =3D=3D DMA_TO_DEVICE) { + if (mhi_chan->dir =3D=3D DMA_TO_DEVICE) atomic_dec(&mhi_cntrl->pending_pkts); - /* Release the reference got from mhi_queue() */ - pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); - pm_runtime_put(mhi_cntrl->cntrl_dev); - } =20 if (!buf_info->pre_mapped) mhi_cntrl->unmap_single(mhi_cntrl, buf_info); diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c index b4ef115189b505c3450ff0949ad2d09f3ed53386..fd690e8af693109ed8c55248db0= ea153f9e69423 100644 --- a/drivers/bus/mhi/host/pm.c +++ b/drivers/bus/mhi/host/pm.c @@ -429,6 +429,7 @@ static int mhi_pm_mission_mode_transition(struct mhi_co= ntroller *mhi_cntrl) =20 if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { ret =3D -EIO; + read_unlock_bh(&mhi_cntrl->pm_lock); goto error_mission_mode; } =20 @@ -459,11 +460,9 @@ static int mhi_pm_mission_mode_transition(struct mhi_c= ontroller *mhi_cntrl) */ mhi_create_devices(mhi_cntrl); =20 - read_lock_bh(&mhi_cntrl->pm_lock); =20 error_mission_mode: - mhi_cntrl->wake_put(mhi_cntrl, false); - read_unlock_bh(&mhi_cntrl->pm_lock); + mhi_device_put(mhi_cntrl->mhi_dev); =20 return ret; } @@ -1038,9 +1037,11 @@ int __mhi_device_get_sync(struct mhi_controller *mhi= _cntrl) read_unlock_bh(&mhi_cntrl->pm_lock); return -EIO; } + read_unlock_bh(&mhi_cntrl->pm_lock); + + pm_runtime_get_sync(&mhi_cntrl->mhi_dev->dev); + read_lock_bh(&mhi_cntrl->pm_lock); mhi_cntrl->wake_get(mhi_cntrl, true); - if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) - mhi_trigger_resume(mhi_cntrl); read_unlock_bh(&mhi_cntrl->pm_lock); =20 ret =3D wait_event_timeout(mhi_cntrl->state_event, @@ -1049,9 +1050,7 @@ int __mhi_device_get_sync(struct mhi_controller *mhi_= cntrl) msecs_to_jiffies(mhi_cntrl->timeout_ms)); =20 if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { - read_lock_bh(&mhi_cntrl->pm_lock); - mhi_cntrl->wake_put(mhi_cntrl, false); - read_unlock_bh(&mhi_cntrl->pm_lock); + mhi_device_put(mhi_cntrl->mhi_dev); return -EIO; } =20 @@ -1339,11 +1338,10 @@ void mhi_device_put(struct mhi_device *mhi_dev) =20 mhi_dev->dev_wake--; read_lock_bh(&mhi_cntrl->pm_lock); - if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) - mhi_trigger_resume(mhi_cntrl); =20 mhi_cntrl->wake_put(mhi_cntrl, false); read_unlock_bh(&mhi_cntrl->pm_lock); + pm_runtime_put(&mhi_cntrl->mhi_dev->dev); } EXPORT_SYMBOL_GPL(mhi_device_put); =20 --=20 2.34.1