All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Ley Foon Tan <lftan@altera.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Russell King <linux@arm.linux.org.uk>,
	Arnd Bergmann <arnd@arndb.de>,
	Dinh Nguyen <dinguyen@opensource.altera.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/6] pci: altera: Add Altera PCIe MSI driver
Date: Wed, 29 Jul 2015 10:15:39 +0100	[thread overview]
Message-ID: <55B899BB.2090008@arm.com> (raw)
In-Reply-To: <CAFiDJ59kb=tDbnktmdF5r1_ShUfwvpxDQUtWV8LieS5Y=iVi4w@mail.gmail.com>

On 29/07/15 09:52, Ley Foon Tan wrote:
> On Wed, Jul 29, 2015 at 1:58 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> Hi Ley,
>>
>> On 28/07/15 11:45, Ley Foon Tan wrote:
>>> This patch adds Altera PCIe MSI driver. This soft IP supports configurable
>>> number of vectors, which is a dts parameter.
>>
>> Can't you read this configuration from the HW?
> No, we can't read from HW.

Ah, that's a shame. Specially on HW that is configurable by design.

[...]

>>> +
>>> +                     irq = irq_find_mapping(msi->msi_domain->parent, offset);
>>
>> This would tend to indicate that you don't really need to store the
>> msi_domain pointer, but the inner_domain pointer instead.
> Will store the inner_domain pointer. But, I think we still need
> msi_domain for irq_domain_remove.
> Or do we have any way to retrieve msi_domain from inner_domain?

Do you have any case where you remove the domains, aside from the
obvious error cases?

[...]

>>> +
>>> +static struct msi_domain_info altera_msi_domain_info = {
>>> +     .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS),
>>
>> So you don't support MSIX? That's a bit weird.
> Yes, this MSI IP doesn't support it.

This is not really a function of the MSI IP, but of the PCI device. In
your case, this is just a set of doorbells, so I hardly see what would
prevent MSI-X to be supported. Multi-MSI, I can see why.

[...]

>>> +static int altera_msi_set_affinity(struct irq_data *irq_data,
>>> +                              const struct cpumask *mask, bool force)
>>> +{
>>> +      return irq_set_affinity(irq_data->hwirq, mask);
>>
>> There is no way this can be right. irq_data->hwirq can *never* be passed
>> as a Linux IRQ. This really should be the IRQ to the GIC.
>>
>> Which raises another issue: as you only have a single interrupt to the
>> GIC, changing the affinity of a single MSI is going to affect all the
>> other MSIs as well. This doesn't seem like a desirable behaviour.
> Do we must provide '.irq_set_affinity" callback to msi domain? I have
> tried set it to NULL,
> but kernel got the NULL pointer deference error from msi_domain_set_affinity().
> Recently, I saw this new patch for pci-tegra.c from [1], it doesn't
> set the ".irq_set_affinity".
> Just wonder how it can work.
> 
> Do you have any recommendation way for this?
> 
> [1] https://git.kernel.org/cgit/linux/kernel/git/maz/arm-platforms.git/commit/drivers/pci/host?h=irq/gsi-irq-domain-v2&id=17c22fc4e60e6ad54c7e3b73868cbc057360fa63

Please realize that I *never* tested this patch (I don't think I ever
posted it officially, I just keep here for convenience), and I wouldn't
take it as a reference.

When it comes to msi_domain_set_affinity issue, this look more like an
oversight. I'll cook a patch for that.

Anyway, whichever way you want to do it, you need to fix this. You could
always return -EINVAL in the meantime,

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

WARNING: multiple messages have this Message-ID (diff)
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] pci: altera: Add Altera PCIe MSI driver
Date: Wed, 29 Jul 2015 10:15:39 +0100	[thread overview]
Message-ID: <55B899BB.2090008@arm.com> (raw)
In-Reply-To: <CAFiDJ59kb=tDbnktmdF5r1_ShUfwvpxDQUtWV8LieS5Y=iVi4w@mail.gmail.com>

On 29/07/15 09:52, Ley Foon Tan wrote:
> On Wed, Jul 29, 2015 at 1:58 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> Hi Ley,
>>
>> On 28/07/15 11:45, Ley Foon Tan wrote:
>>> This patch adds Altera PCIe MSI driver. This soft IP supports configurable
>>> number of vectors, which is a dts parameter.
>>
>> Can't you read this configuration from the HW?
> No, we can't read from HW.

Ah, that's a shame. Specially on HW that is configurable by design.

[...]

>>> +
>>> +                     irq = irq_find_mapping(msi->msi_domain->parent, offset);
>>
>> This would tend to indicate that you don't really need to store the
>> msi_domain pointer, but the inner_domain pointer instead.
> Will store the inner_domain pointer. But, I think we still need
> msi_domain for irq_domain_remove.
> Or do we have any way to retrieve msi_domain from inner_domain?

Do you have any case where you remove the domains, aside from the
obvious error cases?

[...]

