Skip to contentSkip to conversation

ARM: pmu: avoid setting IRQ affinity on UP systems

PATCH New Will Deacon 2 participants 3 messages Feb 15, 2011 – Feb 18, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: pmu: avoid setting IRQ affinity on UP systems

Now that we can execute a CONFIG_SMP kernel on a uniprocessor system, extra care has to be taken in the PMU IRQ affinity setting code to ensure that we don't always fail to initialise.

This patch changes the CPU PMU initialisation code so that when we only have a single IRQ, whose affinity can not be changed at the controller, we report success (0) rather than -EINVAL.

---
 arch/arm/kernel/pmu.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
arch/arm/kernel/pmu.c +14 -7
index b8af96e..2b65d10 100644
@@ -97,22 +97,29 @@ set_irq_affinity(int irq,
 			   irq, cpu);
 	return err;
 #else
-	return 0;
+	return -EINVAL;
 #endif
 }
 
 static int
 init_cpu_pmu(void)
 {
-	int i, err = 0;
+	int i, irqs, err = 0;
 	struct platform_device *pdev = pmu_devices[ARM_PMU_DEVICE_CPU];
 
-	if (!pdev) {
-		err = -ENODEV;
-		goto out;
-	}
+	if (!pdev)
+		return -ENODEV;
+
+	irqs = pdev->num_resources;
+
+	/*
+	 * If we have a single PMU interrupt that we can't shift, assume that
+	 * we're running on a uniprocessor machine and continue.
+	 */
+	if (irqs == 1 && !irq_can_set_affinity(platform_get_irq(pdev, 0)))
+		return 0;
 
-	for (i = 0; i < pdev->num_resources; ++i) {
+	for (i = 0; i < irqs; ++i) {
 		err = set_irq_affinity(platform_get_irq(pdev, i), i);
 		if (err)
 			break;
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 ARM: pmu: avoid setting IRQ affinity on UP systems

Quoted 11 lines · Will Deacon

Now that we can execute a CONFIG_SMP kernel on a uniprocessor system, extra care has to be taken in the PMU IRQ affinity setting code to ensure that we don't always fail to initialise.

This patch changes the CPU PMU initialisation code so that when we only have a single IRQ, whose affinity can not be changed at the controller, we report success (0) rather than -EINVAL.

Look good!

Jamie

#2 lore raw

PATCH 1/1 ARM: pmu: avoid setting IRQ affinity on UP systems

Hi Jamie,

Quoted 9 lines · Will Deacon
Quoted 8 lines

Now that we can execute a CONFIG_SMP kernel on a uniprocessor system, extra care has to be taken in the PMU IRQ affinity setting code to ensure that we don't always fail to initialise.

This patch changes the CPU PMU initialisation code so that when we only have a single IRQ, whose affinity can not be changed at the controller, we report success (0) rather than -EINVAL.

Quoted 7 lines
Quoted 3 lines

Look good!

Cheers. I've submitted this as 6742/1 with a minor change (deleted the out:
label as it's no longer used).

Will