diff options
| author | Mark Brown <broonie@kernel.org> | 2026-11-13 13:44:17 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-11-13 13:44:17 +0000 |
| commit | 8c5678903908b21066a8c566450f8017f3afc504 (patch) | |
| tree | 87e123b11e9072537c6e4536d28137795c74e531 | |
| parent | be5637991f7227aa0476e3ece7fc1672b3816048 (diff) | |
| parent | bafda823590ddf7031ecb765d673572fae7ab44a (diff) | |
| download | linux-next-pending-fixes.tar.gz linux-next-pending-fixes.zip | |
Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.gitpending-fixes
| -rw-r--r-- | MAINTAINERS | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/bridge/sii902x.c | 8 | ||||
| -rw-r--r-- | drivers/gpu/drm/bridge/ssd2825.c | 9 | ||||
| -rw-r--r-- | drivers/gpu/drm/display/drm_hdmi_helper.c | 65 | ||||
| -rw-r--r-- | drivers/gpu/drm/gud/gud_drv.c | 13 | ||||
| -rw-r--r-- | drivers/gpu/drm/meson/meson_encoder_dsi.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/panfrost/panfrost_gpu.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 18 | ||||
| -rw-r--r-- | drivers/gpu/drm/scheduler/sched_rq.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/vc4/vc4_hvs.c | 18 | ||||
| -rw-r--r-- | drivers/gpu/drm/vc4/vc4_irq.c | 42 | ||||
| -rw-r--r-- | drivers/gpu/drm/vc4/vc4_v3d.c | 8 |
18 files changed, 153 insertions, 64 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 9e0ec1e2bd33..803d7177263d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8360,6 +8360,7 @@ F: drivers/gpu/drm/tiny/hx8357d.c DRM DRIVER FOR HYPERV SYNTHETIC VIDEO DEVICE M: Dexuan Cui <decui@microsoft.com> +M: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com> M: Saurabh Sengar <ssengar@linux.microsoft.com> L: linux-hyperv@vger.kernel.org L: dri-devel@lists.freedesktop.org diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index a1e34d2bb3da..299f5b7bffa1 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -890,9 +890,15 @@ static int sii902x_audio_codec_init(struct sii902x *sii902x, } codec_data.max_i2s_channels = 2 * num_lanes; - for (i = 0; i < num_lanes; i++) + for (i = 0; i < num_lanes; i++) { + if (lanes[i] >= ARRAY_SIZE(i2s_lane_id)) + return dev_err_probe(dev, -EINVAL, + "invalid sil,i2s-data-lanes value %u\n", + lanes[i]); + sii902x->audio.i2s_fifo_sequence[i] |= audio_fifo_id[i] | i2s_lane_id[lanes[i]] | SII902X_TPI_I2S_FIFO_ENABLE; + } sii902x->audio.mclk = devm_clk_get_optional(dev, "mclk"); if (IS_ERR(sii902x->audio.mclk)) { diff --git a/drivers/gpu/drm/bridge/ssd2825.c b/drivers/gpu/drm/bridge/ssd2825.c index 71877699dfab..9216cee09115 100644 --- a/drivers/gpu/drm/bridge/ssd2825.c +++ b/drivers/gpu/drm/bridge/ssd2825.c @@ -475,6 +475,7 @@ static void ssd2825_bridge_atomic_pre_enable(struct drm_bridge *bridge, struct drm_atomic_commit *state) { struct ssd2825_priv *priv = bridge_to_ssd2825(bridge); + struct drm_bridge *next_bridge = priv->output.bridge; struct mipi_dsi_device *dsi_dev = priv->output.dev; const struct drm_crtc_state *crtc_state; const struct drm_display_mode *mode; @@ -569,6 +570,14 @@ static void ssd2825_bridge_atomic_pre_enable(struct drm_bridge *bridge, /* Initial DSI configuration register set */ ssd2825_write_reg(priv, SSD2825_CONFIGURATION_REG, config); ssd2825_write_reg(priv, SSD2825_VC_CTRL_REG, 0); + + /* + * The SSD2825 requires that the next bridge be enabled first; + * otherwise, the SSD2825 cannot complete its configuration and + * there will be no output. + */ + if (next_bridge->funcs && next_bridge->funcs->atomic_enable) + next_bridge->funcs->atomic_enable(next_bridge, state); } static void ssd2825_bridge_atomic_enable(struct drm_bridge *bridge, diff --git a/drivers/gpu/drm/display/drm_hdmi_helper.c b/drivers/gpu/drm/display/drm_hdmi_helper.c index f85cce3d6254..278cfda38e18 100644 --- a/drivers/gpu/drm/display/drm_hdmi_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_helper.c @@ -470,6 +470,28 @@ static bool drm_scdc_sink_supports_scrambling(struct drm_connector *connector) info->hdmi.scdc.scrambling.supported; } +static void drm_connector_hdmi_reset_sink_scrambling(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + u8 config; + int ret; + + if (!connector->ddc || !drm_scdc_sink_supports_scrambling(connector)) + return; + + ret = drm_scdc_readb(connector->ddc, SCDC_TMDS_CONFIG, &config); + if (ret) { + drm_dbg_kms(dev, "Failed to read TMDS config: %d\n", ret); + return; + } + + if (config & SCDC_SCRAMBLING_ENABLE) + drm_scdc_set_scrambling(connector, false); + + if (config & SCDC_TMDS_BIT_CLOCK_RATIO_BY_40) + drm_scdc_set_high_tmds_clock_ratio(connector, false); +} + static int drm_connector_hdmi_try_scrambling_setup(struct drm_connector *connector) { bool done; @@ -522,6 +544,11 @@ static void drm_connector_hdmi_scdc_work(struct work_struct *work) * the sink side and retry the operation, as some displays refuse to set the * scrambling bit right away. * + * When @conn_state doesn't require scrambling, the sink-side SCDC status is + * reset instead, so that a sink left scrambling by a state the driver did not + * control, e.g. set up by the firmware before boot, doesn't end up out of sync + * with the source. + * * The work item is cancelled by drm_connector_hdmi_disable_scrambling(), hence * source drivers must ensure the display pipeline is shut down on unbind, e.g. * via drm_atomic_helper_shutdown(). Otherwise the work may outlive the driver's @@ -541,8 +568,14 @@ int drm_connector_hdmi_enable_scrambling(struct drm_connector *connector, if (!conn_state) return -EINVAL; - if (!conn_state->hdmi.scrambler_needed) + if (!conn_state->hdmi.scrambler_needed) { + /* + * Resync the sink here, where it is known to be connected + * and its capabilities have been parsed. + */ + drm_connector_hdmi_reset_sink_scrambling(connector); return 0; + } if (!drm_connector_hdmi_scrambler_supported(connector)) { drm_dbg_kms(dev, "Source doesn't support scrambling.\n"); @@ -581,8 +614,7 @@ int drm_connector_hdmi_enable_scrambling(struct drm_connector *connector, WRITE_ONCE(hdmi->scrambler_enabled, false); cancel_delayed_work_sync(&hdmi->scdc_work); - drm_scdc_set_scrambling(connector, false); - drm_scdc_set_high_tmds_clock_ratio(connector, false); + drm_connector_hdmi_reset_sink_scrambling(connector); } return ret; @@ -619,12 +651,7 @@ int drm_connector_hdmi_disable_scrambling(struct drm_connector *connector) if (hdmi->scdc_work_initialized) cancel_delayed_work_sync(&hdmi->scdc_work); - if (connector->ddc && - connector->status == connector_status_connected && - drm_scdc_sink_supports_scrambling(connector)) { - drm_scdc_set_scrambling(connector, false); - drm_scdc_set_high_tmds_clock_ratio(connector, false); - } + drm_connector_hdmi_reset_sink_scrambling(connector); return hdmi->funcs->scrambler_disable(connector); } @@ -653,9 +680,8 @@ EXPORT_SYMBOL(drm_connector_hdmi_disable_scrambling); int drm_connector_hdmi_sync_scdc(struct drm_connector *connector, bool plugged, struct drm_modeset_acquire_ctx *ctx) { - struct drm_connector_hdmi *hdmi = &connector->hdmi; - struct drm_device *dev = connector->dev; struct drm_connector_state *conn_state; + struct drm_device *dev; struct drm_crtc *crtc; u8 config; int ret; @@ -663,6 +689,8 @@ int drm_connector_hdmi_sync_scdc(struct drm_connector *connector, bool plugged, if (!connector || !plugged || !ctx) return 0; + dev = connector->dev; + /* * This is normally part of .detect_ctx() call path, which already holds * connection_mutex through @ctx. However, re-acquiring it with the @@ -674,14 +702,21 @@ int drm_connector_hdmi_sync_scdc(struct drm_connector *connector, bool plugged, /* TODO: Also handle HDMI 2.1 FRL link training */ - if (!drm_connector_hdmi_scrambler_supported(connector) || - !READ_ONCE(hdmi->scrambler_enabled)) - return 0; - conn_state = connector->state; if (!conn_state) return 0; + /* + * Rely on the committed connector state rather than on the current + * scrambler status: a source driver may force scrambler_enabled at + * init to get a disable at boot (e.g. vc4), and that value would + * remain stale until the first disable actually happens, leading to + * a spurious CRTC reset whenever the active mode needs no scrambling. + */ + if (!drm_connector_hdmi_scrambler_supported(connector) || + !conn_state->hdmi.scrambler_needed) + return 0; + crtc = conn_state->crtc; if (!crtc) return 0; diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c index ea98f641c0b9..55510bf62009 100644 --- a/drivers/gpu/drm/gud/gud_drv.c +++ b/drivers/gpu/drm/gud/gud_drv.c @@ -329,10 +329,17 @@ static int gud_stats_debugfs(struct seq_file *m, void *data) seq_puts(m, "\n"); if (gdrm->compression) { + u64 actual_length = gdrm->stats_actual_length; u64 remainder; - u64 ratio = div64_u64_rem(gdrm->stats_length, gdrm->stats_actual_length, - &remainder); - u64 ratio_frac = div64_u64(remainder * 10, gdrm->stats_actual_length); + u64 ratio, ratio_frac; + + if (!actual_length) { + seq_puts(m, "Compression ratio: n/a\n"); + return 0; + } + + ratio = div64_u64_rem(gdrm->stats_length, actual_length, &remainder); + ratio_frac = div64_u64(remainder * 10, actual_length); seq_printf(m, "Compression ratio: %llu.%llu\n", ratio, ratio_frac); } diff --git a/drivers/gpu/drm/meson/meson_encoder_dsi.c b/drivers/gpu/drm/meson/meson_encoder_dsi.c index faa309cb97a6..912cd676bbe2 100644 --- a/drivers/gpu/drm/meson/meson_encoder_dsi.c +++ b/drivers/gpu/drm/meson/meson_encoder_dsi.c @@ -65,9 +65,9 @@ static void meson_encoder_dsi_atomic_enable(struct drm_bridge *bridge, /* ENCL clock setup is handled by CCF */ meson_venc_mipi_dsi_mode_set(priv, &crtc_state->adjusted_mode); - meson_encl_load_gamma(priv); writel_relaxed(0, priv->io_base + _REG(ENCL_VIDEO_EN)); + meson_encl_load_gamma(priv); writel_bits_relaxed(ENCL_VIDEO_MODE_ADV_VFIFO_EN, ENCL_VIDEO_MODE_ADV_VFIFO_EN, priv->io_base + _REG(ENCL_VIDEO_MODE_ADV)); diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h index 341f133dc38c..eb8adaf07fe5 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h @@ -63,6 +63,7 @@ struct nvkm_falcon_func { int (*select)(struct nvkm_falcon *); u32 addr2; u32 riscv_irqmask; + u32 riscv_irqdest; bool reset_pmc; int (*reset_eng)(struct nvkm_falcon *); int (*reset_prep)(struct nvkm_falcon *); diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index d71dcfc6ee66..07882624a7f6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -354,6 +354,11 @@ static const struct drm_mode_config_funcs nouveau_mode_config_funcs = { .fb_create = nouveau_user_framebuffer_create, }; +static const struct drm_mode_config_funcs nouveau_mode_config_funcs_atomic = { + .fb_create = nouveau_user_framebuffer_create, + .atomic_commit = drm_atomic_helper_commit, + .atomic_check = drm_atomic_helper_check, +}; struct nouveau_drm_prop_enum_list { u8 gen_mask; @@ -654,7 +659,11 @@ nouveau_display_create(struct drm_device *dev) drm_mode_create_scaling_mode_property(dev); drm_mode_create_dvi_i_properties(dev); - dev->mode_config.funcs = &nouveau_mode_config_funcs; + /* this only gets set if the driver has the ATOMIC flag */ + if (drm_drv_uses_atomic_modeset(dev)) + dev->mode_config.funcs = &nouveau_mode_config_funcs_atomic; + else + dev->mode_config.funcs = &nouveau_mode_config_funcs; dev->mode_config.min_width = 0; dev->mode_config.min_height = 0; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c index d5126fe39d27..10e2813a0163 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c @@ -27,6 +27,7 @@ ga100_gsp_flcn = { .enable = gm200_flcn_enable, .addr2 = 0x1000, .riscv_irqmask = 0x2b4, + .riscv_irqdest = 0x2b8, .reset_eng = gp102_flcn_reset_eng, .reset_wait_mem_scrubbing = gm200_flcn_reset_wait_mem_scrubbing, .bind_inst = gm200_flcn_bind_inst, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c index b6b3eb6f4c00..96fa26fa6122 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c @@ -140,6 +140,7 @@ ga102_gsp_flcn = { .select = ga102_flcn_select, .addr2 = 0x1000, .riscv_irqmask = 0x528, + .riscv_irqdest = 0x52c, .reset_eng = gp102_flcn_reset_eng, .reset_prep = ga102_flcn_reset_prep, .reset_wait_mem_scrubbing = ga102_flcn_reset_wait_mem_scrubbing, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c index 63aa30f94747..fe590a045d70 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c @@ -64,7 +64,9 @@ r535_gsp_intr(struct nvkm_inth *inth) u32 intr = nvkm_falcon_rd32(&gsp->falcon, 0x0008); u32 inte = nvkm_falcon_rd32(&gsp->falcon, gsp->falcon.func->addr2 + gsp->falcon.func->riscv_irqmask); - u32 stat = intr & inte; + u32 dest = nvkm_falcon_rd32(&gsp->falcon, gsp->falcon.func->addr2 + + gsp->falcon.func->riscv_irqdest); + u32 stat = intr & inte & dest; if (!stat) { nvkm_debug(subdev, "inte %08x %08x\n", intr, inte); diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c index 11a37963bd4e..823532758afd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c @@ -420,6 +420,7 @@ tu102_gsp_flcn = { .enable = gm200_flcn_enable, .addr2 = 0x1000, .riscv_irqmask = 0x2b4, + .riscv_irqdest = 0x2b8, .reset_eng = gp102_flcn_reset_eng, .reset_wait_mem_scrubbing = gm200_flcn_reset_wait_mem_scrubbing, .bind_inst = gm200_flcn_bind_inst, diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c index 6081b27829e1..5c3fee65c9e3 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c @@ -94,11 +94,10 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) GPU_IRQ_CLEAN_CACHES_COMPLETED); /* - * All in-flight jobs should have released their cycle - * counter references upon reset, but let us make sure + * Even though all in-flight jobs should have released their cycle counter + * references upon reset, perfcnt's might still hang about. */ - if (drm_WARN_ON(&pfdev->base, atomic_read(&pfdev->cycle_counter.use_count) != 0)) - atomic_set(&pfdev->cycle_counter.use_count, 0); + atomic_set(&pfdev->cycle_counter.use_count, 0); return 0; } diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c index 3e65589a1093..9e9c2e953036 100644 --- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c @@ -17,6 +17,7 @@ #include "panfrost_device.h" #include "panfrost_features.h" #include "panfrost_gem.h" +#include "panfrost_gpu.h" #include "panfrost_issues.h" #include "panfrost_job.h" #include "panfrost_mmu.h" @@ -52,6 +53,7 @@ static void panfrost_perfcnt_hw_disable(struct panfrost_device *pfdev) gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0); if (perfcnt->owns_as_ref) { + panfrost_cycle_counter_put(pfdev); panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu); perfcnt->owns_as_ref = false; } @@ -84,6 +86,7 @@ static int panfrost_perfcnt_hw_enable(struct panfrost_device *pfdev) return ret; perfcnt->owns_as_ref = true; + panfrost_cycle_counter_get(pfdev); as = ret; cfg = GPU_PERFCNT_CFG_AS(as) | @@ -145,18 +148,17 @@ static int panfrost_perfcnt_dump_locked(struct panfrost_device *pfdev, u32 *stat */ ret = wait_for_completion_interruptible_timeout(&pfdev->perfcnt->dump_comp, msecs_to_jiffies(1000)); - if (!ret) ret = -ETIMEDOUT; - /* We need to restore perfcnt state so the next successful dump can relay it to UM */ - if (ret < 0) { - perfcnt->state |= *state; - *state = 0; - return ret; - } - scoped_guard(rwsem_read, &pfdev->reset.lock) { + /* Restore perfcnt state so the next successful dump can relay it to UM */ + if (ret < 0) { + perfcnt->state |= *state; + *state = 0; + return ret; + } + *state |= perfcnt->state; /* UM must re-enable their session before requesting new dumps. */ diff --git a/drivers/gpu/drm/scheduler/sched_rq.c b/drivers/gpu/drm/scheduler/sched_rq.c index 23f46ec610e7..6f67a146d99c 100644 --- a/drivers/gpu/drm/scheduler/sched_rq.c +++ b/drivers/gpu/drm/scheduler/sched_rq.c @@ -345,6 +345,13 @@ void drm_sched_rq_pop_entity(struct drm_sched_entity *entity) lockdep_assert_held(&entity->lock); + /* + * If entity is getting torn down via drm_sched_entity_kill() we need + * to ensure it does not get re-added to the tree behind it's back. + */ + if (entity->stopped) + return; + spin_lock(&rq->lock); /* diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index b1fb096858cc..537aaa992129 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -1677,15 +1677,6 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) struct device_node *node; unsigned int max_rate; - node = rpi_firmware_find_node(); - if (!node) - return -EINVAL; - - firmware = rpi_firmware_get(node); - of_node_put(node); - if (!firmware) - return -EPROBE_DEFER; - hvs->core_clk = devm_clk_get(&pdev->dev, (vc4->gen >= VC4_GEN_6_C) ? "core" : NULL); if (IS_ERR(hvs->core_clk)) { @@ -1700,6 +1691,15 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) return PTR_ERR(hvs->disp_clk); } + node = rpi_firmware_find_node(); + if (!node) + return -EINVAL; + + firmware = rpi_firmware_get(node); + of_node_put(node); + if (!firmware) + return -EPROBE_DEFER; + max_rate = rpi_firmware_clk_get_max_rate(firmware, RPI_FIRMWARE_CORE_CLK_ID); rpi_firmware_put(firmware); diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c index c00a3e7c1358..ff405d3c1d4c 100644 --- a/drivers/gpu/drm/vc4/vc4_irq.c +++ b/drivers/gpu/drm/vc4/vc4_irq.c @@ -53,10 +53,6 @@ #include "vc4_regs.h" #include "vc4_trace.h" -#define V3D_DRIVER_IRQS (V3D_INT_OUTOMEM | \ - V3D_INT_FLDONE | \ - V3D_INT_FRDONE) - static void vc4_overflow_mem_work(struct work_struct *work) { @@ -249,6 +245,7 @@ void vc4_irq_enable(struct drm_device *dev) { struct vc4_dev *vc4 = to_vc4_dev(dev); + u32 mask = V3D_INT_FLDONE | V3D_INT_FRDONE; if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) return; @@ -256,10 +253,20 @@ vc4_irq_enable(struct drm_device *dev) if (!vc4->v3d) return; - /* Enable the render done interrupts. The out-of-memory interrupt is - * enabled as soon as we have a binner BO allocated. + /* Arming the OOM interrupt before there is a binner BO would raise an + * interrupt nothing can clear. */ - V3D_WRITE(V3D_INTENA, V3D_INT_FLDONE | V3D_INT_FRDONE); + if (vc4->bin_bo) + mask |= V3D_INT_OUTOMEM; + + /* Clear any pending interrupts someone might have left around for us. */ + V3D_WRITE(V3D_INTCTL, mask); + + /* Enable our set of interrupts, masking out any others. */ + V3D_WRITE(V3D_INTDIS, ~mask); + V3D_WRITE(V3D_INTENA, mask); + + enable_irq(vc4->irq); } void @@ -274,14 +281,14 @@ vc4_irq_disable(struct drm_device *dev) return; /* Disable sending interrupts for our driver's IRQs. */ - V3D_WRITE(V3D_INTDIS, V3D_DRIVER_IRQS); - - /* Clear any pending interrupts we might have left. */ - V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); + V3D_WRITE(V3D_INTDIS, ~0); /* Finish any interrupt handler still in flight. */ disable_irq(vc4->irq); + /* Clear any pending interrupts we might have left. */ + V3D_WRITE(V3D_INTCTL, ~0); + cancel_work_sync(&vc4->overflow_mem_work); } @@ -324,15 +331,12 @@ void vc4_irq_reset(struct drm_device *dev) if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) return; - /* Acknowledge any stale IRQs. */ - V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); - - /* - * Turn all our interrupts on. Binner out of memory is the only - * one we expect to trigger at this point, since the reset cleared - * the overflow memory address and none has been supplied yet. + /* bin_bo_alloc() may arm OUTOMEM between the bin_bo check and the + * INTDIS write in vc4_irq_enable(), which would then mask it again. */ - V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS); + scoped_guard(mutex, &vc4->bin_bo_lock) { + vc4_irq_enable(dev); + } spin_lock_irqsave(&vc4->job_lock, irqflags); vc4_cancel_bin_job(dev); diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c index 5c1c99533b30..86e8b6d2e6a1 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -302,11 +302,15 @@ static int bin_bo_alloc(struct vc4_dev *vc4) int vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used) { - int ret = 0; + int ret; if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) return -ENODEV; + ret = vc4_v3d_pm_get(vc4); + if (ret) + return ret; + mutex_lock(&vc4->bin_bo_lock); if (used && *used) @@ -322,6 +326,7 @@ int vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used) complete: mutex_unlock(&vc4->bin_bo_lock); + vc4_v3d_pm_put(vc4); return ret; } @@ -373,7 +378,6 @@ static int vc4_v3d_runtime_resume(struct device *dev) vc4_v3d_init_hw(&vc4->base); vc4_irq_enable(&vc4->base); - enable_irq(vc4->irq); return 0; } |
