[PATCH 3/4] EDAC/amd64: Set zn_regs_v2 flag for all AMD Family 1Ah-based SOCs

Avadhut Naik posted 4 patches 2 months ago
[PATCH 3/4] EDAC/amd64: Set zn_regs_v2 flag for all AMD Family 1Ah-based SOCs
Posted by Avadhut Naik 2 months ago
The zn_regs_v2 flag should be set for all AMD Family 1Ah-based SOCs.

Set the flag once for all 1Ah-based SOCs and avoid repetetive assignment.

Signed-off-by: Avadhut Naik <avadhut.naik@amd.com>
---
 drivers/edac/amd64_edac.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 2391f3469961..832f9675e7b0 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -3779,6 +3779,8 @@ static int per_family_init(struct amd64_pvt *pvt)
 	else
 		pvt->ops = &dct_ops;
 
+	pvt->flags.zn_regs_v2 = (pvt->fam >= 0x1A) ? 1 : 0;
+
 	switch (pvt->fam) {
 	case 0xf:
 		tmp_name				= (pvt->ext_model >= K8_REV_F) ?
@@ -3887,20 +3889,14 @@ static int per_family_init(struct amd64_pvt *pvt)
 		switch (pvt->model) {
 		case 0x00 ... 0x1f:
 			pvt->max_mcs            = 12;
-			pvt->flags.zn_regs_v2   = 1;
-			break;
-		case 0x40 ... 0x4f:
-			pvt->flags.zn_regs_v2   = 1;
 			break;
 		case 0x50 ... 0x57:
 		case 0xc0 ... 0xc7:
 			pvt->max_mcs            = 16;
-			pvt->flags.zn_regs_v2   = 1;
 			break;
 		case 0x90 ... 0x9f:
 		case 0xa0 ... 0xaf:
 			pvt->max_mcs            = 8;
-			pvt->flags.zn_regs_v2   = 1;
 			break;
 		}
 		break;
-- 
2.43.0
Re: [PATCH 3/4] EDAC/amd64: Set zn_regs_v2 flag for all AMD Family 1Ah-based SOCs
Posted by Borislav Petkov 1 month, 2 weeks ago
On Mon, Oct 13, 2025 at 05:30:42PM +0000, Avadhut Naik wrote:
> The zn_regs_v2 flag should be set for all AMD Family 1Ah-based SOCs.
> 
> Set the flag once for all 1Ah-based SOCs and avoid repetetive assignment.

Unknown word [repetetive] in commit message.
Suggestions: ['repetitive', 'repetitively', 'recitative', 'putative']

Please introduce a spellchecker into your patch creation workflow.

> Signed-off-by: Avadhut Naik <avadhut.naik@amd.com>
> ---
>  drivers/edac/amd64_edac.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index 2391f3469961..832f9675e7b0 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -3779,6 +3779,8 @@ static int per_family_init(struct amd64_pvt *pvt)
>  	else
>  		pvt->ops = &dct_ops;
>  
> +	pvt->flags.zn_regs_v2 = (pvt->fam >= 0x1A) ? 1 : 0;
> +
>  	switch (pvt->fam) {
>  	case 0xf:
>  		tmp_name				= (pvt->ext_model >= K8_REV_F) ?
> @@ -3887,20 +3889,14 @@ static int per_family_init(struct amd64_pvt *pvt)
>  		switch (pvt->model) {
>  		case 0x00 ... 0x1f:
>  			pvt->max_mcs            = 12;
> -			pvt->flags.zn_regs_v2   = 1;
> -			break;
> -		case 0x40 ... 0x4f:
> -			pvt->flags.zn_regs_v2   = 1;
>  			break;
>  		case 0x50 ... 0x57:
>  		case 0xc0 ... 0xc7:
>  			pvt->max_mcs            = 16;
> -			pvt->flags.zn_regs_v2   = 1;
>  			break;
>  		case 0x90 ... 0x9f:
>  		case 0xa0 ... 0xaf:
>  			pvt->max_mcs            = 8;
> -			pvt->flags.zn_regs_v2   = 1;
>  			break;
>  		}

I'm not sure about this: if we hoist this particular assignment up, then
what's the point of the tabellary switch-case where you can see at a quick
glance, all the settings that we do per model...?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH 3/4] EDAC/amd64: Set zn_regs_v2 flag for all AMD Family 1Ah-based SOCs
Posted by Yazen Ghannam 1 month, 2 weeks ago
On Wed, Oct 29, 2025 at 06:10:57PM +0100, Borislav Petkov wrote:
> On Mon, Oct 13, 2025 at 05:30:42PM +0000, Avadhut Naik wrote:

[...]

> > --- a/drivers/edac/amd64_edac.c
> > +++ b/drivers/edac/amd64_edac.c
> > @@ -3779,6 +3779,8 @@ static int per_family_init(struct amd64_pvt *pvt)
> >  	else
> >  		pvt->ops = &dct_ops;
> >  
> > +	pvt->flags.zn_regs_v2 = (pvt->fam >= 0x1A) ? 1 : 0;
> > +
> >  	switch (pvt->fam) {
> >  	case 0xf:
> >  		tmp_name				= (pvt->ext_model >= K8_REV_F) ?
> > @@ -3887,20 +3889,14 @@ static int per_family_init(struct amd64_pvt *pvt)
> >  		switch (pvt->model) {
> >  		case 0x00 ... 0x1f:
> >  			pvt->max_mcs            = 12;
> > -			pvt->flags.zn_regs_v2   = 1;
> > -			break;
> > -		case 0x40 ... 0x4f:
> > -			pvt->flags.zn_regs_v2   = 1;
> >  			break;
> >  		case 0x50 ... 0x57:
> >  		case 0xc0 ... 0xc7:
> >  			pvt->max_mcs            = 16;
> > -			pvt->flags.zn_regs_v2   = 1;
> >  			break;
> >  		case 0x90 ... 0x9f:
> >  		case 0xa0 ... 0xaf:
> >  			pvt->max_mcs            = 8;
> > -			pvt->flags.zn_regs_v2   = 1;
> >  			break;
> >  		}
> 
> I'm not sure about this: if we hoist this particular assignment up, then
> what's the point of the tabellary switch-case where you can see at a quick
> glance, all the settings that we do per model...?
> 

I think we should take any opportunity to get away from family/model
checks.

Yes, we still have one item (max_mcs) left. As a follow up, we can see
if this can be removed also.

Thanks,
Yazen
Re: [PATCH 3/4] EDAC/amd64: Set zn_regs_v2 flag for all AMD Family 1Ah-based SOCs
Posted by Borislav Petkov 1 month, 2 weeks ago
On Thu, Oct 30, 2025 at 09:48:39AM -0400, Yazen Ghannam wrote:
> 
> I think we should take any opportunity to get away from family/model
> checks.

But we're not getting rid of them - we're just partially hoisting the
zn_regs_v2 assignment for some only.

This looks like an unfinished patch to me so what's the point of it even?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH 3/4] EDAC/amd64: Set zn_regs_v2 flag for all AMD Family 1Ah-based SOCs
Posted by Yazen Ghannam 1 month, 2 weeks ago
On Mon, Nov 03, 2025 at 10:18:48PM +0100, Borislav Petkov wrote:
> On Thu, Oct 30, 2025 at 09:48:39AM -0400, Yazen Ghannam wrote:
> > 
> > I think we should take any opportunity to get away from family/model
> > checks.
> 
> But we're not getting rid of them - we're just partially hoisting the
> zn_regs_v2 assignment for some only.
> 
> This looks like an unfinished patch to me so what's the point of it even?
> 

Hmm, okay. I see your point. We can drop this if/until we have more
substantial changes.

Thanks,
Yazen