x86/resctrl: Move rdt_find_domain() to be visible to arch and fs code

rdt_find_domain() finds a domain given a resource and a cache-id.  This is
used by both the architecture code and the filesystem code.

After the filesystem code moves to live in /fs/, this helper is either
duplicated by all architectures, or needs exposing by the filesystem code.

Add the declaration to the global header file. As it's now globally visible,
and has only a handful of callers, swap the 'rdt' for 'resctrl'. Move the
function to live with its caller in ctrlmondata.c as the filesystem code will
not have anything corresponding to core.c.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Babu Moger <babu.moger@amd.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Amit Singh Tomar <amitsinght@marvell.com> # arm64
Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> # arm64
Tested-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/20250311183715.16445-13-james.morse@arm.com
This commit is contained in:
James Morse
2025-03-11 18:36:57 +00:00
committed by Borislav Petkov (AMD)
parent 8079565d17
commit e3d5138cef
4 changed files with 41 additions and 37 deletions
+14
View File
@@ -372,6 +372,20 @@ static inline void resctrl_arch_rmid_read_context_check(void)
might_sleep();
}
/**
* resctrl_find_domain() - Search for a domain id in a resource domain list.
* @h: The domain list to search.
* @id: The domain id to search for.
* @pos: A pointer to position in the list id should be inserted.
*
* Search the domain list to find the domain id. If the domain id is
* found, return the domain. NULL otherwise. If the domain id is not
* found (and NULL returned) then the first domain with id bigger than
* the input id can be returned to the caller via @pos.
*/
struct rdt_domain_hdr *resctrl_find_domain(struct list_head *h, int id,
struct list_head **pos);
/**
* resctrl_arch_reset_rmid() - Reset any private state associated with rmid
* and eventid.