Skip to contentSkip to conversation

hwmon: amd_energy: match for supported models

PATCH Applied Naveen Krishna Chatradhi 3 participants 6 messages Jul 6, 2020 – Jul 7, 2020 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: amd_energy: match for supported models

The energy counters of certain models seems to be reporting inconsisten values. Hence, match for the supported models.

---
 drivers/hwmon/amd_energy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/amd_energy.c +1 -1
index e95b7426106e..29603742c858 100644
@@ -362,7 +362,7 @@ static struct platform_driver amd_energy_driver = {
 static struct platform_device *amd_energy_platdev;
 
 static const struct x86_cpu_id cpu_ids[] __initconst = {
-	X86_MATCH_VENDOR_FAM(AMD, 0x17, NULL),
+	X86_MATCH_VENDOR_FAM_MODEL(AMD, 0x17, 0x31, NULL),
 	{}
 };
 MODULE_DEVICE_TABLE(x86cpu, cpu_ids);
Signature · 1 line
2.17.1
#1 lore raw

Hi Guenter,

Quoted 3 lines · Naveen Krishna Chatradhi

The energy counters of certain models seems to be reporting inconsisten values. Hence, match for the supported models.

Actually, the supported models could be of family 0x17 in a range between 0x30 ~ 0x3f. I did not find any macro or usage for a range of models. Could you suggest to me if i've missed an existing way to provide a range for models.

Quoted 22 lines
---
 drivers/hwmon/amd_energy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/amd_energy.c +1 -2
index e95b7426106e..29603742c858 100644
@@ -362,7 +362,7 @@ static struct platform_driver amd_energy_driver = {
 static struct platform_device *amd_energy_platdev;
 
 static const struct x86_cpu_id cpu_ids[] __initconst = {
-       X86_MATCH_VENDOR_FAM(AMD, 0x17, NULL),
+       X86_MATCH_VENDOR_FAM_MODEL(AMD, 0x17, 0x31, NULL),
        {}
 };
 MODULE_DEVICE_TABLE(x86cpu, cpu_ids);
--

2.17.1

Signature · 2 lines
Shine bright,
(: Nav :)
maintainer
#2 lore raw
Quoted 11 lines · Naveen Krishna Ch

Hi Guenter,

Quoted 3 lines · Naveen Krishna Chatradhi

The energy counters of certain models seems to be reporting inconsisten values. Hence, match for the supported models.

Actually, the supported models could be of family 0x17 in a range between 0x30 ~ 0x3f. I did not find any macro or usage for a range of models. Could you suggest to me if i've missed an existing way to provide a range for models.

I have no idea, sorry. Maybe match all of them, check for actually supported models in the probe function, and return -ENODEV if the model is not supported. Alternatively, just list all models in the supported range.

Either case, how would you know that a future model in the presumably supported range doesn't have a bug in the microcode that makes it report bad data ? Assuming that this is a microcode bug, of course.

Guenter

Quoted 24 lines
Quoted 22 lines
---
 drivers/hwmon/amd_energy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/amd_energy.c +1 -2
index e95b7426106e..29603742c858 100644
@@ -362,7 +362,7 @@ static struct platform_driver amd_energy_driver = {
 static struct platform_device *amd_energy_platdev;
 
 static const struct x86_cpu_id cpu_ids[] __initconst = {
-       X86_MATCH_VENDOR_FAM(AMD, 0x17, NULL),
+       X86_MATCH_VENDOR_FAM_MODEL(AMD, 0x17, 0x31, NULL),
        {}
 };
 MODULE_DEVICE_TABLE(x86cpu, cpu_ids);
--

2.17.1

maintainer
#3 lore raw
In reply to Naveen Krishna Ch
Quoted 11 lines · Naveen Krishna Ch

Hi Guenter,

Quoted 3 lines · Naveen Krishna Chatradhi

The energy counters of certain models seems to be reporting inconsisten values. Hence, match for the supported models.

Actually, the supported models could be of family 0x17 in a range between 0x30 ~ 0x3f. I did not find any macro or usage for a range of models. Could you suggest to me if i've missed an existing way to provide a range for models.

So, do you want me to apply the patch as-is, or are you going to send an updated version ?

Thanks,
Guenter

Quoted 24 lines
Quoted 22 lines
---
 drivers/hwmon/amd_energy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/amd_energy.c +1 -2
index e95b7426106e..29603742c858 100644
@@ -362,7 +362,7 @@ static struct platform_driver amd_energy_driver = {
 static struct platform_device *amd_energy_platdev;
 
 static const struct x86_cpu_id cpu_ids[] __initconst = {
-       X86_MATCH_VENDOR_FAM(AMD, 0x17, NULL),
+       X86_MATCH_VENDOR_FAM_MODEL(AMD, 0x17, 0x31, NULL),
        {}
 };
 MODULE_DEVICE_TABLE(x86cpu, cpu_ids);
--

2.17.1

#4 lore raw

Hi Guenter

Quoted 8 lines · Guenter Roeck
Quoted 6 lines · Naveen Krishna Ch

Hi Guenter,

Quoted 3 lines · Naveen Krishna Chatradhi

The energy counters of certain models seems to be reporting inconsisten values. Hence, match for the supported models.

Quoted 7 lines
Quoted 5 lines

Actually, the supported models could be of family 0x17 in a range between 0x30 ~ 0x3f. I did not find any macro or usage for a range of models. Could you suggest to me if i've missed an existing way to provide a range for models.

So, do you want me to apply the patch as-is, or are you going to send an updated version ?

Please take this patch as-is, i will update the supported models when ever i get a chance to test on them.

Quoted 29 lines

Thanks,
Guenter

Quoted 24 lines
Quoted 22 lines
---
 drivers/hwmon/amd_energy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/amd_energy.c +1 -2
index e95b7426106e..29603742c858 100644
@@ -362,7 +362,7 @@ static struct platform_driver amd_energy_driver = {
 static struct platform_device *amd_energy_platdev;
 
 static const struct x86_cpu_id cpu_ids[] __initconst = {
-       X86_MATCH_VENDOR_FAM(AMD, 0x17, NULL),
+       X86_MATCH_VENDOR_FAM_MODEL(AMD, 0x17, 0x31, NULL),
        {}
 };
 MODULE_DEVICE_TABLE(x86cpu, cpu_ids);
--

2.17.1

Signature · 2 lines
Shine bright,
(: Nav :)
maintainer Applied
#5 lore raw
In reply to Naveen Krishna Chatradhi
Quoted 4 lines · Naveen Krishna Chatradhi

The energy counters of certain models seems to be reporting inconsisten values. Hence, match for the supported models.

Applied.

Thanks,
Guenter

Quoted 17 lines
---
 drivers/hwmon/amd_energy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/amd_energy.c +1 -1
index e95b7426106e..29603742c858 100644
@@ -362,7 +362,7 @@ static struct platform_driver amd_energy_driver = {
 static struct platform_device *amd_energy_platdev;
 
 static const struct x86_cpu_id cpu_ids[] __initconst = {
-	X86_MATCH_VENDOR_FAM(AMD, 0x17, NULL),
+	X86_MATCH_VENDOR_FAM_MODEL(AMD, 0x17, 0x31, NULL),
 	{}
 };
 MODULE_DEVICE_TABLE(x86cpu, cpu_ids);