2020-06-07 04:39:43

by Jacky Hu

[permalink] [raw]
Subject: [PATCH 0/2] MCA and EDAC updates for AMD Family 17h, Model 60h

This patchset adds MCA and EDAC support for AMD Family 17h, Model 60h.

Also k10temp works with 4800h

k10temp-pci-00c3
Adapter: PCI adapter
Vcore: 1.55 V
Vsoc: 1.55 V
Tctl: +49.6°C
Tdie: +49.6°C
Icore: 0.00 A
Isoc: 0.00 A

Jacky Hu (2):
x86/amd_nb: Add Family 17h, Model 60h PCI IDs
EDAC/amd64: Add family ops for Family 17h Models 60h-6Fh

arch/x86/kernel/amd_nb.c | 5 +++++
drivers/edac/amd64_edac.c | 14 ++++++++++++++
drivers/edac/amd64_edac.h | 3 +++
drivers/hwmon/k10temp.c | 2 ++
include/linux/pci_ids.h | 1 +
5 files changed, 25 insertions(+)

--
2.27.0


2020-06-07 04:41:28

by Jacky Hu

[permalink] [raw]
Subject: [PATCH 2/2] EDAC/amd64: Add family ops for Family 17h Models 60h-6Fh

Add family ops to support AMD Family 17h, Models 60h-6Fh systems.

Signed-off-by: Jacky Hu <[email protected]>
---
drivers/edac/amd64_edac.c | 14 ++++++++++++++
drivers/edac/amd64_edac.h | 3 +++
2 files changed, 17 insertions(+)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 9cf7cc1f3f72..0e74027d3660 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2319,6 +2319,16 @@ static struct amd64_family_type family_types[] = {
.dbam_to_cs = f17_addr_mask_to_cs_size,
}
},
+ [F17_M60H_CPUS] = {
+ .ctl_name = "F17h_M60h",
+ .f0_id = PCI_DEVICE_ID_AMD_17H_M60H_DF_F0,
+ .f6_id = PCI_DEVICE_ID_AMD_17H_M60H_DF_F6,
+ .max_mcs = 2,
+ .ops = {
+ .early_channel_count = f17_early_channel_count,
+ .dbam_to_cs = f17_addr_mask_to_cs_size,
+ }
+ },
[F17_M70H_CPUS] = {
.ctl_name = "F17h_M70h",
.f0_id = PCI_DEVICE_ID_AMD_17H_M70H_DF_F0,
@@ -3357,6 +3367,10 @@ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt)
fam_type = &family_types[F17_M30H_CPUS];
pvt->ops = &family_types[F17_M30H_CPUS].ops;
break;
+ } else if (pvt->model >= 0x60 && pvt->model <= 0x6f) {
+ fam_type = &family_types[F17_M60H_CPUS];
+ pvt->ops = &family_types[F17_M60H_CPUS].ops;
+ break;
} else if (pvt->model >= 0x70 && pvt->model <= 0x7f) {
fam_type = &family_types[F17_M70H_CPUS];
pvt->ops = &family_types[F17_M70H_CPUS].ops;
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index abbf3c274d74..52b5d03eeba0 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -120,6 +120,8 @@
#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F6 0x15ee
#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F0 0x1490
#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F6 0x1496
+#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F0 0x1448
+#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F6 0x144e
#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F0 0x1440
#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F6 0x1446
#define PCI_DEVICE_ID_AMD_19H_DF_F0 0x1650
@@ -293,6 +295,7 @@ enum amd_families {
F17_CPUS,
F17_M10H_CPUS,
F17_M30H_CPUS,
+ F17_M60H_CPUS,
F17_M70H_CPUS,
F19_CPUS,
NUM_FAMILIES,
--
2.27.0

2020-06-07 04:41:34

by Jacky Hu

[permalink] [raw]
Subject: [PATCH 1/2] x86/amd_nb: Add Family 17h, Model 60h PCI IDs

Add the new Family 17h, Model 60h PCI IDs for AMD Zen2 APU systems.

Signed-off-by: Jacky Hu <[email protected]>
---
arch/x86/kernel/amd_nb.c | 5 +++++
drivers/hwmon/k10temp.c | 2 ++
include/linux/pci_ids.h | 1 +
3 files changed, 8 insertions(+)

diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index b6b3297851f3..b57e7bd68885 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -18,9 +18,11 @@
#define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450
#define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0
#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480
+#define PCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630
#define PCI_DEVICE_ID_AMD_17H_DF_F4 0x1464
#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec
#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F4 0x1494
+#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F4 0x144c
#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F4 0x1444
#define PCI_DEVICE_ID_AMD_19H_DF_F4 0x1654

@@ -33,6 +35,7 @@ static const struct pci_device_id amd_root_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_ROOT) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_ROOT) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_ROOT) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M60H_ROOT) },
{}
};

