Skip to content

Please merge MPAM branch 26.04 linux nvidia.glue.others.cpu less.hardlimit into 7.0 hwe#419

Open
fyu1 wants to merge 115 commits into
NVIDIA:26.04_linux-nvidiafrom
fyu1:26.04_linux-nvidia.glue.others.cpu_less.hardlimit
Open

Please merge MPAM branch 26.04 linux nvidia.glue.others.cpu less.hardlimit into 7.0 hwe#419
fyu1 wants to merge 115 commits into
NVIDIA:26.04_linux-nvidiafrom
fyu1:26.04_linux-nvidia.glue.others.cpu_less.hardlimit

Conversation

@fyu1
Copy link
Copy Markdown
Collaborator

@fyu1 fyu1 commented May 14, 2026

This MPAM branch is based on 7.0 hwe:

  1. The first 47 patches are cherry picked from 7.1-rc upstream for MPAM part 2 glue series;
  2. The patch 48 enable RESCTRL_FS in annotations
  3. The patches 49-114 are VR features (iommu, cmin/cmax, cpu-less and hardlimit) and are forward ported from 6.17 hwe kernel.
  4. The patch 115 fixes a couple of bugs on Grace.

Please review the PR and consider merging it into 7.0 hwe.

Thank you!

-Fenghua

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

PR Validation Report

Patchscan ✅ No Missing Fixes

All cherry-picked commits checked — no missing upstream fixes found.

PR Lint ❌ Errors found

Details
Checking 115 commits...

Cherry-pick digest:
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local        │ Referenced upstream / Patch subject                              │ Patch-ID   │ Subject │ SoB chain                 │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 475f355d0408 │ [SAUCE] fix mbm_l3_assign and mon_local_bytes                    │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 65d7ed7fac3a │ [SAUCE] documentation: resctrl: document max_lim and mb_hlim for │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ cb558bd74005 │ [SAUCE] resctrl: add mba max_lim sysfs and visibility from init  │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6fcf89fe046b │ [SAUCE] resctrl/mpam: populate mba mb_max_lim from mpam probe    │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1d481bd718ca │ [SAUCE] resctrl: add membw.mb_max_lim and arch_has_mb_max_lim    │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6353badbca86 │ [SAUCE] resctrl/mpam: bind mb_hlim resource to mba mpam class    │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3fab9aa5901a │ [SAUCE] resctrl/mpam: track mbw max hard-limit in config         │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 049ba6963a3a │ [SAUCE] resctrl/mpam: probe mpamf_mbw_idr max_lim and hardlim_rw │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2c8a9379738d │ [SAUCE] resctrl: wire mb_hlim schemata parsing and group setup   │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b723c7e6de9b │ [SAUCE] resctrl: add mb_hlim resource id and schema type         │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2f8ad7b1230a │ [SAUCE] iommu/arm-smmu-v3: fix mpam for indentity-mappings       │ N/A        │ N/A     │ sdonthin, fenghuay        │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3e04efc960a7 │ [SAUCE] resctrl/mpam: reset ris by applying explicit default con │ N/A        │ N/A     │ sdonthin, fenghuay        │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7b957b75bab1 │ [SAUCE] arm_mpam: include all associated                         │ N/A        │ N/A     │ sdonthin, fenghuay        │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ be85015f769e │ [SAUCE] arm_mpam: handle cpu-less numa nodes                     │ N/A        │ N/A     │ sdonthin, fenghuay        │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ a4c9c30922f7 │ [SAUCE] arm_mpam: avoid msc teardown for the sw programming erro │ N/A        │ N/A     │ sdonthin, fenghuay        │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ dfc5316eef3b │ [SAUCE] arm_mpam: resctrl: add the glue code to convert to/from  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8f73325a1ac7 │ [SAUCE] fs/resctrl: add l2 and l3 'max' resource schema          │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c4b427ff8459 │ [SAUCE] fs/resctrl: expose the schema format to user-space       │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3121c3ebd769 │ [SAUCE] fs/resctrl: add fflags_from_schema() for files based on  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ fa292d386ec9 │ [SAUCE] fs/resctrl: add additional files for percentage and bitm │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 0eb3d97abc59 │ [SAUCE] fs/resctrl: remove 'range' schema format                 │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 418b1eb61c2b │ [SAUCE] arm_mpam: resctrl: convert mb resource to use percentage │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 89f91ff44448 │ [SAUCE] x86/resctrl: move over to specifying mba control formats │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9861237cab4c │ [SAUCE] fs/resctrl: add specific schema types for 'range'        │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 646c7ae0b5b3 │ [SAUCE] fs/resctrl: use schema format to check the resource is a │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ f59372d1dfff │ [SAUCE] fs/resctrl: add a schema format to the schema, allowing  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7ce0bf1ccbe8 │ [SAUCE] fs/resctrl: rename resctrl_get_default_ctrl() to include │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 5531a97de851 │ [SAUCE] fs/resctrl: move mba supported check to parse_line() ins │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9929d500742b │ [SAUCE] fs/resctrl: abstract duplicate domain test to a helper   │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b5c53160da5f │ [SAUCE] fs/resctrl: group all the mba specific properties in a s │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ de7a05a2774d │ [SAUCE] arm_mpam: rename mbw conversion to 'fract16' for code re │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7161cdb24aad │ [SAUCE] arm_mpam: allow cmax/cmin to be configured               │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 573d10fceb28 │ [SAUCE] fs/resctrl: uniform data type of component_id/domid/id/c │ N/A        │ N/A     │ nie, morse, fenghuay      │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 27a33ff1a855 │ [SAUCE] fs/restrl: allow the overflow handler to be disabled     │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 66c73d663734 │ [SAUCE] arm_mpam: resctrl: determine if any exposed counter can  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 20f1f56ee8bf │ [SAUCE] x86/resctrl: add stub to allow other architecture to dis │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 74270b20e5e3 │ [SAUCE] untested: mpam: convert pcc_channels list to xarray and  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 42757601a02d │ [SAUCE] arm_mpam: allow duplicate pcc subspace_ids               │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e4930378ebf9 │ [SAUCE] arm_mpam: add mpam-fb msc firmware access support        │ N/A        │ N/A     │ przywara, morse, fenghuay │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ aed9791a593e │ [SAUCE] firmware: arm_scmi: add mpam-fb scmi protocol stub       │ N/A        │ N/A     │ przywara, morse, fenghuay │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c6ab75560bb8 │ [SAUCE] fs/resctrl: add support for assigning iommu_groups to re │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1040b3a8f8e9 │ [SAUCE] arm_mpam: resctrl: add iommu helpers to get/set the part │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 032978dca060 │ [SAUCE] kobject: add kset_get_next_obj() to allow a kset to be w │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 71baec24a6fc │ [SAUCE] iommu: add helper to retrieve iommu kset                 │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ edd415b2eb4f │ [SAUCE] iommu: add helpers to retrieve iommu_groups by id or kob │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d8833a44faac │ [SAUCE] iommu: add helpers to get and set the qos state          │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d49f01485681 │ [SAUCE] iommu/arm-smmu-v3: add mpam helpers to query and set sta │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7386548fb100 │ [SAUCE] iommu/arm-smmu-v3: register smmu capabilities with mpam  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ a0482194fb96 │ [SAUCE] fs/resctrl: add this_is_not_abi mount option             │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ f8daf5cbde06 │ [SAUCE] arm_mpam: allow msc to be forced to have an unknown loca │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 434f0c926091 │ [SAUCE] arm_mpam: allow the maximum partid to be overridden from │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 17a769b16b03 │ [SAUCE] arm_mpam: split the locking around the mon_sel registers │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 52bb8908d046 │ [SAUCE] fs/resctrl,x86/resctrl: factor mba rounding to be per-ar │ N/A        │ N/A     │ Martin, morse, fenghuay   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 39be102ddcc3 │ [SAUCE] arm_mpam: add resctrl_arch_round_bw()                    │ N/A        │ N/A     │ Martin, morse, fenghuay   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 906c88e57a68 │ [SAUCE] arm_mpam: expose the number of nrdy retries in debugfs   │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c4e649fea61c │ [SAUCE] arm_mpam: add force-disable debugfs trigger              │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9acc219bab12 │ [SAUCE] arm_mpam: add debugfs entries to show the msc/ris the dr │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7ce35e0ad620 │ [SAUCE] debugfs: add helpers for creating cpumask entries in deb │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 465b8ee3710b │ [SAUCE] fs/resctrl: avoid a race with dom_data_exit() and rmid_p │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ bc1ce80fc011 │ [SAUCE] fs/resctrl: avoid a race with dom_data_exit() and closid │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c0fe87972f3e │ [SAUCE] arm_mpam: resctrl: add resctrl_arch_cntr_read() & resctr │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 77c933a088a8 │ [SAUCE] arm_mpam: resctrl: add resctrl_arch_rmid_read() and resc │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 668c1243ab33 │ [SAUCE] arm_mpam: resctrl: add resctrl_arch_config_cntr() for ab │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e06479d310d8 │ [SAUCE] arm_mpam: resctrl: add kunit test for abmc/cdp interacti │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e520145bf91c │ [SAUCE] arm_mpam: resctrl: pre-allocate assignable monitors      │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d653685bdf31 │ [SAUCE] arm_mpam: resctrl: pre-allocate free running monitors    │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c673322fc725 │ [SAUCE] untested: arm_mpam: resctrl: pick classes for use as mbm │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 75d4de9e87cf │ [SAUCE] update annotations to set config_resctrl_fs              │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 4a62598f71fd │ 4d5bbbafc170 arm_mpam: resctrl: Make resctrl_mon_ctx_waiters sta │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 594306027b3e │ 67c0a487efa5 arm_mpam: resctrl: Fix the check for no monitor com │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ f882f42d275c │ f758340da529 arm_mpam: resctrl: Fix MBA CDP alloc_capable handli │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 573123304cb4 │ 79727019ce3d fs/resctrl: Add missing return value descriptions   │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 068050b12092 │ c611752be9d7 MAINTAINERS: Update resctrl entry                   │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3fe1d937265a │ d2bf45d067c7 fs/resctrl: Add "*" shorthand to set io_alloc CBM f │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ bcb41697d432 │ d06b8e7c97c3 fs/resctrl: Report invalid domain ID when parsing i │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 4664c58538ae │ 4ce0a2ccc035 arm64: mpam: Add initial MPAM documentation         │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3b4acd320d9b │ aeb8595a5f8b arm_mpam: Quirk CMN-650's CSU NRDY behaviour        │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 10792e863569 │ dc48eb1ff27c arm_mpam: Add workaround for T241-MPAM-6            │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8e795b74a210 │ a7efe23ed6dd arm_mpam: Add workaround for T241-MPAM-4            │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c7e5a30d16c8 │ 70e81fbedc65 arm_mpam: Add workaround for T241-MPAM-1            │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ ece939c0fd52 │ fa7745218c98 arm_mpam: Add quirk framework                       │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9cb919d7b81e │ fb481ec08699 arm_mpam: resctrl: Call resctrl_init() on platforms │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 0bbfc0145fea │ 4aab135bda16 arm64: mpam: Select ARCH_HAS_CPU_RESCTRL            │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1a287f8bd40f │ ec9a788620be ALSA: usb-audio: Replace hard-coded number with MAX │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 581305c7e9cb │ efc775eadce2 arm_mpam: resctrl: Add empty definitions for assort │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 812ea7b36935 │ 49b04e401825 arm_mpam: resctrl: Update the rmid reallocation lim │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 864fa5794d24 │ fb56b29932ca arm_mpam: resctrl: Add resctrl_arch_rmid_read()     │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 658399c34655 │ 2a3c79c61539 arm_mpam: resctrl: Allow resctrl to allocate monito │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2ef3779ca8e8 │ 1458c4f05335 arm_mpam: resctrl: Add support for csu counters     │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 525443bd5c05 │ 264c285999fc arm_mpam: resctrl: Add monitor initialisation and d │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ aa243ac0f2d4 │ 5dc8f73eaa5d arm_mpam: resctrl: Add kunit test for control forma │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 57d50d780a4a │ 36528c7681b8 arm_mpam: resctrl: Add support for 'MB' resource    │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e2da3bf9903f │ 1c1e2968a860 arm_mpam: resctrl: Wait for cacheinfo to be ready   │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7b58c9757e13 │ 3e9b35823aab arm_mpam: resctrl: Add rmid index helpers           │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 33377dda2fe9 │ 80d147d29313 arm_mpam: resctrl: Convert to/from MPAMs fixed-poin │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ baecc1eb0abe │ 01a0021f6c39 arm_mpam: resctrl: Hide CDP emulation behind CONFIG │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7c3b4648da12 │ 6789fb99282c arm_mpam: resctrl: Add CDP emulation                │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 465853344c65 │ 9d2e1a99fae5 arm_mpam: resctrl: Add plumbing against arm64 task  │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 39a8356bc7c7 │ 9cd2b522be2c arm_mpam: resctrl: Implement helpers to update conf │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b9dc7e3b30b8 │ 02cc66168788 arm_mpam: resctrl: Add resctrl_arch_get_config()    │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 81c270c0b088 │ 370d166d878d arm_mpam: resctrl: Implement resctrl_arch_reset_all │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c8bf60c4c8ee │ 52a4edb16121 arm_mpam: resctrl: Pick the caches we will use as r │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 244511f0bb33 │ 09e61daf8e96 arm_mpam: resctrl: Add boilerplate cpuhp and domain │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7d4f7f9a7c64 │ 2cf9ca3fae38 arm64: mpam: Add helpers to change a task or cpu's  │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6a0490ffc03c │ 37fe0f984d9c arm64: mpam: Initialise and context switch the MPAM │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3379accac5f2 │ 735dad999905 arm64: mpam: Add cpu_pm notifier to restore MPAM sy │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e10ca7a8e037 │ 831a7f16728c arm64: mpam: Advertise the CPUs MPAM limits to the  │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b427b9fa82c7 │ c544f00a4732 arm64: mpam: Drop the CONFIG_EXPERT restriction     │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6d0c883bbff2 │ 87b78a5d70e8 arm64: mpam: Re-initialise MPAM regs when CPU comes │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 95aeaa4ec701 │ 8e06d04ff1cf arm64: mpam: Context switch the MPAM registers      │ match      │ match   │ preserved + f
...(truncated)

