Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5245858ybl; Tue, 14 Jan 2020 06:01:00 -0800 (PST) X-Google-Smtp-Source: APXvYqzdcJQLvU4n3sD8Q+jhgBp03aK6B2nj/cdlnA41pCiYP5QX1PP0A6XMCFs5+gv5X4iPqU7k X-Received: by 2002:aca:fcd1:: with SMTP id a200mr16117555oii.74.1579010460664; Tue, 14 Jan 2020 06:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579010460; cv=none; d=google.com; s=arc-20160816; b=AgRECPMJfvTKInqTQ8rfGcR11S+6VIPEl4hINKEnT8iWv/NdEN91F0si6oTYw4gh8B j35fNq6IhMQlG4PDDhvb2IgSs362qHtOL7q6LviFsUIMlW37QGq424pmFncXEJnwNfGZ HqxNSVDvWNSTI6uAr/52yRj4d9PVBLlG/PlarUl3zAwmW/e04Wo1pfZdJUlyJR4jGOv7 VsXDqzWxtwufP8bKE0QkVvnbxf8qdctwXC/un0QNr+mDEXBwFZpdv+I1FxbAtn1sz1ri mr9KnqgGGe0wgKk6o1RlgbsfPBx0i55V8xqlZjfu7uHmaWy1Q0t6Kf0mu/1Sg01+nuG0 4o4Q== 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=+qS8cmFG129sXx7XLwvT27GqZEqHpjOOs5rdHnFSHiU=; b=lW02l1zBkpwKpYHBfXkt8TBrtAwhFpzUReSfnmTDIbjk40mgRRV3Kapco3d4QXIwUz b+miroGzJdp2RJT1CPLyDLgPUIuU1pRUy+hOf9ms7WLy2Ekab+y1Hk1VbULGDS9gFhuD AurSWu3Z8454NKffkd+5AYEGtLGbRD02KLt5FgGhrlIyH8bpz6mGoeepOUgvGcmqSrLF VK6Im91FLWE1SDg79ih1USU4psbgEmg+qeto2Ru0YMLrDnv8qPYrYi/zC75kZTKYIwnQ w7CLrIAMEiSTX8GtikKbfghV8DxqU3B+yAN1lr2mjzoReLaustjZ1qEHgq4jRL57FaBx OOaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IZGzjrkK; 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 d3si7691820oia.236.2020.01.14.06.00.49; Tue, 14 Jan 2020 06:01:00 -0800 (PST) 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=IZGzjrkK; 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 S1729014AbgANOAD (ORCPT + 99 others); Tue, 14 Jan 2020 09:00:03 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39330 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728975AbgANOAC (ORCPT ); Tue, 14 Jan 2020 09:00:02 -0500 Received: by mail-wm1-f67.google.com with SMTP id 20so13832894wmj.4; Tue, 14 Jan 2020 06:00:01 -0800 (PST) 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=+qS8cmFG129sXx7XLwvT27GqZEqHpjOOs5rdHnFSHiU=; b=IZGzjrkKewPPH+1qPChWS+BhLPaglsstZcFbIFMqVrWlnEyYo4D//EwlO073t5dWRt wsEUkhhhPmT8ar86gm41TZiFZdKhJ2hH3xwEbn3ADew+ZParRG4n8k5o10jGL1LVRUU2 BrBFsb3E1LCR5wy9kjfteNYmsmUS3a6zFMW85ywB2QE/McqEpFsR6LhS7Q4jCZc/iMUv PlIJAqPajK75h7F0rRdhNWoe63r2OhG9YYn/0wMxi/hX/wkIBchGVH/aHmOKmpMenkfJ zmjXb4+u1GtLTbLFq3gs2YUvR/hG+0pZd1Z57g5j0ZHtScUCIuDBo32GjFTElntjiR5m nDvw== 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=+qS8cmFG129sXx7XLwvT27GqZEqHpjOOs5rdHnFSHiU=; b=q11OWSEesovI4m+PrmHb30wvYAYC7nz1KzpRnOcRUZF9W1C9JDl+iXyHmW0WHxIwGu FXz0+2x4dJS6vAXqQ5aKfwaxO48MTKFw5fUceINWEHp0zX9/dZlopz/AorZLIPzAsGVY 108kCqdTt7S9jlFfDXkbikTpxHyDV4vCCi3avci8wEzWFyHVLrWR4UWNpMNlA9UWUcB8 N2kJmXTDqxNeiOQB41sAPtI6yeniLrjCZ4loK0N5IFtBRF1jV+De9Gc/vGAJOz4U1RJY eqnm6/DBmwwlwN645flm4wJKgspUtwyY4IPtRFgVGWZZQkjQ07AEg8XLWPDwBSBFOh8p NBtw== X-Gm-Message-State: APjAAAVFM5pMxiuHUGsiE8nOu/TQe7i+oMDmXnAqOCpPbr8+UK6dTw7j 25pQMgIwqsM6fgJJWpfOq4E= X-Received: by 2002:a1c:a702:: with SMTP id q2mr27788126wme.6.1579010400417; Tue, 14 Jan 2020 06:00:00 -0800 (PST) Received: from Red.localdomain ([2a01:cb1d:147:7200:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id 4sm17854448wmg.22.2020.01.14.05.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 05:59:59 -0800 (PST) From: Corentin Labbe To: alexandre.torgue@st.com, davem@davemloft.net, herbert@gondor.apana.org.au, mcoquelin.stm32@gmail.com, mripard@kernel.org, wens@csie.org, iuliana.prodan@nxp.com, horia.geanta@nxp.com, aymen.sghaier@nxp.com Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH RFC 07/10] crypto: sun8i-ce: handle slot > 0 Date: Tue, 14 Jan 2020 14:59:33 +0100 Message-Id: <20200114135936.32422-8-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114135936.32422-1-clabbe.montjoie@gmail.com> References: <20200114135936.32422-1-clabbe.montjoie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Handle the fact a slot could be different than 0. This imply: - linking two task via next - set interrupt flag just before running the batch in the last task. Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 8 +++++++- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c index 9c1f6c9eaaf9..d56c992fbf93 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c @@ -99,6 +99,9 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req int slot = 0; int err = 0; + if (slot < 0 || slot >= MAXTASK) + return -EINVAL; + algt = container_of(alg, struct sun8i_ce_alg_template, alg.skcipher); dev_dbg(ce->dev, "%s %s %u %x IV(%p %u) key=%u\n", __func__, @@ -120,8 +123,11 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req cet->t_id = cpu_to_le32(flow); common = ce->variant->alg_cipher[algt->ce_algo_id]; - common |= rctx->op_dir | CE_COMM_INT; + common |= rctx->op_dir; cet->t_common_ctl = cpu_to_le32(common); + if (slot > 0) + chan->tl[slot - 1].next = cpu_to_le32(chan->t_phy + 176 * slot); + /* CTS and recent CE (H6) need length in bytes, in word otherwise */ if (ce->variant->has_t_dlen_in_bytes) cet->t_dlen = cpu_to_le32(areq->cryptlen); diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c index bd355f4b95f3..39bf684c0ff5 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c @@ -106,6 +106,8 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name) #ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG ce->chanlist[flow].stat_req++; #endif + /* mark last one */ + ce->chanlist[flow].tl[ce->chanlist[flow].engine->ct - 1].t_common_ctl |= cpu_to_le32(CE_COMM_INT); mutex_lock(&ce->mlock); -- 2.24.1