diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/clk/clk_arb.c | 26 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/lockless_allocator.c | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/pmu/pmu.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/barrier.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/linux/barrier.h | 2 |
5 files changed, 23 insertions, 19 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 | ||
1948 | find_exit: | 1948 | find_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 */ |
1962 | int nvgpu_clk_arb_get_current_pstate(struct gk20a *g) | 1962 | int 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 | ||
1967 | static int nvgpu_clk_arb_change_vf_point(struct gk20a *g, u16 gpc2clk_target, | 1967 | static 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) |
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c index 04df7e3f..0df1ae9d 100644 --- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c | |||
@@ -60,9 +60,9 @@ static u64 nvgpu_lockless_alloc(struct nvgpu_allocator *a, u64 len) | |||
60 | if (len != pa->blk_size) | 60 | if (len != pa->blk_size) |
61 | return 0; | 61 | return 0; |
62 | 62 | ||
63 | head = ACCESS_ONCE(pa->head); | 63 | head = NV_ACCESS_ONCE(pa->head); |
64 | while (head >= 0) { | 64 | while (head >= 0) { |
65 | new_head = ACCESS_ONCE(pa->next[head]); | 65 | new_head = NV_ACCESS_ONCE(pa->next[head]); |
66 | ret = cmpxchg(&pa->head, head, new_head); | 66 | ret = cmpxchg(&pa->head, head, new_head); |
67 | if (ret == head) { | 67 | if (ret == head) { |
68 | addr = pa->base + head * pa->blk_size; | 68 | addr = pa->base + head * pa->blk_size; |
@@ -71,7 +71,7 @@ static u64 nvgpu_lockless_alloc(struct nvgpu_allocator *a, u64 len) | |||
71 | addr); | 71 | addr); |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | head = ACCESS_ONCE(pa->head); | 74 | head = NV_ACCESS_ONCE(pa->head); |
75 | } | 75 | } |
76 | 76 | ||
77 | if (addr) | 77 | if (addr) |
@@ -93,8 +93,8 @@ static void nvgpu_lockless_free(struct nvgpu_allocator *a, u64 addr) | |||
93 | alloc_dbg(a, "Free node # %llu @ addr 0x%llx\n", cur_idx, addr); | 93 | alloc_dbg(a, "Free node # %llu @ addr 0x%llx\n", cur_idx, addr); |
94 | 94 | ||
95 | while (1) { | 95 | while (1) { |
96 | head = ACCESS_ONCE(pa->head); | 96 | head = NV_ACCESS_ONCE(pa->head); |
97 | ACCESS_ONCE(pa->next[cur_idx]) = head; | 97 | NV_ACCESS_ONCE(pa->next[cur_idx]) = head; |
98 | ret = cmpxchg(&pa->head, head, cur_idx); | 98 | ret = cmpxchg(&pa->head, head, cur_idx); |
99 | if (ret == head) { | 99 | if (ret == head) { |
100 | nvgpu_atomic_dec(&pa->nr_allocs); | 100 | nvgpu_atomic_dec(&pa->nr_allocs); |
diff --git a/drivers/gpu/nvgpu/common/pmu/pmu.c b/drivers/gpu/nvgpu/common/pmu/pmu.c index 63597d10..89216ea2 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu.c | |||
@@ -413,7 +413,7 @@ static int nvgpu_pg_init_task(void *arg) | |||
413 | (pg_init->state_change == true), 0); | 413 | (pg_init->state_change == true), 0); |
414 | 414 | ||
415 | pmu->pg_init.state_change = false; | 415 | pmu->pg_init.state_change = false; |
416 | pmu_state = ACCESS_ONCE(pmu->pmu_state); | 416 | pmu_state = NV_ACCESS_ONCE(pmu->pmu_state); |
417 | 417 | ||
418 | if (pmu_state == PMU_STATE_EXIT) { | 418 | if (pmu_state == PMU_STATE_EXIT) { |
419 | nvgpu_pmu_dbg(g, "pmu state exit"); | 419 | nvgpu_pmu_dbg(g, "pmu state exit"); |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/barrier.h b/drivers/gpu/nvgpu/include/nvgpu/barrier.h index 26eec3ed..01d8a9cf 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/barrier.h +++ b/drivers/gpu/nvgpu/include/nvgpu/barrier.h | |||
@@ -37,4 +37,6 @@ | |||
37 | #define nvgpu_read_barrier_depends() __nvgpu_read_barrier_depends() | 37 | #define nvgpu_read_barrier_depends() __nvgpu_read_barrier_depends() |
38 | #define nvgpu_smp_read_barrier_depends() __nvgpu_smp_read_barrier_depends() | 38 | #define nvgpu_smp_read_barrier_depends() __nvgpu_smp_read_barrier_depends() |
39 | 39 | ||
40 | #define NV_ACCESS_ONCE(x) __NV_ACCESS_ONCE(x) | ||
41 | |||
40 | #endif /* __NVGPU_BARRIER_H__ */ | 42 | #endif /* __NVGPU_BARRIER_H__ */ |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/barrier.h b/drivers/gpu/nvgpu/include/nvgpu/linux/barrier.h index e7b83ee8..b20f9462 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/linux/barrier.h +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/barrier.h | |||
@@ -30,4 +30,6 @@ | |||
30 | #define __nvgpu_read_barrier_depends() read_barrier_depends() | 30 | #define __nvgpu_read_barrier_depends() read_barrier_depends() |
31 | #define __nvgpu_smp_read_barrier_depends() smp_read_barrier_depends() | 31 | #define __nvgpu_smp_read_barrier_depends() smp_read_barrier_depends() |
32 | 32 | ||
33 | #define __NV_ACCESS_ONCE(x) ACCESS_ONCE(x) | ||
34 | |||
33 | #endif /* __NVGPU_BARRIER_LINUX_H__ */ | 35 | #endif /* __NVGPU_BARRIER_LINUX_H__ */ |