henryZe and others added 25 commits May 14, 2026 00:31
The per-RIS flag, in_reset_state, indicates whether or not the MSC
registers are in reset state, and allows avoiding resetting when they are
already in reset state. However, when mpam_apply_config() updates the
configuration it doesn't update the in_reset_state flag and so even after
the configuration update in_reset_state can be true and mpam_reset_ris()
will skip the actual register restoration on subsequent resets.

Once resctrl has a MPAM backend it will use resctrl_arch_reset_all_ctrls()
to reset the MSC configuration on unmount and, if the in_reset_state flag
is bogusly true, fail to reset the MSC configuration. The resulting
non-reset MSC configuration can lead to persistent performance restrictions
even after resctrl is unmounted.

Fix by clearing in_reset_state to false immediately after successful
configuration application, ensuring that the next reset operation
properly restores MSC register defaults.

Fixes: 09b89d2 ("arm_mpam: Allow configuration to be applied and restored during cpu online")
Signed-off-by: Zeng Heng <[email protected]>
Acked-by: Ben Horgan <[email protected]>
[Horgan: rewrite commit message to not be specific to resctrl unmount]
Signed-off-by: Ben Horgan <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: James Morse <[email protected]>
Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit f91e913)
Signed-off-by: Fenghua Yu <[email protected]>
To indicate that the configuration, of the controls used by resctrl, in a
RIS need resetting to driver defaults the reset flags in mpam_config are
set. However, these flags are only ever set temporarily at RIS scope in
mpam_reset_ris() and hence mpam_cpu_online() will never reset these
controls to default. As the hardware reset is unknown this leads to unknown
configuration when the control values haven't been configured away from the
defaults.

Use the policy that an unset feature configuration bit means reset. In this
way the mpam_config in the component can encode that it should be in reset
state and mpam_reprogram_msc() will reset controls as needed.

Fixes: 09b89d2 ("arm_mpam: Allow configuration to be applied and restored during cpu online")
Signed-off-by: Ben Horgan <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: James Morse <[email protected]>
Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Jesse Chick <[email protected]>
[ morse: Removed unused reset flags from config structure ]
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit a1cb657)
Signed-off-by: Fenghua Yu <[email protected]>
The MPAMSM_EL1 register determines the MPAM configuration for an SMCU. Add
the register definition.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 29fa1be)
Signed-off-by: Fenghua Yu <[email protected]>
When KVM enables or disables MPAM traps to EL2 it clears all other bits in
MPAM2_EL2.  Notably, it clears the partition ids (PARTIDs) and performance
monitoring groups (PMGs). Avoid changing these bits in anticipation of
adding support for MPAM in the kernel. Otherwise, on a VHE system with the
host running at EL2 where MPAM2_EL2 and MPAM1_EL1 access the same register,
any attempt to use MPAM to monitor or partition resources for kernel space
would be foiled by running a KVM guest. Additionally, MPAM2_EL2.EnMPAMSM is
always set to 0 which causes MPAMSM_EL1 to always trap. Keep EnMPAMSM set
to 1 when not in a guest so that the kernel can use MPAMSM_EL1.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Acked-by: Marc Zyngier <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit eda1cd1)
Signed-off-by: Fenghua Yu <[email protected]>
The MPAMSM_EL1 register controls the MPAM labeling for an SMCU, Streaming
Mode Compute Unit. As there is no MPAM support in KVM, make sure MPAMSM_EL1
accesses trigger an UNDEF.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Acked-by: Marc Zyngier <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 2e7c684)
Signed-off-by: Fenghua Yu <[email protected]>
MPAM allows traffic in the SoC to be labeled by the OS, these labels are
used to apply policy in caches and bandwidth regulators, and to monitor
traffic in the SoC. The label is made up of a PARTID and PMG value. The x86
equivalent calls these CLOSID and RMID, but they don't map precisely.

MPAM has two CPU system registers that is used to hold the PARTID and PMG
values that traffic generated at each exception level will use. These can
be set per-task by the resctrl file system. (resctrl is the defacto
interface for controlling this stuff).

Add a helper to switch this.

struct task_struct's separate CLOSID and RMID fields are insufficient to
implement resctrl using MPAM, as resctrl can change the PARTID (CLOSID) and
PMG (sort of like the RMID) separately. On x86, the rmid is an independent
number, so a race that writes a mismatched closid and rmid into hardware is
benign. On arm64, the pmg bits extend the partid.
(i.e. partid-5 has a pmg-0 that is not the same as partid-6's pmg-0).  In
this case, mismatching the values will 'dirty' a pmg value that resctrl
believes is clean, and is not tracking with its 'limbo' code.

To avoid this, the partid and pmg are always read and written as a
pair. This requires a new u64 field. In struct task_struct there are two
u32, rmid and closid for the x86 case, but as we can't use them here do
something else. Add this new field, mpam_partid_pmg, to struct thread_info
to avoid adding more architecture specific code to struct task_struct.
Always use READ_ONCE()/WRITE_ONCE() when accessing this field.

Resctrl allows a per-cpu 'default' value to be set, this overrides the
values when scheduling a task in the default control-group, which has
PARTID 0. The way 'code data prioritisation' gets emulated means the
register value for the default group needs to be a variable.

The current system register value is kept in a per-cpu variable to avoid
writing to the system register if the value isn't going to change.  Writes
to this register may reset the hardware state for regulating bandwidth.

Finally, there is no reason to context switch these registers unless there
is a driver changing the values in struct task_struct. Hide the whole thing
behind a static key. This also allows the driver to disable MPAM in
response to errors reported by hardware. Move the existing static key to
belong to the arch code, as in the future the MPAM driver may become a
loadable module.

All this should depend on whether there is an MPAM driver, hide it behind
CONFIG_ARM64_MPAM.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
CC: Amit Singh Tomar <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 8e06d04)
Signed-off-by: Fenghua Yu <[email protected]>
Now that the MPAM system registers are expected to have values that change,
reprogram them based on the previous value when a CPU is brought online.

