Re: [PATCH v5 15/18] cxl: Parse device tree and create cxl device(s) at boot

2016-02-25 Thread Manoj Kumar

Fred: Thanks for the clarification.

Reviewed-by: Manoj Kumar 

---
Manoj Kumar


On 2/25/2016 7:19 AM, Frederic Barrat wrote:



Le 24/02/2016 21:15, Manoj Kumar a écrit :

On 2/23/2016 10:21 AM, Frederic Barrat wrote:

+module_init(cxl_base_init);


Is this a remnant from when there were two modules?
Do you really need two module_init() calls (can't one be called from the
other)?
What is the tear-down portion of this (module_exit)?


No, this is not a left-over from the previous 2-module implementation of
the cxl driver.
The file base.c is not part of the "normal" cxl driver. It is either
part of the kernel if the cxl driver is a module or configured in the
kernel. Or it is discarded if cxl is not even a module. So code in that
file is either in the kernel or it's not even compiled. That was already
the case on bare-metal.
Code in module_init() is executed when the kernel boots and it is not
going away.

   Fred


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v5 15/18] cxl: Parse device tree and create cxl device(s) at boot

2016-02-25 Thread Frederic Barrat



Le 24/02/2016 21:15, Manoj Kumar a écrit :

On 2/23/2016 10:21 AM, Frederic Barrat wrote:

+module_init(cxl_base_init);


Is this a remnant from when there were two modules?
Do you really need two module_init() calls (can't one be called from the
other)?
What is the tear-down portion of this (module_exit)?


No, this is not a left-over from the previous 2-module implementation of 
the cxl driver.
The file base.c is not part of the "normal" cxl driver. It is either 
part of the kernel if the cxl driver is a module or configured in the 
kernel. Or it is discarded if cxl is not even a module. So code in that 
file is either in the kernel or it's not even compiled. That was already 
the case on bare-metal.
Code in module_init() is executed when the kernel boots and it is not 
going away.


  Fred

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v5 15/18] cxl: Parse device tree and create cxl device(s) at boot

2016-02-24 Thread Manoj Kumar

Fred, Christophe: See comment below.

---
Manoj Kumar

On 2/23/2016 10:21 AM, Frederic Barrat wrote:

+module_init(cxl_base_init);


Is this a remnant from when there were two modules?
Do you really need two module_init() calls (can't one be called from the
other)?
What is the tear-down portion of this (module_exit)?


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v5 15/18] cxl: Parse device tree and create cxl device(s) at boot

2016-02-23 Thread Frederic Barrat
Add new entry point to scan the device tree at boot in a guest,
looking for cxl devices.

Co-authored-by: Christophe Lombard 
Signed-off-by: Frederic Barrat 
Signed-off-by: Christophe Lombard 
Acked-by: Ian Munsie 
---
 drivers/misc/cxl/base.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/misc/cxl/base.c b/drivers/misc/cxl/base.c
index 957f4dd..9b90ec6 100644
--- a/drivers/misc/cxl/base.c
+++ b/drivers/misc/cxl/base.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "cxl.h"
 
 /* protected by rcu */
@@ -91,3 +92,27 @@ int cxl_update_properties(struct device_node *dn,
return of_update_property(dn, new_prop);
 }
 EXPORT_SYMBOL_GPL(cxl_update_properties);
+
+static int __init cxl_base_init(void)
+{
+   struct device_node *np = NULL;
+   struct platform_device *dev;
+   int count = 0;
+
+   /*
+* Scan for compatible devices in guest only
+*/
+   if (cpu_has_feature(CPU_FTR_HVMODE))
+   return 0;
+
+   while ((np = of_find_compatible_node(np, NULL,
+"ibm,coherent-platform-facility"))) {
+   dev = of_platform_device_create(np, NULL, NULL);
+   if (dev)
+   count++;
+   }
+   pr_devel("Found %d cxl device(s)\n", count);
+   return 0;
+}
+
+module_init(cxl_base_init);
-- 
1.9.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev