diff mbox

[v6,12/20] cxl: Add guest-specific code

Message ID 20160309124238.37FD414032B@ozlabs.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Michael Ellerman March 9, 2016, 12:42 p.m. UTC
On Fri, 2016-04-03 at 11:26:36 UTC, Frederic Barrat wrote:
> From: Christophe Lombard <clombard@linux.vnet.ibm.com>
> 
> The new of.c file contains code to parse the device tree to find out
> about cxl adapters and AFUs.
> 
> guest.c implements the guest-specific callbacks for the backend API.
> 
> The process element ID is not known until the context is attached, so
> we have to separate the context ID assigned by the cxl driver from the
> process element ID visible to the user applications. In bare-metal,
> the 2 IDs match.
> 
> Co-authored-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
> Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com>
> Acked-by: Ian Munsie <imunsie@au1.ibm.com>
> ---
>  drivers/misc/cxl/Makefile  |   1 +
>  drivers/misc/cxl/api.c     |   2 +-
>  drivers/misc/cxl/context.c |   6 +-
>  drivers/misc/cxl/cxl.h     |  37 +-
>  drivers/misc/cxl/file.c    |   2 +-
>  drivers/misc/cxl/guest.c   | 950 +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/misc/cxl/main.c    |  18 +-
>  drivers/misc/cxl/of.c      | 513 ++++++++++++++++++++++++
>  8 files changed, 1519 insertions(+), 10 deletions(-)
>  create mode 100644 drivers/misc/cxl/guest.c
>  create mode 100644 drivers/misc/cxl/of.c
> 
> diff --git a/drivers/misc/cxl/Makefile b/drivers/misc/cxl/Makefile
> index be2ac5c..a3d4bef 100644
> --- a/drivers/misc/cxl/Makefile
> +++ b/drivers/misc/cxl/Makefile
> @@ -4,6 +4,7 @@ ccflags-$(CONFIG_PPC_WERROR)	+= -Werror
>  cxl-y				+= main.o file.o irq.o fault.o native.o
>  cxl-y				+= context.o sysfs.o debugfs.o pci.o trace.o
>  cxl-y				+= vphb.o api.o
> +cxl-y				+= guest.o of.o hcalls.o
>  obj-$(CONFIG_CXL)		+= cxl.o
>  obj-$(CONFIG_CXL_BASE)		+= base.o

This breaks the (newly added[1]) powernv_defconfig. ie. CONFIG_POWERNV=y, CONFIG_PPC_PSERIES=n.

  ERROR: "plpar_hcall" [drivers/misc/cxl/cxl.ko] undefined!
  ERROR: "rtas_call" [drivers/misc/cxl/cxl.ko] undefined!
  ERROR: "rtas_data_buf" [drivers/misc/cxl/cxl.ko] undefined!
  ERROR: "rtas_token" [drivers/misc/cxl/cxl.ko] undefined!
  ERROR: "plpar_hcall9" [drivers/misc/cxl/cxl.ko] undefined!
  ERROR: "rtas_data_buf_lock" [drivers/misc/cxl/cxl.ko] undefined!


Which is a show-stopper.

I've applied the following patch, let me know if there's anything wrong with
it. It would be great if we could do something cleaner.

cheers

Comments

Michael Ellerman March 9, 2016, 12:57 p.m. UTC | #1
On Wed, 2016-03-09 at 23:42 +1100, Michael Ellerman wrote:
> On Fri, 2016-04-03 at 11:26:36 UTC, Frederic Barrat wrote:
> > From: Christophe Lombard <clombard@linux.vnet.ibm.com>
> > diff --git a/drivers/misc/cxl/Makefile b/drivers/misc/cxl/Makefile
> > index be2ac5c..a3d4bef 100644
> > --- a/drivers/misc/cxl/Makefile
> > +++ b/drivers/misc/cxl/Makefile
> > @@ -4,6 +4,7 @@ ccflags-$(CONFIG_PPC_WERROR)	+= -Werror
> >  cxl-y				+= main.o file.o irq.o fault.o native.o
> >  cxl-y				+= context.o sysfs.o debugfs.o pci.o trace.o
> >  cxl-y				+= vphb.o api.o
> > +cxl-y				+= guest.o of.o hcalls.o
> >  obj-$(CONFIG_CXL)		+= cxl.o
> >  obj-$(CONFIG_CXL_BASE)		+= base.o
>
> This breaks the (newly added[1]) powernv_defconfig. ie. CONFIG_POWERNV=y, CONFIG_PPC_PSERIES=n.

That footnote was meant to be a link to the powernv_defconfig patch:

  https://patchwork.ozlabs.org/patch/587157/

And also here's the full build failure report:

  http://kisskb.ellerman.id.au/kisskb/buildresult/12629380/

It's rebuliding now with that fixup patch, the result should appear here:

  http://kisskb.ellerman.id.au/kisskb/buildresult/12629513/

cheers
Frederic Barrat March 9, 2016, 2:20 p.m. UTC | #2
Le 09/03/2016 13:42, Michael Ellerman a écrit :
> I've applied the following patch, let me know if there's anything wrong with
> it. It would be great if we could do something cleaner.


I think this is fine.
I've built pseries_le_defconfig and powernv_defconfig, and did minimum 
of testing with the cxl driver, things look good.

   Fred
diff mbox

Patch

diff --git a/drivers/misc/cxl/Makefile b/drivers/misc/cxl/Makefile
index 9ab874f83df0..8a55c1aa11aa 100644
--- a/drivers/misc/cxl/Makefile
+++ b/drivers/misc/cxl/Makefile
@@ -4,7 +4,7 @@  ccflags-$(CONFIG_PPC_WERROR)	+= -Werror
 cxl-y				+= main.o file.o irq.o fault.o native.o
 cxl-y				+= context.o sysfs.o debugfs.o pci.o trace.o
 cxl-y				+= vphb.o api.o
-cxl-y				+= flash.o guest.o of.o hcalls.o
+cxl-$(CONFIG_PPC_PSERIES)	+= flash.o guest.o of.o hcalls.o
 obj-$(CONFIG_CXL)		+= cxl.o
 obj-$(CONFIG_CXL_BASE)		+= base.o
 
diff --git a/drivers/misc/cxl/main.c b/drivers/misc/cxl/main.c
index b5eeb71f6a9e..ae68c3201156 100644
--- a/drivers/misc/cxl/main.c
+++ b/drivers/misc/cxl/main.c
@@ -296,10 +296,13 @@  static int __init init_cxl(void)
 	if (cpu_has_feature(CPU_FTR_HVMODE)) {
 		cxl_ops = &cxl_native_ops;
 		rc = pci_register_driver(&cxl_pci_driver);
-	} else {
+	}
+#ifdef CONFIG_PPC_PSERIES
+	else {
 		cxl_ops = &cxl_guest_ops;
 		rc = platform_driver_register(&cxl_of_driver);
 	}
+#endif
 	if (rc)
 		goto err1;
 
@@ -317,8 +320,10 @@  static void exit_cxl(void)
 {
 	if (cpu_has_feature(CPU_FTR_HVMODE))
 		pci_unregister_driver(&cxl_pci_driver);
+#ifdef CONFIG_PPC_PSERIES
 	else
 		platform_driver_unregister(&cxl_of_driver);
+#endif
 
 	cxl_debugfs_exit();
 	cxl_file_exit();