cxl: Remove abandonned capi support for the Mellanox CX4
Subsystems (2)
cover cxl: Remove abandonned capi support for the Mellanox CX4
An attempt was made to add capi support for the Mellanox CX4 card, so that it could operate in "traditional" PCI mode or capi mode. The project ended up being canceled and a different approach was taken for CX5. Mellanox never upstreamed any capi support in their CX4 driver.
CX4 was not following exactly the CAIA 1.0 model, so some CX4-specific code was added. That code is now dead and hasn't been tested for a while, so it's probably broken anyway. Let's remove it. It has been agreed with engineers at Mellanox, of course.
No user API is affected. Some (unused) symbols exported by cxl are removed.
Most of the patch set consists of reverts of older patches, with sometimes very minor tweaking. The last patch aggregates a few changes where reverting was not possible easily.
Tests run to prevent regressions:
- memcpy tests on POWER8 and POWER9 - Mellanox CX5, which uses a different code path, based on cxllib - cxlflash tests on POWER8
Alastair D'Silva (7):
Revert "cxl: Add kernel API to allow a context to operate with
relocate disabled"
Revert "cxl: Add support for interrupts on the Mellanox CX4" Revert "cxl: Add preliminary workaround for CX4 interrupt limitation" Revert "cxl: Add kernel APIs to get & set the max irqs per context" Revert "cxl: Add cxl_check_and_switch_mode() API to switch bi-modal
cards"
Revert "cxl: Add support for using the kernel API with a real PHB" Revert "powerpc/powernv: Add support for the cxl kernel api on the
real phb"
Frederic Barrat (3):
Revert "cxl: Add cxl_slot_is_supported API"
Revert "cxl: Allow a default context to be associated with an external
pci_dev"
cxl: Remove abandonned capi support for the Mellanox CX4, final
cleanup
arch/powerpc/include/asm/pnv-pci.h | 7 - arch/powerpc/platforms/powernv/pci-cxl.c | 199 ------------ arch/powerpc/platforms/powernv/pci-ioda.c | 22 +- arch/powerpc/platforms/powernv/pci.h | 15 - drivers/misc/cxl/Kconfig | 8 - drivers/misc/cxl/Makefile | 2 +- drivers/misc/cxl/api.c | 132 -------- drivers/misc/cxl/base.c | 83 ----- drivers/misc/cxl/context.c | 3 +- drivers/misc/cxl/cxl.h | 33 -- drivers/misc/cxl/debugfs.c | 5 - drivers/misc/cxl/guest.c | 3 - drivers/misc/cxl/main.c | 5 - drivers/misc/cxl/native.c | 3 +- drivers/misc/cxl/pci.c | 351 ++-------------------- drivers/misc/cxl/phb.c | 44 --- drivers/misc/cxl/vphb.c | 46 +-- include/misc/cxl-base.h | 10 - include/misc/cxl.h | 68 ----- 19 files changed, 58 insertions(+), 981 deletions(-) delete mode 100644 drivers/misc/cxl/phb.c
Signature · 1 line
2.17.1
PATCH 1/10 Revert "cxl: Add kernel API to allow a context to operate with relocate disabled"
From: Alastair D'Silva <[email protected]>
Remove abandonned capi support for the Mellanox CX4. The symbol 'cxl_set_translation_mode' is never called, so ctx->real_mode is always false.
This reverts commit 7a0d85d313c2066712e530e668bc02bb741a685c.
--- drivers/misc/cxl/api.c | 19 ------------------- drivers/misc/cxl/cxl.h | 1 - drivers/misc/cxl/guest.c | 3 --- drivers/misc/cxl/native.c | 3 ++- include/misc/cxl.h | 8 -------- 5 files changed, 2 insertions(+), 32 deletions(-)
drivers/misc/cxl/api.c +0 -19
@@ -324,7 +324,6 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed,if (task) { ctx->pid =get_task_pid (task,PIDTYPE_PID ); kernel = false; - ctx->real_mode = false;/* acquire a reference to the task's mm */ ctx->mm =get_task_mm (current);
@@ -388,24 +387,6 @@ void cxl_set_master(struct cxl_context *ctx) }EXPORT_SYMBOL_GPL (cxl_set_master); -int cxl_set_translation_mode (struct cxl_context *ctx,bool real_mode) -{ -if (ctx->status ==STARTED ) { -/* -* We could potentially update the PE and issue an update LLCMD -* to support this, but it doesn't seem to have a good use case -* since it's trivial to just create a second kernel context -* with different translation modes, so until someone convinces -* me otherwise: -*/ -return -EBUSY ; - } - - ctx->real_mode = real_mode; -return 0 ; -} -EXPORT_SYMBOL_GPL (cxl_set_translation_mode); -/* wrappers around afu_* file ops which are EXPORTED */ int cxl_fd_open (struct inode *inode,struct file *file) {
drivers/misc/cxl/cxl.h +0 -1
@@ -613,7 +613,6 @@ struct cxl_context {bool pe_inserted;bool master;bool kernel; -bool real_mode;bool pending_irq;bool pending_fault;bool pending_afu_err;
drivers/misc/cxl/guest.c +0 -3
@@ -623,9 +623,6 @@ static int guest_attach_process(struct cxl_context *ctx, bool kernel, u64 wed, u {pr_devel ("in %s\n" , __func__); -if (ctx->real_mode) -return -EPERM ; - ctx->kernel = kernel;if (ctx->afu->current_mode ==CXL_MODE_DIRECTED )return attach_afu_directed (ctx, wed, amr);
drivers/misc/cxl/native.c +2 -1
@@ -605,6 +605,7 @@ u64 cxl_calculate_sr(bool master, bool kernel, bool real_mode, bool p9) sr |= CXL_PSL_SR_An_MP;if (mfspr (SPRN_LPCR ) &LPCR_TC ) sr |= CXL_PSL_SR_An_TC; +if (kernel) {if (!real_mode) sr |= CXL_PSL_SR_An_R;
@@ -629,7 +630,7 @@ u64 cxl_calculate_sr(bool master, bool kernel, bool real_mode, bool p9)static u64 calculate_sr (struct cxl_context *ctx) { -return cxl_calculate_sr (ctx->master, ctx->kernel, ctx->real_mode, +return cxl_calculate_sr (ctx->master, ctx->kernel, false,cxl_is_power9 ()); }
include/misc/cxl.h +0 -8
@@ -173,14 +173,6 @@ int cxl_afu_reset(struct cxl_context *ctx);*/ void cxl_set_master (struct cxl_context *ctx); -/* -* Sets the context to use real mode memory accesses to operate with -* translation disabled. Note that this only makes sense for kernel contexts -* under bare metal, and will not work with virtualisation. May only be -* performed on stopped contexts. -*/ -int cxl_set_translation_mode (struct cxl_context *ctx,bool real_mode); -/* * Map and unmap the AFU Problem Space area. The amount and location mapped * depends on if this context is a master or slave.
Signature · 1 line
2.17.1
PATCH 2/10 Revert "cxl: Add support for interrupts on the Mellanox CX4"
In reply to Frederic BarratFrom: Alastair D'Silva <[email protected]>
Remove abandonned capi support for the Mellanox CX4.
This reverts commit a2f67d5ee8d950caaa7a6144cf0bfb256500b73e.
--- arch/powerpc/platforms/powernv/pci-cxl.c | 84 ----------------------- arch/powerpc/platforms/powernv/pci-ioda.c | 4 -- arch/powerpc/platforms/powernv/pci.h | 2 - drivers/misc/cxl/api.c | 71 ------------------- drivers/misc/cxl/base.c | 31 --------- drivers/misc/cxl/cxl.h | 4 -- drivers/misc/cxl/main.c | 2 - include/misc/cxl-base.h | 4 -- 8 files changed, 202 deletions(-)
arch/powerpc/platforms/powernv/pci-cxl.c +0 -84
@@ -8,7 +8,6 @@*/ #include <linux/module.h> -#include <linux/msi.h> #include <asm/pci-bridge.h> #include <asm/pnv-pci.h> #include <asm/opal.h>
@@ -292,86 +291,3 @@ void pnv_cxl_disable_device(struct pci_dev *dev)cxl_pci_disable_device (dev);cxl_afu_put (afu); } - -/* -* This is a special version of pnv_setup_msi_irqs for cards in cxl mode. This -* function handles setting up the IVTE entries for the XSL to use. -* -* We are currently not filling out the MSIX table, since the only currently -* supported adapter (CX4) uses a custom MSIX table format in cxl mode and it -* is up to their driver to fill that out. In the future we may fill out the -* MSIX table (and change the IVTE entries to be an index to the MSIX table) -* for adapters implementing the Full MSI-X mode described in the CAIA. -*/ -int pnv_cxl_cx4_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type) -{ -struct pci_controller *hose =pci_bus_to_host (pdev->bus); -struct pnv_phb *phb = hose->private_data; -struct msi_desc *entry; -struct cxl_context *ctx =NULL ; -unsigned int virq; -int hwirq; -int afu_irq =0 ; -int rc; - -if (WARN_ON (!phb) || !phb->msi_bmp.bitmap) -return -ENODEV ; - -if (pdev->no_64bit_msi && !phb->msi32_support) -return -ENODEV ; - - rc =cxl_cx4_setup_msi_irqs (pdev, nvec, type); -if (rc) -return rc; - -for_each_pci_msi_entry (entry, pdev) { -if (!entry->msi_attrib.is_64 && !phb->msi32_support) { -pr_warn ("%s: Supports only 64-bit MSIs\n" , -pci_name (pdev)); -return -ENXIO ; - } - - hwirq =cxl_next_msi_hwirq (pdev, &ctx, &afu_irq); -if (WARN_ON (hwirq <=0 )) -return (hwirq ? hwirq : -ENOMEM ); - - virq =irq_create_mapping (NULL , hwirq); -if (!virq) { -pr_warn ("%s: Failed to map cxl mode MSI to linux irq\n" , -pci_name (pdev)); -return -ENOMEM ; - } - - rc =pnv_cxl_ioda_msi_setup (pdev, hwirq, virq); -if (rc) { -pr_warn ("%s: Failed to setup cxl mode MSI\n" ,pci_name (pdev)); -irq_dispose_mapping (virq); -return rc; - } - -irq_set_msi_desc (virq, entry); - } - -return 0 ; -} - -void pnv_cxl_cx4_teardown_msi_irqs (struct pci_dev *pdev) -{ -struct pci_controller *hose =pci_bus_to_host (pdev->bus); -struct pnv_phb *phb = hose->private_data; -struct msi_desc *entry; -irq_hw_number_t hwirq; - -if (WARN_ON (!phb)) -return ; - -for_each_pci_msi_entry (entry, pdev) { -if (!entry->irq) -continue ; - hwirq =virq_to_hw (entry->irq); -irq_set_msi_desc (entry->irq,NULL ); -irq_dispose_mapping (entry->irq); - } - -cxl_cx4_teardown_msi_irqs (pdev); -}
arch/powerpc/platforms/powernv/pci-ioda.c +0 -4
@@ -3847,10 +3847,6 @@ static const struct pci_controller_ops pnv_npu_ocapi_ioda_controller_ops = {const struct pci_controller_ops pnv_cxl_cx4_ioda_controller_ops = { .dma_dev_setup = pnv_pci_dma_dev_setup, .dma_bus_setup = pnv_pci_dma_bus_setup, -#ifdef CONFIG_PCI_MSI - .setup_msi_irqs = pnv_cxl_cx4_setup_msi_irqs, - .teardown_msi_irqs = pnv_cxl_cx4_teardown_msi_irqs, -#endif .enable_device_hook = pnv_cxl_enable_device_hook, .disable_device = pnv_cxl_disable_device, .release_device = pnv_pci_release_device,
arch/powerpc/platforms/powernv/pci.h +0 -2
@@ -265,8 +265,6 @@ extern int pnv_npu2_init(struct pnv_phb *phb);/* cxl functions */ extern bool pnv_cxl_enable_device_hook (struct pci_dev *dev);extern void pnv_cxl_disable_device (struct pci_dev *dev); -extern int pnv_cxl_cx4_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type); -extern void pnv_cxl_cx4_teardown_msi_irqs (struct pci_dev *pdev);/* phb ops (cxl switches these when enabling the kernel api on the phb) */
drivers/misc/cxl/api.c +0 -71
80 lines not on this page · raw message
drivers/misc/cxl/base.c +0 -31
@@ -158,37 +158,6 @@ int cxl_next_msi_hwirq(struct pci_dev *pdev, struct cxl_context **ctx, int *afu_ }EXPORT_SYMBOL_GPL (cxl_next_msi_hwirq); -int cxl_cx4_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type) -{ -int ret; -struct cxl_calls *calls; - - calls =cxl_calls_get (); -if (!calls) -return false; - - ret = calls->cxl_cx4_setup_msi_irqs (pdev, nvec, type); - -cxl_calls_put (calls); - -return ret; -} -EXPORT_SYMBOL_GPL (cxl_cx4_setup_msi_irqs); - -void cxl_cx4_teardown_msi_irqs (struct pci_dev *pdev) -{ -struct cxl_calls *calls; - - calls =cxl_calls_get (); -if (!calls) -return ; - - calls->cxl_cx4_teardown_msi_irqs (pdev); - -cxl_calls_put (calls); -} -EXPORT_SYMBOL_GPL (cxl_cx4_teardown_msi_irqs); -static int __init cxl_base_init (void ) {struct device_node *np;
drivers/misc/cxl/cxl.h +0 -4
@@ -879,16 +879,12 @@ ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf,bool _cxl_pci_associate_default_context (struct pci_dev *dev,struct cxl_afu *afu);void _cxl_pci_disable_device (struct pci_dev *dev);int _cxl_next_msi_hwirq (struct pci_dev *pdev,struct cxl_context **ctx,int *afu_irq); -int _cxl_cx4_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type); -void _cxl_cx4_teardown_msi_irqs (struct pci_dev *pdev);struct cxl_calls {void (*cxl_slbia)(struct mm_struct *mm);bool (*cxl_pci_associate_default_context)(struct pci_dev *dev,struct cxl_afu *afu);void (*cxl_pci_disable_device)(struct pci_dev *dev);int (*cxl_next_msi_hwirq)(struct pci_dev *pdev,struct cxl_context **ctx,int *afu_irq); -int (*cxl_cx4_setup_msi_irqs)(struct pci_dev *pdev,int nvec,int type); -void (*cxl_cx4_teardown_msi_irqs)(struct pci_dev *pdev);struct module *owner; };
drivers/misc/cxl/main.c +0 -2
@@ -107,8 +107,6 @@ static struct cxl_calls cxl_calls = { .cxl_pci_associate_default_context = _cxl_pci_associate_default_context, .cxl_pci_disable_device = _cxl_pci_disable_device, .cxl_next_msi_hwirq = _cxl_next_msi_hwirq, - .cxl_cx4_setup_msi_irqs = _cxl_cx4_setup_msi_irqs, - .cxl_cx4_teardown_msi_irqs = _cxl_cx4_teardown_msi_irqs, .owner = THIS_MODULE, };
include/misc/cxl-base.h +0 -4
@@ -43,8 +43,6 @@ void cxl_afu_put(struct cxl_afu *afu);void cxl_slbia (struct mm_struct *mm);bool cxl_pci_associate_default_context (struct pci_dev *dev,struct cxl_afu *afu);void cxl_pci_disable_device (struct pci_dev *dev); -int cxl_cx4_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type); -void cxl_cx4_teardown_msi_irqs (struct pci_dev *pdev);#else /* CONFIG_CXL_BASE */
@@ -54,8 +52,6 @@ static inline void cxl_afu_put(struct cxl_afu *afu) {}static inline void cxl_slbia (struct mm_struct *mm) {}static inline bool cxl_pci_associate_default_context (struct pci_dev *dev,struct cxl_afu *afu) {return false; }static inline void cxl_pci_disable_device (struct pci_dev *dev) {} -static inline int cxl_cx4_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type) {return -ENODEV ; } -static inline void cxl_cx4_teardown_msi_irqs (struct pci_dev *pdev) {}#endif /* CONFIG_CXL_BASE */
Signature · 1 line
2.17.1
PATCH 3/10 Revert "cxl: Add preliminary workaround for CX4 interrupt limitation"
In reply to Frederic BarratFrom: Alastair D'Silva <[email protected]>
Remove abandonned capi support for the Mellanox CX4.
This reverts commit cbce0917e2e47d4bf5aa3b5fd6b1247f33e1a126.
--- drivers/misc/cxl/api.c | 15 --------------- drivers/misc/cxl/base.c | 17 ----------------- drivers/misc/cxl/context.c | 1 - drivers/misc/cxl/cxl.h | 10 ---------- drivers/misc/cxl/main.c | 1 - include/misc/cxl.h | 20 -------------------- 6 files changed, 64 deletions(-)
drivers/misc/cxl/api.c +0 -15
@@ -181,21 +181,6 @@ static irq_hw_number_t cxl_find_afu_irq(struct cxl_context *ctx, int num)return 0 ; } -int _cxl_next_msi_hwirq (struct pci_dev *pdev,struct cxl_context **ctx,int *afu_irq) -{ -if (*ctx ==NULL || *afu_irq ==0 ) { - *afu_irq =1 ; - *ctx =cxl_get_context (pdev); - }else { - (*afu_irq)++; -if (*afu_irq >cxl_get_max_irqs_per_process (pdev)) { - *ctx =list_next_entry (*ctx, extra_irq_contexts); - *afu_irq =1 ; - } - } -return cxl_find_afu_irq (*ctx, *afu_irq); -} -/* Exported via cxl_base */ int cxl_set_priv (struct cxl_context *ctx,void *priv) {
drivers/misc/cxl/base.c +0 -17
@@ -141,23 +141,6 @@ void cxl_pci_disable_device(struct pci_dev *dev) }EXPORT_SYMBOL_GPL (cxl_pci_disable_device); -int cxl_next_msi_hwirq (struct pci_dev *pdev,struct cxl_context **ctx,int *afu_irq) -{ -int ret; -struct cxl_calls *calls; - - calls =cxl_calls_get (); -if (!calls) -return -EBUSY ; - - ret = calls->cxl_next_msi_hwirq (pdev, ctx, afu_irq); - -cxl_calls_put (calls); - -return ret; -} -EXPORT_SYMBOL_GPL (cxl_next_msi_hwirq); -static int __init cxl_base_init (void ) {struct device_node *np;
drivers/misc/cxl/context.c +0 -1
@@ -74,7 +74,6 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master) ctx->pending_afu_err = false;INIT_LIST_HEAD (&ctx->irq_names); -INIT_LIST_HEAD (&ctx->extra_irq_contexts);/* * When we have to destroy all contexts in cxl_context_detach_all() we
drivers/misc/cxl/cxl.h +0 -10
@@ -623,14 +623,6 @@ struct cxl_context {struct rcu_head rcu; -/* -* Only used when more interrupts are allocated via -* pci_enable_msix_range than are supported in the default context, to -* use additional contexts to overcome the limitation. i.e. Mellanox -* CX4 only: -*/ -struct list_head extra_irq_contexts; -struct mm_struct *mm;u16 tidr;
@@ -878,13 +870,11 @@ ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf,/* Internal functions wrapped in cxl_base to allow PHB to call them */ bool _cxl_pci_associate_default_context (struct pci_dev *dev,struct cxl_afu *afu);void _cxl_pci_disable_device (struct pci_dev *dev); -int _cxl_next_msi_hwirq (struct pci_dev *pdev,struct cxl_context **ctx,int *afu_irq);struct cxl_calls {void (*cxl_slbia)(struct mm_struct *mm);bool (*cxl_pci_associate_default_context)(struct pci_dev *dev,struct cxl_afu *afu);void (*cxl_pci_disable_device)(struct pci_dev *dev); -int (*cxl_next_msi_hwirq)(struct pci_dev *pdev,struct cxl_context **ctx,int *afu_irq);struct module *owner; };
drivers/misc/cxl/main.c +0 -1
@@ -106,7 +106,6 @@ static struct cxl_calls cxl_calls = { .cxl_slbia = cxl_slbia_core, .cxl_pci_associate_default_context = _cxl_pci_associate_default_context, .cxl_pci_disable_device = _cxl_pci_disable_device, - .cxl_next_msi_hwirq = _cxl_next_msi_hwirq, .owner = THIS_MODULE, };
include/misc/cxl.h +0 -20
@@ -183,26 +183,6 @@ void cxl_psa_unmap(void __iomem *addr);/* Get the process element for this context */ int cxl_process_element (struct cxl_context *ctx); -/* -* Limit the number of interrupts that a single context can allocate via -* cxl_start_work. If using the api with a real phb, this may be used to -* request that additional default contexts be created when allocating -* interrupts via pci_enable_msix_range. These will be set to the same running -* state as the default context, and if that is running it will reuse the -* parameters previously passed to cxl_start_context for the default context. -*/ -int cxl_set_max_irqs_per_process (struct pci_dev *dev,int irqs); -int cxl_get_max_irqs_per_process (struct pci_dev *dev); - -/* -* Use to simultaneously iterate over hardware interrupt numbers, contexts and -* afu interrupt numbers allocated for the device via pci_enable_msix_range and -* is a useful convenience function when working with hardware that has -* limitations on the number of interrupts per process. *ctx and *afu_irq -* should be NULL and 0 to start the iteration. -*/ -int cxl_next_msi_hwirq (struct pci_dev *pdev,struct cxl_context **ctx,int *afu_irq); -/* * These calls allow drivers to create their own file descriptors and make them * identical to the cxl file descriptor user API. An example use case:
Signature · 1 line
2.17.1
PATCH 4/10 Revert "cxl: Add kernel APIs to get & set the max irqs per context"
In reply to Frederic BarratFrom: Alastair D'Silva <[email protected]>
Remove abandonned capi support for the Mellanox CX4.
This reverts commit 79384e4b71240abf50c375eea56060b0d79c242a.
--- drivers/misc/cxl/api.c | 27 --------------------------- 1 file changed, 27 deletions(-)
drivers/misc/cxl/api.c +0 -27
@@ -552,30 +552,3 @@ ssize_t cxl_read_adapter_vpd(struct pci_dev *dev, void *buf, size_t count)return cxl_ops->read_adapter_vpd (afu->adapter, buf, count); }EXPORT_SYMBOL_GPL (cxl_read_adapter_vpd); - -int cxl_set_max_irqs_per_process (struct pci_dev *dev,int irqs) -{ -struct cxl_afu *afu =cxl_pci_to_afu (dev); -if (IS_ERR (afu)) -return -ENODEV ; - -if (irqs > afu->adapter->user_irqs) -return -EINVAL ; - -/* Limit user_irqs to prevent the user increasing this via sysfs */ - afu->adapter->user_irqs = irqs; - afu->irqs_max = irqs; - -return 0 ; -} -EXPORT_SYMBOL_GPL (cxl_set_max_irqs_per_process); - -int cxl_get_max_irqs_per_process (struct pci_dev *dev) -{ -struct cxl_afu *afu =cxl_pci_to_afu (dev); -if (IS_ERR (afu)) -return -ENODEV ; - -return afu->irqs_max; -} -EXPORT_SYMBOL_GPL (cxl_get_max_irqs_per_process);
Signature · 1 line
2.17.1
PATCH 5/10 Revert "cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards"
In reply to Frederic BarratFrom: Alastair D'Silva <[email protected]>
Remove abandonned capi support for the Mellanox CX4.
This reverts commit b0b5e5918ad1babfd1d43d98c7281926a7b57b9f.
--- drivers/misc/cxl/Kconfig | 8 -- drivers/misc/cxl/pci.c | 236 +++------------------------------------ include/misc/cxl.h | 25 ----- 3 files changed, 18 insertions(+), 251 deletions(-)
drivers/misc/cxl/Kconfig +0 -8
@@ -33,11 +33,3 @@ config CXL CAPI adapters are found in POWER8 based systems. If unsure, say N. - -config CXL_BIMODAL - bool "Support for bi-modal CAPI cards" - depends on HOTPLUG_PCI_POWERNV = y && CXL || HOTPLUG_PCI_POWERNV = m && CXL = m - default y - help - Select this option to enable support for bi-modal CAPI cards, such as - the Mellanox CX-4.
drivers/misc/cxl/pci.c +18 -218
267 lines not on this page · raw message
include/misc/cxl.h +0 -25
@@ -39,31 +39,6 @@bool cxl_slot_is_supported (struct pci_dev *dev,int flags); -#define CXL_BIMODE_CXL 1 -#define CXL_BIMODE_PCI 2 - -/* -* Check the mode that the given bi-modal CXL adapter is currently in and -* change it if necessary. This does not apply to AFU drivers. -* -* If the mode matches the requested mode this function will return 0 - if the -* driver was expecting the generic CXL driver to have bound to the adapter and -* it gets this return value it should fail the probe function to give the CXL -* driver a chance to probe it. -* -* If the mode does not match it will start a background task to unplug the -* device from Linux and switch its mode, and will return -EBUSY. At this -* point the calling driver should make sure it has released the device and -* fail its probe function. -* -* The offset of the CXL VSEC can be provided to this function. If 0 is passed, -* this function will search for a CXL VSEC with ID 0x1280 and return -ENODEV -* if it is not found. -*/ -#ifdef CONFIG_CXL_BIMODAL -int cxl_check_and_switch_mode (struct pci_dev *dev,int mode,int vsec); -#endif -/* Get the AFU associated with a pci_dev */ struct cxl_afu *cxl_pci_to_afu (struct pci_dev *dev);
Signature · 1 line
2.17.1
PATCH 6/10 Revert "cxl: Add support for using the kernel API with a real PHB"
In reply to Frederic BarratFrom: Alastair D'Silva <[email protected]>
Remove abandonned capi support for the Mellanox CX4.
This reverts commit 317f5ef1b363417b6f1e93b90dfd2ffd6be6e867.
--- drivers/misc/cxl/pci.c | 3 --- drivers/misc/cxl/vphb.c | 16 ++-------------- 2 files changed, 2 insertions(+), 17 deletions(-)
drivers/misc/cxl/pci.c +0 -3
@@ -1886,9 +1886,6 @@ static int cxl_probe(struct pci_dev *dev, const struct pci_device_id *id)dev_err (&dev->dev,"AFU %i failed to start: %i\n" , slice, rc); } -if (pnv_pci_on_cxl_phb (dev) && adapter->slices >=1 ) -pnv_cxl_phb_set_peer_afu (dev, adapter->afu[0 ]); -return 0 ; }
drivers/misc/cxl/vphb.c +2 -14
@@ -9,7 +9,6 @@#include <linux/pci.h> #include <misc/cxl.h> -#include <asm/pnv-pci.h> #include "cxl.h" static int cxl_dma_set_mask (struct pci_dev *pdev,u64 dma_mask)
@@ -284,18 +283,13 @@ void cxl_pci_vphb_remove(struct cxl_afu *afu)*/ } -static bool _cxl_pci_is_vphb_device (struct pci_controller *phb) -{ -return (phb->ops == &cxl_pcie_pci_ops); -} -bool cxl_pci_is_vphb_device (struct pci_dev *dev) {struct pci_controller *phb; phb =pci_bus_to_host (dev->bus); -return _cxl_pci_is_vphb_device (phb); +return (phb->ops == &cxl_pcie_pci_ops); }struct cxl_afu *cxl_pci_to_afu (struct pci_dev *dev)
@@ -304,13 +298,7 @@ struct cxl_afu *cxl_pci_to_afu(struct pci_dev *dev) phb =pci_bus_to_host (dev->bus); -if (_cxl_pci_is_vphb_device (phb)) -return (struct cxl_afu *)phb->private_data; - -if (pnv_pci_on_cxl_phb (dev)) -return pnv_cxl_phb_to_afu (phb); - -return ERR_PTR (-ENODEV ); +return (struct cxl_afu *)phb->private_data; }EXPORT_SYMBOL_GPL (cxl_pci_to_afu);
Signature · 1 line
2.17.1
PATCH 7/10 Revert "powerpc/powernv: Add support for the cxl kernel api on the real phb"
In reply to Frederic BarratFrom: Alastair D'Silva <[email protected]>
Remove abandonned capi support for the Mellanox CX4.
This reverts commit 4361b03430d685610e5feea3ec7846e8b9ae795f.
--- arch/powerpc/include/asm/pnv-pci.h | 7 -- arch/powerpc/platforms/powernv/pci-cxl.c | 115 ---------------------- arch/powerpc/platforms/powernv/pci-ioda.c | 18 +--- arch/powerpc/platforms/powernv/pci.h | 13 --- 4 files changed, 1 insertion(+), 152 deletions(-)
arch/powerpc/include/asm/pnv-pci.h +0 -7
@@ -50,13 +50,6 @@ int pnv_cxl_alloc_hwirq_ranges(struct cxl_irq_ranges *irqs, struct pci_dev *dev, int num);void pnv_cxl_release_hwirq_ranges (struct cxl_irq_ranges *irqs,struct pci_dev *dev); - -/* Support for the cxl kernel api on the real PHB (instead of vPHB) */ -int pnv_cxl_enable_phb_kernel_api (struct pci_controller *hose,bool enable); -bool pnv_pci_on_cxl_phb (struct pci_dev *dev); -struct cxl_afu *pnv_cxl_phb_to_afu (struct pci_controller *hose); -void pnv_cxl_phb_set_peer_afu (struct pci_dev *dev,struct cxl_afu *afu); -#endif struct pnv_php_slot {
arch/powerpc/platforms/powernv/pci-cxl.c +0 -115
126 lines not on this page · raw message
arch/powerpc/platforms/powernv/pci-ioda.c +1 -17
@@ -3575,7 +3575,7 @@ static resource_size_t pnv_pci_iov_resource_alignment(struct pci_dev *pdev,/* Prevent enabling devices for which we couldn't properly * assign a PE */ -bool pnv_pci_enable_device_hook (struct pci_dev *dev) +static bool pnv_pci_enable_device_hook (struct pci_dev *dev) {struct pci_controller *hose =pci_bus_to_host (dev->bus);struct pnv_phb *phb = hose->private_data;
@@ -3843,22 +3843,6 @@ static const struct pci_controller_ops pnv_npu_ocapi_ioda_controller_ops = { .shutdown = pnv_pci_ioda_shutdown, }; -#ifdef CONFIG_CXL_BASE -const struct pci_controller_ops pnv_cxl_cx4_ioda_controller_ops = { - .dma_dev_setup = pnv_pci_dma_dev_setup, - .dma_bus_setup = pnv_pci_dma_bus_setup, - .enable_device_hook = pnv_cxl_enable_device_hook, - .disable_device = pnv_cxl_disable_device, - .release_device = pnv_pci_release_device, - .window_alignment = pnv_pci_window_alignment, - .setup_bridge = pnv_pci_setup_bridge, - .reset_secondary_bus = pnv_pci_reset_secondary_bus, - .dma_set_mask = pnv_pci_ioda_dma_set_mask, - .dma_get_required_mask = pnv_pci_ioda_dma_get_required_mask, - .shutdown = pnv_pci_ioda_shutdown, -}; -#endif -static void __init pnv_pci_init_ioda_phb (struct device_node *np,u64 hub_id,int ioda_type) {
arch/powerpc/platforms/powernv/pci.h +0 -13
@@ -88,7 +88,6 @@ struct pnv_ioda_pe { };#define PNV_PHB_FLAG_EEH (1 << 0) -#define PNV_PHB_FLAG_CXL (1 << 1)/* Real PHB supporting the cxl kernel API */ struct pnv_phb {struct pci_controller *hose;
@@ -194,9 +193,6 @@ struct pnv_phb {bool nmmu_flush; } npu; -#ifdef CONFIG_CXL_BASE -struct cxl_afu *cxl_afu; -#endif int p2p_target_count; };
@@ -238,7 +234,6 @@ extern int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);extern void pnv_teardown_msi_irqs (struct pci_dev *pdev);extern struct pnv_ioda_pe *pnv_ioda_get_pe (struct pci_dev *dev);extern void pnv_set_msi_irq_chip (struct pnv_phb *phb,unsigned int virq); -extern bool pnv_pci_enable_device_hook (struct pci_dev *dev);extern void pnv_pci_ioda2_set_bypass (struct pnv_ioda_pe *pe,bool enable);extern int pnv_eeh_post_init (void );
@@ -262,12 +257,4 @@ extern void pnv_npu_take_ownership(struct pnv_ioda_pe *npe);extern void pnv_npu_release_ownership (struct pnv_ioda_pe *npe);extern int pnv_npu2_init (struct pnv_phb *phb); -/* cxl functions */ -extern bool pnv_cxl_enable_device_hook (struct pci_dev *dev); -extern void pnv_cxl_disable_device (struct pci_dev *dev); - - -/* phb ops (cxl switches these when enabling the kernel api on the phb) */ -extern const struct pci_controller_ops pnv_cxl_cx4_ioda_controller_ops; -#endif /* __POWERNV_PCI_H */
Signature · 1 line
2.17.1
PATCH 8/10 Revert "cxl: Add cxl_slot_is_supported API"
In reply to Frederic BarratRemove abandonned capi support for the Mellanox CX4.
This reverts commit 4e56f858bdde5cbfb70f61baddfaa56a8ed851bf.
--- drivers/misc/cxl/pci.c | 37 ------------------------------------- include/misc/cxl.h | 15 --------------- 2 files changed, 52 deletions(-)
drivers/misc/cxl/pci.c +0 -37
@@ -1808,43 +1808,6 @@ int cxl_slot_is_switched(struct pci_dev *dev)return (depth >CXL_MAX_PCIEX_PARENT ); } -bool cxl_slot_is_supported (struct pci_dev *dev,int flags) -{ -if (!cpu_has_feature (CPU_FTR_HVMODE )) -return false; - -if ((flags &CXL_SLOT_FLAG_DMA ) && (!pvr_version_is (PVR_POWER8NVL ))) { -/* -* CAPP DMA mode is technically supported on regular P8, but -* will EEH if the card attempts to access memory < 4GB, which -* we cannot realistically avoid. We might be able to work -* around the issue, but until then return unsupported: -*/ -return false; - } - -if (cxl_slot_is_switched (dev)) -return false; - -/* -* XXX: This gets a little tricky on regular P8 (not POWER8NVL) since -* the CAPP can be connected to PHB 0, 1 or 2 on a first come first -* served basis, which is racy to check from here. If we need to -* support this in future we might need to consider having this -* function effectively reserve it ahead of time. -* -* Currently, the only user of this API is the Mellanox CX4, which is -* only supported on P8NVL due to the above mentioned limitation of -* CAPP DMA mode and therefore does not need to worry about this. If the -* issue with CAPP DMA mode is later worked around on P8 we might need -* to revisit this. -*/ - -return true; -} -EXPORT_SYMBOL_GPL (cxl_slot_is_supported); - -static int cxl_probe (struct pci_dev *dev,const struct pci_device_id *id) {struct cxl *adapter;
include/misc/cxl.h +0 -15
@@ -24,21 +24,6 @@* generic PCI API. This API is agnostic to the actual AFU. */ -#define CXL_SLOT_FLAG_DMA 0x1 - -/* -* Checks if the given card is in a cxl capable slot. Pass CXL_SLOT_FLAG_DMA if -* the card requires CAPP DMA mode to also check if the system supports it. -* This is intended to be used by bi-modal devices to determine if they can use -* cxl mode or if they should continue running in PCI mode. -* -* Note that this only checks if the slot is cxl capable - it does not -* currently check if the CAPP is currently available for chips where it can be -* assigned to different PHBs on a first come first serve basis (i.e. P8) -*/ -bool cxl_slot_is_supported (struct pci_dev *dev,int flags); - -/* Get the AFU associated with a pci_dev */ struct cxl_afu *cxl_pci_to_afu (struct pci_dev *dev);
Signature · 1 line
2.17.1
PATCH 9/10 Revert "cxl: Allow a default context to be associated with an external pci_dev"
In reply to Frederic BarratRemove abandonned capi support for the Mellanox CX4.
This reverts commit a19bd79e31769626d288cc016e21a31b6f47bf6f.
--- drivers/misc/cxl/Makefile | 2 +- drivers/misc/cxl/base.c | 35 ------------------------------- drivers/misc/cxl/cxl.h | 6 ------ drivers/misc/cxl/main.c | 2 -- drivers/misc/cxl/phb.c | 44 --------------------------------------- drivers/misc/cxl/vphb.c | 30 +++++++++++++++++++++++--- include/misc/cxl-base.h | 6 ------ 7 files changed, 28 insertions(+), 97 deletions(-) delete mode 100644 drivers/misc/cxl/phb.c
drivers/misc/cxl/Makefile +1 -1
@@ -4,7 +4,7 @@ ccflags-$(CONFIG_PPC_WERROR) += -Werror cxl-y += main.o file.o irq.o fault.o native.o cxl-y += context.o sysfs.o pci.o trace.o -cxl-y += vphb.o phb.o api.o cxllib.o +cxl-y += vphb.o api.o cxllib.o cxl-$(CONFIG_PPC_PSERIES) += flash.o guest.o of.o hcalls.o cxl-$(CONFIG_DEBUG_FS) += debugfs.o obj-$(CONFIG_CXL) += cxl.o
drivers/misc/cxl/base.c +0 -35
@@ -106,41 +106,6 @@ int cxl_update_properties(struct device_node *dn, }EXPORT_SYMBOL_GPL (cxl_update_properties); -/* -* API calls into the driver that may be called from the PHB code and must be -* built in. -*/ -bool cxl_pci_associate_default_context (struct pci_dev *dev,struct cxl_afu *afu) -{ -bool ret; -struct cxl_calls *calls; - - calls =cxl_calls_get (); -if (!calls) -return false; - - ret = calls->cxl_pci_associate_default_context (dev, afu); - -cxl_calls_put (calls); - -return ret; -} -EXPORT_SYMBOL_GPL (cxl_pci_associate_default_context); - -void cxl_pci_disable_device (struct pci_dev *dev) -{ -struct cxl_calls *calls; - - calls =cxl_calls_get (); -if (!calls) -return ; - - calls->cxl_pci_disable_device (dev); - -cxl_calls_put (calls); -} -EXPORT_SYMBOL_GPL (cxl_pci_disable_device); -static int __init cxl_base_init (void ) {struct device_node *np;
drivers/misc/cxl/cxl.h +0 -6
@@ -867,15 +867,9 @@ static inline bool cxl_is_power9_dd1(void)ssize_t cxl_pci_afu_read_err_buffer (struct cxl_afu *afu,char *buf,loff_t off,size_t count); -/* Internal functions wrapped in cxl_base to allow PHB to call them */ -bool _cxl_pci_associate_default_context (struct pci_dev *dev,struct cxl_afu *afu); -void _cxl_pci_disable_device (struct pci_dev *dev);struct cxl_calls {void (*cxl_slbia)(struct mm_struct *mm); -bool (*cxl_pci_associate_default_context)(struct pci_dev *dev,struct cxl_afu *afu); -void (*cxl_pci_disable_device)(struct pci_dev *dev); -struct module *owner; };int register_cxl_calls (struct cxl_calls *calls);
drivers/misc/cxl/main.c +0 -2
@@ -104,8 +104,6 @@ static inline void cxl_slbia_core(struct mm_struct *mm)static struct cxl_calls cxl_calls = { .cxl_slbia = cxl_slbia_core, - .cxl_pci_associate_default_context = _cxl_pci_associate_default_context, - .cxl_pci_disable_device = _cxl_pci_disable_device, .owner =THIS_MODULE , };
drivers/misc/cxl/phb.c deleted +0 -44
44 lines not on this page · raw message
drivers/misc/cxl/vphb.c +27 -3
@@ -44,6 +44,7 @@ static bool cxl_pci_enable_device_hook(struct pci_dev *dev) {struct pci_controller *phb;struct cxl_afu *afu; +struct cxl_context *ctx; phb =pci_bus_to_host (dev->bus); afu = (struct cxl_afu *)phb->private_data;
@@ -56,7 +57,30 @@ static bool cxl_pci_enable_device_hook(struct pci_dev *dev)set_dma_ops (&dev->dev, &dma_nommu_ops);set_dma_offset (&dev->dev,PAGE_OFFSET ); -return _cxl_pci_associate_default_context (dev, afu); +/* +* Allocate a context to do cxl things too. If we eventually do real +* DMA ops, we'll need a default context to attach them to +*/ + ctx =cxl_dev_context_init (dev); +if (IS_ERR (ctx)) +return false; + dev->dev.archdata.cxl_ctx = ctx; + +return (cxl_ops->afu_check_and_enable (afu) ==0 ); +} + +static void cxl_pci_disable_device (struct pci_dev *dev) +{ +struct cxl_context *ctx =cxl_get_context (dev); + +if (ctx) { +if (ctx->status ==STARTED ) { +dev_err (&dev->dev,"Default context started\n" ); +return ; + } + dev->dev.archdata.cxl_ctx =NULL ; +cxl_release_context (ctx); + } } static resource_size_t cxl_pci_window_alignment(struct pci_bus *bus,
@@ -190,8 +214,8 @@ static struct pci_controller_ops cxl_pci_controller_ops = { .probe_mode = cxl_pci_probe_mode, .enable_device_hook = cxl_pci_enable_device_hook, - .disable_device = _cxl_pci_disable_device, - .release_device = _cxl_pci_disable_device, + .disable_device = cxl_pci_disable_device, + .release_device = cxl_pci_disable_device, .window_alignment = cxl_pci_window_alignment, .reset_secondary_bus = cxl_pci_reset_secondary_bus, .setup_msi_irqs = cxl_setup_msi_irqs,
include/misc/cxl-base.h +0 -6
@@ -10,8 +10,6 @@#ifndef _MISC_CXL_BASE_H#define _MISC_CXL_BASE_H -#include <misc/cxl.h> -#ifdef CONFIG_CXL_BASE #define CXL_IRQ_RANGES 4
@@ -41,8 +39,6 @@ static inline void cxl_ctx_put(void)struct cxl_afu *cxl_afu_get (struct cxl_afu *afu);void cxl_afu_put (struct cxl_afu *afu);void cxl_slbia (struct mm_struct *mm); -bool cxl_pci_associate_default_context (struct pci_dev *dev,struct cxl_afu *afu); -void cxl_pci_disable_device (struct pci_dev *dev);#else /* CONFIG_CXL_BASE */
@@ -50,8 +46,6 @@ static inline bool cxl_ctx_in_use(void) { return false; }static inline struct cxl_afu *cxl_afu_get (struct cxl_afu *afu) {return NULL ; }static inline void cxl_afu_put (struct cxl_afu *afu) {}static inline void cxl_slbia (struct mm_struct *mm) {} -static inline bool cxl_pci_associate_default_context (struct pci_dev *dev,struct cxl_afu *afu) {return false; } -static inline void cxl_pci_disable_device (struct pci_dev *dev) {}#endif /* CONFIG_CXL_BASE */
Signature · 1 line
2.17.1
PATCH 10/10 cxl: Remove abandonned capi support for the Mellanox CX4, final cleanup
In reply to Frederic BarratRemove a few XSL/CX4 oddities which are no longer needed. A simple revert of the initial commits was not possible (or not worth it) due to the history of the code.
--- drivers/misc/cxl/context.c | 2 +- drivers/misc/cxl/cxl.h | 12 ------ drivers/misc/cxl/debugfs.c | 5 --- drivers/misc/cxl/pci.c | 75 +++----------------------------------- 4 files changed, 7 insertions(+), 87 deletions(-)
drivers/misc/cxl/context.c +1 -1
@@ -95,7 +95,7 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master)*/ mutex_lock (&afu->contexts_lock);idr_preload (GFP_KERNEL ); - i =idr_alloc (&ctx->afu->contexts_idr, ctx, ctx->afu->adapter->min_pe, + i =idr_alloc (&ctx->afu->contexts_idr, ctx,0 , ctx->afu->num_procs,GFP_NOWAIT );idr_preload_end ();mutex_unlock (&afu->contexts_lock);
drivers/misc/cxl/cxl.h +0 -12
@@ -93,11 +93,6 @@ static const cxl_p1_reg_t CXL_PSL_FIR_CNTL = {0x0148};static const cxl_p1_reg_t CXL_PSL_DSNDCTL = {0x0150 };static const cxl_p1_reg_t CXL_PSL_SNWRALLOC = {0x0158 };static const cxl_p1_reg_t CXL_PSL_TRACE = {0x0170 }; -/* XSL registers (Mellanox CX4) */ -static const cxl_p1_reg_t CXL_XSL_Timebase = {0x0100 }; -static const cxl_p1_reg_t CXL_XSL_TB_CTLSTAT = {0x0108 }; -static const cxl_p1_reg_t CXL_XSL_FEC = {0x0158 }; -static const cxl_p1_reg_t CXL_XSL_DSNCTL = {0x0168 };/* PSL registers - CAIA 2 */ static const cxl_p1_reg_t CXL_PSL9_CONTROL = {0x0020 };static const cxl_p1_reg_t CXL_XSL9_INV = {0x0110 };
@@ -695,7 +690,6 @@ struct cxl {struct bin_attribute cxl_attr;int adapter_num;int user_irqs; -int min_pe;u64 ps_size;u16 psl_rev;u16 base_image;
@@ -934,7 +928,6 @@ int cxl_debugfs_afu_add(struct cxl_afu *afu);void cxl_debugfs_afu_remove (struct cxl_afu *afu);void cxl_debugfs_add_adapter_regs_psl9 (struct cxl *adapter,struct dentry *dir);void cxl_debugfs_add_adapter_regs_psl8 (struct cxl *adapter,struct dentry *dir); -void cxl_debugfs_add_adapter_regs_xsl (struct cxl *adapter,struct dentry *dir);void cxl_debugfs_add_afu_regs_psl9 (struct cxl_afu *afu,struct dentry *dir);void cxl_debugfs_add_afu_regs_psl8 (struct cxl_afu *afu,struct dentry *dir);
@@ -977,11 +970,6 @@ static inline void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, { } -static inline void cxl_debugfs_add_adapter_regs_xsl (struct cxl *adapter, -struct dentry *dir) -{ -} -static inline void cxl_debugfs_add_afu_regs_psl9 (struct cxl_afu *afu,struct dentry *dir) { }
drivers/misc/cxl/debugfs.c +0 -5
@@ -58,11 +58,6 @@ void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir)debugfs_create_io_x64 ("trace" ,S_IRUSR |S_IWUSR , dir,_cxl_p1_addr (adapter,CXL_PSL_TRACE )); } -void cxl_debugfs_add_adapter_regs_xsl (struct cxl *adapter,struct dentry *dir) -{ -debugfs_create_io_x64 ("fec" ,S_IRUSR , dir,_cxl_p1_addr (adapter,CXL_XSL_FEC )); -} -int cxl_debugfs_adapter_add (struct cxl *adapter) {struct dentry *dir;
drivers/misc/cxl/pci.c +6 -69
102 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 17 lines · Frederic Barrat
An attempt was made to add capi support for the Mellanox CX4 card, so that it could operate in "traditional" PCI mode or capi mode. The project ended up being canceled and a different approach was taken for CX5. Mellanox never upstreamed any capi support in their CX4 driver.
CX4 was not following exactly the CAIA 1.0 model, so some CX4-specific code was added. That code is now dead and hasn't been tested for a while, so it's probably broken anyway. Let's remove it. It has been agreed with engineers at Mellanox, of course.
No user API is affected. Some (unused) symbols exported by cxl are removed.
Most of the patch set consists of reverts of older patches, with sometimes very minor tweaking. The last patch aggregates a few changes where reverting was not possible easily.
Tests run to prevent regressions:
Review
Quoted 3 lines
(quoted diff) +0
-3- memcpy tests on POWER8 and POWER9 - Mellanox CX5, which uses a different code path, based on cxllib - cxlflash tests on POWER8
9 of these commits are missing Signed-off-bys.
git revert -s is a thing :)
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Andrew Donnellan
Acked-byQuoted 3 lines · Andrew Donnellan
9 of these commits are missing Signed-off-bys.
git revert -s is a thing :)
After mentally preparing myself for the flashbacks from when we had to implement some of these hacks in the first place, I've read through the rest of the series and it all looks good!
Consider this entire series, with the signoffs fixed:
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited