Commit Graph

10350 Commits

Author SHA1 Message Date
Linus Torvalds
89b59f0979 Merge tag 'acpi-6.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more ACPI updates from Rafael Wysocki:
 "These fix a driver bug, clean up two pieces of code and improve the
  fwnode API consistency:

   - Add missing synchronization between interface updates in the ACPI
     battery driver (Rafael Wysocki)

   - Remove open coded check for cpu_feature_enabled() from
     acpi_processor_power_init_bm_check() (Mario Limonciello)

   - Remove redundant rcu_read_lock/unlock() under spinlock from
     ghes_notify_hed() in the ACPI APEI support code (pengdonglin)

   - Make the .get_next_child_node() callback in the ACPI fwnode backend
     skip ACPI devices that are not present for consistency with the
     analogous callback in the OF fwnode backend (Sakari Ailus)"

* tag 'acpi-6.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: property: Return present device nodes only on fwnode interface
  ACPI: APEI: Remove redundant rcu_read_lock/unlock() under spinlock
  ACPI: battery: Add synchronization between interface updates
  x86/acpi/cstate: Remove open coded check for cpu_feature_enabled()
2025-10-07 09:45:07 -07:00
Linus Torvalds
abdf766d14 Merge tag 'pm-6.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more power management updates from Rafael Wysocki:
 "These are cpufreq fixes and cleanups on top of the material merged
  previously, a power management core code fix and updates of the
  runtime PM framework including unit tests, documentation updates and
  introduction of auto-cleanup macros for runtime PM "resume and get"
  and "get without resuming" operations.

  Specifics:

   - Make cpufreq drivers setting the default CPU transition latency to
     CPUFREQ_ETERNAL specify a proper default transition latency value
     instead which addresses a regression introduced during the 6.6
     cycle that broke CPUFREQ_ETERNAL handling (Rafael Wysocki)

   - Make the cpufreq CPPC driver use a proper transition delay value
     when CPUFREQ_ETERNAL is returned by cppc_get_transition_latency()
     to indicate an error condition (Rafael Wysocki)

   - Make cppc_get_transition_latency() return a negative error code to
     indicate error conditions instead of using CPUFREQ_ETERNAL for this
     purpose and drop CPUFREQ_ETERNAL that has no other users (Rafael
     Wysocki, Gopi Krishna Menon)

   - Fix device leak in the mediatek cpufreq driver (Johan Hovold)

   - Set target frequency on all CPUs sharing a policy during frequency
     updates in the tegra186 cpufreq driver and make it initialize all
     cores to max frequencies (Aaron Kling)

   - Rust cpufreq helper cleanup (Thorsten Blum)

   - Make pm_runtime_put*() family of functions return 1 when the given
     device is already suspended which is consistent with the
     documentation (Brian Norris)

   - Add basic kunit tests for runtime PM API contracts and update
     return values in kerneldoc comments for the runtime PM API (Brian
     Norris, Dan Carpenter)

   - Add auto-cleanup macros for runtime PM "resume and get" and "get
     without resume" operations, use one of them in the PCI core and
     drop the existing "free" macro introduced for similar purpose, but
     somewhat cumbersome to use (Rafael Wysocki)

   - Make the core power management code avoid waiting on device links
     marked as SYNC_STATE_ONLY which is consistent with the handling of
     those device links elsewhere (Pin-yen Lin)"

* tag 'pm-6.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  docs/zh_CN: Fix malformed table
  docs/zh_TW: Fix malformed table
  PM: runtime: Fix error checking for kunit_device_register()
  PM: runtime: Introduce one more usage counter guard
  cpufreq: Drop unused symbol CPUFREQ_ETERNAL
  ACPI: CPPC: Do not use CPUFREQ_ETERNAL as an error value
  cpufreq: CPPC: Avoid using CPUFREQ_ETERNAL as transition delay
  cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency
  PM: runtime: Drop DEFINE_FREE() for pm_runtime_put()
  PCI/sysfs: Use runtime PM guard macro for auto-cleanup
  PM: runtime: Add auto-cleanup macros for "resume and get" operations
  cpufreq: tegra186: Initialize all cores to max frequencies
  cpufreq: tegra186: Set target frequency for all cpus in policy
  rust: cpufreq: streamline find_supply_names
  cpufreq: mediatek: fix device leak on probe failure
  PM: sleep: Do not wait on SYNC_STATE_ONLY device links
  PM: runtime: Update kerneldoc return codes
  PM: runtime: Make put{,_sync}() return 1 when already suspended
  PM: runtime: Add basic kunit tests for API contracts
2025-10-07 09:39:51 -07:00
Rafael J. Wysocki
dd68fd72e5 Merge branches 'acpi-x86', 'acpi-battery', 'acpi-apei' and 'acpi-property'
Merge an x86 cleanup related to ACPI, an ACPI battery driver fix, an
ACPI APEI cleanup, and an ACPI device properties handling update for
6.18-rc1:

 - Remove open coded check for cpu_feature_enabled() from
   acpi_processor_power_init_bm_check() (Mario Limonciello)

 - Add missing synchronization between interface updates in the ACPI
   battery driver (Rafael Wysocki)

 - Remove redundant rcu_read_lock/unlock() under spinlock from
   ghes_notify_hed() in the ACPI APEI support code (pengdonglin)

 - Make the .get_next_child_node() callback in the ACPI fwnode backend
   skip ACPI devices that are not present for consistency with the
   analogous callback in the OF fwnode backend (Sakari Ailus)

* acpi-x86:
  x86/acpi/cstate: Remove open coded check for cpu_feature_enabled()

* acpi-battery:
  ACPI: battery: Add synchronization between interface updates

* acpi-apei:
  ACPI: APEI: Remove redundant rcu_read_lock/unlock() under spinlock

* acpi-property:
  ACPI: property: Return present device nodes only on fwnode interface
2025-10-07 12:59:50 +02:00
Rafael J. Wysocki
53d4d315d4 Merge branch 'pm-cpufreq'
Merge cpufreq fixes and cleanups, mostly on top of those fixes, for
6.18-rc1:

 - Make cpufreq drivers setting the default CPU transition latency to
   CPUFREQ_ETERNAL specify a proper default transition latency value
   instead which addresses a regression introduced during the 6.6 cycle
   that broke CPUFREQ_ETERNAL handling (Rafael Wysocki)

 - Make the cpufreq CPPC driver use a proper transition delay value
   when CPUFREQ_ETERNAL is returned by cppc_get_transition_latency() to
   indicate an error condition (Rafael Wysocki)

 - Make cppc_get_transition_latency() return a negative error code to
   indicate error conditions instead of using CPUFREQ_ETERNAL for this
   purpose and drop CPUFREQ_ETERNAL that has no other users (Rafael
   Wysocki, Gopi Krishna Menon)

 - Fix device leak in the mediatek cpufreq driver (Johan Hovold)

 - Set target frequency on all CPUs sharing a policy during frequency
   updates in the tegra186 cpufreq driver and make it initialize all
   cores to max frequencies (Aaron Kling)

 - Rust cpufreq helper cleanup (Thorsten Blum)

* pm-cpufreq:
  docs/zh_CN: Fix malformed table
  docs/zh_TW: Fix malformed table
  cpufreq: Drop unused symbol CPUFREQ_ETERNAL
  ACPI: CPPC: Do not use CPUFREQ_ETERNAL as an error value
  cpufreq: CPPC: Avoid using CPUFREQ_ETERNAL as transition delay
  cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency
  cpufreq: tegra186: Initialize all cores to max frequencies
  cpufreq: tegra186: Set target frequency for all cpus in policy
  rust: cpufreq: streamline find_supply_names
  cpufreq: mediatek: fix device leak on probe failure
