Skip to content

Commit ea15ea8

Browse files
committed
Clean up two reserved LUTs when link forced down
When the link is forced down, we should unmap the reserved LUTs for the NT Control and the Doorbell/Message registers as the LUT mappings can be different when the link is re-established if the new remote switch has a different partition setup.
1 parent fee356e commit ea15ea8

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

ntb_hw_switchtec.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,22 @@ static int switchtec_ntb_setup_crosslink(struct switchtec_ntb *sndev)
756756
return 0;
757757
}
758758

759+
static void switchtec_ntb_cleanup_crosslink(struct switchtec_ntb *sndev)
760+
{
761+
if (!crosslink_is_enabled(sndev))
762+
return;
763+
764+
if (sndev->mmio_xlink_dbmsg_win) {
765+
pci_iounmap(sndev->stdev->pdev, sndev->mmio_xlink_dbmsg_win);
766+
sndev->mmio_xlink_dbmsg_win = NULL;
767+
}
768+
769+
if (sndev->mmio_xlink_ctrl_win) {
770+
pci_iounmap(sndev->stdev->pdev, sndev->mmio_xlink_ctrl_win);
771+
sndev->mmio_xlink_ctrl_win = NULL;
772+
}
773+
}
774+
759775
static void switchtec_ntb_link_status_update(struct switchtec_ntb *sndev)
760776
{
761777
int link_sta;
@@ -796,6 +812,7 @@ static void check_link_status_work(struct work_struct *work)
796812
if (sndev->link_force_down) {
797813
sndev->link_force_down = false;
798814
switchtec_ntb_reinit_peer(sndev);
815+
switchtec_ntb_cleanup_crosslink(sndev);
799816

800817
if (sndev->link_is_up) {
801818
sndev->link_is_up = 0;
@@ -1530,14 +1547,10 @@ static int switchtec_ntb_init_crosslink(struct switchtec_ntb *sndev)
15301547

15311548
static void switchtec_ntb_deinit_crosslink(struct switchtec_ntb *sndev)
15321549
{
1533-
if (sndev->mmio_xlink_dbmsg_win)
1534-
pci_iounmap(sndev->stdev->pdev, sndev->mmio_xlink_dbmsg_win);
1535-
1536-
if (sndev->mmio_xlink_ctrl_win)
1537-
pci_iounmap(sndev->stdev->pdev, sndev->mmio_xlink_ctrl_win);
1538-
15391550
if (sndev->mmio_xlink_ntinfo_win)
15401551
pci_iounmap(sndev->stdev->pdev, sndev->mmio_xlink_ntinfo_win);
1552+
1553+
switchtec_ntb_cleanup_crosslink(sndev);
15411554
}
15421555

15431556
static int map_bars(int *map, struct ntb_ctrl_regs __iomem *ctrl)

0 commit comments

Comments
 (0)