drivers/resctrl/mpam_internal.h

Source file repositories/reference/linux-study-clean/drivers/resctrl/mpam_internal.h

File Facts

System
Linux kernel
Corpus path
drivers/resctrl/mpam_internal.h
Extension
.h
Size
23168 bytes
Lines
754
Domain
Driver Families
Bucket
drivers/resctrl
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct mpam_garbage {
	/* member of mpam_garbage */
	struct llist_node	llist;

	void			*to_free;
	struct platform_device	*pdev;
};

struct mpam_msc {
	/* member of mpam_all_msc */
	struct list_head	all_msc_list;

	int			id;
	struct platform_device	*pdev;

	/* Not modified after mpam_is_enabled() becomes true */
	enum mpam_msc_iface	iface;
	u32			nrdy_usec;
	cpumask_t		accessibility;
	bool			has_extd_esr;

	int				reenable_error_ppi;
	struct mpam_msc * __percpu	*error_dev_id;

	atomic_t		online_refs;

	/*
	 * probe_lock is only taken during discovery. After discovery these
	 * properties become read-only and the lists are protected by SRCU.
	 */
	struct mutex		probe_lock;
	bool			probed;
	u16			partid_max;
	u8			pmg_max;
	unsigned long		ris_idxs;
	u32			ris_max;
	u32			iidr;
	u16			quirks;

	/*
	 * error_irq_lock is taken when registering/unregistering the error
	 * interrupt and maniupulating the below flags.
	 */
	struct mutex		error_irq_lock;
	bool			error_irq_req;
	bool			error_irq_hw_enabled;

	/* mpam_msc_ris of this component */
	struct list_head	ris;

	/*
	 * part_sel_lock protects access to the MSC hardware registers that are
	 * affected by MPAMCFG_PART_SEL. (including the ID registers that vary
	 * by RIS).
	 * If needed, take msc->probe_lock first.
	 */
	struct mutex		part_sel_lock;

	/*
	 * cfg_lock protects the msc configuration and guards against mbwu_state
	 * save and restore racing.
	 */
	struct mutex		cfg_lock;

	/*
	 * mon_sel_lock protects access to the MSC hardware registers that are
	 * affected by MPAMCFG_MON_SEL, and the mbwu_state.
	 * Access to mon_sel is needed from both process and interrupt contexts,
	 * but is complicated by firmware-backed platforms that can't make any
	 * access unless they can sleep.
	 * Always use the mpam_mon_sel_lock() helpers.
	 * Accesses to mon_sel need to be able to fail if they occur in the wrong
	 * context.
	 * If needed, take msc->probe_lock first.
	 */
	raw_spinlock_t		_mon_sel_lock;
	unsigned long		_mon_sel_flags;

	void __iomem		*mapped_hwpage;
	size_t			mapped_hwpage_sz;

	/* Values only used on some platforms for quirks */
	u32			t241_id;

	struct mpam_garbage	garbage;
};

/* Returning false here means accesses to mon_sel must fail and report an error. */
static inline bool __must_check mpam_mon_sel_lock(struct mpam_msc *msc)
{

Annotation

Implementation Notes