2025-10-07 12:31:46 +02:00
Linus Torvalds
ba9dac9873 Merge tag 'libnvdimm-for-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Ira Weiny:
 "Primarily bug fixes. Dave introduced the usage of cleanup.h a bit late
  in the cycle to help with the new label work required within CXL [1]

  nvdimm:
   - Return -ENOMEM if devm_kcalloc() fails in ndtest_probe()
   - Clean up __nd_ioctl() and remove gotos
   - Remove duplicate linux/slab.h header
   - Introduce guard() for nvdimm_bus_lock
   - Use str_plural() to simplify the code

  ACPI:
   - NFIT: Fix incorrect ndr_desc being reportedin dev_err message"

Link: https://lore.kernel.org/all/20250917134116.1623730-1-s.neeraj@samsung.com/ [1]

* tag 'libnvdimm-for-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  nvdimm: Remove duplicate linux/slab.h header
  nvdimm: ndtest: Return -ENOMEM if devm_kcalloc() fails in ndtest_probe()
  nvdimm: Clean up __nd_ioctl() and remove gotos
  nvdimm: Introduce guard() for nvdimm_bus_lock
  ACPI: NFIT: Fix incorrect ndr_desc being reportedin dev_err message
  nvdimm: Use str_plural() to simplify the code
2025-10-06 11:17:18 -07:00
Linus Torvalds
d104e3d17f Merge tag 'cxl-for-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull CXL updates from Dave Jiang:
 "The changes include adding poison injection support, fixing CXL access
  coordinates when onlining CXL memory, and delaing the enumeration of
  downstream switch ports for CXL hierarchy to ensure that the CXL link
  is established at the time of enumeration to address a few issues
  observed on AMD and Intel platforms.

  Misc changes:
   - Use str_plural() instead of open code for emitting strings.
   - Use str_enabled_disabled() instead of ternary operator
   - Fix emit of type resource_size_t argument for
     validate_region_offset()
   - Typo fixup in CXL driver-api documentation
   - Rename CFMWS coherency restriction defines
   - Add convention doc describe dealing with x86 low memory hole
     and CXL

  Poison Inject support:
   - Move hpa_to_spa callback to new reoot decoder ops structure
   - Define a SPA to HPA callback for interleave calculation with
     XOR math
   - Add support for SPA to DPA address translation with XOR
   - Add locked variants of poison inject and clear functions
   - Add inject and clear poison support by region offset

  CXL access coordinates update fix:
   - A comment update for hotplug memory callback prority defines
   - Add node_update_perf_attrs() for updating perf attrs on a node
   - Update cxl_access_coordinates() to use the new node update function
   - Remove hmat_update_target_coordinates() and related code

  CXL delayed downstream port enumeration and initialization:
   - Add helper to detect top of CXL device topology and remove
     open coding
   - Add helper to delete single dport
   - Add a cached copy of target_map to cxl_decoder
   - Refactor decoder setup to reduce cxl_test burden
   - Defer dport allocation for switch ports
   - Add mock version of devm_cxl_add_dport_by_dev() for cxl_test
   - Adjust the mock version of devm_cxl_switch_port_decoders_setup()
     due to cxl core usage
   - Setup target_map for cxl_test decoder initialization
   - Change SSLBIS handler to handle single dport
   - Move port register setup to when first dport appears"

* tag 'cxl-for-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: (25 commits)
  cxl: Move port register setup to when first dport appear
  cxl: Change sslbis handler to only handle single dport
  cxl/test: Setup target_map for cxl_test decoder initialization
  cxl/test: Adjust the mock version of devm_cxl_switch_port_decoders_setup()
  cxl/test: Add mock version of devm_cxl_add_dport_by_dev()
  cxl: Defer dport allocation for switch ports
  cxl/test: Refactor decoder setup to reduce cxl_test burden
  cxl: Add a cached copy of target_map to cxl_decoder
  cxl: Add helper to delete dport
  cxl: Add helper to detect top of CXL device topology
  cxl: Documentation/driver-api/cxl: Describe the x86 Low Memory Hole solution
  cxl/acpi: Rename CFMW coherency restrictions
  Documentation/driver-api: Fix typo error in cxl
  acpi/hmat: Remove now unused hmat_update_target_coordinates()
  cxl, acpi/hmat: Update CXL access coordinates directly instead of through HMAT
  drivers/base/node: Add a helper function node_update_perf_attrs()
  mm/memory_hotplug: Update comment for hotplug memory callback priorities
  cxl: Fix emit of type resource_size_t argument for validate_region_offset()
  cxl/region: Add inject and clear poison by region offset
  cxl/core: Add locked variants of the poison inject and clear funcs
  ...
2025-10-04 12:02:50 -07:00
Linus Torvalds
86bcf7be1e Merge tag 'riscv-for-linus-6.18-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull more RISC-V updates from Paul Walmsley:

 - Support for the RISC-V-standardized RPMI interface.

   RPMI is a platform management communication mechanism between OSes
   running on application processors, and a remote platform management
   processor. Similar to ARM SCMI, TI SCI, etc. This includes irqchip,
   mailbox, and clk changes.

 - Support for the RISC-V-standardized MPXY SBI extension.

   MPXY is a RISC-V-specific standard implementing a shared memory
   mailbox between S-mode operating systems (e.g., Linux) and M-mode
   firmware (e.g., OpenSBI). It is part of this PR since one of its use
   cases is to enable M-mode firmware to act as a single RPMI client for
   all RPMI activity on a core (including S-mode RPMI activity).
   Includes a mailbox driver.

 - Some ACPI-related updates to enable the use of RPMI and MPXY.

 - The addition of Linux-wide memcpy_{from,to}_le32() static inline
   functions, for RPMI use.

 - An ACPI Kconfig change to enable boot logos on any ACPI-using
   architecture (including RISC-V)

 - A RISC-V defconfig change to add GPIO keyboard and event device
   support, for front panel shutdown or reboot buttons

* tag 'riscv-for-linus-6.18-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (26 commits)
  clk: COMMON_CLK_RPMI should depend on RISCV
  ACPI: support BGRT table on RISC-V
  MAINTAINERS: Add entry for RISC-V RPMI and MPXY drivers
  RISC-V: Enable GPIO keyboard and event device in RV64 defconfig
  irqchip/riscv-rpmi-sysmsi: Add ACPI support
  mailbox/riscv-sbi-mpxy: Add ACPI support
  irqchip/irq-riscv-imsic-early: Export imsic_acpi_get_fwnode()
  ACPI: RISC-V: Add RPMI System MSI to GSI mapping
  ACPI: RISC-V: Add support to update gsi range
  ACPI: RISC-V: Create interrupt controller list in sorted order
  ACPI: scan: Update honor list for RPMI System MSI
  ACPI: Add support for nargs_prop in acpi_fwnode_get_reference_args()
  ACPI: property: Refactor acpi_fwnode_get_reference_args() to support nargs_prop
  irqchip: Add driver for the RPMI system MSI service group
  dt-bindings: Add RPMI system MSI interrupt controller bindings
  dt-bindings: Add RPMI system MSI message proxy bindings
  clk: Add clock driver for the RISC-V RPMI clock service group
  dt-bindings: clock: Add RPMI clock service controller bindings
  dt-bindings: clock: Add RPMI clock service message proxy bindings
  mailbox: Add RISC-V SBI message proxy (MPXY) based mailbox driver
  ...
