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

ntb: intel: fix port config status offset for SPR

The field offset for port configuration status on SPR has been changed to
bit 14 from ICX where it resides at bit 12. By chance link status detection
continued to work on SPR. This is due to bit 12 being a configuration bit
which is in sync with the status bit. Fix this by checking for a SPR device
and checking correct status bit.

Fixes: 26bfe3d0b227 ("ntb: intel: Add Icelake (gen4) support for Intel NTB")
Tested-by: Jerry Dai <jerry.dai@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>

authored by

Dave Jiang and committed by
Jon Mason
d5081bf5 30532568

+32 -1
+16 -1
drivers/ntb/hw/intel/ntb_hw_gen4.c
··· 168 168 return NTB_TOPO_NONE; 169 169 } 170 170 171 + static enum ntb_topo spr_ppd_topo(struct intel_ntb_dev *ndev, u32 ppd) 172 + { 173 + switch (ppd & SPR_PPD_TOPO_MASK) { 174 + case SPR_PPD_TOPO_B2B_USD: 175 + return NTB_TOPO_B2B_USD; 176 + case SPR_PPD_TOPO_B2B_DSD: 177 + return NTB_TOPO_B2B_DSD; 178 + } 179 + 180 + return NTB_TOPO_NONE; 181 + } 182 + 171 183 int gen4_init_dev(struct intel_ntb_dev *ndev) 172 184 { 173 185 struct pci_dev *pdev = ndev->ntb.pdev; ··· 195 183 } 196 184 197 185 ppd1 = ioread32(ndev->self_mmio + GEN4_PPD1_OFFSET); 198 - ndev->ntb.topo = gen4_ppd_topo(ndev, ppd1); 186 + if (pdev_is_ICX(pdev)) 187 + ndev->ntb.topo = gen4_ppd_topo(ndev, ppd1); 188 + else if (pdev_is_SPR(pdev)) 189 + ndev->ntb.topo = spr_ppd_topo(ndev, ppd1); 199 190 dev_dbg(&pdev->dev, "ppd %#x topo %s\n", ppd1, 200 191 ntb_topo_string(ndev->ntb.topo)); 201 192 if (ndev->ntb.topo == NTB_TOPO_NONE)
+16
drivers/ntb/hw/intel/ntb_hw_gen4.h
··· 49 49 #define GEN4_PPD_CLEAR_TRN 0x0001 50 50 #define GEN4_PPD_LINKTRN 0x0008 51 51 #define GEN4_PPD_CONN_MASK 0x0300 52 + #define SPR_PPD_CONN_MASK 0x0700 52 53 #define GEN4_PPD_CONN_B2B 0x0200 53 54 #define GEN4_PPD_DEV_MASK 0x1000 54 55 #define GEN4_PPD_DEV_DSD 0x1000 55 56 #define GEN4_PPD_DEV_USD 0x0000 57 + #define SPR_PPD_DEV_MASK 0x4000 58 + #define SPR_PPD_DEV_DSD 0x4000 59 + #define SPR_PPD_DEV_USD 0x0000 56 60 #define GEN4_LINK_CTRL_LINK_DISABLE 0x0010 57 61 58 62 #define GEN4_SLOTSTS 0xb05a ··· 65 61 #define GEN4_PPD_TOPO_MASK (GEN4_PPD_CONN_MASK | GEN4_PPD_DEV_MASK) 66 62 #define GEN4_PPD_TOPO_B2B_USD (GEN4_PPD_CONN_B2B | GEN4_PPD_DEV_USD) 67 63 #define GEN4_PPD_TOPO_B2B_DSD (GEN4_PPD_CONN_B2B | GEN4_PPD_DEV_DSD) 64 + 65 + #define SPR_PPD_TOPO_MASK (SPR_PPD_CONN_MASK | SPR_PPD_DEV_MASK) 66 + #define SPR_PPD_TOPO_B2B_USD (GEN4_PPD_CONN_B2B | SPR_PPD_DEV_USD) 67 + #define SPR_PPD_TOPO_B2B_DSD (GEN4_PPD_CONN_B2B | SPR_PPD_DEV_DSD) 68 68 69 69 #define GEN4_DB_COUNT 32 70 70 #define GEN4_DB_LINK 32 ··· 116 108 if (pdev_is_gen4(pdev) && 117 109 pdev->revision >= PCI_DEVICE_REVISION_ICX_MIN && 118 110 pdev->revision <= PCI_DEVICE_REVISION_ICX_MAX) 111 + return 1; 112 + return 0; 113 + } 114 + 115 + static inline int pdev_is_SPR(struct pci_dev *pdev) 116 + { 117 + if (pdev_is_gen4(pdev) && 118 + pdev->revision > PCI_DEVICE_REVISION_ICX_MAX) 119 119 return 1; 120 120 return 0; 121 121 }