Commit 8573df34 authored by Daniel Vetter's avatar Daniel Vetter
Browse files

Merge tag 'drm-misc-next-fixes-2023-02-09' of...

Merge tag 'drm-misc-next-fixes-2023-02-09' of git://anongit.freedesktop.org/drm/drm-misc

 into drm-next

Short summary of fixes pull:

Contains a number of fixes to vc4 and ivpu. The patches to the probe
helpers were cherry-picked from the regular development branch.

Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/Y+S6HBmaRJNPYiBG@linux-uq9g
parents 48075a66 467fbc77
Loading
Loading
Loading
Loading
+22 −12
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@ properties:
  compatible:
    const: visionox,vtdr6130

  reg:
    maxItems: 1
    description: DSI virtual channel

  vddio-supply: true
  vci-supply: true
  vdd-supply: true
@@ -26,6 +30,7 @@ additionalProperties: false

required:
  - compatible
  - reg
  - vddio-supply
  - vci-supply
  - vdd-supply
@@ -35,8 +40,12 @@ required:
examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    panel {
    dsi {
        #address-cells = <1>;
        #size-cells = <0>;
        panel@0 {
            compatible = "visionox,vtdr6130";
            reg = <0>;

            vddio-supply = <&vreg_l12b_1p8>;
            vci-supply = <&vreg_l13b_3p0>;
@@ -50,4 +59,5 @@ examples:
                };
            };
        };
    };
...
+2 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ static void file_priv_release(struct kref *ref)

	ivpu_cmdq_release_all(file_priv);
	ivpu_bo_remove_all_bos_from_context(&file_priv->ctx);
	ivpu_jsm_context_release(vdev, file_priv->ctx.id);
	ivpu_mmu_user_context_fini(vdev, &file_priv->ctx);
	drm_WARN_ON(&vdev->drm, xa_erase_irq(&vdev->context_xa, file_priv->ctx.id) != file_priv);
	mutex_destroy(&file_priv->lock);
@@ -427,6 +428,7 @@ static int ivpu_pci_init(struct ivpu_device *vdev)
		ivpu_err(vdev, "Failed to set DMA mask: %d\n", ret);
		return ret;
	}
	dma_set_max_seg_size(vdev->drm.dev, UINT_MAX);

	/* Clear any pending errors */
	pcie_capability_clear_word(pdev, PCI_EXP_DEVSTA, 0x3f);
+24 −13
Original line number Diff line number Diff line
@@ -32,10 +32,11 @@

#define ADDR_TO_L2_CACHE_CFG(addr) ((addr) >> 31)

#define IVPU_FW_CHECK_API(vdev, fw_hdr, name) ivpu_fw_check_api(vdev, fw_hdr, #name, \
#define IVPU_FW_CHECK_API(vdev, fw_hdr, name, min_major) \
	ivpu_fw_check_api(vdev, fw_hdr, #name, \
			  VPU_##name##_API_VER_INDEX, \
			  VPU_##name##_API_VER_MAJOR, \
								  VPU_##name##_API_VER_MINOR)
			  VPU_##name##_API_VER_MINOR, min_major)

static char *ivpu_firmware;
module_param_named_unsafe(firmware, ivpu_firmware, charp, 0644);
@@ -63,19 +64,27 @@ static int ivpu_fw_request(struct ivpu_device *vdev)
	return ret;
}

