Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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/types.h>
9
10struct mpam_msc;
11
12enum mpam_msc_iface {
13 MPAM_IFACE_MMIO, /* a real MPAM MSC */
14 MPAM_IFACE_PCC, /* a fake MPAM MSC */
15};
16
17enum mpam_class_types {
18 MPAM_CLASS_CACHE, /* Caches, e.g. L2, L3 */
19 MPAM_CLASS_MEMORY, /* Main memory */
20 MPAM_CLASS_UNKNOWN, /* Everything else, e.g. SMMU */
21};
22
23#define MPAM_CLASS_ID_DEFAULT 255
24
25#ifdef CONFIG_ACPI_MPAM
26int acpi_mpam_parse_resources(struct mpam_msc *msc,
27 struct acpi_mpam_msc_node *tbl_msc);
28
29int acpi_mpam_count_msc(void);
30#else
31static inline int acpi_mpam_parse_resources(struct mpam_msc *msc,
32 struct acpi_mpam_msc_node *tbl_msc)
33{
34 return -EINVAL;
35}
36
37static inline int acpi_mpam_count_msc(void) { return -EINVAL; }
38#endif
39
40#ifdef CONFIG_ARM64_MPAM_DRIVER
41int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx,
42 enum mpam_class_types type, u8 class_id, int component_id);
43#else
44static inline int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx,
45 enum mpam_class_types type, u8 class_id,
46 int component_id)
47{
48 return -EINVAL;
49}
50#endif
51
52/**
53 * mpam_register_requestor() - Register a requestor with the MPAM driver
54 * @partid_max: The maximum PARTID value the requestor can generate.
55 * @pmg_max: The maximum PMG value the requestor can generate.
56 *
57 * Registers a requestor with the MPAM driver to ensure the chosen system-wide
58 * minimum PARTID and PMG values will allow the requestors features to be used.
59 *
60 * Returns an error if the registration is too late, and a larger PARTID/PMG
61 * value has been advertised to user-space. In this case the requestor should
62 * not use its MPAM features. Returns 0 on success.
63 */
64int mpam_register_requestor(u16 partid_max, u8 pmg_max);
65
66#endif /* __LINUX_ARM_MPAM_H */