Skip to content
Commit e9e5e342 authored by Dave Martin's avatar Dave Martin
Browse files

arm_mpam: [HACK] Define and use generic control group applicator



A resctrl operation on a control group must be applied across all
PARTIDs that the MPAM driver maps to that group.

The ID mapping conversions are a bit fiddly and we may want to
change the way they work in future.  In the interest of
maintainability therefore, it is preferable to keep them in one
place.

This patch defines a generic helper mpam_control_apply() that
encapsulates the ID conversions and iterates over the appropriate
set of MPAM PARTIDs to cover the requested resctrl CLOSID and
config type (CDP_DATA, CDP_CODE etc.)

The control group configuration hooks resctrl_arch_update_one() and
resctrl_arch_get_config() are updated to use the new helper.

Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>

---

Non-bisectable patch -- breaks the MPAM driver.

These changes need to refactored before they can be merged.

---

This approach may be over-cooked.  Although resctrl_arch_get_config()
logically needs to read and merge the configs of all affected PARTIDs,
the PARTIDs will always have identical configurations.

For now, resctrl_arch_get_config() redundantly reads the configuration
of every relevant PARTID and returns the last one.  The others are
thrown away.  This is wasteful but it should do the right thing, since
all PARTIDs should be configured identically.  There are no redundant
hardware accesses: the configuration is just read from memory.  If the
compiler is clever enough, it should be able to optimise the preceding
loop iterations away, but this isn't guaranteed.

Factoring the loop out of the helper, or having an early-termination
convention for the mpam_control_action function would be better, but I
have not settled on an apporach yet.
parent ab96204a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment