[10/10] ocxl: Conditionally bind SCM devices to the generic OCXL driver
diff mbox series

Message ID 20191025044721.16617-11-alastair@au1.ibm.com
State Superseded
Headers show
Series
  • Add support for OpenCAPI SCM devices
Related show

Commit Message

Alastair D'Silva Oct. 25, 2019, 4:47 a.m. UTC
From: Alastair D'Silva <alastair@d-silva.org>

This patch allows the user to bind OpenCAPI SCM devices to the generic OCXL
driver.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 drivers/misc/ocxl/Kconfig | 7 +++++++
 drivers/misc/ocxl/pci.c   | 3 +++
 2 files changed, 10 insertions(+)

Comments

Christoph Hellwig Oct. 26, 2019, 6:43 a.m. UTC | #1
On Fri, Oct 25, 2019 at 03:47:05PM +1100, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
> 
> This patch allows the user to bind OpenCAPI SCM devices to the generic OCXL
> driver.

This completely misses any explanation of why you'd want that.  The
what is rather obvious from the patch.

> +config OCXL_SCM_GENERIC
> +	bool "Treat OpenCAPI Storage Class Memory as a generic OpenCAPI device"
> +	default n

n is the default default.
Andrew Donnellan Nov. 6, 2019, 3:46 a.m. UTC | #2
On 25/10/19 3:47 pm, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
> 
> This patch allows the user to bind OpenCAPI SCM devices to the generic OCXL
> driver.
> 
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>

Agree that this needs more explanation - both in the commit and the 
Kconfig help.

> diff --git a/drivers/misc/ocxl/pci.c b/drivers/misc/ocxl/pci.c
> index cb920aa88d3a..7137055c1883 100644
> --- a/drivers/misc/ocxl/pci.c
> +++ b/drivers/misc/ocxl/pci.c
> @@ -10,6 +10,9 @@
>    */
>   static const struct pci_device_id ocxl_pci_tbl[] = {
>   	{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x062B), },
> +#ifdef CONFIG_OCXL_SCM_GENERIC
> +	{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x0625), },
> +#endif
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(pci, ocxl_pci_tbl);
> 

If there's no way to use the ID table from ocxl-scm directly, there 
should at least be a comment both here and in the ocxl-scm device ID 
table mentioning that you need to keep these in sync.
Frederic Barrat Nov. 7, 2019, 6:08 p.m. UTC | #3
Le 25/10/2019 à 06:47, Alastair D'Silva a écrit :
> From: Alastair D'Silva <alastair@d-silva.org>
> 
> This patch allows the user to bind OpenCAPI SCM devices to the generic OCXL
> driver.
> 
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> ---


I'm wondering if we should upstream this. Is it of any use outside of 
some serious debug session for a developer?
Also we would now have 2 drivers picking up the same device ID, since 
the SCM driver is always registering for that ID, irrespective of 
CONFIG_OCXL_SCM_GENERIC

   Fred


>   drivers/misc/ocxl/Kconfig | 7 +++++++
>   drivers/misc/ocxl/pci.c   | 3 +++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
> index 1916fa65f2f2..8a683715c97c 100644
> --- a/drivers/misc/ocxl/Kconfig
> +++ b/drivers/misc/ocxl/Kconfig
> @@ -29,3 +29,10 @@ config OCXL
>   	  dedicated OpenCAPI link, and don't follow the same protocol.
>   
>   	  If unsure, say N.
> +
> +config OCXL_SCM_GENERIC
> +	bool "Treat OpenCAPI Storage Class Memory as a generic OpenCAPI device"
> +	default n
> +	help
> +	  Select this option to treat OpenCAPI Storage Class Memory
> +	  devices an generic OpenCAPI devices.
> diff --git a/drivers/misc/ocxl/pci.c b/drivers/misc/ocxl/pci.c
> index cb920aa88d3a..7137055c1883 100644
> --- a/drivers/misc/ocxl/pci.c
> +++ b/drivers/misc/ocxl/pci.c
> @@ -10,6 +10,9 @@
>    */
>   static const struct pci_device_id ocxl_pci_tbl[] = {
>   	{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x062B), },
> +#ifdef CONFIG_OCXL_SCM_GENERIC
> +	{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x0625), },
> +#endif
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(pci, ocxl_pci_tbl);
>
Alastair D'Silva Nov. 8, 2019, 12:37 a.m. UTC | #4
On Thu, 2019-11-07 at 19:08 +0100, Frederic Barrat wrote:
> 
> Le 25/10/2019 à 06:47, Alastair D'Silva a écrit :
> > From: Alastair D'Silva <alastair@d-silva.org>
> > 
> > This patch allows the user to bind OpenCAPI SCM devices to the
> > generic OCXL
> > driver.
> > 
> > Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> > ---
> 
> I'm wondering if we should upstream this. Is it of any use outside
> of 
> some serious debug session for a developer?
> Also we would now have 2 drivers picking up the same device ID,
> since 
> the SCM driver is always registering for that ID, irrespective of 
> CONFIG_OCXL_SCM_GENERIC
> 
>    Fred
> 

