Commit graph

39 commits

Author SHA1 Message Date
Linus Torvalds
22c5696e3f Driver core changes for 6.17-rc1
- DEBUGFS
 
   - Remove unneeded debugfs_file_{get,put}() instances
 
   - Remove last remnants of debugfs_real_fops()
 
   - Allow storing non-const void * in struct debugfs_inode_info::aux
 
 - SYSFS
 
   - Switch back to attribute_group::bin_attrs (treewide)
 
   - Switch back to bin_attribute::read()/write() (treewide)
 
   - Constify internal references to 'struct bin_attribute'
 
 - Support cache-ids for device-tree systems
 
   - Add arch hook arch_compact_of_hwid()
 
   - Use arch_compact_of_hwid() to compact MPIDR values on arm64
 
 - Rust
 
   - Device
 
     - Introduce CoreInternal device context (for bus internal methods)
 
     - Provide generic drvdata accessors for bus devices
 
     - Provide Driver::unbind() callbacks
 
     - Use the infrastructure above for auxiliary, PCI and platform
 
     - Implement Device::as_bound()
 
     - Rename Device::as_ref() to Device::from_raw() (treewide)
 
     - Implement fwnode and device property abstractions
 
       - Implement example usage in the Rust platform sample driver
 
   - Devres
 
     - Remove the inner reference count (Arc) and use pin-init instead
 
     - Replace Devres::new_foreign_owned() with devres::register()
 
     - Require T to be Send in Devres<T>
 
     - Initialize the data kept inside a Devres last
 
     - Provide an accessor for the Devres associated Device
 
   - Device ID
 
     - Add support for ACPI device IDs and driver match tables
 
     - Split up generic device ID infrastructure
 
     - Use generic device ID infrastructure in net::phy
 
   - DMA
 
     - Implement the dma::Device trait
 
     - Add DMA mask accessors to dma::Device
 
     - Implement dma::Device for PCI and platform devices
 
     - Use DMA masks from the DMA sample module
 
   - I/O
 
     - Implement abstraction for resource regions (struct resource)
 
     - Implement resource-based ioremap() abstractions
 
     - Provide platform device accessors for I/O (remap) requests
 
   - Misc
 
     - Support fallible PinInit types in Revocable
 
     - Implement Wrapper<T> for Opaque<T>
 
     - Merge pin-init blanket dependencies (for Devres)
 
 - Misc
 
   - Fix OF node leak in auxiliary_device_create()
 
   - Use util macros in device property iterators
 
   - Improve kobject sample code
 
   - Add device_link_test() for testing device link flags
 
   - Fix typo in Documentation/ABI/testing/sysfs-kernel-address_bits
 
   - Hint to prefer container_of_const() over container_of()
 -----BEGIN PGP SIGNATURE-----
 
 iHQEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCaIjkhwAKCRBFlHeO1qrK
 LpXuAP9RWwfD9ZGgQZ9OsMk/0pZ2mDclaK97jcmI9TAeSxeZMgD1FHnOMTY7oSIi
 iG7Muq0yLD+A5gk9HUnMUnFNrngWCg==
 =jgRj
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core

Pull driver core updates from Danilo Krummrich:
 "debugfs:
   - Remove unneeded debugfs_file_{get,put}() instances
   - Remove last remnants of debugfs_real_fops()
   - Allow storing non-const void * in struct debugfs_inode_info::aux

  sysfs:
   - Switch back to attribute_group::bin_attrs (treewide)
   - Switch back to bin_attribute::read()/write() (treewide)
   - Constify internal references to 'struct bin_attribute'

  Support cache-ids for device-tree systems:
   - Add arch hook arch_compact_of_hwid()
   - Use arch_compact_of_hwid() to compact MPIDR values on arm64

  Rust:
   - Device:
       - Introduce CoreInternal device context (for bus internal methods)
       - Provide generic drvdata accessors for bus devices
       - Provide Driver::unbind() callbacks
       - Use the infrastructure above for auxiliary, PCI and platform
       - Implement Device::as_bound()
       - Rename Device::as_ref() to Device::from_raw() (treewide)
       - Implement fwnode and device property abstractions
       - Implement example usage in the Rust platform sample driver
   - Devres:
       - Remove the inner reference count (Arc) and use pin-init instead
       - Replace Devres::new_foreign_owned() with devres::register()
       - Require T to be Send in Devres<T>
       - Initialize the data kept inside a Devres last
       - Provide an accessor for the Devres associated Device
   - Device ID:
       - Add support for ACPI device IDs and driver match tables
       - Split up generic device ID infrastructure
       - Use generic device ID infrastructure in net::phy
   - DMA:
       - Implement the dma::Device trait
       - Add DMA mask accessors to dma::Device
       - Implement dma::Device for PCI and platform devices
       - Use DMA masks from the DMA sample module
   - I/O:
       - Implement abstraction for resource regions (struct resource)
       - Implement resource-based ioremap() abstractions
       - Provide platform device accessors for I/O (remap) requests
   - Misc:
       - Support fallible PinInit types in Revocable
       - Implement Wrapper<T> for Opaque<T>
       - Merge pin-init blanket dependencies (for Devres)

  Misc:
   - Fix OF node leak in auxiliary_device_create()
   - Use util macros in device property iterators
   - Improve kobject sample code
   - Add device_link_test() for testing device link flags
   - Fix typo in Documentation/ABI/testing/sysfs-kernel-address_bits
   - Hint to prefer container_of_const() over container_of()"

* tag 'driver-core-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: (84 commits)
  rust: io: fix broken intra-doc links to `platform::Device`
  rust: io: fix broken intra-doc link to missing `flags` module
  rust: io: mem: enable IoRequest doc-tests
  rust: platform: add resource accessors
  rust: io: mem: add a generic iomem abstraction
  rust: io: add resource abstraction
  rust: samples: dma: set DMA mask
  rust: platform: implement the `dma::Device` trait
  rust: pci: implement the `dma::Device` trait
  rust: dma: add DMA addressing capabilities
  rust: dma: implement `dma::Device` trait
  rust: net::phy Change module_phy_driver macro to use module_device_table macro
  rust: net::phy represent DeviceId as transparent wrapper over mdio_device_id
  rust: device_id: split out index support into a separate trait
  device: rust: rename Device::as_ref() to Device::from_raw()
  arm64: cacheinfo: Provide helper to compress MPIDR value into u32
  cacheinfo: Add arch hook to compress CPU h/w id into 32 bits for cache-id
  cacheinfo: Set cache 'id' based on DT data
  container_of: Document container_of() is not to be used in new code
  driver core: auxiliary bus: fix OF node leak
  ...
