Commit 39e81615 authored by James Morse's avatar James Morse Committed by Zeng Heng
Browse files

arm_mpam: Use the arch static key to indicate when mpam is enabled

maillist inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8T2RT

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/log/?h=mpam/snapshot/v6.7-rc2



---------------------------

Once all the MSC have been probed, the system wide usable number of
PARTID is known and the configuration arrays can be allocated.

After this point, checking all the MSC have been probed is pointless,
and the cpuhp callbacks should restore the configuration, instead of
just resetting the MSC.

Enable the architecture's static key that indicates whether mpam is
enabled and use this to skip the discovery work on cpu hotplug.

Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Signed-off-by: default avatarZeng Heng <zengheng4@huawei.com>
parent 79a4fc6c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -828,6 +828,9 @@ static int mpam_discovery_cpu_online(unsigned int cpu)
	struct mpam_msc *msc;
	bool new_device_probed = false;

	if (mpam_is_enabled())
		return 0;

	mutex_lock(&mpam_list_lock);
	list_for_each_entry(msc, &mpam_all_msc, glbl_list) {
		if (!cpumask_test_cpu(cpu, &msc->accessibility))
@@ -1468,6 +1471,7 @@ static void mpam_enable_once(void)
	partid_max_published = true;
	spin_unlock(&partid_max_lock);

	static_branch_enable(&mpam_enabled);
	mpam_register_cpuhp_callbacks(mpam_cpu_online);

	pr_info("MPAM enabled with %u partid and %u pmg\n",
@@ -1509,6 +1513,8 @@ static irqreturn_t mpam_disable_thread(int irq, void *dev_id)
	}
	mutex_unlock(&mpam_cpuhp_state_lock);

	static_branch_disable(&mpam_enabled);

	mpam_unregister_irqs();

	idx = srcu_read_lock(&mpam_srcu);
+8 −0
Original line number Diff line number Diff line
@@ -8,12 +8,20 @@
#include <linux/atomic.h>
#include <linux/cpumask.h>
#include <linux/io.h>
#include <linux/jump_label.h>
#include <linux/mailbox_client.h>
#include <linux/mutex.h>
#include <linux/resctrl.h>
#include <linux/sizes.h>
#include <linux/srcu.h>

DECLARE_STATIC_KEY_FALSE(mpam_enabled);

static inline bool mpam_is_enabled(void)
{
	return static_branch_likely(&mpam_enabled);
}

struct mpam_msc
{
	/* member of mpam_all_msc */