@@ -51,6 +54,7 @@ static const struct pci_device_id amd_nb_misc_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F3) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M60H_DF_F3) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_DF_F3) },
{}
@@ -65,6 +69,7 @@ static const struct pci_device_id amd_nb_link_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F4) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M60H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) },
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
index 9915578533bb..287e9cf2aab9 100644
--- a/drivers/hwmon/k10temp.c
+++ b/drivers/hwmon/k10temp.c
@@ -583,6 +583,7 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
k10temp_get_ccd_support(pdev, data, 4);
break;
case 0x31: /* Zen2 Threadripper */
+ case 0x60: /* Zen2 APU */
case 0x71: /* Zen2 */
data->show_current = !is_threadripper() && !is_epyc();
data->cfactor[0] = CFACTOR_ICORE;
@@ -632,6 +633,7 @@ static const struct pci_device_id k10temp_id_table[] = {
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F3) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) },
+ { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M60H_DF_F3) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) },
{ PCI_VDEVICE(HYGON, PCI_DEVICE_ID_AMD_17H_DF_F3) },
{}
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 9a57e6717e5c..0ad57693f392 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -550,6 +550,7 @@
#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463
#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb
#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F3 0x1493
+#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F3 0x144b
#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F3 0x1443
#define PCI_DEVICE_ID_AMD_19H_DF_F3 0x1653
#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
--
2.27.0

2020-06-15 12:02:32

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 0/2] MCA and EDAC updates for AMD Family 17h, Model 60h

+ Yazen and linux-hwmon.

On Sun, Jun 07, 2020 at 12:37:07PM +0800, Jacky Hu wrote:
> This patchset adds MCA and EDAC support for AMD Family 17h, Model 60h.
>
> Also k10temp works with 4800h
>
> k10temp-pci-00c3
> Adapter: PCI adapter
> Vcore: 1.55 V
> Vsoc: 1.55 V
> Tctl: +49.6°C
> Tdie: +49.6°C
> Icore: 0.00 A
> Isoc: 0.00 A
>
> Jacky Hu (2):
> x86/amd_nb: Add Family 17h, Model 60h PCI IDs
> EDAC/amd64: Add family ops for Family 17h Models 60h-6Fh
>
> arch/x86/kernel/amd_nb.c | 5 +++++
> drivers/edac/amd64_edac.c | 14 ++++++++++++++
> drivers/edac/amd64_edac.h | 3 +++
> drivers/hwmon/k10temp.c | 2 ++
> include/linux/pci_ids.h | 1 +
> 5 files changed, 25 insertions(+)
>
> --
> 2.27.0
>

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2020-06-15 15:03:46

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 0/2] MCA and EDAC updates for AMD Family 17h, Model 60h

On 6/15/20 4:59 AM, Borislav Petkov wrote:
> + Yazen and linux-hwmon.
>
> On Sun, Jun 07, 2020 at 12:37:07PM +0800, Jacky Hu wrote:
>> This patchset adds MCA and EDAC support for AMD Family 17h, Model 60h.
>>
>> Also k10temp works with 4800h
>>
>> k10temp-pci-00c3
>> Adapter: PCI adapter
>> Vcore: 1.55 V
>> Vsoc: 1.55 V
>> Tctl: +49.6°C
>> Tdie: +49.6°C
>> Icore: 0.00 A
>> Isoc: 0.00 A
>>

Looks like we may have to black-list current measurements
for that chip, though.

Guenter

>> Jacky Hu (2):
>> x86/amd_nb: Add Family 17h, Model 60h PCI IDs
>> EDAC/amd64: Add family ops for Family 17h Models 60h-6Fh
>>
>> arch/x86/kernel/amd_nb.c | 5 +++++
>> drivers/edac/amd64_edac.c | 14 ++++++++++++++
>> drivers/edac/amd64_edac.h | 3 +++
>> drivers/hwmon/k10temp.c | 2 ++
>> include/linux/pci_ids.h | 1 +
>> 5 files changed, 25 insertions(+)
>>
>> --
>> 2.27.0
>>
>

2020-06-16 14:14:28

by Yazen Ghannam

[permalink] [raw]
Subject: Re: [PATCH 0/2] MCA and EDAC updates for AMD Family 17h, Model 60h

On Mon, Jun 15, 2020 at 07:59:50AM -0400, Borislav Petkov wrote:
> + Yazen and linux-hwmon.
>
> On Sun, Jun 07, 2020 at 12:37:07PM +0800, Jacky Hu wrote:
> > This patchset adds MCA and EDAC support for AMD Family 17h, Model 60h.
> >
> > Also k10temp works with 4800h
> >
> > k10temp-pci-00c3
> > Adapter: PCI adapter
> > Vcore: 1.55 V
> > Vsoc: 1.55 V
> > Tctl: +49.6?C
> > Tdie: +49.6?C
> > Icore: 0.00 A
> > Isoc: 0.00 A
> >
> > Jacky Hu (2):
> > x86/amd_nb: Add Family 17h, Model 60h PCI IDs
> > EDAC/amd64: Add family ops for Family 17h Models 60h-6Fh
> >
> > arch/x86/kernel/amd_nb.c | 5 +++++
> > drivers/edac/amd64_edac.c | 14 ++++++++++++++
> > drivers/edac/amd64_edac.h | 3 +++
> > drivers/hwmon/k10temp.c | 2 ++
> > include/linux/pci_ids.h | 1 +
> > 5 files changed, 25 insertions(+)
> >

PCI IDs and EDAC look good to me.

Acked-by: Yazen Ghannam <[email protected]>

Thanks,
Yazen

2020-06-16 14:39:42

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 0/2] MCA and EDAC updates for AMD Family 17h, Model 60h

On Mon, Jun 15, 2020 at 08:01:22AM -0700, Guenter Roeck wrote:
> Looks like we may have to black-list current measurements
> for that chip, though.
>
> Guenter
>
> >> Jacky Hu (2):
> >> x86/amd_nb: Add Family 17h, Model 60h PCI IDs
> >> EDAC/amd64: Add family ops for Family 17h Models 60h-6Fh
> >>
> >> arch/x86/kernel/amd_nb.c | 5 +++++
> >> drivers/edac/amd64_edac.c | 14 ++++++++++++++
> >> drivers/edac/amd64_edac.h | 3 +++
> >> drivers/hwmon/k10temp.c | 2 ++

... meaning I should not take the k10temp changes yet? I can drop them
and take the rest...

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2020-06-16 14:50:58

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 0/2] MCA and EDAC updates for AMD Family 17h, Model 60h

On 6/16/20 7:35 AM, Borislav Petkov wrote:
> On Mon, Jun 15, 2020 at 08:01:22AM -0700, Guenter Roeck wrote:
>> Looks like we may have to black-list current measurements
>> for that chip, though.
>>
>> Guenter
>>
>>>> Jacky Hu (2):
>>>> x86/amd_nb: Add Family 17h, Model 60h PCI IDs
>>>> EDAC/amd64: Add family ops for Family 17h Models 60h-6Fh
>>>>
>>>> arch/x86/kernel/amd_nb.c | 5 +++++
>>>> drivers/edac/amd64_edac.c | 14 ++++++++++++++
>>>> drivers/edac/amd64_edac.h | 3 +++
>>>> drivers/hwmon/k10temp.c | 2 ++
>
> ... meaning I should not take the k10temp changes yet? I can drop them
> and take the rest...
>

No, that is independent. It is more like a note to myself. I'll have to get
debug dumps from someone with affected chip(s), and for that to work
support for those chips has to be enabled in k10temp.

Thanks,
Guenter

2020-06-16 14:59:40

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 0/2] MCA and EDAC updates for AMD Family 17h, Model 60h

On Tue, Jun 16, 2020 at 07:46:36AM -0700, Guenter Roeck wrote:
> No, that is independent. It is more like a note to myself. I'll have to get
> debug dumps from someone with affected chip(s), and for that to work
> support for those chips has to be enabled in k10temp.

Ok, then, will take those patches as is.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2020-06-16 18:12:00

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 2/2] EDAC/amd64: Add family ops for Family 17h Models 60h-6Fh

On Sun, Jun 07, 2020 at 12:37:09PM +0800, Jacky Hu wrote:
> Add family ops to support AMD Family 17h, Models 60h-6Fh systems.
>
> Signed-off-by: Jacky Hu <[email protected]>
> ---
> drivers/edac/amd64_edac.c | 14 ++++++++++++++
> drivers/edac/amd64_edac.h | 3 +++
> 2 files changed, 17 insertions(+)

b6bea24d4151 ("EDAC/amd64: Add AMD family 17h model 60h PCI IDs")

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2020-06-16 18:13:01

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86/amd_nb: Add Family 17h, Model 60h PCI IDs

On Sun, Jun 07, 2020 at 12:37:08PM +0800, Jacky Hu wrote:
> Add the new Family 17h, Model 60h PCI IDs for AMD Zen2 APU systems.
>
> Signed-off-by: Jacky Hu <[email protected]>
> ---
> arch/x86/kernel/amd_nb.c | 5 +++++
> drivers/hwmon/k10temp.c | 2 ++
> include/linux/pci_ids.h | 1 +
> 3 files changed, 8 insertions(+)

Blergh, this shows that I need a vacation. That's already upstream:

a4e91825d7e1 ("x86/amd_nb: Add AMD family 17h model 60h PCI IDs")

modulo the k10temp bits.

Jacky, I'll let you sort this out with Guenter.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2020-06-17 01:35:27

by Jacky Hu

[permalink] [raw]
Subject: [PATCH] hwmon: (k10temp) Add AMD family 17h model 60h probe

With this patch applied, output from 4800H (idle) looks as follows:

k10temp-pci-00c3
Adapter: PCI adapter
Vcore: 1.55 V
Vsoc: 1.55 V
Tctl: +49.6°C
Tdie: +49.6°C
Icore: 0.00 A
Isoc: 0.00 A

Signed-off-by: Jacky Hu <[email protected]>
---
drivers/hwmon/k10temp.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
index 8f12995ec133..287e9cf2aab9 100644
--- a/drivers/hwmon/k10temp.c
+++ b/drivers/hwmon/k10temp.c
@@ -583,6 +583,7 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
k10temp_get_ccd_support(pdev, data, 4);
break;
case 0x31: /* Zen2 Threadripper */
+ case 0x60: /* Zen2 APU */
case 0x71: /* Zen2 */
data->show_current = !is_threadripper() && !is_epyc();
data->cfactor[0] = CFACTOR_ICORE;
--
2.27.0

2020-06-17 03:42:41

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] hwmon: (k10temp) Add AMD family 17h model 60h probe

On Wed, Jun 17, 2020 at 09:32:55AM +0800, Jacky Hu wrote:
> With this patch applied, output from 4800H (idle) looks as follows:
>
> k10temp-pci-00c3
> Adapter: PCI adapter
> Vcore: 1.55 V
> Vsoc: 1.55 V
> Tctl: +49.6?C
> Tdie: +49.6?C
> Icore: 0.00 A
> Isoc: 0.00 A
>
> Signed-off-by: Jacky Hu <[email protected]>
> ---
> drivers/hwmon/k10temp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
> index 8f12995ec133..287e9cf2aab9 100644
> --- a/drivers/hwmon/k10temp.c
> +++ b/drivers/hwmon/k10temp.c
> @@ -583,6 +583,7 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> k10temp_get_ccd_support(pdev, data, 4);
> break;
> case 0x31: /* Zen2 Threadripper */
> + case 0x60: /* Zen2 APU */

Unfortunately it is not that simple. Output above and the little data I have
available suggests that current and voltage measurements are different on the
APU. That means that show_current must remain false.
This will require a separate case statement which doesn't set any flags.

Guenter

> case 0x71: /* Zen2 */
> data->show_current = !is_threadripper() && !is_epyc();
> data->cfactor[0] = CFACTOR_ICORE;
> --
> 2.27.0
>

2020-06-17 07:22:19

by Jacky Hu

[permalink] [raw]
Subject: Re: [PATCH] hwmon: (k10temp) Add AMD family 17h model 60h probe

Hi Guenter,

By increasing the regs count from 32 to 256 and looking into the output of `cat /sys/kernel/debug/k10temp-0000\:00\:18.3/svi`
There is some data from 0x05a300 - 0x05a330
Do you have any idea how we can guess the offset for this model?

