Skip to content

Commit 01e0d60

Browse files
committed
Merge tag 'ntb-4.10' of git://github.com/jonmason/ntb
Pull NTB update from Jon Mason: - NTB bug fixes for removing an unnecessary call to ntb_peer_spad_read, and correcting a free_irq inconsistency - add Intel SKX support - change the AMD NTB maintainer, and fix some bugs present there * tag 'ntb-4.10' of git://github.com/jonmason/ntb: ntb_transport: Remove unnecessary call to ntb_peer_spad_read NTB: Fix 'request_irq()' and 'free_irq()' inconsistancy ntb: fix SKX NTB config space size register offsets NTB: correct ntb_peer_spad_read for case when callback is not supplied. MAINTAINERS: Change in maintainer for AMD NTB ntb_transport: Limit memory windows based on available, scratchpads NTB: Register and offset values fix for memory window NTB: add support for hotplug feature ntb: Adding Skylake Xeon NTB support
2 parents 6ac3bb1 + dfb7d24 commit 01e0d60

File tree

7 files changed

+741
-33
lines changed

7 files changed

+741
-33
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8828,7 +8828,7 @@ T: git git://github.com/jonmason/ntb.git
88288828
F: drivers/ntb/hw/intel/
88298829

88308830
NTB AMD DRIVER
8831-
M: Xiangliang Yu <Xiangliang.Yu@amd.com>
8831+
M: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
88328832
L: linux-ntb@googlegroups.com
88338833
S: Supported
88348834
F: drivers/ntb/hw/amd/

drivers/ntb/hw/amd/ntb_hw_amd.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ static int amd_ntb_mw_set_trans(struct ntb_dev *ntb, int idx,
138138
base_addr = pci_resource_start(ndev->ntb.pdev, bar);
139139

140140
if (bar != 1) {
141-
xlat_reg = AMD_BAR23XLAT_OFFSET + ((bar - 2) << 3);
142-
limit_reg = AMD_BAR23LMT_OFFSET + ((bar - 2) << 3);
141+
xlat_reg = AMD_BAR23XLAT_OFFSET + ((bar - 2) << 2);
142+
limit_reg = AMD_BAR23LMT_OFFSET + ((bar - 2) << 2);
143143

144144
/* Set the limit if supported */
145-
limit = base_addr + size;
145+
limit = size;
146146

147147
/* set and verify setting the translation address */
148148
write64(addr, peer_mmio + xlat_reg);
@@ -164,14 +164,8 @@ static int amd_ntb_mw_set_trans(struct ntb_dev *ntb, int idx,
164164
xlat_reg = AMD_BAR1XLAT_OFFSET;
165165
limit_reg = AMD_BAR1LMT_OFFSET;
166166

167-
/* split bar addr range must all be 32 bit */
168-
if (addr & (~0ull << 32))
169-
return -EINVAL;
170-
if ((addr + size) & (~0ull << 32))
171-
return -EINVAL;
172-
173167
/* Set the limit if supported */
174-
limit = base_addr + size;
168+
limit = size;
175169

176170
/* set and verify setting the translation address */
177171
write64(addr, peer_mmio + xlat_reg);
@@ -199,6 +193,11 @@ static int amd_link_is_up(struct amd_ntb_dev *ndev)
199193
if (!ndev->peer_sta)
200194
return NTB_LNK_STA_ACTIVE(ndev->cntl_sta);
201195

196+
if (ndev->peer_sta & AMD_LINK_UP_EVENT) {
197+
ndev->peer_sta = 0;
198+
return 1;
199+
}
200+
202201
/* If peer_sta is reset or D0 event, the ISR has
203202
* started a timer to check link status of hardware.
204203
* So here just clear status bit. And if peer_sta is
@@ -207,7 +206,7 @@ static int amd_link_is_up(struct amd_ntb_dev *ndev)
207206
*/
208207
if (ndev->peer_sta & AMD_PEER_RESET_EVENT)
209208
ndev->peer_sta &= ~AMD_PEER_RESET_EVENT;
210-
else if (ndev->peer_sta & AMD_PEER_D0_EVENT)
209+
else if (ndev->peer_sta & (AMD_PEER_D0_EVENT | AMD_LINK_DOWN_EVENT))
211210
ndev->peer_sta = 0;
212211

213212
return 0;
@@ -491,6 +490,8 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec)
491490
break;
492491
case AMD_PEER_D3_EVENT:
493492
case AMD_PEER_PMETO_EVENT:
493+
case AMD_LINK_UP_EVENT:
494+
case AMD_LINK_DOWN_EVENT:
494495
amd_ack_smu(ndev, status);
495496

496497
/* link down */
@@ -598,7 +599,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
598599

599600
err_msix_request:
600601
while (i-- > 0)
601-
free_irq(ndev->msix[i].vector, ndev);
602+
free_irq(ndev->msix[i].vector, &ndev->vec[i]);
602603
pci_disable_msix(pdev);
603604
err_msix_enable:
604605
kfree(ndev->msix);

drivers/ntb/hw/amd/ntb_hw_amd.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ enum {
148148
AMD_PEER_D3_EVENT = BIT(2),
149149
AMD_PEER_PMETO_EVENT = BIT(3),
150150
AMD_PEER_D0_EVENT = BIT(4),
151+
AMD_LINK_UP_EVENT = BIT(5),
152+
AMD_LINK_DOWN_EVENT = BIT(6),
151153
AMD_EVENT_INTMASK = (AMD_PEER_FLUSH_EVENT |
152154
AMD_PEER_RESET_EVENT | AMD_PEER_D3_EVENT |
153-
AMD_PEER_PMETO_EVENT | AMD_PEER_D0_EVENT),
155+
AMD_PEER_PMETO_EVENT | AMD_PEER_D0_EVENT |
156+
AMD_LINK_UP_EVENT | AMD_LINK_DOWN_EVENT),
154157

155158
AMD_PMESTAT_OFFSET = 0x480,
156159
AMD_PMSGTRIG_OFFSET = 0x490,

0 commit comments

Comments
 (0)