linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: edac/i7300_edac.c:307: strange macro ?
       [not found] <VI1PR08MB1022F62928A4F5D396DA8FFD9C660@VI1PR08MB1022.eurprd08.prod.outlook.com>
@ 2017-01-11 22:58 ` Borislav Petkov
       [not found]   ` <VI1PR08MB1022FEBA2CB88AE10D7319DA9C660@VI1PR08MB1022.eurprd08.prod.outlook.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2017-01-11 22:58 UTC (permalink / raw)
  To: David Binderman, Mauro Carvalho Chehab; +Cc: mchehab, linux-edac, linux-kernel

On Wed, Jan 11, 2017 at 04:48:51PM +0000, David Binderman wrote:
> Hello there,
> 
> drivers/edac/i7300_edac.c:307:32: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]

Are you adding some other -W-switches to the kernel Makefile?

:-)

> Source code is
> 
>   #define IS_SECOND_CH(v)   ((v) * (1 << 17))

Looks like a bug to me. According to the chipset doc, bit 17 in REDMEMB
is the locator bit for CS[3:2] which probably means the second channel
but multiplying the full register value with 131072 looks wrong.

> Maybe better code
> 
>   #define IS_SECOND_CH(v)   ((v) & (1 << 17))

Yap.

Mauro, what's up?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* Re: edac/i7300_edac.c:307: strange macro ?
       [not found]   ` <VI1PR08MB1022FEBA2CB88AE10D7319DA9C660@VI1PR08MB1022.eurprd08.prod.outlook.com>
@ 2017-01-25 11:58     ` Borislav Petkov
       [not found]       ` <VI1PR08MB102297E01770CE3D7CF4F17A9C740@VI1PR08MB1022.eurprd08.prod.outlook.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2017-01-25 11:58 UTC (permalink / raw)
  To: David Binderman; +Cc: Mauro Carvalho Chehab, mchehab, linux-edac, linux-kernel

On Wed, Jan 11, 2017 at 11:04:22PM +0000, David Binderman wrote:
> Thanks for the confirmation that my best guess looks good to you.

So what now, is there a fix in the form of a patch going to appear on
the horizon anytime soon?

:-)

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* Re: edac/i7300_edac.c:307: strange macro ?
       [not found]       ` <VI1PR08MB102297E01770CE3D7CF4F17A9C740@VI1PR08MB1022.eurprd08.prod.outlook.com>
@ 2017-01-25 15:37         ` Borislav Petkov
  2017-01-26  8:57           ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2017-01-25 15:37 UTC (permalink / raw)
  To: David Binderman; +Cc: Mauro Carvalho Chehab, mchehab, linux-edac, linux-kernel

On Wed, Jan 25, 2017 at 12:04:04PM +0000, David Binderman wrote:
> You'll have a very long wait to get a linux patch from me.
> 
> I am happy for someone else to invent a patch.

Ah ok, I thought you wanted to give it a try and would want me to help
you with it. :-)

Anyway, here it is:

---
From: Borislav Petkov <bp@suse.de>
Date: Wed, 25 Jan 2017 16:08:27 +0100
Subject: [PATCH] EDAC, i7300: Test for the second channel properly

REDMEMB[17] is the ECC_Locator bit, which, when set, identifies the
CS[3:2] as the simbols in error. And thus the second channel.

The macro computing it was wrong so get rid of it (it was used at one
place only) and get rid of the conditional too. Generates better code
this way anyway.

Signed-off-by: Borislav Petkov <bp@suse.de>
Reported-by: David Binderman <dcb314@hotmail.com>
---
 drivers/edac/i7300_edac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
index 0a912bf6de00..e391f5a716be 100644
--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
@@ -304,7 +304,6 @@ static const char *ferr_global_lo_name[] = {
 #define REDMEMA		0xdc
 
 #define REDMEMB		0x7c
-  #define IS_SECOND_CH(v)	((v) * (1 << 17))
 
 #define RECMEMA		0xe0
   #define RECMEMA_BANK(v)	(((v) >> 12) & 7)
@@ -483,8 +482,9 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci)
 		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
 				     REDMEMB, &value);
 		channel = (branch << 1);
-		if (IS_SECOND_CH(value))
-			channel++;
+
+		/* Second channel ? */
+		channel += !!(value & BIT(17));
 
 		/* Clear the error bit */
 		pci_write_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
-- 
2.11.0

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* Re: edac/i7300_edac.c:307: strange macro ?
  2017-01-25 15:37         ` Borislav Petkov
@ 2017-01-26  8:57           ` Mauro Carvalho Chehab
  2017-01-26 10:36             ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2017-01-26  8:57 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: David Binderman, mchehab, linux-edac, linux-kernel

Em Wed, 25 Jan 2017 16:37:28 +0100
Borislav Petkov <bp@alien8.de> escreveu:

> On Wed, Jan 25, 2017 at 12:04:04PM +0000, David Binderman wrote:
> > You'll have a very long wait to get a linux patch from me.
> > 
> > I am happy for someone else to invent a patch.  
> 
> Ah ok, I thought you wanted to give it a try and would want me to help
> you with it. :-)
> 
> Anyway, here it is:
> 
> ---
> From: Borislav Petkov <bp@suse.de>
> Date: Wed, 25 Jan 2017 16:08:27 +0100
> Subject: [PATCH] EDAC, i7300: Test for the second channel properly
> 
> REDMEMB[17] is the ECC_Locator bit, which, when set, identifies the
> CS[3:2] as the simbols in error. And thus the second channel.
> 
> The macro computing it was wrong so get rid of it (it was used at one
> place only) and get rid of the conditional too. Generates better code
> this way anyway.
> 
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Reported-by: David Binderman <dcb314@hotmail.com>

Seems OK to me. Do you want to put it on your tree, or do you
prefer if I put it on mine?

If you prefer to send via your tree:

Reviewed-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


> ---
>  drivers/edac/i7300_edac.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
> index 0a912bf6de00..e391f5a716be 100644
> --- a/drivers/edac/i7300_edac.c
> +++ b/drivers/edac/i7300_edac.c
> @@ -304,7 +304,6 @@ static const char *ferr_global_lo_name[] = {
>  #define REDMEMA		0xdc
>  
>  #define REDMEMB		0x7c
> -  #define IS_SECOND_CH(v)	((v) * (1 << 17))
>  
>  #define RECMEMA		0xe0
>    #define RECMEMA_BANK(v)	(((v) >> 12) & 7)
> @@ -483,8 +482,9 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci)
>  		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
>  				     REDMEMB, &value);
>  		channel = (branch << 1);
> -		if (IS_SECOND_CH(value))
> -			channel++;
> +
> +		/* Second channel ? */
> +		channel += !!(value & BIT(17));
>  
>  		/* Clear the error bit */
>  		pci_write_config_dword(pvt->pci_dev_16_1_fsb_addr_map,


-- 
Thanks,
Mauro

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

* Re: edac/i7300_edac.c:307: strange macro ?
  2017-01-26  8:57           ` Mauro Carvalho Chehab
@ 2017-01-26 10:36             ` Borislav Petkov
  0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2017-01-26 10:36 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: David Binderman, mchehab, linux-edac, linux-kernel

On Thu, Jan 26, 2017 at 06:57:44AM -0200, Mauro Carvalho Chehab wrote:
> Seems OK to me. Do you want to put it on your tree, or do you
> prefer if I put it on mine?

I can carry it.

> If you prefer to send via your tree:
> 
> Reviewed-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

Thanks.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

end of thread, other threads:[~2017-01-26 10:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <VI1PR08MB1022F62928A4F5D396DA8FFD9C660@VI1PR08MB1022.eurprd08.prod.outlook.com>
2017-01-11 22:58 ` edac/i7300_edac.c:307: strange macro ? Borislav Petkov
     [not found]   ` <VI1PR08MB1022FEBA2CB88AE10D7319DA9C660@VI1PR08MB1022.eurprd08.prod.outlook.com>
2017-01-25 11:58     ` Borislav Petkov
     [not found]       ` <VI1PR08MB102297E01770CE3D7CF4F17A9C740@VI1PR08MB1022.eurprd08.prod.outlook.com>
2017-01-25 15:37         ` Borislav Petkov
2017-01-26  8:57           ` Mauro Carvalho Chehab
2017-01-26 10:36             ` Borislav Petkov

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).