summaryrefslogtreecommitdiff
path: root/drivers/crypto/qat
diff options
context:
space:
mode:
authorJack Xu <jack.xu@intel.com>2020-11-06 19:27:46 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2020-11-13 20:38:49 +1100
commit72b67d9507b954b5b5f4cecb74bcefff61a28d8c (patch)
treec027b00b11f694fe3445315974421a1aa7887daf /drivers/crypto/qat
parentee103cf1f5af03ae300dcfdbe0f51ae12ce35dec (diff)
crypto: qat - add support for relative FW ucode loading
Improve the way micro instructions (FW code) are uploaded to Accelerator Engines (AEs). If code starts at PC zero (absolute addressing), read uwords with no relative address. Otherwise, use relative addressing to the page region. Signed-off-by: Jack Xu <jack.xu@intel.com> Co-developed-by: Wojciech Ziemba <wojciech.ziemba@intel.com> Signed-off-by: Wojciech Ziemba <wojciech.ziemba@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/qat')
-rw-r--r--drivers/crypto/qat/qat_common/qat_uclo.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/crypto/qat/qat_common/qat_uclo.c b/drivers/crypto/qat/qat_common/qat_uclo.c
index dc2f2dcf21b8..1c03205c7166 100644
--- a/drivers/crypto/qat/qat_common/qat_uclo.c
+++ b/drivers/crypto/qat/qat_common/qat_uclo.c
@@ -1735,21 +1735,22 @@ static void qat_uclo_fill_uwords(struct icp_qat_uclo_objhandle *obj_handle,
u64 *uword, unsigned int addr_p,
unsigned int raddr, u64 fill)
{
+ unsigned int i, addr;
u64 uwrd = 0;
- unsigned int i;
if (!encap_page) {
*uword = fill;
return;
}
+ addr = (encap_page->page_region) ? raddr : addr_p;
for (i = 0; i < encap_page->uwblock_num; i++) {
- if (raddr >= encap_page->uwblock[i].start_addr &&
- raddr <= encap_page->uwblock[i].start_addr +
+ if (addr >= encap_page->uwblock[i].start_addr &&
+ addr <= encap_page->uwblock[i].start_addr +
encap_page->uwblock[i].words_num - 1) {
- raddr -= encap_page->uwblock[i].start_addr;
- raddr *= obj_handle->uword_in_bytes;
+ addr -= encap_page->uwblock[i].start_addr;
+ addr *= obj_handle->uword_in_bytes;
memcpy(&uwrd, (void *)(((uintptr_t)
- encap_page->uwblock[i].micro_words) + raddr),
+ encap_page->uwblock[i].micro_words) + addr),
obj_handle->uword_in_bytes);
uwrd = uwrd & 0xbffffffffffull;
}