summaryrefslogtreecommitdiff
path: root/drivers/hwmon/amd_energy.c
AgeCommit message (Collapse)Author
2021-02-11hwmon: (amd_energy) Add AMD family 19h model 30h x86 matchNaveen Krishna Chatradhi
Add X86 CPU match for AMD family 19h model 30h. This is necessary to enable support for energy reporting via the amd_energy module. Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Link: https://lore.kernel.org/r/20210211172054.246276-1-nchatrad@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-01-08hwmon: (amd_energy) fix allocation of hwmon_channel_info configDavid Arcari
hwmon, specifically hwmon_num_channel_attrs, expects the config array in the hwmon_channel_info structure to be terminated by a zero entry. amd_energy does not honor this convention. As result, a KASAN warning is possible. Fix this by adding an additional entry and setting it to zero. Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters") Signed-off-by: David Arcari <darcari@redhat.com> Cc: Naveen Krishna Chatradhi <nchatrad@amd.com> Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: David Arcari <darcari@redhat.com> Acked-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Link: https://lore.kernel.org/r/20210107144707.6927-1-darcari@redhat.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-12-02hwmon: (amd_energy) Add AMD family 19h model 01h x86 matchNaveen Krishna Chatradhi
Add X86 CPU match for AMD family 19h model 01h. This is necessary to enable support for energy reporting via the amd_energy module. Signed-off-by: Naveen Krishna Chatradhi <NaveenKrishna.Chatradhi@amd.com> Link: https://lore.kernel.org/r/20201119184246.228322-1-NaveenKrishna.Chatradhi@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-11-13hwmon: (amd_energy) modify the visibility of the countersNaveen Krishna Chatradhi
This patch limits the visibility to owner and groups only for the energy counters exposed through the hwmon based amd_energy driver. Cc: stable@vger.kernel.org Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Link: https://lore.kernel.org/r/20201112172159.8781-1-nchatrad@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-10-04hwmon: (amd_energy) Improve the accumulation logicNaveen Krishna Chatradhi
Factor out the common code in the accumulation functions for core and socket accumulation. While at it, handle the return value of the amd_create_sensor() function. Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Link: https://lore.kernel.org/r/20200929105322.8919-4-nchatrad@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-29hwmon: (amd_energy) optimize accumulation intervalNaveen Krishna Chatradhi
On a system with course grain resolution of energy unit (milli J) the accumulation thread can be executed less frequently than on the system with fine grain resolution(micro J). This patch sets the accumulation thread interval to an optimum value calculated based on the (energy unit) resolution supported by the hardware (assuming a peak wattage of 240W). Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Link: https://lore.kernel.org/r/20200929105322.8919-3-nchatrad@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-29hwmon: (amd_energy) Move label out of accumulation structureAkshay Gupta
At present, core & socket labels are defined in struct sensor_accumulator This patch moves it to the amd_energy_data structure, which will help in calling memset on struct sensor_accumulator to optimize the code. Signed-off-by: Akshay Gupta <Akshay.Gupta@amd.com> Link: https://lore.kernel.org/r/20200929105322.8919-2-nchatrad@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-07-07hwmon: (amd_energy) match for supported modelsNaveen Krishna Chatradhi
The energy counters of certain models seems to be reporting inconsistent values. Hence, match for the supported models. Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters") Link: https://lore.kernel.org/r/20200706171715.124993-1-nchatrad@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-05-26hwmon: (amd_energy) Missing platform_driver_unregister() on error in ↵Wei Yongjun
amd_energy_init() Add the missing platform_driver_unregister() before return from amd_energy_init() in the error handling case. Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Naveen krishna Chatradhi <nchatrad@amd.com> Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20200527022417.105620-1-weiyongjun1@huawei.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-05-22hwmon: Add amd_energy driver to report energy countersNaveen Krishna Chatradhi
This patch adds hwmon based amd_energy driver support for family 17h processors from AMD. The driver provides following interface to the userspace 1. Reports the per core consumption * file: "energy%d_input", label: "Ecore%03d" 2. Reports per socket energy consumption * file: "energy%d_input", label: "Esocket%d" 3. To, increase the wrap around time of the socket energy counters, a 64bit accumultor is implemented. 4. Reports scaled energy value in Joules. Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Link: https://lore.kernel.org/r/20200519155011.56184-1-nchatrad@amd.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>