Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit feda33ef authored by Alex Dai's avatar Alex Dai Committed by Daniel Vetter
Browse files

drm/i915/guc: Add GuC css header parser



The size / offset information of all firmware ingredients are
now caculated from header. Driver will validate the header and
rsa key size. If any component is out of boundary, driver will
reject the loading too.

v6: Clean up warnings from make docs

v5: Tidy up GuC titles in kernel/Doc

v4: Now using 'size_dw' for those defined in css_header

v3: 1) Move DOC to intel_guc_fwif.h right before css_header
definition. Add more comments.
    2) Change 'size' to 'len' or 'length' to avoid confusion.
    3) Add UOS_RSA_SCRATCH_MAX_COUNT according to BSpec. And
driver validate size of RSA key now.
    4) Add fw component size/offset info to intel_guc_fw.

v2: Add indent into DOC to make fixed-width format rather than
change the tmpl.

v1: 1) guc_css_header is defined as __packed now
    2) Add and correct GuC related topics in kernel/Doc

Signed-off-by: default avatarAlex Dai <yu.dai@intel.com>
Reviewed-by: default avatarDave Gordon <david.s.gordon@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent e87a005d
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -4239,17 +4239,21 @@ int num_ioctls;</synopsis>
      </sect2>
    </sect1>
    <sect1>
      <title>GuC-based Command Submission</title>
      <sect2>
      <title>GuC</title>
      <sect2>
        <title>GuC-specific firmware loader</title>
!Pdrivers/gpu/drm/i915/intel_guc_loader.c GuC-specific firmware loader
!Idrivers/gpu/drm/i915/intel_guc_loader.c
      </sect2>
      <sect2>
        <title>GuC Client</title>
!Pdrivers/gpu/drm/i915/i915_guc_submission.c GuC-based command submissison
        <title>GuC-based command submission</title>
!Pdrivers/gpu/drm/i915/i915_guc_submission.c GuC-based command submission
!Idrivers/gpu/drm/i915/i915_guc_submission.c
      </sect2>
      <sect2>
        <title>GuC Firmware Layout</title>
!Pdrivers/gpu/drm/i915/intel_guc_fwif.h GuC Firmware Layout
      </sect2>
    </sect1>

    <sect1>
+6 −0
Original line number Diff line number Diff line
@@ -2403,6 +2403,12 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data)
		guc_fw->guc_fw_major_wanted, guc_fw->guc_fw_minor_wanted);
	seq_printf(m, "\tversion found: %d.%d\n",
		guc_fw->guc_fw_major_found, guc_fw->guc_fw_minor_found);
	seq_printf(m, "\theader: offset is %d; size = %d\n",
		guc_fw->header_offset, guc_fw->header_size);
	seq_printf(m, "\tuCode: offset is %d; size = %d\n",
		guc_fw->ucode_offset, guc_fw->ucode_size);
	seq_printf(m, "\tRSA: offset is %d; size = %d\n",
		guc_fw->rsa_offset, guc_fw->rsa_size);

	tmp = I915_READ(GUC_STATUS);

+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#define SOFT_SCRATCH(n)			(0xc180 + ((n) * 4))

#define UOS_RSA_SCRATCH(i)		(0xc200 + (i) * 4)
#define   UOS_RSA_SCRATCH_MAX_COUNT	  64
#define DMA_ADDR_0_LOW			0xc300
#define DMA_ADDR_0_HIGH			0xc304
#define DMA_ADDR_1_LOW			0xc308
+4 −4
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include "intel_guc.h"

/**
 * DOC: GuC Client
 * DOC: GuC-based command submission
 *
 * i915_guc_client:
 * We use the term client to avoid confusion with contexts. A i915_guc_client is
@@ -588,8 +588,7 @@ static void lr_context_update(struct drm_i915_gem_request *rq)
/**
 * i915_guc_submit() - Submit commands through GuC
 * @client:	the guc client where commands will go through
 * @ctx:	LRC where commands come from
 * @ring:	HW engine that will excute the commands
 * @rq:		request associated with the commands
 *
 * Return:	0 if succeed
 */
@@ -731,7 +730,8 @@ static void guc_client_free(struct drm_device *dev,
 * 		The kernel client to replace ExecList submission is created with
 * 		NORMAL priority. Priority of a client for scheduler can be HIGH,
 * 		while a preemption context can use CRITICAL.
 * @ctx		the context to own the client (we use the default render context)
 * @ctx:	the context that owns the client (we use the default render
 * 		context)
 *
 * Return:	An i915_guc_client object if success.
 */
+7 −1
Original line number Diff line number Diff line
@@ -76,11 +76,17 @@ struct intel_guc_fw {
	uint16_t			guc_fw_minor_wanted;
	uint16_t			guc_fw_major_found;
	uint16_t			guc_fw_minor_found;

	uint32_t header_size;
	uint32_t header_offset;
	uint32_t rsa_size;
	uint32_t rsa_offset;
	uint32_t ucode_size;
	uint32_t ucode_offset;
};

struct intel_guc {
	struct intel_guc_fw guc_fw;

	uint32_t log_flags;
	struct drm_i915_gem_object *log_obj;

Loading