All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akhil P Oommen <quic_akhilpo@quicinc.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Rob Clark <robdclark@gmail.com>
Cc: freedreno@lists.freedesktop.org,
	"Jonathan Marek" <jonathan@marek.ca>,
	"David Airlie" <airlied@linux.ie>,
	linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	dri-devel@lists.freedesktop.org,
	"Jordan Crouse" <jordan@cosmicpenguin.net>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Stephen Boyd" <swboyd@chromium.org>,
	"Sean Paul" <sean@poorly.run>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [Freedreno] [PATCH] drm/msm/adreno: fix cast in adreno_get_param()
Date: Mon, 7 Mar 2022 20:31:29 +0530	[thread overview]
Message-ID: <bd66239d-d5df-79c0-c3c8-be90816373db@quicinc.com> (raw)
In-Reply-To: <20220307133105.GA17534@kili>

On 3/7/2022 7:01 PM, Dan Carpenter wrote:
> These casts need to happen before the shift.  The only time it would
> matter would be if "rev.core" is >= 128.  In that case the sign bit
> would be extended and we do not want that.
>
> Fixes: afab9d91d872 ("drm/msm/adreno: Expose speedbin to userspace")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/gpu/drm/msm/adreno/adreno_gpu.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index 15c8997b7251..f7b3f6d266a9 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -244,10 +244,10 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
>   		*value = !adreno_is_a650_family(adreno_gpu) ? 0x100000 : 0;
>   		return 0;
>   	case MSM_PARAM_CHIP_ID:
> -		*value = (uint64_t) adreno_gpu->rev.patchid |
> -				(uint64_t) (adreno_gpu->rev.minor << 8) |
> -				(uint64_t) (adreno_gpu->rev.major << 16) |
> -				(uint64_t) (adreno_gpu->rev.core << 24);
> +		*value =  (uint64_t)adreno_gpu->rev.patchid |
> +			 ((uint64_t)adreno_gpu->rev.minor << 8) |
> +			 ((uint64_t)adreno_gpu->rev.major << 16) |
> +			 ((uint64_t)adreno_gpu->rev.core  << 24);
>   		if (!adreno_gpu->info->revn)
>   			*value |= ((uint64_t) adreno_gpu->speedbin) << 32;
>   		return 0;
Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>

-Akhil

WARNING: multiple messages have this Message-ID (diff)
From: Akhil P Oommen <quic_akhilpo@quicinc.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Rob Clark <robdclark@gmail.com>
Cc: "Sean Paul" <sean@poorly.run>,
	"Jonathan Marek" <jonathan@marek.ca>,
	"David Airlie" <airlied@linux.ie>,
	linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	dri-devel@lists.freedesktop.org,
	"Jordan Crouse" <jordan@cosmicpenguin.net>,
	"Stephen Boyd" <swboyd@chromium.org>,
	freedreno@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [Freedreno] [PATCH] drm/msm/adreno: fix cast in adreno_get_param()
Date: Mon, 7 Mar 2022 20:31:29 +0530	[thread overview]
Message-ID: <bd66239d-d5df-79c0-c3c8-be90816373db@quicinc.com> (raw)
In-Reply-To: <20220307133105.GA17534@kili>

On 3/7/2022 7:01 PM, Dan Carpenter wrote:
> These casts need to happen before the shift.  The only time it would
> matter would be if "rev.core" is >= 128.  In that case the sign bit
> would be extended and we do not want that.
>
> Fixes: afab9d91d872 ("drm/msm/adreno: Expose speedbin to userspace")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/gpu/drm/msm/adreno/adreno_gpu.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index 15c8997b7251..f7b3f6d266a9 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -244,10 +244,10 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
>   		*value = !adreno_is_a650_family(adreno_gpu) ? 0x100000 : 0;
>   		return 0;
>   	case MSM_PARAM_CHIP_ID:
> -		*value = (uint64_t) adreno_gpu->rev.patchid |
> -				(uint64_t) (adreno_gpu->rev.minor << 8) |
> -				(uint64_t) (adreno_gpu->rev.major << 16) |
> -				(uint64_t) (adreno_gpu->rev.core << 24);
> +		*value =  (uint64_t)adreno_gpu->rev.patchid |
> +			 ((uint64_t)adreno_gpu->rev.minor << 8) |
> +			 ((uint64_t)adreno_gpu->rev.major << 16) |
> +			 ((uint64_t)adreno_gpu->rev.core  << 24);
>   		if (!adreno_gpu->info->revn)
>   			*value |= ((uint64_t) adreno_gpu->speedbin) << 32;
>   		return 0;
Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>

-Akhil

  reply	other threads:[~2022-03-07 15:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 13:31 [PATCH] drm/msm/adreno: fix cast in adreno_get_param() Dan Carpenter
2022-03-07 13:31 ` Dan Carpenter
2022-03-07 15:01 ` Akhil P Oommen [this message]
2022-03-07 15:01   ` [Freedreno] " Akhil P Oommen
2022-03-08 20:25 ` Stephen Boyd
2022-03-08 20:25   ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd66239d-d5df-79c0-c3c8-be90816373db@quicinc.com \
    --to=quic_akhilpo@quicinc.com \
    --cc=airlied@linux.ie \
    --cc=christian.koenig@amd.com \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jonathan@marek.ca \
    --cc=jordan@cosmicpenguin.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.