Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4526980ybl; Tue, 20 Aug 2019 13:25:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx015RxWiWwCafWDsmT+sLo3cqPq5lEPHyxm8a3RyDCsp1GrgHQsGhmDbp4EKkw7df5iMkU X-Received: by 2002:a63:506:: with SMTP id 6mr26138037pgf.434.1566332719891; Tue, 20 Aug 2019 13:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566332719; cv=none; d=google.com; s=arc-20160816; b=Ppe1C75OGDfh7T7yFAD+BFsa81Z6uBdi5cqaPmR7J1RZST90l7NIjIqKgXPaYxTGVN y+8Ogs3V/hP1N+ohC5wWcw/yQsdgUmvuRSTiRaqSY+qLsy18/iCR2ZaLnlwMfaZL25lB LHnbRCygO+aVcY23WfAqUGu621ED+ZcVog18Y4o/bahmI0EqeWVMq8+cRsiYtLLx729s HNRpkuZAkwya47Fc0pQF7S+8ANEy+nj/vi1YN5uIdVXKK6TazLbzxkCNVKjY7uocH5n/ KoHBG6tQvc5Wa4uMlFmhqX+n9rDVTw7zjsIErgYU+IL+Urewe+yVKV2edUnoXHLVC4rj ceKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=41CIshzGWkv7KtXuXJVjibF9O1EhLdAcmlG3QhRo590=; b=XySw702rwOWbwsxcf+ocRQT13jfJp+CywveM42BTg+HJwZrFSS9POJuAkBi5xC0dES fMqKctaqJXlbUp//sle55NkcyIVRE6wnYeCKfXi9kH3OdkA61QaT03clGkZlzIaJfP2b rHHDXdlC2cRgkg34hUp0Dnw3VHIaUHA+Y9nnzsAhuEG3rehdy394f5zYD1XwyQQ4BmER UiNiDqAtau6gMZiQlbgVgPnoQYJBTPsOz7F6r7r0zAu1h347Qjv1Eaw+E0oBGTFjVokM U4Ebx9csXtY7hOjDDtkNZLLJlEvBHjXNLlQtAfn49fWDzkirkhmk3tXd0Fg0sf8/KsWp Oj6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=o4TkNsG4; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91si13289152ply.113.2019.08.20.13.25.06; Tue, 20 Aug 2019 13:25:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=o4TkNsG4; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731002AbfHTUYg (ORCPT + 99 others); Tue, 20 Aug 2019 16:24:36 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38486 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731001AbfHTUYg (ORCPT ); Tue, 20 Aug 2019 16:24:36 -0400 Received: by mail-pl1-f195.google.com with SMTP id m12so40149plt.5; Tue, 20 Aug 2019 13:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=41CIshzGWkv7KtXuXJVjibF9O1EhLdAcmlG3QhRo590=; b=o4TkNsG4VKGXmj8YecwUAjiTxuLXqo5mRq+0lyNxOn/ihNYecJUEwCBzd5xoZPHnJG XCC2NM29L+STqa2/HODLoDePubSqmqpnmgFjWPuk3SSRMn1SLFPmrx7UpPC0KxQwZykn 8E9oUCrzNL4sxwAZkwcFw/nZAFcAh5BjFQ8/byVTamR56VVMyMsbFNLeUyshNi2hQNy7 b0yJwbRJnkJgpi5Ee4CLWDA8xszBN0LVMB2S2SfjhqrzAGd2OZ3cmwR3f+gmfiROkZpS Fnesxz3t8erJyvzCQdMyCayLlEyri4NmspQzL1LpN0XsK9s7QLGniZ15gtpv5m1b5wqj uNow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=41CIshzGWkv7KtXuXJVjibF9O1EhLdAcmlG3QhRo590=; b=el9SVmYDhQxECO4PC692r9A61DibWA2YV3tZu4wMUh87Q4eOGRAi5Fo+q5i+eWY6bo Q2+lbh0iZNf9fSVQGJfWAi5ZuhAy0jdpKFEX0xyZ5WNCKvGjhrytV9YRlZ7l9I0E2Zsc 1hN2qN+IgbC7YgN7QRFlP5gNgMxZbIpD0NFuaOPqESm7uxQpEiLuKjR9UTYB7BYgWWXF 9xlXms7VyXas10VHaIv9xH05Poen33jb+hmuZ//kIvMnRB7q+f55bYxChHvrbDUJxgJH Shw8sskuBTsXg55a4oR+Ul7mCFpVkC5X6+zu88Nx0CTe+OLWDkljEOgEYI+cElB0yTZt xJYA== X-Gm-Message-State: APjAAAUlp/PwCn7XpqJvZdsYt6ooGhUdQBwwQbTA6HH9FTUooxEdiVjT 5dv2TRe2NmksAEK9Kf6BzkT9pfYNnLc= X-Received: by 2002:a17:902:41:: with SMTP id 59mr7843549pla.268.1566332675116; Tue, 20 Aug 2019 13:24:35 -0700 (PDT) Received: from localhost.lan (c-67-185-54-80.hsd1.wa.comcast.net. [67.185.54.80]) by smtp.gmail.com with ESMTPSA id k3sm36149846pfg.23.2019.08.20.13.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 13:24:34 -0700 (PDT) From: Andrey Smirnov To: linux-crypto@vger.kernel.org Cc: Andrey Smirnov , Chris Spencer , Cory Tusar , Chris Healy , Lucas Stach , =?UTF-8?q?Horia=20Geant=C4=83?= , Aymen Sghaier , Leonard Crestez , linux-kernel@vger.kernel.org Subject: [PATCH v8 12/16] crypto: caam - don't hardcode inpentry size Date: Tue, 20 Aug 2019 13:23:58 -0700 Message-Id: <20190820202402.24951-13-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190820202402.24951-1-andrew.smirnov@gmail.com> References: <20190820202402.24951-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Using dma_addr_t for elements of JobR input ring is not appropriate on all 64-bit SoCs, some of which, like i.MX8MQ, use only 32-bit wide pointers there. Convert all of the code to use explicit helper function that can be later extended to support i.MX8MQ. No functional change intended. Signed-off-by: Andrey Smirnov Cc: Chris Spencer Cc: Cory Tusar Cc: Chris Healy Cc: Lucas Stach Cc: Horia Geantă Cc: Aymen Sghaier Cc: Leonard Crestez Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/crypto/caam/intern.h | 3 ++- drivers/crypto/caam/jr.c | 4 ++-- drivers/crypto/caam/regs.h | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h index 081805c0f88b..c00c7c84ec84 100644 --- a/drivers/crypto/caam/intern.h +++ b/drivers/crypto/caam/intern.h @@ -55,7 +55,8 @@ struct caam_drv_private_jr { spinlock_t inplock ____cacheline_aligned; /* Input ring index lock */ u32 inpring_avail; /* Number of free entries in input ring */ int head; /* entinfo (s/w ring) head index */ - dma_addr_t *inpring; /* Base of input ring, alloc DMA-safe */ + void *inpring; /* Base of input ring, alloc + * DMA-safe */ int out_ring_read_index; /* Output index "tail" */ int tail; /* entinfo (s/w ring) tail index */ void *outring; /* Base of output ring, DMA-safe */ diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 6c91f38862e4..417ad52615c6 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -388,7 +388,7 @@ int caam_jr_enqueue(struct device *dev, u32 *desc, head_entry->cbkarg = areq; head_entry->desc_addr_dma = desc_dma; - jrp->inpring[head] = cpu_to_caam_dma(desc_dma); + jr_inpentry_set(jrp->inpring, head, cpu_to_caam_dma(desc_dma)); /* * Guarantee that the descriptor's DMA address has been written to @@ -434,7 +434,7 @@ static int caam_jr_init(struct device *dev) if (error) return error; - jrp->inpring = dmam_alloc_coherent(dev, sizeof(*jrp->inpring) * + jrp->inpring = dmam_alloc_coherent(dev, SIZEOF_JR_INPENTRY * JOBR_DEPTH, &inpbusaddr, GFP_KERNEL); if (!jrp->inpring) diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index cf73015b3be0..6dbb269a3e7e 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -244,6 +244,15 @@ static inline u32 jr_outentry_jrstatus(void *outring, int hw_idx) return jrstatus; } +static inline void jr_inpentry_set(void *inpring, int hw_idx, dma_addr_t val) +{ + dma_addr_t *inpentry = inpring; + + inpentry[hw_idx] = val; +} + +#define SIZEOF_JR_INPENTRY caam_ptr_sz + /* Version registers (Era 10+) e80-eff */ struct version_regs { -- 2.21.0