Commit 9b405d40 authored by Frederic Barrat's avatar Frederic Barrat Committed by Kamal Mostafa

cxl: Parse device tree and create cxl device(s) at boot

BugLink: http://bugs.launchpad.net/bugs/1588468

Add new entry point to scan the device tree at boot in a guest,
looking for cxl devices.
Co-authored-by: default avatarChristophe Lombard <clombard@linux.vnet.ibm.com>
Signed-off-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: default avatarChristophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: default avatarManoj Kumar <manoj@linux.vnet.ibm.com>
Acked-by: default avatarIan Munsie <imunsie@au1.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit b40844aa)
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent e5f65bff
......@@ -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);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment