From nobody Mon Dec 1 22:05:48 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