summaryrefslogtreecommitdiffstats
path: root/drivers
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'nvme-6.9-2024-03-21' of git://git.infradead.org/nvme into block-6.9Jens Axboe2024-03-2111-33/+233
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull NVMe fixes from Keith: "nvme updates for Linux 6.9 - Make an informative message less ominous (Keith) - Enhanced trace decoding (Guixin) - TCP updates (Hannes, Li) - Fabrics connect deadlock fix (Chunguang) - Platform API migration update (Uwe) - A new device quirk (Jiawei)" * tag 'nvme-6.9-2024-03-21' of git://git.infradead.org/nvme: nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flag nvme: remove redundant BUILD_BUG_ON check nvme/tcp: Add wq_unbound modparam for nvme_tcp_wq nvme-tcp: Export the nvme_tcp_wq to sysfs drivers/nvme: Add quirks for device 126f:2262 nvme: parse format command's lbafu when tracing nvme: add tracing of reservation commands nvme: parse zns command's zsa and zrasf to string nvme: use nvme_disk_is_ns_head helper nvme: fix reconnection fail due to reserved tag allocation nvmet: add tracing of zns commands nvmet: add tracing of authentication commands nvme-apple: Convert to platform remove callback returning void nvmet-tcp: do not continue for invalid icreq nvme: change shutdown timeout setting message
| * nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flagGuixin Liu2024-03-211-5/+3
| | | | | | | | | | | | | | | | | | We can simply use invalidate_rkey to check instead of adding a flag. Signed-off-by: Guixin Liu <kanie@linux.alibaba.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme: remove redundant BUILD_BUG_ON checkGuixin Liu2024-03-211-3/+0
| | | | | | | | | | | | | | | | | | | | Remove redundant BUILD_BUG_ON check of struct nvme_dsm_range, it's already checked in nvme_init_ctrl(). Signed-off-by: Guixin Liu <kanie@linux.alibaba.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme/tcp: Add wq_unbound modparam for nvme_tcp_wqLi Feng2024-03-181-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | The default nvme_tcp_wq will use all CPUs to process tasks. Sometimes it is necessary to set CPU affinity to improve performance. A new module parameter wq_unbound is added here. If set to true, users can configure cpu affinity through /sys/devices/virtual/workqueue/nvme_tcp_wq/cpumask. Signed-off-by: Li Feng <fengli@smartx.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme-tcp: Export the nvme_tcp_wq to sysfsLi Feng2024-03-181-1/+1
| | | | | | | | | | | | | | | | Make the workqueue userspace visible for easy viewing and configuration. Signed-off-by: Li Feng <fengli@smartx.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * drivers/nvme: Add quirks for device 126f:2262Jiawei Fu (iBug)2024-03-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds NVME_QUIRK_NO_DEEPEST_PS and NVME_QUIRK_BOGUS_NID for device [126f:2262], which appears to be a generic VID:PID pair used for many SSDs based on the Silicon Motion SM2262/SM2262EN controller. Two of my SSDs with this VID:PID pair exhibit the same behavior: * They frequently have trouble exiting the deepest power state (5), resulting in the entire disk unresponsive. Verified by setting nvme_core.default_ps_max_latency_us=10000 and observing them behaving normally. * They produce all-zero nguid and eui64 with `nvme id-ns` command. The offending products are: * HP SSD EX950 1TB * HIKVISION C2000Pro 2TB Signed-off-by: Jiawei Fu <i@ibugone.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme: parse format command's lbafu when tracingGuixin Liu2024-03-141-1/+4
| | | | | | | | | | | | | | | | Add the parse of format command's lbafu to calculate lbaf. Signed-off-by: Guixin Liu <kanie@linux.alibaba.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme: add tracing of reservation commandsGuixin Liu2024-03-141-0/+62
| | | | | | | | | | | | | | | | | | | | Add detailed parsing of reservation commands to make the trace log more consistent and human-readable. Signed-off-by: Guixin Liu <kanie@linux.alibaba.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme: parse zns command's zsa and zrasf to stringGuixin Liu2024-03-141-3/+35
| | | | | | | | | | | | | | | | | | | | | | Parse zone mgmt send commands's zsa and receive command's zrasf to string to make the trace log more human-readable. Signed-off-by: Guixin Liu <kanie@linux.alibaba.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme: use nvme_disk_is_ns_head helperGuixin Liu2024-03-142-4/+2
| | | | | | | | | | | | | | | | | | | | | | Use nvme_disk_is_ns_head helper instead of check fops directly, and also drop CONFIG_NVME_MULTIPATH check. Signed-off-by: Guixin Liu <kanie@linux.alibaba.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme: fix reconnection fail due to reserved tag allocationChunguang Xu2024-03-142-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We found a issue on production environment while using NVMe over RDMA, admin_q reconnect failed forever while remote target and network is ok. After dig into it, we found it may caused by a ABBA deadlock due to tag allocation. In my case, the tag was hold by a keep alive request waiting inside admin_q, as we quiesced admin_q while reset ctrl, so the request maked as idle and will not process before reset success. As fabric_q shares tagset with admin_q, while reconnect remote target, we need a tag for connect command, but the only one reserved tag was held by keep alive command which waiting inside admin_q. As a result, we failed to reconnect admin_q forever. In order to fix this issue, I think we should keep two reserved tags for admin queue. Fixes: ed01fee283a0 ("nvme-fabrics: only reserve a single tag") Signed-off-by: Chunguang Xu <chunguang.xu@shopee.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvmet: add tracing of zns commandsGuixin Liu2024-03-081-0/+66
| | | | | | | | | | | | | | | | | | | | Add nvme_cmd_zone_append, nvme_cmd_zone_mgmt_send and nvme_cmd_zone_mgmt_recv parse to nvme target tracing. Signed-off-by: Guixin Liu <kanie@linux.alibaba.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvmet: add tracing of authentication commandsGuixin Liu2024-03-081-0/+32
| | | | | | | | | | | | | | | | | | | | Add nvme_fabrics_type_auth_send and nvme_fabrics_type_auth_receive to the nvme target's tracing facility. Signed-off-by: Guixin Liu <kanie@linux.alibaba.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme-apple: Convert to platform remove callback returning voidUwe Kleine-König2024-03-081-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvmet-tcp: do not continue for invalid icreqHannes Reinecke2024-03-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | When the length check for an icreq sqe fails we should not continue processing but rather return immediately as all other contents of that sqe cannot be relied on. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
| * nvme: change shutdown timeout setting messageKeith Busch2024-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | User visible messages containing the word "timeout" can be alarming. This one from nvme is just reporting a potentially informative device configuration, and everything is working as designed. Change the text to report the less concerning "D3 entry latency", which is where this value comes from anyway. Reported-by: Len Brown <lenb@kernel.org> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
* | floppy: remove duplicated code in redo_fd_request()Yufeng Wang2024-03-181-1/+0
| | | | | | | | | | | | | | | | | | | | duplicated code in redo_fd_request(), unlock_fdc() function has the same code "do_floppy = NULL" inside. Signed-off-by: Yufeng Wang <wangyufeng@kylinos.cn> Suggested-by: Denis Efremov <efremov@linux.com> Link: https://lore.kernel.org/r/20240319014219.7812-1-wangyufeng@kylinos.cn Signed-off-by: Jens Axboe <axboe@kernel.dk>
* | Merge tag 'thermal-6.9-rc1' of ↵Linus Torvalds2024-03-1333-377/+260
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull thermal control updates from Rafael Wysocki: "These mostly change the thermal core in a few ways allowing thermal drivers to be simplified, in particular in their removal and failing probe handling parts that are notoriously prone to errors, and propagate the changes to several drivers. Apart from that, support for a new platform is added (Intel Lunar Lake-M), some bugs are fixed and some code is cleaned up, as usual. Specifics: - Store zone trips table and zone operations directly in struct thermal_zone_device (Rafael Wysocki) - Fix up flex array initialization during thermal zone device registration (Nathan Chancellor) - Rework writable trip points handling in the thermal core and several drivers (Rafael Wysocki) - Thermal core code cleanups (Dan Carpenter, Flavio Suligoi) - Use thermal zone accessor functions in the int340x Intel thermal driver (Rafael Wysocki) - Add Lunar Lake-M PCI ID to the int340x Intel thermal driver (Srinivas Pandruvada) - Minor fixes for thermal governors (Rafael Wysocki, Di Shen) - Trip point handling fixes for the iwlwifi wireless driver (Rafael Wysocki) - Code cleanups (Rafael J. Wysocki, AngeloGioacchino Del Regno)" * tag 'thermal-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (29 commits) thermal: core: remove unnecessary check in trip_point_hyst_store() thermal: intel: int340x_thermal: Use thermal zone accessor functions thermal: core: Remove excess empty line from a comment thermal: int340x: processor_thermal: Add Lunar Lake-M PCI ID thermal: core: Eliminate writable trip points masks thermal: of: Set THERMAL_TRIP_FLAG_RW_TEMP directly thermal: imx: Set THERMAL_TRIP_FLAG_RW_TEMP directly wifi: iwlwifi: mvm: Set THERMAL_TRIP_FLAG_RW_TEMP directly mlxsw: core_thermal: Set THERMAL_TRIP_FLAG_RW_TEMP directly thermal: intel: Set THERMAL_TRIP_FLAG_RW_TEMP directly thermal: core: Drop the .set_trip_hyst() thermal zone operation thermal: core: Add flags to struct thermal_trip thermal: core: Move initial num_trips assignment before memcpy() thermal: Get rid of CONFIG_THERMAL_WRITABLE_TRIPS thermal: intel: Adjust ops handling during thermal zone registration thermal: ACPI: Constify acpi_thermal_zone_ops thermal: core: Store zone ops in struct thermal_zone_device thermal: intel: Discard trip tables after zone registration thermal: ACPI: Discard trips table after zone registration thermal: core: Store zone trips table in struct thermal_zone_device ...
| * \ Merge branches 'thermal-core' and 'thermal-intel'Rafael J. Wysocki2024-03-073-1/+4
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge thermal core changes and Intel thermal drivers changes for 6.9-rc1: - Store zone trips table and zone operations directly in struct thermal_zone_device (Rafael Wysocki). - Rework writable trip points handling (Rafael Wysocki). - Thermal core code cleanups (Dan Carpenter, Flavio Suligoi). - Use thermal zone accessor functions in the int340x Intel thermal driver (Rafael Wysocki). - Add Lunar Lake-M PCI ID to the int340x Intel thermal driver (Srinivas Pandruvada). * thermal-core: thermal: core: remove unnecessary check in trip_point_hyst_store() thermal: core: Remove excess empty line from a comment thermal: core: Eliminate writable trip points masks thermal: of: Set THERMAL_TRIP_FLAG_RW_TEMP directly thermal: imx: Set THERMAL_TRIP_FLAG_RW_TEMP directly wifi: iwlwifi: mvm: Set THERMAL_TRIP_FLAG_RW_TEMP directly mlxsw: core_thermal: Set THERMAL_TRIP_FLAG_RW_TEMP directly thermal: intel: Set THERMAL_TRIP_FLAG_RW_TEMP directly thermal: core: Drop the .set_trip_hyst() thermal zone operation thermal: core: Add flags to struct thermal_trip thermal: core: Move initial num_trips assignment before memcpy() thermal: Get rid of CONFIG_THERMAL_WRITABLE_TRIPS thermal: intel: Adjust ops handling during thermal zone registration thermal: ACPI: Constify acpi_thermal_zone_ops thermal: core: Store zone ops in struct thermal_zone_device thermal: intel: Discard trip tables after zone registration thermal: ACPI: Discard trips table after zone registration thermal: core: Store zone trips table in struct thermal_zone_device * thermal-intel: thermal: intel: int340x_thermal: Use thermal zone accessor functions thermal: int340x: processor_thermal: Add Lunar Lake-M PCI ID
| | * | thermal: intel: int340x_thermal: Use thermal zone accessor functionsRafael J. Wysocki2024-03-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make int340x_thermal use the dedicated accessor functions for the thermal zone device object address and the thermal zone type string. This is requisite for future thermal core improvements. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
| | * | Merge thermal core changes for 6.9 to satisfy a dependency.Rafael J. Wysocki2024-03-0526-315/+195
| | |\ \
| | * | | thermal: int340x: processor_thermal: Add Lunar Lake-M PCI IDSrinivas Pandruvada2024-02-282-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Lunar Lake-M PCI ID for processor thermal device. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * | | | thermal: core: remove unnecessary check in trip_point_hyst_store()Dan Carpenter2024-03-061-1/+1
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | This code was shuffled around a bit recently. We no longer need to check the value of "ret" because we know it's zero. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * | | thermal: core: Remove excess empty line from a commentFlavio Suligoi2024-03-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first and the third lines of the kerneldoc comment for: thermal_zone_device_set_polling() belong to the same sentences, so join them together. Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * | | thermal: core: Eliminate writable trip points masksRafael J. Wysocki2024-02-2717-43/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of the thermal_zone_device_register_with_trips() callers pass zero writable trip points masks to it, so drop the mask argument from that function and update all of its callers accordingly. This also removes the artificial trip points per zone limit of 32, related to using writable trip points masks. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: of: Set THERMAL_TRIP_FLAG_RW_TEMP directlyRafael J. Wysocki2024-02-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is now possible to flag trip points with THERMAL_TRIP_FLAG_RW_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the OF thermal code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: imx: Set THERMAL_TRIP_FLAG_RW_TEMP directlyRafael J. Wysocki2024-02-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is now possible to flag trip points with THERMAL_TRIP_FLAG_RW_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the imx thermal code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | wifi: iwlwifi: mvm: Set THERMAL_TRIP_FLAG_RW_TEMP directlyRafael J. Wysocki2024-02-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is now possible to flag trip points with THERMAL_TRIP_FLAG_RW_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the iwlwifi code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | mlxsw: core_thermal: Set THERMAL_TRIP_FLAG_RW_TEMP directlyRafael J. Wysocki2024-02-271-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is now possible to flag trip points with THERMAL_TRIP_FLAG_RW_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the mlxsw code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: intel: Set THERMAL_TRIP_FLAG_RW_TEMP directlyRafael J. Wysocki2024-02-276-55/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some Intel thermal drivers need/want the temperature of their trip points to be set by user space via sysfs and so they pass nonzero writable trip masks during thermal zone registration for this purpose. It is now possible to achieve the same result by setting the THERMAL_TRIP_FLAG_RW_TEMP trip flag directly, so modify the drivers in question to do that instead of using a nonzero writable trips mask. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: core: Drop the .set_trip_hyst() thermal zone operationRafael J. Wysocki2024-02-271-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | None of the users of the thermal core provides a .set_trip_hyst() thermal zone operation, so drop that callback from struct thermal_zone_device_ops and update trip_point_hyst_store() accordingly. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: core: Add flags to struct thermal_tripRafael J. Wysocki2024-02-273-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to allow thermal zone creators to specify the writability of trip point temperature and hysteresis on a per-trip basis, add a flags field to struct thermal_trip and define flags to represent the desired trip properties. Also make thermal_zone_device_register_with_trips() set the THERMAL_TRIP_FLAG_RW_TEMP flag for all trips covered by the writable trips mask passed to it and modify the thermal sysfs code to look at the trip flags instead of using the writable trips mask directly or checking the presence of the .set_trip_hyst() zone callback. Additionally, make trip_point_temp_store() and trip_point_hyst_store() fail with an error code if the trip passed to one of them has THERMAL_TRIP_FLAG_RW_TEMP or THERMAL_TRIP_FLAG_RW_HYST, respectively, clear in its flags. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * | | thermal: core: Move initial num_trips assignment before memcpy()Nathan Chancellor2024-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain that supports __counted_by() (such as clang-18 and newer), there is a panic on boot: [ 2.913770] memcpy: detected buffer overflow: 72 byte write of buffer size 0 [ 2.920834] WARNING: CPU: 2 PID: 1 at lib/string_helpers.c:1027 __fortify_report+0x5c/0x74 ... [ 3.039208] Call trace: [ 3.041643] __fortify_report+0x5c/0x74 [ 3.045469] __fortify_panic+0x18/0x20 [ 3.049209] thermal_zone_device_register_with_trips+0x4c8/0x4f8 This panic occurs because trips is counted by num_trips but num_trips is assigned after the call to memcpy(), so the fortify checks think the buffer size is zero because tz was allocated with kzalloc(). Move the num_trips assignment before the memcpy() to resolve the panic and ensure that the fortify checks work properly. Fixes: 9b0a62758665 ("thermal: core: Store zone trips table in struct thermal_zone_device") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * | | thermal: Get rid of CONFIG_THERMAL_WRITABLE_TRIPSRafael J. Wysocki2024-02-233-15/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only difference made by CONFIG_THERMAL_WRITABLE_TRIPS is whether or not the writable trips mask passed during thermal zone registration will take any effect, but whoever passes a non-zero writable trips mask to thermal_zone_device_register_with_trips() can be forgiven thinking that it will always work. Moreover, some thermal drivers expect user space to set trip temperature values, so they select CONFIG_THERMAL_WRITABLE_TRIPS, possibly overriding a manual choice to unset it and going against the design purportedly allowing system integrators to decide on the writability of trip points for the given kernel build. It is also set in one platform's defconfig. Forthermore, CONFIG_THERMAL_WRITABLE_TRIPS only affects trip temperature, because trip hysteresis is writable as long as the thermal zone provides a callback to update it, regardless of the CONFIG_THERMAL_WRITABLE_TRIPS value. The above means that the symbol in question is used inconsistently and its purpose is at least moot, so remove it and always take the writable trip mask passed to thermal_zone_device_register_with_trips() into account. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: intel: Adjust ops handling during thermal zone registrationRafael J. Wysocki2024-02-237-26/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because thermal zone operations are now stored directly in struct thermal_zone_device, thermal zone creators can discard the operations structure after the zone registration is complete, or it can be made read-only. Accordingly, make int340x_thermal_zone_add() use a local variable to represent thermal zone operations, so it is freed automatically upon the function exit, and make the other Intel thermal drivers use const zone operations structures. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: ACPI: Constify acpi_thermal_zone_opsRafael J. Wysocki2024-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because thermal zone operations are now stored directly in struct thermal_zone_device, acpi_thermal_zone_ops need not be modified by the thermal core and so it can be const. Adjust the code accordingly. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: core: Store zone ops in struct thermal_zone_deviceRafael J. Wysocki2024-02-236-55/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code requires thermal zone creators to pass pointers to writable ops structures to thermal_zone_device_register_with_trips() which needs to modify the target struct thermal_zone_device_ops object if the "critical" operation in it is NULL. Moreover, the callers of thermal_zone_device_register_with_trips() are required to hold on to the struct thermal_zone_device_ops object passed to it until the given thermal zone is unregistered. Both of these requirements are quite inconvenient, so modify struct thermal_zone_device to contain struct thermal_zone_device_ops as field and make thermal_zone_device_register_with_trips() copy the contents of the struct thermal_zone_device_ops passed to it via a pointer (which can be const now) to that field. Also adjust the code using thermal zone ops accordingly and modify thermal_of_zone_register() to use a local ops variable during thermal zone registration so ops do not need to be freed in thermal_of_zone_unregister() any more. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: intel: Discard trip tables after zone registrationRafael J. Wysocki2024-02-238-73/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the thermal core creates and uses its own copy of the trips table passed to thermal_zone_device_register_with_trips(), it is not necessary to hold on to a local copy of it any more after the given thermal zone has been registered. Accordingly, modify Intel thermal drivers to discard the trips tables passed to thermal_zone_device_register_with_trips() after thermal zone registration, for example by storing them in local variables which are automatically discarded when the zone registration is complete. Also make some additional code simplifications unlocked by the above changes. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: ACPI: Discard trips table after zone registrationRafael J. Wysocki2024-02-231-37/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the thermal core creates and uses its own copy of the trips table passed to thermal_zone_device_register_with_trips(), it is not necessary to hold on to a local copy of it any more after the given thermal zone has been registered. Accordingly, modify the ACPI thermal driver to store the trips table passed to thermal_zone_device_register_with_trips() in a local variable which is automatically discarded when acpi_thermal_add() returns to its caller. Also make some additional code simplifications unlocked by the above change. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | | thermal: core: Store zone trips table in struct thermal_zone_deviceRafael J. Wysocki2024-02-234-12/+13
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code expects thermal zone creators to pass a pointer to a writable trips table to thermal_zone_device_register_with_trips() and that trips table is then used by the thermal core going forward. Consequently, the callers of thermal_zone_device_register_with_trips() are required to hold on to the trips table passed to it until the given thermal zone is unregistered, at which point the trips table can be freed, but at the same time they are not expected to access that table directly. This is both error prone and confusing. To address it, turn the trips table pointer in struct thermal_zone_device into a flex array (counted by its num_trips field), allocate it during thermal zone device allocation and copy the contents of the trips table supplied by the zone creator (which can be const now) into it, which will allow the callers of thermal_zone_device_register_with_trips() to drop their trip tables right after the zone registration. This requires the imx thermal driver to be adjusted to store the new temperature in its internal trips table in imx_set_trip_temp(), because it will be separate from the core's trips table now and it has to be explicitly kept in sync with the latter. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * | Merge branch 'thermal-core'Rafael J. Wysocki2024-02-236-46/+46
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge thermal core changes for 6.9: - Minor fixes for thermal governors (Rafael J. Wysocki, Di Shen). - Trip point handling fixes for the iwlwifi wireless driver (Rafael J. Wysocki). - Code cleanups (Rafael J. Wysocki, AngeloGioacchino Del Regno). * thermal-tmp: thermal: gov_power_allocator: Avoid overwriting PID coefficients from setup time thermal: sysfs: Fix up white space in trip_point_temp_store() iwlwifi: mvm: Use for_each_thermal_trip() for walking trip points iwlwifi: mvm: Populate trip table before registering thermal zone iwlwifi: mvm: Drop unused fw_trips_index[] from iwl_mvm_thermal_device thermal: core: Change governor name to const char pointer thermal: gov_bang_bang: Fix possible cooling device state ping-pong thermal: gov_fair_share: Fix dependency on trip points ordering
| | * | thermal: gov_power_allocator: Avoid overwriting PID coefficients from setup timeDi Shen2024-02-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the PID coefficients k_* are set via sysfs before the IPA algorithm is triggered then the coefficients would be overwritten after IPA throttle() is called. The old configuration values might be different than the new values estimated by the IPA internal algorithm. There might be a time delay when this overwriting happens. It depends on the thermal zone temperature value. The temperature value needs to cross the first trip point value then IPA algorithms start operating. Although, the PID coefficients setup time should not be affected or linked to any later operating phase and values must not be overwritten. This patch initializes params->sustainable_power when the governor binds to thermal zone to avoid overwriting k_*. The basic function won't be affected, as the k_* still can be estimated if the sustainable_power is modified. Signed-off-by: Di Shen <di.shen@unisoc.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| | * | thermal: sysfs: Fix up white space in trip_point_temp_store()Rafael J. Wysocki2024-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove an excess tab character from an otherwise empty code line. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
| | * | iwlwifi: mvm: Use for_each_thermal_trip() for walking trip pointsRafael J. Wysocki2024-02-081-15/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code walking trip points in iwl_mvm_send_temp_report_ths_cmd() reads the trip table passed to thermal_zone_device_register_with_trips() in order to get the current trip temperatures, but this is not guaranteed to work in the future, because the thermal zone will store trip points information internally. For this reason, make iwl_mvm_send_temp_report_ths_cmd() use for_each_thermal_trip() as appropriate for walking trip points in a given thermal zone. No intentional functional impact, but it is requisite for future thermal core improvements. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Miri Korenblit <Miriam.rachel.korenblit@intel.com>
| | * | iwlwifi: mvm: Populate trip table before registering thermal zoneRafael J. Wysocki2024-02-081-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The trip table in iwl_mvm_thermal_zone_register() is populated after passing it to thermal_zone_device_register_with_trips(), so it may be accessed (for instance, via sysfs) before it is ready. To prevent that from happening, modify the function to populate the trip table before calling thermal_zone_device_register_with_trips(). Also make the code use THERMAL_TEMP_INVALID as the "invalid temperature" value which is also meaningful for the core. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Miri Korenblit <Miriam.rachel.korenblit@intel.com>
| | * | iwlwifi: mvm: Drop unused fw_trips_index[] from iwl_mvm_thermal_deviceRafael J. Wysocki2024-02-082-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fw_trips_index[] array in struct iwl_mvm_thermal_device is only populated, but never read, so drop it. Note that the iwl_mvm_send_temp_report_ths_cmd() code populating fw_trips_index[] is questionable, because it accesses a trips table of a thermal zone directly, which is not guaranteed to work in the future. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Miri Korenblit <Miriam.rachel.korenblit@intel.com>
| | * | thermal: gov_bang_bang: Fix possible cooling device state ping-pongRafael J. Wysocki2024-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current behavior of thermal_zone_trip_update() in the bang-bang thermal governor may be problematic for trip points with 0 hysteresis, because when the zone temperature reaches the trip temperature and stays there, it will then cause the cooling device go "on" and "off" alternately, which is not desirable. Address this by requiring the zone temperature to actually fall below trip->temperature - trip->hysteresis for the cooling device to go off. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| | * | thermal: gov_fair_share: Fix dependency on trip points orderingRafael J. Wysocki2024-01-291-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The computation in the fair share governor's get_trip_level() function currently works under the assumption that the temperature ordering of trips[] in a thermal zone is ascending, which need not be the case. However, get_trip_level() can be made work regardless of whether or not the trips table is ordered by temperature in any way, so change it accordingly. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * | | thermal/intel: Fix intel_tcc_get_temp() to support negative CPU temperatureZhang Rui2024-02-123-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CPU temperature can be negative in some cases. Thus the negative CPU temperature should not be considered as a failure. Fix intel_tcc_get_temp() and its users to support negative CPU temperature. Fixes: a3c1f066e1c5 ("thermal/intel: Introduce Intel TCC library") Signed-off-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Cc: 6.3+ <stable@vger.kernel.org> # 6.3+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | | | Merge tag 'acpi-6.9-rc1' of ↵Linus Torvalds2024-03-1330-282/+404
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI updates from Rafael Wysocki: "These modify the ACPI device events and processor enumeration code to take the 'enabled' _STA bit into account as mandated by the ACPI specification, convert several platform drivers to using a remove callback that returns void, add some new quirks for ACPI IRQ override and other things, address assorted issues and clean up code. Specifics: - Rearrange Device Check and Bus Check notification handling in the ACPI device hotplug code to make it get the "enabled" _STA bit into account (Rafael Wysocki) - Modify acpi_processor_add() to skip processors with the "enabled" _STA bit clear, as per the specification (Rafael Wysocki) - Stop failing Device Check notification handling without a valid reason (Rafael Wysocki) - Defer enumeration of devices that depend on a device with an ACPI device ID equalt to INTC10CF to address probe ordering issues on some platforms (Wentong Wu) - Constify acpi_bus_type (Ricardo Marliere) - Make the ACPI-specific suspend-to-idle code take the Low-Power S0 Idle MSFT UUID into account on non-AMD systems (Rafael Wysocki) - Add ACPI IRQ override quirks for some new platforms (Sergey Kalinichev, Maxim Kudinov, Alexey Froloff, Sviatoslav Harasymchuk, Nicolas Haye) - Make the NFIT parsing code use acpi_evaluate_dsm_typed() (Andy Shevchenko) - Fix a memory leak in acpi_processor_power_exit() (Armin Wolf) - Make it possible to quirk the CSI-2 and MIPI DisCo for Imaging properties parsing and add a quirk for Dell XPS 9315 (Sakari Ailus) - Prevent false-positive static checker warnings from triggering by intializing some variables in the ACPI thermal code to zero (Colin Ian King) - Add DELL0501 handling to acpi_quirk_skip_serdev_enumeration() and make that function generic (Hans de Goede) - Make the ACPI backlight code handle fetching EDID that is longer than 256 bytes (Mario Limonciello) - Skip initialization of GHES_ASSIST structures for Machine Check Architecture in APEI (Avadhut Naik) - Convert several plaform drivers in the ACPI subsystem to using a remove callback that returns void (Uwe Kleine-König) - Drop the long-deprecated custom_method debugfs interface that is problematic from the security standpoint (Rafael Wysocki) - Use %pe in a couple of places in the ACPI code for easier error decoding (Onkarnath) - Fix register width information handling during system memory accesses in the ACPI CPPC library (Jarred White) - Add AMD CPPC V2 support for family 17h processors to the ACPI CPPC library (Perry Yuan)" * tag 'acpi-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (35 commits) ACPI: resource: Use IRQ override on Maibenben X565 ACPI: CPPC: Use access_width over bit_width for system memory accesses ACPI: CPPC: enable AMD CPPC V2 support for family 17h processors ACPI: APEI: Skip initialization of GHES_ASSIST structures for Machine Check Architecture ACPI: scan: Consolidate Device Check and Bus Check notification handling ACPI: scan: Rework Device Check and Bus Check notification handling ACPI: scan: Make acpi_processor_add() check the device enabled bit ACPI: scan: Relocate acpi_bus_trim_one() ACPI: scan: Fix device check notification handling ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override ACPI: pfr_update: Convert to platform remove callback returning void ACPI: pfr_telemetry: Convert to platform remove callback returning void ACPI: fan: Convert to platform remove callback returning void ACPI: GED: Convert to platform remove callback returning void ACPI: DPTF: Convert to platform remove callback returning void ACPI: AGDI: Convert to platform remove callback returning void ACPI: TAD: Convert to platform remove callback returning void ACPI: APEI: GHES: Convert to platform remove callback returning void ACPI: property: Polish ignoring bad data nodes ACPI: thermal_lib: Initialize temp_decik to zero ...