>>> +
>>> +static struct msi_domain_info altera_msi_domain_info = {
>>> +     .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS),
>>
>> So you don't support MSIX? That's a bit weird.
> Yes, this MSI IP doesn't support it.

This is not really a function of the MSI IP, but of the PCI device. In
your case, this is just a set of doorbells, so I hardly see what would
prevent MSI-X to be supported. Multi-MSI, I can see why.

[...]

>>> +static int altera_msi_set_affinity(struct irq_data *irq_data,
>>> +                              const struct cpumask *mask, bool force)
>>> +{
>>> +      return irq_set_affinity(irq_data->hwirq, mask);
>>
>> There is no way this can be right. irq_data->hwirq can *never* be passed
>> as a Linux IRQ. This really should be the IRQ to the GIC.
>>
>> Which raises another issue: as you only have a single interrupt to the
>> GIC, changing the affinity of a single MSI is going to affect all the
>> other MSIs as well. This doesn't seem like a desirable behaviour.
> Do we must provide '.irq_set_affinity" callback to msi domain? I have
> tried set it to NULL,
> but kernel got the NULL pointer deference error from msi_domain_set_affinity().
> Recently, I saw this new patch for pci-tegra.c from [1], it doesn't
> set the ".irq_set_affinity".
> Just wonder how it can work.
> 
> Do you have any recommendation way for this?
> 
> [1] https://git.kernel.org/cgit/linux/kernel/git/maz/arm-platforms.git/commit/drivers/pci/host?h=irq/gsi-irq-domain-v2&id=17c22fc4e60e6ad54c7e3b73868cbc057360fa63

Please realize that I *never* tested this patch (I don't think I ever
posted it officially, I just keep here for convenience), and I wouldn't
take it as a reference.

When it comes to msi_domain_set_affinity issue, this look more like an
oversight. I'll cook a patch for that.

Anyway, whichever way you want to do it, you need to fix this. You could
always return -EINVAL in the meantime,

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2015-07-29  9:15 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 10:45 [PATCH 0/6] Altera PCIe host controller driver with MSI support Ley Foon Tan
2015-07-28 10:45 ` Ley Foon Tan
2015-07-28 10:45 ` Ley Foon Tan
2015-07-28 10:45 ` [PATCH 1/6] arm: add msi.h to Kbuild Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 10:45 ` [PATCH 2/6] arm: mach-socfpga: enable pci support Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 13:26   ` Rob Herring
2015-07-28 13:26     ` Rob Herring
2015-07-29  3:03     ` Ley Foon Tan
2015-07-29  3:03       ` Ley Foon Tan
2015-07-28 10:45 ` [PATCH 3/6] pci:host: Add Altera PCIe host controller driver Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 16:45   ` Dinh Nguyen
2015-07-28 16:45     ` Dinh Nguyen
2015-07-29  3:05     ` Ley Foon Tan
2015-07-29  3:05       ` Ley Foon Tan
2015-07-29  3:43   ` Rob Herring
2015-07-29  3:43     ` Rob Herring
2015-07-29 11:08     ` Ley Foon Tan
2015-07-29 11:08       ` Ley Foon Tan
2015-07-29  8:35   ` Paul Bolle
2015-07-29  8:35     ` Paul Bolle
2015-07-29 17:43     ` Ley Foon Tan
2015-07-29 17:43       ` Ley Foon Tan
2015-07-29 17:43       ` Ley Foon Tan
2015-07-29 13:19   ` Lorenzo Pieralisi
2015-07-29 13:19     ` Lorenzo Pieralisi
2015-07-29 17:51     ` Ley Foon Tan
2015-07-29 17:51       ` Ley Foon Tan
2015-07-28 10:45 ` [PATCH 4/6] pci: altera: Add Altera PCIe MSI driver Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 17:00   ` Dinh Nguyen
2015-07-28 17:00     ` Dinh Nguyen
2015-07-29  3:07     ` Ley Foon Tan
2015-07-29  3:07       ` Ley Foon Tan
2015-07-29  3:38       ` Dinh Nguyen
2015-07-29  3:38         ` Dinh Nguyen
2015-07-29  8:53     ` Ley Foon Tan
2015-07-29  8:53       ` Ley Foon Tan
2015-07-29  8:53       ` Ley Foon Tan
2015-07-28 17:58   ` Marc Zyngier
2015-07-28 17:58     ` Marc Zyngier
2015-07-29  8:52     ` Ley Foon Tan
2015-07-29  8:52       ` Ley Foon Tan
2015-07-29  9:15       ` Marc Zyngier [this message]
2015-07-29  9:15         ` Marc Zyngier
2015-07-31  3:19         ` Ley Foon Tan
2015-07-31  3:19           ` Ley Foon Tan
2015-07-28 10:45 ` [PATCH 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 10:45 ` [PATCH 6/6] MAINTAINERS: Add Altera PCIe driver maintainer Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan
2015-07-28 10:45   ` Ley Foon Tan

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=55B899BB.2090008@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@opensource.altera.com \
    --cc=lftan@altera.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=robh+dt@kernel.org \
    /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.