Skip to content

Commit

Permalink
Merge tag 'drm-fixes-2020-03-06' of git://anongit.freedesktop.org/drm…
Browse files Browse the repository at this point in the history
…/drm

Pull drm fixes from Dave Airlie:
 "Weekly fixes round, looks like a few people woke up, got a bunch of
  fixes across the drivers. Bit bigger than I'd like but they all seem
  fine and hopefully it quiets down now.

  sun4i, kirin, mediatek and exynos on the ARM side. virtio-gpu and core
  have some mmap fixes, and there is a dma-buf leak. one ttm fence leak
  is also fixed.

  Otherwise it's mostly amdgpu and i915.

  One of the i915 fixes is for a very long latency I was seeing (using
  latencytop) running gnome-shell locally when using firefox and eating
  nearly all my RAM, it really helps with desktop responsiveness esp
  when firefox is chewing a lot.

  dma-buf:
   - fix memory leak

  core:
   - shmem object mmap fix.

  ttm:
   - Fix fence leak in ttm_buffer_object_transfer().

  amdgpu:
   - Gfx reset fix for gfx9, 10
   - Fix for gfx10
   - DP MST fix
   - DCC fix
   - Renoir power fixes
   - Navi power fix

  i915:
   - Break up long lists of object reclaim with cond_resched()
   - PSR probe fix
   - TGL workarounds
   - Selftest return value fix
   - Drop timeline mutex while waiting for retirement
   - Wait for OA configuration completion before writes to OA buffer

  virtio:
   - Fix resource id creation race in virtio.
   - mmap fixes

  sun4i:
   - Fixes for sun4i VI layer format support.

  kirin:
   - kirin: Revert "Fix for hikey620 display offset problem"

  exynos:
   - fix a kernel oops problem in case that driver is loaded as module.
   - fix a regulator warning issue when I2C DDC adapter cannot be gathered.
   - print out an error message only in error case excepting -EPROBE_DEFER.

  mediatek:
   - overlay, cursor and gce fixes"
`

* tag 'drm-fixes-2020-03-06' of git://anongit.freedesktop.org/drm/drm: (38 commits)
  drm/amdgpu/display: navi1x copy dcn watermark clock settings to smu resume from s3 (v2)
  drm/amd/powerplay: map mclk to fclk for COMBINATIONAL_BYPASS case
  drm/amd/powerplay: fix pre-check condition for setting clock range
  drm/amd/display: fix dcc swath size calculations on dcn1
  drm/amd/display: Clear link settings on MST disable connector
  drm/amdgpu: disable 3D pipe 1 on Navi1x
  drm/amdgpu: clean wptr on wb when gpu recovery
  drm: kirin: Revert "Fix for hikey620 display offset problem"
  drm/i915/gt: Drop the timeline->mutex as we wait for retirement
  drm/i915/perf: Reintroduce wait on OA configuration completion
  drm/sun4i: Fix DE2 VI layer format support
  drm/sun4i: Add separate DE3 VI layer formats
  drm/sun4i: de2/de3: Remove unsupported VI layer formats
  drm/i915/selftests: Fix return in assert_mmap_offset()
  drm/i915: Protect i915_request_await_start from early waits
  drm/i915/tgl: Add Wa_1608008084
  drm/i915/tgl: Add Wa_22010178259:tgl
  drm/i915: Program MBUS with rmw during initialization
  drm/i915/psr: Force PSR probe only after full initialization
  drm/i915/gem: Break up long lists of object reclaim
  ...
  • Loading branch information
torvalds committed Mar 6, 2020
2 parents 9f65ed5 + 2ac4853 commit ba0ae9a
Show file tree
Hide file tree
Showing 38 changed files with 520 additions and 212 deletions.
1 change: 1 addition & 0 deletions drivers/dma-buf/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ static int dma_buf_release(struct inode *inode, struct file *file)
dma_resv_fini(dmabuf->resv);

module_put(dmabuf->owner);
kfree(dmabuf->name);
kfree(dmabuf);
return 0;
}
Expand Down
98 changes: 52 additions & 46 deletions drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* 1. Primary ring
* 2. Async ring
*/
#define GFX10_NUM_GFX_RINGS 2
#define GFX10_NUM_GFX_RINGS_NV1X 1
#define GFX10_MEC_HPD_SIZE 2048

#define F32_CE_PROGRAM_RAM_SIZE 65536
Expand Down Expand Up @@ -1304,7 +1304,7 @@ static int gfx_v10_0_sw_init(void *handle)
case CHIP_NAVI14:
case CHIP_NAVI12:
adev->gfx.me.num_me = 1;
adev->gfx.me.num_pipe_per_me = 2;
adev->gfx.me.num_pipe_per_me = 1;
adev->gfx.me.num_queue_per_pipe = 1;
adev->gfx.mec.num_mec = 2;
adev->gfx.mec.num_pipe_per_mec = 4;
Expand Down Expand Up @@ -2710,18 +2710,20 @@ static int gfx_v10_0_cp_gfx_start(struct amdgpu_device *adev)
amdgpu_ring_commit(ring);

/* submit cs packet to copy state 0 to next available state */
ring = &adev->gfx.gfx_ring[1];
r = amdgpu_ring_alloc(ring, 2);
if (r) {
DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r);
return r;
}

amdgpu_ring_write(ring, PACKET3(PACKET3_CLEAR_STATE, 0));
amdgpu_ring_write(ring, 0);
if (adev->gfx.num_gfx_rings > 1) {
/* maximum supported gfx ring is 2 */
ring = &adev->gfx.gfx_ring[1];
r = amdgpu_ring_alloc(ring, 2);
if (r) {
DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r);
return r;
}

amdgpu_ring_commit(ring);
amdgpu_ring_write(ring, PACKET3(PACKET3_CLEAR_STATE, 0));
amdgpu_ring_write(ring, 0);

amdgpu_ring_commit(ring);
}
return 0;
}

Expand Down Expand Up @@ -2818,39 +2820,41 @@ static int gfx_v10_0_cp_gfx_resume(struct amdgpu_device *adev)
mutex_unlock(&adev->srbm_mutex);

/* Init gfx ring 1 for pipe 1 */
mutex_lock(&adev->srbm_mutex);
gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID1);
ring = &adev->gfx.gfx_ring[1];
rb_bufsz = order_base_2(ring->ring_size / 8);
tmp = REG_SET_FIELD(0, CP_RB1_CNTL, RB_BUFSZ, rb_bufsz);
tmp = REG_SET_FIELD(tmp, CP_RB1_CNTL, RB_BLKSZ, rb_bufsz - 2);
WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);
/* Initialize the ring buffer's write pointers */
ring->wptr = 0;
WREG32_SOC15(GC, 0, mmCP_RB1_WPTR, lower_32_bits(ring->wptr));
WREG32_SOC15(GC, 0, mmCP_RB1_WPTR_HI, upper_32_bits(ring->wptr));
/* Set the wb address wether it's enabled or not */
rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);
WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr));
WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) &
CP_RB1_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK);
wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs * 4);
WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_LO,
lower_32_bits(wptr_gpu_addr));
WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_HI,
upper_32_bits(wptr_gpu_addr));

mdelay(1);
WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);

rb_addr = ring->gpu_addr >> 8;
WREG32_SOC15(GC, 0, mmCP_RB1_BASE, rb_addr);
WREG32_SOC15(GC, 0, mmCP_RB1_BASE_HI, upper_32_bits(rb_addr));
WREG32_SOC15(GC, 0, mmCP_RB1_ACTIVE, 1);

gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
mutex_unlock(&adev->srbm_mutex);

if (adev->gfx.num_gfx_rings > 1) {
mutex_lock(&adev->srbm_mutex);
gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID1);
/* maximum supported gfx ring is 2 */
ring = &adev->gfx.gfx_ring[1];
rb_bufsz = order_base_2(ring->ring_size / 8);
tmp = REG_SET_FIELD(0, CP_RB1_CNTL, RB_BUFSZ, rb_bufsz);
tmp = REG_SET_FIELD(tmp, CP_RB1_CNTL, RB_BLKSZ, rb_bufsz - 2);
WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);
/* Initialize the ring buffer's write pointers */
ring->wptr = 0;
WREG32_SOC15(GC, 0, mmCP_RB1_WPTR, lower_32_bits(ring->wptr));
WREG32_SOC15(GC, 0, mmCP_RB1_WPTR_HI, upper_32_bits(ring->wptr));
/* Set the wb address wether it's enabled or not */
rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);
WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr));
WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) &
CP_RB1_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK);
wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs * 4);
WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_LO,
lower_32_bits(wptr_gpu_addr));
WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_HI,
upper_32_bits(wptr_gpu_addr));

mdelay(1);
WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);

rb_addr = ring->gpu_addr >> 8;
WREG32_SOC15(GC, 0, mmCP_RB1_BASE, rb_addr);
WREG32_SOC15(GC, 0, mmCP_RB1_BASE_HI, upper_32_bits(rb_addr));
WREG32_SOC15(GC, 0, mmCP_RB1_ACTIVE, 1);

gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
mutex_unlock(&adev->srbm_mutex);
}
/* Switch to pipe 0 */
mutex_lock(&adev->srbm_mutex);
gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID0);
Expand Down Expand Up @@ -3513,6 +3517,7 @@ static int gfx_v10_0_kcq_init_queue(struct amdgpu_ring *ring)

/* reset ring buffer */
ring->wptr = 0;
atomic64_set((atomic64_t *)&adev->wb.wb[ring->wptr_offs], 0);
amdgpu_ring_clear_ring(ring);
} else {
amdgpu_ring_clear_ring(ring);
Expand Down Expand Up @@ -3966,7 +3971,8 @@ static int gfx_v10_0_early_init(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;

adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS;
adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS_NV1X;

adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;

gfx_v10_0_set_kiq_pm4_funcs(adev);
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -3663,6 +3663,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)

/* reset ring buffer */
ring->wptr = 0;
atomic64_set((atomic64_t *)&adev->wb.wb[ring->wptr_offs], 0);
amdgpu_ring_clear_ring(ring);
} else {
amdgpu_ring_clear_ring(ring);
Expand Down
69 changes: 69 additions & 0 deletions drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,73 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend)
drm_kms_helper_hotplug_event(dev);
}

static int amdgpu_dm_smu_write_watermarks_table(struct amdgpu_device *adev)
{
struct smu_context *smu = &adev->smu;
int ret = 0;

if (!is_support_sw_smu(adev))
return 0;

/* This interface is for dGPU Navi1x.Linux dc-pplib interface depends
* on window driver dc implementation.
* For Navi1x, clock settings of dcn watermarks are fixed. the settings
* should be passed to smu during boot up and resume from s3.
* boot up: dc calculate dcn watermark clock settings within dc_create,
* dcn20_resource_construct
* then call pplib functions below to pass the settings to smu:
* smu_set_watermarks_for_clock_ranges
* smu_set_watermarks_table
* navi10_set_watermarks_table
* smu_write_watermarks_table
*
* For Renoir, clock settings of dcn watermark are also fixed values.
* dc has implemented different flow for window driver:
* dc_hardware_init / dc_set_power_state
* dcn10_init_hw
* notify_wm_ranges
* set_wm_ranges
* -- Linux
* smu_set_watermarks_for_clock_ranges
* renoir_set_watermarks_table
* smu_write_watermarks_table
*
* For Linux,
* dc_hardware_init -> amdgpu_dm_init
* dc_set_power_state --> dm_resume
*
* therefore, this function apply to navi10/12/14 but not Renoir
* *
*/
switch(adev->asic_type) {
case CHIP_NAVI10:
case CHIP_NAVI14:
case CHIP_NAVI12:
break;
default:
return 0;
}

mutex_lock(&smu->mutex);

/* pass data to smu controller */
if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
!(smu->watermarks_bitmap & WATERMARKS_LOADED)) {
ret = smu_write_watermarks_table(smu);

if (ret) {
mutex_unlock(&smu->mutex);
DRM_ERROR("Failed to update WMTABLE!\n");
return ret;
}
smu->watermarks_bitmap |= WATERMARKS_LOADED;
}

mutex_unlock(&smu->mutex);

return 0;
}

/**
* dm_hw_init() - Initialize DC device
* @handle: The base driver device containing the amdgpu_dm device.
Expand Down Expand Up @@ -1700,6 +1767,8 @@ static int dm_resume(void *handle)

amdgpu_dm_irq_resume_late(adev);

amdgpu_dm_smu_write_watermarks_table(adev);

return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ static void dm_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
aconnector->dc_sink);
dc_sink_release(aconnector->dc_sink);
aconnector->dc_sink = NULL;
aconnector->dc_link->cur_link_settings.lane_count = 0;
}

drm_connector_unregister(connector);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,8 @@ static void hubbub1_det_request_size(

hubbub1_get_blk256_size(&blk256_width, &blk256_height, bpe);

swath_bytes_horz_wc = height * blk256_height * bpe;
swath_bytes_vert_wc = width * blk256_width * bpe;
swath_bytes_horz_wc = width * blk256_height * bpe;
swath_bytes_vert_wc = height * blk256_width * bpe;

*req128_horz_wc = (2 * swath_bytes_horz_wc <= detile_buf_size) ?
false : /* full 256B request */
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
{
int ret = 0;

if (min <= 0 && max <= 0)
if (min < 0 && max < 0)
return -EINVAL;

if (!smu_clk_dpm_is_enabled(smu, clk_type))
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/amd/powerplay/renoir_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ static struct smu_12_0_cmn2aisc_mapping renoir_clk_map[SMU_CLK_COUNT] = {
CLK_MAP(GFXCLK, CLOCK_GFXCLK),
CLK_MAP(SCLK, CLOCK_GFXCLK),
CLK_MAP(SOCCLK, CLOCK_SOCCLK),
CLK_MAP(UCLK, CLOCK_UMCCLK),
CLK_MAP(MCLK, CLOCK_UMCCLK),
CLK_MAP(UCLK, CLOCK_FCLK),
CLK_MAP(MCLK, CLOCK_FCLK),
};

static struct smu_12_0_cmn2aisc_mapping renoir_table_map[SMU_TABLE_COUNT] = {
Expand Down Expand Up @@ -280,7 +280,7 @@ static int renoir_print_clk_levels(struct smu_context *smu,
break;
case SMU_MCLK:
count = NUM_MEMCLK_DPM_LEVELS;
cur_value = metrics.ClockFrequency[CLOCK_UMCCLK];
cur_value = metrics.ClockFrequency[CLOCK_FCLK];
break;
case SMU_DCEFCLK:
count = NUM_DCFCLK_DPM_LEVELS;
Expand Down
3 changes: 0 additions & 3 deletions drivers/gpu/drm/amd/powerplay/smu_v12_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,6 @@ int smu_v12_0_set_soft_freq_limited_range(struct smu_context *smu, enum smu_clk_
{
int ret = 0;

if (max < min)
return -EINVAL;

switch (clk_type) {
case SMU_GFXCLK:
case SMU_SCLK:
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ static int anx6345_dp_link_training(struct anx6345 *anx6345)
if (err)
return err;

dpcd[0] = drm_dp_max_link_rate(anx6345->dpcd);
dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]);
dpcd[0] = dp_bw;
err = regmap_write(anx6345->map[I2C_IDX_DPTX],
SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]);
if (err)
Expand Down
16 changes: 11 additions & 5 deletions drivers/gpu/drm/drm_gem_shmem_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,16 @@ static void *drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem)
if (ret)
goto err_zero_use;

if (obj->import_attach)
if (obj->import_attach) {
shmem->vaddr = dma_buf_vmap(obj->import_attach->dmabuf);
else
} else {
pgprot_t prot = PAGE_KERNEL;

if (!shmem->map_cached)
prot = pgprot_writecombine(prot);
shmem->vaddr = vmap(shmem->pages, obj->size >> PAGE_SHIFT,
VM_MAP, pgprot_writecombine(PAGE_KERNEL));
VM_MAP, prot);
}

if (!shmem->vaddr) {
DRM_DEBUG_KMS("Failed to vmap pages\n");
Expand Down Expand Up @@ -540,8 +545,9 @@ int drm_gem_shmem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
}

vma->vm_flags |= VM_MIXEDMAP | VM_DONTEXPAND;
vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
if (!shmem->map_cached)
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
vma->vm_ops = &drm_gem_shmem_vm_ops;

return 0;
Expand Down
12 changes: 7 additions & 5 deletions drivers/gpu/drm/exynos/exynos_drm_dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1773,8 +1773,9 @@ static int exynos_dsi_probe(struct platform_device *pdev)
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(dsi->supplies),
dsi->supplies);
if (ret) {
dev_info(dev, "failed to get regulators: %d\n", ret);
return -EPROBE_DEFER;
if (ret != -EPROBE_DEFER)
dev_info(dev, "failed to get regulators: %d\n", ret);
return ret;
}

dsi->clks = devm_kcalloc(dev,
Expand All @@ -1787,9 +1788,10 @@ static int exynos_dsi_probe(struct platform_device *pdev)
dsi->clks[i] = devm_clk_get(dev, clk_names[i]);
if (IS_ERR(dsi->clks[i])) {
if (strcmp(clk_names[i], "sclk_mipi") == 0) {
strcpy(clk_names[i], OLD_SCLK_MIPI_CLK_NAME);
i--;
continue;
dsi->clks[i] = devm_clk_get(dev,
OLD_SCLK_MIPI_CLK_NAME);
if (!IS_ERR(dsi->clks[i]))
continue;
}

dev_info(dev, "failed to get the clock: %s\n",
Expand Down
Loading

0 comments on commit ba0ae9a

Please sign in to comment.