2025-10-04 10:36:22 -07:00
Linus Torvalds
bed0653fe2 Merge tag 'iommu-updates-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux
Pull iommu updates from Joerg Roedel:

 - Inte VT-d:
    - IOMMU driver updated to the latest VT-d specification
    - Don't enable PRS if PDS isn't supported
    - Replace snprintf with scnprintf
    - Fix legacy mode page table dump through debugfs
    - Miscellaneous cleanups

 - AMD-Vi:
     - Support kdump boot when SNP is enabled

 - Apple-DART:
     - 4-level page-table support

 - RISC-V IOMMU:
     - ACPI support

 - Small number of miscellaneous cleanups and fixes

* tag 'iommu-updates-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux: (22 commits)
  iommu/vt-d: Disallow dirty tracking if incoherent page walk
  iommu/vt-d: debugfs: Avoid dumping context command register
  iommu/vt-d: Removal of Advanced Fault Logging
  iommu/vt-d: PRS isn't usable if PDS isn't supported
  iommu/vt-d: Remove LPIG from page group response descriptor
  iommu/vt-d: Drop unused cap_super_offset()
  iommu/vt-d: debugfs: Fix legacy mode page table dump logic
  iommu/vt-d: Replace snprintf with scnprintf in dmar_latency_snapshot()
  iommu/io-pgtable-dart: Fix off by one error in table index check
  iommu/riscv: Add ACPI support
  ACPI: scan: Add support for RISC-V in acpi_iommu_configure_id()
  ACPI: RISC-V: Add support for RIMT
  iommu/omap: Use int type to store negative error codes
  iommu/apple-dart: Clear stream error indicator bits for T8110 DARTs
  iommu/amd: Skip enabling command/event buffers for kdump
  crypto: ccp: Skip SEV and SNP INIT for kdump boot
  iommu/amd: Reuse device table for kdump
  iommu/amd: Add support to remap/unmap IOMMU buffers for kdump
  iommu/apple-dart: Add 4-level page table support
  iommu/io-pgtable-dart: Add 4-level page table support
  ...
2025-10-03 18:00:11 -07:00
Linus Torvalds
679a16399a Merge tag 'acpi-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki:
 "These include an ACPICA update (upstream revision 20250807 with a few
  fixes on top), fixes and cleanups of the ACPI processor driver, fixes
  and cleanups of the ACPI properties management code, one more ACPI IRQ
  resource management quirk, one more ACPI backlight quirk, an ACPI
  device enumeration quirk related to _DEP, a power resource quirk
  related to WWAN modem for HP EliteBook 855 G7, ACPI SPCR table parser
  extensions, an ACPI APEI EINJ driver update allowing it to handle more
  address types, and several assorted cleanups of ACPI drivers and PNP
  code.

  Specifics:

   - Add SoundWire File Table (SWFT) signature to ACPICA (Maciej
     Strozek)

   - Rearrange local variable definition involving #ifdef in ACPICA to
     avoid using uninitialized variables (Zhe Qiao)

   - Allow ACPICA to skip Global Lock initialization (Huacai Chen)

   - Apply ACPI_NONSTRING in more places in ACPICA and fix two
     regressions related to incorrect ACPI_NONSTRING usage (Ahmed Salem)

   - Fix printing CDAT table header when dissasebling CDAT AML (Ahmed
     Salem)

   - Use acpi_ds_clear_operands() in acpi_ds_call_control_method() in
     ACPICA (Hans de Goede)

   - Update dsmethod.c in ACPICA to address unused variable warning
     (Saket Dumbre)

   - Print error messages in ACPICA for too few or too many control
     method arguments (Saket Dumbre)

   - Update ACPICA version to 20250807 (Saket Dumbre)

   - Fix largest possible resource descriptor index in ACPICA (Dmitry
     Antipov)

   - Add Back-Invalidate restriction to CXL Window for CEDT in ACPICA
     (Davidlohr Bueso)

   - Add the package type to acceptable Arg3 types for _DSM in ACPICA
     because ACPI_TYPE_ANY does not cover it (Saket Dumbre)

   - Fix return values in ap_is_valid_checksum() in the acpidump utility
     in ACPICA (Kaushlendra Kumar)

   - Add Intel CVS ACPI HIDs to acpi_ignore_dep_ids[] so it is not
     regarded as real dependency (Hans de Goede)

   - Use ACPI_FREE() for freeing an ACPI object in description_show() in
     the ACPI sysfs-related code (Kaushlendra Kumar)

   - Fix memory leak in the ACPI processor idle driver registration
     error code path and optimize ACPI idle driver registration (Huisong
     Li, Rafael Wysocki)

   - Add module import namespace to the ACPI processor idle driver
     (Rafael Wysocki)

   - Eliminate static variable flat_state_cnt from the ACPI processor
     idle driver (Rafael Wysocki)

   - Release cpufreq policy references using __free() in the ACPI
     processor thremal driver (Zihuan Zhang)

   - Remove unused empty stubs of some functions and rearrange function
     declarations in a header file in the ACPI processor driver (Huisong
     Li)

   - Redefine two functions as void in the ACPI processor driver (Rafael
     Wysocki)

   - Stop exposing global variable acpi_idle_driver in the ACPI
     processor driver (Huisong Li)

   - Fix ACPI buffer properties extraction for data-only subnodes
     represented as _DSD-equivalent packages (Rafael Wysocki)

   - Fix handling of ACPI data-only subnodes represented as
     _DSD-equivalent packages in the case when they are embedded in
     larger _DSD-equivalent packages and clean up
     acpi_nondev_subnode_extract() (Rafael Wysocki)

   - Skip ACPI IRQ override on ASUS Vivobook Pro N6506CU (Sam van
     Kampen)

   - Add power resource init function and use it for introducing an HP
     EliteBook 855 G7 WWAN modem power resource quirk (Maciej Szmigiero)

   - Add support for DBG2 RISC-V SBI port subtype and Precise Baud Rate
     field to the ACPI SPCR table parser (Chen Pei)

   - Eliminate a dummy local variable from the ACPI thermal driver
     (Rafael Wysocki)

   - Fold two simple functions into their only caller in the ACPI fan
     driver (Rafael Wysocki)

   - Force native backlight on Lenovo 82K8 in the ACPI backlight (video)
     driver (Mario Limonciello)

   - Add missing sysfs_remove_group() for ACPI_TAD_RT (Daniel Tang)

   - Skip PRM handlers with NULL handler_address or NULL VA in the ACPI
     PRM driver (Shang song)

   - Remove redundant assignments in erst_dbg_{ioctl|write}() in the
     ACPI APEI driver (Thorsten Blum)

   - Allow the ACPI APEI EINJ to handle more types of addresses than
     just MMIO (Jiaqi Yan)

   - Use str_low_high() helper in two places in the ACPI code (Chelsy
     Ratnawat)

   - Use str_plural() to simplify the PNP code (Xichao Zhao)

   - Fix signedness issues in read/write helpers in the ACPI AML
     debugger interface (Amir Mohammad)"

* tag 'acpi-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (50 commits)
  ACPI: debug: fix signedness issues in read/write helpers
  ACPI: processor: Do not expose global variable acpi_idle_driver
  ACPI: SPCR: Support Precise Baud Rate field
  ACPI: processor: idle: Redefine two functions as void
  ACPI: processor: Update cpuidle driver check in __acpi_processor_start()
  ACPI: processor: idle: Rearrange declarations in header file
  ACPI: processor: Remove unused empty stubs of some functions
  ACPI: property: Adjust failure handling in acpi_nondev_subnode_extract()
  ACPI: property: Do not pass NULL handles to acpi_attach_data()
  ACPI: property: Add code comments explaining what is going on
  ACPI: property: Disregard references in data-only subnode lists
  ACPI: property: Fix buffer properties extraction for subnodes
  ACPI: SPCR: Add support for DBG2 RISC-V SBI port subtype
  ACPI: APEI: EINJ: Allow more types of addresses except MMIO
  ACPI: APEI: Remove redundant assignments in erst_dbg_{ioctl|write}()
  ACPICA: acpidump: fix return values in ap_is_valid_checksum()
  ACPICA: ACPI_TYPE_ANY does not include the package type
  ACPICA: CEDT: Add Back-Invalidate restriction to CXL Window
  ACPICA: Fix largest possible resource descriptor index
  ACPICA: Update version to 20250807
  ...
