linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: etm4x: Fix width of CCITMIN field
@ 2023-10-30 10:29 James Clark
  2023-11-01  9:38 ` Mike Leach
  2023-11-02  4:14 ` Anshuman Khandual
  0 siblings, 2 replies; 4+ messages in thread
From: James Clark @ 2023-10-30 10:29 UTC (permalink / raw)
  To: coresight, suzuki.poulose, anshuman.khandual
  Cc: James Clark, stable, Mike Leach, Alexander Shishkin,
	Mathieu Poirier, Greg Kroah-Hartman, linux-arm-kernel,
	linux-kernel

CCITMIN is a 12 bit field and doesn't fit in a u8, so extend it to u16.
This probably wasn't an issue previously because values higher than 255
never occurred.

But since commit 0f55b43dedcd ("coresight: etm: Override TRCIDR3.CCITMIN
on errata affected cpus"), a comparison with 256 was done to enable the
errata, generating the following W=1 build error:

  coresight-etm4x-core.c:1188:24: error: result of comparison of
  constant 256 with expression of type 'u8' (aka 'unsigned char') is
  always false [-Werror,-Wtautological-constant-out-of-range-compare]

   if (drvdata->ccitmin == 256)

Cc: stable@vger.kernel.org
Fixes: 54ff892b76c6 ("coresight: etm4x: splitting struct etmv4_drvdata")
Signed-off-by: James Clark <james.clark@arm.com>
---
 drivers/hwtracing/coresight/coresight-etm4x.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
index 20e2e4cb7614..da17b6c49b0f 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.h
+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
@@ -1036,7 +1036,7 @@ struct etmv4_drvdata {
 	u8				ctxid_size;
 	u8				vmid_size;
 	u8				ccsize;
-	u8				ccitmin;
+	u16				ccitmin;
 	u8				s_ex_level;
 	u8				ns_ex_level;
 	u8				q_support;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: etm4x: Fix width of CCITMIN field
  2023-10-30 10:29 [PATCH] coresight: etm4x: Fix width of CCITMIN field James Clark
@ 2023-11-01  9:38 ` Mike Leach
  2023-11-02  4:14 ` Anshuman Khandual
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Leach @ 2023-11-01  9:38 UTC (permalink / raw)
  To: James Clark
  Cc: coresight, suzuki.poulose, anshuman.khandual, stable,
	Alexander Shishkin, Mathieu Poirier, Greg Kroah-Hartman,
	linux-arm-kernel, linux-kernel

On Mon, 30 Oct 2023 at 10:29, James Clark <james.clark@arm.com> wrote:
>
> CCITMIN is a 12 bit field and doesn't fit in a u8, so extend it to u16.
> This probably wasn't an issue previously because values higher than 255
> never occurred.
>
> But since commit 0f55b43dedcd ("coresight: etm: Override TRCIDR3.CCITMIN
> on errata affected cpus"), a comparison with 256 was done to enable the
> errata, generating the following W=1 build error:
>
>   coresight-etm4x-core.c:1188:24: error: result of comparison of
>   constant 256 with expression of type 'u8' (aka 'unsigned char') is
>   always false [-Werror,-Wtautological-constant-out-of-range-compare]
>
>    if (drvdata->ccitmin == 256)
>
> Cc: stable@vger.kernel.org
> Fixes: 54ff892b76c6 ("coresight: etm4x: splitting struct etmv4_drvdata")
> Signed-off-by: James Clark <james.clark@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-etm4x.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
> index 20e2e4cb7614..da17b6c49b0f 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x.h
> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h
> @@ -1036,7 +1036,7 @@ struct etmv4_drvdata {
>         u8                              ctxid_size;
>         u8                              vmid_size;
>         u8                              ccsize;
> -       u8                              ccitmin;
> +       u16                             ccitmin;
>         u8                              s_ex_level;
>         u8                              ns_ex_level;
>         u8                              q_support;
> --
> 2.34.1
>

Reviewed-by: Mike Leach <mike.leach@linaro.org>

-- 
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: etm4x: Fix width of CCITMIN field
  2023-10-30 10:29 [PATCH] coresight: etm4x: Fix width of CCITMIN field James Clark
  2023-11-01  9:38 ` Mike Leach
@ 2023-11-02  4:14 ` Anshuman Khandual
  2023-11-02  9:35   ` James Clark
  1 sibling, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2023-11-02  4:14 UTC (permalink / raw)
  To: James Clark, coresight, suzuki.poulose
  Cc: stable, Mike Leach, Alexander Shishkin, Mathieu Poirier,
	Greg Kroah-Hartman, linux-arm-kernel, linux-kernel



On 10/30/23 15:59, James Clark wrote:
> CCITMIN is a 12 bit field and doesn't fit in a u8, so extend it to u16.
> This probably wasn't an issue previously because values higher than 255
> never occurred.
> 
> But since commit 0f55b43dedcd ("coresight: etm: Override TRCIDR3.CCITMIN
> on errata affected cpus"), a comparison with 256 was done to enable the
> errata, generating the following W=1 build error:
> 
>   coresight-etm4x-core.c:1188:24: error: result of comparison of
>   constant 256 with expression of type 'u8' (aka 'unsigned char') is
>   always false [-Werror,-Wtautological-constant-out-of-range-compare]
> 
>    if (drvdata->ccitmin == 256)
> 
> Cc: stable@vger.kernel.org
> Fixes: 54ff892b76c6 ("coresight: etm4x: splitting struct etmv4_drvdata")
> Signed-off-by: James Clark <james.clark@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-etm4x.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
> index 20e2e4cb7614..da17b6c49b0f 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x.h
> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h
> @@ -1036,7 +1036,7 @@ struct etmv4_drvdata {
>  	u8				ctxid_size;
>  	u8				vmid_size;
>  	u8				ccsize;
> -	u8				ccitmin;
> +	u16				ccitmin;
>  	u8				s_ex_level;
>  	u8				ns_ex_level;
>  	u8				q_support;

Thanks James, so this takes care of the Smatch static checker
warning as reported by Dan Carpenter earlier.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: etm4x: Fix width of CCITMIN field
  2023-11-02  4:14 ` Anshuman Khandual
@ 2023-11-02  9:35   ` James Clark
  0 siblings, 0 replies; 4+ messages in thread
From: James Clark @ 2023-11-02  9:35 UTC (permalink / raw)
  To: Anshuman Khandual, coresight, suzuki.poulose
  Cc: stable, Mike Leach, Alexander Shishkin, Mathieu Poirier,
	Greg Kroah-Hartman, linux-arm-kernel, linux-kernel



On 02/11/2023 04:14, Anshuman Khandual wrote:
> 
> 
> On 10/30/23 15:59, James Clark wrote:
>> CCITMIN is a 12 bit field and doesn't fit in a u8, so extend it to u16.
>> This probably wasn't an issue previously because values higher than 255
>> never occurred.
>>
>> But since commit 0f55b43dedcd ("coresight: etm: Override TRCIDR3.CCITMIN
>> on errata affected cpus"), a comparison with 256 was done to enable the
>> errata, generating the following W=1 build error:
>>
>>    coresight-etm4x-core.c:1188:24: error: result of comparison of
>>    constant 256 with expression of type 'u8' (aka 'unsigned char') is
>>    always false [-Werror,-Wtautological-constant-out-of-range-compare]
>>
>>     if (drvdata->ccitmin == 256)
>>
>> Cc: stable@vger.kernel.org
>> Fixes: 54ff892b76c6 ("coresight: etm4x: splitting struct etmv4_drvdata")
>> Signed-off-by: James Clark <james.clark@arm.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-etm4x.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
>> index 20e2e4cb7614..da17b6c49b0f 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x.h
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h
>> @@ -1036,7 +1036,7 @@ struct etmv4_drvdata {
>>   	u8				ctxid_size;
>>   	u8				vmid_size;
>>   	u8				ccsize;
>> -	u8				ccitmin;
>> +	u16				ccitmin;
>>   	u8				s_ex_level;
>>   	u8				ns_ex_level;
>>   	u8				q_support;
> 
> Thanks James, so this takes care of the Smatch static checker
> warning as reported by Dan Carpenter earlier.
> 

I didn't see that report, but it was in "[linux-next:master]
BUILD REGRESSION c503e3eec382ac708ee7adf874add37b77c5d312"

> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-02  9:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 10:29 [PATCH] coresight: etm4x: Fix width of CCITMIN field James Clark
2023-11-01  9:38 ` Mike Leach
2023-11-02  4:14 ` Anshuman Khandual
2023-11-02  9:35   ` James Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).