diff options
author | Christophe Lombard <clombard@linux.vnet.ibm.com> | 2016-03-04 06:26:38 -0500 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-03-09 07:39:56 -0500 |
commit | 594ff7d067ca42676e27e2a7b5dcc0ff039d08ca (patch) | |
tree | 45824c4fb92c9450b86bfbb9ff19a0dd17cd2c93 /drivers/misc/cxl/file.c | |
parent | 4752876c71701b7663a5ded789058ab2c05f7d0f (diff) |
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/file.c')
-rw-r--r-- | drivers/misc/cxl/file.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c index df4d49a6c67a..e16046292dd6 100644 --- a/drivers/misc/cxl/file.c +++ b/drivers/misc/cxl/file.c | |||
@@ -26,9 +26,7 @@ | |||
26 | #include "trace.h" | 26 | #include "trace.h" |
27 | 27 | ||
28 | #define CXL_NUM_MINORS 256 /* Total to reserve */ | 28 | #define CXL_NUM_MINORS 256 /* Total to reserve */ |
29 | #define CXL_DEV_MINORS 13 /* 1 control + 4 AFUs * 3 (dedicated/master/shared) */ | ||
30 | 29 | ||
31 | #define CXL_CARD_MINOR(adapter) (adapter->adapter_num * CXL_DEV_MINORS) | ||
32 | #define CXL_AFU_MINOR_D(afu) (CXL_CARD_MINOR(afu->adapter) + 1 + (3 * afu->slice)) | 30 | #define CXL_AFU_MINOR_D(afu) (CXL_CARD_MINOR(afu->adapter) + 1 + (3 * afu->slice)) |
33 | #define CXL_AFU_MINOR_M(afu) (CXL_AFU_MINOR_D(afu) + 1) | 31 | #define CXL_AFU_MINOR_M(afu) (CXL_AFU_MINOR_D(afu) + 1) |
34 | #define CXL_AFU_MINOR_S(afu) (CXL_AFU_MINOR_D(afu) + 2) | 32 | #define CXL_AFU_MINOR_S(afu) (CXL_AFU_MINOR_D(afu) + 2) |
@@ -36,7 +34,6 @@ | |||
36 | #define CXL_AFU_MKDEV_M(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_M(afu)) | 34 | #define CXL_AFU_MKDEV_M(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_M(afu)) |
37 | #define CXL_AFU_MKDEV_S(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_S(afu)) | 35 | #define CXL_AFU_MKDEV_S(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_S(afu)) |
38 | 36 | ||
39 | #define CXL_DEVT_ADAPTER(dev) (MINOR(dev) / CXL_DEV_MINORS) | ||
40 | #define CXL_DEVT_AFU(dev) ((MINOR(dev) % CXL_DEV_MINORS - 1) / 3) | 37 | #define CXL_DEVT_AFU(dev) ((MINOR(dev) % CXL_DEV_MINORS - 1) / 3) |
41 | 38 | ||
42 | #define CXL_DEVT_IS_CARD(dev) (MINOR(dev) % CXL_DEV_MINORS == 0) | 39 | #define CXL_DEVT_IS_CARD(dev) (MINOR(dev) % CXL_DEV_MINORS == 0) |
@@ -446,7 +443,8 @@ static const struct file_operations afu_master_fops = { | |||
446 | 443 | ||
447 | static char *cxl_devnode(struct device *dev, umode_t *mode) | 444 | static char *cxl_devnode(struct device *dev, umode_t *mode) |
448 | { | 445 | { |
449 | if (CXL_DEVT_IS_CARD(dev->devt)) { | 446 | if (cpu_has_feature(CPU_FTR_HVMODE) && |
447 | CXL_DEVT_IS_CARD(dev->devt)) { | ||
450 | /* | 448 | /* |
451 | * These minor numbers will eventually be used to program the | 449 | * These minor numbers will eventually be used to program the |
452 | * PSL and AFUs once we have dynamic reprogramming support | 450 | * PSL and AFUs once we have dynamic reprogramming support |
@@ -547,6 +545,11 @@ int cxl_register_adapter(struct cxl *adapter) | |||
547 | return device_register(&adapter->dev); | 545 | return device_register(&adapter->dev); |
548 | } | 546 | } |
549 | 547 | ||
548 | dev_t cxl_get_dev(void) | ||
549 | { | ||
550 | return cxl_dev; | ||
551 | } | ||
552 | |||
550 | int __init cxl_file_init(void) | 553 | int __init cxl_file_init(void) |
551 | { | 554 | { |
552 | int rc; | 555 | int rc; |