Commit 2b04cf31 authored by Frederic Barrat's avatar Frederic Barrat Committed by Michael Ellerman

cxl: Rename some bare-metal specific functions

Rename a few functions, changing the 'cxl_' prefix to either
'cxl_pci_' or 'cxl_native_', to make clear that the implementation is
bare-metal specific.

Those functions will have an equivalent implementation for a guest in
a later patch.
Co-authored-by: default avatarChristophe Lombard <clombard@linux.vnet.ibm.com>
Signed-off-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: default avatarChristophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: default avatarManoj Kumar <manoj@linux.vnet.ibm.com>
Acked-by: default avatarIan Munsie <imunsie@au1.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 5be587b1
...@@ -519,14 +519,14 @@ struct cxl { ...@@ -519,14 +519,14 @@ struct cxl {
bool perst_same_image; bool perst_same_image;
}; };
int cxl_alloc_one_irq(struct cxl *adapter); int cxl_pci_alloc_one_irq(struct cxl *adapter);
void cxl_release_one_irq(struct cxl *adapter, int hwirq); void cxl_pci_release_one_irq(struct cxl *adapter, int hwirq);
int cxl_alloc_irq_ranges(struct cxl_irq_ranges *irqs, struct cxl *adapter, unsigned int num); int cxl_pci_alloc_irq_ranges(struct cxl_irq_ranges *irqs, struct cxl *adapter, unsigned int num);
void cxl_release_irq_ranges(struct cxl_irq_ranges *irqs, struct cxl *adapter); void cxl_pci_release_irq_ranges(struct cxl_irq_ranges *irqs, struct cxl *adapter);
int cxl_setup_irq(struct cxl *adapter, unsigned int hwirq, unsigned int virq); int cxl_pci_setup_irq(struct cxl *adapter, unsigned int hwirq, unsigned int virq);
int cxl_update_image_control(struct cxl *adapter); int cxl_update_image_control(struct cxl *adapter);
int cxl_reset(struct cxl *adapter); int cxl_pci_reset(struct cxl *adapter);
void cxl_release_afu(struct device *dev); void cxl_pci_release_afu(struct device *dev);
/* common == phyp + powernv */ /* common == phyp + powernv */
struct cxl_process_element_common { struct cxl_process_element_common {
...@@ -623,7 +623,7 @@ static inline u64 cxl_p2n_read(struct cxl_afu *afu, cxl_p2n_reg_t reg) ...@@ -623,7 +623,7 @@ static inline u64 cxl_p2n_read(struct cxl_afu *afu, cxl_p2n_reg_t reg)
return ~0ULL; return ~0ULL;
} }
ssize_t cxl_afu_read_err_buffer(struct cxl_afu *afu, char *buf, ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
loff_t off, size_t count); loff_t off, size_t count);
...@@ -663,12 +663,12 @@ struct cxl *cxl_alloc_adapter(void); ...@@ -663,12 +663,12 @@ struct cxl *cxl_alloc_adapter(void);
struct cxl_afu *cxl_alloc_afu(struct cxl *adapter, int slice); struct cxl_afu *cxl_alloc_afu(struct cxl *adapter, int slice);
int cxl_afu_select_best_mode(struct cxl_afu *afu); int cxl_afu_select_best_mode(struct cxl_afu *afu);
int cxl_register_psl_irq(struct cxl_afu *afu); int cxl_native_register_psl_irq(struct cxl_afu *afu);
void cxl_release_psl_irq(struct cxl_afu *afu); void cxl_native_release_psl_irq(struct cxl_afu *afu);
int cxl_register_psl_err_irq(struct cxl *adapter); int cxl_native_register_psl_err_irq(struct cxl *adapter);
void cxl_release_psl_err_irq(struct cxl *adapter); void cxl_native_release_psl_err_irq(struct cxl *adapter);
int cxl_register_serr_irq(struct cxl_afu *afu); int cxl_native_register_serr_irq(struct cxl_afu *afu);
void cxl_release_serr_irq(struct cxl_afu *afu); void cxl_native_release_serr_irq(struct cxl_afu *afu);
int afu_register_irqs(struct cxl_context *ctx, u32 count); int afu_register_irqs(struct cxl_context *ctx, u32 count);
void afu_release_irqs(struct cxl_context *ctx, void *cookie); void afu_release_irqs(struct cxl_context *ctx, void *cookie);
void afu_irq_name_free(struct cxl_context *ctx); void afu_irq_name_free(struct cxl_context *ctx);
......
...@@ -80,7 +80,7 @@ int cxl_afu_disable(struct cxl_afu *afu) ...@@ -80,7 +80,7 @@ int cxl_afu_disable(struct cxl_afu *afu)
} }
/* This will disable as well as reset */ /* This will disable as well as reset */
static int __cxl_afu_reset(struct cxl_afu *afu) static int native_afu_reset(struct cxl_afu *afu)
{ {
pr_devel("AFU reset request\n"); pr_devel("AFU reset request\n");
...@@ -90,7 +90,7 @@ static int __cxl_afu_reset(struct cxl_afu *afu) ...@@ -90,7 +90,7 @@ static int __cxl_afu_reset(struct cxl_afu *afu)
false); false);
} }
static int cxl_afu_check_and_enable(struct cxl_afu *afu) static int native_afu_check_and_enable(struct cxl_afu *afu)
{ {
if (!cxl_ops->link_ok(afu->adapter)) { if (!cxl_ops->link_ok(afu->adapter)) {
WARN(1, "Refusing to enable afu while link down!\n"); WARN(1, "Refusing to enable afu while link down!\n");
...@@ -631,7 +631,7 @@ static int deactivate_dedicated_process(struct cxl_afu *afu) ...@@ -631,7 +631,7 @@ static int deactivate_dedicated_process(struct cxl_afu *afu)
return 0; return 0;
} }
static int cxl_afu_deactivate_mode(struct cxl_afu *afu, int mode) static int native_afu_deactivate_mode(struct cxl_afu *afu, int mode)
{ {
if (mode == CXL_MODE_DIRECTED) if (mode == CXL_MODE_DIRECTED)
return deactivate_afu_directed(afu); return deactivate_afu_directed(afu);
...@@ -640,7 +640,7 @@ static int cxl_afu_deactivate_mode(struct cxl_afu *afu, int mode) ...@@ -640,7 +640,7 @@ static int cxl_afu_deactivate_mode(struct cxl_afu *afu, int mode)
return 0; return 0;
} }
static int cxl_afu_activate_mode(struct cxl_afu *afu, int mode) static int native_afu_activate_mode(struct cxl_afu *afu, int mode)
{ {
if (!mode) if (!mode)
return 0; return 0;
...@@ -660,7 +660,8 @@ static int cxl_afu_activate_mode(struct cxl_afu *afu, int mode) ...@@ -660,7 +660,8 @@ static int cxl_afu_activate_mode(struct cxl_afu *afu, int mode)
return -EINVAL; return -EINVAL;
} }
static int cxl_attach_process(struct cxl_context *ctx, bool kernel, u64 wed, u64 amr) static int native_attach_process(struct cxl_context *ctx, bool kernel,
u64 wed, u64 amr)
{ {
if (!cxl_ops->link_ok(ctx->afu->adapter)) { if (!cxl_ops->link_ok(ctx->afu->adapter)) {
WARN(1, "Device link is down, refusing to attach process!\n"); WARN(1, "Device link is down, refusing to attach process!\n");
...@@ -697,7 +698,7 @@ static inline int detach_process_native_afu_directed(struct cxl_context *ctx) ...@@ -697,7 +698,7 @@ static inline int detach_process_native_afu_directed(struct cxl_context *ctx)
return 0; return 0;
} }
static int cxl_detach_process(struct cxl_context *ctx) static int native_detach_process(struct cxl_context *ctx)
{ {
trace_cxl_detach(ctx); trace_cxl_detach(ctx);
...@@ -707,7 +708,7 @@ static int cxl_detach_process(struct cxl_context *ctx) ...@@ -707,7 +708,7 @@ static int cxl_detach_process(struct cxl_context *ctx)
return detach_process_native_afu_directed(ctx); return detach_process_native_afu_directed(ctx);
} }
static int cxl_get_irq(struct cxl_afu *afu, struct cxl_irq_info *info) static int native_get_irq_info(struct cxl_afu *afu, struct cxl_irq_info *info)
{ {
u64 pidtid; u64 pidtid;
...@@ -729,7 +730,8 @@ static int cxl_get_irq(struct cxl_afu *afu, struct cxl_irq_info *info) ...@@ -729,7 +730,8 @@ static int cxl_get_irq(struct cxl_afu *afu, struct cxl_irq_info *info)
return 0; return 0;
} }
static irqreturn_t handle_psl_slice_error(struct cxl_context *ctx, u64 dsisr, u64 errstat) static irqreturn_t native_handle_psl_slice_error(struct cxl_context *ctx,
u64 dsisr, u64 errstat)
{ {
u64 fir1, fir2, fir_slice, serr, afu_debug; u64 fir1, fir2, fir_slice, serr, afu_debug;
...@@ -762,7 +764,7 @@ static irqreturn_t fail_psl_irq(struct cxl_afu *afu, struct cxl_irq_info *irq_in ...@@ -762,7 +764,7 @@ static irqreturn_t fail_psl_irq(struct cxl_afu *afu, struct cxl_irq_info *irq_in
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t cxl_irq_multiplexed(int irq, void *data) static irqreturn_t native_irq_multiplexed(int irq, void *data)
{ {
struct cxl_afu *afu = data; struct cxl_afu *afu = data;
struct cxl_context *ctx; struct cxl_context *ctx;
...@@ -770,7 +772,7 @@ static irqreturn_t cxl_irq_multiplexed(int irq, void *data) ...@@ -770,7 +772,7 @@ static irqreturn_t cxl_irq_multiplexed(int irq, void *data)
int ph = cxl_p2n_read(afu, CXL_PSL_PEHandle_An) & 0xffff; int ph = cxl_p2n_read(afu, CXL_PSL_PEHandle_An) & 0xffff;
int ret; int ret;
if ((ret = cxl_get_irq(afu, &irq_info))) { if ((ret = native_get_irq_info(afu, &irq_info))) {
WARN(1, "Unable to get CXL IRQ Info: %i\n", ret); WARN(1, "Unable to get CXL IRQ Info: %i\n", ret);
return fail_psl_irq(afu, &irq_info); return fail_psl_irq(afu, &irq_info);
} }
...@@ -791,7 +793,7 @@ static irqreturn_t cxl_irq_multiplexed(int irq, void *data) ...@@ -791,7 +793,7 @@ static irqreturn_t cxl_irq_multiplexed(int irq, void *data)
return fail_psl_irq(afu, &irq_info); return fail_psl_irq(afu, &irq_info);
} }
static irqreturn_t cxl_slice_irq_err(int irq, void *data) static irqreturn_t native_slice_irq_err(int irq, void *data)
{ {
struct cxl_afu *afu = data; struct cxl_afu *afu = data;
u64 fir_slice, errstat, serr, afu_debug; u64 fir_slice, errstat, serr, afu_debug;
...@@ -812,7 +814,7 @@ static irqreturn_t cxl_slice_irq_err(int irq, void *data) ...@@ -812,7 +814,7 @@ static irqreturn_t cxl_slice_irq_err(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t cxl_irq_err(int irq, void *data) static irqreturn_t native_irq_err(int irq, void *data)
{ {
struct cxl *adapter = data; struct cxl *adapter = data;
u64 fir1, fir2, err_ivte; u64 fir1, fir2, err_ivte;
...@@ -833,7 +835,7 @@ static irqreturn_t cxl_irq_err(int irq, void *data) ...@@ -833,7 +835,7 @@ static irqreturn_t cxl_irq_err(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
int cxl_register_psl_err_irq(struct cxl *adapter) int cxl_native_register_psl_err_irq(struct cxl *adapter)
{ {
int rc; int rc;
...@@ -842,7 +844,7 @@ int cxl_register_psl_err_irq(struct cxl *adapter) ...@@ -842,7 +844,7 @@ int cxl_register_psl_err_irq(struct cxl *adapter)
if (!adapter->irq_name) if (!adapter->irq_name)
return -ENOMEM; return -ENOMEM;
if ((rc = cxl_register_one_irq(adapter, cxl_irq_err, adapter, if ((rc = cxl_register_one_irq(adapter, native_irq_err, adapter,
&adapter->err_hwirq, &adapter->err_hwirq,
&adapter->err_virq, &adapter->err_virq,
adapter->irq_name))) { adapter->irq_name))) {
...@@ -856,7 +858,7 @@ int cxl_register_psl_err_irq(struct cxl *adapter) ...@@ -856,7 +858,7 @@ int cxl_register_psl_err_irq(struct cxl *adapter)
return 0; return 0;
} }
void cxl_release_psl_err_irq(struct cxl *adapter) void cxl_native_release_psl_err_irq(struct cxl *adapter)
{ {
if (adapter->err_virq != irq_find_mapping(NULL, adapter->err_hwirq)) if (adapter->err_virq != irq_find_mapping(NULL, adapter->err_hwirq))
return; return;
...@@ -867,7 +869,7 @@ void cxl_release_psl_err_irq(struct cxl *adapter) ...@@ -867,7 +869,7 @@ void cxl_release_psl_err_irq(struct cxl *adapter)
kfree(adapter->irq_name); kfree(adapter->irq_name);
} }
int cxl_register_serr_irq(struct cxl_afu *afu) int cxl_native_register_serr_irq(struct cxl_afu *afu)
{ {
u64 serr; u64 serr;
int rc; int rc;
...@@ -877,7 +879,7 @@ int cxl_register_serr_irq(struct cxl_afu *afu) ...@@ -877,7 +879,7 @@ int cxl_register_serr_irq(struct cxl_afu *afu)
if (!afu->err_irq_name) if (!afu->err_irq_name)
return -ENOMEM; return -ENOMEM;
if ((rc = cxl_register_one_irq(afu->adapter, cxl_slice_irq_err, afu, if ((rc = cxl_register_one_irq(afu->adapter, native_slice_irq_err, afu,
&afu->serr_hwirq, &afu->serr_hwirq,
&afu->serr_virq, afu->err_irq_name))) { &afu->serr_virq, afu->err_irq_name))) {
kfree(afu->err_irq_name); kfree(afu->err_irq_name);
...@@ -892,7 +894,7 @@ int cxl_register_serr_irq(struct cxl_afu *afu) ...@@ -892,7 +894,7 @@ int cxl_register_serr_irq(struct cxl_afu *afu)
return 0; return 0;
} }
void cxl_release_serr_irq(struct cxl_afu *afu) void cxl_native_release_serr_irq(struct cxl_afu *afu)
{ {
if (afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq)) if (afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq))
return; return;
...@@ -903,7 +905,7 @@ void cxl_release_serr_irq(struct cxl_afu *afu) ...@@ -903,7 +905,7 @@ void cxl_release_serr_irq(struct cxl_afu *afu)
kfree(afu->err_irq_name); kfree(afu->err_irq_name);
} }
int cxl_register_psl_irq(struct cxl_afu *afu) int cxl_native_register_psl_irq(struct cxl_afu *afu)
{ {
int rc; int rc;
...@@ -912,7 +914,7 @@ int cxl_register_psl_irq(struct cxl_afu *afu) ...@@ -912,7 +914,7 @@ int cxl_register_psl_irq(struct cxl_afu *afu)
if (!afu->psl_irq_name) if (!afu->psl_irq_name)
return -ENOMEM; return -ENOMEM;
if ((rc = cxl_register_one_irq(afu->adapter, cxl_irq_multiplexed, afu, if ((rc = cxl_register_one_irq(afu->adapter, native_irq_multiplexed, afu,
&afu->psl_hwirq, &afu->psl_virq, &afu->psl_hwirq, &afu->psl_virq,
afu->psl_irq_name))) { afu->psl_irq_name))) {
kfree(afu->psl_irq_name); kfree(afu->psl_irq_name);
...@@ -921,7 +923,7 @@ int cxl_register_psl_irq(struct cxl_afu *afu) ...@@ -921,7 +923,7 @@ int cxl_register_psl_irq(struct cxl_afu *afu)
return rc; return rc;
} }
void cxl_release_psl_irq(struct cxl_afu *afu) void cxl_native_release_psl_irq(struct cxl_afu *afu)
{ {
if (afu->psl_virq != irq_find_mapping(NULL, afu->psl_hwirq)) if (afu->psl_virq != irq_find_mapping(NULL, afu->psl_hwirq))
return; return;
...@@ -945,7 +947,7 @@ static void recover_psl_err(struct cxl_afu *afu, u64 errstat) ...@@ -945,7 +947,7 @@ static void recover_psl_err(struct cxl_afu *afu, u64 errstat)
cxl_p2n_write(afu, CXL_PSL_ErrStat_An, errstat); cxl_p2n_write(afu, CXL_PSL_ErrStat_An, errstat);
} }
static int cxl_ack_irq(struct cxl_context *ctx, u64 tfc, u64 psl_reset_mask) static int native_ack_irq(struct cxl_context *ctx, u64 tfc, u64 psl_reset_mask)
{ {
trace_cxl_psl_irq_ack(ctx, tfc); trace_cxl_psl_irq_ack(ctx, tfc);
if (tfc) if (tfc)
...@@ -961,7 +963,7 @@ int cxl_check_error(struct cxl_afu *afu) ...@@ -961,7 +963,7 @@ int cxl_check_error(struct cxl_afu *afu)
return (cxl_p1n_read(afu, CXL_PSL_SCNTL_An) == ~0ULL); return (cxl_p1n_read(afu, CXL_PSL_SCNTL_An) == ~0ULL);
} }
static int cxl_afu_cr_read64(struct cxl_afu *afu, int cr, u64 off, u64 *out) static int native_afu_cr_read64(struct cxl_afu *afu, int cr, u64 off, u64 *out)
{ {
if (unlikely(!cxl_ops->link_ok(afu->adapter))) if (unlikely(!cxl_ops->link_ok(afu->adapter)))
return -EIO; return -EIO;
...@@ -972,7 +974,7 @@ static int cxl_afu_cr_read64(struct cxl_afu *afu, int cr, u64 off, u64 *out) ...@@ -972,7 +974,7 @@ static int cxl_afu_cr_read64(struct cxl_afu *afu, int cr, u64 off, u64 *out)
return 0; return 0;
} }
static int cxl_afu_cr_read32(struct cxl_afu *afu, int cr, u64 off, u32 *out) static int native_afu_cr_read32(struct cxl_afu *afu, int cr, u64 off, u32 *out)
{ {
if (unlikely(!cxl_ops->link_ok(afu->adapter))) if (unlikely(!cxl_ops->link_ok(afu->adapter)))
return -EIO; return -EIO;
...@@ -983,25 +985,25 @@ static int cxl_afu_cr_read32(struct cxl_afu *afu, int cr, u64 off, u32 *out) ...@@ -983,25 +985,25 @@ static int cxl_afu_cr_read32(struct cxl_afu *afu, int cr, u64 off, u32 *out)
return 0; return 0;
} }
static int cxl_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off, u16 *out) static int native_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off, u16 *out)
{ {
u64 aligned_off = off & ~0x3L; u64 aligned_off = off & ~0x3L;
u32 val; u32 val;
int rc; int rc;
rc = cxl_afu_cr_read32(afu, cr, aligned_off, &val); rc = native_afu_cr_read32(afu, cr, aligned_off, &val);
if (!rc) if (!rc)
*out = (val >> ((off & 0x3) * 8)) & 0xffff; *out = (val >> ((off & 0x3) * 8)) & 0xffff;
return rc; return rc;
} }
static int cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off, u8 *out) static int native_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off, u8 *out)
{ {
u64 aligned_off = off & ~0x3L; u64 aligned_off = off & ~0x3L;
u32 val; u32 val;
int rc; int rc;
rc = cxl_afu_cr_read32(afu, cr, aligned_off, &val); rc = native_afu_cr_read32(afu, cr, aligned_off, &val);
if (!rc) if (!rc)
*out = (val >> ((off & 0x3) * 8)) & 0xff; *out = (val >> ((off & 0x3) * 8)) & 0xff;
return rc; return rc;
...@@ -1009,26 +1011,26 @@ static int cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off, u8 *out) ...@@ -1009,26 +1011,26 @@ static int cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off, u8 *out)
const struct cxl_backend_ops cxl_native_ops = { const struct cxl_backend_ops cxl_native_ops = {
.module = THIS_MODULE, .module = THIS_MODULE,
.adapter_reset = cxl_reset, .adapter_reset = cxl_pci_reset,
.alloc_one_irq = cxl_alloc_one_irq, .alloc_one_irq = cxl_pci_alloc_one_irq,
.release_one_irq = cxl_release_one_irq, .release_one_irq = cxl_pci_release_one_irq,
.alloc_irq_ranges = cxl_alloc_irq_ranges, .alloc_irq_ranges = cxl_pci_alloc_irq_ranges,
.release_irq_ranges = cxl_release_irq_ranges, .release_irq_ranges = cxl_pci_release_irq_ranges,
.setup_irq = cxl_setup_irq, .setup_irq = cxl_pci_setup_irq,
.handle_psl_slice_error = handle_psl_slice_error, .handle_psl_slice_error = native_handle_psl_slice_error,
.psl_interrupt = NULL, .psl_interrupt = NULL,
.ack_irq = cxl_ack_irq, .ack_irq = native_ack_irq,
.attach_process = cxl_attach_process, .attach_process = native_attach_process,
.detach_process = cxl_detach_process, .detach_process = native_detach_process,
.link_ok = cxl_adapter_link_ok, .link_ok = cxl_adapter_link_ok,
.release_afu = cxl_release_afu, .release_afu = cxl_pci_release_afu,
.afu_read_err_buffer = cxl_afu_read_err_buffer, .afu_read_err_buffer = cxl_pci_afu_read_err_buffer,
.afu_check_and_enable = cxl_afu_check_and_enable, .afu_check_and_enable = native_afu_check_and_enable,
.afu_activate_mode = cxl_afu_activate_mode, .afu_activate_mode = native_afu_activate_mode,
.afu_deactivate_mode = cxl_afu_deactivate_mode, .afu_deactivate_mode = native_afu_deactivate_mode,
.afu_reset = __cxl_afu_reset, .afu_reset = native_afu_reset,
.afu_cr_read8 = cxl_afu_cr_read8, .afu_cr_read8 = native_afu_cr_read8,
.afu_cr_read16 = cxl_afu_cr_read16, .afu_cr_read16 = native_afu_cr_read16,
.afu_cr_read32 = cxl_afu_cr_read32, .afu_cr_read32 = native_afu_cr_read32,
.afu_cr_read64 = cxl_afu_cr_read64, .afu_cr_read64 = native_afu_cr_read64,
}; };
...@@ -415,7 +415,7 @@ static int init_implementation_afu_regs(struct cxl_afu *afu) ...@@ -415,7 +415,7 @@ static int init_implementation_afu_regs(struct cxl_afu *afu)
return 0; return 0;
} }
int cxl_setup_irq(struct cxl *adapter, unsigned int hwirq, int cxl_pci_setup_irq(struct cxl *adapter, unsigned int hwirq,
unsigned int virq) unsigned int virq)
{ {
struct pci_dev *dev = to_pci_dev(adapter->dev.parent); struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
...@@ -458,28 +458,30 @@ int cxl_update_image_control(struct cxl *adapter) ...@@ -458,28 +458,30 @@ int cxl_update_image_control(struct cxl *adapter)
return 0; return 0;
} }
int cxl_alloc_one_irq(struct cxl *adapter) int cxl_pci_alloc_one_irq(struct cxl *adapter)
{ {
struct pci_dev *dev = to_pci_dev(adapter->dev.parent); struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
return pnv_cxl_alloc_hwirqs(dev, 1); return pnv_cxl_alloc_hwirqs(dev, 1);
} }
void cxl_release_one_irq(struct cxl *adapter, int hwirq) void cxl_pci_release_one_irq(struct cxl *adapter, int hwirq)
{ {
struct pci_dev *dev = to_pci_dev(adapter->dev.parent); struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
return pnv_cxl_release_hwirqs(dev, hwirq, 1); return pnv_cxl_release_hwirqs(dev, hwirq, 1);
} }
int cxl_alloc_irq_ranges(struct cxl_irq_ranges *irqs, struct cxl *adapter, unsigned int num) int cxl_pci_alloc_irq_ranges(struct cxl_irq_ranges *irqs,
struct cxl *adapter, unsigned int num)
{ {
struct pci_dev *dev = to_pci_dev(adapter->dev.parent); struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
return pnv_cxl_alloc_hwirq_ranges(irqs, dev, num); return pnv_cxl_alloc_hwirq_ranges(irqs, dev, num);
} }
void cxl_release_irq_ranges(struct cxl_irq_ranges *irqs, struct cxl *adapter) void cxl_pci_release_irq_ranges(struct cxl_irq_ranges *irqs,
struct cxl *adapter)
{ {
struct pci_dev *dev = to_pci_dev(adapter->dev.parent); struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
...@@ -540,7 +542,7 @@ static int switch_card_to_cxl(struct pci_dev *dev) ...@@ -540,7 +542,7 @@ static int switch_card_to_cxl(struct pci_dev *dev)
return 0; return 0;
} }
static int cxl_map_slice_regs(struct cxl_afu *afu, struct cxl *adapter, struct pci_dev *dev) static int pci_map_slice_regs(struct cxl_afu *afu, struct cxl *adapter, struct pci_dev *dev)
{ {
u64 p1n_base, p2n_base, afu_desc; u64 p1n_base, p2n_base, afu_desc;
const u64 p1n_size = 0x100; const u64 p1n_size = 0x100;
...@@ -570,7 +572,7 @@ static int cxl_map_slice_regs(struct cxl_afu *afu, struct cxl *adapter, struct p ...@@ -570,7 +572,7 @@ static int cxl_map_slice_regs(struct cxl_afu *afu, struct cxl *adapter, struct p
return -ENOMEM; return -ENOMEM;
} }
static void cxl_unmap_slice_regs(struct cxl_afu *afu) static void pci_unmap_slice_regs(struct cxl_afu *afu)
{ {
if (afu->p2n_mmio) { if (afu->p2n_mmio) {
iounmap(afu->p2n_mmio); iounmap(afu->p2n_mmio);
...@@ -586,11 +588,11 @@ static void cxl_unmap_slice_regs(struct cxl_afu *afu) ...@@ -586,11 +588,11 @@ static void cxl_unmap_slice_regs(struct cxl_afu *afu)
} }
} }
void cxl_release_afu(struct device *dev) void cxl_pci_release_afu(struct device *dev)
{ {
struct cxl_afu *afu = to_cxl_afu(dev); struct cxl_afu *afu = to_cxl_afu(dev);
pr_devel("cxl_release_afu\n"); pr_devel("%s\n", __func__);
idr_destroy(&afu->contexts_idr); idr_destroy(&afu->contexts_idr);
cxl_release_spa(afu); cxl_release_spa(afu);
...@@ -729,7 +731,7 @@ static int sanitise_afu_regs(struct cxl_afu *afu) ...@@ -729,7 +731,7 @@ static int sanitise_afu_regs(struct cxl_afu *afu)
* 4/8 bytes aligned access. So in case the requested offset/count arent 8 byte * 4/8 bytes aligned access. So in case the requested offset/count arent 8 byte
* aligned the function uses a bounce buffer which can be max PAGE_SIZE. * aligned the function uses a bounce buffer which can be max PAGE_SIZE.
*/ */
ssize_t cxl_afu_read_err_buffer(struct cxl_afu *afu, char *buf, ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
loff_t off, size_t count) loff_t off, size_t count)
{ {
loff_t aligned_start, aligned_end; loff_t aligned_start, aligned_end;
...@@ -766,11 +768,11 @@ ssize_t cxl_afu_read_err_buffer(struct cxl_afu *afu, char *buf, ...@@ -766,11 +768,11 @@ ssize_t cxl_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
return count; return count;
} }
static int cxl_configure_afu(struct cxl_afu *afu, struct cxl *adapter, struct pci_dev *dev) static int pci_configure_afu(struct cxl_afu *afu, struct cxl *adapter, struct pci_dev *dev)
{ {
int rc; int rc;
if ((rc = cxl_map_slice_regs(afu, adapter, dev))) if ((rc = pci_map_slice_regs(afu, adapter, dev)))
return rc; return rc;
if ((rc = sanitise_afu_regs(afu))) if ((rc = sanitise_afu_regs(afu)))
...@@ -792,29 +794,29 @@ static int cxl_configure_afu(struct cxl_afu *afu, struct cxl *adapter, struct pc ...@@ -792,29 +794,29 @@ static int cxl_configure_afu(struct cxl_afu *afu, struct cxl *adapter, struct pc
if ((rc = init_implementation_afu_regs(afu))) if ((rc = init_implementation_afu_regs(afu)))
goto err1; goto err1;
if ((rc = cxl_register_serr_irq(afu))) if ((rc = cxl_native_register_serr_irq(afu)))
goto err1; goto err1;
if ((rc = cxl_register_psl_irq(afu))) if ((rc = cxl_native_register_psl_irq(afu)))
goto err2; goto err2;
return 0; return 0;
err2: err2:
cxl_release_serr_irq(afu); cxl_native_release_serr_irq(afu);
err1: err1:
cxl_unmap_slice_regs(afu); pci_unmap_slice_regs(afu);
return rc; return rc;
} }
static void cxl_deconfigure_afu(struct cxl_afu *afu) static void pci_deconfigure_afu(struct cxl_afu *afu)
{ {
cxl_release_psl_irq(afu); cxl_native_release_psl_irq(afu);
cxl_release_serr_irq(afu); cxl_native_release_serr_irq(afu);
cxl_unmap_slice_regs(afu); pci_unmap_slice_regs(afu);
} }
static int cxl_init_afu(struct cxl *adapter, int slice, struct pci_dev *dev) static int pci_init_afu(struct cxl *adapter, int slice, struct pci_dev *dev)
{ {
struct cxl_afu *afu; struct cxl_afu *afu;
int rc; int rc;
...@@ -827,7 +829,7 @@ static int cxl_init_afu(struct cxl *adapter, int slice, struct pci_dev *dev) ...@@ -827,7 +829,7 @@ static int cxl_init_afu(struct cxl *adapter, int slice, struct pci_dev *dev)
if (rc) if (rc)
goto err_free; goto err_free;
rc = cxl_configure_afu(afu, adapter, dev); rc = pci_configure_afu(afu, adapter, dev);
if (rc) if (rc)
goto err_free; goto err_free;
...@@ -852,7 +854,7 @@ static int cxl_init_afu(struct cxl *adapter, int slice, struct pci_dev *dev) ...@@ -852,7 +854,7 @@ static int cxl_init_afu(struct cxl *adapter, int slice, struct pci_dev *dev)
return 0; return 0;
err_put1: err_put1:
cxl_deconfigure_afu(afu); pci_deconfigure_afu(afu);
cxl_debugfs_afu_remove(afu); cxl_debugfs_afu_remove(afu);
device_unregister(&afu->dev); device_unregister(&afu->dev);
return rc; return rc;
...@@ -863,9 +865,9 @@ static int cxl_init_afu(struct cxl *adapter, int slice, struct pci_dev *dev) ...@@ -863,9 +865,9 @@ static int cxl_init_afu(struct cxl *adapter, int slice, struct pci_dev *dev)
} }
static void cxl_remove_afu(struct cxl_afu *afu) static void cxl_pci_remove_afu(struct cxl_afu *afu)
{ {
pr_devel("cxl_remove_afu\n"); pr_devel("%s\n", __func__);
if (!afu) if (!afu)
return; return;
...@@ -880,11 +882,11 @@ static void cxl_remove_afu(struct cxl_afu *afu) ...@@ -880,11 +882,11 @@ static void cxl_remove_afu(struct cxl_afu *afu)
cxl_context_detach_all(afu); cxl_context_detach_all(afu);
cxl_ops->afu_deactivate_mode(afu, afu->current_mode); cxl_ops->afu_deactivate_mode(afu, afu->current_mode);
cxl_deconfigure_afu(afu); pci_deconfigure_afu(afu);
device_unregister(&afu->dev); device_unregister(&afu->dev);
} }
int cxl_reset(struct cxl *adapter) int cxl_pci_reset(struct cxl *adapter)
{ {
struct pci_dev *dev = to_pci_dev(adapter->dev.parent); struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
int rc; int rc;
...@@ -1130,7 +1132,7 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev) ...@@ -1130,7 +1132,7 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev)
if ((rc = cxl_setup_psl_timebase(adapter, dev))) if ((rc = cxl_setup_psl_timebase(adapter, dev)))
goto err; goto err;
if ((rc = cxl_register_psl_err_irq(adapter))) if ((rc = cxl_native_register_psl_err_irq(adapter)))
goto err; goto err;
return 0; return 0;
...@@ -1145,13 +1147,13 @@ static void cxl_deconfigure_adapter(struct cxl *adapter) ...@@ -1145,13 +1147,13 @@ static void cxl_deconfigure_adapter(struct cxl *adapter)
{ {
struct pci_dev *pdev = to_pci_dev(adapter->dev.parent); struct pci_dev *pdev = to_pci_dev(adapter->dev.parent);
cxl_release_psl_err_irq(adapter); cxl_native_release_psl_err_irq(adapter);
cxl_unmap_adapter_regs(adapter); cxl_unmap_adapter_regs(adapter);
pci_disable_device(pdev); pci_disable_device(pdev);
} }
static struct cxl *cxl_init_adapter(struct pci_dev *dev) static struct cxl *cxl_pci_init_adapter(struct pci_dev *dev)
{ {
struct cxl *adapter; struct cxl *adapter;
int rc; int rc;
...@@ -1198,7 +1200,7 @@ static struct cxl *cxl_init_adapter(struct pci_dev *dev) ...@@ -1198,7 +1200,7 @@ static struct cxl *cxl_init_adapter(struct pci_dev *dev)
return ERR_PTR(rc); return ERR_PTR(rc);
} }
static void cxl_remove_adapter(struct cxl *adapter) static void cxl_pci_remove_adapter(struct cxl *adapter)
{ {
pr_devel("cxl_remove_adapter\n"); pr_devel("cxl_remove_adapter\n");
...@@ -1219,14 +1221,14 @@ static int cxl_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -1219,14 +1221,14 @@ static int cxl_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (cxl_verbose) if (cxl_verbose)
dump_cxl_config_space(dev); dump_cxl_config_space(dev);
adapter = cxl_init_adapter(dev); adapter = cxl_pci_init_adapter(dev);
if (IS_ERR(adapter)) { if (IS_ERR(adapter)) {
dev_err(&dev->dev, "cxl_init_adapter failed: %li\n", PTR_ERR(adapter)); dev_err(&dev->dev, "cxl_init_adapter failed: %li\n", PTR_ERR(adapter));
return PTR_ERR(adapter); return PTR_ERR(adapter);
} }
for (slice = 0; slice < adapter->slices; slice++) { for (slice = 0; slice < adapter->slices; slice++) {
if ((rc = cxl_init_afu(adapter, slice, dev))) { if ((rc = pci_init_afu(adapter, slice, dev))) {
dev_err(&dev->dev, "AFU %i failed to initialise: %i\n", slice, rc); dev_err(&dev->dev, "AFU %i failed to initialise: %i\n", slice, rc);
continue; continue;
} }
...@@ -1252,9 +1254,9 @@ static void cxl_remove(struct pci_dev *dev) ...@@ -1252,9 +1254,9 @@ static void cxl_remove(struct pci_dev *dev)
for (i = 0; i < adapter->slices; i++) { for (i = 0; i < adapter->slices; i++) {
afu = adapter->afu[i]; afu = adapter->afu[i];
cxl_pci_vphb_remove(afu); cxl_pci_vphb_remove(afu);
cxl_remove_afu(afu); cxl_pci_remove_afu(afu);
} }
cxl_remove_adapter(adapter); cxl_pci_remove_adapter(adapter);
} }
static pci_ers_result_t cxl_vphb_error_detected(struct cxl_afu *afu, static pci_ers_result_t cxl_vphb_error_detected(struct cxl_afu *afu,
...@@ -1401,7 +1403,7 @@ static pci_ers_result_t cxl_pci_error_detected(struct pci_dev *pdev, ...@@ -1401,7 +1403,7 @@ static pci_ers_result_t cxl_pci_error_detected(struct pci_dev *pdev,
cxl_context_detach_all(afu); cxl_context_detach_all(afu);
cxl_ops->afu_deactivate_mode(afu, afu->current_mode); cxl_ops->afu_deactivate_mode(afu, afu->current_mode);
cxl_deconfigure_afu(afu); pci_deconfigure_afu(afu);
} }
cxl_deconfigure_adapter(adapter); cxl_deconfigure_adapter(adapter);
...@@ -1424,7 +1426,7 @@ static pci_ers_result_t cxl_pci_slot_reset(struct pci_dev *pdev) ...@@ -1424,7 +1426,7 @@ static pci_ers_result_t cxl_pci_slot_reset(struct pci_dev *pdev)
for (i = 0; i < adapter->slices; i++) { for (i = 0; i < adapter->slices; i++) {
afu = adapter->afu[i]; afu = adapter->afu[i];
if (cxl_configure_afu(afu, adapter, pdev)) if (pci_configure_afu(afu, adapter, pdev))
goto err; goto err;
if (cxl_afu_select_best_mode(afu)) if (cxl_afu_select_best_mode(afu))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment