From: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Antoine Tenart <antoine.tenart@bootlin.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Bjorn Helgaas <bhelgaas@google.com>,
Pascal van Leeuwen <pascalvanl@gmail.com>,
Kelsey Skunberg <skunberg.kelsey@gmail.com>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: RE: [PATCH 3/3] crypto: inside-secure - Remove #ifdef checks
Date: Thu, 17 Oct 2019 14:14:03 +0000 [thread overview]
Message-ID: <MN2PR20MB29736FBE530B603C71F99AD6CA6D0@MN2PR20MB2973.namprd20.prod.outlook.com> (raw)
In-Reply-To: <CAK8P3a3+UrqS0nQxcG7UuMt4s5FDnowFq-C5-K5XU-CKpciM8g@mail.gmail.com>
> -----Original Message-----
> From: Arnd Bergmann <arnd@arndb.de>
> Sent: Thursday, October 17, 2019 3:48 PM
> To: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
> Cc: Antoine Tenart <antoine.tenart@bootlin.com>; Herbert Xu <herbert@gondor.apana.org.au>;
> David S. Miller <davem@davemloft.net>; Bjorn Helgaas <bhelgaas@google.com>; Pascal van Leeuwen
> <pascalvanl@gmail.com>; Kelsey Skunberg <skunberg.kelsey@gmail.com>; linux-
> crypto@vger.kernel.org; linux-kernel@vger.kernel.org; linux-pci@vger.kernel.org
> Subject: Re: [PATCH 3/3] crypto: inside-secure - Remove #ifdef checks
>
> On Thu, Oct 17, 2019 at 3:26 PM Pascal Van Leeuwen
> <pvanleeuwen@verimatrix.com> wrote:
>
> > > /* Register PCI driver */
> > > - pcireg_rc = pci_register_driver(&safexcel_pci_driver);
> > > -#endif
> > > + ret = pci_register_driver(&safexcel_pci_driver);
> > >
> > > -#if IS_ENABLED(CONFIG_OF)
> > > /* Register platform driver */
> > > - ofreg_rc = platform_driver_register(&crypto_safexcel);
> > > - #if IS_ENABLED(CONFIG_PCI)
> > > - /* Return success if either PCI or OF registered OK */
> > > - return pcireg_rc ? ofreg_rc : 0;
> > > - #else
> > > - return ofreg_rc;
> > > - #endif
> > > -#else
> > > - #if IS_ENABLED(CONFIG_PCI)
> > > - return pcireg_rc;
> > > - #else
> > > - return -EINVAL;
> > > - #endif
> > > -#endif
> > > + if (IS_ENABLED(CONFIG_OF) && !ret) {
> > >
> > Hmm ... this would make it skip the OF registration if the PCIE
> > registration failed. Note that the typical embedded system will
> > have a PCIE subsystem (e.g. Marvell A7K/A8K does) but will have
> > the EIP embedded on the SoC as an OF device.
> >
> > So the question is: is it possible somehow that PCIE registration
> > fails while OF registration does pass? Because in that case, this
> > code would be wrong ...
>
> I don't see how it would fail. When CONFIG_PCI is disabled,
> pci_register_driver() does nothing, and the pci_driver as well
> as everything referenced from it will be silently dropped from
> the object file.
> If CONFIG_PCI is enabled, then the driver will be registered
> to the PCI subsystem, waiting for a device to show up, but
> the driver registration does not care about whether there is
> such a device.
>
I know it does not care about the device being present or not.
I was just worried some issue with the PCIE subsystem would propagate
to (unrelated) OF device use this way. But I have no idea on the exact
ways PCIE registration may fail. If it is because of lack of memory,
I assume that subsequent OF device registration would fail as well.
So maybe I'm worried about an issue that doesn't really exist.
> > Other than that, I don't care much how this code is implemented
> > as long as it works for both my use cases, being an OF embedded
> > device (on a SoC _with_ or _without_ PCIE support) and a device
> > on a PCIE board in a PCI (which has both PCIE and OF support).
>
> Yes, that should be fine. There are a lot of drivers that support
> multiple bus interfaces, and this is the normal way to handle them.
>
Ok, if this is the "normal way to handle this" and a lot of other
drivers do it the same way, then I'm OK with that ...
I already verified it works correctly for my specific use cases.
Thanks.
> Arnd
Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com
next prev parent reply other threads:[~2019-10-17 14:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-30 12:14 [PATCH 1/3] crypto: inside-secure - Fix a maybe-uninitialized warning Arnd Bergmann
2019-09-30 12:14 ` [PATCH 2/3] crypto: inside-secure - Reduce stack usage Arnd Bergmann
2019-09-30 19:04 ` Pascal Van Leeuwen
2019-09-30 20:11 ` Arnd Bergmann
2019-09-30 21:09 ` Pascal Van Leeuwen
2019-10-01 18:49 ` Arnd Bergmann
2019-10-10 12:40 ` Herbert Xu
2019-09-30 12:14 ` [PATCH 3/3] crypto: inside-secure - Remove #ifdef checks Arnd Bergmann
2019-09-30 13:04 ` Bjorn Helgaas
2019-10-10 12:55 ` Herbert Xu
2019-10-17 13:26 ` Pascal Van Leeuwen
2019-10-17 13:47 ` Arnd Bergmann
2019-10-17 14:14 ` Pascal Van Leeuwen [this message]
2019-09-30 18:50 ` [PATCH 1/3] crypto: inside-secure - Fix a maybe-uninitialized warning Pascal Van Leeuwen
2019-10-10 12:54 ` Herbert Xu
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=MN2PR20MB29736FBE530B603C71F99AD6CA6D0@MN2PR20MB2973.namprd20.prod.outlook.com \
--to=pvanleeuwen@verimatrix.com \
--cc=antoine.tenart@bootlin.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=pascalvanl@gmail.com \
--cc=skunberg.kelsey@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).