From mboxrd@z Thu Jan 1 00:00:00 1970 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 75A222EFD81 for ; Thu, 10 Jul 2025 17:18:07 +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=1752167889; cv=none; b=g54SnRvUmDLNbveGOcCMwwWC93GSaP/tAOXgpVHJ1JnTkQqEJIE5KcHxtSCx/CJfODDuvv2R4QqbwQ3vXIIl2ISHq4drL2dJXIkt1zJPoHMYwvWXmn6rZicf2UywlMDwWgWUvy/aLiZWD5VK7LmlL1548ro0xgkkBmSwYy+AZNo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752167889; c=relaxed/simple; bh=AMvH8CbgflCSwtZv4m6a1RA/Wg9jDTGoMyT6/VZgH/o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=eG8CjAKPS/lUAxtHGzfMGS2ArNt0xLHIyRwHva1uCG7OQvqFFZdbVTfXQmUnEAza+n5pjKaQqGbbLqpUFfCDuW60F6YbBbtWZsi/rhLUeSL6o5g3Ef/6wdhw0dIkugwLdbnakVKjkV/ADd8VRhVWOADxLb+m/GrrQTr9nWwIOG0= 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=kftSpZ9Y; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="kftSpZ9Y" 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 56A900x2016172 for ; Thu, 10 Jul 2025 17:18: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= Ar7cVymq/jtUHBmvH1VZaUyciNOHi8uWBeFm9Lj+JaM=; b=kftSpZ9YXjb9tP8z JAa7GP/C5N1nGxlH9A8arpDhrAqIcgd0Ga9o0P84DK05+Q7dKtyGNZt6b8HMn2tw 2ORX65/2UdoBSPG0ncP6NiYWtDVilajBiYoZ6j+5CahLCPbwt4t8lyz9oZ8rUkB5 tmZWZN+HNChoCB6+SRBUW4I1tS2X3FifvuGUeLC2qUMcNERFtPWQ27xtQePftVGY H5SdSLyPMSLonbwuZYQFzVQHI43CrnNINhkcycur23ivtvSTguMNk/IHaQh8e8c+ x1KfD1I4AVZIIxD8PhiiccHeNDKBbgGNNU51RDnTtnRF11rxnwvnNfHsIZ5/Uw/3 o+Vzeg== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47pvefs8qm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 10 Jul 2025 17:18:06 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-748e6457567so1829978b3a.1 for ; Thu, 10 Jul 2025 10:18:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752167885; x=1752772685; 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=Ar7cVymq/jtUHBmvH1VZaUyciNOHi8uWBeFm9Lj+JaM=; b=QZxmmLThNnWrWouf4T+RjUMs7pkA27IGbxtPLDdRQZWcXGGhxi7Dp7qn6BnVXSg3Da bXDD0eaxaWiKIVpv++sbJTMWoqepGmp1CV2WCdDSbqr/VWF6SeGJAAvHKBDucLrCJcxE vaj6oUwkKbme8I8Ka2kOOk5HAak4h16KvTSoKk+orYG6SbBcZ7JPz91w41aVcgsWDybh MHQA/SK7nd+HEpuYH2OIoyNv7O2+r+HnYj/PnVhHPJqG9oGSrd+F/yHveDL+V9rNyHRI HuBQzZC7WFGUYCa9fDz/Xbl/uxD2YOsOWUqH4qoKRwIfuIGUDbb756ObcBgR3hQ9HbSk NAHA== X-Forwarded-Encrypted: i=1; AJvYcCWsQMjwfwL6y3Zaw0CkIBAbXRmuqsmpeuIutKRVhMB56wRG4XH0dk9vRs29CB+qhsJv24X8XIfrqC14rgV6@vger.kernel.org X-Gm-Message-State: AOJu0Yx4QiR87wcIrOM4wCObPY2MixlQZBp7JTUHaEALi+mjuuEf7xS1 5MGBIX4pbiJNDYaC8FK9klFw5b2uolAN7CtX8ZKgdbee46PMB35UlJhk2tEb2ZIYZQJKec0Mzpi GsN5WrhSNQJE8KL2qGgYchTWv+pvYu30y3iOtrFtRO0xFJuABiZ1TxNXeBWDAOU4P5n/t X-Gm-Gg: ASbGnctfUNXv+57MdacZHzA/KV0hSksl2uAC60Ymp1pblbHNVlSSmnlOKV5xI6SVDOH y1/8SnvAGLbYLwRqf0W44lWP7CJ39009bgBbpGaKn1D8oaCTdDq4cpf74+s0fCU1YOx+H3071UT r5fTod22E9ZD/GjNOj4f8c4STKMaFpTEscKR5GsAREadoo5qRZE+gBf4SzKzVP8eaE4dxlaYGIr WGg+wSKlbQCPjwaZCQ2F831O14o+KS5rM03c/sqoTIQdDrzkj6Nq+TEvHh7pRBhWIrECqEHUpcY 6COUS9B3QeTe/yCbOR8jYuSQrEx3nz7z4O1CkR3iKVnZ+1DVN0g= X-Received: by 2002:a05:6a20:729e:b0:21f:9b24:321b with SMTP id adf61e73a8af0-22fc57e7824mr8500615637.20.1752167884946; Thu, 10 Jul 2025 10:18:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHffsp+s2THEsKwd99/2YsGeT6E/wKdQJkZlm+vr/bjKBhhIbOq/IXrxnXy0oU1VYAbUwh2SA== X-Received: by 2002:a05:6a20:729e:b0:21f:9b24:321b with SMTP id adf61e73a8af0-22fc57e7824mr8500573637.20.1752167884443; Thu, 10 Jul 2025 10:18:04 -0700 (PDT) Received: from [192.168.29.92] ([49.43.227.1]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b3bbe72ea8bsm2779997a12.76.2025.07.10.10.17.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Jul 2025 10:18:04 -0700 (PDT) Message-ID: <304d71ca-5773-4fa6-aece-50f92b70c77f@oss.qualcomm.com> Date: Thu, 10 Jul 2025 22:47:53 +0530 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] bus: mhi: keep device context through suspend cycles To: Muhammad Usama Anjum , Manivannan Sadhasivam , Jeff Johnson , Jeff Hugo , Youssef Samir , Matthew Leung , Yan Zhen , Alexander Wilhelm , Alex Elder , Kunwu Chan , Greg Kroah-Hartman , Siddartha Mohanadoss , Sujeev Dias , Julia Lawall , John Crispin , Muna Sinada , Venkateswara Naralasetty , Maharaja Kennadyrajan , mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org Cc: kernel@collabora.com References: <20250630074330.253867-1-usama.anjum@collabora.com> <20250630074330.253867-4-usama.anjum@collabora.com> Content-Language: en-US From: Krishna Chaitanya Chundru In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzEwMDE0NyBTYWx0ZWRfX0kyrkQmFHXTa tvrCAq75/PfCEcoKsACG57dZZqFpMi408MytULucLUeM8f5DdEv5GWzlYmLw/0iFuaovKaSp9Ti 2Kj/nfKpmBo+eJQH2D5jtJDFFtIcPwMxiGc+WOimPIy2ru7rO9t+czL5hIjZxijV/i3csm2+Ftw m7NGiaxgHyW7rr/kmT2gi4vmyRFyt3lmgyCLfUXq4257TA7FdeUaaj2srfI7rtzdnxIWWCko/HX q9qS3nfkgXUUcyRlhZAIattYZ9YTcZCZcNeBGjCPPHuPFz89Wr/C6dA1X5c241uJBjdsK/zwkzc aSc5ZOH4OWTbDXw0R1ABls1vBofRFTHa8k4SJvnyvB0JYceEwNoBL4iBOHqwKnENYeXC+wjusbo RJZSO0T0FV4CsLPx/spFid+nV2sOTaNCVYoHdWSrN1PLhe5VYrJuhq0G8ZDRl8UfjnIg+mpg X-Authority-Analysis: v=2.4 cv=dciA3WXe c=1 sm=1 tr=0 ts=686ff5ce cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=4nqOr+EkFiuPl9GB/B4vcQ==:17 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=QX4gbG5DAAAA:8 a=zOkQIraDPy1jB-BB_0EA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 a=AbAUZ8qAyYyZVLSsDulk:22 X-Proofpoint-GUID: LUwYi6drN_eoUVhsUlSapkU1QQbH_Izu X-Proofpoint-ORIG-GUID: LUwYi6drN_eoUVhsUlSapkU1QQbH_Izu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-10_04,2025-07-09_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 suspectscore=0 impostorscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 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-2507100147 On 7/10/2025 8:37 PM, Muhammad Usama Anjum wrote: > On 7/8/25 3:15 PM, Krishna Chaitanya Chundru wrote: >> >> >> On 6/30/2025 1:13 PM, Muhammad Usama Anjum wrote: >>> Don't deinitialize the device context while going into suspend or >>> hibernation cycles. Otherwise the resume may fail if at resume time, the >>> memory pressure is high and no dma memory is available. >>> >>> Tested-on: WCN6855 WLAN.HSP.1.1-03926.13-QCAHSPSWPL_V2_SILICONZ_CE-2.52297.6 >>> >>> Fixes: 3000f85b8f47 ("bus: mhi: core: Add support for basic PM operations") >>> Signed-off-by: Muhammad Usama Anjum >>> --- >>>   drivers/bus/mhi/host/init.c | 11 ++++++----- >>>   1 file changed, 6 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c >>> index 2e0f18c939e68..8f56e73fdc42e 100644 >>> --- a/drivers/bus/mhi/host/init.c >>> +++ b/drivers/bus/mhi/host/init.c >>> @@ -1133,9 +1133,11 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl) >>>         mutex_lock(&mhi_cntrl->pm_mutex); >>>   -    ret = mhi_init_dev_ctxt(mhi_cntrl); >> mhi init dev ctxt also initializes the ring pointers to base value, >> I think we should take care of them also ? > Are you referring to mhi_rings? They are getting initialized inside > mhi_init_dev_ctxt() and de-initialized in __mhi_deinit_dev_ctxt(). That's > why I've not handled them separately. > Maybe I was not clear in my previous comment/not a correct place to do the comment. My point you are not freeing __mhi_deinit_dev_ctxt as part of suspend, that means we are expecting device will continue to use the rp and wr pointers of ring as the previous i.e before suspend pointers. What if PCIe keeps link in D3cold as part of system suspend, will the device able to handle the previous rp & wp of ring. I don't think device can handle this. - Krishna Chaitanya. >> >> - Krishna Chaitanya. >>> -    if (ret) >>> -        goto error_dev_ctxt; >>> +    if (!mhi_cntrl->mhi_ctxt) { >>> +        ret = mhi_init_dev_ctxt(mhi_cntrl); >>> +        if (ret) >>> +            goto error_dev_ctxt; >>> +    } >>>         ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, BHIOFF, &bhi_off); >>>       if (ret) { >>> @@ -1212,8 +1214,6 @@ void mhi_deinit_dev_ctxt(struct mhi_controller *mhi_cntrl) >>>   { >>>       mhi_cntrl->bhi = NULL; >>>       mhi_cntrl->bhie = NULL; >>> - >>> -    __mhi_deinit_dev_ctxt(mhi_cntrl); >>>   } >>>     void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl) >>> @@ -1234,6 +1234,7 @@ void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl) >>>       } >>>         mhi_deinit_dev_ctxt(mhi_cntrl); >>> +    __mhi_deinit_dev_ctxt(mhi_cntrl); >>>   } >>>   EXPORT_SYMBOL_GPL(mhi_unprepare_after_power_down); >>> >