0x05a000: 00000000 00000000 00000000 00000000
0x05a010: 00000000 00000000 00000000 00000000
0x05a020: 00000000 00000000 00000000 00000000
0x05a030: 00000000 00000000 00000000 00000000
0x05a040: 00000000 00000000 00000000 00000000
0x05a050: 00000000 00000000 00000000 00000000
0x05a060: 00000000 00000000 00000000 00000000
0x05a070: 00000000 00000000 00000000 00000000
0x05a080: 00000000 00000000 00000000 00000000
0x05a090: 00000000 00000000 00000000 00000000
0x05a0a0: 00000000 00000000 00000000 00000000
0x05a0b0: 00000000 00000000 00000000 00000000
0x05a0c0: 00000000 00000000 00000000 00000000
0x05a0d0: 00000000 00000000 00000000 00000000
0x05a0e0: 00000000 00000000 00000000 00000000
0x05a0f0: 00000000 00000000 00000000 00000000
0x05a100: 00000000 00000000 00000000 00000000
0x05a110: 00000000 00000000 00000000 00000000
0x05a120: 00000000 00000000 00000000 00000000
0x05a130: 00000000 00000000 00000000 00000000
0x05a140: 00000000 00000000 00000000 00000000
0x05a150: 00000000 00000000 00000000 00000000
0x05a160: 00000000 00000000 00000000 00000000
0x05a170: 00000000 00000000 00000000 00000000
0x05a180: 00000000 00000000 00000000 00000000
0x05a190: 00000000 00000000 00000000 00000000
0x05a1a0: 00000000 00000000 00000000 00000000
0x05a1b0: 00000000 00000000 00000000 00000000
0x05a1c0: 00000000 00000000 00000000 00000000
0x05a1d0: 00000000 00000000 00000000 00000000
0x05a1e0: 00000000 00000000 00000000 00000000
0x05a1f0: 00000000 00000000 00000000 00000000
0x05a200: 00000000 00000000 00000000 00000000
0x05a210: 00000000 00000000 00000000 00000000
0x05a220: 00000000 00000000 00000000 00000000
0x05a230: 00000000 00000000 00000000 00000000
0x05a240: 00000000 00000000 00000000 00000000
0x05a250: 00000000 00000000 00000000 00000000
0x05a260: 00000000 00000000 00000000 00000000
0x05a270: 00000000 00000000 00000000 00000000
0x05a280: 00000000 00000000 00000000 00000000
0x05a290: 00000000 00000000 00000000 00000000
0x05a2a0: 00000000 00000000 00000000 00000000
0x05a2b0: 00000000 00000000 00000000 00000000
0x05a2c0: 00000000 00000000 00000000 00000000
0x05a2d0: 00000000 00000000 00000000 00000000
0x05a2e0: 00000000 00000000 00000000 00000000
0x05a2f0: 00000000 00000000 00000000 00000000
0x05a300: 00000000 00000001 00000000 00002710
0x05a310: 00000000 00000008 0000000e 00000000
0x05a320: 00000001 0000c000 00000000 0000000b
0x05a330: 00000001 00000000 00000000 00000000
0x05a340: 00000000 00000000 00000000 00000000
0x05a350: 00000000 00000000 00000000 00000000
0x05a360: 00000000 00000000 00000000 00000000
0x05a370: 00000000 00000000 00000000 00000000
0x05a380: 00000000 00000000 00000000 00000000
0x05a390: 00000000 00000000 00000000 00000000
0x05a3a0: 00000000 00000000 00000000 00000000
0x05a3b0: 00000000 00000000 00000000 00000000
0x05a3c0: 00000000 00000000 00000000 00000000
0x05a3d0: 00000000 00000000 00000000 00000000
0x05a3e0: 00000000 00000000 00000000 00000000
0x05a3f0: 00000000 00000000 00000000 00000000

Thanks.
Jacky
On Tue, Jun 16, 2020 at 08:40:28PM -0700, Guenter Roeck wrote:
> On Wed, Jun 17, 2020 at 09:32:55AM +0800, Jacky Hu wrote:
> > With this patch applied, output from 4800H (idle) looks as follows:
> >
> > k10temp-pci-00c3
> > Adapter: PCI adapter
> > Vcore: 1.55 V
> > Vsoc: 1.55 V
> > Tctl: +49.6°C
> > Tdie: +49.6°C
> > Icore: 0.00 A
> > Isoc: 0.00 A
> >
> > Signed-off-by: Jacky Hu <[email protected]>
> > ---
> > drivers/hwmon/k10temp.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
> > index 8f12995ec133..287e9cf2aab9 100644
> > --- a/drivers/hwmon/k10temp.c
> > +++ b/drivers/hwmon/k10temp.c
> > @@ -583,6 +583,7 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> > k10temp_get_ccd_support(pdev, data, 4);
> > break;
> > case 0x31: /* Zen2 Threadripper */
> > + case 0x60: /* Zen2 APU */
>
> Unfortunately it is not that simple. Output above and the little data I have
> available suggests that current and voltage measurements are different on the
> APU. That means that show_current must remain false.
> This will require a separate case statement which doesn't set any flags.
>
> Guenter
>
> > case 0x71: /* Zen2 */
> > data->show_current = !is_threadripper() && !is_epyc();
> > data->cfactor[0] = CFACTOR_ICORE;
> > --
> > 2.27.0
> >

