All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mason <slash.tmp@free.fr>
To: Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	David Laight <david.laight@aculab.com>,
	linux-pci <linux-pci@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Thibaud Cornic <thibaud_cornic@sigmadesigns.com>,
	Phuong Nguyen <phuong_nguyen@sigmadesigns.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v0.2] PCI: Add support for tango PCIe host bridge
Date: Tue, 11 Apr 2017 19:52:10 +0200	[thread overview]
Message-ID: <b59b81ea-bc1b-bff5-4a78-8a69538b0de3@free.fr> (raw)
In-Reply-To: <67014006-a380-9e3b-c9af-a421052cb8e0@arm.com>

On 11/04/2017 18:43, Marc Zyngier wrote:

> On 11/04/17 17:26, Mason wrote:
>
>> Is there a function to map virq to the hwirq in any domain?
> 
> Be more precise. If you want the hwirq associated with the view of a
> virq in a given domain, that's the hwirq field in the corresponding
> irq_data structure. Or are you after something else?

I registered an unmask method for my irq_chip.
(IIUC, I'm supposed to unmask a specific MSI in this callback.)

# cat /proc/interrupts 
           CPU0       CPU1       
 30:          0          0    MSIfoo      0 Edge      aerdrv
 34:          0          0    MSIfoo 524288 Edge      xhci_hcd
 35:          0          0    MSIfoo 524289 Edge      xhci_hcd
 36:          0          0    MSIfoo 524290 Edge      xhci_hcd


void foo_unmask(struct irq_data *data)
{
	int xx,yy;
	struct irq_domain *dom = data->domain;
	printk("%s: irq_data=%p irq=%u hwirq=%lu chip=%p dom=%p pdata=%p data=%p\n",
		__func__, data, data->irq, data->hwirq, data->chip, data->domain,
		data->parent_data, data->chip_data);
	printk("%s ops=%p data=%p parent=%p\n\n",
		dom->name, dom->ops, dom->host_data, dom->parent);
	printk("pcie=%p\n", dom->parent->host_data);
	//dump_stack();
	pci_msi_unmask_irq(data);
	struct tango_pcie *pcie = data->domain->parent->host_data;
	printk("\n%s: pcie=%p irq=%u hwirq=%lu\n\n",
		__func__, pcie, data->irq, data->hwirq);
	xx = irq_find_mapping(pcie->irq_domain, data->hwirq);
	yy = irq_find_mapping(pcie->msi_domain, data->hwirq);
	printk("xx=%d yy=%d\n", xx, yy);
}

so data->irq is the virq (30, 34, 35, 36)
and data->hwirq is the domain hwirq (0, 524288, 524289, 524290)

Is there a way to map hwirq 524288 to MSI 0, hwirq 524289 to MSI 1, etc?

Regards.

WARNING: multiple messages have this Message-ID (diff)
From: slash.tmp@free.fr (Mason)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v0.2] PCI: Add support for tango PCIe host bridge
Date: Tue, 11 Apr 2017 19:52:10 +0200	[thread overview]
Message-ID: <b59b81ea-bc1b-bff5-4a78-8a69538b0de3@free.fr> (raw)
In-Reply-To: <67014006-a380-9e3b-c9af-a421052cb8e0@arm.com>

On 11/04/2017 18:43, Marc Zyngier wrote:

> On 11/04/17 17:26, Mason wrote:
>
>> Is there a function to map virq to the hwirq in any domain?
> 
> Be more precise. If you want the hwirq associated with the view of a
> virq in a given domain, that's the hwirq field in the corresponding
> irq_data structure. Or are you after something else?

I registered an unmask method for my irq_chip.
(IIUC, I'm supposed to unmask a specific MSI in this callback.)

# cat /proc/interrupts 
           CPU0       CPU1       
 30:          0          0    MSIfoo      0 Edge      aerdrv
 34:          0          0    MSIfoo 524288 Edge      xhci_hcd
 35:          0          0    MSIfoo 524289 Edge      xhci_hcd
 36:          0          0    MSIfoo 524290 Edge      xhci_hcd


void foo_unmask(struct irq_data *data)
{
	int xx,yy;
	struct irq_domain *dom = data->domain;
	printk("%s: irq_data=%p irq=%u hwirq=%lu chip=%p dom=%p pdata=%p data=%p\n",
		__func__, data, data->irq, data->hwirq, data->chip, data->domain,
		data->parent_data, data->chip_data);
	printk("%s ops=%p data=%p parent=%p\n\n",
		dom->name, dom->ops, dom->host_data, dom->parent);
	printk("pcie=%p\n", dom->parent->host_data);
	//dump_stack();
	pci_msi_unmask_irq(data);
	struct tango_pcie *pcie = data->domain->parent->host_data;
	printk("\n%s: pcie=%p irq=%u hwirq=%lu\n\n",
		__func__, pcie, data->irq, data->hwirq);
	xx = irq_find_mapping(pcie->irq_domain, data->hwirq);
	yy = irq_find_mapping(pcie->msi_domain, data->hwirq);
	printk("xx=%d yy=%d\n", xx, yy);
}

so data->irq is the virq (30, 34, 35, 36)
and data->hwirq is the domain hwirq (0, 524288, 524289, 524290)

Is there a way to map hwirq 524288 to MSI 0, hwirq 524289 to MSI 1, etc?

Regards.

  reply	other threads:[~2017-04-11 17:52 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 13:05 [RFC PATCH v0.2] PCI: Add support for tango PCIe host bridge Mason
2017-03-23 13:05 ` Mason
2017-03-23 14:22 ` Marc Zyngier
2017-03-23 14:22   ` Marc Zyngier
2017-03-23 17:03   ` Mason
2017-03-23 17:03     ` Mason
2017-03-23 23:40     ` Mason
2017-03-23 23:40       ` Mason
2017-03-24 18:22       ` Marc Zyngier
2017-03-24 18:22         ` Marc Zyngier
2017-03-27 14:35         ` Mason
2017-03-27 14:35           ` Mason
2017-03-27 14:35           ` Mason
2017-03-27 14:46           ` Thomas Gleixner
2017-03-27 14:46             ` Thomas Gleixner
2017-03-27 15:18             ` Mason
2017-03-27 15:18               ` Mason
2017-03-27 15:18               ` Mason
2017-03-24 18:47     ` Marc Zyngier
2017-03-24 18:47       ` Marc Zyngier
2017-03-27 15:53       ` Mason
2017-03-27 15:53         ` Mason
2017-03-27 17:09         ` Marc Zyngier
2017-03-27 17:09           ` Marc Zyngier
2017-03-27 19:44           ` Mason
2017-03-27 19:44             ` Mason
2017-03-27 21:07             ` Marc Zyngier
2017-03-27 21:07               ` Marc Zyngier
2017-03-27 21:07               ` Marc Zyngier
2017-03-27 22:04               ` Mason
2017-03-27 22:04                 ` Mason
2017-03-28  8:21                 ` Marc Zyngier
2017-03-28  8:21                   ` Marc Zyngier
2017-04-11 15:13           ` Mason
2017-04-11 15:13             ` Mason
2017-04-11 15:49             ` Marc Zyngier
2017-04-11 15:49               ` Marc Zyngier
2017-04-11 16:26               ` Mason
2017-04-11 16:26                 ` Mason
2017-04-11 16:43                 ` Marc Zyngier
2017-04-11 16:43                   ` Marc Zyngier
2017-04-11 17:52                   ` Mason [this message]
2017-04-11 17:52                     ` Mason
2017-04-12  8:08                     ` Marc Zyngier
2017-04-12  8:08                       ` Marc Zyngier
2017-04-12  9:50                       ` Mason
2017-04-12  9:50                         ` Mason
2017-04-12  9:59                         ` Marc Zyngier
2017-04-12  9:59                           ` Marc Zyngier
2017-04-19 11:19                           ` Mason
2017-04-19 11:19                             ` Mason
2017-04-20  8:20                             ` Mason
2017-04-20  8:20                               ` Mason
2017-04-20  9:43                               ` Marc Zyngier
2017-04-20  9:43                                 ` Marc Zyngier
2017-03-29 11:39 ` Mason
2017-03-29 11:39   ` Mason
2017-03-30 11:09 ` Mason
2017-03-30 11:09   ` Mason

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=b59b81ea-bc1b-bff5-4a78-8a69538b0de3@free.fr \
    --to=slash.tmp@free.fr \
    --cc=david.laight@aculab.com \
    --cc=helgaas@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marc.zyngier@arm.com \
    --cc=phuong_nguyen@sigmadesigns.com \
    --cc=robin.murphy@arm.com \
    --cc=tglx@linutronix.de \
    --cc=thibaud_cornic@sigmadesigns.com \
    /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.