tcs_is_free() had two checks in it: does the software think that the
TCS is free and does the hardware think that the TCS is free. I
couldn't figure out in which case the hardware could think that a TCS
was in-use but software thought it was free. Apparently there is no
case and the extra check can be removed. This apparently has already
been done in a downstream patch.
Suggested-by: Maulik Shah <[email protected]>
Signed-off-by: Douglas Anderson <[email protected]>
---
Changes in v3:
- Replace ("...warn if state mismatch") w/ ("...just check tcs_in_use")
Changes in v2:
- Comment tcs_is_free() new for v2; replaces old patch 6.
drivers/soc/qcom/rpmh-rsc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
index 84ae3e514eee..9502e7ea96be 100644
--- a/drivers/soc/qcom/rpmh-rsc.c
+++ b/drivers/soc/qcom/rpmh-rsc.c
@@ -177,7 +177,6 @@ static void write_tcs_reg_sync(struct rsc_drv *drv, int reg, int tcs_id,
* @tcs_id: The global ID of this TCS.
*
* Returns true if nobody has claimed this TCS (by setting tcs_in_use).
- * If the TCS looks free, checks that the hardware agrees.
*
* Must be called with the drv->lock held or the tcs_lock for the TCS being
* tested. If only the tcs_lock is held then it is possible that this
@@ -188,8 +187,7 @@ static void write_tcs_reg_sync(struct rsc_drv *drv, int reg, int tcs_id,
*/
static bool tcs_is_free(struct rsc_drv *drv, int tcs_id)
{
- return !test_bit(tcs_id, drv->tcs_in_use) &&
- read_tcs_reg(drv, RSC_DRV_STATUS, tcs_id);
+ return !test_bit(tcs_id, drv->tcs_in_use);
}
/**
--
2.26.0.292.g33ef6b2f38-goog
Hi,
Reviewed-by: Maulik Shah <[email protected]>
Tested-by: Maulik Shah <[email protected]>
Thanks,
Maulik
On 4/8/2020 5:20 AM, Douglas Anderson wrote:
> tcs_is_free() had two checks in it: does the software think that the
> TCS is free and does the hardware think that the TCS is free. I
> couldn't figure out in which case the hardware could think that a TCS
> was in-use but software thought it was free. Apparently there is no
> case and the extra check can be removed. This apparently has already
> been done in a downstream patch.
>
> Suggested-by: Maulik Shah <[email protected]>
> Signed-off-by: Douglas Anderson <[email protected]>
> ---
>
> Changes in v3:
> - Replace ("...warn if state mismatch") w/ ("...just check tcs_in_use")
>
> Changes in v2:
> - Comment tcs_is_free() new for v2; replaces old patch 6.
>
> drivers/soc/qcom/rpmh-rsc.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index 84ae3e514eee..9502e7ea96be 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -177,7 +177,6 @@ static void write_tcs_reg_sync(struct rsc_drv *drv, int reg, int tcs_id,
> * @tcs_id: The global ID of this TCS.
> *
> * Returns true if nobody has claimed this TCS (by setting tcs_in_use).
> - * If the TCS looks free, checks that the hardware agrees.
> *
> * Must be called with the drv->lock held or the tcs_lock for the TCS being
> * tested. If only the tcs_lock is held then it is possible that this
> @@ -188,8 +187,7 @@ static void write_tcs_reg_sync(struct rsc_drv *drv, int reg, int tcs_id,
> */
> static bool tcs_is_free(struct rsc_drv *drv, int tcs_id)
> {
> - return !test_bit(tcs_id, drv->tcs_in_use) &&
> - read_tcs_reg(drv, RSC_DRV_STATUS, tcs_id);
> + return !test_bit(tcs_id, drv->tcs_in_use);
> }
>
> /**
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation