Commit Graph

2321 Commits

Author SHA1 Message Date
Ali Ahmet Memiş
80892972ff ACPI: utils: Add exclusive AML evaluation helpers
ACPICA drops the interpreter lock while AML waits, for example around EC
accesses, so two methods can run interleaved.

Some firmware relies on methods not interleaving, for instance by
switching an EC page selector without taking the AML mutex that the
other users of that page hold.

Add acpi_evaluate_object_exclusive(), acpi_evaluate_integer_exclusive()
and acpi_execute_simple_method_exclusive() which serialize the
evaluation under a global mutex, for callers that are known to be
affected.

Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/all/CAJZ5v0gS4agVUkCO6M=VW4Wi2y1-s+k23bpzmX9aAZ0Rsv4z9Q@mail.gmail.com/
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
Reviewed-by: Rong Zhang <i@rong.moe>
Link: https://patch.msgid.link/20261018122220.678822-2-aliamemis@disroot.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-10-22 19:01:52 +02:00
Linus Torvalds
df37e39242 Power management updates for 7.4-rc1
- Fix multiple issues related to input validation, synchronization,
    access safety, memory layout and register field validation, and error
    handling in the ACPI CPPC library (Christian Loehle and Sumit Gupta)
 
  - Select the frequency-invariance callback per CPU in the CPPC cpufreq
    driver and create the FIE worker before enabling PCC callbacks in it
    to avoid queueing work through a missing worker and dereferencing a
    NULL pointer (Christian Loehle)
 
  - Update the CPPC cpufreq driver entry in MAINTAINERS and add a new
    entry for the ACPI CPPC library (Christian Loehle)
 
  - Minor fixes in various cpufreq drivers (Alexander Koskovich, Daniel
    Schwierzeck, Frank Zhang, Haotian Zhang, Kathiravan Thirumoorthy,
    Sumeet Pawnikar, and Xueqin Luo)
 
  - Fix wrong behaviors on multi-node servers in the Loongson cpufreq
    driver (Huacai Chen)
 
  - Reject NULL from cpufreq_cpu_get() in the Rust code (Mehmet Koseoglu)
 
  - Add suspend OPP to mediatek cpufreq driver and DT (Ryan Brue)
 
  - Fixups for a few bugs identified by Sashiko in the amd-pstate cpufreq
    driver (Mario Limoncielloi, Wentao Guan)
 
  - Initial support for maximum frequency capacity handling on Zen6
    client in amd-pstate (Mario Limonciello)
 
  - Fix for amd-pstate-ut with 'Requested CPU Min frequency' BIOS option
    (K Prateek Nayak)
 
  - New Zen6 tuning values for EPP in amd-pstate (Mario Limonciello,
    Vishal Badole)
 
  - amd-pstate documentation fix (Karl Mehltretter)
 
  - Restrict deferred downscaling to low load for shared policies in the
    conservative cpufreq governor to avoid undesirable CPU frequency
    reduction in some cases (Shengming Hu)
 
  - Serialize sugov_start() against rate limit updates in the schedutil
    cpufreq governor to avoid using a stale rate limit value (Hui Su)
 
  - Prevent cpuidle governors menu and teo from returning idle state 0
    after it has been disabled (Xueqin Luo)
 
  - Replace min_t() with the better alternatives in the intel_idle driver
    and make it use 2-argument strscpy() (Andy Shevchenko)
 
  - Fix two repeated phrase instances in cpuidle (Hemanth Selam, Syazwina
    Fazrul)
 
  - Add rugged Panther Lake support to the intel_rapl power capping
    driver and make it use %pe for printing error pointers (Srinivas
    Pandruvada and Sumeet Pawnikar)
 
  - Update and improve runtime PM documentation and add a kunit test for
    supplier idle/suspend (Brian Norris)
 
  - Add a pm_runtime_dont_use_autosuspend() call to pm_runtime_reinit()
    to ensure autosuspend disabling on driver teardown (Joshua Crofts)
 
  - Ignore page-zero RAM in E820 checksum during hibernation on x86 to
    avoid rejecting images created after kexec() (Matthias Goergens)
 
  - Add resume event mapping for PMSG_POWEROFF to the PM core to allow it
    to carry out device shutdown in the future (Mario Limonciello)
 
  - Add DPM watchdog to prepare/late/early/noirq/complete phases of
    device suspend and resume (Mayank Rungta)
 
  - Update swsusp.txt references to swsusp.rst in hibernation
    documentation (Li Jun)
 
  - Fix use-after-free of perf domain in netlink doit handlers for energy
    models (Fan Wu)
 
  - Add synchronize_rcu() back to cpu_pm_unregister_notifier() after it
    was removed inadvertently in previous development cycles to avoid
    use-after-free (Bradley Morgan)
 
  - Unregister CPU PM notifier outside the timer lock in the timer-ti-dm
    clocksource driver (Bradley Morgan)
 
  - Fix typo "sucessfully" in a comment in pm_clk_add_clk() kerneldoc
    comment and typo "hierachy" in a comment in pm-graph (Hemanth Selam)
 
  - Fix the return value in dev_pm_opp_get_of_node() kernel-doc (Karl
    Mehltretter)
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmrWNkISHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1M7QH/RyTpxMUHI3eLqhPIczecdsQxoJ9gCZS
 wGMQmvBRrNEw/Cp+X+j5Swo8iOJRKQ5Na+h53Ebg4EFJg5Fkh8SDO/VhQDaC0GUp
 t9y9MpVfXq/Fc/gOimzJ/MGhRmBXl5HKva586pg5TdFg4adDs4kPcDj9zDFnKMhf
 Kb0FHgjRjli1iDT1HSOV7KDsH1bZBWD1P04jMaVQ1zJb6Ngwi1msyBaRlE3A1mqX
 W31C3pi7qtfbs1v1JPmrnaVAJEZmv38t7x/G3o5FL35P2bwlgN/KXD0aMNHZ0Rnl
 A6Jz4p5ugop+gBLzyQo4W8SNcLk9cRvlp3FUwuEax4MEPbg+rhfjdDs=
 =4ccu
 -----END PGP SIGNATURE-----

Merge tag 'pm-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management updates from Rafael Wysocki:
 "This time, the most visible part are the ACPI CPPC updates from
  Christian Loehle, including CPPC cpufreq driver changes, even though
  updates of cpufreq drivers proper are still the largest topic group.
  However, the updates of cpufreq drivers depend on the ACPI CPPC
  updates, so they should really be counted together and that is well
  over 1/2 of the total commit count.

  Interestingly enough, almost all of the updates included here are
  fixes or cleanups, with some new feature support in the amd-pstate
  cpufreq driver and IPQ9650 support in the qcom-nvmem cpufreq driver.
  The runtime PM documentation improvements from Brian Norris can also
  be mostly regarded as fixes, but a new kunit test goes along with
  them.

  Specifics:

   - Fix multiple issues related to input validation, synchronization,
     access safety, memory layout and register field validation, and
     error handling in the ACPI CPPC library (Christian Loehle and Sumit
     Gupta)

   - Select the frequency-invariance callback per CPU in the CPPC
     cpufreq driver and create the FIE worker before enabling PCC
     callbacks in it to avoid queueing work through a missing worker and
     dereferencing a NULL pointer (Christian Loehle)

   - Update the CPPC cpufreq driver entry in MAINTAINERS and add a new
     entry for the ACPI CPPC library (Christian Loehle)

   - Minor fixes in various cpufreq drivers (Alexander Koskovich, Daniel
     Schwierzeck, Frank Zhang, Haotian Zhang, Kathiravan Thirumoorthy,
     Sumeet Pawnikar, and Xueqin Luo)

   - Fix wrong behaviors on multi-node servers in the Loongson cpufreq
     driver (Huacai Chen)

   - Reject NULL from cpufreq_cpu_get() in the Rust code (Mehmet
     Koseoglu)

   - Add suspend OPP to mediatek cpufreq driver and DT (Ryan Brue)

   - Fixups for a few bugs identified by Sashiko in the amd-pstate
     cpufreq driver (Mario Limoncielloi, Wentao Guan)

   - Initial support for maximum frequency capacity handling on Zen6
     client in amd-pstate (Mario Limonciello)

   - Fix for amd-pstate-ut with 'Requested CPU Min frequency' BIOS
     option (K Prateek Nayak)

   - New Zen6 tuning values for EPP in amd-pstate (Mario Limonciello,
     Vishal Badole)

   - amd-pstate documentation fix (Karl Mehltretter)

   - Restrict deferred downscaling to low load for shared policies in
     the conservative cpufreq governor to avoid undesirable CPU
     frequency reduction in some cases (Shengming Hu)

   - Serialize sugov_start() against rate limit updates in the schedutil
     cpufreq governor to avoid using a stale rate limit value (Hui Su)

   - Prevent cpuidle governors menu and teo from returning idle state 0
     after it has been disabled (Xueqin Luo)

   - Replace min_t() with the better alternatives in the intel_idle
     driver and make it use 2-argument strscpy() (Andy Shevchenko)

   - Fix two repeated phrase instances in cpuidle (Hemanth Selam,
     Syazwina Fazrul)

   - Add rugged Panther Lake support to the intel_rapl power capping
     driver and make it use %pe for printing error pointers (Srinivas
     Pandruvada and Sumeet Pawnikar)

   - Update and improve runtime PM documentation and add a kunit test
     for supplier idle/suspend (Brian Norris)

   - Add a pm_runtime_dont_use_autosuspend() call to pm_runtime_reinit()
     to ensure autosuspend disabling on driver teardown (Joshua Crofts)

   - Ignore page-zero RAM in E820 checksum during hibernation on x86 to
     avoid rejecting images created after kexec() (Matthias Goergens)

   - Add resume event mapping for PMSG_POWEROFF to the PM core to allow
     it to carry out device shutdown in the future (Mario Limonciello)

   - Add DPM watchdog to prepare/late/early/noirq/complete phases of
     device suspend and resume (Mayank Rungta)

   - Update swsusp.txt references to swsusp.rst in hibernation
     documentation (Li Jun)

   - Fix use-after-free of perf domain in netlink doit handlers for
     energy models (Fan Wu)

   - Add synchronize_rcu() back to cpu_pm_unregister_notifier() after it
     was removed inadvertently in previous development cycles to avoid
     use-after-free (Bradley Morgan)

   - Unregister CPU PM notifier outside the timer lock in the
     timer-ti-dm clocksource driver (Bradley Morgan)

   - Fix typo "sucessfully" in a comment in pm_clk_add_clk() kerneldoc
     comment and typo "hierachy" in a comment in pm-graph (Hemanth
     Selam)

   - Fix the return value in dev_pm_opp_get_of_node() kernel-doc (Karl
     Mehltretter)"

* tag 'pm-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (89 commits)
  cpufreq: loongson3: Replace IOCSR read/write with MMIO ones
  cpufreq: loongson3: Use global physical CPU ID in get/target callbacks
  cpufreq: loongson3: Replace per-package mutex with per-node
  cpufreq: loongson3: Adjust the width of id and val in smc_message
  cpufreq: loongson3: Make this driver depend on MACH_LOONGSON64
  PM: runtime: Expand introduction with core concepts and structure
  cpufreq: schedutil: Serialize sugov_start() against rate limit updates
  MAINTAINERS: ACPI: Add a separate CPPC entry
  MAINTAINERS: cpufreq: Replace CPPC reviewer
  arm64: dts: mediatek: mt8173: Mark the lowest CPU OPPs for suspend
  cpufreq: mediatek: Enter system sleep at the suspend OPP
  cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing
  cpufreq: qcom-nvmem: Add IPQ9650 support
  cpufreq: Add Milos to cpufreq-dt-platdev blocklist
  cpufreq: Use %pe to print error pointers symbolically
  rust: rcpufreq_dt: add module alias
  cpufreq: sti: avoid NULL dereference in dev_err()
  cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv
  cpufreq: sparc-us2e: fix frequency table index copy-paste error
  rust: cpufreq: reject NULL from cpufreq_cpu_get()
  ...
2026-10-21 14:24:26 -10:00
Rafael J. Wysocki
eece15c579 Merge branch 'pm-cpufreq'
Merge cpufreq updates for 7.4:

 - Minor fixes in various cpufreq drivers (Alexander Koskovich, Daniel
   Schwierzeck, Frank Zhang, Haotian Zhang, Kathiravan Thirumoorthy,
   Sumeet Pawnikar, and Xueqin Luo)

 - Fix wrong behaviors on multi-node servers in the Loongson cpufreq
   driver (Huacai Chen)

 - Reject NULL from cpufreq_cpu_get() in the Rust code (Mehmet Koseoglu)

 - Add suspend OPP to mediatek cpufreq driver and DT (Ryan Brue)

 - Fixups for a few bugs identified by Sashiko in the amd-pstate cpufreq
   driver (Mario Limoncielloi, Wentao Guan)

 - Initial support for maximum frequency capacity handling on Zen6
   client in amd-pstate (Mario Limonciello)

 - Fix for amd-pstate-ut with 'Requested CPU Min frequency' BIOS option
   (K Prateek Nayak)

 - New Zen6 tuning values for EPP in amd-pstate (Mario Limonciello,
   Vishal Badole)

 - amd-pstate documentation fix (Karl Mehltretter)

 - Restrict deferred downscaling to low load for shared policies in the
   conservative cpufreq governor to avoid undesirable CPU frequency
   reduction in some cases (Shengming Hu)

 - Serialize sugov_start() against rate limit updates in the schedutil
   cpufreq governor to avoid using a stale rate limit value (Hui Su)

