Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1162206rdb; Fri, 19 Jan 2024 10:00:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXDyBusfYtAYMJo9DH0LwjhW+u6HZKEY7SX+wJGbpNKnaH3uTU4eSEEdPdsde8tQyFYeTn X-Received: by 2002:a17:906:e949:b0:a2c:3596:b0c1 with SMTP id jw9-20020a170906e94900b00a2c3596b0c1mr94330ejb.75.1705687222635; Fri, 19 Jan 2024 10:00:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705687222; cv=pass; d=google.com; s=arc-20160816; b=lMdQQsifOwTqnOSdYVLc0Dvo+M/fD+xJbCJoIj0iPJ9FezDf7udcJ7nXmdbJbKZFSn RcANccFoEl7Z56hTQOiuZYE8R+Yzj5ejoSZ4RZ/zE5uGuvxsjdarNnpXacMg8REMlX3f 15u4yX4Vn/4yrEze4Z20v+teYVDwF2D+u2khAJt3QJfI+iR9L7qqsbFBA5MQp4gkBvm2 3OwCQDpaypPHUEaYRPO2flOyft+ssOzxcijf+cO02Fmv1T1ZdCcVpUA3F6LWmgLfh7cQ dXrsxvNVv4CSntQxRkr9ZWO42nSu5WpY+eEAwMaw17my/NHjXWVREzq15akU4WvG9bfA XaKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=KsejanrJsczGYRynswMeldvh36vvOWZzU/jvY1bGVDk=; fh=6l0NTVB1UicBeC480Gi49LmDoT2v9n+Vtx2JACBylQ4=; b=ezeETcyzUPlj8bqFV3mMXKDcnwOCbcgq9IpVjRlSVCWbVYjO/4KXAMdewJ8s6oYAxF kR3YKstjszjlIDkDb4p/ux2c+JKyz2Ka0LsvRjB/esrISVyEC1HJ4vsqY3IlLtGIqGtl KzllExclAnwYzrmNdkGp2CxMgX98+XVIrq8k2kNod0iF91/yr7LpKvpn6cMpU2k3PRtf qGqJW7kXfw2z5m7/drqHfOFT2UBRcVhDER2jq9/IQHfyi69fq0pnzkzF3YEbvJ2BN6kK OarK9LQvB0Vwaz7bEHFy4blM3fXS8QYSpcr/8YEVQnwHpwTA+7DNhwfJOVZIPtoc/XMn o+Ww== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Rq1OrS5m; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-31455-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31455-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o2-20020a170906358200b00a28b679724fsi7825501ejb.860.2024.01.19.10.00.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 10:00:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31455-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Rq1OrS5m; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-31455-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31455-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 351AC1F24E10 for ; Fri, 19 Jan 2024 18:00:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 739C75674C; Fri, 19 Jan 2024 17:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Rq1OrS5m" 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 027D05644A; Fri, 19 Jan 2024 17:59:47 +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=1705687189; cv=none; b=Dt4p6ew/Hi+MBXgUPq7GZx0MporYznWdrzysnMCyBl3ziUK6toZ1iuO16LNWr+vprv5R+JXhYMceJcJbLzWAIvsATlOtb+6QjvGJm1/Dnbd2llWB97LTEaLSkBAmLeFCOUHPpbUxPjTHI7wTvEdGWyScJXIQKxMfY8jS6vmOvzM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705687189; c=relaxed/simple; bh=MQu8y0M4Jts4ScVci4hTK3ghT1Vrlk00myLt2cCfWcA=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=EIcmHqNNZQX8G3U5Jw6gLEbZa6FqmoFaQr/aYdGYUUvREwF22IOFeLYZcybwkS/FvoUXJBvpkqYB4Qn303McprW+VQ0+osndF9RysndcmVU9xeTQQH1HCG3o6IsTn4W+4LNBDpBJxIWzHALhtV8N+QoVk/fmEEFqBIZCJtU+ySs= 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=Rq1OrS5m; 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 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40JGP8wd001659; Fri, 19 Jan 2024 17:59:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=KsejanrJsczGYRynswMeldvh36vvOWZzU/jvY1bGVDk=; b=Rq 1OrS5mRiRDDbXc7jN0hnAHY05n12/KZrkBCfKxYrNY4lfnTvV3pIDpMZzRXt8RP3 wEZ6u1Cd7NuF8z8J5ahBa227NXjg5dK1cWaD3iBPDHgWvv/GWUVggIerXIAK4sqq VsHgNe0LHQCrKse9cmjkcE917lBpH+GWiHBzvzX6q/5IFg2HqCSJvbO1NEVbIngt JHd7fovNfdT3Ri/7zQLuDgg8xL8ZX1vNYhWEYDHMlq416Y4iiRVgzRPrvPsgdMR0 ti0uadwMGp7xGW/nTlRzaA+XB+7x8S5B+TeO3FH+ASogDTmeGmI0Uh7NGMK1bWLT fn8TFaQtDVrLp0NgS44g== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vqmefh82v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Jan 2024 17:59:42 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40JHxfwQ030865 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Jan 2024 17:59:41 GMT Received: from [10.71.108.105] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 19 Jan 2024 09:59:39 -0800 Message-ID: <003c8ea1-c455-4f68-bc8d-7ed9aa968a58@quicinc.com> Date: Fri, 19 Jan 2024 09:59:37 -0800 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] soc: qcom: rpmh-rsc: Enhance check for VREG in-flight request Content-Language: en-US To: Andrew Halaney , Maulik Shah CC: Bjorn Andersson , Konrad Dybcio , , , , References: <20240119-rpmh-rsc-fixes-v2-1-e42c0a9e36f0@quicinc.com> From: Elliot Berman In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: JmPOcrW9QMXxLhMQs8l5CnEympR6SgkV X-Proofpoint-GUID: JmPOcrW9QMXxLhMQs8l5CnEympR6SgkV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-19_10,2024-01-19_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401190105 On 1/19/2024 7:47 AM, Andrew Halaney wrote: > On Fri, Jan 19, 2024 at 01:56:54PM +0530, Maulik Shah wrote: >> Each RPMh VREG accelerator resource has 3 or 4 contiguous 4-byte aligned >> addresses associated with it. These control voltage, enable state, mode, >> and in legacy targets, voltage headroom. The current in-flight request >> checking logic looks for exact address matches. Requests for different >> addresses of the same RPMh resource as thus not detected as in-flight. >> >> Enhance the in-flight request check for VREG requests by ignoring the >> address offset. This ensures that only one request is allowed to be >> in-flight for a given VREG resource. This is needed to avoid scenarios >> where request commands are carried out by RPMh hardware out-of-order >> leading to LDO regulator over-current protection triggering. >> >> Signed-off-by: Maulik Shah >> Signed-off-by: Elliot Berman > > Just noticed I commented on v1 when v2 was already out, sorry. Copy > pasting this just to keep it on the latest thread: > > Two minor things: > > 1. Does this deserve a Fixes: tag? > 2. The Signed-off-by chain here confuses me, you sent the patch > so your SOB should be last, but then that makes me believe Elliot > was the author which I don't think is reflected here (no From: > line). Please read [0] for a bit more details > > [0] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#developer-s-certificate-of-origin-1-1 > Maulik's S-o-B should be last. This change was authored by him in our downstream driver and this change was pointed out as also being a fix for the upstream driver. I helped rebase/apply the change to upstream to test and shared patch back with him for posting to the list. When he got the rebased patch, my S-o-B would've been last, but now need to be updated again so his is last. >> --- >> Changes in v2: >> - Use GENMASK() and FIELD_GET() >> - Link to v1: https://lore.kernel.org/r/20240117-rpmh-rsc-fixes-v1-1-71ee4f8f72a4@quicinc.com >> --- >> drivers/soc/qcom/rpmh-rsc.c | 21 ++++++++++++++++++++- >> 1 file changed, 20 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c >> index a021dc71807b..e480cde783fe 100644 >> --- a/drivers/soc/qcom/rpmh-rsc.c >> +++ b/drivers/soc/qcom/rpmh-rsc.c >> @@ -1,11 +1,13 @@ >> // SPDX-License-Identifier: GPL-2.0 >> /* >> * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. >> + * Copyright (c) 2023-2024, Qualcomm Innovation Center, Inc. All rights reserved. >> */ >> >> #define pr_fmt(fmt) "%s " fmt, KBUILD_MODNAME >> >> #include >> +#include >> #include >> #include >> #include >> @@ -91,6 +93,15 @@ enum { >> #define CMD_STATUS_ISSUED BIT(8) >> #define CMD_STATUS_COMPL BIT(16) >> >> +#define ACCL_TYPE(addr) FIELD_GET(GENMASK(19, 16), addr) >> +#define VREG_ADDR(addr) FIELD_GET(GENMASK(19, 4), addr) >> + >> +enum { >> + HW_ACCL_CLK = 0x3, >> + HW_ACCL_VREG, >> + HW_ACCL_BUS, >> +}; >> + >> /* >> * Here's a high level overview of how all the registers in RPMH work >> * together: >> @@ -557,7 +568,15 @@ static int check_for_req_inflight(struct rsc_drv *drv, struct tcs_group *tcs, >> for_each_set_bit(j, &curr_enabled, MAX_CMDS_PER_TCS) { >> addr = read_tcs_cmd(drv, drv->regs[RSC_DRV_CMD_ADDR], i, j); >> for (k = 0; k < msg->num_cmds; k++) { >> - if (addr == msg->cmds[k].addr) >> + /* >> + * Each RPMh VREG accelerator resource has 3 or 4 contiguous 4-byte >> + * aligned addresses associated with it. Ignore the offset to check >> + * for in-flight VREG requests. >> + */ >> + if (ACCL_TYPE(msg->cmds[k].addr) == HW_ACCL_VREG && >> + VREG_ADDR(msg->cmds[k].addr) == VREG_ADDR(addr)) >> + return -EBUSY; >> + else if (addr == msg->cmds[k].addr) >> return -EBUSY; >> } >> } >> >> --- >> base-commit: 943b9f0ab2cfbaea148dd6ac279957eb08b96904 >> change-id: 20240117-rpmh-rsc-fixes-6c43c7051828 >> >> Best regards, >> -- >> Maulik Shah >> >> >