aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl/cxl.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/cxl/cxl.h')
-rw-r--r--drivers/misc/cxl/cxl.h38
1 files changed, 33 insertions, 5 deletions
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index a1cee4767ec6..4fd66cabde1e 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -18,10 +18,11 @@
18#include <linux/pid.h> 18#include <linux/pid.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/fs.h>
21#include <asm/cputable.h> 22#include <asm/cputable.h>
22#include <asm/mmu.h> 23#include <asm/mmu.h>
23#include <asm/reg.h> 24#include <asm/reg.h>
24#include <misc/cxl.h> 25#include <misc/cxl-base.h>
25 26
26#include <uapi/misc/cxl.h> 27#include <uapi/misc/cxl.h>
27 28
@@ -315,8 +316,6 @@ static const cxl_p2n_reg_t CXL_PSL_WED_An = {0x0A0};
315#define CXL_MAX_SLICES 4 316#define CXL_MAX_SLICES 4
316#define MAX_AFU_MMIO_REGS 3 317#define MAX_AFU_MMIO_REGS 3
317 318
318#define CXL_MODE_DEDICATED 0x1
319#define CXL_MODE_DIRECTED 0x2
320#define CXL_MODE_TIME_SLICED 0x4 319#define CXL_MODE_TIME_SLICED 0x4
321#define CXL_SUPPORTED_MODES (CXL_MODE_DEDICATED | CXL_MODE_DIRECTED) 320#define CXL_SUPPORTED_MODES (CXL_MODE_DEDICATED | CXL_MODE_DIRECTED)
322 321
@@ -362,6 +361,10 @@ struct cxl_afu {
362 struct mutex spa_mutex; 361 struct mutex spa_mutex;
363 spinlock_t afu_cntl_lock; 362 spinlock_t afu_cntl_lock;
364 363
364 /* AFU error buffer fields and bin attribute for sysfs */
365 u64 eb_len, eb_offset;
366 struct bin_attribute attr_eb;
367
365 /* 368 /*
366 * Only the first part of the SPA is used for the process element 369 * Only the first part of the SPA is used for the process element
367 * linked list. The only other part that software needs to worry about 370 * linked list. The only other part that software needs to worry about
@@ -375,6 +378,9 @@ struct cxl_afu {
375 int spa_max_procs; 378 int spa_max_procs;
376 unsigned int psl_virq; 379 unsigned int psl_virq;
377 380
381 /* pointer to the vphb */
382 struct pci_controller *phb;
383
378 int pp_irqs; 384 int pp_irqs;
379 int irqs_max; 385 int irqs_max;
380 int num_procs; 386 int num_procs;
@@ -455,6 +461,8 @@ struct cxl_context {
455 bool pending_irq; 461 bool pending_irq;
456 bool pending_fault; 462 bool pending_fault;
457 bool pending_afu_err; 463 bool pending_afu_err;
464
465 struct rcu_head rcu;
458}; 466};
459 467
460struct cxl { 468struct cxl {
@@ -563,6 +571,9 @@ static inline void __iomem *_cxl_p2n_addr(struct cxl_afu *afu, cxl_p2n_reg_t reg
563u16 cxl_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off); 571u16 cxl_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off);
564u8 cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off); 572u8 cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off);
565 573
574ssize_t cxl_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
575 loff_t off, size_t count);
576
566 577
567struct cxl_calls { 578struct cxl_calls {
568 void (*cxl_slbia)(struct mm_struct *mm); 579 void (*cxl_slbia)(struct mm_struct *mm);
@@ -606,7 +617,7 @@ void cxl_release_psl_err_irq(struct cxl *adapter);
606int cxl_register_serr_irq(struct cxl_afu *afu); 617int cxl_register_serr_irq(struct cxl_afu *afu);
607void cxl_release_serr_irq(struct cxl_afu *afu); 618void cxl_release_serr_irq(struct cxl_afu *afu);
608int afu_register_irqs(struct cxl_context *ctx, u32 count); 619int afu_register_irqs(struct cxl_context *ctx, u32 count);
609void afu_release_irqs(struct cxl_context *ctx); 620void afu_release_irqs(struct cxl_context *ctx, void *cookie);
610irqreturn_t cxl_slice_irq_err(int irq, void *data); 621irqreturn_t cxl_slice_irq_err(int irq, void *data);
611 622
612int cxl_debugfs_init(void); 623int cxl_debugfs_init(void);
@@ -629,6 +640,10 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master,
629 struct address_space *mapping); 640 struct address_space *mapping);
630void cxl_context_free(struct cxl_context *ctx); 641void cxl_context_free(struct cxl_context *ctx);
631int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma); 642int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma);
643unsigned int cxl_map_irq(struct cxl *adapter, irq_hw_number_t hwirq,
644 irq_handler_t handler, void *cookie, const char *name);
645void cxl_unmap_irq(unsigned int virq, void *cookie);
646int __detach_context(struct cxl_context *ctx);
632 647
633/* This matches the layout of the H_COLLECT_CA_INT_INFO retbuf */ 648/* This matches the layout of the H_COLLECT_CA_INT_INFO retbuf */
634struct cxl_irq_info { 649struct cxl_irq_info {
@@ -642,6 +657,7 @@ struct cxl_irq_info {
642 u64 padding[3]; /* to match the expected retbuf size for plpar_hcall9 */ 657 u64 padding[3]; /* to match the expected retbuf size for plpar_hcall9 */
643}; 658};
644 659
660void cxl_assign_psn_space(struct cxl_context *ctx);
645int cxl_attach_process(struct cxl_context *ctx, bool kernel, u64 wed, 661int cxl_attach_process(struct cxl_context *ctx, bool kernel, u64 wed,
646 u64 amr); 662 u64 amr);
647int cxl_detach_process(struct cxl_context *ctx); 663int cxl_detach_process(struct cxl_context *ctx);
@@ -653,11 +669,23 @@ int cxl_check_error(struct cxl_afu *afu);
653int cxl_afu_slbia(struct cxl_afu *afu); 669int cxl_afu_slbia(struct cxl_afu *afu);
654int cxl_tlb_slb_invalidate(struct cxl *adapter); 670int cxl_tlb_slb_invalidate(struct cxl *adapter);
655int cxl_afu_disable(struct cxl_afu *afu); 671int cxl_afu_disable(struct cxl_afu *afu);
656int cxl_afu_reset(struct cxl_afu *afu); 672int __cxl_afu_reset(struct cxl_afu *afu);
673int cxl_afu_check_and_enable(struct cxl_afu *afu);
657int cxl_psl_purge(struct cxl_afu *afu); 674int cxl_psl_purge(struct cxl_afu *afu);
658 675
659void cxl_stop_trace(struct cxl *cxl); 676void cxl_stop_trace(struct cxl *cxl);
677int cxl_pci_vphb_add(struct cxl_afu *afu);
678void cxl_pci_vphb_remove(struct cxl_afu *afu);
660 679
661extern struct pci_driver cxl_pci_driver; 680extern struct pci_driver cxl_pci_driver;
681int afu_allocate_irqs(struct cxl_context *ctx, u32 count);
682
683int afu_open(struct inode *inode, struct file *file);
684int afu_release(struct inode *inode, struct file *file);
685long afu_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
686int afu_mmap(struct file *file, struct vm_area_struct *vm);
687unsigned int afu_poll(struct file *file, struct poll_table_struct *poll);
688ssize_t afu_read(struct file *file, char __user *buf, size_t count, loff_t *off);
689extern const struct file_operations afu_fops;
662 690
663#endif 691#endif