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 CD82E3EBF15 for ; Mon, 15 Jun 2026 13:07:19 +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=1781528842; cv=none; b=c1nfyna9U4+pyCMTvSOiC9hHNkm/D32J3+qi2XzNjTxOsjDXbXoaGf+89/yl77KOGbK8Mgg5BOJ9PzkUJlXdYELRknx9FaW2Jc3Mc9rmWmhH3E9hBw175SKCpdI3JxWmwZI7MPX3kf5orJmPpCwKNle1vehIvBUo7LMxIBaWGDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781528842; c=relaxed/simple; bh=mM80Ae8XxnzS51Dw4Pw58HMVr5lZn9bOwL/mMk9poQo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lq3iaMiDbv2bVyMznfJa3bHNZNR9tgqdO9v6W4rI+vFWniIj16Rky89Baqm6Q567kp+byhv+jnYVggzlcbWu4vPyKZayYxLN/zjrSpf8HXuO4C4S44PwjeiOgFpDucaNTWSQWuaOOWqkLWeTfQoImiH1g+mMKzDtbR/2vxbqLOs= 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=k2NnFh8O; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=MIyYKKn1; 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="k2NnFh8O"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="MIyYKKn1" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65FCZnMV529556 for ; Mon, 15 Jun 2026 13:07:19 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= HvxVu7ZMj0GrNYVnvEx5o+aB0JEz3pjwUB8+jM1GNAE=; b=k2NnFh8OTE87IxoX b/yqlUzI6TGw5uqop0QKf2e8vEKKI3wI9Zf4QbFK6n4wJgBORCv0KyBBZ4kU1GVT sj++RiR35ktuXs4SxZ4JGm4gXyGXFn0kZqL7F6wd34eaznVEwTfp5Tcim/UAKlMf xth0XqvsvdYNODjm6FgT5cIHw3naQ6IBgZdoE+KMlPvOr2zcP7dAyMsWURP4uArf y03G5nwbEuoi0hWdojyAA9buhKBcqPmKwA1stx3KMUwH4pcGleWeCfZMXJLdaLPD vnFYhroCkcRegNCDnvd9LJ1eX1BrDYVMoSEVAz1zu5b5s8JJlifQgpldjI0wqGZ2 cLli9w== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4eter20tp9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 15 Jun 2026 13:07:18 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-8423f3e4728so2402934b3a.2 for ; Mon, 15 Jun 2026 06:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781528838; x=1782133638; darn=vger.kernel.org; h=content-transfer-encoding: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; bh=HvxVu7ZMj0GrNYVnvEx5o+aB0JEz3pjwUB8+jM1GNAE=; b=MIyYKKn1uuvQRovecjBFAAInTpAFQ1jjRGI6yGNuGL2G7qT8vURHgvi4y5XNN/MocL kZQNvp8D1GvXWbSj/sSLerZ2GLg/rWFCmQAngiIPf5M6YGw9OH6L1HCr7sB+RXc8vEHs JoIaw1ogdh3homHL+Bfws113u8APqorm0pwoCWxrCgxklaGA8dFrH8PwpOoiiB0QHAca keMwQIvRWwtvt6oDLcRdeHmlGWeSnM8DOuEcs2EenHopZht8H3GfJGN1PJC4MODzTLLp V5Clz358uvKRj8lxCm04MAISFB0fg3D31Q3ha69rYk/11xN1tjR8AXz4TdtH7+0kNq/3 cfpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781528838; x=1782133638; h=content-transfer-encoding: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; bh=HvxVu7ZMj0GrNYVnvEx5o+aB0JEz3pjwUB8+jM1GNAE=; b=DEAjWxCc7PfRQ5UeEqeFe7UVg1cPaAkhgfWD+QtWTj0YoT0R+mWx4g3vl+J/qj39xq pzeRGM/+qPCl/v0tDbOkp+hRYykjOQiDxlNOqg7MlG8R9K+aTnU3Ju616+riUDCDXPuU ktkpZfY1SpDhmWPY4AytNvCb52u27+Kcr+eLCvBSLW9xpzNm8sbeQI+vVprjEBfPPdoK bsO0fiPjSpS3PUgQrdtSg4UYeArtVJOFyirpkKWhgOFl8IrBNUqFrB5g4+DURjEnWabR tyBztxTp7vPyXQsSyimoWYP0cEOlEoK0pPXb3Q9X9bSS5lVQ7O6vU6kVfxEzJ5SC4hLC RLXw== X-Forwarded-Encrypted: i=1; AFNElJ+sDcuvMer9MnGD/egWuHLHC1H9e6OyGtwasnHxhhJCEN7Mdw4OvC0VHojQO1kTLMStQ4reT6nMBpt0Eoc=@vger.kernel.org X-Gm-Message-State: AOJu0YxAFu2yS6Mh0TUFOjAI3VudB7XBr5Hxjg4TJNCtfCLmDcUCDtEj BGSF13HcXAhKG8+ACCWB8CnJjqvcNFmiO1kaHCWq2XUoGlA++PfTY3HHyyidt1UeZwlfjZGqCz0 5sK2mE1HUyi7elDMlCpWp6JmQ+okDeMKXmsilyVEGDM/h3nCMsCXZWtw4aFeg5Dzpp1Y= X-Gm-Gg: Acq92OE6qI0Pph/7u7P6ygH/3BYoMpkt6iVLfzTXZSF9XUlG9uM2ek/BYDsehldKWlS PXX7Pm/Yz4gsCvQT/t0ywV6pbA9JaKrfSqaZusC8Na4DICqGX1DR0JfcHvy7xV4YLHGNJhrsWaU dyBFylkVKjVpcM/pcs3/KsHrXAyMmu4c7NPLY6kepp1yj7tB/r5+KqBmo3I57OSM9pdsAOFW6eI kCuW8Vw6ho864Z5Y0+pj+T9/n0JTrMhHKf/hZ0OhYrUhLem3bhh5W1zyT5BkMO3Yu4wH4+URU1E 4+imPbPBmIpwAnRs6IMQcklvYYz4vp69aruafu9wfqflxbexhSpQm0SZ8Ta7+MJvmODGBR8WGrn 3KZrlC+1iyz5ZVVETe70j9yHBEet3YoqAGB3dC/n1N8qDxeAuPA== X-Received: by 2002:a05:6a00:4fc7:b0:842:54c1:8e15 with SMTP id d2e1a72fcca58-8434ce42058mr15689255b3a.29.1781528837800; Mon, 15 Jun 2026 06:07:17 -0700 (PDT) X-Received: by 2002:a05:6a00:4fc7:b0:842:54c1:8e15 with SMTP id d2e1a72fcca58-8434ce42058mr15689210b3a.29.1781528837300; Mon, 15 Jun 2026 06:07:17 -0700 (PDT) Received: from [10.219.57.228] ([202.46.23.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8434b04808dsm10116612b3a.52.2026.06.15.06.07.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jun 2026 06:07:16 -0700 (PDT) Message-ID: Date: Mon, 15 Jun 2026 18:36:51 +0530 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 v2 2/6] iommu/arm-smmu: Add interconnect bandwidth voting support To: Dmitry Baryshkov Cc: Will Deacon , Robin Murphy , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20260526-smmu_interconnect_addition-v2-0-2a6d8ca30d63@oss.qualcomm.com> <20260526-smmu_interconnect_addition-v2-2-2a6d8ca30d63@oss.qualcomm.com> <7xfxlxfqjcqdzl6gckaoyy2ioefglc7bgi66yv5khrbl6fi2zc@ivtiukdaj4jv> Content-Language: en-US From: Bibek Kumar Patro In-Reply-To: <7xfxlxfqjcqdzl6gckaoyy2ioefglc7bgi66yv5khrbl6fi2zc@ivtiukdaj4jv> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE1MDEzOCBTYWx0ZWRfX/s+BXXyuILGp MtB2SqvWoN7J2iTsBTbo6FojqRCKZMUP0ohGNWnGCZEZM0vkmwmDYesNQHP3uvnE1YddewbS3ip AFPi/vj0T8GyutVpcWrSyuJrPhcyw0w= X-Proofpoint-GUID: kKV5M7kR4Zqjc14AgzV1dG_iWSl-dGjJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE1MDEzOCBTYWx0ZWRfXwVCFEprm8Py/ +O1cm0BDqaiQmyge0dMyYW7niQV8dmtiHph8RrLjWYql9t1AL7oDkZPxplzwLEHLgKAXr/pPuhZ sySvXSLxn5LkVZjDiwAbQyK+ndIZMllH7AWrWf4tMaBEgzny83guvpjWNh1mDg1bHLeycvTN7jb D3q0rNfUcwUuXQy1C+/GubMoGTfiC5vxW6MMYnr68rUOwaSdK4OvQxo8nWwJ3kS7RNE58AQ4u9j faqMShh6oNdj06y8dbB7iqtq+D0sAdjhg/V27ZPOIRkA33yx8fL6lj194ZYTZgtX0UKz7wooQeO qrmYARjmknSl3QKtOWfj7L5CMCCnpL89R8bz93F4Hb4hArl9u8s44FLbwTzANmU1HRmLDAiVH6m GBo/WS/KTBK03od40WYxRIkyB6O0I1uvtxomHnsl+JUcA/3Cz8DDLboiV6KP6XcWkNE3JsMpqwe us0SS03VsInYtBPzUpA== X-Authority-Analysis: v=2.4 cv=F4tnsKhN c=1 sm=1 tr=0 ts=6a2ff906 cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=j4ogTh8yFefVWWEFDRgCtg==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=fh4Lr3tRg7ETXUjdBf0A:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 X-Proofpoint-ORIG-GUID: kKV5M7kR4Zqjc14AgzV1dG_iWSl-dGjJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-15_03,2026-06-15_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 clxscore=1015 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606040000 definitions=main-2606150138 On 6/8/2026 7:25 PM, Dmitry Baryshkov wrote: > On Tue, May 26, 2026 at 08:12:03PM +0530, Bibek Kumar Patro wrote: >> On some SoCs the SMMU registers require an active interconnect >> bandwidth vote to be accessible. While other clients typically >> satisfy this requirement implicitly, certain corner cases (e.g. >> during sleep/wakeup transitions) can leave the SMMU without a >> vote, causing intermittent register access failures. >> >> Add support for an optional interconnect path to the arm-smmu >> driver and vote for bandwidth while the SMMU is active. The path >> is acquired from DT if present and ignored otherwise. >> >> The bandwidth vote is enabled before accessing SMMU registers >> during probe and runtime resume, and released during runtime >> suspend and on error paths. >> >> Generally, from an architectural perspective, GEM_NOC and DDR are >> expected to have an active vote whenever the adreno_smmu block is >> powered on. In most common use cases, this requirement is implicitly >> satisfied because other GPU-related clients (for example, the GMU >> device) already hold a GEM_NOC vote when adreno_smmu is enabled. >> >> However, there are certain corner cases, such as during sleep/wakeup >> transitions, where the GEM_NOC vote can be removed before adreno_smmu >> is powered down. If adreno_smmu is then accessed while the interconnect >> vote is missing, it can lead to the observed failures. Because of the >> precise ordering involved, this scenario is difficult to reproduce >> consistently. >> (also GDSC is involved in adreno usecases can have an independent vote) >> >> Signed-off-by: Bibek Kumar Patro >> --- >> drivers/iommu/arm/arm-smmu/arm-smmu.c | 57 +++++++++++++++++++++++++++++++++-- >> drivers/iommu/arm/arm-smmu/arm-smmu.h | 2 ++ >> 2 files changed, 57 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c >> index 0bd21d206eb3e75c3b9fb1364cdc92e82c5aa499..07c7e44ec6a5bd1488f00f87d859a20495e46601 100644 >> --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c >> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c >> @@ -53,6 +53,11 @@ >> #define MSI_IOVA_BASE 0x8000000 >> #define MSI_IOVA_LENGTH 0x100000 >> >> +/* Interconnect bandwidth vote values for the SMMU register access path */ >> +#define ARM_SMMU_ICC_AVG_BW 0 >> +#define ARM_SMMU_ICC_PEAK_BW_HIGH 1000 > > totally random numbers, which might be different for non-Qualcomm platform. > Ideally, any non-zero value would be enough to keep the path active. Here 1 Would be enough to keep the path active, but might be too small to reliably keep the bus active. Other is UINT_MAX, which will reliably keep the bus active but might cause a power penalty. #define ARM_SMMU_ICC_PEAK_BW_HIGH UINT_MAX seems to be suitable here to reliably keep the bus active by BCM for both Qualcomm and non-Qualcomm platforms (with some power penalty). LMK, if you feel otherwise. >> +#define ARM_SMMU_ICC_PEAK_BW_LOW 0 >> + >> static int force_stage; >> module_param(force_stage, int, S_IRUGO); >> MODULE_PARM_DESC(force_stage, >> @@ -86,6 +91,36 @@ static inline void arm_smmu_rpm_put(struct arm_smmu_device *smmu) >> } >> } >> >> +static int arm_smmu_icc_get(struct arm_smmu_device *smmu) >> +{ >> + smmu->icc_path = devm_of_icc_get(smmu->dev, NULL); > > Is there always only one bus / path in question? > >> + if (IS_ERR(smmu->icc_path)) { > > if (!IS_ERR(smmu->icc_path)) > return 0; > > int err = PTR_ERR(); > if (err == -ENODEV) { > icc_path = NULL; > return 0; > } > > return dev_err_probe(); > > >> + int err = PTR_ERR(smmu->icc_path); >> + >> + if (err == -ENODEV) { >> + smmu->icc_path = NULL; >> + return 0; >> + } >> + return dev_err_probe(smmu->dev, err, >> + "failed to get interconnect path\n"); >> + } >> + return 0; >> +} >> + >> +static void arm_smmu_icc_enable(struct arm_smmu_device *smmu) >> +{ >> + if (smmu->icc_path) > > Drop the if. > Ack, will address it in next revision >> + WARN_ON(icc_set_bw(smmu->icc_path, ARM_SMMU_ICC_AVG_BW, >> + ARM_SMMU_ICC_PEAK_BW_HIGH)); > > WARN_ON_ONCE()? > > Pass the error to the caller. > > Ack, would be better to pass. Thanks for pointing this. >> +} >> + >> +static void arm_smmu_icc_disable(struct arm_smmu_device *smmu) >> +{ >> + if (smmu->icc_path) > > Drop the if. > Ack. >> + WARN_ON(icc_set_bw(smmu->icc_path, ARM_SMMU_ICC_AVG_BW, >> + ARM_SMMU_ICC_PEAK_BW_LOW)); > > Pass the error to the caller. > Ack. >> +} >> + >> static void arm_smmu_rpm_use_autosuspend(struct arm_smmu_device *smmu) >> { >> /* >> @@ -2189,6 +2224,17 @@ static int arm_smmu_device_probe(struct platform_device *pdev) >> if (err) >> return err; >> >> + /* >> + * Acquire and vote the interconnect path before accessing any SMMU >> + * registers (including ARM_SMMU_GR0_ID0 in arm_smmu_device_cfg_probe). >> + */ >> + err = arm_smmu_icc_get(smmu); >> + if (err) { >> + clk_bulk_disable_unprepare(smmu->num_clks, smmu->clks); >> + return err; >> + } >> + arm_smmu_icc_enable(smmu); > > Handle the error. > Ack, will address this in next revision. to disable the clocks here as well. + err = arm_smmu_icc_enable(smmu); + if (err) { + clk_bulk_disable_unprepare(smmu->num_clks, smmu->clks); + return err; + } >> + >> err = arm_smmu_device_cfg_probe(smmu); >> if (err) >> return err; >> @@ -2273,8 +2319,10 @@ static void arm_smmu_device_shutdown(struct platform_device *pdev) >> >> if (pm_runtime_enabled(smmu->dev)) >> pm_runtime_force_suspend(smmu->dev); >> - else >> + else { >> clk_bulk_disable(smmu->num_clks, smmu->clks); >> + arm_smmu_icc_disable(smmu); > > Handle the error. > > etc. > Ack, will address the if(), and error handling suggestion in next iteration. Thanks & regards, Bibek >> + } >> >> clk_bulk_unprepare(smmu->num_clks, smmu->clks); >> } >