Example #1
0
static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
				   unsigned long count, void *data)
{
	unsigned int irq = (int)(long)data, full_count = count, err;
	cpumask_t new_value, tmp;

	if (!irq_desc[irq].chip->set_affinity || no_irq_affinity ||
	    irq_balancing_disabled(irq))
		return -EIO;

	err = cpumask_parse_user(buffer, count, new_value);
	if (err)
		return err;

	if (!is_affinity_mask_valid(new_value))
		return -EINVAL;

	/*
	 * Do not allow disabling IRQs completely - it's a too easy
	 * way to make the system unusable accidentally :-) At least
	 * one online CPU still has to be targeted.
	 */
	cpus_and(tmp, new_value, cpu_online_map);
	if (cpus_empty(tmp))
		/* Special case for empty set - allow the architecture
		   code to set default SMP affinity. */
		return select_smp_affinity(irq) ? -EINVAL : full_count;

	irq_set_affinity(irq, new_value);

	return full_count;
}
Example #2
0
static ssize_t irq_affinity_proc_write(struct file *file,
                                       const char __user *buffer, size_t count, loff_t *pos)
{
    unsigned int irq = (int)(long)PDE(file->f_path.dentry->d_inode)->data;
    cpumask_t new_value;
    int err;

    if (!irq_to_desc(irq)->chip->set_affinity || no_irq_affinity ||
            irq_balancing_disabled(irq))
        return -EIO;

    err = cpumask_parse_user(buffer, count, new_value);
    if (err)
        return err;

    if (!is_affinity_mask_valid(new_value))
        return -EINVAL;

    /*
     * Do not allow disabling IRQs completely - it's a too easy
     * way to make the system unusable accidentally :-) At least
     * one online CPU still has to be targeted.
     */
    if (!cpus_intersects(new_value, cpu_online_map))
        /* Special case for empty set - allow the architecture
           code to set default SMP affinity. */
        return irq_select_affinity(irq) ? -EINVAL : count;

    irq_set_affinity(irq, new_value);

    return count;
}
Example #3
0
void intc_balancing_disable(unsigned int irq)
{
	struct intc_desc_int *d = get_intc_desc(irq);
	unsigned long handle = dist_handle[irq];
	unsigned long addr;

	if (irq_balancing_disabled(irq) || !handle)
		return;

	addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
	intc_reg_fns[_INTC_FN(handle)](addr, handle, 0);
}