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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEoE9b9c3U2JxX98mqbmZLrHqL0iMFAmfazJIACgkQbmZLrHqL
 0iPRUA//T5bOCQeW/NEKZM38/t4NFAfzcmbRc0RmDwndwO0P7kWTST2ObFbm1LLt
 TiMiCB+RPGupyMhALMqB0hHtDf/WqFz31ZcEt7TVDU38YjDi/0DIo4+3P0JsMItA
 mqG3XExpHdfQXkGj52wwADrrxZnijaR0vuQuB02HYswg3lIWUH/TJe1jM9c0cKTF
 DIZMwgF7EFiacl7CC2fxk/GtjqdKkQKZI6d78pQdyzY28wkb5tixntOofLfj6b8k
 buZwYZxya6CnY317BVGKK0qIoMJWuBSGAcNlWu4DZru2XL97Ht5yHa6PdQX6zR29
 wiS7n5kTZgjPwLjQvzt4t9urEr752lAEXLE3SN8a9ZFQRohTfiK1FIjU3FJPirV0
 ykoYtHWFoJFSIEkSbTvTzV2Wlq9ilcaJ2K2PA2K1hutaVb766PPUy9hZf7uFeeD/
 PQ3nSGVHYJwFi08MR3NjtHvtiDxfXGQ1od/F+1HSPFgqNte0cB07Si25K5H55Jv1
 /NjKbqvxjVEGSY9BMXDkZ3zYlFru+LKTBPkmlqJRu3Pb0+6DwJpyowS2Z4Qt+WAn
 HiT1kbzU/9i+SXFNJfC91PIeEfxdigj91ZXNbdoWjVNkpjx5v3jLbDuFnqT4xL23
 1Q1XGul83RtmYQqCvkAzfTw2K1gx29t+w56tIAeWyNAHgn/I24s=
 =N7zn
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2025-04-04 14:23:07 -07:00
commit a52a3c18cd
7 changed files with 14 additions and 17 deletions

View File

@ -17244,7 +17244,6 @@ F: Documentation/core-api/symbol-namespaces.rst
F: scripts/nsdeps
NTB AMD DRIVER
M: Sanjay R Mehta <sanju.mehta@amd.com>
M: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
L: ntb@lists.linux.dev
S: Supported

View File

@ -1318,6 +1318,7 @@ static const struct pci_device_id amd_ntb_pci_tbl[] = {
{ PCI_VDEVICE(AMD, 0x148b), (kernel_ulong_t)&dev_data[1] },
{ PCI_VDEVICE(AMD, 0x14c0), (kernel_ulong_t)&dev_data[1] },
{ PCI_VDEVICE(AMD, 0x14c3), (kernel_ulong_t)&dev_data[1] },
{ PCI_VDEVICE(AMD, 0x155a), (kernel_ulong_t)&dev_data[1] },
{ PCI_VDEVICE(HYGON, 0x145b), (kernel_ulong_t)&dev_data[0] },
{ 0, }
};

View File

@ -1041,7 +1041,7 @@ static inline char *idt_get_mw_name(enum idt_mw_type mw_type)
static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port,
unsigned char *mw_cnt)
{
struct idt_mw_cfg mws[IDT_MAX_NR_MWS], *ret_mws;
struct idt_mw_cfg *mws;
const struct idt_ntb_bar *bars;
enum idt_mw_type mw_type;
unsigned char widx, bidx, en_cnt;
@ -1049,6 +1049,11 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port,
int aprt_size;
u32 data;
mws = devm_kcalloc(&ndev->ntb.pdev->dev, IDT_MAX_NR_MWS,
sizeof(*mws), GFP_KERNEL);
if (!mws)
return ERR_PTR(-ENOMEM);
/* Retrieve the array of the BARs registers */
bars = portdata_tbl[port].bars;
@ -1103,16 +1108,7 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port,
}
}
/* Allocate memory for memory window descriptors */
ret_mws = devm_kcalloc(&ndev->ntb.pdev->dev, *mw_cnt, sizeof(*ret_mws),
GFP_KERNEL);
if (!ret_mws)
return ERR_PTR(-ENOMEM);
/* Copy the info of detected memory windows */
memcpy(ret_mws, mws, (*mw_cnt)*sizeof(*ret_mws));
return ret_mws;
return mws;
}
/*

View File

@ -215,6 +215,9 @@ static int gen3_init_ntb(struct intel_ntb_dev *ndev)
}
ndev->db_valid_mask = BIT_ULL(ndev->db_count) - 1;
/* Make sure we are not using DB's used for link status */
if (ndev->hwerr_flags & NTB_HWERR_MSIX_VECTOR32_BAD)
ndev->db_valid_mask &= ~ndev->db_link_mask;
ndev->reg->db_iowrite(ndev->db_valid_mask,
ndev->self_mmio +

View File

@ -288,7 +288,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
if (size != 0 && xlate_pos < 12)
return -EINVAL;
if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
if (xlate_pos >= 0 && !IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
/*
* In certain circumstances we can get a buffer that is
* not aligned to its size. (Most of the time

View File

@ -1353,7 +1353,7 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
qp_count = ilog2(qp_bitmap);
if (nt->use_msi) {
qp_count -= 1;
nt->msi_db_mask = 1 << qp_count;
nt->msi_db_mask = BIT_ULL(qp_count);
ntb_db_clear_mask(ndev, nt->msi_db_mask);
}

View File

@ -839,10 +839,8 @@ static int perf_copy_chunk(struct perf_thread *pthr,
dma_set_unmap(tx, unmap);
ret = dma_submit_error(dmaengine_submit(tx));
if (ret) {
dmaengine_unmap_put(unmap);
if (ret)
goto err_free_resource;
}
dmaengine_unmap_put(unmap);