2020-06-17 14:38:12

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] hwmon: (k10temp) Add AMD family 17h model 60h probe

On Wed, Jun 17, 2020 at 03:19:27PM +0800, Jacky Hu wrote:
> Hi Guenter,
>
> By increasing the regs count from 32 to 256 and looking into the output of `cat /sys/kernel/debug/k10temp-0000\:00\:18.3/svi`
> There is some data from 0x05a300 - 0x05a330
> Do you have any idea how we can guess the offset for this model?
>

For other chips, the upper 16 bits of the register reported the voltage
and the lower 16 bit reported the current. It might possibly be that the
data is now split into multiple registers, but that is impossible to
determine without datasheet and/or additional information. So, sorry,
no, I have no idea. We'll have to wait for someone to reverse engineer
it.

Can you send the contents of the "thm" file ? Maybe we can at least
find the new location of the ccd temperature registers.

Guenter

2020-06-17 14:56:48

by Alexander Monakov

[permalink] [raw]
Subject: Re: [PATCH] hwmon: (k10temp) Add AMD family 17h model 60h probe

Hi,

I've already said in my patch submission (which was Cc'ed to LKML,
linux-edac and linux-hwmon so you should have been able to find it):

>> It appears SMU offsets for reading current/voltage and CCD temperature
>> have changed for this generation (reads from currently used offsets
>> yield zeros), so those features cannot be enabled so trivially.

In https://github.com/FlyGoat/ryzen_nb_smu/issues/3 there some
reverse-engineered info that indicates that for Renoir, SMU region has been
moved to 0x6F000. Its layout also changed, as far as I can tell.

(also, please ask yourself if you want to offer the maintainers an apology)

Alexander

2020-06-17 15:00:09

by Jacky Hu

[permalink] [raw]
Subject: Re: [PATCH] hwmon: (k10temp) Add AMD family 17h model 60h probe

Yep, here it is

~> cat thm.idle
0x059800: 29a00fef 017f1201 00012921 000f4240
0x059810: 800000f9 00000000 00000000 00000000
0x059820: 00000000 00000000 00000000 0fff0078
0x059830: 00000000 002cecf9 002cecf9 002d2cfb
0x059840: 002cccf8 002cacf7 002d2cfb 002cccf8
0x059850: 002d2cfb 002c8cf6 002cccf8 002cacf7
0x059860: 002cacf7 002cecf9 002c8cf6 002d0cfa
0x059870: 002d2cfb 002d0cfa 002d0cfa 002cacf7
0x059880: 002cecf9 002d0cfa 002cecf9 002cacf7
0x059890: 002cccf8 002c6cf5 002d2cfb 002c8cf6
0x0598a0: 002c8cf6 002cccf8 002cacf7 002cccf8
0x0598b0: 002c8cf6 00000000 00002100 ffffffff
0x0598c0: 00000000 00000000 00000000 00000000
0x0598d0: 00000000 00000000 00000000 00000000
0x0598e0: 00000000 00000000 00000000 00000000
0x0598f0: 00000000 00000000 00000000 00000000
0x059900: 00000000 00000000 00000000 00000000
0x059910: 00000000 00000000 00000000 00000000
0x059920: 00000000 00000000 00000000 00000000
0x059930: 00000000 00000000 00000000 00000000
0x059940: 00000000 00000000 00000000 00000000
0x059950: 00000000 00000000 00000000 00000000
0x059960: 00000000 00000000 00000000 00000000
0x059970: 00000000 00000000 08400001 00005229
0x059980: 00000053 a7800005 3118680e 00000000
0x059990: 00000000 00000000 00000000 00000000
0x0599a0: 00000000 00000000 00000000 00000000
0x0599b0: 00000000 00000000 00000000 00000000
0x0599c0: 00000000 00000000 00000000 00000000
0x0599d0: 00000000 00003060 000002d4 00000019
0x0599e0: 000002c6 00000008 00000000 00000000
0x0599f0: 000002d4 00000019 00000000 00000000
0x059a00: 00000001 0001000d 00000000 00000000
0x059a10: 00000000 00000000 00000000 00000000
0x059a20: 00000000 00000000 00000000 00000000
0x059a30: 00000000 00000000 00000000 00000000
0x059a40: 00000000 00000000 00000000 00000000
0x059a50: 00000000 00000000 00000000 00000000
0x059a60: 00000000 00000000 00000000 00000000
0x059a70: 00000000 00000000 00000000 00000000
0x059a80: 00000000 00000000 00000000 00000000
0x059a90: 00000000 00000000 00000000 00000000
0x059aa0: 00000000 00000000 00000000 00000000
0x059ab0: 00000000 00000000 00000000 00000000
0x059ac0: 00000000 00000000 00000000 00000000
0x059ad0: 00000000 00000000 00000000 00000000
0x059ae0: 00000000 00000000 00000000 00000000
0x059af0: 00000000 00000000 00000000 00000000
0x059b00: 00000000 00000000 00000000 00000000
0x059b10: 0000000e 00000000 00000003 00000000
0x059b20: 901f001a 00050003 00000000 00000000
0x059b30: 00480001 00000000 00000000 00000000
0x059b40: 00000000 00000000 00000010 0000ffff
0x059b50: 00000000 00000000 00000000 00000000
0x059b60: 00000000 00000000 00000000 00000000
0x059b70: 00000000 00000000 00000000 00130082
0x059b80: 0000067f 12110201 0003045a 00001303
0x059b90: 00000000 028a4f5c 08036927 0021e548
0x059ba0: 00000000 7fffffff 00000000 00000043
0x059bb0: c00001c0 000000f9 00000000 00000000
0x059bc0: 00000000 00000000 00000000 00000000
0x059bd0: 00000000 00000000 00000000 00000000
0x059be0: 00000000 00000000 00000000 00000000
0x059bf0: 00000000 00000000 00000000 00000000

