Skip to content

Commit

Permalink
ARM: 6742/1: pmu: avoid setting IRQ affinity on UP systems
Browse files Browse the repository at this point in the history
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.

Reported-by: Avik Sil <avik.sil@linaro.org>
Acked-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Will Deacon authored and Russell King committed Feb 19, 2011
1 parent 885028e commit 71efb06
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions arch/arm/kernel/pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,28 +97,34 @@ 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;
}

out:
return err;
}

Expand Down

0 comments on commit 71efb06

Please sign in to comment.