summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
diff options
context:
space:
mode:
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>2019-07-25 03:18:10 +0300
committerChris Wilson <chris@chris-wilson.co.uk>2019-07-25 09:30:41 +0300
commit90dd992260cc44cec8f6e41ab5e64938921912c0 (patch)
tree138efa0058c54964d4338369596e39f51503ded5 /drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
parent91e55e545ab8bbedd3a518dbe6124c10388ff92f (diff)
downloadlinux-90dd992260cc44cec8f6e41ab5e64938921912c0.tar.xz
drm/i915/uc: Move xfer rsa logic to common function
The way we copy the RSA is the same for GuC and HuC, so we can move the logic in a common function. this will also make any update needed for local memory easier. v2: return the number of copied bytes and check it (Chris) Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> #v1 Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20190725001813.4740-6-daniele.ceraolospurio@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c')
-rw-r--r--drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
index ba2e1a835830..472568843ccf 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
@@ -36,17 +36,17 @@ void intel_huc_fw_init_early(struct intel_huc *huc)
static void huc_xfer_rsa(struct intel_huc *huc)
{
- struct intel_uc_fw *fw = &huc->fw;
- struct sg_table *pages = fw->obj->mm.pages;
+ size_t copied;
/*
* HuC firmware image is outside GuC accessible range.
* Copy the RSA signature out of the image into
* the perma-pinned region set aside for it
*/
- sg_pcopy_to_buffer(pages->sgl, pages->nents,
- huc->rsa_data_vaddr, fw->rsa_size,
- fw->rsa_offset);
+ GEM_BUG_ON(huc->fw.rsa_size > huc->rsa_data->size);
+ copied = intel_uc_fw_copy_rsa(&huc->fw, huc->rsa_data_vaddr,
+ huc->rsa_data->size);
+ GEM_BUG_ON(copied < huc->fw.rsa_size);
}
static int huc_xfer_ucode(struct intel_huc *huc)