~> cat thm.busy
0x059800: 57800fef 017f1201 00012921 000f4240
0x059810: 800000f9 00000000 00000000 00000000
0x059820: 00000000 00000000 00000000 0fff0078
0x059830: 00000000 00372d4d 0042edad 003f6d90
0x059840: 00416da1 003e0d85 00392d5d 003bad72
0x059850: 00394d5e 003acd6b 00382d55 00348d37
0x059860: 0033ad30 0033cd31 0033cd31 00336d2e
0x059870: 00338d2f 0043edb5 00402d97 00440db6
0x059880: 0040ed9d 0039ed63 003c4d77 0039ed63
0x059890: 003c2d76 003a0d65 00338d2f 00334d2d
0x0598a0: 0033ad30 00342d34 00344d35 0037cd52
0x0598b0: 0035ed43 00000000 00002100 ffffffff
0x0598c0: 00000000 00000000 00000000 00000000
0x0598d0: 00000000 00000000 00000000 00000000
0x0598e0: 00000000 00000000 00000000 00000000
0x0598f0: 00000000 00000000 00000000 00000000
0x059900: 00000000 00000000 00000000 00000000
0x059910: 00000000 00000000 00000000 00000000
0x059920: 00000000 00000000 00000000 00000000
0x059930: 00000000 00000000 00000000 00000000
0x059940: 00000000 00000000 00000000 00000000
0x059950: 00000000 00000000 00000000 00000000
0x059960: 00000000 00000000 00000000 00000000
0x059970: 00000000 00000000 08400001 0000ae57
0x059980: 0000005b a7800005 3118680e 00000000
0x059990: 00000000 00000000 00000000 00000000
0x0599a0: 00000000 00000000 00000000 00000000
0x0599b0: 00000000 00000000 00000000 00000000
0x0599c0: 00000000 00000000 00000000 00000000
0x0599d0: 00000000 00003060 00000440 00000012
0x0599e0: 00000334 0000001a 00000000 00000000
0x0599f0: 00000440 00000012 00000000 00000000
0x059a00: 00000001 0001000d 00000000 00000000
0x059a10: 00000000 00000000 00000000 00000000
0x059a20: 00000000 00000000 00000000 00000000
0x059a30: 00000000 00000000 00000000 00000000
0x059a40: 00000000 00000000 00000000 00000000
0x059a50: 00000000 00000000 00000000 00000000
0x059a60: 00000000 00000000 00000000 00000000
0x059a70: 00000000 00000000 00000000 00000000
0x059a80: 00000000 00000000 00000000 00000000
0x059a90: 00000000 00000000 00000000 00000000
0x059aa0: 00000000 00000000 00000000 00000000
0x059ab0: 00000000 00000000 00000000 00000000
0x059ac0: 00000000 00000000 00000000 00000000
0x059ad0: 00000000 00000000 00000000 00000000
0x059ae0: 00000000 00000000 00000000 00000000
0x059af0: 00000000 00000000 00000000 00000000
0x059b00: 00000000 00000000 00000000 00000000
0x059b10: 0000000e 00000000 00000003 00000000
0x059b20: 901f001a 00050003 00000000 00000000
0x059b30: 00480001 00000000 00000000 00000000
0x059b40: 00000000 00000000 00000010 0000ffff
0x059b50: 00000000 00000000 00000000 00000000
0x059b60: 00000000 00000000 00000000 00000000
0x059b70: 00000000 00000000 00000000 00130082
0x059b80: 0000067f 12110201 0003045a 00001303
0x059b90: 00000000 028a4f5c 08036927 0021e548
0x059ba0: 00000000 7fffffff 00000000 00000043
0x059bb0: c00001c0 000000f9 00000000 00000000
0x059bc0: 00000000 00000000 00000000 00000000
0x059bd0: 00000000 00000000 00000000 00000000
0x059be0: 00000000 00000000 00000000 00000000
0x059bf0: 00000000 00000000 00000000 00000000

Jacky
On Wed, Jun 17, 2020 at 07:33:42AM -0700, Guenter Roeck wrote:
> On Wed, Jun 17, 2020 at 03:19:27PM +0800, Jacky Hu wrote:
> > Hi Guenter,
> >
> > By increasing the regs count from 32 to 256 and looking into the output of `cat /sys/kernel/debug/k10temp-0000\:00\:18.3/svi`
> > There is some data from 0x05a300 - 0x05a330
> > Do you have any idea how we can guess the offset for this model?
> >
>
> For other chips, the upper 16 bits of the register reported the voltage
> and the lower 16 bit reported the current. It might possibly be that the
> data is now split into multiple registers, but that is impossible to
> determine without datasheet and/or additional information. So, sorry,
> no, I have no idea. We'll have to wait for someone to reverse engineer
> it.
>
> Can you send the contents of the "thm" file ? Maybe we can at least
> find the new location of the ccd temperature registers.
>
> Guenter

2020-06-17 15:10:02

by Jacky Hu

[permalink] [raw]
Subject: Re: [PATCH] hwmon: (k10temp) Add AMD family 17h model 60h probe

Hi,

Sorry, I apologize for didn't do much lookup that you already did the patch
submission before I submitted the patch.
I have to say we are all programmed by the programs.
Also I didn't submit to either of the lists.
A few places I did looked at are below before I did the submission.
https://pci-ids.ucw.cz/v2.2/pci.ids
https://lore.kernel.org/patchwork/project/lkml/list/

Jacky
On Wed, Jun 17, 2020 at 05:54:36PM +0300, Alexander Monakov wrote:
> Hi,
>
> I've already said in my patch submission (which was Cc'ed to LKML,
> linux-edac and linux-hwmon so you should have been able to find it):
>
> >> It appears SMU offsets for reading current/voltage and CCD temperature
> >> have changed for this generation (reads from currently used offsets
> >> yield zeros), so those features cannot be enabled so trivially.
>
> In https://github.com/FlyGoat/ryzen_nb_smu/issues/3 there some
> reverse-engineered info that indicates that for Renoir, SMU region has been
> moved to 0x6F000. Its layout also changed, as far as I can tell.
>
> (also, please ask yourself if you want to offer the maintainers an apology)
>
> Alexander

2020-06-17 15:26:49

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH] hwmon: (k10temp) Add AMD family 17h model 60h probe

Ok, both of you:

On Wed, Jun 17, 2020 at 11:07:35PM +0800, Jacky Hu wrote:
> Hi,
>
> Sorry, I apologize for didn't do much lookup that you already did the patch
> submission before I submitted the patch.
> I have to say we are all programmed by the programs.
> Also I didn't submit to either of the lists.
> A few places I did looked at are below before I did the submission.
> https://pci-ids.ucw.cz/v2.2/pci.ids
> https://lore.kernel.org/patchwork/project/lkml/list/

Jacky, please do not top-post. Please adhere to the etiquette on public
mailing lists.

Alexander, things like that can happen and they pretty much do happen
everytime new hw comes out. Kernel development has exploded so much in
recent years so that it is absolutely normal to miss stuff. Hell, *we*
miss stuff too, from time to time.

So let's concentrate on the work pls.

Thank you both!

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette