All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Ley Foon Tan <lftan@altera.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Russell King <linux@arm.linux.org.uk>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Dinh Nguyen <dinguyen@opensource.altera.com>,
	linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Subject: Re: [PATCH v9 3/6] pci:host: Add Altera PCIe host controller driver
Date: Wed, 14 Oct 2015 11:36:04 +0200	[thread overview]
Message-ID: <5210459.PtmhWaT6RM@wuerfel> (raw)
In-Reply-To: <CAFiDJ59AuXmM8vN9=ry8_UvS-paRN54CdCFw6EUMx9RV2TT3bQ@mail.gmail.com>

On Wednesday 14 October 2015 17:28:45 Ley Foon Tan wrote:
> On Wed, Oct 14, 2015 at 5:09 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Wednesday 14 October 2015 16:32:25 Ley Foon Tan wrote:
> >> On Wed, Oct 14, 2015 at 4:20 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> >> > On Wednesday 14 October 2015 10:41:29 Ley Foon Tan wrote:
> >> >> +static int altera_pcie_remove(struct platform_device *pdev)
> >> >> +{
> >> >> +     struct altera_pcie *pcie = platform_get_drvdata(pdev);
> >> >> +
> >> >> +     altera_pcie_free_irq_domain(pcie);
> >> >> +     platform_set_drvdata(pdev, NULL);
> >> >> +     return 0;
> >> >> +}
> >> >
> >> > I just noticed this. Does it actually work to unload the module
> >> > and tear down all the pci_dev structures in a safe way?
> >> Good catch. It only can be compiled as builtin-moduley now, so we can
> >> remove this _remove callback function.
> >
> > I think we should change both: make it possible to load the
> > driver dynamically, and remove the altera_pcie_remove function.
> This driver depends on the pci fixups to work correctly. But, fixups
> callback functions in this driver are not being call if the driver is
> loadable module.

Ah, I see. We should find a better way to deal with this, as we
are getting an increasing number of host driver specific fixups.

Bjorn, do you have any idea here?

Could we perhaps have a helper function that lets us register
fixups dynamically?

> The linker script keeps all pci fixup callbacks in pci fixup regions
> during kernel compile time. So, it needs to be builtin module. Do you
> know any way we can update those fixup regions?

The only method I'm aware of at the moment is move the fixups to
drivers/pci/quirks.c and enclose them in an #ifdef if you want them
to not appear in kernels that don't support your SoC.

> > You can prevent the module from being unloaded if you also remove
> > the module_platform_driver() directive and add a module_init()
> > without a matching module_exit().
> >
> > Please also add a '.suppress_bind_attrs = true,' flag in the driver
> > struct to prevent manual unbinding.
> I think we don't need these if it only can work as builtin module.

No, this is orthogonal, you need it either way, as built-in drivers
can still be unbound by writing to sysfs. Try writing the device name
to /sys/bus/platform/drivers/altera-pcie/unbind and watch it blow up ;-)

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 3/6] pci:host: Add Altera PCIe host controller driver
Date: Wed, 14 Oct 2015 11:36:04 +0200	[thread overview]
Message-ID: <5210459.PtmhWaT6RM@wuerfel> (raw)
In-Reply-To: <CAFiDJ59AuXmM8vN9=ry8_UvS-paRN54CdCFw6EUMx9RV2TT3bQ@mail.gmail.com>

On Wednesday 14 October 2015 17:28:45 Ley Foon Tan wrote:
> On Wed, Oct 14, 2015 at 5:09 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Wednesday 14 October 2015 16:32:25 Ley Foon Tan wrote:
> >> On Wed, Oct 14, 2015 at 4:20 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> >> > On Wednesday 14 October 2015 10:41:29 Ley Foon Tan wrote:
> >> >> +static int altera_pcie_remove(struct platform_device *pdev)
> >> >> +{
> >> >> +     struct altera_pcie *pcie = platform_get_drvdata(pdev);
> >> >> +
> >> >> +     altera_pcie_free_irq_domain(pcie);
> >> >> +     platform_set_drvdata(pdev, NULL);
> >> >> +     return 0;
> >> >> +}
> >> >
> >> > I just noticed this. Does it actually work to unload the module
> >> > and tear down all the pci_dev structures in a safe way?
> >> Good catch. It only can be compiled as builtin-moduley now, so we can
> >> remove this _remove callback function.
> >
> > I think we should change both: make it possible to load the
> > driver dynamically, and remove the altera_pcie_remove function.
> This driver depends on the pci fixups to work correctly. But, fixups
> callback functions in this driver are not being call if the driver is
> loadable module.

Ah, I see. We should find a better way to deal with this, as we
are getting an increasing number of host driver specific fixups.

Bjorn, do you have any idea here?

Could we perhaps have a helper function that lets us register
fixups dynamically?

> The linker script keeps all pci fixup callbacks in pci fixup regions
> during kernel compile time. So, it needs to be builtin module. Do you
> know any way we can update those fixup regions?

The only method I'm aware of at the moment is move the fixups to
drivers/pci/quirks.c and enclose them in an #ifdef if you want them
to not appear in kernels that don't support your SoC.

> > You can prevent the module from being unloaded if you also remove
> > the module_platform_driver() directive and add a module_init()
> > without a matching module_exit().
> >
> > Please also add a '.suppress_bind_attrs = true,' flag in the driver
> > struct to prevent manual unbinding.
> I think we don't need these if it only can work as builtin module.

No, this is orthogonal, you need it either way, as built-in drivers
can still be unbound by writing to sysfs. Try writing the device name
to /sys/bus/platform/drivers/altera-pcie/unbind and watch it blow up ;-)

	Arnd

  reply	other threads:[~2015-10-14  9:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14  2:41 [PATCH v9 0/6] Altera PCIe host controller driver with MSI support Ley Foon Tan
2015-10-14  2:41 ` Ley Foon Tan
2015-10-14  2:41 ` Ley Foon Tan
2015-10-14  2:41 ` [PATCH v9 1/6] arm: add msi.h to Kbuild Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41 ` [PATCH v9 2/6] pci: add Altera PCI vendor ID Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41 ` [PATCH v9 3/6] pci:host: Add Altera PCIe host controller driver Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  8:20   ` Arnd Bergmann
2015-10-14  8:20     ` Arnd Bergmann
2015-10-14  8:32     ` Ley Foon Tan
2015-10-14  8:32       ` Ley Foon Tan
2015-10-14  9:09       ` Arnd Bergmann
2015-10-14  9:09         ` Arnd Bergmann
2015-10-14  9:28         ` Ley Foon Tan
2015-10-14  9:28           ` Ley Foon Tan
2015-10-14  9:36           ` Arnd Bergmann [this message]
2015-10-14  9:36             ` Arnd Bergmann
2015-10-14 10:01             ` Ley Foon Tan
2015-10-14 10:01               ` Ley Foon Tan
2015-10-14 13:32               ` Arnd Bergmann
2015-10-14 13:32                 ` Arnd Bergmann
2015-10-16  8:48                 ` Ley Foon Tan
2015-10-16  8:48                   ` Ley Foon Tan
2015-10-14  2:41 ` [PATCH v9 4/6] pci: altera: Add Altera PCIe MSI driver Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41 ` [PATCH v9 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41 ` [PATCH v9 6/6] MAINTAINERS: Add Altera PCIe and MSI drivers maintainer Ley Foon Tan
2015-10-14  2:41   ` Ley Foon Tan
2015-10-14  2:41   ` 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=5210459.PtmhWaT6RM@wuerfel \
    --to=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@opensource.altera.com \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --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=lorenzo.pieralisi@arm.com \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --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.