2025-10-01 16:24:50 -07:00
Sakari Ailus
d9f866b2bb ACPI: property: Return present device nodes only on fwnode interface
fwnode_graph_get_next_subnode() may return fwnode backed by ACPI
device nodes and there has been no check these devices are present
in the system, unlike there has been on fwnode OF backend.

In order to provide consistent behaviour towards callers,
add a check for device presence by introducing
a new function acpi_get_next_present_subnode(), used as the
get_next_child_node() fwnode operation that also checks device
node presence.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Link: https://patch.msgid.link/20251001102636.1272722-2-sakari.ailus@linux.intel.com
[ rjw: Kerneldoc comment and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-10-01 20:47:49 +02:00
Rafael J. Wysocki
c28a280bd4 ACPI: CPPC: Do not use CPUFREQ_ETERNAL as an error value
Instead of using CPUFREQ_ETERNAL for signaling an error condition
in cppc_get_transition_latency(), change the return value type of
that function to int and make it return a proper negative error
code on failures.

No intentional functional impact.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Qais Yousef <qyousef@layalina.io>
2025-10-01 13:57:13 +02:00
Linus Torvalds
70de5572a8 Merge tag 'timers-clocksource-2025-09-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull clocksource updates from Thomas Gleixner:

 - Further preparations for modular clocksource/event drivers

 - The usual device tree updates to support new chip variants and the
   related changes to thise drivers

 - Avoid a 64-bit division in the TEGRA186 driver, which caused a build
   fail on 32-bit machines.

 - Small fixes, improvements and cleanups all over the place

* tag 'timers-clocksource-2025-09-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (52 commits)
  dt-bindings: timer: exynos4210-mct: Add compatible for ARTPEC-9 SoC
  clocksource/drivers/sh_cmt: Split start/stop of clock source and events
  clocksource/drivers/clps711x: Fix resource leaks in error paths
  clocksource/drivers/arm_global_timer: Add auto-detection for initial prescaler values
  clocksource/drivers/ingenic-sysost: Convert from round_rate() to determine_rate()
  clocksource/drivers/timer-tegra186: Don't print superfluous errors
  clocksource/drivers/timer-rtl-otto: Simplify documentation
  clocksource/drivers/timer-rtl-otto: Do not interfere with interrupts
  clocksource/drivers/timer-rtl-otto: Drop set_counter function
  clocksource/drivers/timer-rtl-otto: Work around dying timers
  clocksource/drivers/timer-ti-dm : Capture functionality for OMAP DM timer
  clocksource/drivers/arm_arch_timer_mmio: Add MMIO clocksource
  clocksource/drivers/arm_arch_timer_mmio: Switch over to standalone driver
  clocksource/drivers/arm_arch_timer: Add standalone MMIO driver
  ACPI: GTDT: Generate platform devices for MMIO timers
  clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support
  dt: bindings: fsl,vf610-pit: Add compatible for s32g2 and s32g3
  clocksource/drivers/vf-pit: Rename the VF PIT to NXP PIT
  clocksource/drivers/vf-pit: Unify the function name for irq ack
  clocksource/drivers/vf-pit: Consolidate calls to pit_*_disable/enable
  ...
2025-09-30 16:53:59 -07:00
Rafael J. Wysocki
c87072064b Merge branches 'acpi-apei', 'acpi-misc' and 'pnp'
Merge ACPI APEI updates, a miscellaneous update related to ACPI, and a
PNP update for 6.18-rc1:

 - Remove redundant assignments in erst_dbg_{ioctl|write}() in the ACPI
   APEI driver (Thorsten Blum)

 - Allow the ACPI APEI EINJ to handle more types of addresses than just
   MMIO (Jiaqi Yan)

 - Use str_low_high() helper in two places in the ACPI code (Chelsy
   Ratnawat)

 - Use str_plural() to simplify the PNP code (Xichao Zhao)

* acpi-apei:
  ACPI: APEI: EINJ: Allow more types of addresses except MMIO
  ACPI: APEI: Remove redundant assignments in erst_dbg_{ioctl|write}()

* acpi-misc:
  ACPI: Use str_low_high() helper in two places

* pnp:
  PNP: isapnp: use str_plural() to simplify the code
2025-09-29 15:28:51 +02:00
Rafael J. Wysocki
02e9542558 Merge branches 'acpi-thermal', 'acpi-fan', 'acpi-video', 'acpi-tad' and 'acpi-prm'
Merge an ACPI thermal zone driver update, an ACPI fan driver update, an
ACPI backlight (video) driver update, an ACPI TAD (time and alarm
device) driver update, and an ACPI PRM (platform runtime mechanism)
driver update for 6.18-rc1:

 - Eliminate a dummy local variable from the ACPI thermal driver (Rafael
   Wysocki)

 - Fold two simple functions into their only caller in the ACPI fan
   driver (Rafael Wysocki)

 - Force native backlight on Lenovo 82K8 in the ACPI backlight (video)
   driver (Mario Limonciello)

 - Add missing sysfs_remove_group() for ACPI_TAD_RT (Daniel Tang)

 - Skip PRM handlers with NULL handler_address or NULL VA in the ACPI
   PRM driver (Shang song)

* acpi-thermal:
  ACPI: thermal: Get rid of a dummy local variable

* acpi-fan:
  ACPI: fan: Fold two simple functions into their only caller

* acpi-video:
  ACPI: video: force native for Lenovo 82K8

* acpi-tad:
  ACPI: TAD: Add missing sysfs_remove_group() for ACPI_TAD_RT

* acpi-prm:
  ACPI: PRM: Skip handlers with NULL handler_address or NULL VA
2025-09-29 15:23:52 +02:00
Rafael J. Wysocki
6173176cf2 Merge branches 'acpi-property', 'acpi-resource', 'acpi-pm' and 'acpi-tables'
Merge updates of the ACPI device properties management code, ACPI
resources management code, ACPI power management, and ACPI data tables
parsing code for 6.18-rc1:

 - Fix ACPI buffer properties extraction for data-only subnodes
   represented as _DSD-equivalent packages (Rafael Wysocki)

 - Fix handling of ACPI data-only subnodes represented as _DSD-equivalent
   packages in the case when they are embedded in larger _DSD-equivalent
   packages and clean up acpi_nondev_subnode_extract() (Rafael Wysocki)

 - Skip ACPI IRQ override on ASUS Vivobook Pro N6506CU (Sam van Kampen)

 - Add power resource init function and use it for introducing an HP
   EliteBook 855 G7 WWAN modem power resource quirk (Maciej Szmigiero)

 - Add support for DBG2 RISC-V SBI port subtype and Precise Baud Rate
   field to the ACPI SPCR table parser (Chen Pei)

* acpi-property:
  ACPI: property: Adjust failure handling in acpi_nondev_subnode_extract()
  ACPI: property: Do not pass NULL handles to acpi_attach_data()
  ACPI: property: Add code comments explaining what is going on
  ACPI: property: Disregard references in data-only subnode lists
  ACPI: property: Fix buffer properties extraction for subnodes

* acpi-resource:
  ACPI: resource: Skip IRQ override on ASUS Vivobook Pro N6506CU

* acpi-pm:
  ACPI: PM: Add HP EliteBook 855 G7 WWAN modem power resource quirk
  ACPI: PM: Add power resource init function

* acpi-tables:
  ACPI: SPCR: Support Precise Baud Rate field
  ACPI: SPCR: Add support for DBG2 RISC-V SBI port subtype
2025-09-29 15:14:29 +02:00
Rafael J. Wysocki
be61a77818 Merge branches 'acpi-scan', 'acpi-processor' and 'acpi-sysfs'
Merge an ACPI device enumeration update, ACPI processor driver updates,
and an ACPI sysfs-related code update for 6.18-rc1:

 - Add Intel CVS ACPI HIDs to acpi_ignore_dep_ids[] so it is not
   regarded as real dependency (Hans de Goede)

 - Use ACPI_FREE() for freeing an ACPI object in description_show() in
   the ACPI sysfs-related code (Kaushlendra Kumar)

 - Fix memory leak in the ACPI processor idle driver registration error
   code path and optimize ACPI idle driver registration (Huisong Li,
   Rafael Wysocki)

 - Add module import namespace to the ACPI processor idle driver (Rafael
   Wysocki)

 - Eliminate static variable flat_state_cnt from the ACPI processor idle
   driver (Rafael Wysocki)

 - Release cpufreq policy references using __free() in the ACPI
   processor thremal driver (Zihuan Zhang)

 - Remove unused empty stubs of some functions and rearrange function
   declarations in a header file in the ACPI processor driver (Huisong
   Li)

 - Redefine two functions as void in the ACPI processor driver (Rafael
   Wysocki)

 - Do not expose global variable acpi_idle_driver in the ACPI processor
   driver (Huisong Li)

* acpi-scan:
  ACPI: scan: Add Intel CVS ACPI HIDs to acpi_ignore_dep_ids[]

* acpi-processor:
  ACPI: processor: Do not expose global variable acpi_idle_driver
  ACPI: processor: idle: Redefine two functions as void
  ACPI: processor: Update cpuidle driver check in __acpi_processor_start()
  ACPI: processor: idle: Rearrange declarations in header file
  ACPI: processor: Remove unused empty stubs of some functions
  ACPI: processor: thermal: Release policy references using __free()
  ACPI: processor: idle: Fix function defined but not used warning
  ACPI: processor: idle: Eliminate static variable flat_state_cnt
  ACPI: processor: idle: Add module import namespace
  ACPI: processor: idle: Optimize ACPI idle driver registration
  ACPI: processor: idle: Fix memory leak when register cpuidle device failed

* acpi-sysfs:
  ACPI: sysfs: Use ACPI_FREE() for freeing an ACPI object
2025-09-29 15:12:52 +02:00
Rafael J. Wysocki
ab80f7707d Merge branch 'acpica'
Merge ACPICA updates (20250807 release material with a few fixes on top)
for 6.18-rc1:

 - Add SoundWire File Table (SWFT) signature to ACPICA (Maciej Strozek)

 - Rearrange local variable definition involving #ifdef in ACPICA to
   avoid using uninitialized variables (Zhe Qiao)

 - Allow ACPICA to skip Global Lock initialization (Huacai Chen)

 - Apply ACPI_NONSTRING in more places in ACPICA and fix two regressions
   related to incorrect ACPI_NONSTRING usage (Ahmed Salem)

 - Fix printing CDAT table header when dissasebling CDAT AML (Ahmed
   Salem)

 - Use acpi_ds_clear_operands() in acpi_ds_call_control_method() in
   ACPICA (Hans de Goede)

 - Update dsmethod.c in ACPICA to address unused variable warning (Saket
   Dumbre)

 - Print error messages in ACPICA for too few or too many control method
   arguments (Saket Dumbre)

 - Update ACPICA version to 20250807 (Saket Dumbre)

 - Fix largest possible resource descriptor index in ACPICA (Dmitry
   Antipov)

 - Add Back-Invalidate restriction to CXL Window for CEDT in ACPICA
   (Davidlohr Bueso).

 - Add the package type to acceptable Arg3 types for _DSM in ACPICA
   because ACPI_TYPE_ANY does not cover it (Saket Dumbre)

 - Fix return values in ap_is_valid_checksum() in the acpidump utility
   in ACPICA (Kaushlendra Kumar)

* acpica:
  ACPICA: acpidump: fix return values in ap_is_valid_checksum()
  ACPICA: ACPI_TYPE_ANY does not include the package type
  ACPICA: CEDT: Add Back-Invalidate restriction to CXL Window
  ACPICA: Fix largest possible resource descriptor index
  ACPICA: Update version to 20250807
  ACPICA: Print error messages for too few or too many arguments
  ACPICA: Update dsmethod.c to get rid of unused variable warning
  ACPICA: dispatcher: Use acpi_ds_clear_operands() in acpi_ds_call_control_method()
  ACPICA: Debugger: drop ACPI_NONSTRING attribute from name_seg
  ACPICA: acpidump: drop ACPI_NONSTRING attribute from file_name
  ACPICA: iASL: Fix printing CDAT table header
  ACPICA: Apply ACPI_NONSTRING
  ACPICA: Allow to skip Global Lock initialization
  ACPICA: Change the compilation conditions
  ACPICA: Remove redundant "#ifdef" definitions
  ACPICA: Modify variable definition position
  ACPICA: Add SoundWire File Table (SWFT) signature
2025-09-29 15:10:54 +02:00
pengdonglin
c7bc7e9070 ACPI: APEI: Remove redundant rcu_read_lock/unlock() under spinlock
Since commit a8bb74acd8 ("rcu: Consolidate RCU-sched update-side
function definitions") there is no difference between rcu_read_lock(),
rcu_read_lock_bh() and rcu_read_lock_sched() in terms of RCU read
section and the relevant grace period. That means that spin_lock(),
which implies rcu_read_lock_sched(), also implies rcu_read_lock().

There is no need no explicitly start a RCU read section if one has
already been started implicitly by spin_lock().

Simplify the code and remove the inner rcu_read_lock() invocation.

Signed-off-by: pengdonglin <pengdonglin@xiaomi.com>
Signed-off-by: pengdonglin <dolinux.peng@gmail.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Link: https://patch.msgid.link/20250916044735.2316171-2-dolinux.peng@gmail.com
[ rjw: Subject adjustment ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-28 12:31:54 +02:00
Rafael J. Wysocki
399dbcadc0 ACPI: battery: Add synchronization between interface updates
There is no synchronization between different code paths in the ACPI
battery driver that update its sysfs interface or its power supply
class device interface.  In some cases this results to functional
failures due to race conditions.

One example of this is when two ACPI notifications:

  - ACPI_BATTERY_NOTIFY_STATUS (0x80)
  - ACPI_BATTERY_NOTIFY_INFO   (0x81)

are triggered (by the platform firmware) in a row with a little delay
in between after removing and reinserting a laptop battery.  Both
notifications cause acpi_battery_update() to be called and if the delay
between them is sufficiently small, sysfs_add_battery() can be re-entered
before battery->bat is set which leads to a duplicate sysfs entry error:

 sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1'
 CPU: 1 UID: 0 PID: 185 Comm: kworker/1:4 Kdump: loaded Not tainted 6.12.38+deb13-amd64 #1  Debian 6.12.38-1
 Hardware name: Gateway          NV44             /SJV40-MV        , BIOS V1.3121 04/08/2009
 Workqueue: kacpi_notify acpi_os_execute_deferred
 Call Trace:
  <TASK>
  dump_stack_lvl+0x5d/0x80
  sysfs_warn_dup.cold+0x17/0x23
  sysfs_create_dir_ns+0xce/0xe0
  kobject_add_internal+0xba/0x250
  kobject_add+0x96/0xc0
  ? get_device_parent+0xde/0x1e0
  device_add+0xe2/0x870
  __power_supply_register.part.0+0x20f/0x3f0
  ? wake_up_q+0x4e/0x90
  sysfs_add_battery+0xa4/0x1d0 [battery]
  acpi_battery_update+0x19e/0x290 [battery]
  acpi_battery_notify+0x50/0x120 [battery]
  acpi_ev_notify_dispatch+0x49/0x70
  acpi_os_execute_deferred+0x1a/0x30
  process_one_work+0x177/0x330
  worker_thread+0x251/0x390
  ? __pfx_worker_thread+0x10/0x10
  kthread+0xd2/0x100
  ? __pfx_kthread+0x10/0x10
  ret_from_fork+0x34/0x50
  ? __pfx_kthread+0x10/0x10
  ret_from_fork_asm+0x1a/0x30
  </TASK>
 kobject: kobject_add_internal failed for BAT1 with -EEXIST, don't try to register things with the same name in the same directory.

There are also other scenarios in which analogous issues may occur.

Address this by using a common lock in all of the code paths leading
to updates of driver interfaces: ACPI Notify () handler, system resume
callback and post-resume notification, device addition and removal.

This new lock replaces sysfs_lock that has been used only in
sysfs_remove_battery() which now is going to be always called under
the new lock, so it doesn't need any internal locking any more.

Fixes: 1066625155 ("ACPI: battery: Install Notify() handler directly")
Closes: https://lore.kernel.org/linux-acpi/20250910142653.313360-1-luogf2025@163.com/
Reported-by: GuangFei Luo <luogf2025@163.com>
Tested-by: GuangFei Luo <luogf2025@163.com>
Cc: 6.6+ <stable@vger.kernel.org> # 6.6+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-28 12:25:02 +02:00
Joerg Roedel
5f4b8c03f4 Merge branches 'apple/dart', 'ti/omap', 'riscv', 'intel/vt-d' and 'amd/amd-vi' into next 2025-09-26 10:03:33 +02:00
Heinrich Schuchardt
21c3896b47 ACPI: support BGRT table on RISC-V
The BGRT table is used to display a vendor logo in the boot process.
There is no good reason why RISC-V should not support it.

Remove the architecture constraint.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Link: https://lore.kernel.org/r/20250729131535.522205-3-heinrich.schuchardt@canonical.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2025-09-25 20:11:41 -06:00
Sunil V L
bb96fb5a79 ACPI: RISC-V: Add RPMI System MSI to GSI mapping
The RPMI System MSI device will provide GSIs to downstream devices
(such as GED) so add it to the RISC-V GSI to fwnode mapping.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-20-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2025-09-25 19:49:09 -06:00
Sunil V L
4d185fdeef ACPI: RISC-V: Add support to update gsi range
Some RISC-V interrupt controllers like RPMI based system MSI interrupt
controllers do not have MADT entry defined. These interrupt controllers
exist only in the namespace. ACPI spec defines _GSB method to get the
GSI base of the interrupt controller, However, there is no such standard
method to get the GSI range. To support such interrupt controllers, set
the GSI range of such interrupt controllers to non-overlapping range and
provide API for interrupt controller driver to update it with proper
value.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-19-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2025-09-25 19:48:54 -06:00
Sunil V L
694b2ef1e7 ACPI: RISC-V: Create interrupt controller list in sorted order
Currently, the interrupt controller list is created without any order.
Create the list sorted with the GSI base of the interrupt controllers.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-18-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2025-09-25 19:48:52 -06:00
Sunil V L
4215d1cf59 ACPI: scan: Update honor list for RPMI System MSI
The RPMI System MSI interrupt controller (just like PLIC and APLIC)
needs to probed prior to devices like GED which use interrupts provided
by it. Also, it has dependency on the SBI MPXY mailbox device.

Add HIDs of RPMI System MSI and SBI MPXY mailbox devices to the honor
list so that those dependencies are handled.

Reviewed-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-17-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2025-09-25 19:48:49 -06:00
Sunil V L
159c86f306 ACPI: Add support for nargs_prop in acpi_fwnode_get_reference_args()
Currently, ACPI does not support the use of a nargs_prop (e.g.,
associated with a reference in fwnode_property_get_reference_args().
Instead, ACPI expects the number of arguments (nargs) to be explicitly
passed or known.

This behavior diverges from Open Firmware (OF), which allows the use of
a #*-cells property in the referenced node to determine the number of
arguments. Since fwnode_property_get_reference_args() is a common
interface used across both OF and ACPI firmware paradigms, it is
desirable to have a unified calling convention that works seamlessly for
both.

Add the support for ACPI to parse a nargs_prop from the referenced
fwnode, aligning its behavior with the OF backend. This allows drivers
and subsystems using fwnode_property_get_reference_args() to work in a
firmware-agnostic way without having to hardcode or special-case
argument counts for ACPI.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-16-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2025-09-25 19:48:47 -06:00
Sunil V L
e121be784d ACPI: property: Refactor acpi_fwnode_get_reference_args() to support nargs_prop
Currently, acpi_fwnode_get_reference_args() delegates to the internal
function __acpi_node_get_property_reference() to retrieve property
references. However, this function does not handle the nargs_prop (cells
property) parameter, and instead expects the number of arguments (nargs)
to be known or hardcoded.

As a result, when fwnode_property_get_reference_args() is used with a
valid nargs_prop, the ACPI backend ignores it, whereas the Device Tree
(DT) backend uses the #*-cells property from the reference node to
determine the number of arguments dynamically.

To support the nargs_prop in ACPI, refactor the code as follows:

- Move the implementation from __acpi_node_get_property_reference()
  into acpi_fwnode_get_reference_args().

- Update __acpi_node_get_property_reference() to call the (now updated)
  acpi_fwnode_get_reference_args() passing NULL as nargs_prop to keep
  the behavior of __acpi_node_get_property_reference() intact.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-15-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2025-09-25 15:28:12 -06:00
Amir Mohammad Jahangirzad
496f9372ea ACPI: debug: fix signedness issues in read/write helpers
In the ACPI debugger interface, the helper functions for read and write
operations use "int" as the length parameter data type. When a large
"size_t count" is passed from the file operations, this cast to "int"
results in truncation and a negative value due to signed integer
representation.

Logically, this negative number propagates to the min() calculation,
where it is selected over the positive buffer space value, leading to
unexpected behavior. Subsequently, when this negative value is used in
copy_to_user() or copy_from_user(), it is interpreted as a large positive
value due to the unsigned nature of the size parameter in these functions,
causing the copy operations to attempt handling sizes far beyond the
intended buffer limits.

Address the issue by:
 - Changing the length parameters in acpi_aml_read_user() and
   acpi_aml_write_user() from "int" to "size_t", aligning with the
   expected unsigned size semantics.
 - Updating return types and local variables in acpi_aml_read() and
   acpi_aml_write() to "ssize_t" for consistency with kernel file
   operation conventions.
 - Using "size_t" for the "n" variable to ensure calculations remain
   unsigned.
 - Using min_t() for circ_count_to_end() and circ_space_to_end() to
   ensure type-safe comparisons and prevent integer overflow.

Signed-off-by: Amir Mohammad Jahangirzad <a.jahangirzad@gmail.com>
Link: https://patch.msgid.link/20250923013113.20615-1-a.jahangirzad@gmail.com
[ rjw: Changelog tweaks, local variable definitions ordering adjustments ]
Fixes: 8cfb0cdf07 ("ACPI / debugger: Add IO interface to access debugger functionalities")
Cc: 4.5+ <stable@vger.kernel.org> # 4.5+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-23 15:45:28 +02:00
Huisong Li
559f2eacc8 ACPI: processor: Do not expose global variable acpi_idle_driver
Move the cpuidle driver check from __acpi_processor_start() to
acpi_processor_power_init() which allows variable acpi_idle_driver to
become static.

No intentional functional impact.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Link: https://patch.msgid.link/20250923032428.2656329-2-lihuisong@huawei.com
[ rjw: Subject tweak, new changelog, adjustment of a new comment ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-23 15:33:19 +02:00
Marc Zyngier
5669d92f3e ACPI: GTDT: Generate platform devices for MMIO timers
In preparation for the MMIO timer support code becoming an actual
driver, mimic what is done for the SBSA watchdog and expose
a synthetic device for each MMIO timer block.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20250807160243.1970533-2-maz@kernel.org
2025-09-23 12:30:25 +02:00
Chen Pei
4d330fe541 ACPI: SPCR: Support Precise Baud Rate field
The Microsoft Serial Port Console Redirection (SPCR) specification
revision 1.09 comprises additional field: Precise Baud Rate [1].

It is used to describe non-traditional baud rates (such as those
used by high-speed UARTs).

It contains a specific non-zero baud rate which overrides the value
of the Configured Baud Rate field. If this field is zero or not
present, Configured Baud Rate is used.

Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table [1]
Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
Link: https://patch.msgid.link/20250913070815.16758-1-cp0613@linux.alibaba.com
[ rjw: Corrected typo in the subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-22 19:13:08 +02:00
Rafael J. Wysocki
fbd401e95e ACPI: processor: idle: Redefine two functions as void
Notice that acpi_processor_power_init() and acpi_processor_power_exit()
don't need to return any values because their callers don't check them
anyway, so redefine those functions as void.

While at it, rearrange the code in acpi_processor_power_init() to
reduce the indentation level, get rid of a redundant local variable
in that function, and rephrase a code comment in it.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
2025-09-19 22:49:49 +02:00
Rafael J. Wysocki
8a1b5d412c ACPI: processor: Update cpuidle driver check in __acpi_processor_start()
Commit 7a8c994cbb ("ACPI: processor: idle: Optimize ACPI idle
driver registration") moved the ACPI idle driver registration to
acpi_processor_driver_init() and acpi_processor_power_init() does
not register an idle driver any more.

Accordingly, the cpuidle driver check in __acpi_processor_start() needs
to be updated to avoid calling acpi_processor_power_init() without a
cpuidle driver, in which case the registration of the cpuidle device
in that function would lead to a NULL pointer dereference in
__cpuidle_register_device().

Fixes: 7a8c994cbb ("ACPI: processor: idle: Optimize ACPI idle driver registration")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Link: https://patch.msgid.link/5044465.31r3eYUQgx@rafael.j.wysocki
[ rjw: Changelog update ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-19 22:49:49 +02:00
Rafael J. Wysocki
0f83b1d436 ACPI: property: Adjust failure handling in acpi_nondev_subnode_extract()
Make acpi_nondev_subnode_extract() follow the usual code flow pattern
in which failure is handled at the point where it is detected.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2025-09-16 19:51:37 +02:00
Rafael J. Wysocki
baf60d5cb8 ACPI: property: Do not pass NULL handles to acpi_attach_data()
In certain circumstances, the ACPI handle of a data-only node may be
NULL, in which case it does not make sense to attempt to attach that
node to an ACPI namespace object, so update the code to avoid attempts
to do so.

This prevents confusing and unuseful error messages from being printed.

Also document the fact that the ACPI handle of a data-only node may be
NULL and when that happens in a code comment.  In addition, make
acpi_add_nondev_subnodes() print a diagnostic message for each data-only
node with an unknown ACPI namespace scope.

Fixes: 1d52f10917 ("ACPI: property: Tie data nodes to acpi handles")
Cc: 6.0+ <stable@vger.kernel.org> # 6.0+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2025-09-16 19:51:37 +02:00
Rafael J. Wysocki
737c3a09dc ACPI: property: Add code comments explaining what is going on
In some places in the ACPI device properties handling code, it is
unclear why the code is what it is.  Some assumptions are not documented
and some pieces of code are based on knowledge that is not mentioned
anywhere.

Add code comments explaining these things.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2025-09-16 19:51:37 +02:00
Rafael J. Wysocki
d06118fe9b ACPI: property: Disregard references in data-only subnode lists
Data-only subnode links following the ACPI data subnode GUID in a _DSD
package are expected to point to named objects returning _DSD-equivalent
packages.  If a reference to such an object is used in the target field
of any of those links, that object will be evaluated in place (as a
named object) and its return data will be embedded in the outer _DSD
package.

For this reason, it is not expected to see a subnode link with the
target field containing a local reference (that would mean pointing
to a device or another object that cannot be evaluated in place and
therefore cannot return a _DSD-equivalent package).

Accordingly, simplify the code parsing data-only subnode links to
simply print a message when it encounters a local reference in the
target field of one of those links.

Moreover, since acpi_nondev_subnode_data_ok() would only have one
caller after the change above, fold it into that caller.

Link: https://lore.kernel.org/linux-acpi/CAJZ5v0jVeSrDO6hrZhKgRZrH=FpGD4vNUjFD8hV9WwN9TLHjzQ@mail.gmail.com/
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2025-09-16 19:51:37 +02:00
Rafael J. Wysocki
d0759b1098 ACPI: property: Fix buffer properties extraction for subnodes
The ACPI handle passed to acpi_extract_properties() as the first
argument represents the ACPI namespace scope in which to look for
objects returning buffers associated with buffer properties.

For _DSD objects located immediately under ACPI devices, this handle is
the same as the handle of the device object holding the _DSD, but for
data-only subnodes it is not so.

First of all, data-only subnodes are represented by objects that
cannot hold other objects in their scopes (like control methods).
Therefore a data-only subnode handle cannot be used for completing
relative pathname segments, so the current code in
in acpi_nondev_subnode_extract() passing a data-only subnode handle
to acpi_extract_properties() is invalid.

Moreover, a data-only subnode of device A may be represented by an
object located in the scope of device B (which kind of makes sense,
for instance, if A is a B's child).  In that case, the scope in
question would be the one of device B.  In other words, the scope
mentioned above is the same as the scope used for subnode object
lookup in acpi_nondev_subnode_extract().

Accordingly, rearrange that function to use the same scope for the
extraction of properties and subnode object lookup.

Fixes: 103e10c69c ("ACPI: property: Add support for parsing buffer property UUID")
Cc: 6.0+ <stable@vger.kernel.org> # 6.0+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2025-09-16 19:51:37 +02:00
Colin Ian King
d1a599a813 ACPI: NFIT: Fix incorrect ndr_desc being reportedin dev_err message
There appears to be a cut-n-paste error with the incorrect field
ndr_desc->numa_node being reported for the target node. Fix this by
using ndr_desc->target_node instead.

Fixes: f060db9937 ("ACPI: NFIT: Use fallback node id when numa info in NFIT table is incorrect")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
2025-09-16 10:57:37 -05:00
Chen Pei
bf4206d7ac ACPI: SPCR: Add support for DBG2 RISC-V SBI port subtype
Commit 4aca2bef90 ("ACPICA: Headers: Add RISC-V SBI Subtype to
DBG2") added the definition of ACPI_DBG2_RISCV_SBI_CON.

Continue to implement its function so that the parameters of UART can
be configured correctly.

Subsequent calls to setup_earlycon() will reuse the earlycon based on
SBI.

Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
Reviewed-by: Guo Ren (Alibaba Damo Academy) <guoren@kernel.org>
Link: https://patch.msgid.link/20250910094136.4423-1-cp0613@linux.alibaba.com
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 21:37:40 +02:00
Jiaqi Yan
7d444f5099 ACPI: APEI: EINJ: Allow more types of addresses except MMIO
EINJ driver today only allows injection request to go through for two
kinds of IORESOURCE_MEM: IORES_DESC_PERSISTENT_MEMORY and
IORES_DESC_SOFT_RESERVED. This check prevents user of EINJ to test
memory corrupted in many interesting areas:

 - Legacy persistent memory
 - Memory claimed to be used by ACPI tables or NV storage
 - Kernel crash memory and others

There is need to test how kernel behaves when something consumes memory
errors in these memory regions. For example, if certain ACPI table is
corrupted, does kernel crash gracefully to prevent "silent data
corruption". For another example, legacy persistent memory, when managed
by Device DAX, does support recovering from Machine Check Exception
raised by memory failure, hence worth to be tested.

However, attempt to inject memory error via EINJ to legacy persistent
memory or ACPI owned memory fails with -EINVAL.

Allow EINJ to inject at address except it is MMIO. Leave it to the BIOS
or firmware to decide what is a legitimate injection target.

In addition to the test done in [1], on a machine having the following
iomem resources:

    ...
    01000000-08ffffff : Crash kernel
    768f0098-768f00a7 : APEI EINJ
    ...
  768f4000-77323fff : ACPI Non-volatile Storage
  77324000-777fefff : ACPI Tables
  777ff000-777fffff : System RAM
  77800000-7fffffff : Reserved
  80000000-8fffffff : PCI MMCONFIG 0000 [bus 00-ff]
  90040000-957fffff : PCI Bus 0000:00
  ...
  300000000-3ffffffff : Persistent Memory (legacy)
  ...

I commented __einj_error_inject during the test and just tested when
injecting a memory error at each start address shown above:
- 0x80000000 and 0x90040000 both failed with EINVAL
- request passed through for all other addresses

Link: https://lore.kernel.org/linux-acpi/20250825223348.3780279-1-jiaqiyan@google.com [1]
Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Link: https://patch.msgid.link/20250910044531.264043-1-jiaqiyan@google.com
[ rjw: Adding a link tag for the [1] reference ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 21:32:29 +02:00
Thorsten Blum
e06722a9df ACPI: APEI: Remove redundant assignments in erst_dbg_{ioctl|write}()
Use the result of copy_from_user() directly instead of assigning it to
the local variable 'rc' and then overwriting it in erst_dbg_write() or
immediately returning from erst_dbg_ioctl().

No intentional functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Link: https://patch.msgid.link/20250903224913.242928-2-thorsten.blum@linux.dev
[ rjw: Changelog edit ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 21:21:57 +02:00
Saket Dumbre
81f92cff6d ACPICA: ACPI_TYPE_ANY does not include the package type
So add it to the list of acceptable Arg3 types for _DSM.

Link: https://github.com/acpica/acpica/commit/6eb81e7c
Signed-off-by: Saket Dumbre <saket.dumbre@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 12:20:13 +02:00
Dmitry Antipov
8ca944fea4 ACPICA: Fix largest possible resource descriptor index
ACPI_RESOURCE_NAME_LARGE_MAX should be equal to the last actually
used resource descriptor index (ACPI_RESOURCE_NAME_CLOCK_INPUT).

Otherwise 'resource_index' in 'acpi_ut_validate_resource()' may be
clamped incorrectly and resulting value may issue an out-of-bounds
access for 'acpi_gbl_resource_types' array. Compile tested only.

Fixes: 520d4a0ee5 ("ACPICA: add support for ClockInput resource (v6.5)")
Link: https://github.com/acpica/acpica/commit/cf00116c
Link: https://marc.info/?l=linux-acpi&m=175449676131260&w=2
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 12:20:13 +02:00
Saket Dumbre
e2c80b3c23 ACPICA: Print error messages for too few or too many arguments
Fix Issue #1027 by displaying error messages when there are too few or
too many arguments in the caller vs the definition of an ASL/AML method.

Link: https://github.com/acpica/acpica/commit/cbc243e4
Reported-by: Peter Williams <peter@newton.cx>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Saket Dumbre <saket.dumbre@intel.com>
2025-09-15 12:20:13 +02:00
Saket Dumbre
761dc71c60 ACPICA: Update dsmethod.c to get rid of unused variable warning
All the 3 major C compilers (MSVC, GCC, LLVM/Clang) warn about
the unused variable i after the removal of its usage by PR #1031
addressing Issue #1027

Link: https://github.com/acpica/acpica/commit/6d235320
Signed-off-by: Saket Dumbre <saket.dumbre@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 12:20:13 +02:00
Hans de Goede
e9dff11a7a ACPICA: dispatcher: Use acpi_ds_clear_operands() in acpi_ds_call_control_method()
When deleting the previous walkstate operand stack
acpi_ds_call_control_method() was deleting obj_desc->Method.param_count
operands. But Method.param_count does not necessarily match
this_walk_state->num_operands, it may be either less or more.

After correcting the for loop to check `i < this_walk_state->num_operands`
the code is identical to acpi_ds_clear_operands(), so just outright
replace the code with acpi_ds_clear_operands() to fix this.

Link: https://github.com/acpica/acpica/commit/53fc0220
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 12:20:13 +02:00
Ahmed Salem
22c65572ef ACPICA: Debugger: drop ACPI_NONSTRING attribute from name_seg
ACPICA commit 4623b3369f3aa1ec5229d461e91c514510a96912

Partially revert commit 70662db73d ("ACPICA: Apply ACPI_NONSTRING in
more places") as I've yet again incorrectly applied the ACPI_NONSTRING
attribute where it is not needed.

A warning was initially reported by Collin Funk [1], and further review
by Jiri Slaby [2] highlighted another issue related to the same commit.

Drop the ACPI_NONSTRING attribute to fix the issue.

Fixes: 70662db73d ("ACPICA: Apply ACPI_NONSTRING in more places")
Link: https://lore.kernel.org/all/87ecvpcypw.fsf@gmail.com [1]
Link: https://lore.kernel.org/all/5c210121-c9b8-4458-b1ad-0da24732ac72@kernel.org [2]
Link: https://github.com/acpica/acpica/commit/4623b336
Reported-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
Cc: 6.16+ <stable@vger.kernel.org> # 6.16+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 12:20:12 +02:00
Ahmed Salem
4b020eff66 ACPICA: iASL: Fix printing CDAT table header
When disassembling CDAT AML, the lack of CDAT's common ACPI table header
should be taken into consideration when printing the table's actual
header. As the table header lacks fields like Signature, header
information is mangled and incorrect:

 # $ iasl -d -ds CDAT cdat.aml
 # Input file cdat.aml, Length 0xE4 (228) bytes
 # ACPI: ?    0x0000000000000000 000C01 (v00        ?        00180000 ??   23456789)

Both Signature and Length are printed incorrectly, and the remaining
fields are not applicable for this special table. To fix this, verify
acpi_gbl_CDAT is set (<-ds CDAT> via command line) and Header->Signature
is an invalid nameseg (due to the presence of non-ASCII char(s)), then
print only the explicitly-passed signature (ACPI_SIG_CDAT) and the table
length as cast with a pointer to the struct acpi_table_cdat structure.

Link: https://github.com/acpica/acpica/commit/2b5586b4
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 12:20:12 +02:00
Huacai Chen
feb8ae81b2 ACPICA: Allow to skip Global Lock initialization
Introduce acpi_gbl_use_global_lock, which allows to skip the Global Lock
initialization. This is useful for systems without Global Lock (such as
loong_arch), so as to avoid error messages during boot phase:

 ACPI Error: Could not enable global_lock event (20240827/evxfevnt-182)
 ACPI Error: No response from Global Lock hardware, disabling lock (20240827/evglock-59)

Link: https://github.com/acpica/acpica/commit/463cb0fe
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 12:20:12 +02:00