drm fixes for 5.13-rc8/final
radeon/nouveau/amdgpu/ttm: - same fix in 3 drivers to wait for BO to be pinned after moving it. core: - auth locking change + brown paper bag revert amdgpu: - Revert GFX9, 10 doorbell fixes, we just end up trading one bug for another - Potential memory corruption fix in framebuffer handling nouveau: - fix regression checking dma addresses kmb: - error return fix atmel-hlcdc: - fix kernel warnings at boot - enable async flips vc4: - fix CPU hang due to power management -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEEKbZHaGwW9KfbeusDHTzWXnEhr4FAmDU5zkACgkQDHTzWXnE hr55/w//WEVZ5RiGC4XDphPDol4drYDIcM+JncbJUbpSjJyglxiiVMLcYgWW6yBF 7VsI45Eb+cZ6VKltRhKFod3sLrriy8u4rsbykRw8ilztLr5ihGUs+yt9WBkqXSVS OV6sRq6d0hLzW3y4R44sn7m2hIfCs6deYbe/qd8bzWrPzdqkJNpWUFe7K+nHHltc BeoXPbBUwc+whitCZjg81TvC63HN2oxnAVVYeSq0uRYZ79GUHkO5mcHGnVQTNt8+ 2zctF18jUTmNxhcxDUR6bg6egvZtK/R7g4UvS9VM8JHSs/VeiYQto4UjTP9Sc7mZ D6j/t7lkNStntJTiZKC6x6ZHPlfIu2ZfZsUw3dH2InbgpxHQIilgCYQUrMyIkQaE 6sgGY78uLCJUwlMGuXqzK99d11fe9+1Fx3BAmbpCpGcRlloiNxoe9zEXpajZGlGI HDUr78hdLRpo4jUzSChv9HWK6zicv3A9PtJtd5TzYQX3Iur/dxS1ycKSv+tYpz7A Y4ATIwYZnxS5L0rZSUitpJ3k9sKgH4c8RyAADnql+QRiyR/fxrHhthrnVvCOymWn u66xW3FS8rciueYNHdHXQ2myODffB4HpCrZNE5TCIUcS0aS/kQ3TKd96YBPnIykD USAvSXDGmz5+mrBv1IQlnZlHt59Bbe0NJEL9YKO4ms/TwZ+U0pA= =YqKA -----END PGP SIGNATURE----- Merge tag 'drm-fixes-2021-06-25' of git://anongit.freedesktop.org/drm/drm Pull drm fixes from Dave Airlie: "This is a bit bigger than I'd like at this stage, and I guess last week was extra quiet, but it's mostly one fix across three drivers to wait for buffer move pinning to complete. There was one locking change that got reverted so it's just noise. Otherwise the amdgpu/nouveau changes are for known regressions, and otherwise it's just misc changes in kmb/atmel/vc4 drivers. Summary: core: - auth locking change + brown paper bag revert radeon/nouveau/amdgpu/ttm: - wait for BO to be pinned after moving it (same fix in three drivers) amdgpu: - Revert GFX9/10 doorbell fixes, we just end up trading one bug for another - Potential memory corruption fix in framebuffer handling nouveau: - fix regression checking dma addresses kmb: - error return fix atmel-hlcdc: - fix kernel warnings at boot - enable async flips vc4: - fix CPU hang due to power management" * tag 'drm-fixes-2021-06-25' of git://anongit.freedesktop.org/drm/drm: drm/nouveau: fix dma_address check for CPU/GPU sync drm/kmb: Fix error return code in kmb_hw_init() drm/amdgpu: wait for moving fence after pinning drm/radeon: wait for moving fence after pinning drm/nouveau: wait for moving fence after pinning v2 Revert "drm: add a locked version of drm_is_current_master" Revert "drm/amdgpu/gfx9: fix the doorbell missing when in CGPG issue." Revert "drm/amdgpu/gfx10: enlarge CP_MEC_DOORBELL_RANGE_UPPER to cover full doorbell." drm/amdgpu: Call drm_framebuffer_init last for framebuffer init drm: add a locked version of drm_is_current_master drm/atmel-hlcdc: Allow async page flips drm/panel: ld9040: reference spi_device_id table drm: atmel_hlcdc: Enable the crtc vblank prior to crtc usage. drm/vc4: hdmi: Make sure the controller is powered in detect drm/vc4: hdmi: Move the HSM clock enable to runtime_pm
This commit is contained in:
commit
44db63d1ad
|
@ -1047,11 +1047,12 @@ int amdgpu_display_gem_fb_init(struct drm_device *dev,
|
|||
|
||||
rfb->base.obj[0] = obj;
|
||||
drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
|
||||
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
|
||||
|
||||
ret = amdgpu_display_framebuffer_init(dev, rfb, mode_cmd, obj);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = amdgpu_display_framebuffer_init(dev, rfb, mode_cmd, obj);
|
||||
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
@ -1071,9 +1072,6 @@ int amdgpu_display_gem_fb_verify_and_init(
|
|||
|
||||
rfb->base.obj[0] = obj;
|
||||
drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
|
||||
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
|
||||
if (ret)
|
||||
goto err;
|
||||
/* Verify that the modifier is supported. */
|
||||
if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format,
|
||||
mode_cmd->modifier[0])) {
|
||||
|
@ -1092,6 +1090,10 @@ int amdgpu_display_gem_fb_verify_and_init(
|
|||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
drm_dbg_kms(dev, "Failed to verify and init gem fb: %d\n", ret);
|
||||
|
|
|
@ -214,9 +214,21 @@ static int amdgpu_dma_buf_pin(struct dma_buf_attachment *attach)
|
|||
{
|
||||
struct drm_gem_object *obj = attach->dmabuf->priv;
|
||||
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
|
||||
int r;
|
||||
|
||||
/* pin buffer into GTT */
|
||||
return amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
|
||||
r = amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (bo->tbo.moving) {
|
||||
r = dma_fence_wait(bo->tbo.moving, true);
|
||||
if (r) {
|
||||
amdgpu_bo_unpin(bo);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6871,12 +6871,8 @@ static int gfx_v10_0_kiq_init_register(struct amdgpu_ring *ring)
|
|||
if (ring->use_doorbell) {
|
||||
WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,
|
||||
(adev->doorbell_index.kiq * 2) << 2);
|
||||
/* If GC has entered CGPG, ringing doorbell > first page doesn't
|
||||
* wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround
|
||||
* this issue.
|
||||
*/
|
||||
WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,
|
||||
(adev->doorbell.size - 4));
|
||||
(adev->doorbell_index.userqueue_end * 2) << 2);
|
||||
}
|
||||
|
||||
WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
|
||||
|
|
|
@ -3673,12 +3673,8 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)
|
|||
if (ring->use_doorbell) {
|
||||
WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,
|
||||
(adev->doorbell_index.kiq * 2) << 2);
|
||||
/* If GC has entered CGPG, ringing doorbell > first page doesn't
|
||||
* wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround
|
||||
* this issue.
|
||||
*/
|
||||
WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,
|
||||
(adev->doorbell.size - 4));
|
||||
(adev->doorbell_index.userqueue_end * 2) << 2);
|
||||
}
|
||||
|
||||
WREG32_SOC15_RLC(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
|
||||
|
|
|
@ -232,7 +232,6 @@ static void atmel_hlcdc_crtc_atomic_enable(struct drm_crtc *c,
|
|||
|
||||
pm_runtime_put_sync(dev->dev);
|
||||
|
||||
drm_crtc_vblank_on(c);
|
||||
}
|
||||
|
||||
#define ATMEL_HLCDC_RGB444_OUTPUT BIT(0)
|
||||
|
@ -343,8 +342,17 @@ static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c,
|
|||
|
||||
static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
drm_crtc_vblank_on(c);
|
||||
}
|
||||
|
||||
static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *c,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&c->dev->event_lock, flags);
|
||||
|
||||
if (c->state->event) {
|
||||
c->state->event->pipe = drm_crtc_index(c);
|
||||
|
@ -354,12 +362,7 @@ static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c,
|
|||
crtc->event = c->state->event;
|
||||
c->state->event = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
/* TODO: write common plane control register if available */
|
||||
spin_unlock_irqrestore(&c->dev->event_lock, flags);
|
||||
}
|
||||
|
||||
static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = {
|
||||
|
|
|
@ -593,6 +593,7 @@ static int atmel_hlcdc_dc_modeset_init(struct drm_device *dev)
|
|||
dev->mode_config.max_width = dc->desc->max_width;
|
||||
dev->mode_config.max_height = dc->desc->max_height;
|
||||
dev->mode_config.funcs = &mode_config_funcs;
|
||||
dev->mode_config.async_page_flip = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ static int kmb_hw_init(struct drm_device *drm, unsigned long flags)
|
|||
/* Allocate LCD interrupt resources */
|
||||
irq_lcd = platform_get_irq(pdev, 0);
|
||||
if (irq_lcd < 0) {
|
||||
ret = irq_lcd;
|
||||
drm_err(&kmb->drm, "irq_lcd not found");
|
||||
goto setup_fail;
|
||||
}
|
||||
|
|
|
@ -546,7 +546,7 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo)
|
|||
struct ttm_tt *ttm_dma = (struct ttm_tt *)nvbo->bo.ttm;
|
||||
int i, j;
|
||||
|
||||
if (!ttm_dma)
|
||||
if (!ttm_dma || !ttm_dma->dma_address)
|
||||
return;
|
||||
if (!ttm_dma->pages) {
|
||||
NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma);
|
||||
|
@ -582,7 +582,7 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo)
|
|||
struct ttm_tt *ttm_dma = (struct ttm_tt *)nvbo->bo.ttm;
|
||||
int i, j;
|
||||
|
||||
if (!ttm_dma)
|
||||
if (!ttm_dma || !ttm_dma->dma_address)
|
||||
return;
|
||||
if (!ttm_dma->pages) {
|
||||
NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma);
|
||||
|
|
|
@ -93,7 +93,22 @@ int nouveau_gem_prime_pin(struct drm_gem_object *obj)
|
|||
if (ret)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
ret = ttm_bo_reserve(&nvbo->bo, false, false, NULL);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
if (nvbo->bo.moving)
|
||||
ret = dma_fence_wait(nvbo->bo.moving, true);
|
||||
|
||||
ttm_bo_unreserve(&nvbo->bo);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
return ret;
|
||||
|
||||
error:
|
||||
nouveau_bo_unpin(nvbo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void nouveau_gem_prime_unpin(struct drm_gem_object *obj)
|
||||
|
|
|
@ -383,6 +383,7 @@ MODULE_DEVICE_TABLE(spi, ld9040_ids);
|
|||
static struct spi_driver ld9040_driver = {
|
||||
.probe = ld9040_probe,
|
||||
.remove = ld9040_remove,
|
||||
.id_table = ld9040_ids,
|
||||
.driver = {
|
||||
.name = "panel-samsung-ld9040",
|
||||
.of_match_table = ld9040_of_match,
|
||||
|
|
|
@ -77,9 +77,19 @@ int radeon_gem_prime_pin(struct drm_gem_object *obj)
|
|||
|
||||
/* pin buffer into GTT */
|
||||
ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL);
|
||||
if (likely(ret == 0))
|
||||
bo->prime_shared_count++;
|
||||
if (unlikely(ret))
|
||||
goto error;
|
||||
|
||||
if (bo->tbo.moving) {
|
||||
ret = dma_fence_wait(bo->tbo.moving, false);
|
||||
if (unlikely(ret)) {
|
||||
radeon_bo_unpin(bo);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
bo->prime_shared_count++;
|
||||
error:
|
||||
radeon_bo_unreserve(bo);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -159,6 +159,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
|
|||
struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
|
||||
bool connected = false;
|
||||
|
||||
WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
|
||||
|
||||
if (vc4_hdmi->hpd_gpio) {
|
||||
if (gpio_get_value_cansleep(vc4_hdmi->hpd_gpio) ^
|
||||
vc4_hdmi->hpd_active_low)
|
||||
|
@ -180,10 +182,12 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
|
|||
}
|
||||
}
|
||||
|
||||
pm_runtime_put(&vc4_hdmi->pdev->dev);
|
||||
return connector_status_connected;
|
||||
}
|
||||
|
||||
cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
|
||||
pm_runtime_put(&vc4_hdmi->pdev->dev);
|
||||
return connector_status_disconnected;
|
||||
}
|
||||
|
||||
|
@ -473,7 +477,6 @@ static void vc4_hdmi_encoder_post_crtc_powerdown(struct drm_encoder *encoder,
|
|||
HDMI_READ(HDMI_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE);
|
||||
|
||||
clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock);
|
||||
clk_disable_unprepare(vc4_hdmi->hsm_clock);
|
||||
clk_disable_unprepare(vc4_hdmi->pixel_clock);
|
||||
|
||||
ret = pm_runtime_put(&vc4_hdmi->pdev->dev);
|
||||
|
@ -784,13 +787,6 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
|
|||
return;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(vc4_hdmi->hsm_clock);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to turn on HSM clock: %d\n", ret);
|
||||
clk_disable_unprepare(vc4_hdmi->pixel_clock);
|
||||
return;
|
||||
}
|
||||
|
||||
vc4_hdmi_cec_update_clk_div(vc4_hdmi);
|
||||
|
||||
/*
|
||||
|
@ -801,7 +797,6 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
|
|||
(hsm_rate > VC4_HSM_MID_CLOCK ? 150000000 : 75000000));
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret);
|
||||
clk_disable_unprepare(vc4_hdmi->hsm_clock);
|
||||
clk_disable_unprepare(vc4_hdmi->pixel_clock);
|
||||
return;
|
||||
}
|
||||
|
@ -809,7 +804,6 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
|
|||
ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret);
|
||||
clk_disable_unprepare(vc4_hdmi->hsm_clock);
|
||||
clk_disable_unprepare(vc4_hdmi->pixel_clock);
|
||||
return;
|
||||
}
|
||||
|
@ -1929,6 +1923,29 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int vc4_hdmi_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
|
||||
|
||||
clk_disable_unprepare(vc4_hdmi->hsm_clock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vc4_hdmi_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
|
||||
int ret;
|
||||
|
||||
ret = clk_prepare_enable(vc4_hdmi->hsm_clock);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
|
||||
{
|
||||
const struct vc4_hdmi_variant *variant = of_device_get_match_data(dev);
|
||||
|
@ -2165,11 +2182,18 @@ static const struct of_device_id vc4_hdmi_dt_match[] = {
|
|||
{}
|
||||
};
|
||||
|
||||
static const struct dev_pm_ops vc4_hdmi_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(vc4_hdmi_runtime_suspend,
|
||||
vc4_hdmi_runtime_resume,
|
||||
NULL)
|
||||
};
|
||||
|
||||
struct platform_driver vc4_hdmi_driver = {
|
||||
.probe = vc4_hdmi_dev_probe,
|
||||
.remove = vc4_hdmi_dev_remove,
|
||||
.driver = {
|
||||
.name = "vc4_hdmi",
|
||||
.of_match_table = vc4_hdmi_dt_match,
|
||||
.pm = &vc4_hdmi_pm_ops,
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue