summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk/clk_arb.c
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2017-09-01 00:44:59 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-03 17:26:27 -0400
commit2dcfd29861f2c5dc75cff988e7d950e15aad9da2 (patch)
tree8995756cdeeba70d771c2cfaf2bfa147611ff8f2 /drivers/gpu/nvgpu/clk/clk_arb.c
parent081dc658cba1982deaeee8e5745d54826b04db38 (diff)
gpu: nvgpu: NVGPU abstraction for ACCESS_ONCE
Construct a wrapper macro NV_ACCESS_ONCE(x) which uses OS specific versions of ACCESS_ONCE. e.g for linux, ACCESS_ONCE(x) is used. Jira NVGPU-125 Change-Id: Ia5c67baae111c1a7978c530bf279715fc808287d Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1549928 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_arb.c')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_arb.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_arb.c b/drivers/gpu/nvgpu/clk/clk_arb.c
index fc6d403e..0204627b 100644
--- a/drivers/gpu/nvgpu/clk/clk_arb.c
+++ b/drivers/gpu/nvgpu/clk/clk_arb.c
@@ -705,7 +705,7 @@ static int nvgpu_clk_arb_update_vf_table(struct nvgpu_clk_arb *arb)
705 struct clk_set_info *p5_info, *p0_info; 705 struct clk_set_info *p5_info, *p0_info;
706 706
707 707
708 table = ACCESS_ONCE(arb->current_vf_table); 708 table = NV_ACCESS_ONCE(arb->current_vf_table);
709 /* make flag visible when all data has resolved in the tables */ 709 /* make flag visible when all data has resolved in the tables */
710 nvgpu_smp_rmb(); 710 nvgpu_smp_rmb();
711 711
@@ -1073,7 +1073,7 @@ static void nvgpu_clk_arb_run_arbiter_cb(struct work_struct *work)
1073 if (!session->zombie) { 1073 if (!session->zombie) {
1074 mclk_set = false; 1074 mclk_set = false;
1075 gpc2clk_set = false; 1075 gpc2clk_set = false;
1076 target = ACCESS_ONCE(session->target) == 1076 target = NV_ACCESS_ONCE(session->target) ==
1077 &session->target_pool[0] ? 1077 &session->target_pool[0] ?
1078 &session->target_pool[1] : 1078 &session->target_pool[1] :
1079 &session->target_pool[0]; 1079 &session->target_pool[0];
@@ -1221,7 +1221,7 @@ static void nvgpu_clk_arb_run_arbiter_cb(struct work_struct *work)
1221 goto exit_arb; 1221 goto exit_arb;
1222 } 1222 }
1223 1223
1224 actual = ACCESS_ONCE(arb->actual) == &arb->actual_pool[0] ? 1224 actual = NV_ACCESS_ONCE(arb->actual) == &arb->actual_pool[0] ?
1225 &arb->actual_pool[1] : &arb->actual_pool[0]; 1225 &arb->actual_pool[1] : &arb->actual_pool[0];
1226 1226
1227 /* do not reorder this pointer */ 1227 /* do not reorder this pointer */
@@ -1374,7 +1374,7 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev,
1374 notification = &arb->notification_queue. 1374 notification = &arb->notification_queue.
1375 notifications[(index+1) % size]; 1375 notifications[(index+1) % size];
1376 alarm_detected = 1376 alarm_detected =
1377 ACCESS_ONCE(notification->notification); 1377 NV_ACCESS_ONCE(notification->notification);
1378 1378
1379 if (!(enabled_mask & alarm_detected)) 1379 if (!(enabled_mask & alarm_detected))
1380 continue; 1380 continue;
@@ -1382,7 +1382,7 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev,
1382 queue_index++; 1382 queue_index++;
1383 dev->queue.notifications[ 1383 dev->queue.notifications[
1384 queue_index % dev->queue.size].timestamp = 1384 queue_index % dev->queue.size].timestamp =
1385 ACCESS_ONCE(notification->timestamp); 1385 NV_ACCESS_ONCE(notification->timestamp);
1386 1386
1387 dev->queue.notifications[ 1387 dev->queue.notifications[
1388 queue_index % dev->queue.size].notification = 1388 queue_index % dev->queue.size].notification =
@@ -1686,7 +1686,7 @@ int nvgpu_clk_arb_get_session_target_mhz(struct nvgpu_clk_session *session,
1686 struct nvgpu_clk_arb_target *target; 1686 struct nvgpu_clk_arb_target *target;
1687 1687
1688 do { 1688 do {
1689 target = ACCESS_ONCE(session->target); 1689 target = NV_ACCESS_ONCE(session->target);
1690 /* no reordering of this pointer */ 1690 /* no reordering of this pointer */
1691 nvgpu_smp_rmb(); 1691 nvgpu_smp_rmb();
1692 1692
@@ -1703,7 +1703,7 @@ int nvgpu_clk_arb_get_session_target_mhz(struct nvgpu_clk_session *session,
1703 *freq_mhz = 0; 1703 *freq_mhz = 0;
1704 err = -EINVAL; 1704 err = -EINVAL;
1705 } 1705 }
1706 } while (target != ACCESS_ONCE(session->target)); 1706 } while (target != NV_ACCESS_ONCE(session->target));
1707 return err; 1707 return err;
1708} 1708}
1709 1709
@@ -1715,7 +1715,7 @@ int nvgpu_clk_arb_get_arbiter_actual_mhz(struct gk20a *g,
1715 struct nvgpu_clk_arb_target *actual; 1715 struct nvgpu_clk_arb_target *actual;
1716 1716
1717 do { 1717 do {
1718 actual = ACCESS_ONCE(arb->actual); 1718 actual = NV_ACCESS_ONCE(arb->actual);
1719 /* no reordering of this pointer */ 1719 /* no reordering of this pointer */
1720 nvgpu_smp_rmb(); 1720 nvgpu_smp_rmb();
1721 1721
@@ -1732,7 +1732,7 @@ int nvgpu_clk_arb_get_arbiter_actual_mhz(struct gk20a *g,
1732 *freq_mhz = 0; 1732 *freq_mhz = 0;
1733 err = -EINVAL; 1733 err = -EINVAL;
1734 } 1734 }
1735 } while (actual != ACCESS_ONCE(arb->actual)); 1735 } while (actual != NV_ACCESS_ONCE(arb->actual));
1736 return err; 1736 return err;
1737} 1737}
1738 1738
@@ -1853,7 +1853,7 @@ static u8 nvgpu_clk_arb_find_vf_point(struct nvgpu_clk_arb *arb,
1853 mclk_voltuv = 0; 1853 mclk_voltuv = 0;
1854 mclk_voltuv_sram = 0; 1854 mclk_voltuv_sram = 0;
1855 1855
1856 table = ACCESS_ONCE(arb->current_vf_table); 1856 table = NV_ACCESS_ONCE(arb->current_vf_table);
1857 /* pointer to table can be updated by callback */ 1857 /* pointer to table can be updated by callback */
1858 nvgpu_smp_rmb(); 1858 nvgpu_smp_rmb();
1859 1859
@@ -1943,7 +1943,7 @@ recalculate_vf_point:
1943 mclk_voltuv_sram = mclk_vf->uvolt_sram; 1943 mclk_voltuv_sram = mclk_vf->uvolt_sram;
1944 1944
1945 } while (!table || 1945 } while (!table ||
1946 (ACCESS_ONCE(arb->current_vf_table) != table)); 1946 (NV_ACCESS_ONCE(arb->current_vf_table) != table));
1947 1947
1948find_exit: 1948find_exit:
1949 *voltuv = gpc2clk_voltuv > mclk_voltuv ? gpc2clk_voltuv : mclk_voltuv; 1949 *voltuv = gpc2clk_voltuv > mclk_voltuv ? gpc2clk_voltuv : mclk_voltuv;
@@ -1961,7 +1961,7 @@ find_exit:
1961 * arbiter must be blocked before calling this function */ 1961 * arbiter must be blocked before calling this function */
1962int nvgpu_clk_arb_get_current_pstate(struct gk20a *g) 1962int nvgpu_clk_arb_get_current_pstate(struct gk20a *g)
1963{ 1963{
1964 return ACCESS_ONCE(g->clk_arb->actual->pstate); 1964 return NV_ACCESS_ONCE(g->clk_arb->actual->pstate);
1965} 1965}
1966 1966
1967static int nvgpu_clk_arb_change_vf_point(struct gk20a *g, u16 gpc2clk_target, 1967static int nvgpu_clk_arb_change_vf_point(struct gk20a *g, u16 gpc2clk_target,
@@ -2038,7 +2038,7 @@ static int nvgpu_clk_arb_stats_show(struct seq_file *s, void *unused)
2038 u64 num; 2038 u64 num;
2039 s64 tmp, avg, std, max, min; 2039 s64 tmp, avg, std, max, min;
2040 2040
2041 debug = ACCESS_ONCE(arb->debug); 2041 debug = NV_ACCESS_ONCE(arb->debug);
2042 /* Make copy of structure and ensure no reordering */ 2042 /* Make copy of structure and ensure no reordering */
2043 nvgpu_smp_rmb(); 2043 nvgpu_smp_rmb();
2044 if (!debug) 2044 if (!debug)