diff options
Diffstat (limited to 'drivers/misc/cxl/cxl.h')
| -rw-r--r-- | drivers/misc/cxl/cxl.h | 38 |
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 | ||
| 460 | struct cxl { | 468 | struct cxl { |
| @@ -563,6 +571,9 @@ static inline void __iomem *_cxl_p2n_addr(struct cxl_afu *afu, cxl_p2n_reg_t reg | |||
| 563 | u16 cxl_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off); | 571 | u16 cxl_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off); |
| 564 | u8 cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off); | 572 | u8 cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off); |
| 565 | 573 | ||
| 574 | ssize_t cxl_afu_read_err_buffer(struct cxl_afu *afu, char *buf, | ||
| 575 | loff_t off, size_t count); | ||
| 576 | |||
| 566 | 577 | ||
| 567 | struct cxl_calls { | 578 | struct 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); | |||
| 606 | int cxl_register_serr_irq(struct cxl_afu *afu); | 617 | int cxl_register_serr_irq(struct cxl_afu *afu); |
| 607 | void cxl_release_serr_irq(struct cxl_afu *afu); | 618 | void cxl_release_serr_irq(struct cxl_afu *afu); |
| 608 | int afu_register_irqs(struct cxl_context *ctx, u32 count); | 619 | int afu_register_irqs(struct cxl_context *ctx, u32 count); |
| 609 | void afu_release_irqs(struct cxl_context *ctx); | 620 | void afu_release_irqs(struct cxl_context *ctx, void *cookie); |
| 610 | irqreturn_t cxl_slice_irq_err(int irq, void *data); | 621 | irqreturn_t cxl_slice_irq_err(int irq, void *data); |
| 611 | 622 | ||
| 612 | int cxl_debugfs_init(void); | 623 | int 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); |
| 630 | void cxl_context_free(struct cxl_context *ctx); | 641 | void cxl_context_free(struct cxl_context *ctx); |
| 631 | int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma); | 642 | int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma); |
| 643 | unsigned int cxl_map_irq(struct cxl *adapter, irq_hw_number_t hwirq, | ||
| 644 | irq_handler_t handler, void *cookie, const char *name); | ||
| 645 | void cxl_unmap_irq(unsigned int virq, void *cookie); | ||
| 646 | int __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 */ |
| 634 | struct cxl_irq_info { | 649 | struct 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 | ||
| 660 | void cxl_assign_psn_space(struct cxl_context *ctx); | ||
| 645 | int cxl_attach_process(struct cxl_context *ctx, bool kernel, u64 wed, | 661 | int cxl_attach_process(struct cxl_context *ctx, bool kernel, u64 wed, |
| 646 | u64 amr); | 662 | u64 amr); |
| 647 | int cxl_detach_process(struct cxl_context *ctx); | 663 | int cxl_detach_process(struct cxl_context *ctx); |
| @@ -653,11 +669,23 @@ int cxl_check_error(struct cxl_afu *afu); | |||
| 653 | int cxl_afu_slbia(struct cxl_afu *afu); | 669 | int cxl_afu_slbia(struct cxl_afu *afu); |
| 654 | int cxl_tlb_slb_invalidate(struct cxl *adapter); | 670 | int cxl_tlb_slb_invalidate(struct cxl *adapter); |
| 655 | int cxl_afu_disable(struct cxl_afu *afu); | 671 | int cxl_afu_disable(struct cxl_afu *afu); |
| 656 | int cxl_afu_reset(struct cxl_afu *afu); | 672 | int __cxl_afu_reset(struct cxl_afu *afu); |
| 673 | int cxl_afu_check_and_enable(struct cxl_afu *afu); | ||
| 657 | int cxl_psl_purge(struct cxl_afu *afu); | 674 | int cxl_psl_purge(struct cxl_afu *afu); |
| 658 | 675 | ||
| 659 | void cxl_stop_trace(struct cxl *cxl); | 676 | void cxl_stop_trace(struct cxl *cxl); |
| 677 | int cxl_pci_vphb_add(struct cxl_afu *afu); | ||
| 678 | void cxl_pci_vphb_remove(struct cxl_afu *afu); | ||
| 660 | 679 | ||
| 661 | extern struct pci_driver cxl_pci_driver; | 680 | extern struct pci_driver cxl_pci_driver; |
| 681 | int afu_allocate_irqs(struct cxl_context *ctx, u32 count); | ||
| 682 | |||
| 683 | int afu_open(struct inode *inode, struct file *file); | ||
| 684 | int afu_release(struct inode *inode, struct file *file); | ||
| 685 | long afu_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | ||
| 686 | int afu_mmap(struct file *file, struct vm_area_struct *vm); | ||
| 687 | unsigned int afu_poll(struct file *file, struct poll_table_struct *poll); | ||
| 688 | ssize_t afu_read(struct file *file, char __user *buf, size_t count, loff_t *off); | ||
| 689 | extern const struct file_operations afu_fops; | ||
| 662 | 690 | ||
| 663 | #endif | 691 | #endif |
