Commit 693f9a00 authored by James Morse's avatar James Morse Committed by Zeng Heng
Browse files

perf/arm-cmn: Stop claiming all the resources

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



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

Carl reports that when both the MPAM driver and CMN driver are built
into the kernel, they fight over who can claim the resources associated
with their registers. This prevents the second of these two drivers
from probing.

Currently the CMN PMU driver claims all the CMN registers.

The MPAM registers are grouped together in a small number of pages,
whereas the PMU registers that the CMN PMU driver uses appear
throughout the CMN register space.

Having the CMN driver claim all the resources is the wrong thing
to do, and claiming individual registers here and there is not
worthwhile.
Instead, stop the CMN driver from claiming any resources as its
registers are not grouped together.

Reported-by: default avatarCarl Worth <carl@os.amperecomputing.com>
Tested-by: default avatarCarl Worth <carl@os.amperecomputing.com>
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
CC: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Signed-off-by: default avatarZeng Heng <zengheng4@huawei.com>
parent c5a4bf91
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -2428,6 +2428,7 @@ static int arm_cmn_probe(struct platform_device *pdev)
	struct arm_cmn *cmn;
	const char *name;
	static atomic_t id;
	struct resource *cfg;
	int err, rootnode, this_id;

	cmn = devm_kzalloc(&pdev->dev, sizeof(*cmn), GFP_KERNEL);
@@ -2442,7 +2443,16 @@ static int arm_cmn_probe(struct platform_device *pdev)
		rootnode = arm_cmn600_acpi_probe(pdev, cmn);
	} else {
		rootnode = 0;
		cmn->base = devm_platform_ioremap_resource(pdev, 0);

		/*
		 * Avoid registering resources as the PMUs registers are
		 * scattered through CMN, and may appear either side of
		 * registers for other 'devices'. (e.g. the MPAM MSC controls).
		 */
		cfg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
		if (!cfg)
			return -EINVAL;
		cmn->base = devm_ioremap(&pdev->dev, cfg->start, resource_size(cfg));
		if (IS_ERR(cmn->base))
			return PTR_ERR(cmn->base);
		if (cmn->part == PART_CMN600)