static void
static int
ivpu_fw_check_api(struct ivpu_device *vdev, const struct vpu_firmware_header *fw_hdr,
		  const char *str, int index, u16 expected_major, u16 expected_minor)
		  const char *str, int index, u16 expected_major, u16 expected_minor,
		  u16 min_major)
{
	u16 major = (u16)(fw_hdr->api_version[index] >> 16);
	u16 minor = (u16)(fw_hdr->api_version[index]);

	if (major < min_major) {
		ivpu_err(vdev, "Incompatible FW %s API version: %d.%d, required %d.0 or later\n",
			 str, major, minor, min_major);
		return -EINVAL;
	}
	if (major != expected_major) {
		ivpu_warn(vdev, "Incompatible FW %s API version: %d.%d (expected %d.%d)\n",
		ivpu_warn(vdev, "Major FW %s API version different: %d.%d (expected %d.%d)\n",
			  str, major, minor, expected_major, expected_minor);
	}
	ivpu_dbg(vdev, FW_BOOT, "FW %s API version: %d.%d (expected %d.%d)\n",
		 str, major, minor, expected_major, expected_minor);

	return 0;
}

static int ivpu_fw_parse(struct ivpu_device *vdev)
@@ -131,6 +140,14 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
		ivpu_err(vdev, "Invalid entry point: 0x%llx\n", fw_hdr->entry_point);
		return -EINVAL;
	}
	ivpu_dbg(vdev, FW_BOOT, "Header version: 0x%x, format 0x%x\n",
		 fw_hdr->header_version, fw_hdr->image_format);
	ivpu_dbg(vdev, FW_BOOT, "FW version: %s\n", (char *)fw_hdr + VPU_FW_HEADER_SIZE);

	if (IVPU_FW_CHECK_API(vdev, fw_hdr, BOOT, 3))
		return -EINVAL;
	if (IVPU_FW_CHECK_API(vdev, fw_hdr, JSM, 3))
		return -EINVAL;

	fw->runtime_addr = runtime_addr;
	fw->runtime_size = runtime_size;
@@ -141,16 +158,10 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
	fw->cold_boot_entry_point = fw_hdr->entry_point;
	fw->entry_point = fw->cold_boot_entry_point;

	ivpu_dbg(vdev, FW_BOOT, "Header version: 0x%x, format 0x%x\n",
		 fw_hdr->header_version, fw_hdr->image_format);
	ivpu_dbg(vdev, FW_BOOT, "Size: file %lu image %u runtime %u shavenn %u\n",
		 fw->file->size, fw->image_size, fw->runtime_size, fw->shave_nn_size);
	ivpu_dbg(vdev, FW_BOOT, "Address: runtime 0x%llx, load 0x%llx, entry point 0x%llx\n",
		 fw->runtime_addr, image_load_addr, fw->entry_point);
	ivpu_dbg(vdev, FW_BOOT, "FW version: %s\n", (char *)fw_hdr + VPU_FW_HEADER_SIZE);

	IVPU_FW_CHECK_API(vdev, fw_hdr, BOOT);
	IVPU_FW_CHECK_API(vdev, fw_hdr, JSM);

	return 0;
}
+2 −6
Original line number Diff line number Diff line
@@ -42,9 +42,7 @@ static int prime_map_pages_locked(struct ivpu_bo *bo)
	struct ivpu_device *vdev = ivpu_bo_to_vdev(bo);
	struct sg_table *sgt;

	WARN_ON(!bo->base.import_attach);

	sgt = dma_buf_map_attachment(bo->base.import_attach, DMA_BIDIRECTIONAL);
	sgt = dma_buf_map_attachment_unlocked(bo->base.import_attach, DMA_BIDIRECTIONAL);
	if (IS_ERR(sgt)) {
		ivpu_err(vdev, "Failed to map attachment: %ld\n", PTR_ERR(sgt));
		return PTR_ERR(sgt);
@@ -56,9 +54,7 @@ static int prime_map_pages_locked(struct ivpu_bo *bo)

static void prime_unmap_pages_locked(struct ivpu_bo *bo)
{
	WARN_ON(!bo->base.import_attach);

	dma_buf_unmap_attachment(bo->base.import_attach, bo->sgt, DMA_BIDIRECTIONAL);
	dma_buf_unmap_attachment_unlocked(bo->base.import_attach, bo->sgt, DMA_BIDIRECTIONAL);
	bo->sgt = NULL;
}

+3 −2
Original line number Diff line number Diff line
@@ -400,8 +400,9 @@ static int ivpu_direct_job_submission(struct ivpu_job *job)
	if (ret)
		goto err_xa_erase;

	ivpu_dbg(vdev, JOB, "Job submitted: id %3u ctx %2d engine %d next %d\n",
		 job->job_id, file_priv->ctx.id, job->engine_idx, cmdq->jobq->header.tail);
	ivpu_dbg(vdev, JOB, "Job submitted: id %3u addr 0x%llx ctx %2d engine %d next %d\n",
		 job->job_id, job->cmd_buf_vpu_addr, file_priv->ctx.id,
		 job->engine_idx, cmdq->jobq->header.tail);

	if (ivpu_test_mode == IVPU_TEST_MODE_NULL_HW) {
		ivpu_job_done(vdev, job->job_id, VPU_JSM_STATUS_SUCCESS);
Loading