[PATCH RFC 00/15] arm-mpam: Add basic device tree support for resctrl

Yin Li <[email protected]>
Newsgroups dev.linux.lists.driver-core,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <20260811-mpam-resctrl-dt-knp-support-v1-0-ea6397bead59@oss.qualcomm.com>
Notes for James, Shanker and Rob
--------------------------------
This series builds directly on your not-yet-upstream MPAM snapshot
patches from the mpam/snapshot+extras/v6.18-rc1 branch. Two things I'd
like your guidance on:

1. Do you mind us picking these up and continuing to extend them? We have
   kept the original authorship and Signed-off-by intact and documented
   the inherited-vs-new split below. If you would prefer a different
   attribution arrangement, or have your own plans to upstream MPAM DT
   support, please let us know so we can avoid duplicating effort.

2. The fixes to the inherited patches are kept as small, self-contained
   patches on top, purely to make review easier. Since fixes to
   not-yet-upstream patches would normally be squashed into the original
   commit by its author, please point out which of these you would like
   folded back, and we will reorganize accordingly.

Rob kindly provided some early off-list feedback on an earlier draft,
which this series has tried to address.

Add Arm MPAM resctrl basic device tree support.

Arm Memory System Resource Partitioning and Monitoring (MPAM) with
resctrl requires device tree (DT) support as a prerequisite before any
higher-level functionality can be enabled. This series provides the
foundational DT binding and parsing support for MPAM, laying the
groundwork for subsequent features such as MPAM Firmware-backed
(MPAM-FB) partitioning.

The patches are based on earlier work by James Morse, Shanker
Donthineni and Rob Herring, with fixes and additions on top:

Inherited (authorship preserved, with fixes noted in each patch):
- dt-bindings: MPAM MSC binding [1]
- cacheinfo: expose cache-id generation from a device_node [2]
- arm_mpam: device tree support for MSC probing [3]
- arm_mpam: memory controller MSC support on DT platforms [4]

New on top:
- standalone fixes extracted from the inherited patches (device_node
  refcount, cache-id sentinel/type, RIS index range checks, MSC window
  size, accessibility return type, foundling MSC creation, cache-id
  error path)
- dt-bindings: schema and example fixes
- arm_mpam: derive MSC accessibility from per-RIS nodes as a fallback

[1] https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/commit/?h=mpam/snapshot+extras/v6.18-rc1&id=b38bed339681
[2] https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/commit/?h=mpam/snapshot+extras/v6.18-rc1&id=2af39084438c
[3] https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/commit/?h=mpam/snapshot+extras/v6.18-rc1&id=a6ab8b6c77cb
[4] https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/commit/?h=mpam/snapshot+extras/v6.18-rc1&id=c1be40782ace

DT affinity model
-----------------
An MSC node is nested under the device it partitions or monitors. For a
cache MSC this is the cache node, so the MSC's CPU affinity is derived
from its parent cache; for a memory-controller MSC the parent is the
memory device, which is accessible from all CPUs. A per-RIS fallback is
also provided: when an MSC sits under a generic container with no
affinity-bearing parent, affinity is resolved from an explicit 'cpus'
phandle or an 'arm,mpam-device' phandle on each RIS node.

The Kaanapali DTS patch is for local enabling and verification only and
cannot be upstreamed: the platform is already upstream with a public
device tree, and production firmware does not allow the OS to write the
MSC registers, so this path only works on a local test setup. The MSC
nodes are disabled by default, serving as a reference example for other
platform DT authors.

Signed-off-by: Yin Li <[email protected]>
---
To: James Morse <[email protected]>
To: Rob Herring <[email protected]>
To: Shanker Donthineni <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Ben Horgan <[email protected]>
To: Conor Dooley <[email protected]>
To: Greg Kroah-Hartman <[email protected]>
To: "Rafael J. Wysocki" <[email protected]>
To: Danilo Krummrich <[email protected]>
To: Reinette Chatre <[email protected]>
To: Fenghua Yu <[email protected]>
To: Bjorn Andersson <[email protected]>
To: Konrad Dybcio <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Srivathsa L Rao <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Srivathsa L Rao <[email protected]>

---
James Morse (2):
      cacheinfo: Expose the code to generate a cache-id from a device_node
      arm_mpam: Add device tree support for MSC probing

Rob Herring (1):
      dt-bindings: arm: Add MPAM MSC binding

Shanker Donthineni (1):
      arm_mpam: Add support for memory controller MSC on DT platforms

Yin Li (11):
      arm_mpam: Fix device_node refcount in DT resource parsing
      arm_mpam: Fix cache ID sentinel from ~0UL to U32_MAX to match u32 return type
      arm_mpam: Fix the RIS index range check in mpam_ris_create_locked
      arm_mpam: Fix ris_idx type to prevent range check bypass on truncation
      arm_mpam: Fix MSC MMIO window size to use resource_size() instead of end - start
      arm_mpam: Fix update_msc_accessibility() return type to void
      arm_mpam: Fix mpam_dt_create_foundling_msc() to create MSC platform devices
      arm_mpam: Fix get_cpumask_from_cache() to clear mask on error
      dt-bindings: arm: Fix MPAM MSC binding schema and examples
      arm_mpam: Support MSC accessibility derivation from RIS nodes
      [DNM] arm64: dts: qcom: kaanapali: Add MPAM MSC nodes for the L2 caches

 .../devicetree/bindings/arm/arm,mpam-msc.yaml      | 202 +++++++++++
 arch/arm64/boot/dts/qcom/kaanapali.dtsi            |  50 ++-
 drivers/base/cacheinfo.c                           |  19 +-
 drivers/resctrl/mpam_devices.c                     | 401 +++++++++++++++++++--
 drivers/resctrl/mpam_internal.h                    |   2 +-
 include/linux/arm_mpam.h                           |   4 +-
 include/linux/cacheinfo.h                          |   3 +
 7 files changed, 638 insertions(+), 43 deletions(-)
---
base-commit: 3d08ff75a47a3e7e2ab45a3bcab6723b4d906422
change-id: 20260731-mpam-resctrl-dt-knp-support-c15dcc3a4a98

Best regards,
--  
Yin Li <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.