From 118b7fb891e976d7f5e8845b08d90f33d7e3043e Mon Sep 17 00:00:00 2001 From: Tejal Kudav Date: Mon, 4 Jun 2018 13:15:28 +0530 Subject: gpu: nvgpu: nvlink: Add HAL to get link_mask VBIOS link_disable_mask should be sufficient to find the connected links. As VBIOS is not updated with correct mask, we parse the DT node where we hardcode the link_id. DT method is not scalable as same DT node is used for different dGPUs connected over PCIE. Remove the DT parsing of link id and use HAL to get link_mask based on the GPU. JIRA NVLINK-162 Change-Id: Idb7b639962928ce48711a0d7fc277c4c324bee91 Signed-off-by: Tejal Kudav Reviewed-on: https://git-master.nvidia.com/r/1738967 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gv100/hal_gv100.c | 1 + drivers/gpu/nvgpu/gv100/nvlink_gv100.c | 23 ++++++++++++++++++++--- drivers/gpu/nvgpu/gv100/nvlink_gv100.h | 3 +++ 3 files changed, 24 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gv100') diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c index 5e42ba9f..92900421 100644 --- a/drivers/gpu/nvgpu/gv100/hal_gv100.c +++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c @@ -843,6 +843,7 @@ static const struct gpu_ops gv100_ops = { .rxdet = NULL, .setup_pll = gv100_nvlink_setup_pll, .minion_data_ready_en = gv100_nvlink_minion_data_ready_en, + .get_connected_link_mask = gv100_nvlink_get_connected_link_mask, /* API */ .link_early_init = gv100_nvlink_link_early_init, .link_get_state = gv100_nvlink_link_get_state, diff --git a/drivers/gpu/nvgpu/gv100/nvlink_gv100.c b/drivers/gpu/nvgpu/gv100/nvlink_gv100.c index cae4f9bd..e85b5a93 100644 --- a/drivers/gpu/nvgpu/gv100/nvlink_gv100.c +++ b/drivers/gpu/nvgpu/gv100/nvlink_gv100.c @@ -2696,6 +2696,13 @@ u32 gv100_nvlink_link_get_rx_sublink_state(struct gk20a *g, u32 link_id) return nvl_sl1_slsm_status_rx_primary_state_v(reg); } +/* Hardcode the link_mask while we wait for VBIOS link_disable_mask field + * to be updated. + */ +void gv100_nvlink_get_connected_link_mask(u32 *link_mask) +{ + *link_mask = GV100_CONNECTED_LINK_MASK; +} /* * Performs nvlink device level initialization by discovering the topology * taking device out of reset, boot minion, set clocks up and common interrupts @@ -2735,10 +2742,20 @@ int gv100_nvlink_early_init(struct gk20a *g) /* Links in reset should be removed from initialized link sw state */ g->nvlink.initialized_links &= __gv100_nvlink_get_link_reset_mask(g); - nvgpu_log(g, gpu_dbg_nvlink, "connected_links = 0x%08x (from DT)", - g->nvlink.connected_links); + /* VBIOS link_disable_mask should be sufficient to find the connected + * links. As VBIOS is not updated with correct mask, we parse the DT + * node where we hardcode the link_id. DT method is not scalable as same + * DT node is used for different dGPUs connected over PCIE. + * Remove the DT parsing of link id and use HAL to get link_mask based + * on the GPU. This is temporary WAR while we get the VBIOS updated with + * correct mask. + */ + g->ops.nvlink.get_connected_link_mask(&(g->nvlink.connected_links)); + + nvgpu_log(g, gpu_dbg_nvlink, "connected_links = 0x%08x", + g->nvlink.connected_links); - /* Track unconnected links */ + /* Track only connected links */ g->nvlink.discovered_links &= g->nvlink.connected_links; nvgpu_log(g, gpu_dbg_nvlink, "discovered_links = 0x%08x (combination)", diff --git a/drivers/gpu/nvgpu/gv100/nvlink_gv100.h b/drivers/gpu/nvgpu/gv100/nvlink_gv100.h index bf923d4b..d9a4b073 100644 --- a/drivers/gpu/nvgpu/gv100/nvlink_gv100.h +++ b/drivers/gpu/nvgpu/gv100/nvlink_gv100.h @@ -23,6 +23,8 @@ #ifndef NVGPU_NVLINK_GV100_H #define NVGPU_NVLINK_GV100_H +#define GV100_CONNECTED_LINK_MASK 0x8 + struct gk20a; int gv100_nvlink_discover_ioctrl(struct gk20a *g); @@ -34,6 +36,7 @@ int gv100_nvlink_minion_send_command(struct gk20a *g, u32 link_id, u32 command, int gv100_nvlink_setup_pll(struct gk20a *g, unsigned long link_mask); int gv100_nvlink_minion_data_ready_en(struct gk20a *g, unsigned long link_mask, bool sync); +void gv100_nvlink_get_connected_link_mask(u32 *link_mask); /* API */ int gv100_nvlink_link_early_init(struct gk20a *g, unsigned long mask); u32 gv100_nvlink_link_get_mode(struct gk20a *g, u32 link_id); -- cgit v1.2.2