Commit e5b0d2d1 authored by Xiangliang Yu's avatar Xiangliang Yu Committed by Jon Mason

NTB: add support for hotplug feature

AMD NTB support hotplug under B2B mode. NTB will trigger link
up/down interrupt event when doing plug add/remove, this patch
implements the two interrupt event to support B2B hotplug function.
Signed-off-by: default avatarXiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: default avatarShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Acked-by: default avatarAllen Hubbe <Allen.Hubbe@dell.com>
Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
parent 783dfa6c
...@@ -199,6 +199,11 @@ static int amd_link_is_up(struct amd_ntb_dev *ndev) ...@@ -199,6 +199,11 @@ static int amd_link_is_up(struct amd_ntb_dev *ndev)
if (!ndev->peer_sta) if (!ndev->peer_sta)
return NTB_LNK_STA_ACTIVE(ndev->cntl_sta); return NTB_LNK_STA_ACTIVE(ndev->cntl_sta);
if (ndev->peer_sta & AMD_LINK_UP_EVENT) {
ndev->peer_sta = 0;
return 1;
}
/* If peer_sta is reset or D0 event, the ISR has /* If peer_sta is reset or D0 event, the ISR has
* started a timer to check link status of hardware. * started a timer to check link status of hardware.
* So here just clear status bit. And if peer_sta is * So here just clear status bit. And if peer_sta is
...@@ -207,7 +212,7 @@ static int amd_link_is_up(struct amd_ntb_dev *ndev) ...@@ -207,7 +212,7 @@ static int amd_link_is_up(struct amd_ntb_dev *ndev)
*/ */
if (ndev->peer_sta & AMD_PEER_RESET_EVENT) if (ndev->peer_sta & AMD_PEER_RESET_EVENT)
ndev->peer_sta &= ~AMD_PEER_RESET_EVENT; ndev->peer_sta &= ~AMD_PEER_RESET_EVENT;
else if (ndev->peer_sta & AMD_PEER_D0_EVENT) else if (ndev->peer_sta & (AMD_PEER_D0_EVENT | AMD_LINK_DOWN_EVENT))
ndev->peer_sta = 0; ndev->peer_sta = 0;
return 0; return 0;
...@@ -491,6 +496,8 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) ...@@ -491,6 +496,8 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec)
break; break;
case AMD_PEER_D3_EVENT: case AMD_PEER_D3_EVENT:
case AMD_PEER_PMETO_EVENT: case AMD_PEER_PMETO_EVENT:
case AMD_LINK_UP_EVENT:
case AMD_LINK_DOWN_EVENT:
amd_ack_smu(ndev, status); amd_ack_smu(ndev, status);
/* link down */ /* link down */
......
...@@ -148,9 +148,12 @@ enum { ...@@ -148,9 +148,12 @@ enum {
AMD_PEER_D3_EVENT = BIT(2), AMD_PEER_D3_EVENT = BIT(2),
AMD_PEER_PMETO_EVENT = BIT(3), AMD_PEER_PMETO_EVENT = BIT(3),
AMD_PEER_D0_EVENT = BIT(4), AMD_PEER_D0_EVENT = BIT(4),
AMD_LINK_UP_EVENT = BIT(5),
AMD_LINK_DOWN_EVENT = BIT(6),
AMD_EVENT_INTMASK = (AMD_PEER_FLUSH_EVENT | AMD_EVENT_INTMASK = (AMD_PEER_FLUSH_EVENT |
AMD_PEER_RESET_EVENT | AMD_PEER_D3_EVENT | AMD_PEER_RESET_EVENT | AMD_PEER_D3_EVENT |
AMD_PEER_PMETO_EVENT | AMD_PEER_D0_EVENT), AMD_PEER_PMETO_EVENT | AMD_PEER_D0_EVENT |
AMD_LINK_UP_EVENT | AMD_LINK_DOWN_EVENT),
AMD_PMESTAT_OFFSET = 0x480, AMD_PMESTAT_OFFSET = 0x480,
AMD_PMSGTRIG_OFFSET = 0x490, AMD_PMSGTRIG_OFFSET = 0x490,
......
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