Merge tag 'drm-misc-next-2021-04-09' of git://anongit.freedesktop.org/drm/drm-misc...
authorDave Airlie <airlied@redhat.com>
Fri, 9 Apr 2021 19:27:11 +0000 (05:27 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 9 Apr 2021 19:46:35 +0000 (05:46 +1000)
drm-misc-next for 5.13:

UAPI Changes:

Cross-subsystem Changes:

Core Changes:
  - bridge: Fix Kconfig dependency
  - cmdline: Refuse zero width/height mode
  - ttm: Ignore signaled move fences, ioremap buffer according to mem
         caching settins

Driver Changes:
  - Conversions to sysfs_emit
  - tegra: Don't register DP AUX channels before connectors
  - zynqmp: Fix for an out-of-bound (but within struct padding) memset

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210409090020.jroa2d4p4qansrpa@gilmour
22 files changed:
drivers/dma-buf/dma-fence.c
drivers/gpu/drm/arm/display/include/malidp_utils.h
drivers/gpu/drm/arm/display/komeda/komeda_dev.c
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
drivers/gpu/drm/bridge/Kconfig
drivers/gpu/drm/bridge/lontium-lt8912b.c
drivers/gpu/drm/drm_dp_mst_topology.c
drivers/gpu/drm/drm_internal.h
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/drm_syncobj.c
drivers/gpu/drm/drm_vblank.c
drivers/gpu/drm/gma500/power.c
drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
drivers/gpu/drm/tegra/dpaux.c
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/xlnx/zynqmp_dp.c
include/drm/drm_dp_helper.h
include/drm/drm_print.h
include/drm/gpu_scheduler.h
include/linux/dma-fence.h

index d64fc03..ce0f5ef 100644 (file)
@@ -123,7 +123,9 @@ static const struct dma_fence_ops dma_fence_stub_ops = {
 /**
  * dma_fence_get_stub - return a signaled fence
  *
- * Return a stub fence which is already signaled.
+ * Return a stub fence which is already signaled. The fence's
+ * timestamp corresponds to the first time after boot this
+ * function is called.
  */
 struct dma_fence *dma_fence_get_stub(void)
 {
@@ -141,6 +143,29 @@ struct dma_fence *dma_fence_get_stub(void)
 }
 EXPORT_SYMBOL(dma_fence_get_stub);
 
+/**
+ * dma_fence_allocate_private_stub - return a private, signaled fence
+ *
+ * Return a newly allocated and signaled stub fence.
+ */
+struct dma_fence *dma_fence_allocate_private_stub(void)
+{
+       struct dma_fence *fence;
+
+       fence = kzalloc(sizeof(*fence), GFP_KERNEL);
+       if (fence == NULL)
+               return ERR_PTR(-ENOMEM);
+
+       dma_fence_init(fence,
+                      &dma_fence_stub_ops,
+                      &dma_fence_stub_lock,
+                      0, 0);
+       dma_fence_signal(fence);
+
+       return fence;
+}
+EXPORT_SYMBOL(dma_fence_allocate_private_stub);
+
 /**
  * dma_fence_context_alloc - allocate an array of fence contexts
  * @num: amount of contexts to allocate
index 3bc383d..49a1d7f 100644 (file)
@@ -13,9 +13,6 @@
 #define has_bit(nr, mask)      (BIT(nr) & (mask))
 #define has_bits(bits, mask)   (((bits) & (mask)) == (bits))
 
-#define dp_for_each_set_bit(bit, mask) \
-       for_each_set_bit((bit), ((unsigned long *)&(mask)), sizeof(mask) * 8)
-
 #define dp_wait_cond(__cond, __tries, __min_range, __max_range)        \
 ({                                                     \
        int num_tries = __tries;                        \
index ca891ae..cc7664c 100644 (file)
@@ -62,7 +62,7 @@ core_id_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct komeda_dev *mdev = dev_to_mdev(dev);
 
-       return snprintf(buf, PAGE_SIZE, "0x%08x\n", mdev->chip.core_id);
+       return sysfs_emit(buf, "0x%08x\n", mdev->chip.core_id);
 }
 static DEVICE_ATTR_RO(core_id);
 
@@ -85,7 +85,7 @@ config_id_show(struct device *dev, struct device_attribute *attr, char *buf)
                if (pipe->layers[i]->layer_type == KOMEDA_FMT_RICH_LAYER)
                        config_id.n_richs++;
        }
-       return snprintf(buf, PAGE_SIZE, "0x%08x\n", config_id.value);
+       return sysfs_emit(buf, "0x%08x\n", config_id.value);
 }
 static DEVICE_ATTR_RO(config_id);
 
@@ -94,7 +94,7 @@ aclk_hz_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct komeda_dev *mdev = dev_to_mdev(dev);
 
-       return snprintf(buf, PAGE_SIZE, "%lu\n", clk_get_rate(mdev->aclk));
+       return sysfs_emit(buf, "%lu\n", clk_get_rate(mdev->aclk));
 }
 static DEVICE_ATTR_RO(aclk_hz);
 
index 719a797..06c5953 100644 (file)
@@ -46,8 +46,9 @@ void komeda_pipeline_destroy(struct komeda_dev *mdev,
 {
        struct komeda_component *c;
        int i;
+       unsigned long avail_comps = pipe->avail_comps;
 
-       dp_for_each_set_bit(i, pipe->avail_comps) {
+       for_each_set_bit(i, &avail_comps, 32) {
                c = komeda_pipeline_get_component(pipe, i);
                komeda_component_destroy(mdev, c);
        }
@@ -247,6 +248,7 @@ static void komeda_pipeline_dump(struct komeda_pipeline *pipe)
 {
        struct komeda_component *c;
        int id;
+       unsigned long avail_comps = pipe->avail_comps;
 
        DRM_INFO("Pipeline-%d: n_layers: %d, n_scalers: %d, output: %s.\n",
                 pipe->id, pipe->n_layers, pipe->n_scalers,
@@ -258,7 +260,7 @@ static void komeda_pipeline_dump(struct komeda_pipeline *pipe)
                 pipe->of_output_links[1] ?
                 pipe->of_output_links[1]->full_name : "none");
 
-       dp_for_each_set_bit(id, pipe->avail_comps) {
+       for_each_set_bit(id, &avail_comps, 32) {
                c = komeda_pipeline_get_component(pipe, id);
 
                komeda_component_dump(c);
@@ -270,8 +272,9 @@ static void komeda_component_verify_inputs(struct komeda_component *c)
        struct komeda_pipeline *pipe = c->pipeline;
        struct komeda_component *input;
        int id;
+       unsigned long supported_inputs = c->supported_inputs;
 
-       dp_for_each_set_bit(id, c->supported_inputs) {
+       for_each_set_bit(id, &supported_inputs, 32) {
                input = komeda_pipeline_get_component(pipe, id);
                if (!input) {
                        c->supported_inputs &= ~(BIT(id));
@@ -302,8 +305,9 @@ static void komeda_pipeline_assemble(struct komeda_pipeline *pipe)
        struct komeda_component *c;
        struct komeda_layer *layer;
        int i, id;
+       unsigned long avail_comps = pipe->avail_comps;
 
-       dp_for_each_set_bit(id, pipe->avail_comps) {
+       for_each_set_bit(id, &avail_comps, 32) {
                c = komeda_pipeline_get_component(pipe, id);
                komeda_component_verify_inputs(c);
        }
@@ -355,13 +359,15 @@ void komeda_pipeline_dump_register(struct komeda_pipeline *pipe,
 {
        struct komeda_component *c;
        u32 id;
+       unsigned long avail_comps;
 
        seq_printf(sf, "\n======== Pipeline-%d ==========\n", pipe->id);
 
        if (pipe->funcs && pipe->funcs->dump_register)
                pipe->funcs->dump_register(pipe, sf);
 
-       dp_for_each_set_bit(id, pipe->avail_comps) {
+       avail_comps = pipe->avail_comps;
+       for_each_set_bit(id, &avail_comps, 32) {
                c = komeda_pipeline_get_component(pipe, id);
 
                seq_printf(sf, "\n------%s------\n", c->name);
index 5c08511..e672b9c 100644 (file)
@@ -1231,14 +1231,15 @@ komeda_pipeline_unbound_components(struct komeda_pipeline *pipe,
        struct komeda_pipeline_state *old = priv_to_pipe_st(pipe->obj.state);
        struct komeda_component_state *c_st;
        struct komeda_component *c;
-       u32 disabling_comps, id;
+       u32 id;
+       unsigned long disabling_comps;
 
        WARN_ON(!old);
 
        disabling_comps = (~new->active_comps) & old->active_comps;
 
        /* unbound all disabling component */
-       dp_for_each_set_bit(id, disabling_comps) {
+       for_each_set_bit(id, &disabling_comps, 32) {
                c = komeda_pipeline_get_component(pipe, id);
                c_st = komeda_component_get_state_and_set_user(c,
                                drm_st, NULL, new->crtc);
@@ -1286,7 +1287,8 @@ bool komeda_pipeline_disable(struct komeda_pipeline *pipe,
        struct komeda_pipeline_state *old;
        struct komeda_component *c;
        struct komeda_component_state *c_st;
-       u32 id, disabling_comps = 0;
+       u32 id;
+       unsigned long disabling_comps;
 
        old = komeda_pipeline_get_old_state(pipe, old_state);
 
@@ -1296,10 +1298,10 @@ bool komeda_pipeline_disable(struct komeda_pipeline *pipe,
                disabling_comps = old->active_comps &
                                  pipe->standalone_disabled_comps;
 
-       DRM_DEBUG_ATOMIC("PIPE%d: active_comps: 0x%x, disabling_comps: 0x%x.\n",
+       DRM_DEBUG_ATOMIC("PIPE%d: active_comps: 0x%x, disabling_comps: 0x%lx.\n",
                         pipe->id, old->active_comps, disabling_comps);
 
-       dp_for_each_set_bit(id, disabling_comps) {
+       for_each_set_bit(id, &disabling_comps, 32) {
                c = komeda_pipeline_get_component(pipe, id);
                c_st = priv_to_comp_st(c->obj.state);
 
@@ -1330,16 +1332,17 @@ void komeda_pipeline_update(struct komeda_pipeline *pipe,
        struct komeda_pipeline_state *new = priv_to_pipe_st(pipe->obj.state);
        struct komeda_pipeline_state *old;
        struct komeda_component *c;
-       u32 id, changed_comps = 0;
+       u32 id;
+       unsigned long changed_comps;
 
        old = komeda_pipeline_get_old_state(pipe, old_state);
 
        changed_comps = new->active_comps | old->active_comps;
 
-       DRM_DEBUG_ATOMIC("PIPE%d: active_comps: 0x%x, changed: 0x%x.\n",
+       DRM_DEBUG_ATOMIC("PIPE%d: active_comps: 0x%x, changed: 0x%lx.\n",
                         pipe->id, new->active_comps, changed_comps);
 
-       dp_for_each_set_bit(id, changed_comps) {
+       for_each_set_bit(id, &changed_comps, 32) {
                c = komeda_pipeline_get_component(pipe, id);
 
                if (new->active_comps & BIT(c->id))
index dba62f9..22a467a 100644 (file)
@@ -55,7 +55,7 @@ config DRM_DISPLAY_CONNECTOR
        depends on OF
        help
          Driver for display connectors with support for DDC and hot-plug
-         detection. Most display controller handle display connectors
+         detection. Most display controllers handle display connectors
          internally and don't need this driver, but the DRM subsystem is
          moving towards separating connector handling from display controllers
          on ARM-based platforms. Saying Y here when this driver is not needed
@@ -210,6 +210,7 @@ config DRM_TOSHIBA_TC358762
        tristate "TC358762 DSI/DPI bridge"
        depends on OF
        select DRM_MIPI_DSI
+       select DRM_KMS_HELPER
        select DRM_PANEL_BRIDGE
        help
          Toshiba TC358762 DSI/DPI bridge driver.
index 6149161..4f69312 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <linux/device.h>
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/gpio.h>
 #include <linux/of_gpio.h>
index 01f47e5..1590144 100644 (file)
@@ -4109,10 +4109,9 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
                return 0;
 
        up_req = kzalloc(sizeof(*up_req), GFP_KERNEL);
-       if (!up_req) {
-               DRM_ERROR("Not enough memory to process MST up req\n");
+       if (!up_req)
                return -ENOMEM;
-       }
+
        INIT_LIST_HEAD(&up_req->next);
 
        drm_dp_sideband_parse_req(&mgr->up_req_recv, &up_req->msg);
index fad2249..1265de2 100644 (file)
@@ -170,7 +170,6 @@ void drm_sysfs_connector_remove(struct drm_connector *connector);
 void drm_sysfs_lease_event(struct drm_device *dev);
 
 /* drm_gem.c */
-struct drm_gem_object;
 int drm_gem_init(struct drm_device *dev);
 int drm_gem_handle_create_tail(struct drm_file *file_priv,
                               struct drm_gem_object *obj,
index 1ac67d4..33a93fa 100644 (file)
@@ -1864,6 +1864,9 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
 {
        struct drm_display_mode *mode;
 
+       if (cmd->xres == 0 || cmd->yres == 0)
+               return NULL;
+
        if (cmd->cvt)
                mode = drm_cvt_mode(dev,
                                    cmd->xres, cmd->yres,
index 6231a82..fdd2ec8 100644 (file)
@@ -350,12 +350,16 @@ EXPORT_SYMBOL(drm_syncobj_replace_fence);
  *
  * Assign a already signaled stub fence to the sync object.
  */
-static void drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
+static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
 {
-       struct dma_fence *fence = dma_fence_get_stub();
+       struct dma_fence *fence = dma_fence_allocate_private_stub();
+
+       if (IS_ERR(fence))
+               return PTR_ERR(fence);
 
        drm_syncobj_replace_fence(syncobj, fence);
        dma_fence_put(fence);
+       return 0;
 }
 
 /* 5s default for wait submission */
@@ -478,6 +482,7 @@ EXPORT_SYMBOL(drm_syncobj_free);
 int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags,
                       struct dma_fence *fence)
 {
+       int ret;
        struct drm_syncobj *syncobj;
 
        syncobj = kzalloc(sizeof(struct drm_syncobj), GFP_KERNEL);
@@ -488,8 +493,13 @@ int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags,
        INIT_LIST_HEAD(&syncobj->cb_list);
        spin_lock_init(&syncobj->lock);
 
-       if (flags & DRM_SYNCOBJ_CREATE_SIGNALED)
-               drm_syncobj_assign_null_handle(syncobj);
+       if (flags & DRM_SYNCOBJ_CREATE_SIGNALED) {
+               ret = drm_syncobj_assign_null_handle(syncobj);
+               if (ret < 0) {
+                       drm_syncobj_put(syncobj);
+                       return ret;
+               }
+       }
 
        if (fence)
                drm_syncobj_replace_fence(syncobj, fence);
@@ -1334,8 +1344,11 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,
        if (ret < 0)
                return ret;
 
-       for (i = 0; i < args->count_handles; i++)
-               drm_syncobj_assign_null_handle(syncobjs[i]);
+       for (i = 0; i < args->count_handles; i++) {
+               ret = drm_syncobj_assign_null_handle(syncobjs[i]);
+               if (ret < 0)
+                       break;
+       }
 
        drm_syncobj_array_free(syncobjs, args->count_handles);
 
index 2bd9896..3417e1a 100644 (file)
@@ -1478,6 +1478,7 @@ static void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
        u64 diff_ns;
        u32 cur_vblank, diff = 1;
        int count = DRM_TIMESTAMP_MAXRETRIES;
+       u32 max_vblank_count = drm_max_vblank_count(dev, pipe);
 
        if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
                return;
@@ -1504,7 +1505,7 @@ static void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
        drm_dbg_vbl(dev,
                    "missed %d vblanks in %lld ns, frame duration=%d ns, hw_diff=%d\n",
                    diff, diff_ns, framedur_ns, cur_vblank - vblank->last);
-       store_vblank(dev, pipe, diff, t_vblank, cur_vblank);
+       vblank->last = (cur_vblank - diff) & max_vblank_count;
 }
 
 /**
index 56ef882..f07641d 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/pm_runtime.h>
 
 static struct mutex power_mutex;       /* Serialize power ops */
-static spinlock_t power_ctrl_lock;     /* Serialize power claim */
+static DEFINE_SPINLOCK(power_ctrl_lock);       /* Serialize power claim */
 
 /**
  *     gma_power_init          -       initialise power manager
@@ -55,7 +55,6 @@ void gma_power_init(struct drm_device *dev)
        dev_priv->display_power = true; /* We start active */
        dev_priv->display_count = 0;    /* Currently no users */
        dev_priv->suspended = false;    /* And not suspended */
-       spin_lock_init(&power_ctrl_lock);
        mutex_init(&power_mutex);
 
        if (dev_priv->ops->init_pm)
index 49e6c93..bacaf1b 100644 (file)
@@ -186,7 +186,7 @@ static ssize_t vmirror_show(struct device *dev, struct device_attribute *attr,
 {
        struct td043mtea1_panel *lcd = dev_get_drvdata(dev);
 
-       return snprintf(buf, PAGE_SIZE, "%d\n", lcd->vmirror);
+       return sysfs_emit(buf, "%d\n", lcd->vmirror);
 }
 
 static ssize_t vmirror_store(struct device *dev, struct device_attribute *attr,
@@ -214,7 +214,7 @@ static ssize_t mode_show(struct device *dev, struct device_attribute *attr,
 {
        struct td043mtea1_panel *lcd = dev_get_drvdata(dev);
 
-       return snprintf(buf, PAGE_SIZE, "%d\n", lcd->mode);
+       return sysfs_emit(buf, "%d\n", lcd->mode);
 }
 
 static ssize_t mode_store(struct device *dev, struct device_attribute *attr,
index 105fb9c..ea56c6e 100644 (file)
@@ -534,9 +534,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
        dpaux->aux.transfer = tegra_dpaux_transfer;
        dpaux->aux.dev = &pdev->dev;
 
-       err = drm_dp_aux_register(&dpaux->aux);
-       if (err < 0)
-               return err;
+       drm_dp_aux_init(&dpaux->aux);
 
        /*
         * Assume that by default the DPAUX/I2C pads will be used for HDMI,
@@ -589,8 +587,6 @@ static int tegra_dpaux_remove(struct platform_device *pdev)
        pm_runtime_put_sync(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
 
-       drm_dp_aux_unregister(&dpaux->aux);
-
        mutex_lock(&dpaux_lock);
        list_del(&dpaux->list);
        mutex_unlock(&dpaux_lock);
@@ -723,6 +719,10 @@ int drm_dp_aux_attach(struct drm_dp_aux *aux, struct tegra_output *output)
        unsigned long timeout;
        int err;
 
+       err = drm_dp_aux_register(aux);
+       if (err < 0)
+               return err;
+
        output->connector.polled = DRM_CONNECTOR_POLL_HPD;
        dpaux->output = output;
 
@@ -760,6 +760,7 @@ int drm_dp_aux_detach(struct drm_dp_aux *aux)
        unsigned long timeout;
        int err;
 
+       drm_dp_aux_unregister(aux);
        disable_irq(dpaux->irq);
 
        if (dpaux->output->panel) {
index 6ab7b66..cfd0b92 100644 (file)
@@ -705,8 +705,9 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
                return 0;
 
        if (no_wait_gpu) {
+               ret = dma_fence_is_signaled(fence) ? 0 : -EBUSY;
                dma_fence_put(fence);
-               return -EBUSY;
+               return ret;
        }
 
        dma_resv_add_shared_fence(bo->base.resv, fence);
index a2a17c8..efb7e9c 100644 (file)
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
                if (mem->bus.caching == ttm_write_combined)
                        addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86
+               else if (mem->bus.caching == ttm_cached)
+                       addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif
                else
                        addr = ioremap(mem->bus.offset, bus_size);
                if (!addr) {
@@ -371,6 +375,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
                if (mem->bus.caching == ttm_write_combined)
                        map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
                                                  size);
+#ifdef CONFIG_X86
+               else if (mem->bus.caching == ttm_cached)
+                       map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+                                                 size);
+#endif
                else
                        map->virtual = ioremap(bo->mem.bus.offset + offset,
                                               size);
@@ -489,6 +498,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
                else if (mem->bus.caching == ttm_write_combined)
                        vaddr_iomem = ioremap_wc(mem->bus.offset,
                                                 bo->base.size);
+#ifdef CONFIG_X86
+               else if (mem->bus.caching == ttm_cached)
+                       vaddr_iomem = ioremap_cache(mem->bus.offset,
+                                                 bo->base.size);
+#endif
                else
                        vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
index 99158ee..59d1fb0 100644 (file)
@@ -866,7 +866,7 @@ static int zynqmp_dp_train(struct zynqmp_dp *dp)
                return ret;
 
        zynqmp_dp_write(dp, ZYNQMP_DP_SCRAMBLING_DISABLE, 1);
-       memset(dp->train_set, 0, 4);
+       memset(dp->train_set, 0, sizeof(dp->train_set));
        ret = zynqmp_dp_link_train_cr(dp);
        if (ret)
                return ret;
index 85d728f..1e85c20 100644 (file)
@@ -1846,34 +1846,34 @@ struct drm_dp_aux_cec {
  * @crc_count: counter of captured frame CRCs
  * @transfer: transfers a message representing a single AUX transaction
  *
- * The .dev field should be set to a pointer to the device that implements
- * the AUX channel.
+ * The @dev field should be set to a pointer to the device that implements the
+ * AUX channel.
  *
- * The .name field may be used to specify the name of the I2C adapter. If set to
- * NULL, dev_name() of .dev will be used.
+ * The @name field may be used to specify the name of the I2C adapter. If set to
+ * %NULL, dev_name() of @dev will be used.
  *
- * Drivers provide a hardware-specific implementation of how transactions
- * are executed via the .transfer() function. A pointer to a drm_dp_aux_msg
+ * Drivers provide a hardware-specific implementation of how transactions are
+ * executed via the @transfer() function. A pointer to a &drm_dp_aux_msg
  * structure describing the transaction is passed into this function. Upon
- * success, the implementation should return the number of payload bytes
- * that were transferred, or a negative error-code on failure. Helpers
- * propagate errors from the .transfer() function, with the exception of
- * the -EBUSY error, which causes a transaction to be retried. On a short,
- * helpers will return -EPROTO to make it simpler to check for failure.
+ * success, the implementation should return the number of payload bytes that
+ * were transferred, or a negative error-code on failure. Helpers propagate
+ * errors from the @transfer() function, with the exception of the %-EBUSY
+ * error, which causes a transaction to be retried. On a short, helpers will
+ * return %-EPROTO to make it simpler to check for failure.
  *
  * An AUX channel can also be used to transport I2C messages to a sink. A
- * typical application of that is to access an EDID that's present in the
- * sink device. The .transfer() function can also be used to execute such
- * transactions. The drm_dp_aux_register() function registers an I2C
- * adapter that can be passed to drm_probe_ddc(). Upon removal, drivers
- * should call drm_dp_aux_unregister() to remove the I2C adapter.
- * The I2C adapter uses long transfers by default; if a partial response is
- * received, the adapter will drop down to the size given by the partial
- * response for this transaction only.
+ * typical application of that is to access an EDID that's present in the sink
+ * device. The @transfer() function can also be used to execute such
+ * transactions. The drm_dp_aux_register() function registers an I2C adapter
+ * that can be passed to drm_probe_ddc(). Upon removal, drivers should call
+ * drm_dp_aux_unregister() to remove the I2C adapter. The I2C adapter uses long
+ * transfers by default; if a partial response is received, the adapter will
+ * drop down to the size given by the partial response for this transaction
+ * only.
  *
- * Note that the aux helper code assumes that the .transfer() function
- * only modifies the reply field of the drm_dp_aux_msg structure.  The
- * retry logic and i2c helpers assume this is the case.
+ * Note that the aux helper code assumes that the @transfer() function only
+ * modifies the reply field of the &drm_dp_aux_msg structure. The retry logic
+ * and i2c helpers assume this is the case.
  */
 struct drm_dp_aux {
        const char *name;
index f32d179..a3c58c9 100644 (file)
@@ -524,16 +524,20 @@ void __drm_err(const char *format, ...);
 #define DRM_DEBUG_DP(fmt, ...)                                         \
        __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
 
-
-#define DRM_DEBUG_KMS_RATELIMITED(fmt, ...)                            \
-({                                                                     \
-       static DEFINE_RATELIMIT_STATE(_rs,                              \
-                                     DEFAULT_RATELIMIT_INTERVAL,       \
-                                     DEFAULT_RATELIMIT_BURST);         \
-       if (__ratelimit(&_rs))                                          \
-               drm_dev_dbg(NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__);      \
+#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)                                  \
+({                                                                                             \
+       static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
+       const struct drm_device *drm_ = (drm);                                                  \
+                                                                                               \
+       if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))                        \
+               drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__);       \
 })
 
+#define drm_dbg_kms_ratelimited(drm, fmt, ...) \
+       __DRM_DEFINE_DBG_RATELIMITED(KMS, drm, fmt, ## __VA_ARGS__)
+
+#define DRM_DEBUG_KMS_RATELIMITED(fmt, ...) drm_dbg_kms_ratelimited(NULL, fmt, ## __VA_ARGS__)
+
 /*
  * struct drm_device based WARNs
  *
index 1c815e0..f888b5e 100644 (file)
@@ -277,6 +277,7 @@ struct drm_sched_backend_ops {
  * @hang_limit: once the hangs by a job crosses this limit then it is marked
  *              guilty and it will be considered for scheduling further.
  * @score: score to help loadbalancer pick a idle sched
+ * @_score: score used when the driver doesn't provide one
  * @ready: marks if the underlying HW is ready to work
  * @free_guilty: A hit to time out handler to free the guilty job.
  *
index 9f12efa..6ffb4b2 100644 (file)
@@ -587,6 +587,7 @@ static inline signed long dma_fence_wait(struct dma_fence *fence, bool intr)
 }
 
 struct dma_fence *dma_fence_get_stub(void);
+struct dma_fence *dma_fence_allocate_private_stub(void);
 u64 dma_fence_context_alloc(unsigned num);
 
 #define DMA_FENCE_TRACE(f, fmt, args...) \