diff options
author | Frederic Barrat <fbarrat@linux.vnet.ibm.com> | 2016-03-04 12:26:39 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-03-09 23:39:59 +1100 |
commit | b40844aa55bb325de7509003c7529c75b0532412 (patch) | |
tree | ed8c4d693c684d38aa089928fb41dd98e6d2ac7e /drivers/misc | |
parent | 594ff7d067ca42676e27e2a7b5dcc0ff039d08ca (diff) | |
download | linux-b40844aa55bb325de7509003c7529c75b0532412.tar.bz2 |
cxl: Parse device tree and create cxl device(s) at boot
Add new entry point to scan the device tree at boot in a guest,
looking for cxl devices.
Co-authored-by: Christophe Lombard <clombard@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>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/cxl/base.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/misc/cxl/base.c b/drivers/misc/cxl/base.c index 957f4dd23f40..9b90ec6c07cd 100644 --- a/drivers/misc/cxl/base.c +++ b/drivers/misc/cxl/base.c @@ -11,6 +11,7 @@ #include <linux/rcupdate.h> #include <asm/errno.h> #include <misc/cxl-base.h> +#include <linux/of_platform.h> #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); |