aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Lombard <clombard@linux.vnet.ibm.com>2017-09-08 09:52:11 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2017-10-06 05:52:43 -0400
commit5632874311dbf432c698fcbe0cf7a49e01ebf324 (patch)
tree96c7cc161ab97e3c4ffca3ab7df108291ab85487
parent4ca360f3dbf2036d964cdf3a6c4a45a81fdf8e18 (diff)
cxl: Add support for POWER9 DD2
The PSL initialization sequence has been updated to DD2. This patch adapts to the changes, retaining compatibility with DD1. The patch includes some changes to DD1 fix-ups as well. Tests performed on some of the old/new hardware. The function is_page_fault(), for POWER9, lists the Translation Checkout Responses where the page fault will be handled by copro_handle_mm_fault(). This list is too restrictive and not necessary. This patches removes this restriction and all page faults, whatever the reason, will be handled. In this case, the interruption is always acknowledged. The following features will be added soon: - phb reset when switching to capi mode. - cxllib update to support new functions. Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com> Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Reviewed-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--drivers/misc/cxl/cxl.h2
-rw-r--r--drivers/misc/cxl/fault.c15
-rw-r--r--drivers/misc/cxl/pci.c47
3 files changed, 28 insertions, 36 deletions
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index b1afeccbb97f..0167df81df62 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -100,6 +100,8 @@ static const cxl_p1_reg_t CXL_XSL_FEC = {0x0158};
100static const cxl_p1_reg_t CXL_XSL_DSNCTL = {0x0168}; 100static const cxl_p1_reg_t CXL_XSL_DSNCTL = {0x0168};
101/* PSL registers - CAIA 2 */ 101/* PSL registers - CAIA 2 */
102static const cxl_p1_reg_t CXL_PSL9_CONTROL = {0x0020}; 102static const cxl_p1_reg_t CXL_PSL9_CONTROL = {0x0020};
103static const cxl_p1_reg_t CXL_XSL9_INV = {0x0110};
104static const cxl_p1_reg_t CXL_XSL9_DEF = {0x0140};
103static const cxl_p1_reg_t CXL_XSL9_DSNCTL = {0x0168}; 105static const cxl_p1_reg_t CXL_XSL9_DSNCTL = {0x0168};
104static const cxl_p1_reg_t CXL_PSL9_FIR1 = {0x0300}; 106static const cxl_p1_reg_t CXL_PSL9_FIR1 = {0x0300};
105static const cxl_p1_reg_t CXL_PSL9_FIR2 = {0x0308}; 107static const cxl_p1_reg_t CXL_PSL9_FIR2 = {0x0308};
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index f17f72ea0545..70dbb6de102c 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -220,22 +220,11 @@ static bool cxl_is_segment_miss(struct cxl_context *ctx, u64 dsisr)
220 220
221static bool cxl_is_page_fault(struct cxl_context *ctx, u64 dsisr) 221static bool cxl_is_page_fault(struct cxl_context *ctx, u64 dsisr)
222{ 222{
223 u64 crs; /* Translation Checkout Response Status */
224
225 if ((cxl_is_power8()) && (dsisr & CXL_PSL_DSISR_An_DM)) 223 if ((cxl_is_power8()) && (dsisr & CXL_PSL_DSISR_An_DM))
226 return true; 224 return true;
227 225
228 if (cxl_is_power9()) { 226 if (cxl_is_power9())
229 crs = (dsisr & CXL_PSL9_DSISR_An_CO_MASK); 227 return true;
230 if ((crs == CXL_PSL9_DSISR_An_PF_SLR) ||
231 (crs == CXL_PSL9_DSISR_An_PF_RGC) ||
232 (crs == CXL_PSL9_DSISR_An_PF_RGP) ||
233 (crs == CXL_PSL9_DSISR_An_PF_HRH) ||
234 (crs == CXL_PSL9_DSISR_An_PF_STEG) ||
235 (crs == CXL_PSL9_DSISR_An_URTCH)) {
236 return true;
237 }
238 }
239 228
240 return false; 229 return false;
241} 230}
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 3ba04f371380..b4ce9ea113a9 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -401,7 +401,8 @@ int cxl_calc_capp_routing(struct pci_dev *dev, u64 *chipid,
401 *capp_unit_id = get_capp_unit_id(np, *phb_index); 401 *capp_unit_id = get_capp_unit_id(np, *phb_index);
402 of_node_put(np); 402 of_node_put(np);
403 if (!*capp_unit_id) { 403 if (!*capp_unit_id) {
404 pr_err("cxl: invalid capp unit id\n"); 404 pr_err("cxl: invalid capp unit id (phb_index: %d)\n",
405 *phb_index);
405 return -ENODEV; 406 return -ENODEV;
406 } 407 }
407 408
@@ -475,37 +476,37 @@ static int init_implementation_adapter_regs_psl9(struct cxl *adapter,
475 psl_fircntl |= 0x1ULL; /* ce_thresh */ 476 psl_fircntl |= 0x1ULL; /* ce_thresh */
476 cxl_p1_write(adapter, CXL_PSL9_FIR_CNTL, psl_fircntl); 477 cxl_p1_write(adapter, CXL_PSL9_FIR_CNTL, psl_fircntl);
477 478
478 /* vccredits=0x1 pcklat=0x4 */ 479 /* Setup the PSL to transmit packets on the PCIe before the
479 cxl_p1_write(adapter, CXL_PSL9_DSNDCTL, 0x0000000000001810ULL); 480 * CAPP is enabled
480
481 /*
482 * For debugging with trace arrays.
483 * Configure RX trace 0 segmented mode.
484 * Configure CT trace 0 segmented mode.
485 * Configure LA0 trace 0 segmented mode.
486 * Configure LA1 trace 0 segmented mode.
487 */ 481 */
488 cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8040800080000000ULL); 482 cxl_p1_write(adapter, CXL_PSL9_DSNDCTL, 0x0001001000002A10ULL);
489 cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8040800080000003ULL);
490 cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8040800080000005ULL);
491 cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8040800080000006ULL);
492 483
493 /* 484 /*
494 * A response to an ASB_Notify request is returned by the 485 * A response to an ASB_Notify request is returned by the
495 * system as an MMIO write to the address defined in 486 * system as an MMIO write to the address defined in
496 * the PSL_TNR_ADDR register 487 * the PSL_TNR_ADDR register.
488 * keep the Reset Value: 0x00020000E0000000
497 */ 489 */
498 /* PSL_TNR_ADDR */
499 490
500 /* NORST */ 491 /* Enable XSL rty limit */
501 cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0x8000000000000000ULL); 492 cxl_p1_write(adapter, CXL_XSL9_DEF, 0x51F8000000000005ULL);
493
494 /* Change XSL_INV dummy read threshold */
495 cxl_p1_write(adapter, CXL_XSL9_INV, 0x0000040007FFC200ULL);
496
497 if (phb_index == 3) {
498 /* disable machines 31-47 and 20-27 for DMA */
499 cxl_p1_write(adapter, CXL_PSL9_APCDEDTYPE, 0x40000FF3FFFF0000ULL);
500 }
502 501
503 /* allocate the apc machines */ 502 /* Snoop machines */
504 cxl_p1_write(adapter, CXL_PSL9_APCDEDTYPE, 0x40000003FFFF0000ULL); 503 cxl_p1_write(adapter, CXL_PSL9_APCDEDALLOC, 0x800F000200000000ULL);
505 504
506 /* Disable vc dd1 fix */ 505 if (cxl_is_power9_dd1()) {
507 if (cxl_is_power9_dd1()) 506 /* Disabling deadlock counter CAR */
508 cxl_p1_write(adapter, CXL_PSL9_GP_CT, 0x0400000000000001ULL); 507 cxl_p1_write(adapter, CXL_PSL9_GP_CT, 0x0020000000000001ULL);
508 } else
509 cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0x4000000000000000ULL);
509 510
510 return 0; 511 return 0;
511} 512}