Skip to content

Commit 872deb2

Browse files
Shyam Sundar S Kjonmason
authored andcommitted
NTB: Register and offset values fix for memory window
Due to incorrect limit and translation register values, NTB link was going down when the memory window was setup. Made appropriate changes as per spec. Fix limit register values for BAR1, which was overlapping with the BAR23 address. Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Acked-by: Allen Hubbe <Allen.Hubbe@dell.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
1 parent e5b0d2d commit 872deb2

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/ntb/hw/amd/ntb_hw_amd.c

Lines changed: 4 additions & 10 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);

0 commit comments

Comments
 (0)