I think I'll drop this patch. It's easy enough to maintain out-of-tree
for our in-house SCM hardware engineers.

> 
> >   drivers/misc/ocxl/Kconfig | 7 +++++++
> >   drivers/misc/ocxl/pci.c   | 3 +++
> >   2 files changed, 10 insertions(+)
> > 
> > diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
> > index 1916fa65f2f2..8a683715c97c 100644
> > --- a/drivers/misc/ocxl/Kconfig
> > +++ b/drivers/misc/ocxl/Kconfig
> > @@ -29,3 +29,10 @@ config OCXL
> >   	  dedicated OpenCAPI link, and don't follow the same protocol.
> >   
> >   	  If unsure, say N.
> > +
> > +config OCXL_SCM_GENERIC
> > +	bool "Treat OpenCAPI Storage Class Memory as a generic OpenCAPI
> > device"
> > +	default n
> > +	help
> > +	  Select this option to treat OpenCAPI Storage Class Memory
> > +	  devices an generic OpenCAPI devices.
> > diff --git a/drivers/misc/ocxl/pci.c b/drivers/misc/ocxl/pci.c
> > index cb920aa88d3a..7137055c1883 100644
> > --- a/drivers/misc/ocxl/pci.c
> > +++ b/drivers/misc/ocxl/pci.c
> > @@ -10,6 +10,9 @@
> >    */
> >   static const struct pci_device_id ocxl_pci_tbl[] = {
> >   	{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x062B), },
> > +#ifdef CONFIG_OCXL_SCM_GENERIC
> > +	{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x0625), },
> > +#endif
> >   	{ }
> >   };
> >   MODULE_DEVICE_TABLE(pci, ocxl_pci_tbl);
> >

Patch
diff mbox series

diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
index 1916fa65f2f2..8a683715c97c 100644
--- a/drivers/misc/ocxl/Kconfig
+++ b/drivers/misc/ocxl/Kconfig
@@ -29,3 +29,10 @@  config OCXL
 	  dedicated OpenCAPI link, and don't follow the same protocol.
 
 	  If unsure, say N.
+
+config OCXL_SCM_GENERIC
+	bool "Treat OpenCAPI Storage Class Memory as a generic OpenCAPI device"
+	default n
+	help
+	  Select this option to treat OpenCAPI Storage Class Memory
+	  devices an generic OpenCAPI devices.
diff --git a/drivers/misc/ocxl/pci.c b/drivers/misc/ocxl/pci.c
index cb920aa88d3a..7137055c1883 100644
--- a/drivers/misc/ocxl/pci.c
+++ b/drivers/misc/ocxl/pci.c
@@ -10,6 +10,9 @@ 
  */
 static const struct pci_device_id ocxl_pci_tbl[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x062B), },
+#ifdef CONFIG_OCXL_SCM_GENERIC
+	{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x0625), },
+#endif
 	{ }
 };
 MODULE_DEVICE_TABLE(pci, ocxl_pci_tbl);