diff options
author | Frederic Barrat <fbarrat@linux.vnet.ibm.com> | 2016-03-04 12:26:28 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-03-09 03:05:43 +0100 |
commit | 5be587b1110132b4f05e0bc3515a145365e910fe (patch) | |
tree | 102af0ae101eef7c75f39bb696cda28ed45c8f65 /drivers/misc/cxl/main.c | |
parent | cxl: Define process problem state area at attach time only (diff) | |
download | linux-5be587b1110132b4f05e0bc3515a145365e910fe.tar.xz linux-5be587b1110132b4f05e0bc3515a145365e910fe.zip |
cxl: Introduce implementation-specific API
The backend API (in cxl.h) lists some low-level functions whose
implementation is different on bare-metal and in a guest. Each
environment implements its own functions, and the common code uses
them through function pointers, defined in cxl_backend_ops
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/cxl/main.c')
-rw-r--r-- | drivers/misc/cxl/main.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/misc/cxl/main.c b/drivers/misc/cxl/main.c index 90933eb80fa3..a9051512198c 100644 --- a/drivers/misc/cxl/main.c +++ b/drivers/misc/cxl/main.c @@ -32,6 +32,8 @@ uint cxl_verbose; module_param_named(verbose, cxl_verbose, uint, 0600); MODULE_PARM_DESC(verbose, "Enable verbose dmesg output"); +const struct cxl_backend_ops *cxl_ops; + int cxl_afu_slbia(struct cxl_afu *afu) { unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT); @@ -46,7 +48,7 @@ int cxl_afu_slbia(struct cxl_afu *afu) /* If the adapter has gone down, we can assume that we * will PERST it and that will invalidate everything. */ - if (!cxl_adapter_link_ok(afu->adapter)) + if (!cxl_ops->link_ok(afu->adapter)) return -EIO; cpu_relax(); } @@ -228,7 +230,7 @@ struct cxl_afu *cxl_alloc_afu(struct cxl *adapter, int slice) afu->adapter = adapter; afu->dev.parent = &adapter->dev; - afu->dev.release = cxl_release_afu; + afu->dev.release = cxl_ops->release_afu; afu->slice = slice; idr_init(&afu->contexts_idr); mutex_init(&afu->contexts_lock); @@ -244,10 +246,10 @@ struct cxl_afu *cxl_alloc_afu(struct cxl *adapter, int slice) int cxl_afu_select_best_mode(struct cxl_afu *afu) { if (afu->modes_supported & CXL_MODE_DIRECTED) - return cxl_afu_activate_mode(afu, CXL_MODE_DIRECTED); + return cxl_ops->afu_activate_mode(afu, CXL_MODE_DIRECTED); if (afu->modes_supported & CXL_MODE_DEDICATED) - return cxl_afu_activate_mode(afu, CXL_MODE_DEDICATED); + return cxl_ops->afu_activate_mode(afu, CXL_MODE_DEDICATED); dev_warn(&afu->dev, "No supported programming modes available\n"); /* We don't fail this so the user can inspect sysfs */ @@ -269,6 +271,7 @@ static int __init init_cxl(void) if ((rc = register_cxl_calls(&cxl_calls))) goto err; + cxl_ops = &cxl_native_ops; if ((rc = pci_register_driver(&cxl_pci_driver))) goto err1; |