Skip to content

Commit a52a3c1

Browse files
committed
Merge tag 'ntb-6.15' of https://github.com/jonmason/ntb
Pull ntb fixes from Jon Mason: "Bug fixes for NTB Switchtec driver mw negative shift, Intel NTB link status db, ntb_perf double unmap (in error case), and MSI 64bit arithmetic. Also, add new AMD NTB PCI IDs, update AMD NTB maintainer, and pull in patch to reduce the stack usage in IDT driver" * tag 'ntb-6.15' of https://github.com/jonmason/ntb: ntb_hw_amd: Add NTB PCI ID for new gen CPU ntb: reduce stack usage in idt_scan_mws ntb: use 64-bit arithmetic for the MSI doorbell mask MAINTAINERS: Update AMD NTB maintainers ntb_perf: Delete duplicate dmaengine_unmap_put() call in perf_copy_chunk() ntb: intel: Fix using link status DB's ntb_hw_switchtec: Fix shift-out-of-bounds in switchtec_ntb_mw_set_trans
2 parents 4a1d8ab + bf8a7ce commit a52a3c1

File tree

7 files changed

+14
-17
lines changed

7 files changed

+14
-17
lines changed

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17244,7 +17244,6 @@ F: Documentation/core-api/symbol-namespaces.rst
1724417244
F: scripts/nsdeps
1724517245

1724617246
NTB AMD DRIVER
17247-
M: Sanjay R Mehta <sanju.mehta@amd.com>
1724817247
M: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
1724917248
L: ntb@lists.linux.dev
1725017249
S: Supported

drivers/ntb/hw/amd/ntb_hw_amd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,7 @@ static const struct pci_device_id amd_ntb_pci_tbl[] = {
13181318
{ PCI_VDEVICE(AMD, 0x148b), (kernel_ulong_t)&dev_data[1] },
13191319
{ PCI_VDEVICE(AMD, 0x14c0), (kernel_ulong_t)&dev_data[1] },
13201320
{ PCI_VDEVICE(AMD, 0x14c3), (kernel_ulong_t)&dev_data[1] },
1321+
{ PCI_VDEVICE(AMD, 0x155a), (kernel_ulong_t)&dev_data[1] },
13211322
{ PCI_VDEVICE(HYGON, 0x145b), (kernel_ulong_t)&dev_data[0] },
13221323
{ 0, }
13231324
};

drivers/ntb/hw/idt/ntb_hw_idt.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,14 +1041,19 @@ static inline char *idt_get_mw_name(enum idt_mw_type mw_type)
10411041
static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port,
10421042
unsigned char *mw_cnt)
10431043
{
1044-
struct idt_mw_cfg mws[IDT_MAX_NR_MWS], *ret_mws;
1044+
struct idt_mw_cfg *mws;
10451045
const struct idt_ntb_bar *bars;
10461046
enum idt_mw_type mw_type;
10471047
unsigned char widx, bidx, en_cnt;
10481048
bool bar_64bit = false;
10491049
int aprt_size;
10501050
u32 data;
10511051

1052+
mws = devm_kcalloc(&ndev->ntb.pdev->dev, IDT_MAX_NR_MWS,
1053+
sizeof(*mws), GFP_KERNEL);
1054+
if (!mws)
1055+
return ERR_PTR(-ENOMEM);
1056+
10521057
/* Retrieve the array of the BARs registers */
10531058
bars = portdata_tbl[port].bars;
10541059

@@ -1103,16 +1108,7 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port,
11031108
}
11041109
}
11051110

1106-
/* Allocate memory for memory window descriptors */
1107-
ret_mws = devm_kcalloc(&ndev->ntb.pdev->dev, *mw_cnt, sizeof(*ret_mws),
1108-
GFP_KERNEL);
1109-
if (!ret_mws)
1110-
return ERR_PTR(-ENOMEM);
1111-
1112-
/* Copy the info of detected memory windows */
1113-
memcpy(ret_mws, mws, (*mw_cnt)*sizeof(*ret_mws));
1114-
1115-
return ret_mws;
1111+
return mws;
11161112
}
11171113

11181114
/*

drivers/ntb/hw/intel/ntb_hw_gen3.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ static int gen3_init_ntb(struct intel_ntb_dev *ndev)
215215
}
216216

217217
ndev->db_valid_mask = BIT_ULL(ndev->db_count) - 1;
218+
/* Make sure we are not using DB's used for link status */
219+
if (ndev->hwerr_flags & NTB_HWERR_MSIX_VECTOR32_BAD)
220+
ndev->db_valid_mask &= ~ndev->db_link_mask;
218221

219222
ndev->reg->db_iowrite(ndev->db_valid_mask,
220223
ndev->self_mmio +

drivers/ntb/hw/mscc/ntb_hw_switchtec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
288288
if (size != 0 && xlate_pos < 12)
289289
return -EINVAL;
290290

291-
if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
291+
if (xlate_pos >= 0 && !IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
292292
/*
293293
* In certain circumstances we can get a buffer that is
294294
* not aligned to its size. (Most of the time

drivers/ntb/ntb_transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
13531353
qp_count = ilog2(qp_bitmap);
13541354
if (nt->use_msi) {
13551355
qp_count -= 1;
1356-
nt->msi_db_mask = 1 << qp_count;
1356+
nt->msi_db_mask = BIT_ULL(qp_count);
13571357
ntb_db_clear_mask(ndev, nt->msi_db_mask);
13581358
}
13591359

drivers/ntb/test/ntb_perf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,10 +839,8 @@ static int perf_copy_chunk(struct perf_thread *pthr,
839839
dma_set_unmap(tx, unmap);
840840

841841
ret = dma_submit_error(dmaengine_submit(tx));
842-
if (ret) {
843-
dmaengine_unmap_put(unmap);
842+
if (ret)
844843
goto err_free_resource;
845-
}
846844

847845
dmaengine_unmap_put(unmap);
848846

0 commit comments

Comments
 (0)