2025-07-29 12:15:39 -07:00
Suma Hegde
bde430fb66
platform/x86/amd/hsmp: Enhance the print messages to prevent confusion
When the HSMP ACPI device is present, loading the amd_hsmp.ko
module incorrectly displays the message "HSMP is not supported on
Family:%x model:%x\n" despite being supported by the hsmp_acpi.ko
module, leading to confusion.

To address this issue, relocate the acpi_dev_present() check to the
beginning of the hsmp_plt_init() and revise the print message to
better reflect the current support status.

Additionally, add more error messages in the error paths and debug
messages to indicate successful probing for both hsmp_acpi.ko
and amd_hsmp.ko modules.

Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Link: https://lore.kernel.org/r/20250709105413.2487851-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-07-09 15:21:50 +03:00
Ilpo Järvinen
88e326b331
Merge branch 'fixes' into for-next
Merge fixes back into for-next to be able to take dell_rbu change that
is build on top of fixes material, and to bring lenovo related changes
in sync after the move under lenovo/ subdir in the for-next branch and
diverging changes in the fixes branch.
2025-07-02 13:30:30 +03:00
Greg Kroah-Hartman
63dafeb392 Merge 6.16-rc3 into driver-core-next
We need the driver-core fixes that are in 6.16-rc3 into here as well
to build on top of.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-23 07:53:36 +02:00
Thomas Weißschuh
fb506e31b3 sysfs: treewide: switch back to attribute_group::bin_attrs
The normal bin_attrs field can now handle const pointers.
This makes the _new variant unnecessary.
Switch all users back.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20250530-sysfs-const-bin_attr-final-v3-4-724bfcf05b99@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-17 10:44:15 +02:00
Thomas Weißschuh
2fbe82037a sysfs: treewide: switch back to bin_attribute::read()/write()
The bin_attribute argument of bin_attribute::read() is now const.
This makes the _new() callbacks unnecessary. Switch all users back.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20250530-sysfs-const-bin_attr-final-v3-3-724bfcf05b99@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-17 10:44:13 +02:00
Suma Hegde
e7c1a9e8d3
platform/x86/amd/hsmp: Use IS_ENABLED() instead of IS_REACHABLE()
IS_REACHABLE() was required when CONFIG_HWMON was set to m and HSMP to y.
However, commit 69157b00b5 ("platform/x86/amd/hsmp: fix building with
CONFIG_HWMON=m") added a HWMON dependency for HSMP in Kconfig. With
this change, using IS_ENABLED() is sufficient.

Add the missing header file as well.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Link: https://lore.kernel.org/r/20250603055807.2503028-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-06-09 12:37:02 +03:00
Jake Hillion
784e48a829
x86/platform/amd: replace down_timeout() with down_interruptible()
Currently hsmp_send_message() uses down_timeout() with a 100ms timeout
to take the semaphore. However __hsmp_send_message(), the content of the
critical section, has a sleep in it. On systems with significantly
delayed scheduling behaviour this may take over 100ms.

Convert this method to down_interruptible(). Leave the error handling
the same as the documentation currently is not specific about what error
is returned.

Previous behaviour: a caller who competes with another caller stuck in
the critical section due to scheduler delays would receive -ETIME.

New behaviour: a caller who competes with another caller stuck in the
critical section due to scheduler delays will complete successfully.

Reviewed-by: Suma Hegde <suma.hegde@amd.com>
Tested-by: Suma Hegde <suma.hegde@amd.com>
Signed-off-by: Jake Hillion <jake@hillion.co.uk>
Link: https://lore.kernel.org/r/20250605-amd-hsmp-v2-2-a811bc3dd74a@hillion.co.uk
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-06-09 10:50:42 +03:00
Jake Hillion
f8afb12a2d
x86/platform/amd: move final timeout check to after final sleep
__hsmp_send_message sleeps between result read attempts and has a
timeout of 100ms. Under extreme load it's possible for these sleeps to
take a long time, exceeding the 100ms. In this case the current code
does not check the register and fails with ETIMEDOUT.

Refactor the loop to ensure there is at least one read of the register
after a sleep of any duration. This removes instances of ETIMEDOUT with
a single caller, even with a misbehaving scheduler. Tested on AMD
Bergamo machines.

Suggested-by: Blaise Sanouillet <linux@blaise.sanouillet.com>
Reviewed-by: Suma Hegde <suma.hegde@amd.com>
Tested-by: Suma Hegde <suma.hegde@amd.com>
Signed-off-by: Jake Hillion <jake@hillion.co.uk>
Link: https://lore.kernel.org/r/20250605-amd-hsmp-v2-1-a811bc3dd74a@hillion.co.uk
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-06-09 10:50:40 +03:00
Linus Torvalds
1193e205db platform-drivers-x86 for v6.16-1
Highlights:
 
  - alienware-wmi-wmax:
 
    - Add HWMON support
 
    - Add ABI and admin-guide documentation
 
    - Expose GPIO debug methods through debug FS
 
    - Support manual fan control and "custom" thermal profile
 
  - amd/hsmp:
 
    - Add sysfs files to show HSMP telemetry
 
    - Report power readings and limits via hwmon
 
  - amd/isp4: Add AMD ISP platform config for OV05C10
 
  - asus-wmi:
 
    - Refactor Ally suspend/resume to work better with older FW
 
    - hid-asus: check ROG Ally MCU version and warn about old FW versions
 
  - dasharo-acpi: Add driver for Dasharo devices supporting fans and
                  temperatures monitoring
 
  - dell-ddv:
 
    - Expose the battery health and manufacture date to userspace using
      power supply extensions
 
    - Implement the battery matching algorithm
 
  - dell-pc:
 
   - Improve error propagation
 
   - Use faux device
 
  - int3472:
 
    - Add delays to avoid GPIO regulator spikes
 
    - Add handshake pin support
 
    - Make regulator supply name configurable and allow registering more
      than 1 GPIO regulator
 
    - Map mt9m114 powerdown pin to powerenable
 
  - intel/pmc: Add separate SSRAM Telemetry driver
 
  - intel-uncore-freq: Add attributes to show agent types and die ID
 
  - ISST:
 
    - Support SST-TF revision 2 (allows more cores per bucket)
 
    - Support SST-PP revision 2 (fabric 1 frequencies)
 
    - Remove unnecessary SST MSRs restore (the package retains MSRs
      despite CPU offlining)
 
  - mellanox: Add support for SN2201, SN4280, SN5610, and SN5640
 
  - mellanox: mlxbf-pmc: Support additional PMC blocks
 
  - oxpec:
 
    - Add OneXFly variants
 
    - Add support for charge limit, charge thresholds, and turbo LED
 
    - Distinguish current X1 variants to avoid unwanted matching to new
      variants
 
    - Follow hwmon conventions
 
    - Move from hwmon/oxp-sensors to platform/x86 to match the enlarged
      scope
 
  - power: supply:
 
    - Add inhibit-charge-awake (needed by oxpec)
 
    - Add additional battery health status values ("blown fuse" and "cell
      imbalance") (needed by dell-ddv)
 
  - powerwell-ec: Add driver for Portwell EC supporting GPIO and watchdog
 
  - thinkpad-acpi: Support camera shutter switch hotkey
 
  - tuxedo: Add virtual LampArray for TUXEDO NB04 devices
 
  - tools/power/x86/intel-speed-select:
 
    - Support displaying SST-PP revision 2 fields
 
    - Skip uncore frequency update on newer generations of CPUs
 
  - Miscellaneous cleanups / refactoring / improvements
 
 The following is an automated shortlog grouped by driver:
 
 ABI: testing: sysfs-class-oxp:
  -  add missing documentation
  -  add tt_led attribute documentation
 
 Add AMD ISP platform config for OV05C10:
  - Add AMD ISP platform config for OV05C10
 
 alienware-wmi-wmax:
  -  Add a DebugFS interface
  -  Add HWMON support
  -  Add support for manual fan control
  -  Add support for the "custom" thermal profile
  -  Expose GPIO debug methods
  -  Fix awcc_hwmon_fans_init() label logic
  -  Fix uninitialized bitmap in awcc_hwmon_fans_init()
  -  Improve ID processing
  -  Improve internal AWCC API
  -  Improve platform profile probe
  -  Modify supported_thermal_profiles[]
  -  Rename thermal related symbols
 
 amd/hsmp: acpi:
  -  Add sysfs files to display HSMP telemetry
 
 amd/hsmp:
  -  fix building with CONFIG_HWMON=m
  -  Report power via hwmon sensors
  -  Use a single DRIVER_VERSION for all hsmp modules
 
 arm64: huawei-gaokun-ec:
  -  Remove unneeded semicolon
 
 asus-wmi:
  -  fix build without CONFIG_SUSPEND
  -  Refactor Ally suspend/resume
 
 Avoid -Wflex-array-member-not-at-end warning:
  - Avoid -Wflex-array-member-not-at-end warning
 
 barco-p50:
  -  use new GPIO line value setter callbacks
 
 dell-ddv:
  -  Expose the battery health to userspace
  -  Expose the battery manufacture date to userspace
  -  Implement the battery matching algorithm
 
 dell-pc:
  -  Propagate errors when detecting feature support
  -  Transition to faux device
  -  Use non-atomic bitmap operations
 
 docs: ABI:
  -  Fix "aassociated" to "associated"
 
 Documentation/ABI:
  -  Add new attribute for mlxreg-io sysfs interfaces
 
 Documentation: ABI:
  -  Add sysfs platform and debugfs ABI documentation for alienware-wmi
 
 Documentation: admin-guide: laptops:
  -  Add documentation for alienware-wmi
 
 Documentation: admin-guide: pm:
  -  Add documentation for agent_types
  -  Add documentation for die_id
 
 Documentation: wmi: alienware-wmi:
  -  Add GPIO control documentation
 
 Documentation: wmi:
  -  Improve and update alienware-wmi documentation
 
 Do not enable by default during compile testing:
  - Do not enable by default during compile testing
 
 hid-asus:
  -  check ROG Ally MCU version and warn
 
 hwmon:
  -  (oxp-sensors) Add all OneXFly variants
  -  (oxp-sensors) Distinguish the X1 variants
 
 int0002:
  -  use new GPIO line value setter callbacks
 
 int3472:
  -  Add handshake pin support
  -  Add skl_int3472_register_clock() helper
  -  Avoid GPIO regulator spikes
  -  Debug log when remapping pins
  -  Drop unused gpio field from struct int3472_gpio_regulator
  -  Export int3472_discrete_parse_crs()
  -  For mt9m114 sensors map powerdown to powerenable
  -  Make regulator supply name configurable
  -  Move common.h to public includes, symbols to INTEL_INT3472
  -  Prepare for registering more than 1 GPIO regulator
  -  Remove unused sensor_config struct member
  -  Rework AVDD second sensor quirk handling
  -  Stop setting a supply-name for GPIO regulators
  -  Stop using devm_gpiod_get()
 
 intel/pmc:
  -  Convert index variables to be unsigned
  -  Create Intel PMC SSRAM Telemetry driver
  -  Improve pmc_core_get_lpm_req()
  -  Move error handling to init function
  -  Move PMC Core related functions
  -  Move PMC devid to core.h
  -  Remove unneeded header file inclusion
  -  Remove unneeded io operations
  -  Rename core_ssram to ssram_telemetry
  -  Use devm for mutex_init
 
 intel: power-domains:
  -  Add interface to get Linux die ID
 
 intel-uncore-freq:
  -  Add attributes to show agent types
  -  Add attributes to show die_id
 
 intel/vsec:
  -  Change return type of intel_vsec_register
 
 Introduce dasharo-acpi platform driver:
  - Introduce dasharo-acpi platform driver
 
 ISST:
  -  Do Not Restore SST MSRs on CPU Online Operation
  -  Support SST-PP revision 2
  -  Support SST-TF revision 2
  -  Update minor version
 
 mellanox:
  -  Cosmetic changes to improve code style
  -  Introduce support of Nvidia smart switch
  -  Rename field to improve code readability
 
 mlxbf-pmc:
  -  Support additional PMC blocks
 
 mlx-platform:
  -  Add support for new Nvidia system
 
 mlxreg-dpu:
  -  Add initial support for Nvidia DPU
  -  Fix smatch warnings
 
 nvsw-sn2200:
  -  Add support for new system flavour
  -  Fix .items in nvsw_sn2201_busbar_hotplug
 
 oxpec:
  -  Add a lower bounds check in oxp_psy_ext_set_prop()
  -  Add charge threshold and behaviour to OneXPlayer
  -  Add support for the OneXPlayer G1
  -  Add turbo led support to X1 devices
  -  Adhere to sysfs-class-hwmon and enable pwm on 2
  -  Convert defines to using tabs
  -  Follow reverse xmas convention for tt_toggle
  -  Make turbo val apply a bitmask
  -  Move fan speed read to separate function
  -  Move hwmon/oxp-sensors to platform/x86
  -  Move pwm_enable read to its own function
  -  Move pwm value read/write to separate functions
  -  Rename ec group to tt_toggle
  -  Rename rval to ret in tt_toggle
 
 portwell-ec:
  -  Add GPIO and WDT driver for Portwell EC
 
 power: supply:
  -  add inhibit-charge-awake to charge_behaviour
 
 power: supply: core:
  -  Add additional health status values
 
 silicom:
  -  use new GPIO line value setter callbacks
 
 sony-laptop:
  -  Remove unused sony laptop camera code
 
 thermal/drivers/acerhdf:
  -  Constify struct thermal_zone_device_ops
 
 thinkpad-acpi:
  -  Add support for new hotkey for camera shutter switch
 
 tools/power/x86/intel-speed-select:
  -  Skip uncore frequency update
  -  Support SST PP revision 2 fields
  -  v1.23 release
 
 tuxedo:
  -  Add virtual LampArray for TUXEDO NB04 devices
  -  Prevent invalid Kconfig state
 
 Use strscpy()/scnprintf() with acpi_device_name/class():
  - Use strscpy()/scnprintf() with acpi_device_name/class()
 
 Merges:
  -  Merge branch 'fixes' into for-next
  -  Merge branch 'intel-sst' of https://github.com/spandruvada/linux-kernel into for-next
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCaDWJ7wAKCRBZrE9hU+XO
 MT8JAQDWW6qBoXuqpd6Yx1oOyROc6gJMQAsS9sNc7I60mGooEAEAnTLhOHDGkKb5
 av1fz/SmXGl7joeRYkZV9FRzJ/26AAk=
 =ytxa
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v6.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform drivers updates from Ilpo Järvinen:
 "The changes are mostly business as usual. Besides pdx86 changes, there
  are a few power supply changes needed for related pdx86 features, move
  of oxpec driver from hwmon (oxp-sensors) to pdx86, and one FW version
  warning to hid-asus.

  Highlights:

   - alienware-wmi-wmax:
       - Add HWMON support
       - Add ABI and admin-guide documentation
       - Expose GPIO debug methods through debug FS
       - Support manual fan control and "custom" thermal profile

   - amd/hsmp:
       - Add sysfs files to show HSMP telemetry
       - Report power readings and limits via hwmon

   - amd/isp4: Add AMD ISP platform config for OV05C10

   - asus-wmi:
       - Refactor Ally suspend/resume to work better with older FW
       - hid-asus: check ROG Ally MCU version and warn about old FW versions

   - dasharo-acpi:
       - Add driver for Dasharo devices supporting fans and temperatures
         monitoring

   - dell-ddv:
       - Expose the battery health and manufacture date to userspace
         using power supply extensions
       - Implement the battery matching algorithm

   - dell-pc:
       - Improve error propagation
       - Use faux device

   - int3472:
       - Add delays to avoid GPIO regulator spikes
       - Add handshake pin support
       - Make regulator supply name configurable and allow registering
         more than 1 GPIO regulator
       - Map mt9m114 powerdown pin to powerenable

   - intel/pmc: Add separate SSRAM Telemetry driver

   - intel-uncore-freq: Add attributes to show agent types and die ID

   - ISST:
       - Support SST-TF revision 2 (allows more cores per bucket)
       - Support SST-PP revision 2 (fabric 1 frequencies)
       - Remove unnecessary SST MSRs restore (the package retains MSRs
         despite CPU offlining)

   - mellanox: Add support for SN2201, SN4280, SN5610, and SN5640

   - mellanox: mlxbf-pmc: Support additional PMC blocks

   - oxpec:
       - Add OneXFly variants
       - Add support for charge limit, charge thresholds, and turbo LED
       - Distinguish current X1 variants to avoid unwanted matching to
         new variants
       - Follow hwmon conventions
       - Move from hwmon/oxp-sensors to platform/x86 to match the
         enlarged scope

   - power supply:
       - Add inhibit-charge-awake (needed by oxpec)
       - Add additional battery health status values ("blown fuse" and
         "cell imbalance") (needed by dell-ddv)

   - powerwell-ec: Add driver for Portwell EC supporting GPIO and watchdog

   - thinkpad-acpi: Support camera shutter switch hotkey

   - tuxedo: Add virtual LampArray for TUXEDO NB04 devices

   - tools/power/x86/intel-speed-select:
       - Support displaying SST-PP revision 2 fields
       - Skip uncore frequency update on newer generations of CPUs

   - Miscellaneous cleanups / refactoring / improvements"

* tag 'platform-drivers-x86-v6.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (112 commits)
  thermal/drivers/acerhdf: Constify struct thermal_zone_device_ops
  platform/x86/amd/hsmp: fix building with CONFIG_HWMON=m
  platform/x86: asus-wmi: fix build without CONFIG_SUSPEND
  docs: ABI: Fix "aassociated" to "associated"
  platform/x86: Add AMD ISP platform config for OV05C10
  Documentation: admin-guide: pm: Add documentation for die_id
  platform/x86/intel-uncore-freq: Add attributes to show die_id
  platform/x86/intel: power-domains: Add interface to get Linux die ID
  Documentation: admin-guide: pm: Add documentation for agent_types
  platform/x86/intel-uncore-freq: Add attributes to show agent types
  platform/x86/tuxedo: Prevent invalid Kconfig state
  platform/x86: dell-ddv: Expose the battery health to userspace
  platform/x86: dell-ddv: Expose the battery manufacture date to userspace
  platform/x86: dell-ddv: Implement the battery matching algorithm
  power: supply: core: Add additional health status values
  platform/x86/amd/hsmp: acpi: Add sysfs files to display HSMP telemetry
  platform/x86/amd/hsmp: Report power via hwmon sensors
  platform/x86/amd/hsmp: Use a single DRIVER_VERSION for all hsmp modules
  platform/mellanox: mlxreg-dpu: Fix smatch warnings
  platform: mellanox: nvsw-sn2200: Fix .items in nvsw_sn2201_busbar_hotplug
  ...
2025-05-29 10:19:22 -07:00
Arnd Bergmann
69157b00b5
platform/x86/amd/hsmp: fix building with CONFIG_HWMON=m
When CONFIG_HWMON is built as a loadable module, the HSMP drivers
cannot be built-in:

ERROR: modpost: "hsmp_create_sensor" [drivers/platform/x86/amd/hsmp/amd_hsmp.ko] undefined!
ERROR: modpost: "hsmp_create_sensor" [drivers/platform/x86/amd/hsmp/hsmp_acpi.ko] undefined!

Enforce that through the usual Kconfig dependnecy trick.

Fixes: 92c025db52 ("platform/x86/amd/hsmp: Report power via hwmon sensors")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250522144422.2824083-1-arnd@kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-05-25 23:49:03 +03:00
Ingo Molnar
412751aa69 Linux 6.15-rc7
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCgA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmgqSbkeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGr6sH/1ICAvlin1GuxffE
 ISVNz3xhXQpXG2k8yl9r0umpdCfPQbGrxm30vZyuIDNutY/FuMvkIqfu+Z1NnLg0
 GidZW015LtXrp7/puKtTnUD5CPSjdETMXig+Q7c1PrxkkmHwz8sBbbm173AIDbDB
 t7wwqSEUQh2AIDouGwN+DXB+6bR2FoOXb/k/njmtappIwR3rBc2f1HQJnP095rKO
 5AKw1c9DMv5Wq2cEdBOCP48e4CFZEIN1ycW0nvtjpnOmcPOJjLoEothRbntQolqF
 udtj5UeTGdAJqmjigv7KHmlrmFNe+GqBq4+beHl5MRxhBaT2uGGaM9jCJiSxT3Jx
 sHyYYr8=
 =Ddma
 -----END PGP SIGNATURE-----

Merge tag 'v6.15-rc7' into x86/core, to pick up fixes

Pick up build fixes from upstream to make this tree more testable.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
2025-05-21 08:45:03 +02:00
Suma Hegde
511a4a5ea2
platform/x86/amd/hsmp: acpi: Add sysfs files to display HSMP telemetry
Make frequently fetched telemetry available via sysfs. These parameters
do not fit in hwmon sensor model, hence make them available via sysfs.

Create following sysfs files per acpi device node.
* c0_residency_input
* prochot_status
* smu_fw_version
* protocol_version
* ddr_max_bw(GB/s)
* ddr_utilised_bw_input(GB/s)
* ddr_utilised_bw_perc_input(%)
* mclk_input(MHz)
* fclk_input(MHz)
* clk_fmax(MHz)
* clk_fmin(MHz)
* cclk_freq_limit_input(MHz)
* pwr_current_active_freq_limit(MHz)
* pwr_current_active_freq_limit_source

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20250506101542.200811-3-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-05-12 13:20:35 +03:00
Suma Hegde
92c025db52
platform/x86/amd/hsmp: Report power via hwmon sensors
Expose power reading and power limits via hwmon power sensors.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20250506101542.200811-2-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-05-12 13:20:17 +03:00
Suma Hegde
cf8dea42e4
platform/x86/amd/hsmp: Use a single DRIVER_VERSION for all hsmp modules
Use a single DRIVER_VERSION for the plat, hsmp and acpi modules,
as all these modules are connected to a common functionality.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20250506101542.200811-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-05-12 00:35:45 +03:00
Suma Hegde
0581d384f3
platform/x86/amd/hsmp: Make amd_hsmp and hsmp_acpi as mutually exclusive drivers
amd_hsmp and hsmp_acpi are intended to be mutually exclusive drivers and
amd_hsmp is for legacy platforms. To achieve this, it is essential to
check for the presence of the ACPI device in plat.c. If the hsmp ACPI
device entry is found, allow the hsmp_acpi driver to manage the hsmp
and return an error from plat.c.

Additionally, rename the driver from amd_hsmp to hsmp_acpi to prevent
"Driver 'amd_hsmp' is already registered, aborting..." error in case
both drivers are loaded simultaneously.

Also, support both platform device based and ACPI based probing for
family 0x1A models 0x00 to 0x0F, implement only ACPI based probing
for family 0x1A, models 0x10 to 0x1F. Return false from
legacy_hsmp_support() for this platform.
This aligns with the condition check in is_f1a_m0h().

Link: https://lore.kernel.org/platform-driver-x86/aALZxvHWmphNL1wa@gourry-fedora-PF4VCD3F/
Fixes: 7d3135d163 ("platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers")
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Co-developed-by: Gregory Price <gourry@gourry.net>
Signed-off-by: Gregory Price <gourry@gourry.net>
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Link: https://lore.kernel.org/r/20250425102357.266790-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-04-29 18:03:13 +03:00
Ingo Molnar
0a35c9280a x86/platform/amd: Move the <asm/amd_node.h> header to <asm/amd/node.h>
Collect AMD specific platform header files in <asm/amd/*.h>.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mario Limonciello <superm1@kernel.org>
Link: https://lore.kernel.org/r/20250413084144.3746608-7-mingo@kernel.org
2025-04-14 09:34:17 +02:00
Ingo Molnar
d96c786841 x86/platform/amd: Move the <asm/amd_hsmp.h> header to <asm/amd/hsmp.h>
Collect AMD specific platform header files in <asm/amd/*.h>.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Carlos Bilbao <carlos.bilbao@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mario Limonciello <superm1@kernel.org>
Cc: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20250413084144.3746608-5-mingo@kernel.org
2025-04-14 09:34:17 +02:00
Linus Torvalds
fb1ceb29b2 platform-drivers-x86 for v6.15-1
Highlights:
 
  - alienware-wmi: Refactor and split WMAX/legacy drivers
 
  - dell-ddv:
 
     - Correct +0.1 offset in temperature
 
     - Use the power supply extension mechanism for battery temperatures
 
  - intel/pmc:
 
     - Refactor init to mostly use a common init function
 
     - Add support for Arrow Lake U/H
 
     - Add support for Panther Lake
 
  - intel/sst:
 
     - Improve multi die handling
 
     - Prefix header search path with sysroot (fixes cross-compiling)
 
  - lenovo-wmi-hotkey-utilities: Support for mic & audio mute LEDs
 
  - samsung-galaxybook: Add driver for Samsung Galaxy Book series
 
  - wmi:
 
     - Rework WCxx/WExx ACPI method handling
 
     - Enable data block collection when the data block is set
 
  - platform/arm:
 
     - Add Huawei Matebook E Go EC driver
 
  - platform/mellanox:
 
     - Relocate to drivers/platform/mellanox/
 
     - mlxbf-bootctl: RTC battery status sysfs support
 
  - Miscellaneous cleanups / refactoring / improvements
 
 The following is an automated shortlog grouped by driver:
 
 alienware-wmi:
  -  Add a state container for LED control feature
  -  Add a state container for thermal control methods
  -  Add alienware-wmi.h
  -  Add WMI Drivers
  -  Refactor hdmi, amplifier, deepslp methods
  -  Refactor LED control methods
  -  Refactor thermal control methods
  -  Rename alienware-wmi.c
  -  Split DMI table
  -  Split the alienware-wmi driver
  -  Update alienware-wmi config entries
  -  Update header and module information
 
 amd/pmc:
  -  fix leak in probe()
  -  Move macros and structures to the PMC header file
  -  Notify user when platform does not support s0ix transition
  -  Remove unnecessary line breaks
  -  Use managed APIs for mutex
 
 amd/pmf:
  -  convert timeouts to secs_to_jiffies()
 
 amd:
  -  Use *-y instead of *-objs in Makefiles
 
 arm64:
  -  add Huawei Matebook E Go EC driver
 
 arm64: dts: qcom: gaokun3:
  -  Add Embedded Controller node
 
 compal-laptop:
  -  Do not include <linux/fb.h>
 
 dell-ddv:
  -  Fix temperature calculation
  -  Use devm_battery_hook_register
  -  Use the power supply extension mechanism
 
 dell: dell-wmi-sysman:
  -  Use *-y instead of *-objs in Makefile
 
 dell:
  -  Modify Makefile alignment
  -  Use *-y instead of *-objs in Makefile
 
 dell-uart-backlight:
  -  Make dell_uart_bl_serdev_driver static
 
 dt-bindings: platform:
  -  Add Huawei Matebook E Go EC
 
 hp-bioscfg:
  -  Replace deprecated strncpy() with strscpy()
  -  Use wmi_instance_count()
 
 hp:
  -  Use *-y instead of *-objs in Makefile
 
 hwmon:
  -  (hp-wmi-sensors) Use the WMI bus API when accessing sensors
 
 ideapad-laptop:
  -  use dev_groups to register attribute groups
 
 int3472:
  -  Call "func" "con_id" instead
 
 intel/pmc:
  -  Add Arrow Lake U/H support to intel_pmc_core driver
  -  Add Panther Lake support to intel_pmc_core
  -  Create generic_core_init() for all platforms
  -  Make tgl_core_generic_init() static
  -  Move arch specific action to init function
  -  Remove duplicate enum
  -  Remove simple init functions
  -  Remove unnecessary declarations in header
  -  Remove unneeded extern keyword in header
 
 intel:
  -  Use *-y instead of *-objs in Makefile
 
 irqdomain: platform/x86:
  -  Switch to irq_domain_create_linear()
 
 lenovo-wmi-hotkey-utilities.c:
  -  Support for mic and audio mute LEDs
 
 lenovo-yoga-tab2-pro-1380-fastcharger:
  -  Make symbol static
 
 MAINTAINERS:
  -  Add documentation reference for Mellanox platform
  -  Update ALIENWARE WMI DRIVER entry
 
 mellanox:
  -  Relocate mlx-platform driver
 
 mlxbf-bootctl:
  -  Support sysfs entries for RTC battery status
 
 mlx-platform:
  -  Change register name
  -  Cosmetic changes
 
 samsung-galaxybook:
  -  Add samsung-galaxybook driver
  -  Fix block_recording not supported logic
 
 sonypi:
  -  Use str_on_off() helper in sonypi_display_info()
 
 think-lmi:
  -  Use ACPI object when extracting strings
  -  Use WMI bus API when accessing BIOS settings
 
 thinkpad_acpi:
  -  check the return value of devm_mutex_init()
  -  convert timeouts to secs_to_jiffies()
  -  Do not include <linux/fb.h>
  -  Move HWMON initialization to tpacpi_hwmon_pdriver's probe
  -  Move subdriver initialization to tpacpi_pdriver's probe.
 
 tools/power/x86/intel-speed-select:
  -  Die ID for IO dies
  -  Fix the condition to check multi die system
  -  Prefix header search path with sysroot
  -  Prevent increasing MAX_DIE_PER_PACKAGE
  -  v1.22 release
 
 wmi:
  -  Call WCxx methods when setting data blocks
  -  Rework WCxx/WExx ACPI method handling
  -  Update documentation regarding the GUID-based API
  -  Use devres to disable the WMI device
 
 x86-android-tablets:
  -  Add select POWER_SUPPLY to Kconfig
 
 Merges:
  -  Merge branch 'fixes' into for-next
  -  Merge branch 'intel-sst' of https://github.com/spandruvada/linux-kernel into review-ilpo-next
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCZ+QJyQAKCRBZrE9hU+XO
 MUPYAP4sjtB8DKTIHgiQqado7PJZmdgpeJfAplitwKGe4BOcEQEA1mhuqMA5n6S+
 jvbTtRF+jiKxis/5zAtAdChScM/pIgo=
 =W+gy
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform drivers updates from Ilpo Järvinen:

 - alienware-wmi:
     - Refactor and split WMAX/legacy drivers

 - dell-ddv:
     - Correct +0.1 offset in temperature
     - Use the power supply extension mechanism for battery temperatures

 - intel/pmc:
     - Refactor init to mostly use a common init function
     - Add support for Arrow Lake U/H
     - Add support for Panther Lake

 - intel/sst:
     - Improve multi die handling
     - Prefix header search path with sysroot (fixes cross-compiling)

 - lenovo-wmi-hotkey-utilities:
     - Support for mic & audio mute LEDs

 - samsung-galaxybook:
     - Add driver for Samsung Galaxy Book series

 - wmi:
     - Rework WCxx/WExx ACPI method handling
     - Enable data block collection when the data block is set

 - platform/arm:
     - Add Huawei Matebook E Go EC driver

 - platform/mellanox:
     - Relocate to drivers/platform/mellanox/
     - mlxbf-bootctl:
     - RTC battery status sysfs support

 - Miscellaneous cleanups / refactoring / improvements

* tag 'platform-drivers-x86-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (75 commits)
  platform/x86: x86-android-tablets: Add select POWER_SUPPLY to Kconfig
  platform/x86/amd/pmf: convert timeouts to secs_to_jiffies()
  platform/x86: thinkpad_acpi: convert timeouts to secs_to_jiffies()
  irqdomain: platform/x86: Switch to irq_domain_create_linear()
  platform/x86/amd/pmc: fix leak in probe()
  tools/power/x86/intel-speed-select: v1.22 release
  tools/power/x86/intel-speed-select: Prefix header search path with sysroot
  tools/power/x86/intel-speed-select: Die ID for IO dies
  tools/power/x86/intel-speed-select: Fix the condition to check multi die system
  tools/power/x86/intel-speed-select: Prevent increasing MAX_DIE_PER_PACKAGE
  platform/x86/amd/pmc: Use managed APIs for mutex
  platform/x86/amd/pmc: Remove unnecessary line breaks
  platform/x86/amd/pmc: Move macros and structures to the PMC header file
  platform/x86/amd/pmc: Notify user when platform does not support s0ix transition
  platform/x86: dell-ddv: Use the power supply extension mechanism
  platform/x86: dell-ddv: Use devm_battery_hook_register
  platform/x86: dell-ddv: Fix temperature calculation
  platform/x86: thinkpad_acpi: check the return value of devm_mutex_init()
  platform/x86: samsung-galaxybook: Fix block_recording not supported logic
  platform/x86: dell-uart-backlight: Make dell_uart_bl_serdev_driver static
  ...
2025-03-26 09:54:40 -07:00
Yazen Ghannam
8a3dc0f7c4 x86/amd_node, platform/x86/amd/hsmp: Have HSMP use SMN through AMD_NODE
The HSMP interface is just an SMN interface with different offsets.

Define an HSMP wrapper in the SMN code and have the HSMP platform driver
use that rather than a local solution.

Also, remove the "root" member from AMD_NB, since there are no more
users of it.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Carlos Bilbao <carlos.bilbao@kernel.org>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20250130-wip-x86-amd-nb-cleanup-v4-1-b5cc997e471b@amd.com
2025-03-19 11:18:05 +01:00
Kurt Borja
cfba129ad2
platform/x86: amd: Use *-y instead of *-objs in Makefiles
The `objs` suffix is reserved for user-space tools. Use the `y` suffix
instead, which is usually used for kernel drivers.

While at it, fix alignment in AMD PMC and PMF Makefiles.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250218194113.26589-3-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2025-02-24 17:15:02 +02:00
Thomas Weißschuh
8fa1a2e105
platform/x86/amd/hsmp: Constify 'struct bin_attribute'
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241202-sysfs-const-bin_attr-pdx86-v1-5-9ab204c2a814@weissschuh.net
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-17 13:12:59 +02:00
Ilpo Järvinen
dd77ba8801
Merge import NS conversion from 'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git' into for-next 2024-12-04 14:02:54 +02:00
Peter Zijlstra
cdd30ebb1b module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.

Scripted using

  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}

  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done

Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 11:34:44 -08:00
Suma Hegde
836d0d7107
platform/x86/amd/hsmp: Add support for HSMP protocol version 7 messages
Following new HSMP messages are available on family 0x1A, model 0x00-0x1F
platforms with protocol version 7. Add support for them in the driver.
- SetXgmiPstateRange(26h)
- CpuRailIsoFreqPolicy(27h)
- DfcEnable(28h)
- GetRaplUnit(30h)
- GetRaplCoreCounter(31h)
- GetRaplPackageCounter(32h)

Also update HSMP message PwrEfficiencyModeSelection-21h. This message is
updated to include GET option in recent firmware.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241118102752.11703-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-12-02 19:20:14 +02:00
Linus Torvalds
55cb93fd24 Driver core changes for 6.13-rc1
Here is a small set of driver core changes for 6.13-rc1.
 
 Nothing major for this merge cycle, except for the 2 simple merge
 conflicts are here just to make life interesting.
 
 Included in here are:
   - sysfs core changes and preparations for more sysfs api cleanups that
     can come through all driver trees after -rc1 is out
   - fw_devlink fixes based on many reports and debugging sessions
   - list_for_each_reverse() removal, no one was using it!
   - last-minute seq_printf() format string bug found and fixed in many
     drivers all at once.
   - minor bugfixes and changes full details in the shortlog
 
 As mentioned above, there is 2 merge conflicts with your tree, one is
 where the file is removed (easy enough to resolve), the second is a
 build time error, that has been found in linux-next and the fix can be
 seen here:
 	https://lore.kernel.org/r/20241107212645.41252436@canb.auug.org.au
 
 Other than that, the changes here have been in linux-next with no other
 reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZ0lEog8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ym+0ACgw6wN+LkLVIHWhxTq5DYHQ0QCxY8AoJrRIcKe
 78h0+OU3OXhOy8JGz62W
 =oI5S
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is a small set of driver core changes for 6.13-rc1.

  Nothing major for this merge cycle, except for the two simple merge
  conflicts are here just to make life interesting.

  Included in here are:

   - sysfs core changes and preparations for more sysfs api cleanups
     that can come through all driver trees after -rc1 is out

   - fw_devlink fixes based on many reports and debugging sessions

   - list_for_each_reverse() removal, no one was using it!

   - last-minute seq_printf() format string bug found and fixed in many
     drivers all at once.

   - minor bugfixes and changes full details in the shortlog"

* tag 'driver-core-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (35 commits)
  Fix a potential abuse of seq_printf() format string in drivers
  cpu: Remove spurious NULL in attribute_group definition
  s390/con3215: Remove spurious NULL in attribute_group definition
  perf: arm-ni: Remove spurious NULL in attribute_group definition
  driver core: Constify bin_attribute definitions
  sysfs: attribute_group: allow registration of const bin_attribute
  firmware_loader: Fix possible resource leak in fw_log_firmware_info()
  drivers: core: fw_devlink: Fix excess parameter description in docstring
  driver core: class: Correct WARN() message in APIs class_(for_each|find)_device()
  cacheinfo: Use of_property_present() for non-boolean properties
  cdx: Fix cdx_mmap_resource() after constifying attr in ->mmap()
  drivers: core: fw_devlink: Make the error message a bit more useful
  phy: tegra: xusb: Set fwnode for xusb port devices
  drm: display: Set fwnode for aux bus devices
  driver core: fw_devlink: Stop trying to optimize cycle detection logic
  driver core: Constify attribute arguments of binary attributes
  sysfs: bin_attribute: add const read/write callback variants
  sysfs: implement all BIN_ATTR_* macros in terms of __BIN_ATTR()
  sysfs: treewide: constify attribute callback of bin_attribute::llseek()
  sysfs: treewide: constify attribute callback of bin_attribute::mmap()
  ...
2024-11-29 11:43:29 -08:00
Suma Hegde
8560b2775a
platform/x86/amd/hsmp: Change the error type
When file is opened in WRITE only mode, then GET messages are not allowed
and when file is opened in READ only mode, SET messages are not allowed.
In these scenerios, return error EPERM to userspace instead of EINVAL.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241112120450.2407125-2-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-11-13 15:36:33 +02:00
Suma Hegde
996b318e6f
platform/x86/amd/hsmp: Add new error code and error logs
Firmware is updated to send HSMP_ERR_PREREQ_NOT_SATISFIED(0xFD) and
HSMP_ERR_SMU_BUSY(0xFC) error codes. Add them here.

Add error logs to make it easy to understand the failure reason for
different error conditions.

Replace pr_err() with dev_err() to identify the driver printing the
error.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241112120450.2407125-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-11-13 15:36:26 +02:00
Suma Hegde
1349dd7dc2
platform/x86/amd/hsmp: Make hsmp_pdev static instead of global
Instead of making hsmp_pdev global and exporting this symbol from hsmp.c,
make it static and create a wrapper function get_hsmp_pdev() to access
hsmp_pdev from plat.c and acpi.c.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-11-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-25 17:29:38 +03:00
Suma Hegde
c1691730d9
platform/x86/amd/hsmp: Use dev_groups in the driver structure
Move out of device_add_group() variants, instead assign static array of
attribute groups to .dev_groups in platform_driver structure.
Then use is_visible to enable only the necessary files on the platform.

.read() and .is_bin_visibile() have slightly different
implemetations on ACPI and non-ACPI system, so move them
to respective files.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-10-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-25 17:29:33 +03:00
Suma Hegde
4fc0366ef8
platform/x86/amd/hsmp: Use name space while exporting module symbols
hsmp_send_message() is exported with AMD_HSMP name space.
The other modules who would like to use this symbol,
need to import AMD_HSMP namespace using MODULE_IMPORT_NS()
to get away with warning.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-9-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-25 17:29:28 +03:00
Suma Hegde
7d3135d163
platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers
Separate the probes for HSMP ACPI and platform device drivers.

Provide a Kconfig option to choose between ACPI or the platform device
based driver. The common code which is the core part of the HSMP driver
maintained at hsmp.c is guarded by AMD_HSMP config and is selected by
these two driver configs. This will be built into separate hsmp_common.ko
module and acpi as hsmp_acpi and plat as amd_hsmp respectively.

Also add "|| COMPILE_TEST" clause in Kconfig to get build coverage for
HSMP.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-8-suma.hegde@amd.com
[ij: Fixed doc to use pre-formatted text for the ACPI dump.]
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-25 17:28:20 +03:00
Suma Hegde
8e75dff56e
platform/x86/amd/hsmp: Change generic plat_dev name to hsmp_pdev
plat_dev is a commonly used variable name, since its made as extern now,
change it to more specific name.
Also change miscdevice hsmp_device to mdev.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-7-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-22 13:36:57 +03:00
Suma Hegde
969f915473
platform/x86/amd/hsmp: Move ACPI code to acpi.c
An upcoming change splits HSMP driver into ACPI and platform device
variants. Prepare for the split by moving ACPI related code
to acpi.c from hsmp.c. Common code is kept in hsmp.c.

No logical/functional change.
We still have one driver at this point,
the driver probe will be split in the next patch.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-6-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-22 13:36:55 +03:00
Suma Hegde
e47c018a0e
platform/x86/amd/hsmp: Move platform device specific code to plat.c
An upcoming change splits HSMP driver into ACPI and platform device
variants. Prepare for the split by moving platform device part to plat.c.

No functinality/logical changes.
Common code which can be used by ACPI and platform device
remains in hsmp.c.
ACPI code in hsmp.c will be moved to acpi.c in next patch.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-5-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-22 13:36:54 +03:00
Suma Hegde
1757d2b8dc
platform/x86/amd/hsmp: Move structure and macros to header file
This is in preparation to splitting ACPI and platform device drivers.
No logical change, move common structures, macros to hsmp.h,
add missed header files, remove unwanted header inclusions,
and re-order the header file in hsmp.c file.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-4-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-22 13:36:52 +03:00
Suma Hegde
d9a621ebdd
platform/x86/amd/hsmp: Convert amd_hsmp_rdwr() to a function pointer
This is in preparation to ACPI, Non-ACPI split.
amd_hsmp_rdwr() is used to access HSMP protocol registers.
ACPI and Non-ACPI use different methods to access these registers.
Now that code is split and common functionality is kept in hsmp.c
we need to define a function pointer to handle these functions separately.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-3-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-22 13:36:50 +03:00
Suma Hegde
1e1c4c0ab3
platform/x86/amd/hsmp: Create wrapper function init_acpi()
This is in preparation to splitting ACPI and platform device drivers.
Having init_acpi() helps in smooth code movement.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-2-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-22 13:36:49 +03:00
Suma Hegde
9df193087b
platform/x86/amd/hsmp: Create hsmp/ directory
This is in preparation to splitting ACPI and platform device drivers.
Create and move hsmp specific code into its own directory,
no logical changes.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-1-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-10-22 13:36:46 +03:00