Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'ntb-5.11' of git://github.com/jonmason/ntb

Pull NTB fixes from Jon Mason:
"Bug fix for IDT NTB and Intel NTB LTR management support"

* tag 'ntb-5.11' of git://github.com/jonmason/ntb:
ntb: intel: add Intel NTB LTR vendor support for gen4 NTB
ntb: idt: fix error check in ntb_hw_idt.c

+44 -3
+2 -2
drivers/ntb/hw/idt/ntb_hw_idt.c
··· 2511 2511 /* If the top directory is not created then do nothing */ 2512 2512 if (IS_ERR_OR_NULL(dbgfs_topdir)) { 2513 2513 dev_info(&ndev->ntb.pdev->dev, "Top DebugFS directory absent"); 2514 - return PTR_ERR(dbgfs_topdir); 2514 + return PTR_ERR_OR_ZERO(dbgfs_topdir); 2515 2515 } 2516 2516 2517 2517 /* Create the info file node */ ··· 2756 2756 2757 2757 /* Allocate the memory for IDT NTB device data */ 2758 2758 ndev = idt_create_dev(pdev, id); 2759 - if (IS_ERR_OR_NULL(ndev)) 2759 + if (IS_ERR(ndev)) 2760 2760 return PTR_ERR(ndev); 2761 2761 2762 2762 /* Initialize the basic PCI subsystem of the device */
+1
drivers/ntb/hw/intel/ntb_hw_gen1.h
··· 141 141 #define NTB_HWERR_B2BDOORBELL_BIT14 BIT_ULL(2) 142 142 #define NTB_HWERR_MSIX_VECTOR32_BAD BIT_ULL(3) 143 143 #define NTB_HWERR_BAR_ALIGN BIT_ULL(4) 144 + #define NTB_HWERR_LTR_BAD BIT_ULL(5) 144 145 145 146 extern struct intel_b2b_addr xeon_b2b_usd_addr; 146 147 extern struct intel_b2b_addr xeon_b2b_dsd_addr;
+26 -1
drivers/ntb/hw/intel/ntb_hw_gen4.c
··· 177 177 178 178 ndev->reg = &gen4_reg; 179 179 180 - if (pdev_is_ICX(pdev)) 180 + if (pdev_is_ICX(pdev)) { 181 181 ndev->hwerr_flags |= NTB_HWERR_BAR_ALIGN; 182 + ndev->hwerr_flags |= NTB_HWERR_LTR_BAD; 183 + } 182 184 183 185 ppd1 = ioread32(ndev->self_mmio + GEN4_PPD1_OFFSET); 184 186 ndev->ntb.topo = gen4_ppd_topo(ndev, ppd1); ··· 433 431 dev_dbg(&ntb->pdev->dev, 434 432 "ignoring max_width %d\n", max_width); 435 433 434 + if (!(ndev->hwerr_flags & NTB_HWERR_LTR_BAD)) { 435 + u32 ltr; 436 + 437 + /* Setup active snoop LTR values */ 438 + ltr = NTB_LTR_ACTIVE_REQMNT | NTB_LTR_ACTIVE_VAL | NTB_LTR_ACTIVE_LATSCALE; 439 + /* Setup active non-snoop values */ 440 + ltr = (ltr << NTB_LTR_NS_SHIFT) | ltr; 441 + iowrite32(ltr, ndev->self_mmio + GEN4_LTR_ACTIVE_OFFSET); 442 + 443 + /* Setup idle snoop LTR values */ 444 + ltr = NTB_LTR_IDLE_VAL | NTB_LTR_IDLE_LATSCALE | NTB_LTR_IDLE_REQMNT; 445 + /* Setup idle non-snoop values */ 446 + ltr = (ltr << NTB_LTR_NS_SHIFT) | ltr; 447 + iowrite32(ltr, ndev->self_mmio + GEN4_LTR_IDLE_OFFSET); 448 + 449 + /* setup PCIe LTR to active */ 450 + iowrite8(NTB_LTR_SWSEL_ACTIVE, ndev->self_mmio + GEN4_LTR_SWSEL_OFFSET); 451 + } 452 + 436 453 ntb_ctl = NTB_CTL_E2I_BAR23_SNOOP | NTB_CTL_I2E_BAR23_SNOOP; 437 454 ntb_ctl |= NTB_CTL_E2I_BAR45_SNOOP | NTB_CTL_I2E_BAR45_SNOOP; 438 455 iowrite32(ntb_ctl, ndev->self_mmio + ndev->reg->ntb_ctl); ··· 496 475 lnkctl = ioread16(ndev->self_mmio + GEN4_LINK_CTRL_OFFSET); 497 476 lnkctl |= GEN4_LINK_CTRL_LINK_DISABLE; 498 477 iowrite16(lnkctl, ndev->self_mmio + GEN4_LINK_CTRL_OFFSET); 478 + 479 + /* set LTR to idle */ 480 + if (!(ndev->hwerr_flags & NTB_HWERR_LTR_BAD)) 481 + iowrite8(NTB_LTR_SWSEL_IDLE, ndev->self_mmio + GEN4_LTR_SWSEL_OFFSET); 499 482 500 483 ndev->dev_up = 0; 501 484
+15
drivers/ntb/hw/intel/ntb_hw_gen4.h
··· 35 35 #define GEN4_IM_SPAD_SEM_OFFSET 0x00c0 /* SPAD hw semaphore */ 36 36 #define GEN4_IM_SPAD_STICKY_OFFSET 0x00c4 /* sticky SPAD */ 37 37 #define GEN4_IM_DOORBELL_OFFSET 0x0100 /* 0-31 doorbells */ 38 + #define GEN4_LTR_SWSEL_OFFSET 0x30ec 39 + #define GEN4_LTR_ACTIVE_OFFSET 0x30f0 40 + #define GEN4_LTR_IDLE_OFFSET 0x30f4 38 41 #define GEN4_EM_SPAD_OFFSET 0x8080 39 42 /* note, link status is now in MMIO and not config space for NTB */ 40 43 #define GEN4_LINK_CTRL_OFFSET 0xb050 ··· 82 79 #define NTB_CTL_LINK_DOWN 0x010000 83 80 84 81 #define NTB_SJC_FORCEDETECT 0x000004 82 + 83 + #define NTB_LTR_SWSEL_ACTIVE 0x0 84 + #define NTB_LTR_SWSEL_IDLE 0x1 85 + 86 + #define NTB_LTR_NS_SHIFT 16 87 + #define NTB_LTR_ACTIVE_VAL 0x0000 /* 0 us */ 88 + #define NTB_LTR_ACTIVE_LATSCALE 0x0800 /* 1us scale */ 89 + #define NTB_LTR_ACTIVE_REQMNT 0x8000 /* snoop req enable */ 90 + 91 + #define NTB_LTR_IDLE_VAL 0x0258 /* 600 us */ 92 + #define NTB_LTR_IDLE_LATSCALE 0x0800 /* 1us scale */ 93 + #define NTB_LTR_IDLE_REQMNT 0x8000 /* snoop req enable */ 85 94 86 95 ssize_t ndev_ntb4_debugfs_read(struct file *filp, char __user *ubuf, 87 96 size_t count, loff_t *offp);