From nobody Thu Oct 2 18:21:34 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 CA9AC3009CB; Fri, 12 Sep 2025 12:48:18 +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=1757681300; cv=none; b=lrNdDIrou05ulDoJi3/O9EY06ZlEeb8xJyA4EoL10XeDiwIhVVFx1LDhqaLCJi4fnkWEG9lHg7IWZewch9FYVrsGMaqcPBJKQZCp3s5BBNdBlJa1B6ac6NWaRfZDuUwJhDZ6NIRd54MxRQuEcWyPTKa9g7+yYoxb+zkYt20jl5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681300; c=relaxed/simple; bh=A8gyK/b7FnH631/sjkN75cT4RAPmZ51zNmokOEPbfmc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=nstBjdvVGGwpLgRFSCXt4FR3Dc1W0789Yvaqj3NHJ0IwEPVjA+T/vC+bhL3Js1D5ws8tTvlW7UrUEYjy6Gic2bt/LwLKw/qG8PVnXmIekTMuzOyn6Ky/wZWtcXgnSOTDcquw52KV3P1PKtKqJZU+iBTCmW1KnLlPDpL0yhm3X2I= 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=nVKm+wcb; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="nVKm+wcb" 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 58C9fMPm010866; Fri, 12 Sep 2025 12:48:15 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= M/N2VCoxkmJfnyTu9jjJe2fVaQO2YB0d3qkgApe6XaM=; b=nVKm+wcbmS7Fynxo zCUdSpMBgYoO5CM+MrqPLjMO5F+B0OCBMgH/ikxwGJumvmAD/BKYZniK6w4jgOo3 LTKunS0vt+g+A21t/QuxxS4/2rtpzuCIBlWPMLNyL3GwCloTZ0bc9F7BZE0yRMR8 ZzktXvsNKcJ7gI4UJoOI80si6mTITpFRt8SF3twBWBJfFdqshe1YAtUE1SMw+xlp zd4tzdIZgD1rrhW+t5kVwGR7s/UOav5pRsoyV+/SDDKF227CVw+iZzfEyQ6EkVtU 0QithUfoc0fPR0ExR8Xz7EyopJlAKcMjrheR+D4Okw3lZTtF9Zb11N3xogRb6bo1 5ZkWfw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 490e4mbff6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:15 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 58CCmEGj021533 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:14 GMT Received: from hu-vpernami-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.24; Fri, 12 Sep 2025 05:48:12 -0700 From: Vivek.Pernamitta@quicinc.com Date: Fri, 12 Sep 2025 18:18:05 +0530 Subject: [PATCH v4 1/6] bus: mhi: host: Add support for separate controller configurations for VF and PF 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: <20250912-uevent_vdev_next-20250911-v4-1-fa2f6ccd301b@quicinc.com> References: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> In-Reply-To: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> To: Manivannan Sadhasivam CC: , , , Vivek Pernamitta , Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757681290; l=2099; i=; s=20241114; h=from:subject:message-id; bh=zqF2I+MNJTHJf1rVfjfJ1iJ/E4tvhwf2lHcNDPwdJrM=; b=pkEqjtN+GFKi6Oy4Uic8WTXt3IFO7fJu9l7Rgxtuu9PwtHbWkTDsv14X2m71ukx6aw1ZOAWP8 K+XbKWoHOZlBwRwTfNCByIKiHFItAdSQ/6kGOGRMiI6JjKLDUJWWUpb X-Developer-Key: i=; a=ed25519; pk=HDwn8xReb8K52LA6/CJc6S9Zik8gDCZ5LO4Cypff71Y= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA2MDAzOCBTYWx0ZWRfXw76Kb61/fONE 2B8qaIRPP48hYbF4TW1NsbuMPDoTJwl/Nc+qHBdCS3QAjIsAv5cmxloClVW6h3A5FFXjb7xhNUx 9tV0l2+SkBqzfwKRD0c+cy1+NtV9peiEj55JxVF6ysFshXrMw9PS6c2RQZcmFVK8wDKpOKKpnHr bzMilpor6cDGbBKuQKhIZvZi+bFEqc73rru73ly82Z5mzS/vGxynNbUL7qX1NCrOQbA5u6qKX26 nU6+xeyt3i0FFcWDl0VtOi6Vyf/qVyv24nD6vVgaREJTvFc743rL6rcKm2Rmr7K8+pQ/mNQCBBH 5ExNBWQIKphEPB7KUt3k/yQtpKVYKr6bYY5ICz7CxYm4CF2rS8OXYM+pC/2XevgdnIwNsZrbw9o d9WzvFI0 X-Authority-Analysis: v=2.4 cv=J66q7BnS c=1 sm=1 tr=0 ts=68c4168f cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=8tVK0NU1EB3xojDYR3gA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: HK4Xi-LWLi8CEOxqKxN1NW4z7UVq7WEJ X-Proofpoint-ORIG-GUID: HK4Xi-LWLi8CEOxqKxN1NW4z7UVq7WEJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-12_04,2025-09-11_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 clxscore=1015 spamscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509060038 From: Vivek Pernamitta Implement support for separate controller configurations for both Virtual Functions (VF) and Physical Functions (PF). This enhancement allows for more flexible and efficient management of resources. The PF takes on a supervisory role and will have bootup information such as SAHARA, DIAG, and NDB (for file system sync data, etc.). VFs can handle resources associated with the main data movement of the Function are available to the SI (system image) as per PCIe SRIOV spec (rev 0.9 1.Architectural overview) Signed-off-by: Vivek Pernamitta Reviewed-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/pci_generic.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_= generic.c index 4564e2528775ed9f4ee6fe3dcbb2cd90b1966016..8a605cb3b8e1e54ef4e699700f3= f2660ad5cb093 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -34,6 +34,7 @@ /** * struct mhi_pci_dev_info - MHI PCI device specific information * @config: MHI controller configuration + * @vf_config: MHI controller configuration for Virtual function (optional) * @name: name of the PCI module * @fw: firmware path (if any) * @edl: emergency download mode firmware path (if any) @@ -47,6 +48,7 @@ */ struct mhi_pci_dev_info { const struct mhi_controller_config *config; + const struct mhi_controller_config *vf_config; const char *name; const char *fw; const char *edl; @@ -1299,9 +1301,14 @@ static int mhi_pci_probe(struct pci_dev *pdev, const= struct pci_device_id *id) return -ENOMEM; =20 INIT_WORK(&mhi_pdev->recovery_work, mhi_pci_recovery_work); + + if (pdev->is_virtfn && info->vf_config) + mhi_cntrl_config =3D info->vf_config; + else + mhi_cntrl_config =3D info->config; + timer_setup(&mhi_pdev->health_check_timer, health_check, 0); =20 - mhi_cntrl_config =3D info->config; mhi_cntrl =3D &mhi_pdev->mhi_cntrl; =20 mhi_cntrl->cntrl_dev =3D &pdev->dev; --=20 2.34.1 From nobody Thu Oct 2 18:21:34 2025 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 714C93081D6; Fri, 12 Sep 2025 12:48:21 +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=1757681303; cv=none; b=liVbQjN3rkZqcJhp/eBvb8jK4zW0SR2ow1MD32XwP4judbR4rpZwjs79os9+hcTczG5SmY+JP1pRj3GL3Toje39vTdhiMSjIi4x7wVeX5LDpnO4NHKK8B814tJ5CzsgU7ysJq2l4AFPuBgYwCMwYjxEuaBVtviFFynmnYt/bTWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681303; c=relaxed/simple; bh=QOq3V9j4sMR9Cf3J9bhf8IOAukpm08eA++Tt7jLk2CA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=gcU3IvISKHP7I4/Lwym5UunnFgxpa/pLWlO2LZhJgLlfJa/pYsjUVDkqkqnO6N7TVh0NgtFTbtJ0qc2UkMfhFxJNbF2PiyolFtpaGOLna8BPKZAuhI012dRVrJ2EhFZygITpuQ5Xcxrpp+iIxL6T+kDiy1VHG/HffM5p4trBjSU= 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=RPBOzsYU; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="RPBOzsYU" 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 58CBBRwL017563; Fri, 12 Sep 2025 12:48:18 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= LoeuIrkc+NE1IP6WAWmWrj0anbU9PNQRxeI3pV5ASq0=; b=RPBOzsYUUOAdfR6c 6OBsmeB7fUH9QAEHyeM9eM3JarrQaBm/TXa4pCpg6/xGNauWOgbFG6fFobA+semc ROzp16Px8mtDettHsBCCW1Vhg240mUKNB8LlhkoGQEH8BJ9p0Z3nKjdh4BRoelMB 7UYVrXyq0hZpfGAtzU7hwE6gPXy4WUssxmwvxFPIEs5h5DGco3hUr0+II22TG0BI hbBjaBM7vmKxmZY2ijamyY+qKye4PVFzXK73NuSrHbXd+lDa+Ii5NQDVqJJlEK6b ugpyYy10vQMTVM1mXDcTT57vKzrihSNtYhRFr2ZPd1lzpQHlwA3xpOPdJKy+Yvf/ B3THKQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 494jdx07yn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:18 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 58CCmHcM031281 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:17 GMT Received: from hu-vpernami-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.24; Fri, 12 Sep 2025 05:48:15 -0700 From: Vivek.Pernamitta@quicinc.com Date: Fri, 12 Sep 2025 18:18:06 +0530 Subject: [PATCH v4 2/6] bus: mhi: host: pci_generic: Read SUBSYSTEM_VENDOR_ID for VF's to check status 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: <20250912-uevent_vdev_next-20250911-v4-2-fa2f6ccd301b@quicinc.com> References: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> In-Reply-To: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> To: Manivannan Sadhasivam CC: , , , Vivek Pernamitta , Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757681290; l=5108; i=; s=20241114; h=from:subject:message-id; bh=AXyLfptTmmjYsJdMdKeFlbwmyFM1pw9zTX08UUH6tdo=; b=8DFT0Ez/agXCgi5pNjOMG8i9FhWz98qknTULvLYLIEfqJ7i2jRoEvpiWx9z1hhvipj+TYCkUk oG8IP9DWDDTDRea5Tby2RXuSwyQ1rn3/ise/1PCDCoz4+6Bm663S7vA X-Developer-Key: i=; a=ed25519; pk=HDwn8xReb8K52LA6/CJc6S9Zik8gDCZ5LO4Cypff71Y= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTEyMDEwNiBTYWx0ZWRfX4+3/WsvkKplX LUYCYgw7+sudp9KhE1PaNKIZ4k97o3Gt3WhcPXhnX5wstNgPH1kngGcfR4uxufEFRX06133Yj8p s1vVb9zr76M+xSBnxvGQFy3au22uFpRqD4TTB/wCOeCB8+ZPXxS3o376Fec0OEvmku2zN0cLQcN LTKOqe/jW09mAOML38iLK2sNRw0aIsJ8FYyww1L4/+SRpsg+x1Hpw74KDXRn4ZZMKvBrvYICEDB ZZ1oKLMU7QRZIbxpMKEOIqB0dNqjhqKUhhWcOZZezu0bgsnQQ3VJb7fPXQ1tOUeypMsdK6lRx93 wevfSAxdz4lpcJgGjO/xo8KuV0C0xjg0skNpxZXuWyLyBlkvreA0x0vjvOcko02Soc15MOeAFQY xv5EsPYU X-Proofpoint-GUID: hBhTQYaB_0ivQPp7l2brl6z1zX9MuxCE X-Authority-Analysis: v=2.4 cv=JMM7s9Kb c=1 sm=1 tr=0 ts=68c41692 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=xHIV5HlekO6mxpULEJIA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: hBhTQYaB_0ivQPp7l2brl6z1zX9MuxCE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-12_04,2025-09-11_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 clxscore=1015 suspectscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509120106 From: Vivek Pernamitta In SR-IOV enabled devices, reading the VF DEVICE/VENDOR ID register returns `FFFFh`, as specified in section 3.4.1.1 of the PCIe SR-IOV spec. To accurately determine device activity, read the PCIe VENDOR_ID of the Physical Function (PF) instead. Health check monitoring for Virtual Functions (VFs) has been disabled, since VFs are not physical functions and lack direct hardware control. This change prevents unnecessary CPU cycles from being consumed by VF health checks, which are both unintended and non-functional. Signed-off-by: Vivek Pernamitta Reviewed-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/pci_generic.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_= generic.c index 8a605cb3b8e1e54ef4e699700f3f2660ad5cb093..6fa16975e320212a50e0b68ddb3= 4db5ce711589c 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -1082,7 +1082,7 @@ static bool mhi_pci_is_alive(struct mhi_controller *m= hi_cntrl) struct pci_dev *pdev =3D to_pci_dev(mhi_cntrl->cntrl_dev); u16 vendor =3D 0; =20 - if (pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor)) + if (pci_read_config_word(pci_physfn(pdev), PCI_VENDOR_ID, &vendor)) return false; =20 if (vendor =3D=3D (u16) ~0 || vendor =3D=3D 0) @@ -1193,7 +1193,9 @@ static void mhi_pci_recovery_work(struct work_struct = *work) =20 dev_warn(&pdev->dev, "device recovery started\n"); =20 - timer_delete(&mhi_pdev->health_check_timer); + if (pdev->is_physfn) + timer_delete(&mhi_pdev->health_check_timer); + pm_runtime_forbid(&pdev->dev); =20 /* Clean up MHI state */ @@ -1220,7 +1222,10 @@ static void mhi_pci_recovery_work(struct work_struct= *work) dev_dbg(&pdev->dev, "Recovery completed\n"); =20 set_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status); - mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); + + if (pdev->is_physfn) + mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); + return; =20 err_unprepare: @@ -1307,7 +1312,9 @@ static int mhi_pci_probe(struct pci_dev *pdev, const = struct pci_device_id *id) else mhi_cntrl_config =3D info->config; =20 - timer_setup(&mhi_pdev->health_check_timer, health_check, 0); + /* Initialize health check monitor only for Physical functions */ + if (pdev->is_physfn) + timer_setup(&mhi_pdev->health_check_timer, health_check, 0); =20 mhi_cntrl =3D &mhi_pdev->mhi_cntrl; =20 @@ -1371,7 +1378,8 @@ static int mhi_pci_probe(struct pci_dev *pdev, const = struct pci_device_id *id) set_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status); =20 /* start health check */ - mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); + if (pdev->is_physfn) + mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); =20 /* Allow runtime suspend only if both PME from D3Hot and M3 are supported= */ if (pci_pme_capable(pdev, PCI_D3hot) && !(info->no_m3)) { @@ -1396,7 +1404,8 @@ static void mhi_pci_remove(struct pci_dev *pdev) struct mhi_pci_device *mhi_pdev =3D pci_get_drvdata(pdev); struct mhi_controller *mhi_cntrl =3D &mhi_pdev->mhi_cntrl; =20 - timer_delete_sync(&mhi_pdev->health_check_timer); + if (pdev->is_physfn) + timer_delete_sync(&mhi_pdev->health_check_timer); cancel_work_sync(&mhi_pdev->recovery_work); =20 if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { @@ -1424,7 +1433,8 @@ static void mhi_pci_reset_prepare(struct pci_dev *pde= v) =20 dev_info(&pdev->dev, "reset\n"); =20 - timer_delete(&mhi_pdev->health_check_timer); + if (pdev->is_physfn) + timer_delete(&mhi_pdev->health_check_timer); =20 /* Clean up MHI state */ if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { @@ -1469,7 +1479,8 @@ static void mhi_pci_reset_done(struct pci_dev *pdev) } =20 set_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status); - mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); + if (pdev->is_physfn) + mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); } =20 static pci_ers_result_t mhi_pci_error_detected(struct pci_dev *pdev, @@ -1534,7 +1545,9 @@ static int __maybe_unused mhi_pci_runtime_suspend(st= ruct device *dev) if (test_and_set_bit(MHI_PCI_DEV_SUSPENDED, &mhi_pdev->status)) return 0; =20 - timer_delete(&mhi_pdev->health_check_timer); + if (pdev->is_physfn) + timer_delete(&mhi_pdev->health_check_timer); + cancel_work_sync(&mhi_pdev->recovery_work); =20 if (!test_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status) || @@ -1585,7 +1598,8 @@ static int __maybe_unused mhi_pci_runtime_resume(stru= ct device *dev) } =20 /* Resume health check */ - mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); + if (pdev->is_physfn) + mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); =20 /* It can be a remote wakeup (no mhi runtime_get), update access time */ pm_runtime_mark_last_busy(dev); --=20 2.34.1 From nobody Thu Oct 2 18:21:34 2025 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 9C69E30AAA6; Fri, 12 Sep 2025 12:48:24 +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=1757681306; cv=none; b=dIPu+y+XZhSLHIVagH00RpNXGFycbzYyp5KBBbXX07XhYfxHEQVipGOMhvnHzsKxfHAeNIT8CfT3iNGujAQhjmEAJBH38wL9dez+3Am4PJurtzjnPNV/qVVJU737IxY2UbzGb7TqsNxVZZyVz0xKhOypxzEgFV0CTkJxhYV25/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681306; c=relaxed/simple; bh=O5W/iLg+SYsG8ivE2dyS3PJ1OuzWBrYBl+D/zbtlN5M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=aKf/7dGoDaRwW+MvND+ZHMFA2Q+AHi+T2PvMAnVlEwfEXeBg2dOLQvKXb70fx0VfEz8qGrHMIkrKPiwWEJoK6rUw+J9O+SmQlOvY9L0fVvVTKNMl8hMeQAm9IcGht3pAIjjNrX41litm+4G22qeOonYgAteBFfq/hIRNWiIgOVw= 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=Ok/Xn4Vw; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Ok/Xn4Vw" 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 58C9fNfG023198; Fri, 12 Sep 2025 12:48:20 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= BY6w3MvDLSZbR17JImCgGxFMLaXFEJvQHvsEyXiClCk=; b=Ok/Xn4VwvENtkiTz NHAgAE7VpjnRg9VU7QxpH0cssO5HYLvYAB/MzI9ojYHOQIj8HY/KdtquRoGtaDSI pRkIKhSN0kdYSabFlhxG1ZCNhrV/8sFeHUdmgdCBYdrJNSAg1UMFvL9gX7dbtONJ EGHz1J7SJmW7YQXQxD8WuwzUdipLUe4Pi/CrBKfRBfG41sYEGa04FrFIJ+4EWdsS 5u3n2sWo4V9Sd1YQcmUUD2Oh3pEhBNp5B/TBQgKgzHsnAF84aY2ExcjctmSdRf2V ZyhLELLd2t7QXanjkCmb+jMjjRjbvw/y71DfAJphwpQYCNzic78UeyhaNWmoORj8 E3IRtQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 491vc2fs7b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:20 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 58CCmJav001450 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:19 GMT Received: from hu-vpernami-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.24; Fri, 12 Sep 2025 05:48:17 -0700 From: Vivek.Pernamitta@quicinc.com Date: Fri, 12 Sep 2025 18:18:07 +0530 Subject: [PATCH v4 3/6] bus: mhi: host: pci_generic: Add SRIOV 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: <20250912-uevent_vdev_next-20250911-v4-3-fa2f6ccd301b@quicinc.com> References: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> In-Reply-To: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> To: Manivannan Sadhasivam CC: , , , Vivek Pernamitta , Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757681290; l=989; i=; s=20241114; h=from:subject:message-id; bh=izD2tI5ZGDuScnRmiYlS6sDVEl3t132qF7TBwq8F4Xk=; b=qDfS9f+8c/u0k6qS+CNX/+Leg2u956TYri+eIo7nXplGUzdsjK9DXhcSG5d5ol7uNCD4WnSfD dabM2GIKLAXAN5ITi9dqYG51iwyrOe3+1NnQzj6rr3gzPbz9Rk/cGZi X-Developer-Key: i=; a=ed25519; pk=HDwn8xReb8K52LA6/CJc6S9Zik8gDCZ5LO4Cypff71Y= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=FN4bx/os c=1 sm=1 tr=0 ts=68c41694 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=1E9kmim99rDzh7857o0A:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: zMLTlOMwLeAfsJFO7M3ucCA77pfIx3wd X-Proofpoint-GUID: zMLTlOMwLeAfsJFO7M3ucCA77pfIx3wd X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA4MDA5NCBTYWx0ZWRfX9WPH/APzwZBj saIHnj+8KpBVGMOzJzgL+wABnBTg3Kgy7PW0pl8QBG2+f3R2A6vN1shw50dRNu94XuqbHbCe7oX aa6guHx4Tylsg1hf2bgEF5M8AEpRyjnV+hi848SZVKSHvVZywk2xSczOBCrAWRru03k0MSqx81U TyBdSR2Ps6rd/DfqPvsWhBZvJDmW7qX1lIqOxXqO9/wl8BED/mKV/IgQQTwYlwlTiAiHgthPSTj p+xtAUt5xxZkuwyym486ngOthxPm/uggkrpQQGXNMR9OekkBxwNwhNWRmXZ0QF4oWTDcQ1YR1rW e5+F8eTAbZKFdwczThV43JtcTYNGGZJHQmT60A6nfptf9U6zCKBR7/ME5pr2XPIEn5y4HqUWEfq 3AtE9Dmp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-12_04,2025-09-11_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 clxscore=1015 phishscore=0 adultscore=0 bulkscore=0 impostorscore=0 malwarescore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509080094 From: Vivek Pernamitta pci_sriov_configure_simple() will enable or disable SR-IOV for devices that don't require any specific PF setup before enabling SR-IOV. Signed-off-by: Vivek Pernamitta Reviewed-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/pci_generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_= generic.c index 6fa16975e320212a50e0b68ddb34db5ce711589c..6d0bade288265d9fdab8555c089= c9153b642454f 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -1685,7 +1685,8 @@ static struct pci_driver mhi_pci_driver =3D { .remove =3D mhi_pci_remove, .shutdown =3D mhi_pci_shutdown, .err_handler =3D &mhi_pci_err_handler, - .driver.pm =3D &mhi_pci_pm_ops + .driver.pm =3D &mhi_pci_pm_ops, + .sriov_configure =3D pci_sriov_configure_simple, }; module_pci_driver(mhi_pci_driver); =20 --=20 2.34.1 From nobody Thu Oct 2 18:21:34 2025 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 C170130AAC9; Fri, 12 Sep 2025 12:48:25 +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=1757681307; cv=none; b=lBfPtKdWyf4TGrmOsVapc/iO2lWJzHFO2QjLI94lZYjnDjJrvFHg4sRA1y49YRtzHgoIaSokksqDVxilYRwZ580X1bGlOYFTYVE/nZLbVZ248agBTeD6l4i13/Tz/sVbRE9XTtkX15z2nwxS93t3h3oVNoeF8WPGwLYYoeAJ8fA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681307; c=relaxed/simple; bh=1/OAOf1Knm+GQqWP2XcBUU0iDLGnGgVhn0wCwTlsKEc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=KtbIANmZHJbyJpBSJqBy+oJLugFfAaxz9spAY9fuJrT+kaw+knAaji+ZZL/1gZBqvI4eXDqi7ro4elL/DYN7QlO/8caIxGZSoEnFubPhZUV+oU/atj7lTqoxCpxEhCnmwLsQWhDy4D/E1lLpXkv4Ir37npif/DDI3RgJs5pTlQ8= 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=iNsCxtD+; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="iNsCxtD+" 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 58C9fJm1014005; Fri, 12 Sep 2025 12:48:22 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= GqtXLX4RCyzYfLsMrU4yk0EetT6O5w+qHPjCzHo8z9M=; b=iNsCxtD+PNn5SJew WIRLAatt0sYCwk/2HneiKix4A3xjTZUvGyg3FRAr2gpuJkFDP0+GzzLVF56X1a2c WOMb253nmmb24vlGcxTDFK13UEIYBQj437lm7k4l1GWTedVgJXwCOF3FN40nApt0 ETYP7sD+SVcIYg3Y0LwRoj6sk0CoHsEyr8jE2lqfsSkzZv5u4Dc4qoRkZnrlSRJ0 6IkXcT1ryWKOho0A7K0XmY63mF/WFHdB+DS8FtfzpSOI0TnPmeeNW60snSzhcbQk pCp6b3+rBEm0IDQONYTLjO0Z08tfs8xefVV4SqsiPXmhpsQ7mKdoSSOK9ipLRrwJ 7jq4Ng== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 493qphwcqk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:22 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 58CCmLvO031744 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:21 GMT Received: from hu-vpernami-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.24; Fri, 12 Sep 2025 05:48:19 -0700 From: Vivek.Pernamitta@quicinc.com Date: Fri, 12 Sep 2025 18:18:08 +0530 Subject: [PATCH v4 4/6] bus: mhi: host: pci_generic: Remove MHI driver and ensure graceful device recovery 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: <20250912-uevent_vdev_next-20250911-v4-4-fa2f6ccd301b@quicinc.com> References: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> In-Reply-To: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> To: Manivannan Sadhasivam CC: , , , Vivek Pernamitta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757681290; l=3164; i=; s=20241114; h=from:subject:message-id; bh=lTtKFTczPEu4XHkccAZ6GU/mhBb4jai0rmDJzFOiX5M=; b=MeYv66tc6pCUBIbBjtl4H5GDP3K68V/dzoo2OBM6SYylRvomkVxljZBpymv966naBIqLM6uVU x2Bu/R0BYO5A7OAd7CA1FVd57+/QuQiHwZDsdU50oPAegR1d4W7Foa2 X-Developer-Key: i=; a=ed25519; pk=HDwn8xReb8K52LA6/CJc6S9Zik8gDCZ5LO4Cypff71Y= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=aPDwqa9m c=1 sm=1 tr=0 ts=68c41696 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=WvyZO_AjdMnUHqvMN-4A:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: mJAb-pnePv7v-okrz5xFK8-z03Wj0Qks X-Proofpoint-ORIG-GUID: mJAb-pnePv7v-okrz5xFK8-z03Wj0Qks X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTExMDA0MCBTYWx0ZWRfX5lca7WUdUJxC w9g4cIxn0hYRYtJk9M1goGQ3NUonuGtX6PMfjcR+LX/bAe3aibCX+KXHtOGLvG8AdEZm4HfOLxN 5dqH/rIPMy2R2kxtgxEk5gsj9xxm4RGbHIfmvfq/Md5AlUjkHxy8nMliqF0aXHLrMz9G2Zdw9tz /JNYEhQi/XijtRlrV+v0GuT9yI7j50DKQk5ZSABGkSiN5RKFfeJ+LDihIbtGe5Oi8gU9BUQ7nLs AbFjFAJNDMC/HBNimB/0w3tveWp3aevzn/TBkZYWGYLUcbSZEtmRYUqtXLv1RKpEW62SONe5mcU fcjN7aPV1P8ews2gnZNu2ASCmgAWgaKmiR8WIOrv6zMa0lRaxPkD50gIKl5OR2LbaTpd3mePPjM o9IFk2BJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-12_04,2025-09-11_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 impostorscore=0 malwarescore=0 bulkscore=0 clxscore=1015 spamscore=0 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509110040 From: Vivek Pernamitta So, When the MHI driver is removed from the host side, it is essential to ensure a clean and stable recovery of the device. This commit introduces the following steps to achieve that: 1. Disable SR-IOV for any SR-IOV-enabled devices on the Physical Function. 2. Perform a SOC_RESET on the PF to fully reset the device. Disabling SR-IOV ensures all Virtual Functions (VFs) are properly shutdown, preventing issues during the reset process. The SOC_RESET guarantees that the PF is restored to a known good state. If soc_reset is not performed device at driver remove, device will be stuck in mission mode state and subsequent driver insert/power_up will not proceed further. Signed-off-by: Vivek Pernamitta --- drivers/bus/mhi/host/pci_generic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_= generic.c index 6d0bade288265d9fdab8555c089c9153b642454f..4de7e56d4b8819f1b26a34b8a96= 49327314169dd 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -45,6 +45,7 @@ * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead * of inband wake support (such as sdx24) * @no_m3: M3 not supported + * @reset_on_remove: Set true for devices that require SoC during driver r= emoval */ struct mhi_pci_dev_info { const struct mhi_controller_config *config; @@ -58,6 +59,7 @@ struct mhi_pci_dev_info { unsigned int mru_default; bool sideband_wake; bool no_m3; + bool reset_on_remove; }; =20 #define MHI_CHANNEL_CONFIG_UL(ch_num, ch_name, el_count, ev_ring) \ @@ -300,6 +302,7 @@ static const struct mhi_pci_dev_info mhi_qcom_qdu100_in= fo =3D { .dma_data_width =3D 32, .sideband_wake =3D false, .no_m3 =3D true, + .reset_on_remove =3D true, }; =20 static const struct mhi_channel_config mhi_qcom_sa8775p_channels[] =3D { @@ -1027,6 +1030,7 @@ struct mhi_pci_device { struct work_struct recovery_work; struct timer_list health_check_timer; unsigned long status; + bool reset_on_remove; }; =20 static int mhi_pci_read_reg(struct mhi_controller *mhi_cntrl, @@ -1332,6 +1336,9 @@ static int mhi_pci_probe(struct pci_dev *pdev, const = struct pci_device_id *id) mhi_cntrl->mru =3D info->mru_default; mhi_cntrl->name =3D info->name; =20 + if (pdev->is_physfn) + mhi_pdev->reset_on_remove =3D info->reset_on_remove; + if (info->edl_trigger) mhi_cntrl->edl_trigger =3D mhi_pci_generic_edl_trigger; =20 @@ -1404,6 +1411,8 @@ static void mhi_pci_remove(struct pci_dev *pdev) struct mhi_pci_device *mhi_pdev =3D pci_get_drvdata(pdev); struct mhi_controller *mhi_cntrl =3D &mhi_pdev->mhi_cntrl; =20 + pci_disable_sriov(pdev); + if (pdev->is_physfn) timer_delete_sync(&mhi_pdev->health_check_timer); cancel_work_sync(&mhi_pdev->recovery_work); @@ -1417,6 +1426,9 @@ static void mhi_pci_remove(struct pci_dev *pdev) if (pci_pme_capable(pdev, PCI_D3hot)) pm_runtime_get_noresume(&pdev->dev); =20 + if (mhi_pdev->reset_on_remove) + mhi_soc_reset(mhi_cntrl); + mhi_unregister_controller(mhi_cntrl); } =20 --=20 2.34.1 From nobody Thu Oct 2 18:21:34 2025 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 8BBAB30B527; Fri, 12 Sep 2025 12:48:27 +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=1757681309; cv=none; b=rd5EycmATYwnVgyyD2FIouHgdQjF0gU1dplnu8gStUbz0T930plUqm2NYXm8gVsX2pyJTesMEGLSFoeeY9qX4lJ9gVFYOYQTzJ6/Ij9otwpBLebuv9OcD5ELsACUwR8H5JQgt27pFPEPvcOoS4Jefi6eRiU57J7WF8GCzqSus1k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681309; c=relaxed/simple; bh=UF1CIMCevu9HbluOPb99Yw0/05oUTlgecK3A7mMUSuU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=QqiLhdiLal9UQye5F0cGXj3464V1qMLZDSDsvkUJZroJzAGYRb4a/RzyFCz6owVd/BSwWLJGl4e7ApHt6NyfYj74LVnlrwf5H6H4tRhO0lgdWPzA/Xj+CKb/lwV6hu0A2iiQsXY4RiS8/35bq4nQIfGUNTgFKSko8ICa9eMoQLs= 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=nl6fKb4Y; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="nl6fKb4Y" 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 58C9fijH023969; Fri, 12 Sep 2025 12:48:24 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= 7k3f3m6IS8fJ/gmBWpXzmShGYlKp7WFy3tyMFbp9syE=; b=nl6fKb4YWv7xh4oc wq5x+seHgLNMsm1VC84payoxXtOrVGugJdwI5J50VyduTyqd1K+I+oAxMRNfyDud 0ggcdZVdxHU2vVnowj92u18J4ebGAdXH2YYZ1CRdY0hnE5JU775aGsJjsMjlFp2W xJTzPrfDCIAo5a21OjwYAYGRrNOzqm0zHGr0XiMYaSUseJDyz8DWf6ari8ca7te7 YDvGTZewwRgZiZOWNU4bxke6grngJBMus/iwICbG4wDu6emr1JWYwmLKIxAW9oSv D6Y+UpKYtwal9RbSwfl2Cfh7Bbu2ScryIw3fuabt3+E8jPIusUizzJZCLOEoh+zU 94cX6w== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 491vc2fs7m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:24 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 58CCmNYO031754 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:23 GMT Received: from hu-vpernami-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.24; Fri, 12 Sep 2025 05:48:21 -0700 From: Vivek.Pernamitta@quicinc.com Date: Fri, 12 Sep 2025 18:18:09 +0530 Subject: [PATCH v4 5/6] bus: mhi: core: Improve mhi_sync_power_up handling for SYS_ERR state 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: <20250912-uevent_vdev_next-20250911-v4-5-fa2f6ccd301b@quicinc.com> References: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> In-Reply-To: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> To: Manivannan Sadhasivam CC: , , , Vivek Pernamitta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757681290; l=2001; i=; s=20241114; h=from:subject:message-id; bh=YKwSKBs+8PzFfcdnAnUQhAssZGEFmql2m+8BzXL/FgQ=; b=8kFAWW0Se94mzr+rAaeaNqEIAn2WIpFVDoyiJNxRx7hToDCBICppRn2BRfoz8jf062V1G6oNf fgEJULUtNGzAphe/QiXuR0IPiaoIXI9Am8axG1AA2CvUfcmwh85ZBjq X-Developer-Key: i=; a=ed25519; pk=HDwn8xReb8K52LA6/CJc6S9Zik8gDCZ5LO4Cypff71Y= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=FN4bx/os c=1 sm=1 tr=0 ts=68c41698 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=d564mSNedCF9_XSSoE4A:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: hayx54-gMvt7acqikrw8seA_BOjKvmfH X-Proofpoint-GUID: hayx54-gMvt7acqikrw8seA_BOjKvmfH X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA4MDA5NCBTYWx0ZWRfX1/8w2Xpo9qTo ZWP6+6yyCf13iXUyM8PF0ZT0tcMdfHp0vQ+MS3SFK/RY10SUJWU51I+dgSLj/j5PP8MAzymXqU0 TXTIpIN57RxyPdsb7UP2L0urGLVHZUUeRRQDfRBI9n3oRxllvTaQXlur/O1ciny6B8q7Ite7ejZ RhDqreSDmmcoeUEqwgp4B7pII3VAOc4vHwnxKgwWE6IZ5gtZ+1EEaxhFUUtRgcj1NsRReXnAHT0 QbGjKyGUzAU0a03DNNdvQAcAxkrEc2erPk619YYNkKdhaakuKUaMoZvlCClSHm4AZ03t4qs7GPG namkN3EwWr0zKK4Q8odpee/iLuc6abeBZ7oZIL1zo817XRE3q3HjGQ2frlAmp9nfeI3PQr2TkWw TTPnx9MD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-12_04,2025-09-11_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 clxscore=1015 phishscore=0 adultscore=0 bulkscore=0 impostorscore=0 malwarescore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509080094 From: Vivek Pernamitta Ensure mhi_sync_power_up waits for Mission Mode after SYS_ERR Allow mhi_sync_power_up to handle SYS_ERR during power-up, reboot, or recovery. Avoid premature exit when MHI_PM_IN_ERROR_STATE is seen. Treat SYS_ERR as a valid state and let its handler process the error. Queue the next transition to Mission Mode instead of aborting early. Prevent teardown before SYS_ERR is serviced to enable proper recovery. Improve robustness by ensuring Mission Mode is reached after SYS_ERR. Signed-off-by: Vivek Pernamitta --- drivers/bus/mhi/host/internal.h | 2 ++ drivers/bus/mhi/host/pm.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/interna= l.h index 034be33565b78eff9bdefd93faa4f3ce93825bad..9f815cfac763e1a33f55804cfd7= f3df9cf53f89a 100644 --- a/drivers/bus/mhi/host/internal.h +++ b/drivers/bus/mhi/host/internal.h @@ -170,6 +170,8 @@ enum mhi_pm_state { MHI_PM_IN_ERROR_STATE(pm_state)) #define MHI_PM_IN_SUSPEND_STATE(pm_state) (pm_state & \ (MHI_PM_M3_ENTER | MHI_PM_M3)) +#define MHI_PM_FATAL_ERROR(pm_state) ((pm_state =3D=3D MHI_PM_FW_DL_ERR)= || \ + (pm_state >=3D MHI_PM_SYS_ERR_FAIL)) =20 #define NR_OF_CMD_RINGS 1 #define CMD_EL_PER_RING 128 diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c index 33d92bf2fc3ed48db5f7fe80e4f0ef9fe2d2f2ab..31b20c07de9ee7006dbb81e3ab2= fbf6e66396d98 100644 --- a/drivers/bus/mhi/host/pm.c +++ b/drivers/bus/mhi/host/pm.c @@ -1279,7 +1279,7 @@ int mhi_sync_power_up(struct mhi_controller *mhi_cntr= l) mhi_cntrl->ready_timeout_ms : mhi_cntrl->timeout_ms; wait_event_timeout(mhi_cntrl->state_event, MHI_IN_MISSION_MODE(mhi_cntrl->ee) || - MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), + MHI_PM_FATAL_ERROR(mhi_cntrl->pm_state), msecs_to_jiffies(timeout_ms)); =20 ret =3D (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -ETIMEDOUT; --=20 2.34.1 From nobody Thu Oct 2 18:21:34 2025 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 BAC1430C62A; Fri, 12 Sep 2025 12:48:29 +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=1757681311; cv=none; b=JR/k9W78CMwvCIReYpCGagZn0zmvs4VHaLpfvaDudVKFo/InHDJI2y7OICrbEAh2ouRwy2LDCnyZfDtpU/MuFCxuE6k85rFZUuEtd/oz9QQ5xFM1YQ6w5fDG4+EkPRWomJiAKm2moonyhUA0QbX3lBRQuNwrJIBd77Q3DSPz4go= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681311; c=relaxed/simple; bh=4SFuEubmFaiGps0CP3Ly5iZC/s5WN25OLjJ+LpWzhts=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=TKwooeV7AOqODQrWf/54/JqZBIY1sC7Iv9v65hlNULHMQmRO4cOq80IcjgnQKZKA9OYq5frah8TuwiNxrG6sappuRZmSsWax3v6NRU0vydXHa3AnfNBW67Zl9kqKmWKAsW4DVmwqtK/+6YzDV/RnyobligRbwTA4oGeINUezMLc= 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=O8Jq+DOG; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="O8Jq+DOG" 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 58C9fKJC009094; Fri, 12 Sep 2025 12:48:27 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= MsGGPNwY8cXigk7bjzPUFp93nvN9ZPJmkA14HYaXLBQ=; b=O8Jq+DOG4V66LTOc 3a1E6sCuhHOPWdvHcUc4iySlnHRGKMAufqhqj++/l1FR5VCnzoKpJFE5XvoOMPR8 l4MPVPfkEJCNsKeNeWoi0oYlEZjMQv+b7JrfwYXgsj9SEWNWbhP0w7l1mTXLUj+7 3rKiNustZ4U/fGv090KhGJCQlmFuUHWLa8jOvv2alqhZ2mrMqi3Yemn0eCFppd3m 9OT1SUoeQCkdy3ucN6r3hScmRj/eX9Haifad2jt1XSu9EPIDtCTgFMJbG9776GCl T1mehqMFD1bMeKZJXWQZUibYDR0eNFPz5SWDD6hYg3ksFhnr8mwjvdV0j6kcRAyR vCgCmQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 490cj13mqh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:26 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 58CCmPXO014792 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Sep 2025 12:48:25 GMT Received: from hu-vpernami-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.24; Fri, 12 Sep 2025 05:48:23 -0700 From: Vivek.Pernamitta@quicinc.com Date: Fri, 12 Sep 2025 18:18:10 +0530 Subject: [PATCH v4 6/6] bus: mhi: host: pci_generic: Support independent DMA mask for VFs 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: <20250912-uevent_vdev_next-20250911-v4-6-fa2f6ccd301b@quicinc.com> References: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> In-Reply-To: <20250912-uevent_vdev_next-20250911-v4-0-fa2f6ccd301b@quicinc.com> To: Manivannan Sadhasivam CC: , , , Vivek Pernamitta X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757681290; l=3681; i=; s=20241114; h=from:subject:message-id; bh=gWNq35DSTvJwD2BrTCkoj2BC1wvazwuSQspATqlZUbk=; b=M+56bPSVELGRXP/k56OnMe4dEpxh5XwWofbURhe9Ef7BqTNbt6hxJ0Nk01cFoUCEebazQmuw0 DU87+ChbbYxCF9OtltP2GHiD/bFMtm3SdyUm3Z6YIHUuQs3ALe7nu+y X-Developer-Key: i=; a=ed25519; pk=HDwn8xReb8K52LA6/CJc6S9Zik8gDCZ5LO4Cypff71Y= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: sH7FGgFly8voxh4jOQqas3u5VZD6_78Q X-Proofpoint-GUID: sH7FGgFly8voxh4jOQqas3u5VZD6_78Q X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA2MDAyNCBTYWx0ZWRfX3RwYJ9NnkMG3 hVZNStug9rRHBX0Z+crNPQbKelRyRc9J42pRIYdCLl9CbPzjWiunv6GHhPEYhX9eFIqHFhQEXq7 X5MWJRSlo/UPjIDbxHx33qBsTV0sYhIJZ3wYiGagTdu1alQosPPphKoDSRGapAiIlCbI2z0BYzC kNKabI0rpCqY8wrDpTbauQ7hOdI8PaTgO2EgObnTDae/ciq9HH8YYylaIkf136t1osfR/A0PpPz OAc7+9pGyE8sokV3UQOBv46E/hya8Ne5hg92iNm+xxSu02A9i+nBBqkDuX680SLBNTpejeA3p/x D+sJHkKtiFTXQTSuDDuIbHA1FMM9pSg3fxoergVOPqWeC7Y5p90eaVQcVarsEWXYpvbKmh70545 29JWuydW X-Authority-Analysis: v=2.4 cv=QeFmvtbv c=1 sm=1 tr=0 ts=68c4169a cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=B_Hsn4pIL-mR84e0YfAA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-12_04,2025-09-11_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 clxscore=1015 spamscore=0 impostorscore=0 bulkscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509060024 From: Vivek Pernamitta Certain devices like QDU100 bootloader support only up to a 32-bit DMA address range. However, Virtual Functions (VFs) are enabled only after the device enters Mission Mode and can support higher DMA address ranges (up to 40 bits). A 32-bit DMA mask limits addressable space to 4GiB, which is insufficient for data transfer requirements over VFs on platforms like QDU100. These devices require larger memory regions to be mapped for efficient VF operation. To address this, configure `dma_mask` independently for Physical Functions (PFs) and Virtual Functions (VFs), allowing VFs to use higher DMA mask values where supported. As per PCIe SR-IOV specification (rev 0.9, Section 1), VFs are capable of handling resources associated with the main data movement of the Function. This change ensures compatibility with bootloaders that have limited DMA capabilities while enabling full VF functionality once the device reaches Mission Mode. Signed-off-by: Vivek Pernamitta --- drivers/bus/mhi/host/pci_generic.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_= generic.c index 4de7e56d4b8819f1b26a34b8a9649327314169dd..b188bbf7de042d8b9aa0dde1217= d2c86558c3caf 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -41,6 +41,7 @@ * @edl_trigger: capable of triggering EDL mode in the device (if supporte= d) * @bar_num: PCI base address register to use for MHI MMIO register space * @dma_data_width: DMA transfer word size (32 or 64 bits) + * @vf_dma_data_width: DMA transfer word size for VF's (optional) * @mru_default: default MRU size for MBIM network packets * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead * of inband wake support (such as sdx24) @@ -56,6 +57,7 @@ struct mhi_pci_dev_info { bool edl_trigger; unsigned int bar_num; unsigned int dma_data_width; + unsigned int vf_dma_data_width; unsigned int mru_default; bool sideband_wake; bool no_m3; @@ -300,6 +302,7 @@ static const struct mhi_pci_dev_info mhi_qcom_qdu100_in= fo =3D { .config =3D &mhi_qcom_qdu100_config, .bar_num =3D MHI_PCI_DEFAULT_BAR_NUM, .dma_data_width =3D 32, + .vf_dma_data_width =3D 40, .sideband_wake =3D false, .no_m3 =3D true, .reset_on_remove =3D true, @@ -1300,6 +1303,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const = struct pci_device_id *id) const struct mhi_controller_config *mhi_cntrl_config; struct mhi_pci_device *mhi_pdev; struct mhi_controller *mhi_cntrl; + unsigned int dma_data_width; int err; =20 dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name); @@ -1322,9 +1326,12 @@ static int mhi_pci_probe(struct pci_dev *pdev, const= struct pci_device_id *id) =20 mhi_cntrl =3D &mhi_pdev->mhi_cntrl; =20 + dma_data_width =3D (pdev->is_virtfn && info->vf_dma_data_width) ? + info->vf_dma_data_width : info->dma_data_width; + mhi_cntrl->cntrl_dev =3D &pdev->dev; mhi_cntrl->iova_start =3D 0; - mhi_cntrl->iova_stop =3D (dma_addr_t)DMA_BIT_MASK(info->dma_data_width); + mhi_cntrl->iova_stop =3D (dma_addr_t)DMA_BIT_MASK(dma_data_width); mhi_cntrl->fw_image =3D info->fw; mhi_cntrl->edl_image =3D info->edl; =20 @@ -1348,7 +1355,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const = struct pci_device_id *id) mhi_cntrl->wake_toggle =3D mhi_pci_wake_toggle_nop; } =20 - err =3D mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(info->dma_da= ta_width)); + err =3D mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(dma_data_wid= th)); if (err) return err; =20 --=20 2.34.1