Skip to content

Can't set CPU affinity on RP1 downstream interrupts #6077

@P33M

Description

@P33M

Describe the bug

The RP1 irqchip doesn't declare an affinity set function, so writing a sensible value to /proc/irq/<blah>/smp_affinity returns write error: Invalid argument.

Steps to reproduce the behaviour

Write any mask to smp_affinity in procfs.

Device (s)

Raspberry Pi 5

System

Any Pi 5 kernel version

Logs

No response

Additional context

A fix that nominally seems to work is

diff --git a/drivers/mfd/rp1.c b/drivers/mfd/rp1.c
index 4adfbb767136..0a498a670a81 100644
--- a/drivers/mfd/rp1.c
+++ b/drivers/mfd/rp1.c
@@ -141,11 +141,20 @@ static int rp1_irq_set_type(struct irq_data *irqd, unsigned int type)
        return ret;
 }

+static int rp1_irq_set_affinity(struct irq_data *irqd, const struct cpumask *dest, bool force)
+{
+       struct rp1_dev *rp1 = irqd->domain->host_data;
+       struct irq_data *pcie_irqd = rp1->pcie_irqds[irqd->hwirq];
+
+       return msi_domain_set_affinity(pcie_irqd, dest, force);
+}
+
 static struct irq_chip rp1_irq_chip = {
        .name            = "rp1_irq_chip",
        .irq_mask        = rp1_mask_irq,
        .irq_unmask      = rp1_unmask_irq,
        .irq_set_type    = rp1_irq_set_type,
+       .irq_set_affinity = rp1_irq_set_affinity,
 };

 static void rp1_chained_handle_irq(struct irq_desc *desc)

In that my eth0 interrupts now appear on a CPU of my choosing - but is it the right fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions