Skip to content

Commit 96000bc

Browse files
committed
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
2 parents 2225acc + 8cd7786 commit 96000bc

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

drivers/ntb/hw/amd/ntb_hw_amd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,8 @@ static const struct ntb_dev_data dev_data[] = {
13211321
static const struct pci_device_id amd_ntb_pci_tbl[] = {
13221322
{ PCI_VDEVICE(AMD, 0x145b), (kernel_ulong_t)&dev_data[0] },
13231323
{ PCI_VDEVICE(AMD, 0x148b), (kernel_ulong_t)&dev_data[1] },
1324+
{ PCI_VDEVICE(AMD, 0x14c0), (kernel_ulong_t)&dev_data[1] },
1325+
{ PCI_VDEVICE(AMD, 0x14c3), (kernel_ulong_t)&dev_data[1] },
13241326
{ PCI_VDEVICE(HYGON, 0x145b), (kernel_ulong_t)&dev_data[0] },
13251327
{ 0, }
13261328
};

drivers/ntb/hw/mscc/ntb_hw_switchtec.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
297297
* (see CMA_CONFIG_ALIGNMENT)
298298
*/
299299
dev_err(&sndev->stdev->dev,
300-
"ERROR: Memory window address is not aligned to it's size!\n");
300+
"ERROR: Memory window address is not aligned to its size!\n");
301301
return -EINVAL;
302302
}
303303

@@ -419,8 +419,10 @@ static void switchtec_ntb_part_link_speed(struct switchtec_ntb *sndev,
419419
enum ntb_width *width)
420420
{
421421
struct switchtec_dev *stdev = sndev->stdev;
422+
struct part_cfg_regs __iomem *part_cfg =
423+
&stdev->mmio_part_cfg_all[partition];
422424

423-
u32 pff = ioread32(&stdev->mmio_part_cfg[partition].vep_pff_inst_id);
425+
u32 pff = ioread32(&part_cfg->vep_pff_inst_id) & 0xFF;
424426
u32 linksta = ioread32(&stdev->mmio_pff_csr[pff].pci_cap_region[13]);
425427

426428
if (speed)
@@ -840,7 +842,6 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev)
840842
u64 tpart_vec;
841843
int self;
842844
u64 part_map;
843-
int bit;
844845

845846
sndev->ntb.pdev = sndev->stdev->pdev;
846847
sndev->ntb.topo = NTB_TOPO_SWITCH;
@@ -859,31 +860,31 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev)
859860
tpart_vec |= ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_low);
860861

861862
part_map = ioread64(&sndev->mmio_ntb->ep_map);
863+
tpart_vec &= part_map;
862864
part_map &= ~(1 << sndev->self_partition);
863865

864-
if (!ffs(tpart_vec)) {
866+
if (!tpart_vec) {
865867
if (sndev->stdev->partition_count != 2) {
866868
dev_err(&sndev->stdev->dev,
867869
"ntb target partition not defined\n");
868870
return -ENODEV;
869871
}
870872

871-
bit = ffs(part_map);
872-
if (!bit) {
873+
if (!part_map) {
873874
dev_err(&sndev->stdev->dev,
874875
"peer partition is not NT partition\n");
875876
return -ENODEV;
876877
}
877878

878-
sndev->peer_partition = bit - 1;
879+
sndev->peer_partition = __ffs64(part_map);
879880
} else {
880-
if (ffs(tpart_vec) != fls(tpart_vec)) {
881+
if (__ffs64(tpart_vec) != (fls64(tpart_vec) - 1)) {
881882
dev_err(&sndev->stdev->dev,
882883
"ntb driver only supports 1 pair of 1-1 ntb mapping\n");
883884
return -ENODEV;
884885
}
885886

886-
sndev->peer_partition = ffs(tpart_vec) - 1;
887+
sndev->peer_partition = __ffs64(tpart_vec);
887888
if (!(part_map & (1ULL << sndev->peer_partition))) {
888889
dev_err(&sndev->stdev->dev,
889890
"ntb target partition is not NT partition\n");
@@ -954,7 +955,7 @@ static int config_req_id_table(struct switchtec_ntb *sndev,
954955
u32 error;
955956
u32 proxy_id;
956957

957-
if (ioread32(&mmio_ctrl->req_id_table_size) < count) {
958+
if (ioread16(&mmio_ctrl->req_id_table_size) < count) {
958959
dev_err(&sndev->stdev->dev,
959960
"Not enough requester IDs available.\n");
960961
return -EFAULT;
@@ -966,9 +967,6 @@ static int config_req_id_table(struct switchtec_ntb *sndev,
966967
if (rc)
967968
return rc;
968969

969-
iowrite32(NTB_PART_CTRL_ID_PROT_DIS,
970-
&mmio_ctrl->partition_ctrl);
971-
972970
for (i = 0; i < count; i++) {
973971
iowrite32(req_ids[i] << 16 | NTB_CTRL_REQ_ID_EN,
974972
&mmio_ctrl->req_id_table[i]);
@@ -1090,7 +1088,7 @@ static int crosslink_enum_partition(struct switchtec_ntb *sndev,
10901088
{
10911089
struct part_cfg_regs __iomem *part_cfg =
10921090
&sndev->stdev->mmio_part_cfg_all[sndev->peer_partition];
1093-
u32 pff = ioread32(&part_cfg->vep_pff_inst_id);
1091+
u32 pff = ioread32(&part_cfg->vep_pff_inst_id) & 0xFF;
10941092
struct pff_csr_regs __iomem *mmio_pff =
10951093
&sndev->stdev->mmio_pff_csr[pff];
10961094
const u64 bar_space = 0x1000000000LL;

drivers/ntb/msi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,9 @@ static int ntbm_msi_setup_callback(struct ntb_dev *ntb, struct msi_desc *entry,
262262
* @handler: Function to be called when the IRQ occurs
263263
* @thread_fn: Function to be called in a threaded interrupt context. NULL
264264
* for clients which handle everything in @handler
265-
* @devname: An ascii name for the claiming device, dev_name(dev) if NULL
265+
* @name: An ascii name for the claiming device, dev_name(dev) if NULL
266266
* @dev_id: A cookie passed back to the handler function
267+
* @msi_desc: MSI descriptor data which triggers the interrupt
267268
*
268269
* This function assigns an interrupt handler to an unused
269270
* MSI interrupt and returns the descriptor used to trigger

include/linux/switchtec.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,6 @@ enum {
337337
NTB_CTRL_REQ_ID_EN = 1 << 0,
338338

339339
NTB_CTRL_LUT_EN = 1 << 0,
340-
341-
NTB_PART_CTRL_ID_PROT_DIS = 1 << 0,
342340
};
343341

344342
struct ntb_ctrl_regs {

0 commit comments

Comments
 (0)