gpu: nvgpu: linux: read current syncpt in set safe state

nvhost_syncpt_read_minval() only reads the min value that nvhost has
cached. It makes sense for host managed syncpoints, but the user
syncpoint that needs set_safe_state is client managed; its min and max
values are not tracked internally. Use nvhost_syncpt_read_ext_check() to
read the actual syncpoint value from HW and set the "safe state" (65536
increments) based on that.

The safe state is analogous to "set min equal to max" when max is
expected to be no more than the current value plus a big number. Using
the cached min value would make this safe state lose its meaning when
there could have been more than the big number of increments since the
syncpoint was allocated.

Jira NVGPU-4548

Change-Id: I395be75f1696e48e344f5503420864efeb3621de
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2323060
(cherry picked from commit ae571178ca63c4fa3e6bf70a4da0221393e975ee)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2326380
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Hölttä
2020-04-03 08:34:45 +03:00
committed by Alex Waterman
parent 2d9b839f21
commit 32fae6acf4

View File

@@ -178,7 +178,8 @@ u32 nvgpu_nvhost_syncpt_read_maxval(
void nvgpu_nvhost_syncpt_set_safe_state( void nvgpu_nvhost_syncpt_set_safe_state(
struct nvgpu_nvhost_dev *nvhost_dev, u32 id) struct nvgpu_nvhost_dev *nvhost_dev, u32 id)
{ {
u32 val; u32 val = 0;
int err;
/* /*
* Add large number of increments to current value * Add large number of increments to current value
@@ -187,12 +188,17 @@ void nvgpu_nvhost_syncpt_set_safe_state(
* We don't expect any case where more than 0x10000 increments * We don't expect any case where more than 0x10000 increments
* are pending * are pending
*/ */
val = nvhost_syncpt_read_minval(nvhost_dev->host1x_pdev, id); err = nvhost_syncpt_read_ext_check(nvhost_dev->host1x_pdev,
id, &val);
if (err != 0) {
pr_err("%s: syncpt id read failed, cannot reset for safe state",
__func__);
} else {
val += 0x10000; val += 0x10000;
nvhost_syncpt_set_minval(nvhost_dev->host1x_pdev, id, val); nvhost_syncpt_set_minval(nvhost_dev->host1x_pdev, id, val);
nvhost_syncpt_set_maxval(nvhost_dev->host1x_pdev, id, val); nvhost_syncpt_set_maxval(nvhost_dev->host1x_pdev, id, val);
} }
}
int nvgpu_nvhost_create_symlink(struct gk20a *g) int nvgpu_nvhost_create_symlink(struct gk20a *g)
{ {