diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-31 11:23:28 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-31 11:23:28 -0800 |
commit | 28bc6fb9596fe1e577d09fc17ee6e1bb051c6ba3 (patch) | |
tree | 6293b282a960720fc5008e3e5fa4d096d974b2f1 /drivers/scsi/cxlflash/cxl_hw.c | |
parent | 0be600a5add76e8e8b9e1119f2a7426ff849aca8 (diff) | |
parent | a2390348c19d0819d525d375414a7cfdacb51a68 (diff) |
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
"This is mostly updates of the usual driver suspects: arcmsr,
scsi_debug, mpt3sas, lpfc, cxlflash, qla2xxx, aacraid, megaraid_sas,
hisi_sas.
We also have a rework of the libsas hotplug handling to make it more
robust, a slew of 32 bit time conversions and fixes, and a host of the
usual minor updates and style changes. The biggest potential for
regressions is the libsas hotplug changes, but so far they seem stable
under testing"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (313 commits)
scsi: qla2xxx: Fix logo flag for qlt_free_session_done()
scsi: arcmsr: avoid do_gettimeofday
scsi: core: Add VENDOR_SPECIFIC sense code definitions
scsi: qedi: Drop cqe response during connection recovery
scsi: fas216: fix sense buffer initialization
scsi: ibmvfc: Remove unneeded semicolons
scsi: hisi_sas: fix a bug in hisi_sas_dev_gone()
scsi: hisi_sas: directly attached disk LED feature for v2 hw
scsi: hisi_sas: devicetree: bindings: add LED feature for v2 hw
scsi: megaraid_sas: NVMe passthrough command support
scsi: megaraid: use ktime_get_real for firmware time
scsi: fnic: use 64-bit timestamps
scsi: qedf: Fix error return code in __qedf_probe()
scsi: devinfo: fix format of the device list
scsi: qla2xxx: Update driver version to 10.00.00.05-k
scsi: qla2xxx: Add XCB counters to debugfs
scsi: qla2xxx: Fix queue ID for async abort with Multiqueue
scsi: qla2xxx: Fix warning for code intentation in __qla24xx_handle_gpdb_event()
scsi: qla2xxx: Fix warning during port_name debug print
scsi: qla2xxx: Fix warning in qla2x00_async_iocb_timeout()
...
Diffstat (limited to 'drivers/scsi/cxlflash/cxl_hw.c')
-rw-r--r-- | drivers/scsi/cxlflash/cxl_hw.c | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/drivers/scsi/cxlflash/cxl_hw.c b/drivers/scsi/cxlflash/cxl_hw.c new file mode 100644 index 000000000000..db1cadad5c5d --- /dev/null +++ b/drivers/scsi/cxlflash/cxl_hw.c @@ -0,0 +1,168 @@ +/* + * CXL Flash Device Driver + * + * Written by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation + * Uma Krishnan <ukrishn@linux.vnet.ibm.com>, IBM Corporation + * + * Copyright (C) 2018 IBM Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include <misc/cxl.h> + +#include "backend.h" + +/* + * The following routines map the cxlflash backend operations to existing CXL + * kernel API function and are largely simple shims that provide an abstraction + * for converting generic context and AFU cookies into cxl_context or cxl_afu + * pointers. + */ + +static void __iomem *cxlflash_psa_map(void *ctx_cookie) +{ + return cxl_psa_map(ctx_cookie); +} + +static void cxlflash_psa_unmap(void __iomem *addr) +{ + cxl_psa_unmap(addr); +} + +static int cxlflash_process_element(void *ctx_cookie) +{ + return cxl_process_element(ctx_cookie); +} + +static int cxlflash_map_afu_irq(void *ctx_cookie, int num, + irq_handler_t handler, void *cookie, char *name) +{ + return cxl_map_afu_irq(ctx_cookie, num, handler, cookie, name); +} + +static void cxlflash_unmap_afu_irq(void *ctx_cookie, int num, void *cookie) +{ + cxl_unmap_afu_irq(ctx_cookie, num, cookie); +} + +static int cxlflash_start_context(void *ctx_cookie) +{ + return cxl_start_context(ctx_cookie, 0, NULL); +} + +static int cxlflash_stop_context(void *ctx_cookie) +{ + return cxl_stop_context(ctx_cookie); +} + +static int cxlflash_afu_reset(void *ctx_cookie) +{ + return cxl_afu_reset(ctx_cookie); +} + +static void cxlflash_set_master(void *ctx_cookie) +{ + cxl_set_master(ctx_cookie); +} + +static void *cxlflash_get_context(struct pci_dev *dev, void *afu_cookie) +{ + return cxl_get_context(dev); +} + +static void *cxlflash_dev_context_init(struct pci_dev *dev, void *afu_cookie) +{ + return cxl_dev_context_init(dev); +} + +static int cxlflash_release_context(void *ctx_cookie) +{ + return cxl_release_context(ctx_cookie); +} + +static void cxlflash_perst_reloads_same_image(void *afu_cookie, bool image) +{ + cxl_perst_reloads_same_image(afu_cookie, image); +} + +static ssize_t cxlflash_read_adapter_vpd(struct pci_dev *dev, + void *buf, size_t count) +{ + return cxl_read_adapter_vpd(dev, buf, count); +} + +static int cxlflash_allocate_afu_irqs(void *ctx_cookie, int num) +{ + return cxl_allocate_afu_irqs(ctx_cookie, num); +} + +static void cxlflash_free_afu_irqs(void *ctx_cookie) +{ + cxl_free_afu_irqs(ctx_cookie); +} + +static void *cxlflash_create_afu(struct pci_dev *dev) +{ + return cxl_pci_to_afu(dev); +} + +static struct file *cxlflash_get_fd(void *ctx_cookie, + struct file_operations *fops, int *fd) +{ + return cxl_get_fd(ctx_cookie, fops, fd); +} + +static void *cxlflash_fops_get_context(struct file *file) +{ + return cxl_fops_get_context(file); +} + +static int cxlflash_start_work(void *ctx_cookie, u64 irqs) +{ + struct cxl_ioctl_start_work work = { 0 }; + + work.num_interrupts = irqs; + work.flags = CXL_START_WORK_NUM_IRQS; + + return cxl_start_work(ctx_cookie, &work); +} + +static int cxlflash_fd_mmap(struct file *file, struct vm_area_struct *vm) +{ + return cxl_fd_mmap(file, vm); +} + +static int cxlflash_fd_release(struct inode *inode, struct file *file) +{ + return cxl_fd_release(inode, file); +} + +const struct cxlflash_backend_ops cxlflash_cxl_ops = { + .module = THIS_MODULE, + .psa_map = cxlflash_psa_map, + .psa_unmap = cxlflash_psa_unmap, + .process_element = cxlflash_process_element, + .map_afu_irq = cxlflash_map_afu_irq, + .unmap_afu_irq = cxlflash_unmap_afu_irq, + .start_context = cxlflash_start_context, + .stop_context = cxlflash_stop_context, + .afu_reset = cxlflash_afu_reset, + .set_master = cxlflash_set_master, + .get_context = cxlflash_get_context, + .dev_context_init = cxlflash_dev_context_init, + .release_context = cxlflash_release_context, + .perst_reloads_same_image = cxlflash_perst_reloads_same_image, + .read_adapter_vpd = cxlflash_read_adapter_vpd, + .allocate_afu_irqs = cxlflash_allocate_afu_irqs, + .free_afu_irqs = cxlflash_free_afu_irqs, + .create_afu = cxlflash_create_afu, + .get_fd = cxlflash_get_fd, + .fops_get_context = cxlflash_fops_get_context, + .start_work = cxlflash_start_work, + .fd_mmap = cxlflash_fd_mmap, + .fd_release = cxlflash_fd_release, +}; |