diff options
Diffstat (limited to 'drivers/gpu/nvgpu/lpwr/lpwr.c')
-rw-r--r-- | drivers/gpu/nvgpu/lpwr/lpwr.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/lpwr/lpwr.c b/drivers/gpu/nvgpu/lpwr/lpwr.c index 4f8d2eec..e3483cca 100644 --- a/drivers/gpu/nvgpu/lpwr/lpwr.c +++ b/drivers/gpu/nvgpu/lpwr/lpwr.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -362,8 +362,11 @@ int nvgpu_lpwr_enable_pg(struct gk20a *g, bool pstate_lock) | |||
362 | is_mscg_supported = nvgpu_lpwr_is_mscg_supported(g, | 362 | is_mscg_supported = nvgpu_lpwr_is_mscg_supported(g, |
363 | present_pstate); | 363 | present_pstate); |
364 | if (is_mscg_supported && g->mscg_enabled) { | 364 | if (is_mscg_supported && g->mscg_enabled) { |
365 | if (!pmu->mscg_stat) | 365 | if (!ACCESS_ONCE(pmu->mscg_stat)) { |
366 | pmu->mscg_stat = PMU_MSCG_ENABLED; | 366 | WRITE_ONCE(pmu->mscg_stat, PMU_MSCG_ENABLED); |
367 | /* make status visible */ | ||
368 | smp_mb(); | ||
369 | } | ||
367 | } | 370 | } |
368 | 371 | ||
369 | is_rppg_supported = nvgpu_lpwr_is_rppg_supported(g, | 372 | is_rppg_supported = nvgpu_lpwr_is_rppg_supported(g, |
@@ -409,8 +412,11 @@ int nvgpu_lpwr_disable_pg(struct gk20a *g, bool pstate_lock) | |||
409 | is_mscg_supported = nvgpu_lpwr_is_mscg_supported(g, | 412 | is_mscg_supported = nvgpu_lpwr_is_mscg_supported(g, |
410 | present_pstate); | 413 | present_pstate); |
411 | if (is_mscg_supported && g->mscg_enabled) { | 414 | if (is_mscg_supported && g->mscg_enabled) { |
412 | if (pmu->mscg_stat) | 415 | if (ACCESS_ONCE(pmu->mscg_stat)) { |
413 | pmu->mscg_stat = PMU_MSCG_DISABLED; | 416 | WRITE_ONCE(pmu->mscg_stat, PMU_MSCG_DISABLED); |
417 | /* make status visible */ | ||
418 | smp_mb(); | ||
419 | } | ||
414 | } | 420 | } |
415 | 421 | ||
416 | exit_unlock: | 422 | exit_unlock: |