forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/scsi/cxlflash/ocxl_hw.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * CXL Flash Device Driver
34 *
....@@ -5,20 +6,17 @@
56 * Uma Krishnan <ukrishn@linux.vnet.ibm.com>, IBM Corporation
67 *
78 * Copyright (C) 2018 IBM Corporation
8
- *
9
- * This program is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU General Public License
11
- * as published by the Free Software Foundation; either version
12
- * 2 of the License, or (at your option) any later version.
139 */
1410
1511 #include <linux/file.h>
1612 #include <linux/idr.h>
1713 #include <linux/module.h>
1814 #include <linux/mount.h>
15
+#include <linux/pseudo_fs.h>
1916 #include <linux/poll.h>
2017 #include <linux/sched/signal.h>
21
-
18
+#include <linux/interrupt.h>
19
+#include <asm/xive.h>
2220 #include <misc/ocxl.h>
2321
2422 #include <uapi/misc/cxl.h>
....@@ -35,31 +33,15 @@
3533 static int ocxlflash_fs_cnt;
3634 static struct vfsmount *ocxlflash_vfs_mount;
3735
38
-static const struct dentry_operations ocxlflash_fs_dops = {
39
- .d_dname = simple_dname,
40
-};
41
-
42
-/*
43
- * ocxlflash_fs_mount() - mount the pseudo-filesystem
44
- * @fs_type: File system type.
45
- * @flags: Flags for the filesystem.
46
- * @dev_name: Device name associated with the filesystem.
47
- * @data: Data pointer.
48
- *
49
- * Return: pointer to the directory entry structure
50
- */
51
-static struct dentry *ocxlflash_fs_mount(struct file_system_type *fs_type,
52
- int flags, const char *dev_name,
53
- void *data)
36
+static int ocxlflash_fs_init_fs_context(struct fs_context *fc)
5437 {
55
- return mount_pseudo(fs_type, "ocxlflash:", NULL, &ocxlflash_fs_dops,
56
- OCXLFLASH_FS_MAGIC);
38
+ return init_pseudo(fc, OCXLFLASH_FS_MAGIC) ? 0 : -ENOMEM;
5739 }
5840
5941 static struct file_system_type ocxlflash_fs_type = {
6042 .name = "ocxlflash",
6143 .owner = THIS_MODULE,
62
- .mount = ocxlflash_fs_mount,
44
+ .init_fs_context = ocxlflash_fs_init_fs_context,
6345 .kill_sb = kill_anon_super,
6446 };
6547
....@@ -199,7 +181,7 @@
199181 struct ocxl_hw_afu *afu = ctx->hw_afu;
200182 struct device *dev = afu->dev;
201183 struct ocxlflash_irqs *irq;
202
- void __iomem *vtrig;
184
+ struct xive_irq_data *xd;
203185 u32 virq;
204186 int rc = 0;
205187
....@@ -223,15 +205,15 @@
223205 goto err1;
224206 }
225207
226
- vtrig = ioremap(irq->ptrig, PAGE_SIZE);
227
- if (unlikely(!vtrig)) {
228
- dev_err(dev, "%s: Trigger page mapping failed\n", __func__);
229
- rc = -ENOMEM;
208
+ xd = irq_get_handler_data(virq);
209
+ if (unlikely(!xd)) {
210
+ dev_err(dev, "%s: Can't get interrupt data\n", __func__);
211
+ rc = -ENXIO;
230212 goto err2;
231213 }
232214
233215 irq->virq = virq;
234
- irq->vtrig = vtrig;
216
+ irq->vtrig = xd->trig_mmio;
235217 out:
236218 return rc;
237219 err2:
....@@ -278,8 +260,6 @@
278260 }
279261
280262 irq = &ctx->irqs[num];
281
- if (irq->vtrig)
282
- iounmap(irq->vtrig);
283263
284264 if (irq_find_mapping(NULL, irq->hwirq)) {
285265 free_irq(irq->virq, cookie);
....@@ -634,7 +614,6 @@
634614 struct ocxl_hw_afu *afu = ctx->hw_afu;
635615 struct device *dev = afu->dev;
636616 struct ocxlflash_irqs *irqs;
637
- u64 addr;
638617 int rc = 0;
639618 int hwirq;
640619 int i;
....@@ -659,7 +638,7 @@
659638 }
660639
661640 for (i = 0; i < num; i++) {
662
- rc = ocxl_link_irq_alloc(afu->link_token, &hwirq, &addr);
641
+ rc = ocxl_link_irq_alloc(afu->link_token, &hwirq);
663642 if (unlikely(rc)) {
664643 dev_err(dev, "%s: ocxl_link_irq_alloc failed rc=%d\n",
665644 __func__, rc);
....@@ -667,7 +646,6 @@
667646 }
668647
669648 irqs[i].hwirq = hwirq;
670
- irqs[i].ptrig = addr;
671649 }
672650
673651 ctx->irqs = irqs;