All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qais Yousef <qais.yousef@imgtec.com>
To: <linux-kernel@vger.kernel.org>
Cc: <tglx@linutronix.de>, <jason@lakedaemon.net>,
	<marc.zyngier@arm.com>, <jiang.liu@linux.intel.com>,
	<ralf@linux-mips.org>, <linux-mips@linux-mips.org>
Subject: Re: [PATCH v2 09/19] genirq: Add a new function to get IPI reverse mapping
Date: Fri, 27 Nov 2015 11:46:38 +0000	[thread overview]
Message-ID: <5658429D.3000105@imgtec.com> (raw)
In-Reply-To: <1448453217-3874-10-git-send-email-qais.yousef@imgtec.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Qais Yousef <qais.yousef@imgtec.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com,
	jiang.liu@linux.intel.com, ralf@linux-mips.org,
	linux-mips@linux-mips.org
Subject: Re: [PATCH v2 09/19] genirq: Add a new function to get IPI reverse mapping
Date: Fri, 27 Nov 2015 11:46:38 +0000	[thread overview]
Message-ID: <5658429D.3000105@imgtec.com> (raw)
Message-ID: <20151127114638.r6KDP77BETlz82_wxJQjG97FT2YG9-migCKn-G49GmE@z> (raw)
In-Reply-To: <1448453217-3874-10-git-send-email-qais.yousef@imgtec.com>

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

  reply	other threads:[~2015-11-27 11:46 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 12:06 [PATCH v2 00/19] Implement generic IPI support mechanism Qais Yousef
2015-11-25 12:06 ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 01/19] genirq: Add new IRQ_DOMAIN_FLAGS_IPI Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 02/19] genirq: Add DOMAIN_BUS_IPI Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 03/19] genirq: Add GENERIC_IRQ_IPI Kconfig symbol Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 04/19] genirq: Add new struct ipi_mask and helper functions Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-30 11:20   ` Thomas Gleixner
2015-11-30 11:48     ` Qais Yousef
2015-11-30 11:48       ` Qais Yousef
2015-11-30 13:11       ` Thomas Gleixner
2015-11-30 13:57         ` Qais Yousef
2015-11-30 13:57           ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 05/19] genirq: Add struct ipi_mask to irq_data Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 06/19] genirq: Add struct ipi_mapping and its helper functions Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 07/19] genirq: Make irq_domain_alloc_descs() non static Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 08/19] genirq: Add a new generic IPI reservation code to irq core Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 09/19] genirq: Add a new function to get IPI reverse mapping Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-27 11:46   ` Qais Yousef [this message]
2015-11-27 11:46     ` Qais Yousef
2015-11-30 10:40     ` Thomas Gleixner
2015-11-30 10:53       ` Qais Yousef
2015-11-30 10:53         ` Qais Yousef
2015-11-30 11:22         ` Thomas Gleixner
2015-11-30 11:59           ` Qais Yousef
2015-11-30 11:59             ` Qais Yousef
2015-12-01 10:47             ` Qais Yousef
2015-12-01 10:47               ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 10/19] genirq: Add a new irq_send_ipi() to irq_chip Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 11/19] genirq: Implement ipi_send_{mask, single}() Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 12/19] irqchip/mips-gic: Add a IPI hierarchy domain Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 13/19] irqchip/mips-gic: Add device " Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 14/19] irqchip/mips-gic: Use gic_vpes instead of NR_CPUS Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 15/19] irqchip/mips-gic: Clear percpu_masks correctly when mapping Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 16/19] MIPS: Add generic SMP IPI support Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 17/19] MIPS: Make smp CMP, CPS and MT use the new generic IPI functions Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 18/19] MIPS: Delete smp-gic.c Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 12:06 ` [PATCH v2 19/19] irqchip/mips-gic: Add new DT property to reserve IPIs Qais Yousef
2015-11-25 12:06   ` Qais Yousef
2015-11-25 16:09   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5658429D.3000105@imgtec.com \
    --to=qais.yousef@imgtec.com \
    --cc=jason@lakedaemon.net \
    --cc=jiang.liu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=marc.zyngier@arm.com \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.