Commit 502f94fb authored by Jan Kiszka's avatar Jan Kiszka
Browse files

cobalt/intr: Add error handling to xnintr_affinity



This function should respect the supported cpu set and report an error
if the specified set has no intersection with it. It should also return
potential errors for the underlying pipeline code.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 5df66fc6
......@@ -124,8 +124,7 @@ void xnintr_enable(struct xnintr *intr);
void xnintr_disable(struct xnintr *intr);
void xnintr_affinity(struct xnintr *intr,
const cpumask_t *cpumask);
int xnintr_affinity(struct xnintr *intr, const cpumask_t *cpumask);
#ifdef CONFIG_XENO_OPT_STATS_IRQS
......
......@@ -118,13 +118,16 @@ void xnintr_disable(struct xnintr *intr)
}
EXPORT_SYMBOL_GPL(xnintr_disable);
void xnintr_affinity(struct xnintr *intr, const cpumask_t *cpumask)
int xnintr_affinity(struct xnintr *intr, const cpumask_t *cpumask)
{
int ret;
cpumask_t effective_mask;
secondary_mode_only();
ret = irq_set_affinity_hint(intr->irq, cpumask);
WARN_ON_ONCE(ret);
cpumask_and(&effective_mask, &xnsched_realtime_cpus, cpumask);
if (cpumask_empty(&effective_mask))
return -EINVAL;
return irq_set_affinity_hint(intr->irq, &effective_mask);
}
EXPORT_SYMBOL_GPL(xnintr_affinity);
......@@ -992,11 +992,21 @@ EXPORT_SYMBOL_GPL(xnintr_disable);
*
* @coretags{secondary-only}
*/
void xnintr_affinity(struct xnintr *intr, const cpumask_t *cpumask)
int xnintr_affinity(struct xnintr *intr, const cpumask_t *cpumask)
{
secondary_mode_only();
#ifdef CONFIG_SMP
ipipe_set_irq_affinity(intr->irq, *cpumask);
cpumask_t effective_mask;
secondary_mode_only();
cpumask_and(&effective_mask, &xnsched_realtime_cpus, cpumask);
if (cpumask_empty(&effective_mask))
return -EINVAL;
return ipipe_set_irq_affinity(intr->irq, effective_mask);
#else
secondary_mode_only();
return 0;
#endif
}
EXPORT_SYMBOL_GPL(xnintr_affinity);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment