Commit 96000bc9 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull NTB updates from Jon Mason:
 "New AMD PCI ID for NTB, and a number of bug fixes for ntb_hw_switchtec
  for Linux v5.17"

* tag 'ntb-5.17' of git://github.com/jonmason/ntb:
  ntb_hw_switchtec: Fix a minor issue in config_req_id_table()
  ntb_hw_switchtec: Remove code for disabling ID protection
  ntb_hw_switchtec: Update the way of getting VEP instance ID
  ntb_hw_switchtec: AND with the part_map for a valid tpart_vec
  ntb_hw_switchtec: Fix bug with more than 32 partitions
  ntb_hw_switchtec: Fix pff ioread to read into mmio_part_cfg_all
  ntb_hw_switchtec: fix the spelling of "its"
  NTB/msi: Fix ntbm_msi_request_threaded_irq() kernel-doc comment
  ntb_hw_amd: Add NTB PCI ID for new gen CPU
parents 2225acc3 8cd77865
...@@ -1321,6 +1321,8 @@ static const struct ntb_dev_data dev_data[] = { ...@@ -1321,6 +1321,8 @@ static const struct ntb_dev_data dev_data[] = {
static const struct pci_device_id amd_ntb_pci_tbl[] = { static const struct pci_device_id amd_ntb_pci_tbl[] = {
{ PCI_VDEVICE(AMD, 0x145b), (kernel_ulong_t)&dev_data[0] }, { PCI_VDEVICE(AMD, 0x145b), (kernel_ulong_t)&dev_data[0] },
{ PCI_VDEVICE(AMD, 0x148b), (kernel_ulong_t)&dev_data[1] }, { 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(HYGON, 0x145b), (kernel_ulong_t)&dev_data[0] }, { PCI_VDEVICE(HYGON, 0x145b), (kernel_ulong_t)&dev_data[0] },
{ 0, } { 0, }
}; };
......
...@@ -297,7 +297,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx, ...@@ -297,7 +297,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
* (see CMA_CONFIG_ALIGNMENT) * (see CMA_CONFIG_ALIGNMENT)
*/ */
dev_err(&sndev->stdev->dev, dev_err(&sndev->stdev->dev,
"ERROR: Memory window address is not aligned to it's size!\n"); "ERROR: Memory window address is not aligned to its size!\n");
return -EINVAL; return -EINVAL;
} }
...@@ -419,8 +419,10 @@ static void switchtec_ntb_part_link_speed(struct switchtec_ntb *sndev, ...@@ -419,8 +419,10 @@ static void switchtec_ntb_part_link_speed(struct switchtec_ntb *sndev,
enum ntb_width *width) enum ntb_width *width)
{ {
struct switchtec_dev *stdev = sndev->stdev; struct switchtec_dev *stdev = sndev->stdev;
struct part_cfg_regs __iomem *part_cfg =
&stdev->mmio_part_cfg_all[partition];
u32 pff = ioread32(&stdev->mmio_part_cfg[partition].vep_pff_inst_id); u32 pff = ioread32(&part_cfg->vep_pff_inst_id) & 0xFF;
u32 linksta = ioread32(&stdev->mmio_pff_csr[pff].pci_cap_region[13]); u32 linksta = ioread32(&stdev->mmio_pff_csr[pff].pci_cap_region[13]);
if (speed) if (speed)
...@@ -840,7 +842,6 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) ...@@ -840,7 +842,6 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev)
u64 tpart_vec; u64 tpart_vec;
int self; int self;
u64 part_map; u64 part_map;
int bit;
sndev->ntb.pdev = sndev->stdev->pdev; sndev->ntb.pdev = sndev->stdev->pdev;
sndev->ntb.topo = NTB_TOPO_SWITCH; sndev->ntb.topo = NTB_TOPO_SWITCH;
...@@ -859,31 +860,31 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) ...@@ -859,31 +860,31 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev)
tpart_vec |= ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_low); tpart_vec |= ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_low);
part_map = ioread64(&sndev->mmio_ntb->ep_map); part_map = ioread64(&sndev->mmio_ntb->ep_map);
tpart_vec &= part_map;
part_map &= ~(1 << sndev->self_partition); part_map &= ~(1 << sndev->self_partition);
if (!ffs(tpart_vec)) { if (!tpart_vec) {
if (sndev->stdev->partition_count != 2) { if (sndev->stdev->partition_count != 2) {
dev_err(&sndev->stdev->dev, dev_err(&sndev->stdev->dev,
"ntb target partition not defined\n"); "ntb target partition not defined\n");
return -ENODEV; return -ENODEV;
} }
bit = ffs(part_map); if (!part_map) {
if (!bit) {
dev_err(&sndev->stdev->dev, dev_err(&sndev->stdev->dev,
"peer partition is not NT partition\n"); "peer partition is not NT partition\n");
return -ENODEV; return -ENODEV;
} }
sndev->peer_partition = bit - 1; sndev->peer_partition = __ffs64(part_map);
} else { } else {
if (ffs(tpart_vec) != fls(tpart_vec)) { if (__ffs64(tpart_vec) != (fls64(tpart_vec) - 1)) {
dev_err(&sndev->stdev->dev, dev_err(&sndev->stdev->dev,
"ntb driver only supports 1 pair of 1-1 ntb mapping\n"); "ntb driver only supports 1 pair of 1-1 ntb mapping\n");
return -ENODEV; return -ENODEV;
} }
sndev->peer_partition = ffs(tpart_vec) - 1; sndev->peer_partition = __ffs64(tpart_vec);
if (!(part_map & (1ULL << sndev->peer_partition))) { if (!(part_map & (1ULL << sndev->peer_partition))) {
dev_err(&sndev->stdev->dev, dev_err(&sndev->stdev->dev,
"ntb target partition is not NT partition\n"); "ntb target partition is not NT partition\n");
...@@ -954,7 +955,7 @@ static int config_req_id_table(struct switchtec_ntb *sndev, ...@@ -954,7 +955,7 @@ static int config_req_id_table(struct switchtec_ntb *sndev,
u32 error; u32 error;
u32 proxy_id; u32 proxy_id;
if (ioread32(&mmio_ctrl->req_id_table_size) < count) { if (ioread16(&mmio_ctrl->req_id_table_size) < count) {
dev_err(&sndev->stdev->dev, dev_err(&sndev->stdev->dev,
"Not enough requester IDs available.\n"); "Not enough requester IDs available.\n");
return -EFAULT; return -EFAULT;
...@@ -966,9 +967,6 @@ static int config_req_id_table(struct switchtec_ntb *sndev, ...@@ -966,9 +967,6 @@ static int config_req_id_table(struct switchtec_ntb *sndev,
if (rc) if (rc)
return rc; return rc;
iowrite32(NTB_PART_CTRL_ID_PROT_DIS,
&mmio_ctrl->partition_ctrl);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
iowrite32(req_ids[i] << 16 | NTB_CTRL_REQ_ID_EN, iowrite32(req_ids[i] << 16 | NTB_CTRL_REQ_ID_EN,
&mmio_ctrl->req_id_table[i]); &mmio_ctrl->req_id_table[i]);
...@@ -1090,7 +1088,7 @@ static int crosslink_enum_partition(struct switchtec_ntb *sndev, ...@@ -1090,7 +1088,7 @@ static int crosslink_enum_partition(struct switchtec_ntb *sndev,
{ {
struct part_cfg_regs __iomem *part_cfg = struct part_cfg_regs __iomem *part_cfg =
&sndev->stdev->mmio_part_cfg_all[sndev->peer_partition]; &sndev->stdev->mmio_part_cfg_all[sndev->peer_partition];
u32 pff = ioread32(&part_cfg->vep_pff_inst_id); u32 pff = ioread32(&part_cfg->vep_pff_inst_id) & 0xFF;
struct pff_csr_regs __iomem *mmio_pff = struct pff_csr_regs __iomem *mmio_pff =
&sndev->stdev->mmio_pff_csr[pff]; &sndev->stdev->mmio_pff_csr[pff];
const u64 bar_space = 0x1000000000LL; const u64 bar_space = 0x1000000000LL;
......
...@@ -262,8 +262,9 @@ static int ntbm_msi_setup_callback(struct ntb_dev *ntb, struct msi_desc *entry, ...@@ -262,8 +262,9 @@ static int ntbm_msi_setup_callback(struct ntb_dev *ntb, struct msi_desc *entry,
* @handler: Function to be called when the IRQ occurs * @handler: Function to be called when the IRQ occurs
* @thread_fn: Function to be called in a threaded interrupt context. NULL * @thread_fn: Function to be called in a threaded interrupt context. NULL
* for clients which handle everything in @handler * for clients which handle everything in @handler
* @devname: An ascii name for the claiming device, dev_name(dev) if NULL * @name: An ascii name for the claiming device, dev_name(dev) if NULL
* @dev_id: A cookie passed back to the handler function * @dev_id: A cookie passed back to the handler function
* @msi_desc: MSI descriptor data which triggers the interrupt
* *
* This function assigns an interrupt handler to an unused * This function assigns an interrupt handler to an unused
* MSI interrupt and returns the descriptor used to trigger * MSI interrupt and returns the descriptor used to trigger
......
...@@ -337,8 +337,6 @@ enum { ...@@ -337,8 +337,6 @@ enum {
NTB_CTRL_REQ_ID_EN = 1 << 0, NTB_CTRL_REQ_ID_EN = 1 << 0,
NTB_CTRL_LUT_EN = 1 << 0, NTB_CTRL_LUT_EN = 1 << 0,
NTB_PART_CTRL_ID_PROT_DIS = 1 << 0,
}; };
struct ntb_ctrl_regs { struct ntb_ctrl_regs {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment