[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5658429D.3000105@imgtec.com>
Date: Fri, 27 Nov 2015 11:46:38 +0000
From: Qais Yousef <qais.yousef@...tec.com>
To: <linux-kernel@...r.kernel.org>
CC: <tglx@...utronix.de>, <jason@...edaemon.net>,
<marc.zyngier@....com>, <jiang.liu@...ux.intel.com>,
<ralf@...ux-mips.org>, <linux-mips@...ux-mips.org>
Subject: Re: [PATCH v2 09/19] genirq: Add a new function to get IPI reverse
mapping
On 11/25/2015 12:06 PM, Qais Yousef wrote:
> +
> +/**
> + * ipi_get_hwirq - get the hwirq associated with an IPI to a cpu
> + * @irq: linux irq number
> + * @cpu: the cpu to find the revmap for
> + *
> + * When dealing with coprocessors IPI, we need to inform it of the hwirq it
> + * needs to use to receive and send IPIs. This function provides the revmap
> + * to get this info to pass on to coprocessor firmware.
> + *
> + * Returns hwirq value on success and INVALID_HWIRQ on failure.
> + */
> +irq_hw_number_t ipi_get_hwirq(unsigned int irq, unsigned int cpu)
> +{
> + struct irq_data *data = irq_get_irq_data(irq);
> + struct ipi_mask *ipimask = data ? irq_data_get_ipi_mask(data) : NULL;
> + irq_hw_number_t hwirq;
> +
> + if (!data || !ipimask)
> + return INVALID_HWIRQ;
> +
> + if (cpu > ipimask->nbits)
> + return INVALID_HWIRQ;
> +
> + if (!test_bit(cpu, ipimask->cpu_bitmap))
> + return INVALID_HWIRQ;
> +
> + if (irq_domain_is_ipi_per_cpu(data->domain)) {
> + data = irq_get_irq_data(irq + cpu - ipimask->offset);
> + hwirq = data ? irqd_to_hwirq(data) : INVALID_HWIRQ;
> + } else {
> + hwirq = irqd_to_hwirq(data) + cpu - ipimask->offset;
> + }
> +
> + return hwirq;
> +}
> +EXPORT_SYMBOL_GPL(ipi_get_hwirq);
While trying to get my remoteproc driver work with this I uncovered a
problem with this approach.
mips-gic doesn't store the actual hwirq in the irq_data. It uses
GIC_SHARED_TO_HWIRQ() and GIC_HWIRQ_TO_SHARED() to add and remove an offset.
I'll add a new chip function irq_get_raw_hwirq(struct irq_data *d) that
will return the real hardware value of hwirq. If not defined, I'll
revert back to using the irqd_to_hwirq().
Objections?
Thanks,
Qais
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists