summaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl/guest.c
diff options
context:
space:
mode:
authorChristophe Lombard <clombard@linux.vnet.ibm.com>2016-03-04 12:26:38 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2016-03-09 23:39:56 +1100
commit594ff7d067ca42676e27e2a7b5dcc0ff039d08ca (patch)
tree45824c4fb92c9450b86bfbb9ff19a0dd17cd2c93 /drivers/misc/cxl/guest.c
parent4752876c71701b7663a5ded789058ab2c05f7d0f (diff)
downloadblackbird-obmc-linux-594ff7d067ca42676e27e2a7b5dcc0ff039d08ca.tar.gz
blackbird-obmc-linux-594ff7d067ca42676e27e2a7b5dcc0ff039d08ca.zip
cxl: Support to flash a new image on the adapter from a guest
The new flash.c file contains the logic to flash a new image on the adapter, through a hcall. It is an iterative process, with chunks of data of 1M at a time. There are also 2 phases: write and verify. The flash operation itself is driven from a user-land tool. Once flashing is successful, an rtas call is made to update the device tree with the new properties values for the adapter and the AFU(s) Add a new char device for the adapter, so that the flash tool can access the card, even if there is no valid AFU on it. 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> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc/cxl/guest.c')
-rw-r--r--drivers/misc/cxl/guest.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
index b1b8ac5195e7..816113d9d19b 100644
--- a/drivers/misc/cxl/guest.c
+++ b/drivers/misc/cxl/guest.c
@@ -889,6 +889,7 @@ void cxl_guest_remove_adapter(struct cxl *adapter)
cxl_sysfs_adapter_remove(adapter);
+ cxl_guest_remove_chardev(adapter);
device_unregister(&adapter->dev);
}
@@ -926,6 +927,9 @@ struct cxl *cxl_guest_init_adapter(struct device_node *np, struct platform_devic
if ((rc = properties_look_ok(adapter)))
goto err1;
+ if ((rc = cxl_guest_add_chardev(adapter)))
+ goto err1;
+
/*
* After we call this function we must not free the adapter directly,
* even if it returns an error!
@@ -941,12 +945,23 @@ struct cxl *cxl_guest_init_adapter(struct device_node *np, struct platform_devic
err_put1:
device_unregister(&adapter->dev);
free = false;
+ cxl_guest_remove_chardev(adapter);
err1:
if (free)
free_adapter(adapter);
return ERR_PTR(rc);
}
+void cxl_guest_reload_module(struct cxl *adapter)
+{
+ struct platform_device *pdev;
+
+ pdev = adapter->guest->pdev;
+ cxl_guest_remove_adapter(adapter);
+
+ cxl_of_probe(pdev);
+}
+
const struct cxl_backend_ops cxl_guest_ops = {
.module = THIS_MODULE,
.adapter_reset = guest_reset,
OpenPOWER on IntegriCloud