Skip to content

Commit ae5f531

Browse files
committed
Merge tag 'ntb-5.17-bugfixes' of git://github.com/jonmason/ntb
Pull NTB fixes from Jon Mason: "Bug fixes for sparse warning, intel port config offset, and a new mailing list" * tag 'ntb-5.17-bugfixes' of git://github.com/jonmason/ntb: MAINTAINERS: update mailing list address for NTB subsystem ntb: intel: fix port config status offset for SPR NTB/msi: Use struct_size() helper in devm_kzalloc()
2 parents fb184c4 + 9b81863 commit ae5f531

File tree

4 files changed

+38
-9
lines changed

4 files changed

+38
-9
lines changed

MAINTAINERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13699,15 +13699,15 @@ F: scripts/nsdeps
1369913699
NTB AMD DRIVER
1370013700
M: Sanjay R Mehta <[email protected]>
1370113701
M: Shyam Sundar S K <[email protected]>
13702-
L: linux-ntb@googlegroups.com
13702+
L: ntb@lists.linux.dev
1370313703
S: Supported
1370413704
F: drivers/ntb/hw/amd/
1370513705

1370613706
NTB DRIVER CORE
1370713707
M: Jon Mason <[email protected]>
1370813708
M: Dave Jiang <[email protected]>
1370913709
M: Allen Hubbe <[email protected]>
13710-
L: linux-ntb@googlegroups.com
13710+
L: ntb@lists.linux.dev
1371113711
S: Supported
1371213712
W: https://github.com/jonmason/ntb/wiki
1371313713
T: git git://github.com/jonmason/ntb.git
@@ -13719,13 +13719,13 @@ F: tools/testing/selftests/ntb/
1371913719

1372013720
NTB IDT DRIVER
1372113721
M: Serge Semin <[email protected]>
13722-
L: linux-ntb@googlegroups.com
13722+
L: ntb@lists.linux.dev
1372313723
S: Supported
1372413724
F: drivers/ntb/hw/idt/
1372513725

1372613726
NTB INTEL DRIVER
1372713727
M: Dave Jiang <[email protected]>
13728-
L: linux-ntb@googlegroups.com
13728+
L: ntb@lists.linux.dev
1372913729
S: Supported
1373013730
W: https://github.com/davejiang/linux/wiki
1373113731
T: git https://github.com/davejiang/linux.git

drivers/ntb/hw/intel/ntb_hw_gen4.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ static enum ntb_topo gen4_ppd_topo(struct intel_ntb_dev *ndev, u32 ppd)
168168
return NTB_TOPO_NONE;
169169
}
170170

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+
171183
int gen4_init_dev(struct intel_ntb_dev *ndev)
172184
{
173185
struct pci_dev *pdev = ndev->ntb.pdev;
@@ -183,7 +195,10 @@ int gen4_init_dev(struct intel_ntb_dev *ndev)
183195
}
184196

185197
ppd1 = ioread32(ndev->self_mmio + GEN4_PPD1_OFFSET);
186-
ndev->ntb.topo = gen4_ppd_topo(ndev, ppd1);
198+
if (pdev_is_ICX(pdev))
199+
ndev->ntb.topo = gen4_ppd_topo(ndev, ppd1);
200+
else if (pdev_is_SPR(pdev))
201+
ndev->ntb.topo = spr_ppd_topo(ndev, ppd1);
187202
dev_dbg(&pdev->dev, "ppd %#x topo %s\n", ppd1,
188203
ntb_topo_string(ndev->ntb.topo));
189204
if (ndev->ntb.topo == NTB_TOPO_NONE)

drivers/ntb/hw/intel/ntb_hw_gen4.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@
4949
#define GEN4_PPD_CLEAR_TRN 0x0001
5050
#define GEN4_PPD_LINKTRN 0x0008
5151
#define GEN4_PPD_CONN_MASK 0x0300
52+
#define SPR_PPD_CONN_MASK 0x0700
5253
#define GEN4_PPD_CONN_B2B 0x0200
5354
#define GEN4_PPD_DEV_MASK 0x1000
5455
#define GEN4_PPD_DEV_DSD 0x1000
5556
#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
5660
#define GEN4_LINK_CTRL_LINK_DISABLE 0x0010
5761

5862
#define GEN4_SLOTSTS 0xb05a
@@ -62,6 +66,10 @@
6266
#define GEN4_PPD_TOPO_B2B_USD (GEN4_PPD_CONN_B2B | GEN4_PPD_DEV_USD)
6367
#define GEN4_PPD_TOPO_B2B_DSD (GEN4_PPD_CONN_B2B | GEN4_PPD_DEV_DSD)
6468

69+
#define SPR_PPD_TOPO_MASK (SPR_PPD_CONN_MASK | SPR_PPD_DEV_MASK)
70+
#define SPR_PPD_TOPO_B2B_USD (GEN4_PPD_CONN_B2B | SPR_PPD_DEV_USD)
71+
#define SPR_PPD_TOPO_B2B_DSD (GEN4_PPD_CONN_B2B | SPR_PPD_DEV_DSD)
72+
6573
#define GEN4_DB_COUNT 32
6674
#define GEN4_DB_LINK 32
6775
#define GEN4_DB_LINK_BIT BIT_ULL(GEN4_DB_LINK)
@@ -112,4 +120,12 @@ static inline int pdev_is_ICX(struct pci_dev *pdev)
112120
return 0;
113121
}
114122

123+
static inline int pdev_is_SPR(struct pci_dev *pdev)
124+
{
125+
if (pdev_is_gen4(pdev) &&
126+
pdev->revision > PCI_DEVICE_REVISION_ICX_MAX)
127+
return 1;
128+
return 0;
129+
}
130+
115131
#endif

drivers/ntb/msi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ int ntb_msi_init(struct ntb_dev *ntb,
3333
{
3434
phys_addr_t mw_phys_addr;
3535
resource_size_t mw_size;
36-
size_t struct_size;
3736
int peer_widx;
3837
int peers;
3938
int ret;
@@ -43,9 +42,8 @@ int ntb_msi_init(struct ntb_dev *ntb,
4342
if (peers <= 0)
4443
return -EINVAL;
4544

46-
struct_size = sizeof(*ntb->msi) + sizeof(*ntb->msi->peer_mws) * peers;
47-
48-
ntb->msi = devm_kzalloc(&ntb->dev, struct_size, GFP_KERNEL);
45+
ntb->msi = devm_kzalloc(&ntb->dev, struct_size(ntb->msi, peer_mws, peers),
46+
GFP_KERNEL);
4947
if (!ntb->msi)
5048
return -ENOMEM;
5149

0 commit comments

Comments
 (0)