Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp339595rdb; Wed, 17 Jan 2024 03:49:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHEh/d9ouBlySqKHqMBG+qTXqnEvVukBZtKoX2MEhEYO3a/9z+phEcxj7W9kBsVe5AfMC46 X-Received: by 2002:a05:620a:675:b0:783:2a99:1a08 with SMTP id a21-20020a05620a067500b007832a991a08mr8915048qkh.86.1705492198834; Wed, 17 Jan 2024 03:49:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705492198; cv=pass; d=google.com; s=arc-20160816; b=Jolr26OkSnVUDrOUJIXQzSu9R4SOPGdwXjrYMQDxvEOB0buvYdKS1Z2Zb9RTitiLri 3r/5m+PFAKz2SuF7V/27ifw5iarGahkwL2dRFKfFUuB9Q/0FXNcZr5BH55z76f75TUPk pT83H1VClJCrah4ZVPKNnhQfaAcHnX0nvZFdFK4+UctI4xmfcRgCxFkLY1w5W7cHtrr2 BFytic7MmcFb0F1OFQHBwjTlInhxzTeF16fW3msqCluiPR2ThzED6oLU9KTjxmYW3KSH xIW/ikxxs0imq6utGmdZRmTV8aW/SifEd/wzXHZVD5pCtGaPoU/9HfXMZFoM68t/daQN mDvg== 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:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=nxPSXuNJ8AUL8NOznZbrLecSi/2kLhBhAre/dygA9TY=; fh=uIFtcyH/R33rEmC80MflKbBswu0P99B4/62A8WcimM4=; b=UzS9fGjxB4Hmggo/YJfe/uTSAvMo0gmUV+6T9fWAet0vt0T4pFb1lIYtFTqPG/ldE4 RzEWJ5hLApMP4nrjivjjRRGxGqBQ3/6iKs6CtL0r0A6tMx/AW6nzxg9v1XsyhbFyz5g2 dnMeukEkKSvsPCpXGvfeIEhi2AXO6XNiU/E6k4AnfBk6KjkLkGFztv7prFZ7Is4rBZn1 ylItJkIouKNbxofMmMN5heLpAEjAse7SIWKP8XrhFygS6LC8WXfsAfTZb7T+WcCZBJry NRMYteoLoVJ/hAdBXhOHhElrPW87ZCiGYHZhw8mDeurtJwWZBMPj5vb5zGYxwsZqGBpO SReg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PZ8ySSrW; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-28929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z26-20020a05620a08da00b007835b33c34csi5853116qkz.470.2024.01.17.03.49.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 03:49:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PZ8ySSrW; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-28929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 907431C24448 for ; Wed, 17 Jan 2024 11:49:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0BFC1DFD8; Wed, 17 Jan 2024 11:49:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PZ8ySSrW" Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7103C1DFC8 for ; Wed, 17 Jan 2024 11:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705492190; cv=none; b=r67ElquOeHRQrPU6p8kWq2pNDGF+KYIlyQtqImOmCIlSKAc0GNmrF6BGhzGeN+oWT+557vhQRPdPsCsrlK0zPbIZ07KnYNWmHf4VzoRYrFB1lSQww+3dJN7nEMAlrqIQaq7HiJgUCd1tYAjs0mtZZi8nMjlSy0BLPnxykRdavvo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705492190; c=relaxed/simple; bh=kY5z25saFdI9aw7FeyrSL42gfsRrieLO5WzEyKAr6WE=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; b=Pd5kar+yqVAtEp+aN0nZoAajP3iuSb1oncsKZMNSUbJdHwFQ6ACU7VVhMLDki/69ZUD1VEzlpb44RwVZvrd/k0C6hAq5AQ2VIEd8JA313yKPHcMjM8DF0imJqmUDvHWVVhoun6UMX7glqyyW7R/15NVOO/v/afYwR3K7av4F6p0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=PZ8ySSrW; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-50e80d40a41so13929336e87.1 for ; Wed, 17 Jan 2024 03:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705492186; x=1706096986; 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=nxPSXuNJ8AUL8NOznZbrLecSi/2kLhBhAre/dygA9TY=; b=PZ8ySSrWwGapa/1KMJlQT7mPhCQVdA1y/JSiwQiAdRM+qZ6dUoKYWUygKbyNzzjGk6 0qpVNL6ITvm3MzFEOB8df27RYtH4a6Jce4jMdqnXUQyHwt+625/vp4YMdr3JwgaPXybq xPIe0A4CUMzouJvQKBqSy4D2GbSvV+6ifdZvesuRaxyyN60BKy3jyJHPcLJlzT7Nv+My 52CBt+GxfwIffBC1aQQuey3f8dLSIxrcpBwrSqk6dAcXOnZy1LVXCZ4ztAM0XUm0pNki zCdXOitFYLvnJDsxf3Njh6OXMfStdh7aASe4AY7aPRFoG33monsH4hfs391bjTKAEQE2 plMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705492186; x=1706096986; 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=nxPSXuNJ8AUL8NOznZbrLecSi/2kLhBhAre/dygA9TY=; b=Gxxy8nXoScvnQ1yE/02ZgNk0YvUx1Qk5T//I7kD1G165H+pMJ6zWR+KHp9ITcdFUSz yeMbmzjtBtYWD3jHlzpmUoHY9ynAOTVAf5biI8jtwh136PwCq2c+kb2R2d50X3gh0ZVR dBZdEaeSsuneqrgEfxAl134qSKJN0j/Hy84tAnRSIz+Pu3GfwaxfmLmT+jUKtLX1Dy6Z ALe1xiqsT1sHuE+jff8XCy9J6txenJcoX8BZu1P2YZ8WT8UTK9jx+iziGXYm8XbiJyyb 45SB1pY4WmS5psZNtlkUzCqxoxgd/SU2utpMJUaXVo6CeOxjRqHnpNsi9OMcTPdp/kR0 nQcg== X-Gm-Message-State: AOJu0Yyud8FolHZPoUhtl2UizlY2MHBQKlENTA6HzB2rYy4gT4CTXt0P TAyl+UbkuBw5AQAIDC1Un6Hnh4BCwN/RHjTTNW254V4GYIk= X-Received: by 2002:a05:6512:3907:b0:50e:e888:2c3d with SMTP id a7-20020a056512390700b0050ee8882c3dmr3821308lfu.25.1705492186453; Wed, 17 Jan 2024 03:49:46 -0800 (PST) Received: from [172.30.204.250] (UNUSED.212-182-62-129.lubman.net.pl. [212.182.62.129]) by smtp.gmail.com with ESMTPSA id e8-20020a196748000000b0050ee78fd23esm228767lfj.262.2024.01.17.03.49.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Jan 2024 03:49:46 -0800 (PST) Message-ID: <9b177f7b-8dbf-4193-9a70-94f7b80f0a87@linaro.org> Date: Wed, 17 Jan 2024 12:49:44 +0100 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] soc: qcom: rpmh-rsc: Enhance check for VREG in-flight request To: Maulik Shah , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_eberman@quicinc.com, quic_collinsd@quicinc.com, quic_lsrao@quicinc.com References: <20240117-rpmh-rsc-fixes-v1-1-71ee4f8f72a4@quicinc.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20240117-rpmh-rsc-fixes-v1-1-71ee4f8f72a4@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/17/24 09:54, 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 > --- > drivers/soc/qcom/rpmh-rsc.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c > index a021dc71807b..5371d7e3090a 100644 > --- a/drivers/soc/qcom/rpmh-rsc.c > +++ b/drivers/soc/qcom/rpmh-rsc.c > @@ -1,6 +1,7 @@ > // 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 > @@ -91,6 +92,15 @@ enum { > #define CMD_STATUS_ISSUED BIT(8) > #define CMD_STATUS_COMPL BIT(16) > > +#define ACCL_TYPE(addr) ((addr >> 16) & 0xF) > +#define VREG_ADDR(addr) (addr & ~0xF) It would be nice to add some #define FNAME GENMASK(x, y) accessed with FIELD_GET(FNAME, foobar), so that the code is a bit more self-explanatory Konrad