aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl/pci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-16 15:47:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-16 15:47:46 -0500
commit5b0e2cb020085efe202123162502e0b551e49a0e (patch)
tree534bbb4c9f98c2ed9a520e11107029e5df38c3c2 /drivers/misc/cxl/pci.c
parent758f875848d78148cf9a9cdb3ff1ddf29b234056 (diff)
parent3ffa9d9e2a7c10127d8cbf91ea2be15390b450ed (diff)
Merge tag 'powerpc-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman: "A bit of a small release, I suspect in part due to me travelling for KS. But my backlog of patches to review is smaller than usual, so I think in part folks just didn't send as much this cycle. Non-highlights: - Five fixes for the >128T address space handling, both to fix bugs in our implementation and to bring the semantics exactly into line with x86. Highlights: - Support for a new OPAL call on bare metal machines which gives us a true NMI (ie. is not masked by MSR[EE]=0) for debugging etc. - Support for Power9 DD2 in the CXL driver. - Improvements to machine check handling so that uncorrectable errors can be reported into the generic memory_failure() machinery. - Some fixes and improvements for VPHN, which is used under PowerVM to notify the Linux partition of topology changes. - Plumbing to enable TM (transactional memory) without suspend on some Power9 processors (PPC_FEATURE2_HTM_NO_SUSPEND). - Support for emulating vector loads form cache-inhibited memory, on some Power9 revisions. - Disable the fast-endian switch "syscall" by default (behind a CONFIG), we believe it has never had any users. - A major rework of the API drivers use when initiating and waiting for long running operations performed by OPAL firmware, and changes to the powernv_flash driver to use the new API. - Several fixes for the handling of FP/VMX/VSX while processes are using transactional memory. - Optimisations of TLB range flushes when using the radix MMU on Power9. - Improvements to the VAS facility used to access coprocessors on Power9, and related improvements to the way the NX crypto driver handles requests. - Implementation of PMEM_API and UACCESS_FLUSHCACHE for 64-bit. Thanks to: Alexey Kardashevskiy, Alistair Popple, Allen Pais, Andrew Donnellan, Aneesh Kumar K.V, Arnd Bergmann, Balbir Singh, Benjamin Herrenschmidt, Breno Leitao, Christophe Leroy, Christophe Lombard, Cyril Bur, Frederic Barrat, Gautham R. Shenoy, Geert Uytterhoeven, Guilherme G. Piccoli, Gustavo Romero, Haren Myneni, Joel Stanley, Kamalesh Babulal, Kautuk Consul, Markus Elfring, Masami Hiramatsu, Michael Bringmann, Michael Neuling, Michal Suchanek, Naveen N. Rao, Nicholas Piggin, Oliver O'Halloran, Paul Mackerras, Pedro Miraglia Franco de Carvalho, Philippe Bergheaud, Sandipan Das, Seth Forshee, Shriya, Stephen Rothwell, Stewart Smith, Sukadev Bhattiprolu, Tyrel Datwyler, Vaibhav Jain, Vaidyanathan Srinivasan, and William A. Kennington III" * tag 'powerpc-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (151 commits) powerpc/64s: Fix Power9 DD2.0 workarounds by adding DD2.1 feature powerpc/64s: Fix masking of SRR1 bits on instruction fault powerpc/64s: mm_context.addr_limit is only used on hash powerpc/64s/radix: Fix 128TB-512TB virtual address boundary case allocation powerpc/64s/hash: Allow MAP_FIXED allocations to cross 128TB boundary powerpc/64s/hash: Fix fork() with 512TB process address space powerpc/64s/hash: Fix 128TB-512TB virtual address boundary case allocation powerpc/64s/hash: Fix 512T hint detection to use >= 128T powerpc: Fix DABR match on hash based systems powerpc/signal: Properly handle return value from uprobe_deny_signal() powerpc/fadump: use kstrtoint to handle sysfs store powerpc/lib: Implement UACCESS_FLUSHCACHE API powerpc/lib: Implement PMEM API powerpc/powernv/npu: Don't explicitly flush nmmu tlb powerpc/powernv/npu: Use flush_all_mm() instead of flush_tlb_mm() powerpc/powernv/idle: Round up latency and residency values powerpc/kprobes: refactor kprobe_lookup_name for safer string operations powerpc/kprobes: Blacklist emulate_update_regs() from kprobes powerpc/kprobes: Do not disable interrupts for optprobes and kprobes_on_ftrace powerpc/kprobes: Disable preemption before invoking probe handler for optprobes ...
Diffstat (limited to 'drivers/misc/cxl/pci.c')
-rw-r--r--drivers/misc/cxl/pci.c88
1 files changed, 64 insertions, 24 deletions
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 3ba04f371380..bb7fd3f4edab 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}
@@ -1746,6 +1747,44 @@ static void cxl_deconfigure_adapter(struct cxl *adapter)
1746 pci_disable_device(pdev); 1747 pci_disable_device(pdev);
1747} 1748}
1748 1749
1750static void cxl_stop_trace_psl9(struct cxl *adapter)
1751{
1752 int traceid;
1753 u64 trace_state, trace_mask;
1754 struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
1755
1756 /* read each tracearray state and issue mmio to stop them is needed */
1757 for (traceid = 0; traceid <= CXL_PSL9_TRACEID_MAX; ++traceid) {
1758 trace_state = cxl_p1_read(adapter, CXL_PSL9_CTCCFG);
1759 trace_mask = (0x3ULL << (62 - traceid * 2));
1760 trace_state = (trace_state & trace_mask) >> (62 - traceid * 2);
1761 dev_dbg(&dev->dev, "cxl: Traceid-%d trace_state=0x%0llX\n",
1762 traceid, trace_state);
1763
1764 /* issue mmio if the trace array isn't in FIN state */
1765 if (trace_state != CXL_PSL9_TRACESTATE_FIN)
1766 cxl_p1_write(adapter, CXL_PSL9_TRACECFG,
1767 0x8400000000000000ULL | traceid);
1768 }
1769}
1770
1771static void cxl_stop_trace_psl8(struct cxl *adapter)
1772{
1773 int slice;
1774
1775 /* Stop the trace */
1776 cxl_p1_write(adapter, CXL_PSL_TRACE, 0x8000000000000017LL);
1777
1778 /* Stop the slice traces */
1779 spin_lock(&adapter->afu_list_lock);
1780 for (slice = 0; slice < adapter->slices; slice++) {
1781 if (adapter->afu[slice])
1782 cxl_p1n_write(adapter->afu[slice], CXL_PSL_SLICE_TRACE,
1783 0x8000000000000000LL);
1784 }
1785 spin_unlock(&adapter->afu_list_lock);
1786}
1787
1749static const struct cxl_service_layer_ops psl9_ops = { 1788static const struct cxl_service_layer_ops psl9_ops = {
1750 .adapter_regs_init = init_implementation_adapter_regs_psl9, 1789 .adapter_regs_init = init_implementation_adapter_regs_psl9,
1751 .invalidate_all = cxl_invalidate_all_psl9, 1790 .invalidate_all = cxl_invalidate_all_psl9,
@@ -1762,6 +1801,7 @@ static const struct cxl_service_layer_ops psl9_ops = {
1762 .debugfs_add_adapter_regs = cxl_debugfs_add_adapter_regs_psl9, 1801 .debugfs_add_adapter_regs = cxl_debugfs_add_adapter_regs_psl9,
1763 .debugfs_add_afu_regs = cxl_debugfs_add_afu_regs_psl9, 1802 .debugfs_add_afu_regs = cxl_debugfs_add_afu_regs_psl9,
1764 .psl_irq_dump_registers = cxl_native_irq_dump_regs_psl9, 1803 .psl_irq_dump_registers = cxl_native_irq_dump_regs_psl9,
1804 .err_irq_dump_registers = cxl_native_err_irq_dump_regs_psl9,
1765 .debugfs_stop_trace = cxl_stop_trace_psl9, 1805 .debugfs_stop_trace = cxl_stop_trace_psl9,
1766 .write_timebase_ctrl = write_timebase_ctrl_psl9, 1806 .write_timebase_ctrl = write_timebase_ctrl_psl9,
1767 .timebase_read = timebase_read_psl9, 1807 .timebase_read = timebase_read_psl9,
@@ -1785,7 +1825,7 @@ static const struct cxl_service_layer_ops psl8_ops = {
1785 .debugfs_add_adapter_regs = cxl_debugfs_add_adapter_regs_psl8, 1825 .debugfs_add_adapter_regs = cxl_debugfs_add_adapter_regs_psl8,
1786 .debugfs_add_afu_regs = cxl_debugfs_add_afu_regs_psl8, 1826 .debugfs_add_afu_regs = cxl_debugfs_add_afu_regs_psl8,
1787 .psl_irq_dump_registers = cxl_native_irq_dump_regs_psl8, 1827 .psl_irq_dump_registers = cxl_native_irq_dump_regs_psl8,
1788 .err_irq_dump_registers = cxl_native_err_irq_dump_regs, 1828 .err_irq_dump_registers = cxl_native_err_irq_dump_regs_psl8,
1789 .debugfs_stop_trace = cxl_stop_trace_psl8, 1829 .debugfs_stop_trace = cxl_stop_trace_psl8,
1790 .write_timebase_ctrl = write_timebase_ctrl_psl8, 1830 .write_timebase_ctrl = write_timebase_ctrl_psl8,
1791 .timebase_read = timebase_read_psl8, 1831 .timebase_read = timebase_read_psl8,