Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions drivers/gpu/drm/v3d/v3d_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ static bool v3d_mmu_is_aligned(u32 page, u32 page_address, size_t alignment)
IS_ALIGNED(page_address, alignment >> V3D_MMU_PAGE_SHIFT);
}

int v3d_mmu_flush_all(struct v3d_dev *v3d)
/*
* Issue the MMUC flush and TLB clear unconditionally. The caller must
* already know that V3D is reachable - in particular, this is used from
* the runtime resume callback, where runtime_status is RPM_RESUMING and
* pm_runtime_get_if_active() therefore returns 0.
*/
static int v3d_mmu_flush_all_locked(struct v3d_dev *v3d)
{
int ret = 0;

/* Flush the PTs only if we're already awake */
if (!pm_runtime_get_if_active(v3d->drm.dev))
return 0;
int ret;

V3D_WRITE(V3D_MMUC_CONTROL, V3D_MMUC_CONTROL_FLUSH |
V3D_MMUC_CONTROL_ENABLE);
Expand All @@ -50,7 +52,7 @@ int v3d_mmu_flush_all(struct v3d_dev *v3d)
V3D_MMUC_CONTROL_FLUSHING), 100);
if (ret) {
dev_err(v3d->drm.dev, "MMUC flush wait idle failed\n");
goto pm_put;
return ret;
}

V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL) |
Expand All @@ -61,7 +63,19 @@ int v3d_mmu_flush_all(struct v3d_dev *v3d)
if (ret)
dev_err(v3d->drm.dev, "MMU TLB clear wait idle failed\n");

pm_put:
return ret;
}

int v3d_mmu_flush_all(struct v3d_dev *v3d)
{
int ret;

/* Flush the PTs only if we're already awake */
if (!pm_runtime_get_if_active(v3d->drm.dev))
return 0;

ret = v3d_mmu_flush_all_locked(v3d);

v3d_pm_runtime_put(v3d);
return ret;
}
Expand All @@ -83,7 +97,7 @@ int v3d_mmu_set_page_table(struct v3d_dev *v3d)
V3D_MMU_ILLEGAL_ADDR_ENABLE);
V3D_WRITE(V3D_MMUC_CONTROL, V3D_MMUC_CONTROL_ENABLE);

return v3d_mmu_flush_all(v3d);
return v3d_mmu_flush_all_locked(v3d);
}

void v3d_mmu_insert_ptes(struct v3d_bo *bo)
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/v3d/v3d_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ int v3d_power_resume(struct device *dev)
}

v3d_resume_sms(v3d);

v3d_init_hw_state(v3d);
v3d_mmu_set_page_table(v3d);
v3d_irq_enable(v3d);

Expand Down
2 changes: 1 addition & 1 deletion drivers/pmdomain/bcm/bcm2835-power.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
writel(PM_PASSWORD | val, base + reg);

if (readl_poll_timeout_atomic(base + reg, val,
!!(val & ASB_ACK) != enable, 0, 5))
!!(val & ASB_ACK) != enable, 0, 500))
return -ETIMEDOUT;

return 0;
Expand Down
Loading