Merge tag 'rproc-v4.17' of git://github.com/andersson/remoteproc
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 10 Apr 2018 19:09:27 +0000 (12:09 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 10 Apr 2018 19:09:27 +0000 (12:09 -0700)
Pull remoteproc updates from Bjorn Andersson:

 - add support for generating coredumps for remoteprocs using
   devcoredump

 - add the Qualcomm sysmon driver for intra-remoteproc crash handling

 - a number of fixes in Qualcomm and IMX drivers

* tag 'rproc-v4.17' of git://github.com/andersson/remoteproc:
  remoteproc: fix null pointer dereference on glink only platforms
  soc: qcom: qmi: add CONFIG_NET dependency
  remoteproc: imx_rproc: Slightly simplify code in 'imx_rproc_probe()'
  remoteproc: imx_rproc: Re-use existing error handling path in 'imx_rproc_probe()'
  remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()'
  samples: Introduce Qualcomm QMI sample client
  remoteproc: qcom: Introduce sysmon
  remoteproc: Pass type of shutdown to subdev remove
  remoteproc: qcom: Register segments for core dump
  soc: qcom: mdt-loader: Return relocation base
  remoteproc: Rename "load_rsc_table" to "parse_fw"
  remoteproc: Add remote processor coredump support
  remoteproc: Remove null character write of shared mem

1  2 
drivers/gpu/drm/msm/adreno/a5xx_gpu.c
drivers/soc/qcom/Kconfig
samples/Kconfig
samples/Makefile

@@@ -89,14 -89,14 +89,14 @@@ static int zap_shader_load_mdt(struct m
         */
        if (to_adreno_gpu(gpu)->fwloc == FW_LOCATION_LEGACY) {
                ret = qcom_mdt_load(dev, fw, fwname, GPU_PAS_ID,
-                               mem_region, mem_phys, mem_size);
+                               mem_region, mem_phys, mem_size, NULL);
        } else {
                char newname[strlen("qcom/") + strlen(fwname) + 1];
  
                sprintf(newname, "qcom/%s", fwname);
  
                ret = qcom_mdt_load(dev, fw, newname, GPU_PAS_ID,
-                               mem_region, mem_phys, mem_size);
+                               mem_region, mem_phys, mem_size, NULL);
        }
        if (ret)
                goto out;
@@@ -140,65 -140,6 +140,65 @@@ static void a5xx_flush(struct msm_gpu *
                gpu_write(gpu, REG_A5XX_CP_RB_WPTR, wptr);
  }
  
 +static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit,
 +      struct msm_file_private *ctx)
 +{
 +      struct msm_drm_private *priv = gpu->dev->dev_private;
 +      struct msm_ringbuffer *ring = submit->ring;
 +      struct msm_gem_object *obj;
 +      uint32_t *ptr, dwords;
 +      unsigned int i;
 +
 +      for (i = 0; i < submit->nr_cmds; i++) {
 +              switch (submit->cmd[i].type) {
 +              case MSM_SUBMIT_CMD_IB_TARGET_BUF:
 +                      break;
 +              case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
 +                      if (priv->lastctx == ctx)
 +                              break;
 +              case MSM_SUBMIT_CMD_BUF:
 +                      /* copy commands into RB: */
 +                      obj = submit->bos[submit->cmd[i].idx].obj;
 +                      dwords = submit->cmd[i].size;
 +
 +                      ptr = msm_gem_get_vaddr(&obj->base);
 +
 +                      /* _get_vaddr() shouldn't fail at this point,
 +                       * since we've already mapped it once in
 +                       * submit_reloc()
 +                       */
 +                      if (WARN_ON(!ptr))
 +                              return;
 +
 +                      for (i = 0; i < dwords; i++) {
 +                              /* normally the OUT_PKTn() would wait
 +                               * for space for the packet.  But since
 +                               * we just OUT_RING() the whole thing,
 +                               * need to call adreno_wait_ring()
 +                               * ourself:
 +                               */
 +                              adreno_wait_ring(ring, 1);
 +                              OUT_RING(ring, ptr[i]);
 +                      }
 +
 +                      msm_gem_put_vaddr(&obj->base);
 +
 +                      break;
 +              }
 +      }
 +
 +      a5xx_flush(gpu, ring);
 +      a5xx_preempt_trigger(gpu);
 +
 +      /* we might not necessarily have a cmd from userspace to
 +       * trigger an event to know that submit has completed, so
 +       * do this manually:
 +       */
 +      a5xx_idle(gpu, ring);
 +      ring->memptrs->fence = submit->seqno;
 +      msm_gpu_retire(gpu);
 +}
 +
  static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
        struct msm_file_private *ctx)
  {
        struct msm_ringbuffer *ring = submit->ring;
        unsigned int i, ibs = 0;
  
 +      if (IS_ENABLED(CONFIG_DRM_MSM_GPU_SUDO) && submit->in_rb) {
 +              priv->lastctx = NULL;
 +              a5xx_submit_in_rb(gpu, submit, ctx);
 +              return;
 +      }
 +
        OUT_PKT7(ring, CP_PREEMPT_ENABLE_GLOBAL, 1);
        OUT_RING(ring, 0x02);
  
@@@ -497,6 -432,25 +497,6 @@@ static int a5xx_preempt_start(struct ms
        return a5xx_idle(gpu, ring) ? 0 : -EINVAL;
  }
  
 -
 -static struct drm_gem_object *a5xx_ucode_load_bo(struct msm_gpu *gpu,
 -              const struct firmware *fw, u64 *iova)
 -{
 -      struct drm_gem_object *bo;
 -      void *ptr;
 -
 -      ptr = msm_gem_kernel_new_locked(gpu->dev, fw->size - 4,
 -              MSM_BO_UNCACHED | MSM_BO_GPU_READONLY, gpu->aspace, &bo, iova);
 -
 -      if (IS_ERR(ptr))
 -              return ERR_CAST(ptr);
 -
 -      memcpy(ptr, &fw->data[4], fw->size - 4);
 -
 -      msm_gem_put_vaddr(bo);
 -      return bo;
 -}
 -
  static int a5xx_ucode_init(struct msm_gpu *gpu)
  {
        struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
        int ret;
  
        if (!a5xx_gpu->pm4_bo) {
 -              a5xx_gpu->pm4_bo = a5xx_ucode_load_bo(gpu, adreno_gpu->pm4,
 -                      &a5xx_gpu->pm4_iova);
 +              a5xx_gpu->pm4_bo = adreno_fw_create_bo(gpu,
 +                      adreno_gpu->fw[ADRENO_FW_PM4], &a5xx_gpu->pm4_iova);
  
                if (IS_ERR(a5xx_gpu->pm4_bo)) {
                        ret = PTR_ERR(a5xx_gpu->pm4_bo);
        }
  
        if (!a5xx_gpu->pfp_bo) {
 -              a5xx_gpu->pfp_bo = a5xx_ucode_load_bo(gpu, adreno_gpu->pfp,
 -                      &a5xx_gpu->pfp_iova);
 +              a5xx_gpu->pfp_bo = adreno_fw_create_bo(gpu,
 +                      adreno_gpu->fw[ADRENO_FW_PFP], &a5xx_gpu->pfp_iova);
  
                if (IS_ERR(a5xx_gpu->pfp_bo)) {
                        ret = PTR_ERR(a5xx_gpu->pfp_bo);
@@@ -839,19 -793,19 +839,19 @@@ static void a5xx_destroy(struct msm_gp
        if (a5xx_gpu->pm4_bo) {
                if (a5xx_gpu->pm4_iova)
                        msm_gem_put_iova(a5xx_gpu->pm4_bo, gpu->aspace);
 -              drm_gem_object_unreference_unlocked(a5xx_gpu->pm4_bo);
 +              drm_gem_object_put_unlocked(a5xx_gpu->pm4_bo);
        }
  
        if (a5xx_gpu->pfp_bo) {
                if (a5xx_gpu->pfp_iova)
                        msm_gem_put_iova(a5xx_gpu->pfp_bo, gpu->aspace);
 -              drm_gem_object_unreference_unlocked(a5xx_gpu->pfp_bo);
 +              drm_gem_object_put_unlocked(a5xx_gpu->pfp_bo);
        }
  
        if (a5xx_gpu->gpmu_bo) {
                if (a5xx_gpu->gpmu_iova)
                        msm_gem_put_iova(a5xx_gpu->gpmu_bo, gpu->aspace);
 -              drm_gem_object_unreference_unlocked(a5xx_gpu->gpmu_bo);
 +              drm_gem_object_put_unlocked(a5xx_gpu->gpmu_bo);
        }
  
        adreno_gpu_cleanup(adreno_gpu);
@@@ -1241,7 -1195,6 +1241,7 @@@ static const struct adreno_gpu_funcs fu
                .destroy = a5xx_destroy,
  #ifdef CONFIG_DEBUG_FS
                .show = a5xx_show,
 +              .debugfs_init = a5xx_debugfs_init,
  #endif
                .gpu_busy = a5xx_gpu_busy,
        },
diff --combined drivers/soc/qcom/Kconfig
@@@ -37,7 -37,7 +37,7 @@@ config QCOM_P
  
  config QCOM_QMI_HELPERS
        tristate
-       depends on ARCH_QCOM
+       depends on ARCH_QCOM && NET
        help
          Helper library for handling QMI encoded messages.  QMI encoded
          messages are used in communication between the majority of QRTR
@@@ -47,7 -47,6 +47,7 @@@
  config QCOM_RMTFS_MEM
        tristate "Qualcomm Remote Filesystem memory driver"
        depends on ARCH_QCOM
 +      select QCOM_SCM
        help
          The Qualcomm remote filesystem memory driver is used for allocating
          and exposing regions of shared memory with remote processors for the
diff --combined samples/Kconfig
@@@ -62,6 -62,16 +62,16 @@@ config SAMPLE_KD
          Build an example of how to dynamically add the hello
          command to the kdb shell.
  
+ config SAMPLE_QMI_CLIENT
+       tristate "Build qmi client sample -- loadable modules only"
+       depends on m
+       depends on ARCH_QCOM
+       depends on NET
+       select QCOM_QMI_HELPERS
+       help
+         Build an QMI client sample driver, which demonstrates how to
+         communicate with a remote QRTR service, using QMI encoded messages.
  config SAMPLE_RPMSG_CLIENT
        tristate "Build rpmsg client sample -- loadable modules only"
        depends on RPMSG && m
@@@ -98,6 -108,12 +108,6 @@@ config SAMPLE_SECCOM
          Build samples of seccomp filters using various methods of
          BPF filter construction.
  
 -config SAMPLE_BLACKFIN_GPTIMERS
 -      tristate "Build blackfin gptimers sample code -- loadable modules only"
 -      depends on BLACKFIN && BFIN_GPTIMERS && m
 -      help
 -        Build samples of blackfin gptimers sample module.
 -
  config SAMPLE_VFIO_MDEV_MTTY
        tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
        depends on VFIO_MDEV_DEVICE && m
diff --combined samples/Makefile
@@@ -2,5 -2,5 +2,5 @@@
  
  obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \
                           hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
 -                         configfs/ connector/ v4l/ trace_printk/ blackfin/ \
 +                         configfs/ connector/ v4l/ trace_printk/ \
-                          vfio-mdev/ statx/
+                          vfio-mdev/ statx/ qmi/