Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 6fdca3c5ab55d6a74277efcae2db9828f567a06a 98 lines 3.2 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* Copyright (C) 2025 Arm Ltd. */ 3 4#ifndef __LINUX_ARM_MPAM_H 5#define __LINUX_ARM_MPAM_H 6 7#include <linux/acpi.h> 8#include <linux/resctrl_types.h> 9#include <linux/types.h> 10 11struct mpam_msc; 12 13enum mpam_msc_iface { 14 MPAM_IFACE_MMIO, /* a real MPAM MSC */ 15 MPAM_IFACE_PCC, /* a fake MPAM MSC */ 16}; 17 18enum mpam_class_types { 19 MPAM_CLASS_CACHE, /* Caches, e.g. L2, L3 */ 20 MPAM_CLASS_MEMORY, /* Main memory */ 21 MPAM_CLASS_UNKNOWN, /* Everything else, e.g. SMMU */ 22}; 23 24#define MPAM_CLASS_ID_DEFAULT 255 25 26#ifdef CONFIG_ACPI_MPAM 27int acpi_mpam_parse_resources(struct mpam_msc *msc, 28 struct acpi_mpam_msc_node *tbl_msc); 29 30int acpi_mpam_count_msc(void); 31#else 32static inline int acpi_mpam_parse_resources(struct mpam_msc *msc, 33 struct acpi_mpam_msc_node *tbl_msc) 34{ 35 return -EINVAL; 36} 37 38static inline int acpi_mpam_count_msc(void) { return -EINVAL; } 39#endif 40 41#ifdef CONFIG_ARM64_MPAM_DRIVER 42int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx, 43 enum mpam_class_types type, u8 class_id, int component_id); 44#else 45static inline int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx, 46 enum mpam_class_types type, u8 class_id, 47 int component_id) 48{ 49 return -EINVAL; 50} 51#endif 52 53bool resctrl_arch_alloc_capable(void); 54bool resctrl_arch_mon_capable(void); 55 56void resctrl_arch_set_cpu_default_closid(int cpu, u32 closid); 57void resctrl_arch_set_closid_rmid(struct task_struct *tsk, u32 closid, u32 rmid); 58void resctrl_arch_set_cpu_default_closid_rmid(int cpu, u32 closid, u32 rmid); 59void resctrl_arch_sched_in(struct task_struct *tsk); 60bool resctrl_arch_match_closid(struct task_struct *tsk, u32 closid); 61bool resctrl_arch_match_rmid(struct task_struct *tsk, u32 closid, u32 rmid); 62u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid); 63void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid); 64u32 resctrl_arch_system_num_rmid_idx(void); 65 66struct rdt_resource; 67void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, enum resctrl_event_id evtid); 68void resctrl_arch_mon_ctx_free(struct rdt_resource *r, enum resctrl_event_id evtid, void *ctx); 69 70/* 71 * The CPU configuration for MPAM is cheap to write, and is only written if it 72 * has changed. No need for fine grained enables. 73 */ 74static inline void resctrl_arch_enable_mon(void) { } 75static inline void resctrl_arch_disable_mon(void) { } 76static inline void resctrl_arch_enable_alloc(void) { } 77static inline void resctrl_arch_disable_alloc(void) { } 78 79static inline unsigned int resctrl_arch_round_mon_val(unsigned int val) 80{ 81 return val; 82} 83 84/** 85 * mpam_register_requestor() - Register a requestor with the MPAM driver 86 * @partid_max: The maximum PARTID value the requestor can generate. 87 * @pmg_max: The maximum PMG value the requestor can generate. 88 * 89 * Registers a requestor with the MPAM driver to ensure the chosen system-wide 90 * minimum PARTID and PMG values will allow the requestors features to be used. 91 * 92 * Returns an error if the registration is too late, and a larger PARTID/PMG 93 * value has been advertised to user-space. In this case the requestor should 94 * not use its MPAM features. Returns 0 on success. 95 */ 96int mpam_register_requestor(u16 partid_max, u8 pmg_max); 97 98#endif /* __LINUX_ARM_MPAM_H */