* pm-cpufreq: (34 commits)
  cpufreq: loongson3: Replace IOCSR read/write with MMIO ones
  cpufreq: loongson3: Use global physical CPU ID in get/target callbacks
  cpufreq: loongson3: Replace per-package mutex with per-node
  cpufreq: loongson3: Adjust the width of id and val in smc_message
  cpufreq: loongson3: Make this driver depend on MACH_LOONGSON64
  cpufreq: schedutil: Serialize sugov_start() against rate limit updates
  arm64: dts: mediatek: mt8173: Mark the lowest CPU OPPs for suspend
  cpufreq: mediatek: Enter system sleep at the suspend OPP
  cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing
  cpufreq: qcom-nvmem: Add IPQ9650 support
  cpufreq: Add Milos to cpufreq-dt-platdev blocklist
  cpufreq: Use %pe to print error pointers symbolically
  rust: rcpufreq_dt: add module alias
  cpufreq: sti: avoid NULL dereference in dev_err()
  cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv
  cpufreq: sparc-us2e: fix frequency table index copy-paste error
  rust: cpufreq: reject NULL from cpufreq_cpu_get()
  cpufreq: amd-pstate-ut: Fix max_freq and EPP test failures on Zen6
  cpufreq: amd-pstate: Propagate cppc_set_auto_sel() errors on mode change
  cpufreq: amd-pstate: Restore previous mode when changing driver mode fails
  ...
2026-10-19 14:20:58 +02:00
Rafael J. Wysocki
8669f2b6c9 Merge branch 'acpi-driver'
Merge changes related to ACPI support in device drivers for 7.4:

 - Switch over the users of acpi_get_first_physical_node(), that
   was inherently racy and therefore not really safe to use, to use
   its replacement acpi_bus_get_primary_device(), and eliminate the
   former (Rafael Wysocki)

 - Add !CONFIG_ACPI stubs for acpi_find_child_device() and
   acpi_device_uid() (Mario Limonciello and Robin Murphy)

* acpi-driver:
  ACPI: bus: Drop acpi_get_first_physical_node()
  efi/dev-path-parser: Switch to use acpi_bus_get_primary_device()
  ALSA: hda: tas2781: Switch to use acpi_bus_get_primary_device()
  ALSA: hda: cs35l41: Switch to use acpi_bus_get_primary_device()
  iommu/arm-smmu-v3: Switch to use acpi_bus_get_primary_device()
  ACPI: Add stub for acpi_find_child_device()
  ACPI: bus: Provide !ACPI stub for acpi_device_uid()
  ALSA: hda: aw88399: Switch to use acpi_bus_get_primary_device()
  ASoC: loongson: Switch to use acpi_bus_get_primary_device()
  ASoC: intel: boards: Switch to use acpi_bus_get_primary_device()
  ASoC: amd: acp3x-es83xx: Switch to use acpi_bus_get_primary_device()
  ASoC: amd: acp-es8336: Switch to use acpi_bus_get_primary_device()
  thunderbolt: Switch to use acpi_bus_get_primary_device()
  platform/x86: apple-gmux: Switch to use acpi_bus_get_primary_device()
  platform/x86: x86-android-tablets: Use acpi_bus_get_primary_device()
  platform/x86: serdev_helpers: Switch to use acpi_bus_get_primary_device()
  platform/x86: yogabook: Switch to use acpi_bus_get_primary_device()
  ACPI: amba: Switch to use acpi_bus_get_primary_device()
  ACPI: bus: Use acpi/acpi_bus.h without CONFIG_ACPI
2026-10-19 13:32:55 +02:00
Rafael J. Wysocki
5a44bb4863 Merge branches 'acpica' and 'acpi-thermal'
Merge ACPICA updates and ACPI thermal control updates for 7.4:

 - Add IOVT IOMMU support to ACPICA (Bibo Mao)

 - Fix PCC OperationRegion command offsets in ACPICA (Sudeep Holla)

 - Fix memory leak in acpi_ds_create_field() related to the handling of
   internal_pcc_buffer allocations (Breno Leitao)

 - Fix memory leak due to leftover devm_kcalloc() argument in the ACPI
   fan driver (Rafael Wysocki)

 - Fix backlight unregistration ordering in the ACPI video bus device
   driver (Rafael Wysocki)

 - Update the thermal core to allow the registration of thermal class
   cooling devices under specific parents and convert the ACPI fan,
   ACPI processor, and ACPI video bus device drivers to do so (Rafael
   Wysocki)

 - Adjust the ACPI thermal zone driver to use thermal class cooling
   device parent information for binding cooling devices to trip points
   in thermal zones (Rafael Wysocki)

 - Use cooling device data that is a better match for a given driver
   instread of a struct acpi_device pointer that had to be used for
   this purpose previously in the ACPI fan and processor drivers (Rafael
   Wysocki)

 - Fix acpi_thermal_guess_offset() in the ACPI thermal zone driver for
   thermal zone devices with a 273.0°K offset (Hans de Goede)

 - Define a free for ACPI objects allocated by ACPICA helpers and use
   it to simplify AML error handling in the ACPI fan driver (Rafael
   Wysocki)

* acpica:
  ACPICA: actbl2.h: Add bit constants of the Flags field in the IOVT IOMMU structure
  ACPICA: Fix PCC OperationRegion command offsets
  ACPICA: Fix memory leak in acpi_ds_create_field()

* acpi-thermal:
  ACPI: fan: Use __free() to simplify AML error handling
  ACPI: thermal: Fix acpi_thermal_guess_offset() for device with a 273.0°K offset
  ACPI: fan: Use more suitable cooling device data
  ACPI: fan: Store ACPI device pointer in struct acpi_fan
  ACPI: processor: thermal: Use more suitable cooling device data
  ACPI: thermal: Use cooling device parent for thermal zone binding
  ACPI: fan: Use thermal_cooling_device_create()
  ACPI: video: Use thermal_cooling_device_create()
  ACPI: processor: thermal: Use thermal_cooling_device_create()
  thermal: core: Introduce thermal_cooling_device_create()
  ACPI: video: Fix backlight unregistration ordering
  ACPI: fan: Fix memory leak due to leftover devm_kcalloc() argument
2026-10-19 13:30:25 +02:00
Rafael J. Wysocki
6a71f067f7 Merge branches 'acpi-pci' and 'acpi-apei'
Merge an ACPI support change related to PCI and ACPI APEI support
updates for 7.4:

 - Clear driver_data before free in the ACPI PCI Link driver to prevent
   a dangling pointer from being used later (Jiale Yao)

 - Accumulate the queued flag across error sections of a CPER record in
   ghes_do_proc() to prevent it from being cleared by a later section or
   entry that does not queue memory-failure work (Breno Leitao)

 - Map a raw PCI AER Capability image field by field to prevent
   information loss from occurring while processing it (Dave Jiang)

 - Update a stale driver source reference in the ACPI APEI EINJ driver
   documentation (Prabhakar Pujeri)

 - Reject CPER records with an out-of-range error_data_length or an
   error status block length wrapping a u32 in the EFI CPER driver (Dave
   Jiang)

 - Address multiple assorted issues in the ACPI extlog driver (Dave
   Jiang)

 - Address two issues related to CXL in the ACPI APEI GHES driver (Dave
   Jiang)

 - Read only validated fields in cper_mem_err_pack() (Dave Jiang)

 - Validate memory error section length before payload access, prevent
   writes past array bounds from occurring and sanitize software
   metadata in the ACPI APEI GHES driver (Dave Jiang)

 - Make cxl_cper_handle_prot_err() static (Dave Jiang)

* acpi-pci:
  ACPI: PCI: pci_link: clear driver_data before free

* acpi-apei:
  ACPI: APEI: accumulate the queued flag across error sections
  PCI/AER: Map a raw AER Capability image field by field
  Documentation: ACPI: EINJ: Update stale driver source reference
  cxl/ras: Make cxl_cper_handle_prot_err() static
  ACPI: APEI: GHES: Bound AER info copy and sanitize software metadata
  ACPI: APEI: GHES: Validate memory error section length before payload access
  efi/cper: Read only validated fields in cper_mem_err_pack()
  ACPI: APEI: GHES: Validate CXL protocol error section length before RAS cap copy
  ACPI: APEI: GHES: Bound CXL event record copy to the firmware section length
  ACPI: extlog: Fix CONFIG_ACPI_APEI_PCIEAER guard typo
  ACPI: extlog: Validate PCIe error section length before payload access
  ACPI: extlog: Avoid populating software AER metadata from raw hardware buffer
  ACPI: extlog: Defer CXL protocol error handling to avoid lock inversion
  ACPI: extlog: Validate elog record length before walking sections
  efi/cper: Reject an error status block length that wraps a u32
  efi/cper: Reject CPER records with an out-of-range error_data_length
2026-10-16 22:13:24 +02:00
Rafael J. Wysocki
52e4ebeee9 Merge branches 'acpi-tables', 'acpi-osl', 'acpi-utils' and 'acpi-pm'
Merge ACPI table parser updates, an ACPI OS services layer (OSL) update,
ACPI utility API updates, and ACPI power management updates for 7.4:

 - Remove __meminitdata from hmat_adist_nb declaration preserving it
   even when CONFIG_MEMORY_HOTPLUG is not set to prevent notifier chain
   corruption in some cases (Alejandro Lucero)

 - Prevent a NULL pointer dereference when attempting to read the table
   length after a mapping bookkeeping failure during an initrd override
   invocation with permanent table mappings enabled (Slavin Liu)

 - Use for_each_populated_zone() in get_node_num() in the MRRM table
   pareser (Sang-Heon Jeon)

 - Use vsnprintf() in acpi_os_vprintf() to prevent memory corruption
   resulting from overly long diagnostic messages that may not fit into
   a static buffer used by ACPICA and may be produced by a malformed
   ACPI table (Vlatko Kosturjak)

 - Ignore leading root scope prefix in string _UID match to allow AMD
   IOMMU matching to work as expected in some cases (Mario Limonciello)

 - Adjust message printing macros for ACPI objects to use dev_fmt() for
   more consistency with the analogous dev_*() macros (Rafael Wysocki)

 - Add _Ixx GPE wake indicator support to the x86 suspend-to-idle
   handling code (Saranya Gopal)

 - Add quirks to avoid turning off unused ACPI power resources on Acer
   Swift 3 SF314-56G (MX250), Casper Excalibur G900, and Acer Aspire
   A515-53G (Matthias Dittrich, Hakan Abay, Krittikun Wongnin)

 - Drop unused sleep_no_lps0 define from the generic ACPI system sleep
   handling code (Riwen Lu)

* acpi-tables:
  ACPI: HMAT: preserve hmat_adist_nb notifier block
  ACPI: tables: handle failed initrd override mappings
  ACPI: MRRM: Use for_each_populated_zone() in get_node_num()

* acpi-osl:
  ACPI: OSL: Use vsnprintf() in acpi_os_vprintf()

* acpi-utils:
  ACPI: utils: Ignore leading root scope prefix in string _UID match
  ACPI: utils: Adjust message printing macros for ACPI objects

* acpi-pm:
  ACPI: PM: Add Acer Aspire A515-53G to dmi_leave_unused_power_resources_on[]
  ACPI: PM: sleep: Drop unused sleep_no_lps0 define
  ACPI: PM: Add unused power resource quirk for Casper Excalibur G900
  ACPI: PM: Add quirk for Acer Swift 3 SF314-56G (MX250)
  ACPI: PM: s2idle: Add _Ixx GPE wake indicator support
2026-10-16 21:42:03 +02:00
Rafael J. Wysocki
253b25cbb3 Merge branches 'acpi-scan', 'acpi-glue', 'acpi-bus' and 'acpi-sysfs'
Merge ACPI support infrastructure changes for 7.4:

 - Make the core ACPI device enumeration code stop attempting to
   initialize ACPI power management for devices before they are
   known to be present and functional (Rafael Wysocki)

 - Simplify and clean up the core ACPI device enumeration code on top of
   the previous adjustment and reduce debug noise coming from it (Rafael
   Wysocki)

 - Fix locking in the code binding devices to their ACPI companions,
   prevent it from replacing a valid ACPI companion pointer with NULL
   incidentally, improve its messaging (including debug noise
   reduction), and reduce its overhead by making it skip the cases in
   which no ACPI companion may exist early (Rafael Wysocki)

 - Reduce runtime memory footprint of struct acpi_device by rearranging
   fields in it (Andy Shevchenko)

 - Update the driver core to allow bus types without drivers to be
   registered as "companion bus types" without driver-related sysfs
   attributes and register the ACPI bus type as a companion one (Rafael
   Wysocki)

 - Use strscpy() instead of strcpy() in the ACPI sysfs interface (Ruslan
   Vagner)

* acpi-scan:
  ACPI: scan: Combine two conditionals in acpi_bus_attach()
  ACPI: PM: Move acpi_bus_init_power() declaration to internal header file
  ACPI: scan: Stop calling acpi_bus_init_power() early
  ACPI: PM: Drop parent state update from acpi_device_get_power()
  ACPI: scan: Drop useless and noisy debug statement

* acpi-glue:
  ACPI: glue: Skip devices with no type in acpi_device_notify()
  ACPI: glue: Fix up and adjust acpi_unbind_one()
  ACPI: glue: Rearrange acpi_bind_one() to avoid breakage
  ACPI: glue: Carry out companion lookup under bus_type_sem
  ACPI: glue: Rework the success message in acpi_device_notify()
  ACPI: glue: Reduce debug noise from acpi_device_notify()

* acpi-bus:
  driver core/ACPI: Introduce companion_bus_register()
  ACPI: bus: Reduce runtime memory footprint of struct acpi_device

* acpi-sysfs:
  ACPI: sysfs: use strscpy() instead of strcpy()
2026-10-16 21:17:17 +02:00
Bibo Mao
3bd2779b6c ACPICA: actbl2.h: Add bit constants of the Flags field in the IOVT IOMMU structure
According to the IOVT specification, define macros for each bit of the
Flags field in the IOVT IOMMU structure.

Link: https://github.com/open-acpica/acpica/commit/352f750e4cc0
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Link: https://patch.msgid.link/20260922121058.972734-2-maobibo@loongson.cn
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-10-12 16:44:05 +02:00
Mario Limonciello
4817d3e2b9 ACPI: CPPC: Refactor boost ratio handling
Rename amd_get_boost_ratio_numerator() to amd_get_effective_highest_perf()
to better reflect that it returns the effective highest performance value
for a CPU, accounting for preferred cores and heterogeneous topologies.

Add a new helper amd_get_boost_ratio() for doing both for boost
ratio calculations and update callers to use it.

This refactoring is needed because on some AMD systems (Zen6+),
the boost ratio should be calculated from frequency values rather than
performance values.

Newer versions of the ACPI will introduce a proper interface
for getting this information, but for now hardcode values so that
these systems perform as intended and to unblock future scheduler
work while we continue to wait.

For now use some temporary hardcoded values for Zen6 platforms.

Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20261001142341.2934582-2-mario.limonciello@amd.com
Signed-off-by: Mario Limonciello <superm1@kernel.org>
2026-10-01 12:55:20 -05:00
Mario Limonciello
62d6cb1f7d ACPI: Add stub for acpi_find_child_device()
Provide a NULL-returning stub when CONFIG_ACPI is disabled so callers can
be compiled without ACPI support.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Closes: https://lore.kernel.org/linux-sound/20260925131104.118993-1-arnd@kernel.org/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20260925162628.4142365-1-mario.limonciello@amd.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-25 18:44:18 +02:00
Robin Murphy
0fa8ad52b6 ACPI: bus: Provide !ACPI stub for acpi_device_uid()
While the likes of acpi_dev_uid_to_integer() and acpi_dev_uid_match()
already have stubs for !ACPI, the basic acpi_device_uid() getter does
not. Although calls in portable drivers should already be conditional
on a valid acpi_device in a manner which would usually lead to compile-
time elimination anyway, add a stub for the sake of completeness.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
[ rjw: Subject tweak ]
Link: https://patch.msgid.link/8325277ff0484ab869fecf662a7ea356cd00bcde.1790090794.git.robin.murphy@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-22 19:30:49 +02:00
Rafael J. Wysocki
e7280ab196 ACPI: bus: Use acpi/acpi_bus.h without CONFIG_ACPI
Corrently acpi/acpi_bus.h is included in linux/acpi.h only if
CONFIG_ACPI is set, but it contains declarations that are useful
otherwise too.

For consistency, modify linux/acpi.h to always include acpi/acpi_bus.h
and update the latter to avoid exposing too much when CONFIG_ACPI is
not set.

Since acpi_has_method() is called from some code build when
CONFIG_ACPI is unset, add a stub for it to the !CONFIG_ACPI
block in acpi/acpi_bus.h.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>
Link: https://patch.msgid.link/3717753.iIbC2pHGDl@rafael.j.wysocki
2026-09-22 18:45:17 +02:00
Christian Loehle
4bcc60d326 ACPI: CPPC: Accept requests to retain immutable autonomous selection
ACPI permits Autonomous Selection Enable to be Integer 1 when the platform
always selects performance autonomously. cppc_get_auto_sel() returns that
value, but cppc_set_auto_sel() rejects the Integer even when asked to keep
autonomous selection enabled. AMD shared-memory initialization consequently
fails in active or guided mode after successfully reading the capability.

Accept a request to keep this immutable field enabled without issuing a
register access. Expose the immutable encoding to callers, separately from
the current value of a writable register.

Before an AMD shared-memory transition to passive mode, reject immutable
autonomous selection on any present CPU. Otherwise a guided-to-passive
transition ignores the failed disable and reports the wrong mode, while
active-to-passive unregisters the working driver before passive policy
initialization fails. Check under the driver mode lock before invoking
either transition, including known offline CPUs.

Serialize this capability query with descriptor publication and removal.
ACPI processor removal drops the descriptor before taking the CPU hotplug
write lock, so the caller's cpus_read_lock() alone cannot protect the
lookup. Unpublish under the same mutex before releasing a descriptor,
including when adding its kobject fails.

The cppc-cpufreq auto_select attribute can also request one while
autonomous selection is already enabled. If the subsequent bounds update
fails, its rollback requests zero and clears the cached mode regardless
of the previous state. For an immutable field the disable request fails,
leaving the cached mode wrong. Save and restore the previous mode instead.
This also avoids disabling an already-enabled writable control on that
error path.

Fixes: c984f5d5d4 ("ACPI: CPPC: Add auto select register read/write support")
Fixes: ea3db45ae4 ("cpufreq: cppc: Update MIN_PERF/MAX_PERF in target callbacks")
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20260916162805.1039247-19-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-18 17:29:09 +02:00
Christian Loehle
908a87126a ACPI: CPPC: Validate PCC overlaps across processors
PCC shared-memory offsets are physical within a subspace, but the
existing overlap check stops at one _CPC package. Two processors can
therefore pass probe with writable ranges which overlap in the same PCC
subspace.

This is unsafe in the performance path, where CPUs may stage requests
concurrently while holding the shared side of pcc_lock. Partially
overlapping stores can construct a payload which belongs to neither
request before a doorbell submits it.

Index retained PCC byte ranges by subspace and physical interval. The
registry checks entries within the new descriptor as well as other CPUs,
replacing the separate same-descriptor PCC overlap pass. Permit
read-only overlap and exact aliases of the same logical CPPC entry. The
per-subspace payload lock serializes each exact-alias field store,
including multi-byte fields copied with byte-oriented I/O. Reject every
other overlap involving a writable entry.

Each CPC descriptor owns its interval records. Remove them when processor
teardown unpublishes the descriptor and on probe failure.

Fixes: 80b8286aee ("ACPI / CPPC: support for batching CPPC requests")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20260916162805.1039247-13-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-18 17:29:08 +02:00
Christian Loehle
09d911c996 ACPI: CPPC: Reject direct reads of write-only controls
Between _CPC revision 3 and revision 4, Desired Performance changed from
Read/Write to Write. Revision 4 also added the write-only OSPM Nominal
Performance control. ACPI 6.6 section 4.6.3 says reads of write-only bit
positions produce undefined results.

The public Desired Performance helper already rejects revision-4 readback,
but the common register accessor still permits either write-only control to
be read. Move the check into the common accessor and reject both controls
there, so callers cannot consume undefined values.

A partial SystemMemory field still makes cpc_write() read its complete
access unit to preserve bits outside the field. MASK_VAL_WRITE() replaces
every bit of the field being written, so that field's undefined readback is
not propagated. However, another writer sharing the access unit would
preserve and replay the write-only field when performing its own RMW.
Reject such pairs; a partial write-only field may share its access unit
only with disjoint read-only fields.

Also reject readable fields whose logical bits overlap a write-only field,
even if the write-only descriptor is retained as an inaccessible range.
Reading the containing access unit is safe when the undefined bits are
masked out, but an overlapping read field would expose them to callers.
Apply this check before the no-writer shortcut, and reserve the complete
known access range when a write-only field has no usable Bit Width.

Keep an invalid but locatable write-only SystemMemory descriptor
represented during overlap validation, but mark it unreadable and
unwritable. Otherwise a neighbouring RMW field could evade validation and
replay undefined readback into the hidden control. Conservatively claim the
larger of the declared access unit and logical field span. Check if the
writer access unit covers the write-only field so harmless asymmetric
geometries are not rejected. Preserve a decoded access-unit claim even when
the malformed Bit Width is zero, and use that claimed range when testing
whether another writer's access overlaps the hidden field.

Count only accessible descriptors as writers in the generic conflict
rules. The logical-field overlap check protects a retained field from a
full-width write, and the dedicated write-only-field check also protects it
from another writer's RMW.

Mark an inaccessible OSPM Nominal Performance control unsupported because
it is optional. Do the same for inaccessible Desired Performance while
parsing, then let the post-parse control check accept it only for immutable
autonomous selection. This preserves the autonomous-only exception without
accepting an unusable Desired control in non-autonomous mode.

Do not advertise fast switching or zero transition latency unless Desired
Performance remains writable. An inaccessible descriptor retained only for
overlap validation still carries its original address-space identity, but
cannot service a performance request.

Fixes: 71e1815113 ("ACPI: CPPC: Add support for CPPC v4")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260807111303.1062391-1-christian.loehle%40arm.com
Link: https://sashiko.dev/#/patchset/20260808082644.1251332-1-christian.loehle%40arm.com
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20260916162805.1039247-10-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-18 17:29:08 +02:00
Christian Loehle
2221dc547b ACPI: CPPC: Reject unsafe cross-CPU SystemMemory RMW
A SystemMemory CPPC field narrower than its access unit needs a
read-modify-write operation. The per-CPC-descriptor lock cannot serialize
access units described by different processors, so concurrent writers can
lose updates. _PSD domains do not define physical register ownership.

Track SystemMemory access units in a probe-time interval tree and reject
cross-descriptor partial writers sharing an access unit. Allow exact
aliases only for aligned native-width accesses to the same logical field.
Reject overlapping writable logical fields and full-width writes which
would overwrite another field. Disjoint read-only fields may share a larger
read access unit with a writer.

Within one descriptor, mark both overlapping accesses for the RMW lock,
including a full-width byte beside a wider partial field. Count only
controls written by the CPPC library as competing writers, so the unused
OSPM Nominal Performance control does not trigger a writer conflict.

Mark successful relaxed MMIO writes pending before releasing the raw
spinlock. On architectures which need an MMIO write barrier during lock
handoff, raw_spin_unlock_irqrestore() then orders the write before the next
writer enters the RMW critical section.

Validate the GAS geometry and supported access widths. Require natural
alignment where the architecture's MMIO accessors need it. Exact writable
aliases require alignment on x86 too, because an unaligned instruction need
not be one indivisible device transaction.

Keep validation results separate from the probe return value, so a
successful geometry check cannot make a later mapping failure return
success. Remove the interval records during teardown and probe rollback.

Fixes: 60949b7b80 ("ACPI: CPPC: Fix MASK_VAL() usage")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260724134251.1632824-1-christian.loehle%40arm.com
Link: https://sashiko.dev/#/patchset/20260807111303.1062391-1-christian-loehle%40arm.com
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20260916162805.1039247-9-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-18 17:29:08 +02:00
Christian Loehle
32299b29a8 ACPI: CPPC: Validate _CPC entry and control semantics
Writable _CPC controls are Register descriptors encoded as Buffer objects.
Integer entries represent fixed values or legacy placeholders for
unsupported optional registers; Autonomous Selection Integer 1 is the
special immutable form which enables operation without Desired Performance.

The parser accepts arbitrary object types and cpc_write() assumes that its
argument contains a GAS. Malformed firmware can therefore make it interpret
an Integer union member as a register.

Validate the portion of each encoding consumed by the driver: bound Integer
capabilities stored in u32 fields to U32_MAX, and require Buffer entries to
start with a complete Generic Register descriptor with the expected header.
Do not restrict an Integer Counter Wraparound Time. Both AML Integers and
the kernel interface are 64-bit, despite the DWORD annotation in the ACPI
table. Continue tolerating Integer 0 placeholders for absent optional
Buffer registers to avoid breaking legacy platforms. Report their invalid
encoding as a firmware bug. Retain type checks in cpc_write() as defense in
depth. Reject an attempt to disable immutable Autonomous Selection instead
of silently applying only the EPP part of the request.

Capability registers are read into u64 temporaries but exposed through u32
fields. Reject values above U32_MAX instead of allowing them to be
truncated. In particular, a truncated Highest Performance value can become
a zero divisor in the performance-to-frequency conversion. Enforce the
required ordering from Highest through Nominal, Lowest Nonlinear, and
Lowest Performance, and constrain a present Guaranteed Performance to the
inclusive Lowest-to-Nominal range. Also reject reversed frequency anchors
and unequal frequency anchors with identical performance anchors. Those
invalid tuples otherwise make affine-conversion differences wrap or divide
by zero.

Check mandatory object presence separately from the Integer-zero convention
for absent optional fields.

Reject Minimum and Maximum Performance readbacks above U32_MAX before
narrowing them. A truncated minimum could otherwise become an explicit
zero update when cppc-cpufreq writes the initial controls back to the
platform.

Minimum Performance also defines zero as a real no-limit value, but the
exported cppc_set_perf() interface historically used zero to omit a bound.
Add a minimum-valid flag so callers can request zero without changing that
legacy convention. Set it when reading a supported Minimum Performance
register, preserving zero across cppc-cpufreq initialization and exit.
Keep zero-as-omit for Maximum Performance, whose no-limit encoding is all
ones, not zero. Initialize amd-pstate's control structure with the new flag
clear: its shared-memory backend does not record bios_min_perf, so its
zero-valued restore requests must remain omitted.

Performance Limited is listed as a required Buffer, but the interface does
not depend on it to control performance and the specification permits a
platform with no limiting indication to always report zero. Preserve
compatibility with firmware that represents that case using a NULL register
descriptor instead of disabling CPPC entirely.

Emit an error when a present _CPC package fails parsing or initialization
so such firmware and resource failures no longer silently suppress cpufreq.
Initialize malformed-package failures to -EINVAL and preserve specific
allocation, mapping, and unsupported-access errors in that diagnostic.

Fixes: 337aadff8e ("ACPI: Introduce CPU performance controls using CPPC")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260724134251.1632824-1-christian.loehle%40arm.com
Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20260916162805.1039247-3-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-18 17:29:07 +02:00
Rafael J. Wysocki
d1b25eb2d8 ACPI: processor: thermal: Use more suitable cooling device data
Instead of passing an ACPI device object pointer as devdata to
thermal_cooling_device_create(), make acpi_processor_thermal_init()
pass a pointer to the struct acpi_processor representing the given CPU
to it, which allows the callback functions in processor_cooling_ops to
be simplified and the second argument of acpi_processor_thermal_init()
and acpi_processor_thermal_exit() to be dropped.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Link: https://patch.msgid.link/6192780.MhkbZ0Pkbq@rafael.j.wysocki
2026-09-12 20:12:40 +02:00
Rafael J. Wysocki
bb03cfceb1 ACPI: processor: thermal: Use thermal_cooling_device_create()
Instead of using thermal_cooling_device_register() for registering
a cooling device in the ACPI processor driver, make it use
thermal_cooling_device_create() and pass a pointer to the processor
device representing the given CPU to that function as the cooling
device's parent.  That will cause the cooling device's sysfs directory
to be created under the parent's sysfs directory (among other things).

Since creating a class device under a parent causes a "device" symbolic
link from the sysfs directory of the class device to the sysfs directory
of the parent to appear automatically, remove the code creating the
"device" symbolic link from the sysfs directory of the cooling device
in question to the sysfs directory of the parent's companion ACPI
device.  That ACPI device is reachable through the "firmware_node"
symbolic link in the parent's sysfs directory regardless.

Moreover, since the cooling device is now located in sysfs under its
parent and it can be easily identified as a cooling device, there is
no need to create a "thermal_cooling" symbolic link from its parent's
ACPI companion to it.  Accordingly, also remove the code creating that
symbolic link.

While at it, check for error pointer values in addition to checking
for NULL in acpi_processor_thermal_exit() to avoid dereferencing them
mistakenly.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
[ rjw: Corrected typo in the changelog ]
Link: https://patch.msgid.link/2362345.iZASKD2KPV@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-12 20:11:25 +02:00
Rafael J. Wysocki
6935468526 ACPI: glue: Fix up and adjust acpi_unbind_one()
Since none of the acpi_unbind_one() callers check its return value and
it always returns 0 anyway, make it void.

Also notice that unlocking physical_node_lock for the given ACPI device
should be carried out before dropping the reference to it in case that
reference is the last one (highly unlikely), so rearrange the code to
make that happen.

Fixes: 3e3327837c ("ACPI: Use list_for_each_entry() in acpi_unbind_one()")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/10940500.nUPlyArG6x@rafael.j.wysocki
2026-09-11 15:26:49 +02:00
Andy Shevchenko
f8113f311c ACPI: bus: Reduce runtime memory footprint of struct acpi_device
The ACPI handle is heavily used by the ACPI code. Making it as
the first member in the struct acpi_device reduces code size.

For instance, the drivers/acpi/scan.o (with `make allyesconfig`)
gives this statistics:

add/remove: 0/0 grow/shrink: 3/8 up/down: 50/-169 (-119)
Function                                     old     new   delta
acpi_device_add                             2294    2319     +25
acpi_add_single_object                      6523    6544     +21
acpi_dev_get_next_consumer_dev               602     606      +4
acpi_tie_acpi_dev                            169     165      -4
acpi_scan_drop_device                        319     315      -4
acpi_dev_clear_dependencies                 1151    1147      -4
acpi_bus_attach                             2898    2894      -4
acpi_dma_get_range                          1420    1415      -5
acpi_init_device_object                     5497    5485     -12
acpi_bus_check_add                          1940    1923     -17
acpi_device_hotplug                         3407    3288    -119
Total: Before=77509, After=77390, chg -0.15%

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[ rjw: Changelog tweaks ]
Link: https://patch.msgid.link/20260909163918.368017-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-10 19:25:26 +02:00
Mario Limonciello
3107a9a324 ACPI: utils: Ignore leading root scope prefix in string _UID match
Firmware may express an ACPI namespace path used as a _UID with or
without the leading root scope character ('\'). For example, an AMD
IVRS IVHD ACPI HID device entry may carry a character UID of
"\_SB.MHSP" while the corresponding device's _UID evaluates to
"_SB.MHSP" (or vice versa).  This semantic difference is due to how
Windows PnP enumerates and uses devices.

acpi_str_uid_match() compared the two strings verbatim, so such
entries failed to match on the UID even though they refer to the same
object. In the AMD IOMMU case (get_acpihid_device_id()) this caused
the exact HID+UID match to be missed and the code to fall through to
the HID-only path, spuriously raising a FW_BUG.

Skip a single leading '\' on either string before comparing so that
paths that differ only by the root scope prefix are treated as a
match. The integer _UID path is unaffected.

[ rjw: It is sad that making this change needed to be considered at all.
  That being said, it is also rather unlikely that someone will use a
  leading backslash as the only difference to distinguish one UID
  string from antother, so this change is unlikely to break anything. ]

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
[ rjw: Added separator line to a kerneldoc comment ]
[ rjw: Droppend Link: tag with a limited access target ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-10 16:27:07 +02:00
Rafael J. Wysocki
811268084e ACPI: PM: Move acpi_bus_init_power() declaration to internal header file
Since acpi_bus_init_power() is only used internally in the core ACPI
device enumeration and power management code, it need not be visible
outside, so move its declaration to an internal header file.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Peixin Xie <peixin.xie@linux.spacemit.com>
Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Link: https://patch.msgid.link/3079955.e9J7NaK4W3@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-09 18:07:59 +02:00
Dave Jiang
8bf5881531 ACPI: APEI: GHES: Validate CXL protocol error section length before RAS cap copy
cxl_cper_setup_prot_err_work_data() locates the RAS Capability block at
prot_err + sizeof(*prot_err) + dvsec_len and copies it, but dvsec_len is
firmware controlled and never validated, so it can point the copy outside
the section.

Extend cxl_cper_sec_prot_err_valid() to check that the section can hold
the header, and that the header, DVSEC and RAS Capability block together
fit the reported section length.

Reported-by: sashiko-bot@kernel.org
Link: https://sashiko.dev/#/patchset/20260617-topics-ahmtib01-ras_ffh_arm_internal_review-v6-0-91f725174aa0@arm.com?part=6
Link: https://lore.kernel.org/linux-cxl/20260709165457.8BA181F000E9@smtp.kernel.org/
Fixes: 315c2f0b53 ("acpi/ghes, cper: Recognize and cache CXL Protocol errors")
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260904172337.1409775-10-dave.jiang@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-04 20:22:05 +02:00
Dave Jiang
179ef6d7f9 ACPI: extlog: Defer CXL protocol error handling to avoid lock inversion
extlog_print() calls cxl_cper_handle_prot_err() synchronously while the
MCE notifier chain rwsem is held, and that path takes the PCI device_lock
via guard(device)(). The probe path takes the two in the opposite order,
holding device_lock while mce_register_decode_chain() takes the rwsem, so
they can deadlock AB-BA.

ghes.c already avoids this by posting protocol errors to a kfifo and
handling them from a workqueue via cxl_cper_post_prot_err(). Export that
function and call it instead.

Declare it with the other CONFIG_ACPI_APEI_GHES exports rather than at the
end of the header. No #else stub: ACPI_EXTLOG selects ACPI_APEI_GHES, so
the only caller cannot exist without it.

Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/linux-cxl/20260709165457.8BA181F000E9@smtp.kernel.org/
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260904172337.1409775-5-dave.jiang@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-04 20:22:04 +02:00
Rafael J. Wysocki
4a819ee5f2 ACPI: bus: Drop two fields from struct acpi_device_pnp
There are two fields in struct acpi_device_pnp, device_name and
device_class, that were supposed to be populated and used by device
drivers, but they have never been used consistently and now they
are only set for the bus object in acpi_set_pnp_ids() (and never
read afterward).

Drop them along with all of the associated symbols except for
MAX_ACPI_CLASS_NAME_LEN and the acpi_device_class typedef that
are used by the ACPI netlink messaging code.  Move those two
definitions closer to the struct acpi_bus_event that refers to
the acpi_device_class type.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/6314925.lOV4Wx5bFT@rafael.j.wysocki
2026-09-01 21:45:50 +02:00
Linus Torvalds
3382bfbca5 More ACPI support updates for 7.3-rc1
- Update MAINTAINERS, CREDITS and ACPI subsystem documentation to
    reflect recent changes in the upstream ACPICA project (Rafael
    Wysocki)
 
  - Prevent the core ACPI enumeration code from combining device
    resources that overlap completely in order to avoid resource
    conflicts during platform device registration because there are
    drivers that expect such resources to be present (Rafael Wysocki)
 
  - Defer device power initialization during ACPI-based device
    enumeration to the point when the given device is known to be present
    and functional and all of its dependencies have been met (Peixin Xie)
 
  - Fix bus ID cleanup on device_add() failures during ACPI device object
    registration (Hongyan Xu)
 
  - Introduce a new helper function for looking up the primary "physical"
    device for a given ACPI device object and update the core ACPI device
    enumeration code to use that function (Rafael Wysocki)
 
  - Protect all battery properties with a separated mutex in the ACPI
    battery driver to prevent race conditions from occurring and avoid
    evaluating the _BST ACPI control method multiple times in parallel
    for the same battery device (Rong Zhang)
 
  - Add DMI quirk for the Razer Blade Pro 17 early 2020 lid switch to the
    ACPI button driver (Robin Everaars)
 
  - Convert fixed clock rates in the ACPI driver for AMD SoCs (APD) to
    use HZ_PER_MHZ and add a clock frequency for the HJMC01 I2C
    controller to it (Hongnan Li and Xiangyang Yu)
 
  - Fix a stack buffer overflow in query_capability() in the ACPI
    platform firmware runtime update driver (Anirudh Prasad)
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmqPL0oSHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1RrYH/AgB9tvwsenlB1jp2JxOqZhzuaKezH66
 wRAddLVPg4Goc6XV6EUFZZi47PpAbgUPvRFhxBXu8oxY4W9g8Ak3BKxAefcjH2Gh
 WhGxAo51Be/4PskO47e29CUf1pWlMD9QeffIxBFqB5uqJ48/E2WDdstsR8tUazKL
 6n7APE9udaL/xNAvGvgXEmhrj6hdhMhQfiQISOrcHGtbNd1AIsVrfC4BRi/qCjdv
 s385YtkAtY0xgfu3s6HmjtUQxJ0Isse5dhgDCC5cb05pFxItPqmCPgUY8VYCWqml
 07EfplwaOBBv9IxAuBTyB9gl7E/WDxg9cVTPy6Hm2TZ9PeIFXK2NvI4=
 =Jtbh
 -----END PGP SIGNATURE-----

Merge tag 'acpi-7.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI support updates from Rafael Wysocki:
 "These update documentation to reflect recent changes in the upstream
  ACPICA project, fix issues in the core ACPI device enumeration code
  (one of which has been introduced recently), improve the primary
  "physical" device lookup for ACPI device objects in that code, and
  update ACPI device drivers:

   - Update MAINTAINERS, CREDITS and ACPI subsystem documentation to
     reflect recent changes in the upstream ACPICA project (Rafael
     Wysocki)

   - Prevent the core ACPI enumeration code from combining device
     resources that overlap completely in order to avoid resource
     conflicts during platform device registration because there are
     drivers that expect such resources to be present (Rafael Wysocki)

   - Defer device power initialization during ACPI-based device
     enumeration to the point when the given device is known to be
     present and functional and all of its dependencies have been met
     (Peixin Xie)

   - Fix bus ID cleanup on device_add() failures during ACPI device
     object registration (Hongyan Xu)

   - Introduce a new helper function for looking up the primary
     "physical" device for a given ACPI device object and update the
     core ACPI device enumeration code to use that function (Rafael
     Wysocki)

   - Protect all battery properties with a separated mutex in the ACPI
     battery driver to prevent race conditions from occurring and avoid
     evaluating the _BST ACPI control method multiple times in parallel
     for the same battery device (Rong Zhang)

   - Add DMI quirk for the Razer Blade Pro 17 early 2020 lid switch to
     the ACPI button driver (Robin Everaars)

   - Convert fixed clock rates in the ACPI driver for AMD SoCs (APD) to
     use HZ_PER_MHZ and add a clock frequency for the HJMC01 I2C
     controller to it (Hongnan Li and Xiangyang Yu)

   - Fix a stack buffer overflow in query_capability() in the ACPI
     platform firmware runtime update driver (Anirudh Prasad)"

* tag 'acpi-7.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: button: Add DMI quirk for Razer Blade Pro 17 early 2020 lid switch
  ACPI: scan: Do not combine resources that overlap completely
  ACPI: Update upstream ACPICA repository URL in documentation
  ACPI: Update MAINTAINERS entry for ACPICA
  ACPI: Add Bob Moore to CREDITS
  ACPI: pfr_update: fix stack buffer overflow in query_capability()
  ACPI: scan: Defer device power initialization
  ACPI: APD: Add clock frequency for HJMC01 I2C controller
  ACPI: APD: Convert fixed clock rates to use HZ_PER_MHZ
  ACPI: scan: Use acpi_bus_get_primary_device()
  ACPI: platform: Use acpi_bus_get_primary_device()
  ACPI: bus: Introduce acpi_bus_get_primary_device()
  ACPI: scan: fix bus ID cleanup on device_add() failures
  ACPI: battery: Protect all properties with a separated mutex
2026-08-26 14:06:08 -07:00
Rafael J. Wysocki
bbc981bd54 Merge branch 'acpi-bus'
Merge changes related to primary "physical" device lookup for a given
ACPI device object that include the introduction of a new lookup helper
function and core ACPI device enumeration code updates putting that new
function to use (Rafael Wysocki)

* acpi-bus:
  ACPI: scan: Use acpi_bus_get_primary_device()
  ACPI: platform: Use acpi_bus_get_primary_device()
  ACPI: bus: Introduce acpi_bus_get_primary_device()
2026-08-26 19:22:52 +02:00
Linus Torvalds
59e6295fac Driver core changes for 7.3-rc1
- container_of:
 
   - Apply typeof_member(), remove the local __mptr variable to eliminate
     variable shadowing warnings on nested container_of() calls, and remove
     unnecessary parentheses.
 
 - core:
 
   - Add driver name to probe debug print for initcall_debug.
 
   - Avoid repeatedly printing the same 'Fixed dependency cycle' log.
 
   - Unwind device_add() on attribute creation failure in
     attribute_container_add_class_device().
 
   - Remove statistics group if encryption group creation fails in
     transport_add_class_device().
 
 - debugfs:
 
   - Fix lockdown check for mmap_prepare().
 
   - Warn if file creation failed due to uninitialized debugfs.
 
 - device property:
 
   - Implement fw_devlink support for software nodes by adding
     software_node_add_links(), which creates fwnode links from DEV_PROP_REF
     properties to enable automatic probe ordering. Add kunit-managed fwnode
     helpers and test coverage.
 
   - Fix infinite loop in fwnode_for_each_child_node() when the secondary fwnode
     has more than one child. Add test cases.
 
   - Fix out-of-bounds access in software_node_get_reference_args() when called
     with index -1 (UINT_MAX).
 
   - Refactor to use RAII approach with __free().
 
   - Add Bartosz Golaszewski as software node reviewer.
 
 - firmware loader:
 
   - Fix race where a sysfs fallback request can complete before being queued as
     pending, leading to a use-after-free on the next fallback request.
 
   - Reject 0-size built-in firmware and fail the build on empty firmware files
     in CONFIG_EXTRA_FIRMWARE.
 
 - kobject:
 
   - Provide __KOBJ_ATTR() and __KOBJ_ATTR_RO/WO() initialization macros and
     allow the constification of kobject attributes, enabling them to reside in
     read-only memory.
 
 - platform:
 
   - Provide platform_device_set_of_node(), platform_device_set_fwnode(), and
     platform_device_set_of_node_from_dev() helpers that encapsulate firmware
     node reference counting for dynamically allocated platform devices. Convert
     all in-tree users that manually assigned dev.of_node or dev.fwnode, fixing a
     pre-existing refcount bug in powermac.  Switch to counting references of all
     firmware node types, not only OF nodes.
 
   - Unify the release path for dynamically allocated platform devices by
     removing platform_device_release_full(). Amend the fwnode setter API
     contract to warn if a primary software node is overwritten. Add KUnit tests
     for correct software node removal on device unregistration.
 
 - Rust:
 
   - Auxiliary:
 
     - Add registration_data_with() closure-based API for invariant ForLt types.
 
   - Debugfs:
 
     - Migrate BinaryWriter and BinaryReaderMut trait requirements from
       kernel::transmute traits to zerocopy traits.
 
   - Device:
 
     - Add BoundInternal device context and InternalBoundContext trait for bus
       abstractions that need internal access to a bound device.
 
     - Make the lifetime on Core and CoreInternal invariant to prevent coercion
       to shorter lifetimes.
 
   - Devres:
 
     - Fix race between concurrent revokers where the losing revoker could return
       before the winning revoker finished dropping the inner data, causing
       use-after-free.
 
     - Ensure revocation is complete before the device finishes unbinding by
       making the synchronization bidirectional.
 
     - Add DevresLt<F: ForLt>, a wrapper around Devres that shortens 'static back
       to the caller's borrow scope. Implement ForLt and CovariantForLt for Bar,
       IoMem, and ExclusiveIoMem.
 
   - Driver:
 
     - Switch from index-based to pointer-based device ID info lookup, storing
       static references in driver_data. Centralize device ID handling in
       device_id.rs, removing the open-coded ACPI/OF matching logic and duplicate
       ID table from driver.rs.
 
   - I/O:
 
     - Make I/O regions typed (with a dynamically-sized Region type for the
       existing untyped case), create view types representing subregions of a
       mapped I/O region, and add io_project!() for safely creating subviews.
 
     - Split Io into a base trait (IoBase) and an extension trait (Io) with a
       blanket implementation, preventing implementers from overriding provided
       methods that unsafe code relies on.
 
     - Add a SysMem backend for shared system memory with volatile access, and
       make Coherent implement Io via an I/O view type.  Add IoSysMap as sum type
       of Mmio and SysMem. Add copying methods (memcpy_{from,to}io()) and
       read_val()/write_val() for typed access.
 
     - Replace dma_read!()/dma_write!() with io_read!()/io_write!() for
       primitives and copying methods for aggregates; drop the old macros.
       Convert nova-core to use I/O projection.
 
     - Fix internal shortcut rule dispatch in the register!() macro, remove
       unused rule arguments, and use path fragments for alias destinations.
 
   - IRQ:
 
     - Make irq::Registration compatible with lifetime-bound drivers by
       removing the 'static bound on Handler/ThreadedHandler and
       replacing Devres<RegistrationInner> with direct
       request_irq()/free_irq() calls.  Handlers can now directly own
       lifetime-bound device resources.
 
   - PCI:
 
     - Convert IrqVectorRegistration to a lifetime-annotated owning type,
       giving drivers explicit control over the allocation lifetime.
       IrqVector embeds a resolved IrqRequest, making the conversion
       infallible. Remove the redundant
       request_irq()/request_threaded_irq() wrappers from pci::Device.
 
     - Add pci_irq_type() C helper and expose it via irq_type() on
       IrqVectorRegistration and IrqVector, returning PCI_IRQ_MSIX, PCI_IRQ_MSI,
       or PCI_IRQ_INTX.
 
     - Mark pci::Device refcount methods inline.
 
   - Serdev:
 
     - Add Rust abstractions for the serial device bus, including serdev::Driver
       trait, serdev::Device wrapping struct serdev_device, and serdev::Adapter
       implementing RegistrationOps.  Includes a sample driver. Markus Probst
       takes over as serdev maintainer for both C and Rust code.
 
   - Misc:
 
     - Split ForLt into a base trait (providing the Of<'a> GAT) and an unsafe
       CovariantForLt subtrait guaranteeing covariance, enabling invariant types
       (e.g. those containing Mutex<&'bound T>) to participate in the ForLt
       abstraction.
 
     - Fix Coherent read past EOF returning -ERANGE instead of zero.
 
     - Fix firmware example UB by avoiding null-pointer ARef.
 
 - misc:
 
   - Avoid iattr allocation in kernfs listxattr by using kernfs_iattrs_noalloc().
   - Unregister SoC bus on early device registration failure.
   - Remove unused DMA_FENCE_TRACE Kconfig symbol.
   - Fix /sys/module path in comment.
   - Refactor ISA bus init to remove nested blocks.
   - Remove redundant nodemask clears in numa_init().
   - Add kernel-doc for fwnode_operations and sys_soc.h, mark internal property
     data as private for kernel-doc, and add property.h/fwnode.h to driver-api
     infrastructure docs.
   - Add MAINTAINERS entry for sys_soc.h.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCaoSPugAKCRBFlHeO1qrK
 LlBrAP958EaYZVyfAsqq0EyHv86ahXKWoDDvkwbRUZA5CfV9tAD/bMWVtPLRYaaq
 eNEZT7p5w3Haezh61H3c5zpuwFNMTA0=
 =VRIa
 -----END PGP SIGNATURE-----

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

Pull driver core updates from Danilo Krummrich:
 "container_of:

   - Apply typeof_member(), remove the local __mptr variable to
     eliminate variable shadowing warnings on nested container_of()
     calls, and remove unnecessary parentheses

  core:

   - Add driver name to probe debug print for initcall_debug

   - Avoid repeatedly printing the same 'Fixed dependency cycle' log

   - Unwind device_add() on attribute creation failure in
     attribute_container_add_class_device()

   - Remove statistics group if encryption group creation fails in
     transport_add_class_device()

  debugfs:

   - Fix lockdown check for mmap_prepare()

   - Warn if file creation failed due to uninitialized debugfs

  device property:

   - Implement fw_devlink support for software nodes by adding
     software_node_add_links(), which creates fwnode links from
     DEV_PROP_REF properties to enable automatic probe ordering. Add
     kunit-managed fwnode helpers and test coverage

   - Fix infinite loop in fwnode_for_each_child_node() when the
     secondary fwnode has more than one child. Add test cases

   - Fix out-of-bounds access in software_node_get_reference_args() when
     called with index -1 (UINT_MAX)

   - Refactor to use RAII approach with __free()

   - Add Bartosz Golaszewski as software node reviewer

  firmware loader:

   - Fix race where a sysfs fallback request can complete before being
     queued as pending, leading to a use-after-free on the next fallback
     request

   - Reject 0-size built-in firmware and fail the build on empty
     firmware files in CONFIG_EXTRA_FIRMWARE

  kobject:

   - Provide __KOBJ_ATTR() and __KOBJ_ATTR_RO/WO() initialization macros
     and allow the constification of kobject attributes, enabling them
     to reside in read-only memory

  platform:

   - Provide platform_device_set_of_node(), platform_device_set_fwnode(),
     and platform_device_set_of_node_from_dev() helpers that encapsulate
     firmware node reference counting for dynamically allocated platform
     devices

     Convert all in-tree users that manually assigned dev.of_node or
     dev.fwnode, fixing a pre-existing refcount bug in powermac. Switch
     to counting references of all firmware node types, not only OF
     nodes

   - Unify the release path for dynamically allocated platform devices
     by removing platform_device_release_full(). Amend the fwnode setter
     API contract to warn if a primary software node is overwritten. Add
     KUnit tests for correct software node removal on device
     unregistration

  Rust:

   - Auxiliary:
       - Add registration_data_with() closure-based API for invariant
         ForLt types

   - Debugfs:
       - Migrate BinaryWriter and BinaryReaderMut trait requirements
         from kernel::transmute traits to zerocopy traits

   - Device:
       - Add BoundInternal device context and InternalBoundContext trait
         for bus abstractions that need internal access to a bound
         device.
       - Make the lifetime on Core and CoreInternal invariant to prevent
         coercion to shorter lifetimes

   - Devres:
       - Fix race between concurrent revokers where the losing revoker
         could return before the winning revoker finished dropping the
         inner data, causing use-after-free.
       - Ensure revocation is complete before the device finishes
         unbinding by making the synchronization bidirectional.
       - Add DevresLt<F: ForLt>, a wrapper around Devres that shortens
         'static back to the caller's borrow scope. Implement ForLt and
         CovariantForLt for Bar, IoMem, and ExclusiveIoMem

   - Driver:
       - Switch from index-based to pointer-based device ID info lookup,
         storing static references in driver_data. Centralize device ID
         handling in device_id.rs, removing the open-coded ACPI/OF
         matching logic and duplicate ID table from driver.rs

   - I/O:
       - Make I/O regions typed (with a dynamically-sized Region type
         for the existing untyped case), create view types representing
         subregions of a mapped I/O region, and add io_project!() for
         safely creating subviews.
       - Split Io into a base trait (IoBase) and an extension trait (Io)
         with a blanket implementation, preventing implementers from
         overriding provided methods that unsafe code relies on.
       - Add a SysMem backend for shared system memory with volatile
         access, and make Coherent implement Io via an I/O view type.
         Add IoSysMap as sum type of Mmio and SysMem. Add copying
         methods (memcpy_{from,to}io()) and read_val()/write_val() for
         typed access.
       - Replace dma_read!()/dma_write!() with io_read!()/io_write!()
         for primitives and copying methods for aggregates; drop the old
         macros. Convert nova-core to use I/O projection.
       - Fix internal shortcut rule dispatch in the register!() macro,
         remove unused rule arguments, and use path fragments for alias
         destinations

   - IRQ:
       - Make irq::Registration compatible with lifetime-bound drivers
         by removing the 'static bound on Handler/ThreadedHandler and
         replacing Devres<RegistrationInner> with direct
         request_irq()/free_irq() calls. Handlers can now directly own
         lifetime-bound device resources

   - PCI:
       - Convert IrqVectorRegistration to a lifetime-annotated owning
         type, giving drivers explicit control over the allocation
         lifetime. IrqVector embeds a resolved IrqRequest, making the
         conversion infallible. Remove the redundant
         request_irq()/request_threaded_irq() wrappers from pci::Device.
       - Add pci_irq_type() C helper and expose it via irq_type() on
         IrqVectorRegistration and IrqVector, returning PCI_IRQ_MSIX,
         PCI_IRQ_MSI, or PCI_IRQ_INTX.
       - Mark pci::Device refcount methods inline

   - Serdev:
       - Add Rust abstractions for the serial device bus, including
         serdev::Driver trait, serdev::Device wrapping struct
         serdev_device, and serdev::Adapter implementing
         RegistrationOps. Includes a sample driver. Markus Probst takes
         over as serdev maintainer for both C and Rust code

   - Misc:
       - Split ForLt into a base trait (providing the Of<'a> GAT) and an
         unsafe CovariantForLt subtrait guaranteeing covariance,
         enabling invariant types (e.g. those containing Mutex<&'bound T>)
         to participate in the ForLt abstraction.
       - Fix Coherent read past EOF returning -ERANGE instead of zero.
       - Fix firmware example UB by avoiding null-pointer ARef

  misc:
   - Avoid iattr allocation in kernfs listxattr by using
     kernfs_iattrs_noalloc().
   - Unregister SoC bus on early device registration failure.
   - Remove unused DMA_FENCE_TRACE Kconfig symbol.
   - Fix /sys/module path in comment.
   - Refactor ISA bus init to remove nested blocks.
   - Remove redundant nodemask clears in numa_init().
   - Add kernel-doc for fwnode_operations and sys_soc.h, mark
     internal property data as private for kernel-doc, and add
     property.h/fwnode.h to driver-api infrastructure docs.
   - Add MAINTAINERS entry for sys_soc.h"

* tag 'driver-core-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: (129 commits)
  rust: pci: expose the allocated interrupt type
  PCI: Add pci_irq_type() to query the allocated interrupt type
  rust: pci: remove request_irq() and request_threaded_irq() from Device
  rust: pci: resolve IRQ in index() and embed IrqRequest in IrqVector
  rust: pci: convert IrqVectorRegistration to a lifetime-managed owning type
  kernfs: avoid iattr allocation in listxattr
  rust: serdev: use ThisModule::as_ptr() instead of field access
  ACPI/IORT: use platform_device_set_fwnode()
  ACPI/APMT: use platform_device_set_fwnode()
  firmware_loader: do not queue completed sysfs fallback requests
  rust: pci: Mark Device refcount methods inline
  rust: irq: make Registration compatible with lifetime-bound drivers
  rust: net/phy: remove expansion from doc
  rust: dma: return zero for Coherent reads past EOF
  rust: io: register: use path fragment for alias destination
  rust: io: register: remove unused rule arguments
  rust: io: register: dispatch shortcut rules internally
  MAINTAINERS: add sys_soc.h to DRIVER CORE
  rust: debugfs: remove unsafe blocks from traits impl for Vec
  rust: debugfs: migrate debugfs traits requirements to zerocopy
  ...
2026-08-19 10:42:18 -07:00
Linus Torvalds
85cdaca697 arm64 updates for 7.3
ACPI:
 - Combine reads of AMU counters into a single FFH feedback counter op.
 
 Confidential computing:
 - Fix smp_processor_id() in preemptible context when retrieving an
   attestation token inside a realm.
 
 - Convert pKVM over to a "CC platform".
 
 - Clean-up our SWIOTLB configuration in preparation for reworking the
   handling of encrypted/decryped DMA buffers in the dma-mapping tree.
 
 CPU errata handling:
 - Work around broken device memory ordering on NVIDIA Olympus cores.
 
 - Fix broken 'nospectre_bhb' command-line option.
 
 - Select the idle loop backend instruction on the command-line.
 
 CPU features:
 - Replace our BBML2-noabort feature with the new architectural BBML3
   feature.
 
 - Disable in-kernel BTI for recent versions of Clang due to issues with
   livepatch that are still being investigated.
 
 - Clean-up documentation describing which ID register fields are exposed
   to userspace.
 
 Interrupts:
 - Preliminary work towards supporting FEAT_NMI, which cleans up our
   IRQ entry code and fixes some latent issues with pseudo-NMI.
 
 - Support for an SDEI backend to trigger an NMI backtrace.
 
 Memory management:
 - Treat all devices as coherent when CLIDR_EL1.LoC == 0.
 
 - Fix no-map handling of sub-page-sized regions.
 
 - Second attempt at unmapping the linear aliases of the kernel data and
   bss sections.
 
 - Fix EFI runtime calls when software-PAN is enabled.
 
 Miscellaneous:
 - Add Mark Rutland as a reviewer!
 
 - Tidy-up our futex cmpxchg logic when using the new LSUI instructions.
 
 - Drop the requirement on DYNAMIC_FTRACE_WITH_CALL_OPS when selecting
   HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS.
 
 - Fix a false-positive KCSCAN splat in the delay loop.
 
 - Use a portable typedef for 128-bit scalar types in our UAPI headers.
 
 - Non-critical fixes for Sashiko reports all over.
 
 MPAM:
 - Hook MPAM memory bandwidth counters into resctrl's counter assignment
   interface.
 
 - Fix a quirk in the MPAM bandwidth counting on Nvidia T241 so that it
   also applies to 63 bit counters.
 
 Perf:
 - Workarounds for hardware issues in the CMN-S3 PMU (Graviton 5) and CPU
   PMU (NVIDIA Olympus again!)
 
 - Add support for the DDR PMU on Marvell CN20K SoCs.
 
 - Add support for Picoheart implementations of the DCW PCIe PMU.
 
 - Add support for Channel/Rank/Bank filtering in the CXL PMU driver.
 
 - Add support for 64-bit counters in the CSPMU device.
 
 - Add support for revision 2 of the CMN S3 PMU.
 
 Ptrace:
 - Fix a decade-old bug in our handling of seccomp and tracing on syscall
   entry.
 
 - Fix regset handling for inactive SVE and SSVE registers.
 
 Selftests
 - Add some tests for the decade-old bug that we just tried to fix in our
   syscall entry path.
 
 - Fix SVE test crash on SME-only CPUs.
 -----BEGIN PGP SIGNATURE-----
 
 iQFEBAABCgAuFiEEPxTL6PPUbjXGY88ct6xw3ITBYzQFAmp+9HkQHHdpbGxAa2Vy
 bmVsLm9yZwAKCRC3rHDchMFjNEjXB/4y8KueLwgMOcpjzJom6ujmE2Ab7IOI+I5v
 rYQkGDdHLcQd0WW9gtFXoxlq/EUcWuVCGAdOF3PxkUmVhHJC45ZNSmBGS9/LbU3f
 AqeFskSE46D2gOdMXSscwGAQ+OiQ6WlSSgqy2dU1ZfTXy7ioxydWVUtvmqMmB85O
 ctN9Ocr3zAZuptuyLJurCJNnyCuzd55SIuy+WKU6NIpWseiIqiLEb/6HFbWcw6iV
 vVZjD/Je5my8Gfjuu12z7kJ6o5jwGNpI8U7Z0b68ESUG3b5fh9E2zVLIq0fvn83B
 rjPqg/Wj2TVGag/+yZgafLwQ/7111hhkdf1bPBitClx4GxOoZEjG
 =Iypw
 -----END PGP SIGNATURE-----

Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 updates from Will Deacon:
 "There's a reasonable amount of stuff here, including a bunch of
  updates to the perf PMU drivers and some MPAM updates to expose the
  memory bandwidth counters via resctrl.

  On the architecture side, some highlights include support for BBML3
  and steps towards support for an architectural NMI solution, all
  wrapped up in a web of fixes for latent issues identified by Sashiko.

  ACPI:

   - Combine reads of AMU counters into a single FFH feedback counter op

  Confidential computing:

   - Fix smp_processor_id() in preemptible context when retrieving an
     attestation token inside a realm

   - Convert pKVM over to a "CC platform"

   - Clean-up our SWIOTLB configuration in preparation for reworking the
     handling of encrypted/decryped DMA buffers in the dma-mapping tree

  CPU errata handling:

   - Work around broken device memory ordering on NVIDIA Olympus cores

   - Fix broken 'nospectre_bhb' command-line option

   - Select the idle loop backend instruction on the command-line

  CPU features:

   - Replace our BBML2-noabort feature with the new architectural BBML3
     feature

   - Disable in-kernel BTI for recent versions of Clang due to issues
     with livepatch that are still being investigated

   - Clean-up documentation describing which ID register fields are
     exposed to userspace

  Interrupts:

   - Preliminary work towards supporting FEAT_NMI, which cleans up our
     IRQ entry code and fixes some latent issues with pseudo-NMI

   - Support for an SDEI backend to trigger an NMI backtrace

  Memory management:

   - Treat all devices as coherent when CLIDR_EL1.LoC == 0

   - Fix no-map handling of sub-page-sized regions

   - Second attempt at unmapping the linear aliases of the kernel data
     and bss sections

   - Fix EFI runtime calls when software-PAN is enabled

  Miscellaneous:

   - Add Mark Rutland as a reviewer!

   - Tidy-up our futex cmpxchg logic when using the new LSUI
     instructions

   - Drop the requirement on DYNAMIC_FTRACE_WITH_CALL_OPS when
     selecting HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS

   - Fix a false-positive KCSCAN splat in the delay loop

   - Use a portable typedef for 128-bit scalar types in our UAPI headers

   - Non-critical fixes for Sashiko reports all over

  MPAM:

   - Hook MPAM memory bandwidth counters into resctrl's counter
     assignment interface

   - Fix a quirk in the MPAM bandwidth counting on Nvidia T241 so that
     it also applies to 63 bit counters

  Perf:

   - Workarounds for hardware issues in the CMN-S3 PMU (Graviton 5) and
     CPU PMU (NVIDIA Olympus again!)

   - Add support for the DDR PMU on Marvell CN20K SoCs

   - Add support for Picoheart implementations of the DCW PCIe PMU

   - Add support for Channel/Rank/Bank filtering in the CXL PMU driver

   - Add support for 64-bit counters in the CSPMU device

   - Add support for revision 2 of the CMN S3 PMU

  Ptrace:

   - Fix a decade-old bug in our handling of seccomp and tracing on
     syscall entry

   - Fix regset handling for inactive SVE and SSVE registers

  Selftests

   - Add some tests for the decade-old bug that we just tried to fix in
     our syscall entry path

   - Fix SVE test crash on SME-only CPUs"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (95 commits)
  arm64/efi: Avoid voluntary preemption with efi_mm installed
  arm64: bti: Disable in-kernel BTI with recent versions of Clang
  arm64: entry: Avoid unnecessary local_irq_disable() on kernel exit
  irqchip/gic-v3: make the unmasking of pseudo-NMIs explicit when handling IRQs
  arm64: Disable KCSAN instrumentation in delay.o
  arm_mpam: Disable driver unbind to avoid UAF
  arm_mpam: Fix a NULL pointer dereference on unbinding after an error interrupt
  perf: arm_pmuv3: Zero initialize hw_id branch stack field
  arm64: mm: Unmap kernel data/bss entirely from the linear map
  iommu/arm-smmu-v3-sva: Use system_supports_bbml3() to detect CPU feature
  perf/arm-cmn: Support CMN S3 r2
  perf/arm-cmn: Plumb in new filter types
  perf/arm-cmn: Refactor event filter data
  perf/arm-cmn: Refactor event filter programming
  perf/arm-cmn: Rename filter variables for clarity
  arm64: mm: fix accidental linear mapping of no-map reserved memory
  tools: Ensure tools copy of linux/filter.h exports the UAPI
  kselftest/arm64: Fix abi test compilation errors
  arch: arm64: add early_param idle=<wfi|yield|nop>
  arm64: entry: mask DAIF before returning from C EL1 handlers
  ...
2026-08-18 11:57:17 -07:00
Rafael J. Wysocki
72530e1f72 ACPI: bus: Introduce acpi_bus_get_primary_device()
The function used for obtaining the first "physical" device for which
the given ACPI one is the ACPI companion, acpi_get_first_physical_node(),
may return a stale device pointer (mostly in theory) because
acpi_unbind_one() may run as a whole after dropping the ACPI device's
physical_node_lock in acpi_get_first_physical_node() and before it
returns.  The last reference to the "physical" device may be dropped
then before the pointer to it is returned to the caller.

If that happens and the acpi_get_first_physical_node() caller invokes
get_device() on the pointer obtained from it, which is done by the
majority of its callers, a use-after-free will occur.

To prepare for addressing this problem, introduce a new function for
getting the first "physical" device associated with the given ACPI one
(the "primary physical device") that will also reference count the
device in question before returning a pointer to it.

Make that new function and acpi_get_first_physical_node() share the
physical node list lookup code.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/2843318.mvXUDI8C0e@rafael.j.wysocki
2026-08-14 21:49:41 +02:00
Rafael J. Wysocki
fba08739e9 Merge back ACPI bus type changes for 7.3 2026-08-14 21:48:40 +02:00
Rafael J. Wysocki
79a0aabd5d Merge branches 'acpi-scan', 'acpi-pci', 'acpi-tad' and 'acpi-apei'
Merge an ACPI device enumeration core code update, ACPI support updates
related to PCI, an ACPI Time and Alarm Device (TAD) driver update and
ACPI APEI updates for 7.3-rc1:

 - Avoid registering platform devices with resource overlaps in the ACPI
   core device enumeration code (Rafael Wysocki)

 - Clear driver_data on all paths that free acpi_pci_root in
   acpi_pci_root_add() (Chen Pei)

 - Simplify acpi_get_pci_dev() with the help of a mutex guard, introduce
   acpi_dev_get_pci_dev() for code that has a struct ACPI device for
   which it wants to get the struct pci_dev pointer of the associated
   PCI device, and use it in the ACPI video bus driver (Rafael Wysocki)

 - Avoid printing confusing _OSC messages for non-PCIe host bridges
   without _OSC which is a valid configuration (Kazuma Kondo)

 - Add locking around evaluation of ACPI control methods in the ACPI TAD
   driver to avoid race conditions (Rafael Wysocki)

 - Handle repeated SEA error storms in APEI (Junhao He)

 - Fix ERST timeout unit conversion in APEI (Nirmoy Das)

 - Fix ARM section length accounting after header in the ACPI APEI GHES
   driver (TanZheng)

 - Mark ghes_in_nmi_spool_from_list() as maybe unused (Rui Qi)

* acpi-scan:
  ACPI: scan: Avoid registering platform devices with resource overlaps

* acpi-pci:
  ACPI: PCI: Avoid misleading _OSC messages for non-PCIe host bridges without _OSC
  ACPI: video: Use acpi_dev_get_pci_dev() instead of acpi_get_pci_dev()
  ACPI: video: Drop backlight parent device reference later
  ACPI: PCI: Introduce acpi_dev_get_pci_dev()
  ACPI: PCI: Use a mutex guard to simplify acpi_get_pci_dev()
  ACPI: PCI: Clear driver_data on all paths that free the acpi_pci_root

* acpi-tad:
  ACPI: TAD: Add locking around AML evaluations

* acpi-apei:
  ACPI: APEI: Handle repeated SEA error storms
  ACPI: APEI: Fix ERST timeout unit conversion
  ACPI: APEI: GHES: fix ARM section length accounting after header
  ACPI: APEI: GHES: Mark ghes_in_nmi_spool_from_list() as maybe unused
2026-08-10 12:45:05 +02:00
Danilo Krummrich
dbaafe9cc5 Linux 7.2-rc7
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCgA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmp49yoeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiG1WIH/1SD1rNIb4Prf0C7
 Rk9Hz0IZ3uYNe1Xi+Ozv3zQUuLB6d7ewl9e4zyHHYT4eeIKvBZv9jtIF3QH4ty5X
 JB9Gy62WICtqIEkzzt2bkcV1byFmKz2+BLv04fgcyTXEGOEByCDiZ3/N3kSJOqvg
 YxsGOmKkQSTavFLSe96Gj2pgchJqZ6j3qucDO6GrPOo8depP2kfzxfaJbXix0HEZ
 ln08X9hgZDxy4I98PmSaaJsK2R/i6T6jQdA3i8DnSbbyNhLn+3FK6gkP08ZEpaor
 82WwJf+MVCLHXLYDy0aYOUDHpkNkkJWOj45A2Hv9JkOupGcUpyPGr82l4yh/MrxC
 +kM28xs=
 =rIbd
 -----END PGP SIGNATURE-----

Merge tag 'v7.2-rc7' into driver-core-next

We need the driver-core fixes in here as well to build on top of.

Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-08-10 01:20:05 +02:00
Rafael J. Wysocki
f6ac045369 Merge branches 'acpi-bus', 'acpi-sysfs', 'acpi-tables' and 'acpi-driver'
Merge ACPI bus type code updates, ACPI sysfs code updates related to
exposing table data, updates of ACPI data-only table parsers and
assorted driver changes related to ACPI support for 7.3-rc1:

 - Eliminate struct acpi_driver whose users have all been converted to
   bind to platform devices or auxiliary devices and set the "no power
   management" flag for all struct acpi_device objects (Rafael Wysocki)

 - Update kerneldoc comments of two structures in the ACPI bus type code
   to use correct struct member names to avoid warnings (Randy Dunlap)

 - Avoid complaints regarding missing _OSC features on platforms where
   OSC_CAPABILITIES_MASK_ERROR is set in _OSC error bits even though all
   of the requested features are actually acknowledged (Rafael Wysocki)

 - Use correct region struct for BERT region size check and properly
   map BERT and CCEL data to their ACPI tables (Thomas Renninger)

 - Clean up the list of included header files in the NHLT table parser
   and validate the table and record lengths in the FPDT parser (Andy
   Shevchenko and Pengpeng Hou)

 - Stop using acpi_device_name() in the PNP core, stop setting
   acpi_device_name/class() in the Xen variant of the ACPI PAD
   (Processor Aggregator Device) driver, and make the Loongarch
   laptop driver stop setting acpi_device_class() (Rafael Wysocki)

* acpi-bus:
  ACPI: bus: Avoid confusing complaints regarding missing _OSC features
  ACPI: bus: Use correct struct member names
  ACPI: scan: Set power.no_pm for all struct acpi_device objects
  ACPI: bus: Eliminate struct acpi_driver

* acpi-sysfs:
  ACPI: sysfs: Properly map BERT and CCEL data to their ACPI tables
  ACPI: Use correct region struct for BERT region size check

* acpi-tables:
  ACPI: NHLT: Remove always included kconfig.h
  ACPI: FPDT: validate table and record lengths

* acpi-driver:
  PNP: ACPI: Stop using acpi_device_name()
  ACPI: PAD: xen: Stop setting acpi_device_name/class()
  platform/loongarch: laptop: Stop setting acpi_device_class()
2026-08-07 17:58:05 +02:00
Christian Loehle
9c5ab33a6d ACPI: CPPC: Avoid locking standalone full-width registers
cpc_write() serializes every SystemMemory write with the per-CPU
rmw_lock. The lock is required for read-modify-write fields and for
registers whose access units overlap, but not for a full-width register
in a standalone access unit.

The _CPC layout is immutable after it has been parsed. Classify each
SystemMemory register at probe time and retain locking for partial
fields, invalid access widths, and overlapping access units. Allow
standalone full-width registers to bypass the descriptor lookup and
spinlock.

Store the classification in existing structure padding so that struct
cpc_register_resource does not grow.

Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/20260803210527.1285229-3-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-08-05 15:09:45 +02:00
Gary Guo
2c5d17cdc4 rust: driver: remove open-coded matching logic
With device ID info now including pointers instead of indices, the
open-coded ACPI/OF matching is no longer needed and can be replaced with
`device_get_match_data`.

With the removal of open-coded matching, the exposed functions and helpers
are also removed; this effectively reverts most of commit 2690d07158
("rust: ACPI: fix missing match data for PRP0001").

Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20260629-id_info-v2-9-56fccbe9c5ef@garyguo.net
[ Consider the serdev code merged in the meantime. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-30 22:50:15 +02:00
Pengjie Zhang
9aa7df5205 ACPI: CPPC: add paired FFH feedback-counter read hook
cppc_get_perf_ctrs() reads the delivered and reference performance
counters one at a time.

Allow architectures to provide both FFH feedback counters in one
operation when that either narrows the sampling window or avoids extra
cross-CPU reads. Add a small FFH-specific hook for that case and fall
back to the existing per-register reads when unsupported.

Tested-by: Sumit Gupta <sumitg@nvidia.com>
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
Tested-by: Vanshidhar Konda <vanshikonda@os.amperecomputing.com>
Reviewed-by: Vanshidhar Konda <vanshikonda@os.amperecomputing.com>
Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com>
Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Tested-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
2026-07-22 20:01:23 +00:00
Christian Loehle
11055a46f3 ACPI: CPPC: Check all controls for fast switching
ACPI 6.2, Section 6.2.11.2 permits _CPC registers to use flexible
address spaces. Linux advertises that capability through _OSC and parses
the address space of each _CPC register independently. A directly
accessible DESIRED_PERF combined with PCC-backed limits is therefore a
valid configuration.

cppc_allow_fast_switch() only checks DESIRED_PERF, although the fast-switch
callback passes DESIRED_PERF, MIN_PERF and MAX_PERF to cppc_set_perf(). If
a limit uses PCC, that function can sleep while called from scheduler
context.

Allow fast switching only when every supported control used by the
callback has an address space already accepted for fast access. Check the
complete policy domain, including initialized CPUs that are currently
offline and may later become the policy's managing CPU.

Fixes: 658fa7b1c4 ("ACPI: CPPC: Add cppc_get_perf() API to read performance controls")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/20260722093825.1030594-2-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-07-22 15:09:14 +02:00
Randy Dunlap
3b0eb670f3 ACPI: bus: Use correct struct member names
Avoid kernel-doc warnings by using the correct struct member names:

Warning: ./include/acpi/acpi_bus.h:429 struct member 'crs_csi2_local' not described in 'acpi_device_software_node_port'
Warning: ./include/acpi/acpi_bus.h:429 Excess struct member 'crs_crs2_local' description in 'acpi_device_software_node_port'
Warning: ./include/acpi/acpi_bus.h:445 struct member 'nodeptrs' not described in 'acpi_device_software_nodes'
Warning: ./include/acpi/acpi_bus.h:445 Excess struct member 'nodeprts' description in 'acpi_device_software_nodes'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://patch.msgid.link/20260720032341.3087008-2-rdunlap@infradead.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-07-21 23:02:31 +02:00
Andy Shevchenko
4eff1be926 ACPI: NHLT: Remove always included kconfig.h
The inclusion of <linux/kconfig.h> is unneeded as it's guaranteed by
the build starting from the commit 2a11c8ea20 ("kconfig: Introduce
IS_ENABLED(), IS_BUILTIN() and IS_MODULE()"). Remove it here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260717171635.1783543-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-07-21 21:27:23 +02:00
Rafael J. Wysocki
9d4f0ecb87 ACPI: PCI: Introduce acpi_dev_get_pci_dev()
Some acpi_get_pci_dev() callers already have a struct ACPI device for
which they want to get the struct pci_dev pointer of the associated
PCI device, so they don't need to look for one.

For this reason, add acpi_dev_get_pci_dev() that will get a PCI device
for a given ACPI one (if possible) and turn acpi_get_pci_dev() into
a static inline helper passing the acpi_fetch_acpi_dev() return value
directly to acpi_dev_get_pci_dev().

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/3430928.44csPzL39Z@rafael.j.wysocki
2026-07-21 16:59:46 +02:00
Rafael J. Wysocki
541b293ab1 ACPI: bus: Eliminate struct acpi_driver
Now that struct acpi_driver has no more users, eliminate it along with
all of the code related to it.

Also remove the file added by commit b8c8a8ea18 ("ACPI: Documentation:
driver-api: Disapprove of using ACPI drivers") because it will not be
necessary any more after eliminating struct acpi_driver from the code.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/5132944.31r3eYUQgx@rafael.j.wysocki
2026-07-06 13:31:50 +02:00
Rafael J. Wysocki
9825cf2cb5 ACPICA: Define acpi_ut_safe_strncpy() as strscpy_pad() alias
Commit 292db66afd ("ACPICA: Unbreak tools build after switching over
to strscpy_pad()") added an #ifdef based on a __KERNEL__ check which is
sort of nasty to the acpi_ut_safe_strncpy() definition to unbreak ACPICA
tools builds broken by commit 97f7d3f9c9 ("ACPICA: Replace strncpy()
with strscpy_pad() in acpi_ut_safe_strncpy()").  However, that #ifdef
effectively produces dead code when tools are built because they don't
call acpi_ut_safe_strncpy().

Accordingly, drop the existing definition of acpi_ut_safe_strncpy() and
define it as a strscpy_pad() alias.

Fixes: 292db66afd ("ACPICA: Unbreak tools build after switching over to strscpy_pad()")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ rjw: Tweak the changelog ]
Link: https://patch.msgid.link/12941764.O9o76ZdvQC@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-07-01 12:29:24 +02:00
Linus Torvalds
36808d5e98 Driver core changes for 7.2-rc1
- deferred probe:
   - Fix race where deferred probe timeout work could be permanently
     canceled by using mod_delayed_work()
   - Fix missing jiffies conversion in deferred_probe_extend_timeout()
   - Guard timeout extension with delayed_work_pending() to prevent
     premature firing
   - Use system_percpu_wq instead of the deprecated system_wq
   - Update deferred_probe_timeout documentation
 
 - device:
   - Replace direct struct device bitfield access (can_match, dma_iommu,
     dma_skip_sync, dma_ops_bypass, state_synced, dma_coherent,
     of_node_reused, offline, offline_disabled) with flag-based
     accessors using bit operations
   - Reject devices with unregistered buses
   - Delete unused DEVICE_ATTR_PREALLOC()
   - Add low-level device attribute macros with const show/store
     callbacks, allowing device attributes to reside in read-only memory
   - Move core device attributes to read-only memory
   - Constify group array pointers in driver_add_groups() /
     driver_remove_groups(), struct bus_type, and struct device_driver
 
 - device property:
   - Fix fwnode reference leak in fwnode_graph_get_endpoint_by_id()
   - Initialize all fields of fwnode_handle in fwnode_init()
   - Provide swnode_get()/swnode_put() wrappers around kobject_get/put()
   - Allow passing struct software_node_ref_args pointers directly to
     PROPERTY_ENTRY_REF()
 
 - driver_override:
   - Migrate amba, cdx, vmbus, and rpmsg to the generic driver_override
     infrastructure, fixing a UAF from unsynchronized access to
     driver_override in bus match() callbacks
   - Remove the now-unused driver_set_override()
 
 - firmware loader:
   - Fix recursive lock deadlock in device_cache_fw_images() when async
     work falls back to synchronous execution
   - Fix device reference leak in firmware_upload_register()
 
 - platform:
   - Pass KBUILD_MODNAME through the platform driver registration macro
     to create module symlinks in sysfs for built-in drivers; move
     module_kset initialization to a pure_initcall and tegra cbb
     registration to core_initcall to ensure correct ordering
   - Pass THIS_MODULE implicitly through a coresight_init_driver() macro
 
 - sysfs:
   - Upgrade OOB write detection in sysfs_kf_seq_show() from printk to
     WARN
   - Add return value clamping to sysfs_kf_read()
 
 - Rust:
   - ACPI:
     - Fix missing match data for PRP0001 by exporting
       acpi_of_match_device()
 
   - Auxiliary:
     - Replace drvdata() with dedicated registration data on
       auxiliary_device. drvdata() exposed the driver's bus device
       private data beyond the driver's own scope, creating ordering
       constraints and forcing the data to outlive all registrations
       that access it. Registration data is instead scoped structurally
       to the Registration object, making lifecycle ordering enforced
       by construction rather than convention.
 
   - Rust-native device driver lifetimes (HRT):
     - Allow Rust device drivers to carry a lifetime parameter on their
       bus device private data, tied to the device binding scope -- the
       interval during which a bus device is bound to a driver. Device
       resources like pci::Bar<'a> and IoMem<'a> can be stored directly
       in the driver's bus device private data with a lifetime bounded
       by the binding scope, so the compiler enforces at build time that
       they do not outlive the binding. This removes Devres indirection
       from every access site and eliminates try_access() failure paths
       in destructors.
 
       Bus driver traits use a Generic Associated Type (GAT)
       Data<'bound> to introduce the lifetime on the private data,
       rather than parameterizing the Driver trait itself. Auxiliary
       registration data, where the lifetime is not introduced by a
       trait callback but must be threaded through Registration, uses
       the ForLt trait (a type-level abstraction for types generic over
       a lifetime).
 
 - Misc:
   - Fix DT overlayed devices not probing by reverting the broken
     treewide overlay fix and re-running fw_devlink consumer pickup when
     an overlay is applied to a bound device
   - Use root_device_register() for faux bus root device; add sanity
     check for failed bus init
   - Fix dev_has_sync_state() data race with READ_ONCE() and move it to
     base.h
   - Avoid spurious device_links warning when removing a device while
     its supplier is unbinding
   - Switch ISA bus to dynamic root device
   - Fix suspicious RCU usage in kernfs_put()
   - Remove devcoredump exit callback
   - Constify devfreq_event_class
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCai1lNQAKCRBFlHeO1qrK
 LjX1AP4kEb6SJdvBFlG/IJcG9vyqA7+Cig8OIlx9vEX7e7GvNwEAxL2HltAlAd5Q
 cOIJOlu0uM+j1mn0JyuM9b0WJrxDLAA=
 =E5mG
 -----END PGP SIGNATURE-----

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

Pull driver core updates from Danilo Krummrich:
 "Deferred probe:
   - Fix race where deferred probe timeout work could be permanently
     canceled by using mod_delayed_work()
   - Fix missing jiffies conversion in deferred_probe_extend_timeout()
   - Guard timeout extension with delayed_work_pending() to prevent
     premature firing
   - Use system_percpu_wq instead of the deprecated system_wq
   - Update deferred_probe_timeout documentation

  device:
   - Replace direct struct device bitfield access (can_match, dma_iommu,
     dma_skip_sync, dma_ops_bypass, state_synced, dma_coherent,
     of_node_reused, offline, offline_disabled) with flag-based
     accessors using bit operations
   - Reject devices with unregistered buses
   - Delete unused DEVICE_ATTR_PREALLOC()
   - Add low-level device attribute macros with const show/store
     callbacks, allowing device attributes to reside in read-only memory
   - Move core device attributes to read-only memory
   - Constify group array pointers in driver_add_groups() /
     driver_remove_groups(), struct bus_type, and struct device_driver

  device property:
   - Fix fwnode reference leak in fwnode_graph_get_endpoint_by_id()
   - Initialize all fields of fwnode_handle in fwnode_init()
   - Provide swnode_get()/swnode_put() wrappers around kobject_get/put()
   - Allow passing struct software_node_ref_args pointers directly to
     PROPERTY_ENTRY_REF()

  driver_override:
   - Migrate amba, cdx, vmbus, and rpmsg to the generic driver_override
     infrastructure, fixing a UAF from unsynchronized access to
     driver_override in bus match() callbacks
   - Remove the now-unused driver_set_override()

  firmware loader:
   - Fix recursive lock deadlock in device_cache_fw_images() when async
     work falls back to synchronous execution
   - Fix device reference leak in firmware_upload_register()

  platform:
   - Pass KBUILD_MODNAME through the platform driver registration macro
     to create module symlinks in sysfs for built-in drivers; move
     module_kset initialization to a pure_initcall and tegra cbb
     registration to core_initcall to ensure correct ordering
   - Pass THIS_MODULE implicitly through a coresight_init_driver() macro

  sysfs:
   - Upgrade OOB write detection in sysfs_kf_seq_show() from printk to
     WARN
   - Add return value clamping to sysfs_kf_read()

  Rust:
   - ACPI:

     Fix missing match data for PRP0001 by exporting
     acpi_of_match_device()

   - Auxiliary:

     Replace drvdata() with dedicated registration data on
     auxiliary_device. drvdata() exposed the driver's bus device private
     data beyond the driver's own scope, creating ordering constraints
     and forcing the data to outlive all registrations that access it.
     Registration data is instead scoped structurally to the
     Registration object, making lifecycle ordering enforced by
     construction rather than convention.

   - Rust-native device driver lifetimes (HRT):

     Allow Rust device drivers to carry a lifetime parameter on their
     bus device private data, tied to the device binding scope -- the
     interval during which a bus device is bound to a driver. Device
     resources like pci::Bar<'a> and IoMem<'a> can be stored directly in
     the driver's bus device private data with a lifetime bounded by the
     binding scope, so the compiler enforces at build time that they do
     not outlive the binding. This removes Devres indirection from every
     access site and eliminates try_access() failure paths in
     destructors.

     Bus driver traits use a Generic Associated Type (GAT) Data<'bound>
     to introduce the lifetime on the private data, rather than
     parameterizing the Driver trait itself. Auxiliary registration
     data, where the lifetime is not introduced by a trait callback but
     must be threaded through Registration, uses the ForLt trait (a
     type-level abstraction for types generic over a lifetime).

  Misc:
   - Fix DT overlayed devices not probing by reverting the broken
     treewide overlay fix and re-running fw_devlink consumer pickup when
     an overlay is applied to a bound device
   - Use root_device_register() for faux bus root device; add sanity
     check for failed bus init
   - Fix dev_has_sync_state() data race with READ_ONCE() and move it to
     base.h
   - Avoid spurious device_links warning when removing a device while
     its supplier is unbinding
   - Switch ISA bus to dynamic root device
   - Fix suspicious RCU usage in kernfs_put()
   - Remove devcoredump exit callback
   - Constify devfreq_event_class"

* tag 'driver-core-7.2-rc1' of gitolite.kernel.org:pub/scm/linux/kernel/git/driver-core/driver-core: (81 commits)
  software node: allow passing reference args to PROPERTY_ENTRY_REF()
  driver core: platform: set mod_name in driver registration
  coresight: pass THIS_MODULE implicitly through a macro
  kernel: param: initialize module_kset in a pure_initcall
  soc/tegra: cbb: Move driver registration from pure_initcall to core_initcall
  firmware_loader: Fix recursive lock in device_cache_fw_images()
  driver core: Use system_percpu_wq instead of system_wq
  driver core: remove driver_set_override()
  rpmsg: use generic driver_override infrastructure
  Drivers: hv: vmbus: use generic driver_override infrastructure
  cdx: use generic driver_override infrastructure
  amba: use generic driver_override infrastructure
  rust: devres: add 'static bound to Devres<T>
  samples: rust: rust_driver_auxiliary: showcase lifetime-bound registration data
  rust: auxiliary: generalize Registration over ForLt
  rust: types: add `ForLt` trait for higher-ranked lifetime support
  gpu: nova-core: separate driver type from driver data
  samples: rust: rust_driver_pci: use HRT lifetime for Bar
  rust: io: make IoMem and ExclusiveIoMem lifetime-parameterized
  rust: pci: make Bar lifetime-parameterized
  ...
2026-06-15 12:41:17 +05:30
Rafael J. Wysocki
615f90d3b1 Merge branches 'acpi-processor', 'acpi-cppc' and 'acpi-pci'
Merge an ACPI processor driver update, two ACPI CPPC library updates
and ACPI PCI/CXL support updates for 7.2-rc1:

 - Add cpuidle driver check in acpi_processor_register_idle_driver() to
   avoid evaluating _CST unnecessarily (Tony W Wang-oc)

 - Suppress UBSAN warning caused by field misuse during PCC-based
   register access in the ACPI CPPC library (Jeremy Linton)

 - Add support for CPPC v4 to the ACPI CPPC library (Sumit Gupta)

 - Update the ACPI device enumeration code to honor _DEP for ACPI0016
   PCI/CXL host bridges and make the ACPI PCI root driver clear _DEP
   dependencies for PCI roots that have become operational (Chen Pei)

* acpi-processor:
  ACPI: processor: Add cpuidle driver check in acpi_processor_register_idle_driver()

* acpi-cppc:
  ACPI: CPPC: Suppress UBSAN warning caused by field misuse
  ACPI: CPPC: Add support for CPPC v4

* acpi-pci:
  ACPI: scan: Honor _DEP for ACPI0016 PCI/CXL host bridge
  ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach
2026-06-11 15:34:30 +02:00
Rafael J. Wysocki
9a0d10fed1 Merge branch 'acpi-driver'
Merge updates of core ACPI device drivers for 7.2-rc1:

 - Fix multiple issues related to probe, removal and missing NVDIMM
   device notifications in the ACPI NFIT driver (Rafael Wysocki)

 - Add support for devres-based management of ACPI notify handlers to
   the ACPI core (Rafael Wysocki)

 - Switch multiple core ACPI device drivers (including the ACPI PAD,
   ACPI video bus, ACPI HED, ACPI thermal zone, ACPI AC, ACPI battery,
   and ACPI NFIT drivers) over to using devres-based resource management
   during probe (Rafael Wysocki)

 - Replace mutex_lock/unlock() with guard()/scoped_guard() in the ACPI
   PMIC driver (Maxwell Doose)

 - Fix message kref handling in the dead device path of the ACPI IPMI
   address space handler (Yuho Choi)

 - Use sysfs_emit() in idlecpus_show() in the ACPI processor aggregator
   device (PAD) driver (Yury Norov)

 - Clean up device_id_scheme initialization in the ACPI video bus driver
   (Jean-Ralph Aviles)

* acpi-driver: (26 commits)
  ACPI: IPMI: Fix message kref handling on dead device
  ACPI: NFIT: core: Fix possible deadlock and missing notifications
  ACPI: NFIT: core: Eliminate redundant local variable
  ACPI: NFIT: core: Fix acpi_nfit_init() error cleanup
  ACPI: NFIT: core: Fix possible NULL pointer dereference
  ACPI: bus: Clean up devm_acpi_install_notify_handler()
  ACPI: PAD: Use sysfs_emit() in idlecpus_show()
  ACPI: video: Do not initialise device_id_scheme directly
  ACPI: video: Switch over to devres-based resource management
  ACPI: video: Use devm for video->entry and backlight cleanup
  ACPI: video: Use devm action for freeing video devices
  ACPI: video: Use devm action for video bus object cleanup
  ACPI: video: Rearrange probe and remove code
  ACPI: video: Reduce the number of auxiliary device dereferences
  ACPI: PAD: Switch over to devres-based resource management
  ACPI: PAD: Fix teardown ordering in acpi_pad_remove()
  ACPI: PAD: Pass struct device pointer to acpi_pad_notify()
  ACPI: PAD: Rearrange acpi_pad_notify()
  ACPI: thermal: Switch over to devres-based resource management
  ACPI: HED: Switch over to devres-based resource management
  ...
2026-06-11 15:17:57 +02:00
Rafael J. Wysocki
fc041c6931 Merge branch 'acpica'
Merge ACPICA updates for 7.2-rc1 including the following changes:

 - Add support for the Legacy Virtual Register (LVR) field in I2C serial
   bus resource descriptors to ACPICA (Akhil R)

 - Fix multiple issues related to bounds checks, input validation,
   use-after-free, and integer overflow checks in the AML interpreter
   in ACPICA (ikaros)

 - Update the copyright year to 2026 in ACPICA files and make minor
   changes related to ACPI 6.6 support (Pawel Chmielewski)

 - Remove spurious precision from format used to dump parse trees in
   ACPICA (David Laight)

 - Add modern standby DSM GUIDs to ACPICA header files (Daniel Schaefer)

 - Fix FADT 32/64X length mismatch warning in ACPICA (Abdelkader Boudih)

 - Update D3hot/cold device power states definitions in ACPICA header
   files (Aymeric Wibo)

 - Fix NULL pointer dereference in acpi_ns_custom_package() (Weiming
   Shi)

 - Update ACPICA version to 20260408 (Saket Dumbre)

* acpica: (27 commits)
  ACPICA: add boundary checks in two places
  ACPICA: Add package limit checks in parser functions
  ACPICA: Update version to 20260408
  ACPICA: Update the copyright year to 2026
  ACPICA: Remove spurious precision from format used to dump parse trees
  ACPICA: Enhance OEM ID and Table ID validation in acpi_ex_load_table_op()
  ACPICA: Fix NULL pointer dereference in acpi_ns_custom_package()
  ACPICA: Enhance buffer validation in acpi_ut_walk_aml_resources()
  ACPICA: Add validation for node in acpi_ns_build_normalized_path()
  ACPICA: validate handler object type in two places
  ACPICA: Improve argument parsing in acpi_ps_get_next_simple_arg()
  ACPICA: Fix integer overflow in acpi_ex_opcode_3A_1T_1R() (mid_op)
  ACPICA: Prevent adding invalid references
  ACPICA: add boundary checks in acpi_ps_get_next_field()
  ACPICA: validate byte_count in acpi_ps_get_next_package_length()
  ACPICA: Fix use-after-free in acpi_ds_terminate_control_method()
  ACPICA: fix I2C LVR item count in the conversion table
  ACPICA: Mention the LVR bits
  ACPICA: Change LVR to 8 bit value
  ACPICA: Fetch LVR I2C resource descriptor
  ...
2026-06-11 14:57:55 +02:00
Sumit Gupta
71e1815113 ACPI: CPPC: Add support for CPPC v4
CPPC v4 (ACPI 6.6, Section 8.4.6) adds two optional entries to the
_CPC package:

1. OSPM Nominal Performance (8.4.6.1.2.6): A write-only register that
   lets OSPM inform the platform what it considers nominal performance.
   The platform classifies performance above this level as boost and
   below as throttle for its power/thermal decisions.

2. Resource Priority (8.4.6.1.2.7): A Package of Resource Priority
   Register Descriptor sub-packages that allow OSPM to set relative
   priority among processors for shared resources (boost, throttle,
   L2/L3 cache, memory bandwidth). Parsing the full structure is not
   yet supported; such entries are marked as unsupported.

Add v4 _CPC table parsing (25 entries) and update REG_OPTIONAL to
mark the two new registers as optional.

Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Link: https://patch.msgid.link/20260527194626.185286-2-sumitg@nvidia.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-06-01 20:10:05 +02:00