Previously MPAM's 'default PARTID' of 0 was always used for MPAM in
kernel-space as this is the PARTID that hardware guarantees to
reset. Because there are a limited number of PARTID, this value is exposed
to user-space, meaning resctrl changes to the resctrl default group would
also affect kernel threads.  Instead, use the task's PARTID value for
kernel work on behalf of user-space too. The default of 0 is kept for both
user-space and kernel-space when MPAM is not enabled.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 87b78a5)
Signed-off-by: Fenghua Yu <[email protected]>
In anticipation of MPAM being useful remove the CONFIG_EXPERT restriction.

This was done to prevent the driver being enabled before the user-space
interface was wired up.

Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: James Morse <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
[ morse: Added second paragraph ]
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit c544f00)
Signed-off-by: Fenghua Yu <[email protected]>
Requesters need to populate the MPAM fields for any traffic they send on
the interconnect. For the CPUs these values are taken from the
corresponding MPAMy_ELx register. Each requester may have a limit on the
largest PARTID or PMG value that can be used. The MPAM driver has to
determine the system-wide minimum supported PARTID and PMG values.

To do this, the driver needs to be told what each requestor's limit is.

CPUs are special, but this infrastructure is also needed for the SMMU and
GIC ITS. Call the helper to tell the MPAM driver what the CPUs can do.

The return value can be ignored by the arch code as it runs well before the
MPAM driver starts probing.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
[ morse: requestor->requester as argued by ispell ]
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 831a7f1)
Signed-off-by: Fenghua Yu <[email protected]>
The MPAM system registers will be lost if the CPU is reset during PSCI's
CPU_SUSPEND.

Add a PM notifier to restore them.

mpam_thread_switch(current) can't be used as this won't make any changes if
the in-memory copy says the register already has the correct value. In
reality the system register is UNKNOWN out of reset.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 735dad9)
Signed-off-by: Fenghua Yu <[email protected]>
The MPAMSM_EL1 sets the MPAM labels, PMG and PARTID, for loads and stores
generated by a shared SMCU. Disable the traps so the kernel can use it and
set it to the same configuration as the per-EL cpu MPAM configuration.

If an SMCU is not shared with other cpus then it is implementation
defined whether the configuration from MPAMSM_EL1 is used or that from
the appropriate MPAMy_ELx. As we set the same, PMG_D and PARTID_D,
configuration for MPAM0_EL1, MPAM1_EL1 and MPAMSM_EL1 the resulting
configuration is the same regardless.

The range of valid configurations for the PARTID and PMG in MPAMSM_EL1 is
not currently specified in Arm Architectural Reference Manual but the
architect has confirmed that it is intended to be the same as that for the
cpu configuration in the MPAMy_ELx registers.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Reviewed-by: James Morse <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 37fe0f9)
Signed-off-by: Fenghua Yu <[email protected]>
…lues

Care must be taken when modifying the PARTID and PMG of a task in any
per-task structure as writing these values may race with the task being
scheduled in, and reading the modified values.

Add helpers to set the task properties, and the CPU default value.  These
use WRITE_ONCE() that pairs with the READ_ONCE() in mpam_get_regval() to
avoid causing torn values.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Cc: Dave Martin <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 2cf9ca3)
Signed-off-by: Fenghua Yu <[email protected]>
resctrl has its own data structures to describe its resources. We can't use
these directly as we play tricks with the 'MBA' resource, picking the MPAM
controls or monitors that best apply. We may export the same component as
both L3 and MBA.

Add mpam_resctrl_res[] as the array of class->resctrl mappings we are
exporting, and add the cpuhp hooks that allocated and free the resctrl
domain structures. Only the mpam control feature are considered here and
monitor support will be added later.

While we're here, plumb in a few other obvious things.

CONFIG_ARM_CPU_RESCTRL is used to allow this code to be built even though
it can't yet be linked against resctrl.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 09e61da)
Signed-off-by: Fenghua Yu <[email protected]>
Systems with MPAM support may have a variety of control types at any point
of their system layout. We can only expose certain types of control, and
only if they exist at particular locations.

Start with the well-known caches. These have to be depth 2 or 3 and support
MPAM's cache portion bitmap controls, with a number of portions fewer than
resctrl's limit.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 52a4edb)
Signed-off-by: Fenghua Yu <[email protected]>
We already have a helper for resetting an mpam class and component.  Hook
it up to resctrl_arch_reset_all_ctrls() and the domain offline path.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 370d166)
Signed-off-by: Fenghua Yu <[email protected]>
Implement resctrl_arch_get_config() by testing the live configuration for a
CPOR bitmap. For any other configuration type return the default.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 02cc661)
Signed-off-by: Fenghua Yu <[email protected]>
resctrl has two helpers for updating the configuration.
resctrl_arch_update_one() updates a single value, and is used by the
software-controller to apply feedback to the bandwidth controls, it has to
be called on one of the CPUs in the resctrl:domain.

resctrl_arch_update_domains() copies multiple staged configurations, it can
be called from anywhere.

Both helpers should update any changes to the underlying hardware.

Implement resctrl_arch_update_domains() to use
resctrl_arch_update_one(). Neither need to be called on a specific CPU as
the mpam driver will send IPIs as needed.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 9cd2b52)
Signed-off-by: Fenghua Yu <[email protected]>
arm64 provides helpers for changing a task's and a cpu's mpam partid/pmg
values.

These are used to back a number of resctrl_arch_ functions. Connect them
up.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 9d2e1a9)
Signed-off-by: Fenghua Yu <[email protected]>
Intel RDT's CDP feature allows the cache to use a different control value
depending on whether the accesses was for instruction fetch or a data
access. MPAM's equivalent feature is the other way up: the CPU assigns a
different partid label to traffic depending on whether it was instruction
fetch or a data access, which causes the cache to use a different control
value based solely on the partid.

MPAM can emulate CDP, with the side effect that the alternative partid is
seen by all MSC, it can't be enabled per-MSC.

Add the resctrl hooks to turn this on or off. Add the helpers that match a
closid against a task, which need to be aware that the value written to
hardware is not the same as the one resctrl is using.

Update the 'arm64_mpam_global_default' variable the arch code uses during
context switch to know when the per-cpu value should be used instead. Also,
update these per-cpu values and sync the resulting mpam partid/pmg
configuration to hardware.

resctrl can enable CDP for L2 caches, L3 caches or both. When it is enabled
by one and not the other MPAM globally enabled CDP but hides the effect
on the other cache resource. This hiding is possible as CPOR is the only
supported cache control and that uses a resource bitmap; two partids with
the same bitmap act as one.

Awkwardly, the MB controls don't implement CDP and CDP can't be hidden as
the memory bandwidth control is a maximum per partid which can't be
modelled with more partids. If the total maximum is used for both the data
and instruction partids then then the maximum may be exceeded and if it is
split in two then the one using more bandwidth will hit a lower
limit. Hence, hide the MB controls completely if CDP is enabled for any
resource.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Cc: Dave Martin <[email protected]>
Cc: Amit Singh Tomar <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 6789fb9)
Signed-off-by: Fenghua Yu <[email protected]>
When CDP is not enabled, the 'rmid_entry's in the limbo list,
rmid_busy_llc, map directly to a (PARTID,PMG) pair and when CDP is enabled
the mapping is to two different pairs. As the limbo list is reused between
mounts and CDP disabled on unmount this can lead to stale mapping and the
limbo handler will then make monitor reads with potentially out of range
PARTID. This may then cause an MPAM error interrupt and the driver will
disable MPAM.

No problems are expected if you just mount the resctrl file system
once with CDP enabled and never unmount it. Hide CDP emulation behind
CONFIG_EXPERT to protect the unwary.

Signed-off-by: Ben Horgan <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: James Morse <[email protected]>
Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 01a0021)
Signed-off-by: Fenghua Yu <[email protected]>
MPAM uses a fixed-point formats for some hardware controls.  Resctrl
provides the bandwidth controls as a percentage. Add helpers to convert
between these.

Ensure bwa_wd is at most 16 to make it clear higher values have no meaning.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Signed-off-by: Dave Martin <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 80d147d)
Signed-off-by: Fenghua Yu <[email protected]>
Because MPAM's pmg aren't identical to RDT's rmid, resctrl handles some
data structures by index. This allows x86 to map indexes to RMID, and MPAM
to map them to partid-and-pmg.

Add the helpers to do this.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Suggested-by: James Morse <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 3e9b358)
Signed-off-by: Fenghua Yu <[email protected]>
In order to calculate the rmid realloc threshold the size of the cache
needs to be known. Cache domains will also be named after the cache id. So
that this information can be extracted from cacheinfo we need to wait for
it to be ready. The cacheinfo information is populated in device_initcall()
so we wait for that.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 1c1e296)
Signed-off-by: Fenghua Yu <[email protected]>
resctrl supports 'MB', as a percentage throttling of traffic from the
L3. This is the control that mba_sc uses, so ideally the class chosen
should be as close as possible to the counters used for mbm_total. If there
is a single L3, it's the last cache, and the topology of the memory matches
then the traffic at the memory controller will be equivalent to that at
egress of the L3. If these conditions are met allow the memory class to
back MB.

MB's percentage control should be backed either with the fixed point
fraction MBW_MAX or bandwidth portion bitmaps. The bandwidth portion
bitmaps is not used as its tricky to pick which bits to use to avoid
contention, and may be possible to expose this as something other than a
percentage in the future.

Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Gavin Shan <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Co-developed-by: Dave Martin <[email protected]>
Signed-off-by: Dave Martin <[email protected]>
Co-developed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 36528c7)
Signed-off-by: Fenghua Yu <[email protected]>
resctrl specifies the format of the control schemes, and these don't match
the hardware.

Some of the conversions are a bit hairy - add some kunit tests.

Tested-by: Gavin Shan <[email protected]>
Tested-by: Shaopeng Tan <[email protected]>
Tested-by: Peter Newman <[email protected]>
Tested-by: Zeng Heng <[email protected]>
Tested-by: Punit Agrawal <[email protected]>
Tested-by: Jesse Chick <[email protected]>
Reviewed-by: Zeng Heng <[email protected]>
Reviewed-by: Shaopeng Tan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Gavin Shan <[email protected]>
Signed-off-by: Dave Martin <[email protected]>
[morse: squashed enough of Dave's fixes in here that it's his patch now!]
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 5dc8f73)
Signed-off-by: Fenghua Yu <[email protected]>
James Morse and others added 22 commits May 14, 2026 00:31
…entage

MPAMs bandwidth controls are both exposed to resctrl as if they take a
percentage. Update the schema format so that user-space can be told this
is a perentage, and files that describe this control format are exposed.
(e.g. min_percent)
Existing variation in this area is covered by requiring user-space to
know if it is running on an Intel or AMD platform. Exposing the schema
format directly will avoid modifying user-space to know it is running
on an MPAM or RISCV platform.
MPAM can also expose bitmap controls for memory bandwidth, which may
become important for use-cases in the future. These are currently converted
to a percentage to fit the existing definition of the MB resource.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 2baa164 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
Resctrl previously had a 'range' schema format that took some kind of
number. This has since been split into percentage, MB/s and an AMD
platform specific scheme.
As range is no longer used, remove it.
The last user is mba_sc which should be described as taking MB/s.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 6c8f021 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
…d bitmap controls

