From mboxrd@z Thu Jan 1 00:00:00 1970 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 7C0F03C4174 for ; Wed, 29 Jul 2026 21:07:05 +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=1785359226; cv=none; b=KW2HaUs4zZmL8J82vgtI9jBSo7dt9zkgN5QR66InOE11pJXEn2kXZ1NRBvUYbMXAFshTZ0uFXxXSJIS9ScV7TYET2wfCeX4whDmCUaIoLJ4xzzJ/rBHFkKBeAv5+M6qOFTgTUTUiqFeQye1HjbWPsdtdfT/eCntg/+ia1aUnd0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785359226; c=relaxed/simple; bh=Xw/5ZltwCtw3AUoZIF/AG/UvNI1OOm1dwK4rjeX3slo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=f48IAXpFxgp8t83WJnl08yTQPPnUE25a60dnil+deK1eOLx6k9JG0SU9WDXAIIM+Xr9uh3R3zylYdg7HApOt2qjRSbNuKhEg7DEQB6/Y8fBlGMlKMHxLL21dNDMB9fNnzvOgNAd8p92JujtHAvNH+K7BoSJIpxT/T8Qnu7s97dw= 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=pujv7Uq7; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=DWarv6P2; 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="pujv7Uq7"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="DWarv6P2" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66TL5Ev74154549 for ; Wed, 29 Jul 2026 21:07:05 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= MuWF9stGyUCSIAWOWqLbaSKdFKVMhyVOXirq6Nin1i0=; b=pujv7Uq7ruBhfF1t TTbOYnX7Rn/pqdmFLJNmUKjBX8N6XRmR9Xt9AjTa0lio1+I1mTUTgFlByd6DOHhH A01A7E3eRZdTjQoe0kxAZBfdZ1LvLxOP34dYmR+MQRlsP3H68hPhHiD7OSXT2anq fUxQJEI+MDwt9Wk6iXeqo5gqIBQPln7nXjpfPn9/yfVZXIEWCaX/31cHHtxQg7Ff JxlL/598jS0+Re8VV50aKl9QIFLwRVbv3teAqGJISnsS6FnzNd03xnmfiM+dzzSn rIXJlwb5p5bptvSHqjypp9FkKUYUq6P1bgULYsZfKvlTnWpA40kThwPerP1RRqj8 J6NmZA== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqrc7g6b9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 29 Jul 2026 21:07:04 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2cc73f47bdcso24241075ad.3 for ; Wed, 29 Jul 2026 14:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785359224; x=1785964024; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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 :content-type; bh=MuWF9stGyUCSIAWOWqLbaSKdFKVMhyVOXirq6Nin1i0=; b=DWarv6P2UBwxmFtuumN9RckFgZlk4Koo2PWW+1ZYJinMEvdvg2Nh3Bv0IdIkKLzVWZ hDhFTh2eBK66blZJamVK94gBeiaUSJ/BgtXUdqJMSRWfbn2mMC13IB4jclOlTsFbCxMw +wlQNX0HAbTE16awH0knO3FSlvZUUYgTFU3kq2JBF5RBUPfFqp87ww5DXg7nFFdm3YX8 dxVKADvHW6pK2V+xlDbfF0ISJmwKvaA+uPoesHwuBFGb6ofcmklCxyWw3vzq8rGo+Nax hFxw00DP8Xdvw+4q5sEXcT7qtl68F9xBVeohLVtT+hKdZ4KLDGKEUXa//M5OC9/xhDYI MKwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785359224; x=1785964024; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MuWF9stGyUCSIAWOWqLbaSKdFKVMhyVOXirq6Nin1i0=; b=LdPTbYD1Q67GZAnQOFyRRJ2Ps5y3TiYq2jy5sycqSZ3p85QZ3nqZGepjm0fRqfxBzy gsn65hRdtIsbPaJyZ//UUJ8UvQ98ffOSsWPRRl1qKFLdw4HK1Mgcp/jVSBgxgRtnwibB BHSJsbXUxOe2kq0QtyKHpGejyrLRtGoRES0h91HVU2JigwYub6Et1rErSZGJMmq8T9qw b6HlWSKALm2tL2txvzOJykgbgf6tjigiYA4DMBZs0JDc04kuZ1TaWDfFKPoTf0SEpyNv G7zvJAxzdurrAJHUZb9Zcg3MnD8KRZIb74eqYA108wBmiJjTtyHdNlDXLTCT6APJnU+V NJ/A== X-Forwarded-Encrypted: i=1; AHgh+Rp9reXkSyM1hzbH3geFU8WdoCvV0tNWg4Jr5ts7cf4QWPj31vGzovj8Mvhgh1hP1OO/YrMuEdSsHXBZ+ak=@vger.kernel.org X-Gm-Message-State: AOJu0Yxk4C/Sfdl7/6g9gGEiZKeGcSY4AoG8BSdkrn+C833iRThTcqMK vccJEyxRu8U6PufL3w4uT0bHiU+WawOEu4XuByE9apzi7MAuYpmVxk2OTm6JxRxP7a68aWNtoNU RY/TZCZN84ETIaHTM5VxssmU1GuP4hVOifyZYPvIrD8OrR7Y2uOJycwtMnApgvrC4CX0= X-Gm-Gg: AR+sD13+IDxxFLYUNF3VYCR9YcGs1U6PTYtYtWuoZnLKFrBeWCzTfFt0Mmt+dlpI0jX FbheNOJaUZznw3Uw8FcebkKtZ4zkv6dF+4E8/rXKl7u2cwBUckq6izotv4+by0GkvWDt6MoCF6g EhDbg9h0KAdb74zx3gfKPNPeH5QsJTmltp+pftOjKWRr2+00X8U6hW8VNCV1v13oGZpSLYnwXbh Nd2DpQ+Klw6g86goGO5/zpQDad0IFO8CvGzEozU3Nw5EY1+aMJqT4Z4l7LGGiqirNLc2o5e4RXs Z6Xjaxw4ioQUByTCyQAhrDtpV/DWSBlIBJqO6hLI4c+tsBmHGMIOU5cHdfmyMzwooYkLHBKkh0l S28h5hpqbelLjqrS6fGFrdMoY0WrEELiu3IDrDVuvHN+o7DnbJzbjNg== X-Received: by 2002:a05:6a21:6009:b0:3c3:f371:1ea9 with SMTP id adf61e73a8af0-3c8aaf8d31fmr10052391637.10.1785359223722; Wed, 29 Jul 2026 14:07:03 -0700 (PDT) X-Received: by 2002:a05:6a21:6009:b0:3c3:f371:1ea9 with SMTP id adf61e73a8af0-3c8aaf8d31fmr10052303637.10.1785359222450; Wed, 29 Jul 2026 14:07:02 -0700 (PDT) Received: from [10.226.59.182] (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504d37368sm24048005eec.22.2026.07.29.14.07.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Jul 2026 14:07:02 -0700 (PDT) Message-ID: Date: Wed, 29 Jul 2026 15:07:00 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] bus: mhi: host: Flush the posted write after writing to MHI_SOC_RESET_REQ_OFFSET To: Manivannan Sadhasivam , mani@kernel.org, mhi@lists.linux.dev Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Williamson References: <20260623145134.43976-1-manivannan.sadhasivam@oss.qualcomm.com> Content-Language: en-US From: Jeff Hugo In-Reply-To: <20260623145134.43976-1-manivannan.sadhasivam@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: usy3JuZNad8AVNuQQS6NyVcwp2D2pvfg X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzI5MDE1OSBTYWx0ZWRfXwhtjZajEaGbT iKm0y3cMY7CqwbKmUoL8JRiium0ygFc5wVG82ZVLHf9/d4zhk8IHKvRUYf4eFBYDX54GVC++J5F 4Jdz7M9oxFx5GYld08v3PNbpPU7AV4FGOh6R++/vUUIeIOSF/EV99F/wiZBXpfKDlB6XJiV53HJ WmMarqailfyWDQfwIEiM+tPkwFD+e5i+z3hYgOwlNd9+U8WyNBg1OhonJOkyDsyxMIrL3XO4EXj zfWZbB3JgQ4alvs8PGCzAmN8oqSAzd3Ewwh2jhJluZiH2Wbpn+Z3MMkoTfPta3yH+qUfkjETUV4 fOP8gn/7WZfpK5vlnY06ZRr1O4pdjbOE0haUW69xJAukwYf1EpPyZPNwDd49H2fmdjl4rgMnbzo VFlbK1LqV1lu8xkJY5W5KUVb6JPyK4Gdf2ao7g9SOpbFH5QoDbJto2zf2Wr7R0egYoN9Gftsb8z 348qLykAvoOmat9uAFQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI5MDE1OSBTYWx0ZWRfX4ihjKo+kA9A1 XWxA9rLmfWf3yeQ97tE0skenXyRODD1aLXBJnXS3jSZtcLp/bQ3kdmxue6i6l1tdVLoU6t9V8cm 13qvz7DeC00aXL5AAyIctha+QqeULvs= X-Proofpoint-GUID: usy3JuZNad8AVNuQQS6NyVcwp2D2pvfg X-Authority-Analysis: v=2.4 cv=XJcAjwhE c=1 sm=1 tr=0 ts=6a6a6b78 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=VwQbUJbxAAAA:8 a=r1p2_3pzAAAA:8 a=EUspDBNiAAAA:8 a=nEv132rEWRdaR2lrs_cA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 a=r_pkcD-q9-ctt7trBg_g:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_08,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607290159 On 6/23/2026 8:51 AM, Manivannan Sadhasivam wrote: > mhi_soc_reset() tries to reset the device by writing to the > MHI_SOC_RESET_REQ_OFFSET register. But it doesn't do a read-back to ensure > that the write gets flushed to the device before returning to the caller. > > This may lead to the delay (if implemented) on the caller to be > insufficient, if the posted write doesn't reach the device before the > delay. Interesting. Is the delay tight enough that a few ms will possibly blow it? Seems like a poorly defined delay. All the devices I'm familiar with take multiple seconds to boot (with some variability due to ddr training and thermal constraints), and if the reset triggers a crash dump, then its easily tens of seconds. Regardless, since this reset will either kill the pcie link, or disconnect the SoC from the link for a time, I've been trying to figure out how this change might break, but I haven't found a scenario, so I suspect this is good enough. > So add a read-back after writing to the MHI_SOC_RESET_REQ_OFFSET register. > > Fixes: b5a8d233a588 ("bus: mhi: core: Add device hardware reset support") > Reported-by: Alex Williamson > Closes: https://lore.kernel.org/linux-pci/20260622160822.09350246@shazbot.org > Signed-off-by: Manivannan Sadhasivam > --- > drivers/bus/mhi/host/main.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c > index 53c0ffe30070..4d458396233a 100644 > --- a/drivers/bus/mhi/host/main.c > +++ b/drivers/bus/mhi/host/main.c > @@ -170,6 +170,9 @@ EXPORT_SYMBOL_GPL(mhi_get_mhi_state); > > void mhi_soc_reset(struct mhi_controller *mhi_cntrl) > { > + int __maybe_unused ret; > + u32 tmp; > + > if (mhi_cntrl->reset) { > mhi_cntrl->reset(mhi_cntrl); > return; > @@ -178,6 +181,9 @@ void mhi_soc_reset(struct mhi_controller *mhi_cntrl) > /* Generic MHI SoC reset */ > mhi_write_reg(mhi_cntrl, mhi_cntrl->regs, MHI_SOC_RESET_REQ_OFFSET, > MHI_SOC_RESET_REQ); > + /* Flush the posted write to the device (ignore return value) */ > + ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, MHI_SOC_RESET_REQ_OFFSET, > + &tmp); If you wanted, you could fit this all on one line. word wrapping for a 3 char parameter seems a bit silly to me, but I suspect this is highly subjective. Reviewed-by: Jeff Hugo