MPAM has cache capacity controls that effectively take a percentage.
Resctrl supports percentages, but the collection of files that are
exposed to describe this control belong to the MB resource.
To find the minimum granularity of the percentage cache capacity controls,
user-space is expected to rad the banwdidth_gran file, and know this has
nothing to do with bandwidth.
The only problem here is the name of the file. Add duplicates of these
properties with percentage and bitmap in the name. These will be exposed
based on the schema format.
The existing files must remain tied to the specific resources so that
they remain visible to user-space. Using the same helpers ensures the
values will always be the same regardless of the file used.
These files are not exposed until the new RFTYPE schema flags are
set on a resource 'fflags'.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit a38c116 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/internal.h`;
]
Signed-off-by: Fenghua Yu <[email protected]>
…ed on schema format

MPAM has cache capacity controls that effectively take a percentage.
Resctrl supports percentages, but the collection of files that are
exposed to describe this control belong to the MB resource. New files
have been added that are selected based on the schema format.
Apply the flags to enable these files based on the schema format.
Add a new fflags_from_schema() that is used for controls.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit db00568 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/rdtgroup.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
If more schemas are added to resctrl, user-space needs to know how to
configure them. To allow user-space to configure schema it doesn't know
about, it would be helpful to tell user-space the format, e.g. percentage.
Add a file under info that describes the schema format.
Percentages and 'mbps' are implicitly decimal, bitmaps are expected to be
in hex.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit f0ae691 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/rdtgroup.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
MPAM can have both cache portion and cache capacity controls on any cache
that supports MPAM. Cache portion bitmaps can be exposed via resctrl if
they are implemented on L2 or L3.
The cache capacity controls can not be used to isolate portions, which is
in implicit in the L2 or L3 bitmap provided by user-space. These controls
need to be configured with something more like a percentage.
Add the resource enum entries for these two resources. No additional
resctrl code is needed because the architecture code will specify this
resource takes a 'percentage', re-using the support previously used only
for the MB resource.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 2e9f961 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `include/linux/resctrl.h`;
]
Signed-off-by: Fenghua Yu <[email protected]>
…/from cmax

MPAM's maximum cache-capacity controls take a fixed point fraction format.
Instead of dumping this on user-space, convert it to a percentage.
User-space using resctrl already knows how to handle percentages.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 10caa12 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
…g errors

No need to destory MSC instance for the user/admin programming errors
sicne it's not causing any functional issues.

Signed-off-by: Shanker Donthineni <[email protected]>
(cherry picked from commit 7d348a2 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
In a NUMA system, each node may include CPUs, memory, MPAM MSC
instances, or any combination thereof. Some high-end servers may
have NUMA nodes that include MPAM MSC but no CPUs. In such cases,
associate all possible CPUs for those MSCs.

Signed-off-by: Shanker Donthineni <[email protected]>
(cherry picked from commit 95f0fd8 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
The current MPAM driver only considers the first component associated
with an online/offline CPU during domain creation and teardown. This
is insufficient, as CPU-initiated traffic may traverse multiple MSCs
before reaching the target, and each MSC must be programmed consistently
for proper resource partitioning.

Update the MPAM driver to include all components associated with a
given CPU during domain setup/teardown to expose expected schemata
to userspace for effective resource control.

Signed-off-by: Shanker Donthineni <[email protected]>
(forward ported from commit ac1e5be https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Leaves drivers/resctrl/mpam_internal.h untouched; mpam_resctrl_offline_cpu()
    is already void in the baseline used here.
  - Tightens callers (mpam_resctrl_pick_mba, mpam_resctrl_pick_counters) around
    traffic_matches_l3() together with topology_matches_l3() and
    cpumask_equal(&class->affinity, cpu_possible_mask) and does not add a
    traffic_matches_l3() function body here, which is already defined in
    upstream.
  - Omits any edit to exposed_alloc_capable or exposed_mon_capable; those
    symbols are already absent from the baseline in favor of
    resctrl_arch_alloc_capable() / resctrl_arch_mon_capable().
  - Adds for_each_mpam_resctrl_control() only; does not add MPAM_MAX_EVENT or a
    new for_each_mpam_resctrl_mon() / mpam_resctrl_counters[] sizing hunk
    because that monitor macro and array shape are already in the baseline.
  - Omits INIT_LIST_HEAD_RCU() on res->resctrl_res.ctrl_domains and
    mon_domains, omits moving mpam_resctrl_domain_insert() after
    resctrl_online_*(), and omits adding static void
    mpam_resctrl_online_domain_hdr(); that list setup and insert ordering are
    already in the baseline.
  - Does not replay a void→int conversion for mpam_resctrl_monitor_init() or a
    mpam_pmg_max + 1 num_rmid path; the baseline already has int-returning
    mpam_resctrl_monitor_init() and resctrl_arch_system_num_rmid_idx() for
    num_rmid, so only surrounding line context shifts in this file.
  - Adds for_each_mpam_resctrl_control(), mpam_resctrl_mon_from_res() /
    mpam_resctrl_res_from_mon(), mpam_resctrl_monitor_sync_abmc_vals(struct
    rdt_resource *r), extends mpam_resctrl_alloc_domain() /
    mpam_resctrl_get_domain_from_cpu() / mpam_resctrl_get_mon_domain_from_cpu()
    with struct mpam_component *comp, hardens topology_matches_l3() with
    matched_once, switches resctrl_arch_mbm_cntr_assign_enabled() to use
    mon->assigned_counters, and extends mpam_resctrl_pick_domain_id() so
    memory level > 3 uses component IDs like cache-backed classes]
Signed-off-by: Fenghua Yu <[email protected]>
…lt config

Reset an RIS by building a default mpam_config and applying it via
mpam_reprogram_ris_partid(), like any other config.

- mpam_init_reset_cfg(): set features and default values only for
  controls supported by the RIS (cpor_part, mbw_part, mbw_max,
  mbw_prop, cmax_cmax, cmax_cmin). Use full masks for CPBM/MBW_PBM
  and MPAMCFG_* defaults for MBW_MAX, CMAX, CMIN.
- mpam_reprogram_ris_partid(): apply cfg for all supported controls
  (no separate reset path).

Signed-off-by: Shanker Donthineni <[email protected]>
(forward ported from commit e0b6de0 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - reset_cpbm and reset_mbw_pbm are not used. no need to define them;
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
There is no struct arm_smmu_domain context for domains configured
with identity mappings. Use the device to obtain the necessary
information to program PARTID and PMGID.

Signed-off-by: Shanker Donthineni <[email protected]>
(cherry picked from commit 23bcbda https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
Add RDT_RESOURCE_MB_HLIM and RESCTRL_SCHEMA_MB_HLIM for per-domain
MBW maximum hard-limit control on ARM MPAM. Document the schema in
kernel-doc. Extend resctrl_get_default_ctrl() for RESCTRL_SCHEMA_MB_HLIM
(default 0).

(cherry picked from commit 9fc8c60 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
…etup

Add mb_hlim parsing and validation (0/1), wire RESCTRL_SCHEMA_MB_HLIM
into schemata and control-group setup, align MB_HLIM with MBA for
exclusive mode and pseudo-locking, and default new groups to hardlim off.

(cherry picked from commit 6911e81 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
…lim_rw

Read mbw_max_lim from MPAMF_MBW_IDR.MAX_LIM when MBW_MAX is present,
derive mpam_feat_mbw_max_hardlim_rw when both soft and hard limiting
are supported, and merge mbw_max_lim and the feature across MSCs.
Add mpam_props_sync_mbw_max_hardlim_rw() and propagate merged state in
__props_mismatch().

(cherry picked from commit ced4d46 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
Add mbw_max_hardlim to mpam_config. When reprogramming MBW_MAX, OR in
HARDLIM (MPAMCFG_MBW_MAX bit 31) when either MBW_MAX or HARDLIM_RW
features are active. Merge HARDLIM in mpam_update_config().

(forward ported from commit 114894b https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
  - Resolve minor conflicts in `drivers/resctrl/mpam_internal.h`;
]
Signed-off-by: Fenghua Yu <[email protected]>
When mpam_feat_mbw_max_hardlim_rw is present, share the MBA MPAM class
with RDT_RESOURCE_MB_HLIM. Wire resctrl_arch_get_config and
resctrl_arch_update_one for MB_HLIM, and tear down MBA and MB_HLIM
controls together on class removal.

Handle RDT_RESOURCE_MB_HLIM in fflags_from_resource() so creating
info/MB_HLIM at resctrl mount does not hit the unhandled-rid WARN.

(forward ported from commit 04e2ea3 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
Add mb_max_lim and arch_has_mb_max_lim to struct resctrl_membw with
kernel-doc: MPAM MAX_LIM encoding (MPAMF_MBW_IDR), invalid elsewhere
unless arch sets arch_has_mb_max_lim.

(cherry picked from commit 7939f1e https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
When mpam_feat_mbw_max is present, set membw.mb_max_lim from
cprops->mbw_max_lim and membw.arch_has_mb_max_lim so generic resctrl can
expose max_lim.

(forward ported from commit 05b9bc1 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
… init

Add rdt_mb_max_lim_show() and the max_lim entry in res_common_files[].
Add mb_max_lim_init() to call resctrl_file_fflags_init("max_lim", ...)
when arch_has_mb_max_lim, and invoke it from resctrl_init() after
io_alloc_init().

(forward ported from commit be13cad https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/rdtgroup.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
…IM for MPAM MBA

Document the MBA max_lim sysfs file, MB_HLIM schemata (0/1 per domain),
and how they relate to MPAM MBW_MAX, HARDLIM, and MPAMF_MBW_IDR.MAX_LIM.
Add schema_format for mb_hlim under the MB allocation info directory.

max_lim is exposed as a single decimal integer (MPAMF_MBW_IDR.MAX_LIM
[1:0], 0–3), matching rdt_mb_max_lim_show(). MB_HLIM appears when the
probe treats HARDLIM as read/write, which this series ties to max_lim
reading zero (see mpam_props_sync_mbw_max_hardlim_rw()).

(cherry picked from commit 93e1b6a https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
Add local bytes counter in mpam_resctrl_counters[] to fix missing
mbm_local_bytes monitoring on Grace.

Add mon->assigned_counters check to enable mbm_L3_assignments config
file on Grace.

Signed-off-by: Fenghua Yu <[email protected]>
@fyu1 fyu1 force-pushed the 26.04_linux-nvidia.glue.others.cpu_less.hardlimit branch from 8ca09ec to 475f355 Compare May 14, 2026 00:34
@fyu1
Copy link
Copy Markdown
Collaborator Author

fyu1 commented May 14, 2026

Force pushing the PR with the fixes of the following errors:

Cherry-pick digest:
E: d20c0e3 ("NVIDIA: SAUCE: arm_mpam: resctrl: Make r"): subject differs from upstream "arm_mpam: resctrl: Make resctrl_mon_ctx_"
E: 6935575 ("NVIDIA: SAUCE: arm_mpam: resctrl: Fix th"): subject differs from upstream "arm_mpam: resctrl: Fix the check for no "
E: 2ccd4dc ("NVIDIA: SAUCE: arm_mpam: resctrl: Fix MB"): subject differs from upstream "arm_mpam: resctrl: Fix MBA CDP alloc_cap"

@clsotog
Copy link
Copy Markdown
Collaborator

clsotog commented May 14, 2026

@fyu1 still looking at the patches but question with this untested commit c673322? is what this patch 525443b did not have but you have a commit 40e0b07 (at 6.17 kernel)

struct mpam_msc_ris *ris;

mutex_lock(&msc->cfg_lock);
list_for_each_entry_srcu(ris, &msc->ris, msc_list,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In James Morse's tree, mpam_cpu_offline() calls the helper: mpam_reset_msc(): https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/tree/drivers/resctrl/mpam_devices.c?id=6becd89512fd69089045ca7654fdf70261c973e6#n2002

mpam_reset_msc() takes the outer lock: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/tree/drivers/resctrl/mpam_devices.c?id=6becd89512fd69089045ca7654fdf70261c973e6#n1870

However, in our tree, the mpam_reset_msc() helper is gone and the code is in-lined into mpam_cpu_offline(). I think you need to take the outer lock:

                if (atomic_dec_and_test(&msc->online_refs)) {                                                           
                        struct mpam_msc_ris *ris;                                                                       
                                                                                                                        
                        mutex_lock(&msc->cfg_lock);                                                                     
  +                     mpam_mon_sel_outer_lock(msc);                                                                   
                        list_for_each_entry_srcu(ris, &msc->ris, msc_list,                                       
                                                 srcu_read_lock_held(&mpam_srcu)) {                                   
                                mpam_touch_msc(msc, &mpam_reset_ris, ris);                                            
                                                                                                                        
                                /*                                                                                      
                                 * The reset state for non-zero partid may be                                     
                                 * lost while the CPUs are offline.                                                     
                                 */                                                                                     
                                ris->in_reset_state = false;

                                if (mpam_is_enabled())
                                        mpam_touch_msc(msc, &mpam_save_mbwu_state, ris);
                        }                                    
  +                     mpam_mon_sel_outer_unlock(msc);
                        mutex_unlock(&msc->cfg_lock);
                } 

Comment thread drivers/acpi/arm64/mpam.c
offset, tbl_msc->identifier);
return -EINVAL;
}
tbl_int_tbl = ACPI_ADD_PTR(struct acpi_mpam_interconnect_descriptor_table,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists in the original commit as well.

The bounds check here only rejects offsets at or past tbl_msc->length, but the next statements dereference tbl_int_tbl->type_uuid and tbl_int_tbl->num_descriptors.

Suggested fix:

        case ACPI_MPAM_LOCATION_TYPE_INTERCONNECT:                                                                      
                /* Find the descriptor table, and check it lands in the parent msc */                                   
                offset = res->locator.interconnect_ifc_locator.inter_connect_desc_tbl_off;                              
  -             if (offset >= tbl_msc->length) {                                                                        
  +             if (offset >= tbl_msc->length ||                                                                        
  +                 tbl_msc->length - offset < sizeof(*tbl_int_tbl)) {                                                  
                        pr_err_once("Bad offset (%lu) for interconnect descriptor on msc %u\n",
                                    offset, tbl_msc->identifier);
                        return -EINVAL;
                }
                tbl_int_tbl = ACPI_ADD_PTR(struct acpi_mpam_interconnect_descriptor_table,
                                           tbl_msc, offset);

Comment thread drivers/acpi/arm64/mpam.c
tbl_msc, offset);
guid_parse(UUID_MPAM_INTERCONNECT_TABLE, &spec_uuid);
import_guid(&int_tbl_uuid, tbl_int_tbl->type_uuid);
if (guid_equal(&spec_uuid, &int_tbl_uuid)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists in the original commit as well.

This check looks inverted (guid_equal() returns true when the two GUIDs match).

Suggested fix:

  -             if (guid_equal(&spec_uuid, &int_tbl_uuid)) {                                                            
  +             if (!guid_equal(&spec_uuid, &int_tbl_uuid)) {                                                           
                        pr_err_once("Bad UUID for interconnect descriptor on msc %u\n",                                 
                                    tbl_msc->identifier);                                                               
                        return -EINVAL;                                                                                 
                }    

Comment thread drivers/acpi/arm64/mpam.c
cache_id = tbl_int->source_id;

/* Unknown link type? */
if (tbl_int->link_type != 0 && tbl_int->link_type == 1)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists in the original commit as well.

Kind of nit-picky, but this check can be simplified:

  -               if (tbl_int->link_type != 0 && tbl_int->link_type == 1)
  +               if (tbl_int->link_type == 1)                                                                          
                          return 0;     

Comment thread fs/resctrl/rdtgroup.c
if (kstrtoint(pid_str, 0, &pid)) {
is_iommu = string_is_iommu_group(pid_str, &iommu_group_id);
if (is_iommu)
ret = rdtgroup_move_iommu(iommu_group_id, rdtgrp, of);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists in the original commit as well.

If rdtgroup_move_iommu() returns an error here, this looks like it should break the loop.

And in the success case, it will fall through. In this case, pid is never assigned, but we'll call rdtgroup_move_task() anyway. That seems incorrect to me.

Suggested fix:

      if (string_is_iommu_group(pid_str, &iommu_group_id)) {
          ret = rdtgroup_move_iommu(iommu_group_id, rdtgrp, of);
          if (ret)
              break;
          continue;
      }

This breaks in the failure case and avoids the fall-through in the success case.

Comment thread fs/resctrl/rdtgroup.c
/* iommu_group_get_from_kobj() wants to drop a reference */
kobject_get(group_kobj);

group = iommu_group_get_from_kobj(group_kobj);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists in the original commit as well.

Looks like there's a reference count leak with group->devices_kobj here:

        struct iommu_group *iommu_group_get_from_kobj(struct kobject *group_kobj)
        {
                ...
                kobject_get(group->devices_kobj);
                kobject_put(&group->kobj);
                return group;
        }

The loop calls iommu_group_get_from_kobj(), but never iommu_group_put(). Suggested fix:

          group = iommu_group_get_from_kobj(group_kobj);                                                                
          if (!group)                                                                                                   
              continue;                                                                                                 
                                                                                                                        
          if (iommu_matches_rdtgroup(group, r))                                                                         
              seq_printf(s, "iommu_group:%s\n", group_kobj->name);                                                      
  +                                                                                                                     
  +       iommu_group_put(group);                                                                                       
      }  

@nirmoy
Copy link
Copy Markdown
Collaborator

nirmoy commented May 14, 2026

Boro watcher review skipped

The GitHub watcher skips automatic boro reviews for PRs with more than 50 commits. This PR currently has 100 commits.

To run the review anyway, ask BaseOS_Kernel_Bot in #baseos-kernel:

review https://github.com/NVIDIA/NV-Kernels/pull/419

Head: 475f355d0408

This comment is maintained by nv-pr-bot. It is updated when the GitHub watcher sees a newer PR head.

return 0;
}

static void mpam_init_reset_cfg(struct mpam_config *reset_cfg)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is mpam_init_reset_cfg() no longer needed in 7.0? After this PR removes the CMAX/CMIN else-branches, it looks like mpam_reset_ris() no longer programs CMAX or CMIN on resctrl unmount or CPU online.

24.04's e0b6de09b2a7 re-introduced a refreshed mpam_init_reset_cfg() helper to handle this -- was it intentionally dropped from the forward-port?

@nvmochs
Copy link
Copy Markdown
Collaborator

nvmochs commented May 15, 2026

@fyu1 Couple of comments...

This PR is targeting the wrong branch. It should target 26.04_linux-nvidia-bos. You should submit another PR with ONLY the Grace content for 26.04_linux-nvidia.


475f355 NVIDIA: SAUCE: Fix mbm_L3_assign and mon_local_bytes

Is this fix needed in 6.17-HWE as well?


Codex found this issue when reviewing the NVIDIA:VR:SAUCE patches

  • High: 3e04efc was not resolved correctly. The source patch adds an explicit reset config initializer; the target instead still passes an empty reset_cfg into mpam_reprogram_ris_partid() at drivers/resctrl/
    mpam_devices.c:1881. With an empty cfg, MBW_PBM falls into the else path and writes cfg->mbw_pbm as 0 at drivers/resctrl/mpam_devices.c:1726, while CMAX/CMIN are skipped unless feature bits are set at drivers/resctrl/
    mpam_devices.c:1763. That does not match the source patch intent of applying explicit default values. The annotation about reset_cpbm / reset_mbw_pbm is incomplete and the pick needs code correction.

bc1ce80 NVIDIA: VR: SAUCE: fs/resctrl: Avoid a race with dom_data_exit() and closid_num_dirty_rmid[]

Nit: It looks like this one was a clean pick and doesn’t require an annotation note under the pick tag.


75d4de9 NVIDIA: SAUCE: Update annotations to set CONFIG_RESCTRL_FS

Do we not need CONFIG_ARM64_MPAM_RESCTRL_FS = y ?


No issues with the patches picked from v7.1 - I verified they match upstream and picked clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.