From patchwork Sun Jan 7 12:14:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123645 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1546569qgn; Sun, 7 Jan 2018 04:15:52 -0800 (PST) X-Google-Smtp-Source: ACJfBoutPkYK878f5r1ucFosdvR7bBFsKsmCxDu9yXdhWEPBpH+MuLEdtLS1CPv7qTwBAyN01RJ8 X-Received: by 10.159.230.7 with SMTP id u7mr8988576plq.379.1515327352719; Sun, 07 Jan 2018 04:15:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327352; cv=none; d=google.com; s=arc-20160816; b=OcaJv2141MF8eWFzh/Axg0f4JhjJwlE1ua8uPIqexhmH/hhbzJ5Sr/s08bgUo9TuxX /DMjpSRDigX7n1LZhHQ1vhBUMhuWTbwLDPlo04VFHS5xhgTidfR1ALG+EKxbWyX/DLle 7jU6pjgseuLqqJ3A8wb3EbhbnjULGJeEM75bZi2qpzrxLu2tKEIlnw80RralAVPvJX1I gQjS5+0+6tz/feoS0Bzt9yTJflZtno5mKX+Bk8sJX6mmU1LHc5m4nVlFhiN1r6gFF+TP kajpmMmcRndnwX4ikZ9m2GlxV/hZ/+JNXSkCEkwxy23Z5qC9tASOVYkT7szhLMvgMh1a h3BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=3rE3+Su7STO2/bSR6xOSjBCcfe6J9KTJUD4osOh8API=; b=lBZ1b5AViqx6w6rBWZ3kX/eGsFtfp11p+06qsVOmXdpHE7vLofLZIxpBaqTa1CnElc KazDtIlQdu1cDXZYcGfo+E3Hc1CfmQnLITpw1V5s5L2airG3cFrSD3ppPTft9OFUSoxk k+TRPXgaIHEHKhgkL7mHI/LYT4q/AmP81QqkHoydjX2p7Tj6sVePoIG2DTDQjDdG8ren Ccm7NFCEvhv1CJ/RwROiqrwCRXP2gpjQsV+KgATrONHs76CYuaMgWLQQCVjd1xZ6uzXa 4itpXrG0qn+6CpFI+p1yppTZfNpXSloy9zhFS9yovVNL0JXQ2teYt8GbKCM/ZCivAUIF wPZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3si6881714pll.797.2018.01.07.04.15.52; Sun, 07 Jan 2018 04:15:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753838AbeAGMPu (ORCPT + 28 others); Sun, 7 Jan 2018 07:15:50 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57390 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753791AbeAGMPs (ORCPT ); Sun, 7 Jan 2018 07:15:48 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B55301435; Sun, 7 Jan 2018 04:15:47 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C87CB3F581; Sun, 7 Jan 2018 04:15:45 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 01/27] staging: ccree: SPDXify driver Date: Sun, 7 Jan 2018 12:14:12 +0000 Message-Id: <1515327285-8948-2-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace verbatim GPL v2 copy with SPDX tag. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/Kconfig | 2 ++ drivers/staging/ccree/Makefile | 2 ++ drivers/staging/ccree/cc_crypto_ctx.h | 17 ++--------------- drivers/staging/ccree/cc_debugfs.c | 17 ++--------------- drivers/staging/ccree/cc_debugfs.h | 17 ++--------------- drivers/staging/ccree/cc_hw_queue_defs.h | 17 ++--------------- drivers/staging/ccree/cc_lli_defs.h | 17 ++--------------- drivers/staging/ccree/dx_crys_kernel.h | 17 ++--------------- drivers/staging/ccree/dx_host.h | 17 ++--------------- drivers/staging/ccree/dx_reg_common.h | 17 ++--------------- drivers/staging/ccree/hash_defs.h | 17 ++--------------- drivers/staging/ccree/ssi_aead.c | 17 ++--------------- drivers/staging/ccree/ssi_aead.h | 17 ++--------------- drivers/staging/ccree/ssi_buffer_mgr.c | 17 ++--------------- drivers/staging/ccree/ssi_buffer_mgr.h | 17 ++--------------- drivers/staging/ccree/ssi_cipher.c | 17 ++--------------- drivers/staging/ccree/ssi_cipher.h | 17 ++--------------- drivers/staging/ccree/ssi_driver.c | 17 ++--------------- drivers/staging/ccree/ssi_driver.h | 17 ++--------------- drivers/staging/ccree/ssi_fips.c | 17 ++--------------- drivers/staging/ccree/ssi_fips.h | 17 ++--------------- drivers/staging/ccree/ssi_hash.c | 17 ++--------------- drivers/staging/ccree/ssi_hash.h | 17 ++--------------- drivers/staging/ccree/ssi_ivgen.c | 17 ++--------------- drivers/staging/ccree/ssi_ivgen.h | 17 ++--------------- drivers/staging/ccree/ssi_pm.c | 17 ++--------------- drivers/staging/ccree/ssi_pm.h | 17 ++--------------- drivers/staging/ccree/ssi_request_mgr.c | 17 ++--------------- drivers/staging/ccree/ssi_request_mgr.h | 17 ++--------------- drivers/staging/ccree/ssi_sram_mgr.c | 17 ++--------------- drivers/staging/ccree/ssi_sram_mgr.h | 17 ++--------------- 31 files changed, 62 insertions(+), 435 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/Kconfig b/drivers/staging/ccree/Kconfig index 0b3092b..c94dfe8 100644 --- a/drivers/staging/ccree/Kconfig +++ b/drivers/staging/ccree/Kconfig @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + config CRYPTO_DEV_CCREE tristate "Support for ARM TrustZone CryptoCell C7XX family of Crypto accelerators" depends on CRYPTO && CRYPTO_HW && OF && HAS_DMA diff --git a/drivers/staging/ccree/Makefile b/drivers/staging/ccree/Makefile index ab9f073..bb47144 100644 --- a/drivers/staging/ccree/Makefile +++ b/drivers/staging/ccree/Makefile @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o ccree-y := ssi_driver.o ssi_buffer_mgr.o ssi_request_mgr.o ssi_cipher.o ssi_hash.o ssi_aead.o ssi_ivgen.o ssi_sram_mgr.o ssi_pm.o ccree-$(CONFIG_CRYPTO_FIPS) += ssi_fips.o diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 0e34d9a..02e14f3 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef _CC_CRYPTO_CTX_H_ #define _CC_CRYPTO_CTX_H_ diff --git a/drivers/staging/ccree/cc_debugfs.c b/drivers/staging/ccree/cc_debugfs.c index 662fa07..ab2c986 100644 --- a/drivers/staging/ccree/cc_debugfs.c +++ b/drivers/staging/ccree/cc_debugfs.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/cc_debugfs.h b/drivers/staging/ccree/cc_debugfs.h index edfe9ba..354ec17 100644 --- a/drivers/staging/ccree/cc_debugfs.h +++ b/drivers/staging/ccree/cc_debugfs.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef __CC_DEBUGFS_H__ #define __CC_DEBUGFS_H__ diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 7c25a4f..52d32d1 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef __CC_HW_QUEUE_DEFS_H__ #define __CC_HW_QUEUE_DEFS_H__ diff --git a/drivers/staging/ccree/cc_lli_defs.h b/drivers/staging/ccree/cc_lli_defs.h index 861634a..64b15ac 100644 --- a/drivers/staging/ccree/cc_lli_defs.h +++ b/drivers/staging/ccree/cc_lli_defs.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef _CC_LLI_DEFS_H_ #define _CC_LLI_DEFS_H_ diff --git a/drivers/staging/ccree/dx_crys_kernel.h b/drivers/staging/ccree/dx_crys_kernel.h index 30719f4..fa99440 100644 --- a/drivers/staging/ccree/dx_crys_kernel.h +++ b/drivers/staging/ccree/dx_crys_kernel.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef __CC_CRYS_KERNEL_H__ #define __CC_CRYS_KERNEL_H__ diff --git a/drivers/staging/ccree/dx_host.h b/drivers/staging/ccree/dx_host.h index e90afbc..69ef2fa 100644 --- a/drivers/staging/ccree/dx_host.h +++ b/drivers/staging/ccree/dx_host.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef __CC_HOST_H__ #define __CC_HOST_H__ diff --git a/drivers/staging/ccree/dx_reg_common.h b/drivers/staging/ccree/dx_reg_common.h index 8334d9f..76c5539 100644 --- a/drivers/staging/ccree/dx_reg_common.h +++ b/drivers/staging/ccree/dx_reg_common.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef __CC_REG_COMMON_H__ #define __CC_REG_COMMON_H__ diff --git a/drivers/staging/ccree/hash_defs.h b/drivers/staging/ccree/hash_defs.h index f52656f..92d5c10 100644 --- a/drivers/staging/ccree/hash_defs.h +++ b/drivers/staging/ccree/hash_defs.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef _HASH_DEFS_H_ #define _HASH_DEFS_H_ diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 1522b00..414098a 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 2507be1..9567b8f 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ /* \file ssi_aead.h * ARM CryptoCell AEAD Crypto API diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 6846d93..ece17caf 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_buffer_mgr.h b/drivers/staging/ccree/ssi_buffer_mgr.h index 395c93f..cc4b173 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.h +++ b/drivers/staging/ccree/ssi_buffer_mgr.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ /* \file buffer_mgr.h * Buffer Manager diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index db21570..6178d38 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_cipher.h b/drivers/staging/ccree/ssi_cipher.h index 5d94cd3..97b266b 100644 --- a/drivers/staging/ccree/ssi_cipher.h +++ b/drivers/staging/ccree/ssi_cipher.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ /* \file ssi_cipher.h * ARM CryptoCell Cipher Crypto API diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 1254c69..3eabefb 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index bf83f3e..7383a83 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ /* \file ssi_driver.h * ARM CryptoCell Linux Crypto Driver diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c index 9ca6857..2c58f90 100644 --- a/drivers/staging/ccree/ssi_fips.c +++ b/drivers/staging/ccree/ssi_fips.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_fips.h b/drivers/staging/ccree/ssi_fips.h index 8321dde..0d52003 100644 --- a/drivers/staging/ccree/ssi_fips.h +++ b/drivers/staging/ccree/ssi_fips.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef __CC_FIPS_H__ #define __CC_FIPS_H__ diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 882f1c1..3c28904 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index 81f57fc..fa2cdb1 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ /* \file ssi_hash.h * ARM CryptoCell Hash Crypto API diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index d1b8ce0..6b92649 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_ivgen.h b/drivers/staging/ccree/ssi_ivgen.h index eeca45e3..b6ac169 100644 --- a/drivers/staging/ccree/ssi_ivgen.h +++ b/drivers/staging/ccree/ssi_ivgen.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef __CC_IVGEN_H__ #define __CC_IVGEN_H__ diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c index 5b80b59..3d9d00b 100644 --- a/drivers/staging/ccree/ssi_pm.c +++ b/drivers/staging/ccree/ssi_pm.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_pm.h b/drivers/staging/ccree/ssi_pm.h index 1f601bd..87bc389 100644 --- a/drivers/staging/ccree/ssi_pm.h +++ b/drivers/staging/ccree/ssi_pm.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ /* \file ssi_pm.h */ diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index c57c588..7686e14 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include #include diff --git a/drivers/staging/ccree/ssi_request_mgr.h b/drivers/staging/ccree/ssi_request_mgr.h index eb068bf..8f9a9d3 100644 --- a/drivers/staging/ccree/ssi_request_mgr.h +++ b/drivers/staging/ccree/ssi_request_mgr.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ /* \file request_mgr.h * Request Manager diff --git a/drivers/staging/ccree/ssi_sram_mgr.c b/drivers/staging/ccree/ssi_sram_mgr.c index f72d64a..1a2a7f4d 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.c +++ b/drivers/staging/ccree/ssi_sram_mgr.c @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include "ssi_driver.h" #include "ssi_sram_mgr.h" diff --git a/drivers/staging/ccree/ssi_sram_mgr.h b/drivers/staging/ccree/ssi_sram_mgr.h index 181968a..d48649f 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.h +++ b/drivers/staging/ccree/ssi_sram_mgr.h @@ -1,18 +1,5 @@ -/* - * Copyright (C) 2012-2017 ARM Limited or its affiliates. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #ifndef __CC_SRAM_MGR_H__ #define __CC_SRAM_MGR_H__ From patchwork Sun Jan 7 12:14:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123646 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1546715qgn; Sun, 7 Jan 2018 04:16:01 -0800 (PST) X-Google-Smtp-Source: ACJfBoshXm7xXEnQmNpdx9QWcHJW+1oAC55HCAnAdcO8ezzt8CtdQEHpS8mS4ZpWgdZOGOeeRZKy X-Received: by 10.84.133.7 with SMTP id 7mr8694491plf.61.1515327361381; Sun, 07 Jan 2018 04:16:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327361; cv=none; d=google.com; s=arc-20160816; b=RZiKzV/wwX/a86VvCMiN6H6Twn/XoUvobOmdkqTFgid7P2fFYEm6Np9hqvbpdA+pNq reXZIeI3mxw/Ru1P3Edlo84+DRYDGAgxVyYGySJyq6dqI6HaqgYQk6OV2+efdkga52je 2mvqd2ODgNw/sANwvqIfGG3Yt5KZPA14zSunFAA4i7sfZMmwq2muq/35HzrJrUVWPiYP PI7Ki6W6ZplkS9VLOnewJbEuNWOagp3s6XPoOMGvL5qZKrkRbFXr2ruJjjVo4Rhwdt1g oJTgdt4mh81ZIHBNMHZ2ssQSWVj7kMKto+3Ty+i8ruy/74QISqy7MYRWAif4+84Ucyfm CQ0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=2ctu+RtGUy7WPlQAxxOUPLeJN7ObUpdkbLn50soQ47k=; b=AmB7q1pFJPppivJzdmb0PVUUVdjGt7YE10lwY4MV7AOvuKtfTlLlz+T76zL+5eFek4 lVj2xnxJueB5MMm8tFsl4ENSnnATL9C3MUsNnAyjSO5QITseJioa70b4GGT0ixWey5mA Z76OodQIJXyzNKh6Bswpa5OPCN4R+p3ulsq9F6Ehvymx5VpWRMbXr7urGI7I+MA7VfDN vsRL4q5lh+Ad1zZqZJmAidEZK+sViIk3QqSlJ4jHOQPx9yCSpYGyhroMCpWlSbB5XAEu ND2cf0/58gLXWKrvMjDUgDga7E9Vbq3sxKDEuyaA7wTpXCNO7AOhbcZ9nRDuPTc2WuQ7 bnqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si6115408pgv.665.2018.01.07.04.16.01; Sun, 07 Jan 2018 04:16:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753867AbeAGMP7 (ORCPT + 28 others); Sun, 7 Jan 2018 07:15:59 -0500 Received: from foss.arm.com ([217.140.101.70]:57400 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752944AbeAGMP6 (ORCPT ); Sun, 7 Jan 2018 07:15:58 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C41241435; Sun, 7 Jan 2018 04:15:57 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB9F53F581; Sun, 7 Jan 2018 04:15:55 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 02/27] staging: ccree: fold hash defs into queue defs Date: Sun, 7 Jan 2018 12:14:13 +0000 Message-Id: <1515327285-8948-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fold the two remaining enum in hash defs into the queue defs that are using them and delete the hash defs include file. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_hw_queue_defs.h | 13 +++++++++++++ drivers/staging/ccree/hash_defs.h | 23 ----------------------- drivers/staging/ccree/ssi_driver.h | 1 - 3 files changed, 13 insertions(+), 24 deletions(-) delete mode 100644 drivers/staging/ccree/hash_defs.h -- 2.7.4 diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 52d32d1..bfc18b3 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -186,6 +186,19 @@ enum cc_hw_des_key_size { END_OF_DES_KEYS = S32_MAX, }; +enum cc_hash_conf_pad { + HASH_PADDING_DISABLED = 0, + HASH_PADDING_ENABLED = 1, + HASH_DIGEST_RESULT_LITTLE_ENDIAN = 2, + HASH_CONFIG1_PADDING_RESERVE32 = S32_MAX, +}; + +enum cc_hash_cipher_pad { + DO_NOT_PAD = 0, + DO_PAD = 1, + HASH_CIPHER_DO_PADDING_RESERVE32 = S32_MAX, +}; + /*****************************/ /* Descriptor packing macros */ /*****************************/ diff --git a/drivers/staging/ccree/hash_defs.h b/drivers/staging/ccree/hash_defs.h deleted file mode 100644 index 92d5c10..0000000 --- a/drivers/staging/ccree/hash_defs.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ - -#ifndef _HASH_DEFS_H_ -#define _HASH_DEFS_H_ - -#include "cc_crypto_ctx.h" - -enum cc_hash_conf_pad { - HASH_PADDING_DISABLED = 0, - HASH_PADDING_ENABLED = 1, - HASH_DIGEST_RESULT_LITTLE_ENDIAN = 2, - HASH_CONFIG1_PADDING_RESERVE32 = S32_MAX, -}; - -enum cc_hash_cipher_pad { - DO_NOT_PAD = 0, - DO_PAD = 1, - HASH_CIPHER_DO_PADDING_RESERVE32 = S32_MAX, -}; - -#endif /*_HASH_DEFS_H_*/ - diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 7383a83..df805db 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -30,7 +30,6 @@ #include "dx_reg_common.h" #define CC_SUPPORT_SHA CC_DEV_SHA_MAX #include "cc_crypto_ctx.h" -#include "hash_defs.h" #include "cc_hw_queue_defs.h" #include "ssi_sram_mgr.h" From patchwork Sun Jan 7 12:14:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123647 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1546870qgn; Sun, 7 Jan 2018 04:16:13 -0800 (PST) X-Google-Smtp-Source: ACJfBotr45DARfLYZ/aktN2THO/0qLh4SIhnMlsEhgi4cIGulo+hqfWK9SXSpPJa/SDgQt/RL5S5 X-Received: by 10.159.247.136 with SMTP id e8mr3595666pls.388.1515327373485; Sun, 07 Jan 2018 04:16:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327373; cv=none; d=google.com; s=arc-20160816; b=rWyKNL6T+ab0L9x4NcDY8dSW5F6EJjSXmNcquoPtpTF9xGmopB+U/eYPJbdh3GgYGB kWiZ5hzApvD0mrGmm8ACvPgjdPnDKkocAZe99NjwX+4VKNn4CLrBaofJtVuuYdZJagOc rK9EbG+3MNeeb3UuXN7FuHcQTf7rrdwobCgtOpwliFTJurzngjO/0tKwk0yN4/ZWuFHW L+Lvyssycx2vNrvWwEhhVklunCcS9NX58lwTDaUPDP2l+2jNG5dogarm3YSWfR8RL+tf DDkrowW/blyqE0XXXf71BekI4SIOmTWnc0g4KRrMTMGQLzzzRuhRQfpy29tWpfZsS9pC LZjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=gG/uLgvWVyTWDE/y3ZVreCwXgKQAKi5rLQqXkAK8XsA=; b=zEnI2O46ci0QamuGRqazQkpoDisb9aLBdhgKq4fIcmGpH8ZUc/c9ygIuEAifsx0q2R Y64J+I0fzCJuVYzoG7oGcCx4Mk/1by/Hxv78JEFockgCoUfUWrSsHCyOzfZMZefBI4Fk cfJcnf/JYlZFo0lI7RyJH3z5/PjWTjXW5+sjt+qE2HW/YcnkDFyl3Xb58gjBQECpYt+Y c9qVu1mUh6vZPqqnFB9K3rzLvMBQedQeBmy9WknE+5TdY7SPBqZELeR5SrIePipjnEfr AIYXGDA/HQO1yowYHImR3b6sj52JK7jYHLrY/nao+vhKbWtOvbcDCOMg6yYfWWwXJjyy pZzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x13si6929905pfk.293.2018.01.07.04.16.13; Sun, 07 Jan 2018 04:16:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753885AbeAGMQJ (ORCPT + 28 others); Sun, 7 Jan 2018 07:16:09 -0500 Received: from foss.arm.com ([217.140.101.70]:57410 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752944AbeAGMQI (ORCPT ); Sun, 7 Jan 2018 07:16:08 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0E9A71435; Sun, 7 Jan 2018 04:16:08 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 679FA3F581; Sun, 7 Jan 2018 04:16:06 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 03/27] staging: ccree: fold reg common defines into driver Date: Sun, 7 Jan 2018 12:14:14 +0000 Message-Id: <1515327285-8948-4-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fold the 2 macro defined in dx_reg_common.h into the file they are used in and delete the file. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_crypto_ctx.h | 4 ++-- drivers/staging/ccree/dx_reg_common.h | 13 ------------- drivers/staging/ccree/ssi_driver.h | 5 +++-- 3 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 drivers/staging/ccree/dx_reg_common.h -- 2.7.4 diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 02e14f3..eb16842 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -8,7 +8,7 @@ /* context size */ #ifndef CC_CTX_SIZE_LOG2 -#if (CC_SUPPORT_SHA > 256) +#if (CC_DEV_SHA_MAX > 256) #define CC_CTX_SIZE_LOG2 8 #else #define CC_CTX_SIZE_LOG2 7 @@ -59,7 +59,7 @@ #define CC_SHA384_BLOCK_SIZE 128 #define CC_SHA512_BLOCK_SIZE 128 -#if (CC_SUPPORT_SHA > 256) +#if (CC_DEV_SHA_MAX > 256) #define CC_DIGEST_SIZE_MAX CC_SHA512_DIGEST_SIZE #define CC_HASH_BLOCK_SIZE_MAX CC_SHA512_BLOCK_SIZE /*1024b*/ #else /* Only up to SHA256 */ diff --git a/drivers/staging/ccree/dx_reg_common.h b/drivers/staging/ccree/dx_reg_common.h deleted file mode 100644 index 76c5539..0000000 --- a/drivers/staging/ccree/dx_reg_common.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ - -#ifndef __CC_REG_COMMON_H__ -#define __CC_REG_COMMON_H__ - -#define CC_DEV_SIGNATURE 0xDCC71200UL - -#define CC_HW_VERSION 0xef840015UL - -#define CC_DEV_SHA_MAX 512 - -#endif /*__CC_REG_COMMON_H__*/ diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index df805db..60c1cfd 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -27,8 +27,7 @@ /* Registers definitions from shared/hw/ree_include */ #include "dx_host.h" -#include "dx_reg_common.h" -#define CC_SUPPORT_SHA CC_DEV_SHA_MAX +#define CC_DEV_SHA_MAX 512 #include "cc_crypto_ctx.h" #include "cc_hw_queue_defs.h" #include "ssi_sram_mgr.h" @@ -44,6 +43,8 @@ extern bool cc_dump_bytes; /* Maximum DMA mask supported by IP */ #define DMA_BIT_MASK_LEN 48 +#define CC_DEV_SIGNATURE 0xDCC71200UL + #define CC_AXI_IRQ_MASK ((1 << CC_AXIM_CFG_BRESPMASK_BIT_SHIFT) | \ (1 << CC_AXIM_CFG_RRESPMASK_BIT_SHIFT) | \ (1 << CC_AXIM_CFG_INFLTMASK_BIT_SHIFT) | \ From patchwork Sun Jan 7 12:14:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123648 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1546971qgn; Sun, 7 Jan 2018 04:16:21 -0800 (PST) X-Google-Smtp-Source: ACJfBoueTnG0UZEfmChb5ywOEyHVqxi6cxJNFAfr9I9yhh2da/Ghl6KHCz/ZKzWqRiBx7Fkyf9B2 X-Received: by 10.99.110.130 with SMTP id j124mr3337244pgc.172.1515327381872; Sun, 07 Jan 2018 04:16:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327381; cv=none; d=google.com; s=arc-20160816; b=piK88XBvED50n57AAeGfR4hSUDth14ASZtYkf/phb9Bb5KMJYgEbEIt7C3ncdaMKFV Bo+azrtuMB+A7MWfAoRYnro91sIl8T7FDR2PtD3DPOyMWL2o+lmCvO0Jhk1hGtOG0DFe Y6PrdNx1MmVK4YzZsAswUpTdEasBB36lf8zTX+iBOM4IBdhgQA9u9O0ImlT+ikBHRl9H PYug+YBL3snRa5PxYiP5VC5bBJ2ON919vzIzA9QQci/N2IwOvWJXqIFPxwRU2mM6e3Iu PIE1u5BADCLr1A7G0Tq7hSBwSuB6Vc2XPCUVLsO13Sn7LIj+5juBApqxfuwR17JG+NRl NtUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=PuFXnQ50oYSkEF8PgY9eyPdAvtaoiQVQWEQ/qOIXUqU=; b=awCjNyUUYpJz2AYRy0UsOJ8i8xfpgWHMtvaxp0aEcBnB0geNFLMSWRBsqtdVGd8yir /+Jlv3y/7Iz3vx/e4lwzHwt30CiRBjNbPT0ZFY6dxdPU8qVeWtta1s++nSpCEoqoXNQD Hl983evag3vguNzUNOduJdL2H5z0hsLxYVcAe8l4XQ98TtPcVNpbZPLniRhHPqTVy8e0 TkkSvVpuWxCUxSoFowmMc596PRtOApa74O4kYshD0sdozdSP7DI1G0Ngy8r10FJKt0b1 JNJCGDr72QM76TyEtziRcesu+cnNsDGKvF1KqQkhufG5b2d65XSdiWHrJ7UGwkoiw1oj PsKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x13si6929905pfk.293.2018.01.07.04.16.21; Sun, 07 Jan 2018 04:16:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753899AbeAGMQU (ORCPT + 28 others); Sun, 7 Jan 2018 07:16:20 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57420 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752852AbeAGMQS (ORCPT ); Sun, 7 Jan 2018 07:16:18 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D43221435; Sun, 7 Jan 2018 04:16:17 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 05A4D3F581; Sun, 7 Jan 2018 04:16:15 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 04/27] staging: ccree: remove GFP_DMA flag from mem allocs Date: Sun, 7 Jan 2018 12:14:15 +0000 Message-Id: <1515327285-8948-5-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove bogus GFP_DMA flag from memory allocations. ccree driver does not operate over an ISA or similar limited bus. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_cipher.c | 2 +- drivers/staging/ccree/ssi_hash.c | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 6178d38..496eb19 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -166,7 +166,7 @@ static int cc_cipher_init(struct crypto_tfm *tfm) ctx_p->drvdata = cc_alg->drvdata; /* Allocate key buffer, cache line aligned */ - ctx_p->user.key = kmalloc(max_key_buf_size, GFP_KERNEL | GFP_DMA); + ctx_p->user.key = kmalloc(max_key_buf_size, GFP_KERNEL); if (!ctx_p->user.key) return -ENOMEM; diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 3c28904..f178ffa 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -132,29 +132,27 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, struct cc_hw_desc desc; int rc = -ENOMEM; - state->buff0 = kzalloc(CC_MAX_HASH_BLCK_SIZE, GFP_KERNEL | GFP_DMA); + state->buff0 = kzalloc(CC_MAX_HASH_BLCK_SIZE, GFP_KERNEL); if (!state->buff0) goto fail0; - state->buff1 = kzalloc(CC_MAX_HASH_BLCK_SIZE, GFP_KERNEL | GFP_DMA); + state->buff1 = kzalloc(CC_MAX_HASH_BLCK_SIZE, GFP_KERNEL); if (!state->buff1) goto fail_buff0; state->digest_result_buff = kzalloc(CC_MAX_HASH_DIGEST_SIZE, - GFP_KERNEL | GFP_DMA); + GFP_KERNEL); if (!state->digest_result_buff) goto fail_buff1; - state->digest_buff = kzalloc(ctx->inter_digestsize, - GFP_KERNEL | GFP_DMA); + state->digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL); if (!state->digest_buff) goto fail_digest_result_buff; dev_dbg(dev, "Allocated digest-buffer in context ctx->digest_buff=@%p\n", state->digest_buff); if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) { - state->digest_bytes_len = kzalloc(HASH_LEN_SIZE, - GFP_KERNEL | GFP_DMA); + state->digest_bytes_len = kzalloc(HASH_LEN_SIZE, GFP_KERNEL); if (!state->digest_bytes_len) goto fail1; @@ -164,8 +162,7 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, state->digest_bytes_len = NULL; } - state->opad_digest_buff = kzalloc(ctx->inter_digestsize, - GFP_KERNEL | GFP_DMA); + state->opad_digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL); if (!state->opad_digest_buff) goto fail2; From patchwork Sun Jan 7 12:14:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123649 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1547146qgn; Sun, 7 Jan 2018 04:16:33 -0800 (PST) X-Google-Smtp-Source: ACJfBovKrQrOOnDH3RDeoCy64zC/AYvbwU3SAdxYl7OFSe4a0ALkKTaCzLScQbZWi07m2TA1g/Kj X-Received: by 10.84.238.136 with SMTP id v8mr3878241plk.374.1515327393470; Sun, 07 Jan 2018 04:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327393; cv=none; d=google.com; s=arc-20160816; b=LHuSQiHoCDgvJzN5s0vw6SdOiykAXMAT7q9mNPeiKGuPA3oEv02L3yxYQmXsu18g5D fCOPYOf1zjtaVThppTg2kNgJK0UskUzfcVFTVedy3PrZyMkYFBBbMlUHdzZ5QZdVgwbQ htWzLFiY5EOyMDsSBHZ80H+P2kMmJHLYvKTeOC/iZD2nL8mu2x0V6VYBOUAuxfp3rM4q ponA48uBe8D7XPmmN2yE7w/jFeZ37vxXufXMOGJZfBvPKT0kLFytnZDd7hZtQlNUMhFP iyQky6l1AHmiAYPpZui+WwUNfu3Jq+xsUdlpAO2O5SwiGBxTP5ikUm9KTXw+paN3TIvi 2oMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fNdkE+oTTqyOmplXDOnDFxzVSpexP2JzxoetCQSkZQ4=; b=sXuR8s3J+ghl3f9ncIRdbERVRsYUCmCzliVUQBe8aBhRVMXt6+sz9TW0Qdk/s4fXlw cOG2gC252tTfYtmVA37FfqiwtF9F2go3RQpZTEiFZS9m+fO/xy84cUCoLv5f8aVLbghG J38+0zRu9UqclTQshr77mlUb7hwsewdFbdCKGrRJPt9uTsN28b0RNHL7+JCQbWitMaI+ WQS5Mf2YXPpVenL4Cqs+JKzk3F7rPSPVH7x/XoybV4k3mHz1klFzkggcpjq+JfqEY0cO aiERJ/QI3f2/KxK4tbKgkgmgA3ldR2oSY5OitidXyGzSrZCivFO0eRHiCL0SEYzuKPux A8+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o14si6121897pgc.704.2018.01.07.04.16.33; Sun, 07 Jan 2018 04:16:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753915AbeAGMQa (ORCPT + 28 others); Sun, 7 Jan 2018 07:16:30 -0500 Received: from foss.arm.com ([217.140.101.70]:57430 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752976AbeAGMQ2 (ORCPT ); Sun, 7 Jan 2018 07:16:28 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E9DA41435; Sun, 7 Jan 2018 04:16:27 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1D7A13F581; Sun, 7 Jan 2018 04:16:25 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 05/27] staging: ccree: pick alloc mem flags based on req flags Date: Sun, 7 Jan 2018 12:14:16 +0000 Message-Id: <1515327285-8948-6-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ccree driver was allocating memory using GFP_KERNEL flag always, ignoring the flags set in the crypto request. Fix it by choosing gfp flags based on crypto request flags. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 19 +++++++------ drivers/staging/ccree/ssi_buffer_mgr.h | 6 ++-- drivers/staging/ccree/ssi_cipher.c | 8 ++++-- drivers/staging/ccree/ssi_driver.h | 6 ++++ drivers/staging/ccree/ssi_hash.c | 50 ++++++++++++++++++++-------------- 5 files changed, 54 insertions(+), 35 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index ece17caf..e85bb53 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -217,7 +217,7 @@ static int cc_render_sg_to_mlli(struct device *dev, struct scatterlist *sgl, } static int cc_generate_mlli(struct device *dev, struct buffer_array *sg_data, - struct mlli_params *mlli_params) + struct mlli_params *mlli_params, gfp_t flags) { u32 *mlli_p; u32 total_nents = 0, prev_total_nents = 0; @@ -227,7 +227,7 @@ static int cc_generate_mlli(struct device *dev, struct buffer_array *sg_data, /* Allocate memory from the pointed pool */ mlli_params->mlli_virt_addr = - dma_pool_alloc(mlli_params->curr_pool, GFP_KERNEL, + dma_pool_alloc(mlli_params->curr_pool, flags, &mlli_params->mlli_dma_addr); if (!mlli_params->mlli_virt_addr) { dev_err(dev, "dma_pool_alloc() failed\n"); @@ -483,7 +483,7 @@ void cc_unmap_blkcipher_request(struct device *dev, void *ctx, int cc_map_blkcipher_request(struct cc_drvdata *drvdata, void *ctx, unsigned int ivsize, unsigned int nbytes, void *info, struct scatterlist *src, - struct scatterlist *dst) + struct scatterlist *dst, gfp_t flags) { struct blkcipher_req_ctx *req_ctx = (struct blkcipher_req_ctx *)ctx; struct mlli_params *mlli_params = &req_ctx->mlli_params; @@ -558,7 +558,7 @@ int cc_map_blkcipher_request(struct cc_drvdata *drvdata, void *ctx, if (req_ctx->dma_buf_type == CC_DMA_BUF_MLLI) { mlli_params->curr_pool = buff_mgr->mlli_buffs_pool; - rc = cc_generate_mlli(dev, &sg_data, mlli_params); + rc = cc_generate_mlli(dev, &sg_data, mlli_params, flags); if (rc) goto ablkcipher_exit; } @@ -1200,6 +1200,7 @@ int cc_map_aead_request(struct cc_drvdata *drvdata, struct aead_request *req) u32 mapped_nents = 0; u32 dummy = 0; /*used for the assoc data fragments */ u32 size_to_map = 0; + gfp_t flags = cc_gfp_flags(&req->base); mlli_params->curr_pool = NULL; sg_data.num_of_buffers = 0; @@ -1366,7 +1367,7 @@ int cc_map_aead_request(struct cc_drvdata *drvdata, struct aead_request *req) if (areq_ctx->assoc_buff_type == CC_DMA_BUF_MLLI || areq_ctx->data_buff_type == CC_DMA_BUF_MLLI) { mlli_params->curr_pool = buff_mgr->mlli_buffs_pool; - rc = cc_generate_mlli(dev, &sg_data, mlli_params); + rc = cc_generate_mlli(dev, &sg_data, mlli_params, flags); if (rc) goto aead_map_failure; @@ -1385,7 +1386,7 @@ int cc_map_aead_request(struct cc_drvdata *drvdata, struct aead_request *req) int cc_map_hash_request_final(struct cc_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, - bool do_update) + bool do_update, gfp_t flags) { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; struct device *dev = drvdata_to_dev(drvdata); @@ -1445,7 +1446,7 @@ int cc_map_hash_request_final(struct cc_drvdata *drvdata, void *ctx, /* add the src data to the sg_data */ cc_add_sg_entry(dev, &sg_data, areq_ctx->in_nents, src, nbytes, 0, true, &areq_ctx->mlli_nents); - if (cc_generate_mlli(dev, &sg_data, mlli_params)) + if (cc_generate_mlli(dev, &sg_data, mlli_params, flags)) goto fail_unmap_din; } /* change the buffer index for the unmap function */ @@ -1466,7 +1467,7 @@ int cc_map_hash_request_final(struct cc_drvdata *drvdata, void *ctx, int cc_map_hash_request_update(struct cc_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, - unsigned int block_size) + unsigned int block_size, gfp_t flags) { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; struct device *dev = drvdata_to_dev(drvdata); @@ -1562,7 +1563,7 @@ int cc_map_hash_request_update(struct cc_drvdata *drvdata, void *ctx, cc_add_sg_entry(dev, &sg_data, areq_ctx->in_nents, src, (update_data_len - *curr_buff_cnt), 0, true, &areq_ctx->mlli_nents); - if (cc_generate_mlli(dev, &sg_data, mlli_params)) + if (cc_generate_mlli(dev, &sg_data, mlli_params, flags)) goto fail_unmap_din; } areq_ctx->buff_index = (areq_ctx->buff_index ^ swap_index); diff --git a/drivers/staging/ccree/ssi_buffer_mgr.h b/drivers/staging/ccree/ssi_buffer_mgr.h index cc4b173..0ddadd7 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.h +++ b/drivers/staging/ccree/ssi_buffer_mgr.h @@ -43,7 +43,7 @@ int cc_buffer_mgr_fini(struct cc_drvdata *drvdata); int cc_map_blkcipher_request(struct cc_drvdata *drvdata, void *ctx, unsigned int ivsize, unsigned int nbytes, void *info, struct scatterlist *src, - struct scatterlist *dst); + struct scatterlist *dst, gfp_t flags); void cc_unmap_blkcipher_request(struct device *dev, void *ctx, unsigned int ivsize, @@ -56,11 +56,11 @@ void cc_unmap_aead_request(struct device *dev, struct aead_request *req); int cc_map_hash_request_final(struct cc_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, - bool do_update); + bool do_update, gfp_t flags); int cc_map_hash_request_update(struct cc_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, - unsigned int block_size); + unsigned int block_size, gfp_t flags); void cc_unmap_hash_request(struct device *dev, void *ctx, struct scatterlist *src, bool do_revert); diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 496eb19..933a452 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -639,6 +639,7 @@ static int cc_cipher_process(struct ablkcipher_request *req, struct cc_hw_desc desc[MAX_ABLKCIPHER_SEQ_LEN]; struct cc_crypto_req cc_req = {}; int rc, seq_len = 0, cts_restore_flag = 0; + gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "%s req=%p info=%p nbytes=%d\n", ((direction == DRV_CRYPTO_DIRECTION_ENCRYPT) ? @@ -662,7 +663,7 @@ static int cc_cipher_process(struct ablkcipher_request *req, /* The IV we are handed may be allocted from the stack so * we must copy it to a DMAable buffer before use. */ - req_ctx->iv = kmalloc(ivsize, GFP_KERNEL); + req_ctx->iv = kmalloc(ivsize, flags); if (!req_ctx->iv) { rc = -ENOMEM; goto exit_process; @@ -692,7 +693,7 @@ static int cc_cipher_process(struct ablkcipher_request *req, /* STAT_PHASE_1: Map buffers */ rc = cc_map_blkcipher_request(ctx_p->drvdata, req_ctx, ivsize, nbytes, - req_ctx->iv, src, dst); + req_ctx->iv, src, dst, flags); if (rc) { dev_err(dev, "map_request() failed\n"); goto exit_process; @@ -751,12 +752,13 @@ static int cc_cipher_decrypt(struct ablkcipher_request *req) struct crypto_ablkcipher *ablk_tfm = crypto_ablkcipher_reqtfm(req); struct blkcipher_req_ctx *req_ctx = ablkcipher_request_ctx(req); unsigned int ivsize = crypto_ablkcipher_ivsize(ablk_tfm); + gfp_t flags = cc_gfp_flags(&req->base); /* * Allocate and save the last IV sized bytes of the source, which will * be lost in case of in-place decryption and might be needed for CTS. */ - req_ctx->backup_info = kmalloc(ivsize, GFP_KERNEL); + req_ctx->backup_info = kmalloc(ivsize, flags); if (!req_ctx->backup_info) return -ENOMEM; diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 60c1cfd..f71c602 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -184,5 +184,11 @@ static inline u32 cc_ioread(struct cc_drvdata *drvdata, u32 reg) return ioread32(drvdata->cc_base + reg); } +static inline gfp_t cc_gfp_flags(struct crypto_async_request *req) +{ + return (req->flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? + GFP_KERNEL : GFP_ATOMIC; +} + #endif /*__CC_DRIVER_H__*/ diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index f178ffa..7a8a036 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -123,7 +123,7 @@ static int cc_map_result(struct device *dev, struct ahash_req_ctx *state, } static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, - struct cc_hash_ctx *ctx) + struct cc_hash_ctx *ctx, gfp_t flags) { bool is_hmac = ctx->is_hmac; cc_sram_addr_t larval_digest_addr = @@ -132,27 +132,26 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, struct cc_hw_desc desc; int rc = -ENOMEM; - state->buff0 = kzalloc(CC_MAX_HASH_BLCK_SIZE, GFP_KERNEL); + state->buff0 = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); if (!state->buff0) goto fail0; - state->buff1 = kzalloc(CC_MAX_HASH_BLCK_SIZE, GFP_KERNEL); + state->buff1 = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); if (!state->buff1) goto fail_buff0; - state->digest_result_buff = kzalloc(CC_MAX_HASH_DIGEST_SIZE, - GFP_KERNEL); + state->digest_result_buff = kzalloc(CC_MAX_HASH_DIGEST_SIZE, flags); if (!state->digest_result_buff) goto fail_buff1; - state->digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL); + state->digest_buff = kzalloc(ctx->inter_digestsize, flags); if (!state->digest_buff) goto fail_digest_result_buff; dev_dbg(dev, "Allocated digest-buffer in context ctx->digest_buff=@%p\n", state->digest_buff); if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) { - state->digest_bytes_len = kzalloc(HASH_LEN_SIZE, GFP_KERNEL); + state->digest_bytes_len = kzalloc(HASH_LEN_SIZE, flags); if (!state->digest_bytes_len) goto fail1; @@ -162,7 +161,7 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, state->digest_bytes_len = NULL; } - state->opad_digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL); + state->opad_digest_buff = kzalloc(ctx->inter_digestsize, flags); if (!state->opad_digest_buff) goto fail2; @@ -415,11 +414,12 @@ static int cc_hash_digest(struct ahash_request *req) cc_larval_digest_addr(ctx->drvdata, ctx->hash_mode); int idx = 0; int rc = 0; + gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "===== %s-digest (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); - if (cc_map_req(dev, state, ctx)) { + if (cc_map_req(dev, state, ctx, flags)) { dev_err(dev, "map_ahash_source() failed\n"); return -ENOMEM; } @@ -429,7 +429,8 @@ static int cc_hash_digest(struct ahash_request *req) return -ENOMEM; } - if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1)) { + if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1, + flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); return -ENOMEM; } @@ -566,6 +567,7 @@ static int cc_hash_update(struct ahash_request *req) struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN]; u32 idx = 0; int rc; + gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "===== %s-update (%d) ====\n", ctx->is_hmac ? "hmac" : "hash", nbytes); @@ -576,7 +578,7 @@ static int cc_hash_update(struct ahash_request *req) } rc = cc_map_hash_request_update(ctx->drvdata, state, src, nbytes, - block_size); + block_size, flags); if (rc) { if (rc == 1) { dev_dbg(dev, " data size not require HW update %x\n", @@ -653,11 +655,13 @@ static int cc_hash_finup(struct ahash_request *req) struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN]; int idx = 0; int rc; + gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "===== %s-finup (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); - if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1)) { + if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1, + flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); return -ENOMEM; } @@ -773,11 +777,13 @@ static int cc_hash_final(struct ahash_request *req) struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN]; int idx = 0; int rc; + gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "===== %s-final (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); - if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 0)) { + if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 0, + flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); return -ENOMEM; } @@ -894,11 +900,12 @@ static int cc_hash_init(struct ahash_request *req) struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct cc_hash_ctx *ctx = crypto_ahash_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); + gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "===== init (%d) ====\n", req->nbytes); state->xcbc_count = 0; - cc_map_req(dev, state, ctx); + cc_map_req(dev, state, ctx, flags); return 0; } @@ -1317,6 +1324,7 @@ static int cc_mac_update(struct ahash_request *req) struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN]; int rc; u32 idx = 0; + gfp_t flags = cc_gfp_flags(&req->base); if (req->nbytes == 0) { /* no real updates required */ @@ -1326,7 +1334,7 @@ static int cc_mac_update(struct ahash_request *req) state->xcbc_count++; rc = cc_map_hash_request_update(ctx->drvdata, state, req->src, - req->nbytes, block_size); + req->nbytes, block_size, flags); if (rc) { if (rc == 1) { dev_dbg(dev, " data size not require HW update %x\n", @@ -1379,7 +1387,7 @@ static int cc_mac_final(struct ahash_request *req) int rc = 0; u32 key_size, key_len; u32 digestsize = crypto_ahash_digestsize(tfm); - + gfp_t flags = cc_gfp_flags(&req->base); u32 rem_cnt = state->buff_index ? state->buff1_cnt : state->buff0_cnt; @@ -1395,7 +1403,7 @@ static int cc_mac_final(struct ahash_request *req) dev_dbg(dev, "===== final xcbc reminder (%d) ====\n", rem_cnt); if (cc_map_hash_request_final(ctx->drvdata, state, req->src, - req->nbytes, 0)) { + req->nbytes, 0, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); return -ENOMEM; } @@ -1493,6 +1501,7 @@ static int cc_mac_finup(struct ahash_request *req) int rc = 0; u32 key_len = 0; u32 digestsize = crypto_ahash_digestsize(tfm); + gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "===== finup xcbc(%d) ====\n", req->nbytes); if (state->xcbc_count > 0 && req->nbytes == 0) { @@ -1501,7 +1510,7 @@ static int cc_mac_finup(struct ahash_request *req) } if (cc_map_hash_request_final(ctx->drvdata, state, req->src, - req->nbytes, 1)) { + req->nbytes, 1, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); return -ENOMEM; } @@ -1565,10 +1574,11 @@ static int cc_mac_digest(struct ahash_request *req) u32 key_len; int idx = 0; int rc; + gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "===== -digest mac (%d) ====\n", req->nbytes); - if (cc_map_req(dev, state, ctx)) { + if (cc_map_req(dev, state, ctx, flags)) { dev_err(dev, "map_ahash_source() failed\n"); return -ENOMEM; } @@ -1578,7 +1588,7 @@ static int cc_mac_digest(struct ahash_request *req) } if (cc_map_hash_request_final(ctx->drvdata, state, req->src, - req->nbytes, 1)) { + req->nbytes, 1, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); return -ENOMEM; } From patchwork Sun Jan 7 12:14:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123650 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1547302qgn; Sun, 7 Jan 2018 04:16:42 -0800 (PST) X-Google-Smtp-Source: ACJfBouqavqxuVi7runTfYEf+0IACi0McHfn5DKp+5qjRntxOXRRZj2/DAVQOqU6l9RaXu+0Ncbh X-Received: by 10.159.198.9 with SMTP id f9mr9100007plo.322.1515327402269; Sun, 07 Jan 2018 04:16:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327402; cv=none; d=google.com; s=arc-20160816; b=RMg3hDd8kcAHAJMWeswoRI2L6ZuGWK3TRx6yteqcIAxqsxpAyi0PBmbiYbcIUPJdbs XV7JRLLTu8c7qK/JfSMq5V7rcM1F44va0ZZ1CZQQomOMz8q4HKbicxr1s7OOHqVuwX5i M+sRduRP0yuOsczbAd68L3VYoxRn16tC24lhwzL4EiatYGza05bMAC582DTjdfsow+De NoAmfaQDMnPDMcHnzRdAMoAVU/T9WC9UeuTa+LIKunoY8/DLW9QX4n2b+ahOvDGvCRbf 566Od7lRhNECziiWH+lqDW1Qr3+ixaxdBI27+KTbxPGH7xFAbRM2JGsc5Nn0LDK8JKHY pXNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=kGgDGfBMZX3Bvif1/gQDo2d/mgs4jGV2swEtcqha64E=; b=xiSqrcZCE0NfZ5agkfxXLIjkzjnytJSMTtFWxx8S+i3oiqFi949uCacQN4DG6LMmND ROLRSPbvu304skCyFDrsV/FCvZEPLQAqnHfO6qKQyYsS9l2+Xlznn/EmMQuVWLq6VRZu W+ABRNtJKGzbOFmmVGLBA2TKn5uzRCMlbFS2FjNo/lsQ1HJaHdXCuBfCNP9xIOfuV+Hy W/5yqkbadOqXmXquntN2vztBo15jmDVhQnwNPSh3NbkIEecvVfGPTI0/y/oCqv7GuGZX caAXQK96DlgO40Z6LeC9Mid1d+YxVj84Oe8peENO5v2/aj/9vL/ZTYaQqjfe3Vka+VTY jDcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si796760pgv.684.2018.01.07.04.16.42; Sun, 07 Jan 2018 04:16:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753933AbeAGMQk (ORCPT + 28 others); Sun, 7 Jan 2018 07:16:40 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57442 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753917AbeAGMQi (ORCPT ); Sun, 7 Jan 2018 07:16:38 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F3E261435; Sun, 7 Jan 2018 04:16:37 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 542083F581; Sun, 7 Jan 2018 04:16:36 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 06/27] staging: ccree: copy larval digest from RAM Date: Sun, 7 Jan 2018 12:14:17 +0000 Message-Id: <1515327285-8948-7-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ccree driver was using a DMA operation to copy larval digest from the ccree SRAM to RAM. Replace it with a simple memcpy. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_driver.c | 2 + drivers/staging/ccree/ssi_hash.c | 121 ++++++++++++++++++++----------------- drivers/staging/ccree/ssi_hash.h | 2 + 3 files changed, 68 insertions(+), 57 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 3eabefb..b5df9b4 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -484,6 +484,8 @@ static int __init ccree_init(void) { int ret; + cc_hash_global_init(); + ret = cc_debugfs_global_init(); if (ret) return ret; diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 7a8a036..b51a1d4 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -41,10 +41,10 @@ static const u32 sha256_init[] = { #if (CC_DEV_SHA_MAX > 256) static const u32 digest_len_sha512_init[] = { 0x00000080, 0x00000000, 0x00000000, 0x00000000 }; -static const u64 sha384_init[] = { +static u64 sha384_init[] = { SHA384_H7, SHA384_H6, SHA384_H5, SHA384_H4, SHA384_H3, SHA384_H2, SHA384_H1, SHA384_H0 }; -static const u64 sha512_init[] = { +static u64 sha512_init[] = { SHA512_H7, SHA512_H6, SHA512_H5, SHA512_H4, SHA512_H3, SHA512_H2, SHA512_H1, SHA512_H0 }; #endif @@ -55,6 +55,8 @@ static void cc_setup_xcbc(struct ahash_request *areq, struct cc_hw_desc desc[], static void cc_setup_cmac(struct ahash_request *areq, struct cc_hw_desc desc[], unsigned int *seq_size); +static const void *cc_larval_digest(struct device *dev, u32 mode); + struct cc_hash_alg { struct list_head entry; int hash_mode; @@ -126,10 +128,6 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, struct cc_hash_ctx *ctx, gfp_t flags) { bool is_hmac = ctx->is_hmac; - cc_sram_addr_t larval_digest_addr = - cc_larval_digest_addr(ctx->drvdata, ctx->hash_mode); - struct cc_crypto_req cc_req = {}; - struct cc_hw_desc desc; int rc = -ENOMEM; state->buff0 = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); @@ -203,9 +201,6 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, HASH_LEN_SIZE); #endif } - dma_sync_single_for_device(dev, state->digest_buff_dma_addr, - ctx->inter_digestsize, - DMA_BIDIRECTIONAL); if (ctx->hash_mode != DRV_HASH_NULL) { dma_sync_single_for_cpu(dev, @@ -216,22 +211,15 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, ctx->opad_tmp_keys_buff, ctx->inter_digestsize); } } else { /*hash*/ - /* Copy the initial digests if hash flow. The SRAM contains the - * initial digests in the expected order for all SHA* - */ - hw_desc_init(&desc); - set_din_sram(&desc, larval_digest_addr, ctx->inter_digestsize); - set_dout_dlli(&desc, state->digest_buff_dma_addr, - ctx->inter_digestsize, NS_BIT, 0); - set_flow_mode(&desc, BYPASS); + /* Copy the initial digests if hash flow. */ + const void *larval = cc_larval_digest(dev, ctx->hash_mode); - rc = send_request(ctx->drvdata, &cc_req, &desc, 1, 0); - if (rc) { - dev_err(dev, "send_request() failed (rc=%d)\n", rc); - goto fail4; - } + memcpy(state->digest_buff, larval, ctx->inter_digestsize); } + dma_sync_single_for_device(dev, state->digest_buff_dma_addr, + ctx->inter_digestsize, DMA_BIDIRECTIONAL); + if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) { state->digest_bytes_len_dma_addr = dma_map_single(dev, (void *)state->digest_bytes_len, @@ -2003,11 +1991,7 @@ int cc_init_hash_sram(struct cc_drvdata *drvdata) cc_sram_addr_t sram_buff_ofs = hash_handle->digest_len_sram_addr; unsigned int larval_seq_len = 0; struct cc_hw_desc larval_seq[CC_DIGEST_SIZE_MAX / sizeof(u32)]; - struct device *dev = drvdata_to_dev(drvdata); int rc = 0; -#if (CC_DEV_SHA_MAX > 256) - int i; -#endif /* Copy-to-sram digest-len */ cc_set_sram_desc(digest_len_init, sram_buff_ofs, @@ -2074,49 +2058,49 @@ int cc_init_hash_sram(struct cc_drvdata *drvdata) larval_seq_len = 0; #if (CC_DEV_SHA_MAX > 256) - /* We are forced to swap each double-word larval before copying to - * sram - */ - for (i = 0; i < ARRAY_SIZE(sha384_init); i++) { - const u32 const0 = ((u32 *)((u64 *)&sha384_init[i]))[1]; - const u32 const1 = ((u32 *)((u64 *)&sha384_init[i]))[0]; - - cc_set_sram_desc(&const0, sram_buff_ofs, 1, larval_seq, - &larval_seq_len); - sram_buff_ofs += sizeof(u32); - cc_set_sram_desc(&const1, sram_buff_ofs, 1, larval_seq, - &larval_seq_len); - sram_buff_ofs += sizeof(u32); - } + cc_set_sram_desc((u32 *)sha384_init, sram_buff_ofs, + (ARRAY_SIZE(sha384_init) * 2), larval_seq, + &larval_seq_len); rc = send_request_init(drvdata, larval_seq, larval_seq_len); - if (rc) { - dev_err(dev, "send_request() failed (rc = %d)\n", rc); + if (rc) goto init_digest_const_err; - } + sram_buff_ofs += sizeof(sha384_init); larval_seq_len = 0; - for (i = 0; i < ARRAY_SIZE(sha512_init); i++) { - const u32 const0 = ((u32 *)((u64 *)&sha512_init[i]))[1]; - const u32 const1 = ((u32 *)((u64 *)&sha512_init[i]))[0]; - - cc_set_sram_desc(&const0, sram_buff_ofs, 1, larval_seq, - &larval_seq_len); - sram_buff_ofs += sizeof(u32); - cc_set_sram_desc(&const1, sram_buff_ofs, 1, larval_seq, - &larval_seq_len); - sram_buff_ofs += sizeof(u32); - } + cc_set_sram_desc((u32 *)sha512_init, sram_buff_ofs, + (ARRAY_SIZE(sha512_init) * 2), larval_seq, + &larval_seq_len); rc = send_request_init(drvdata, larval_seq, larval_seq_len); - if (rc) { - dev_err(dev, "send_request() failed (rc = %d)\n", rc); + if (rc) goto init_digest_const_err; - } #endif init_digest_const_err: return rc; } +static void __init cc_swap_dwords(u32 *buf, unsigned long size) +{ + int i; + u32 tmp; + + for (i = 0; i < size; i += 2) { + tmp = buf[i]; + buf[i] = buf[i + 1]; + buf[i + 1] = tmp; + } +} + +/* + * Due to the way the HW works we need to swap every + * double word in the SHA384 and SHA512 larval hashes + */ +void __init cc_hash_global_init(void) +{ + cc_swap_dwords((u32 *)&sha384_init, (ARRAY_SIZE(sha384_init) * 2)); + cc_swap_dwords((u32 *)&sha512_init, (ARRAY_SIZE(sha512_init) * 2)); +} + int cc_hash_alloc(struct cc_drvdata *drvdata) { struct cc_hash_handle *hash_handle; @@ -2373,6 +2357,29 @@ static void cc_set_desc(struct ahash_req_ctx *areq_ctx, *seq_size = idx; } +static const void *cc_larval_digest(struct device *dev, u32 mode) +{ + switch (mode) { + case DRV_HASH_MD5: + return md5_init; + case DRV_HASH_SHA1: + return sha1_init; + case DRV_HASH_SHA224: + return sha224_init; + case DRV_HASH_SHA256: + return sha256_init; +#if (CC_DEV_SHA_MAX > 256) + case DRV_HASH_SHA384: + return sha384_init; + case DRV_HASH_SHA512: + return sha512_init; +#endif + default: + dev_err(dev, "Invalid hash mode (%d)\n", mode); + return md5_init; + } +} + /*! * Gets the address of the initial digest in SRAM * according to the given hash mode diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index fa2cdb1..f78faae 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -90,5 +90,7 @@ cc_digest_len_addr(void *drvdata, u32 mode); */ cc_sram_addr_t cc_larval_digest_addr(void *drvdata, u32 mode); +void cc_hash_global_init(void); + #endif /*__CC_HASH_H__*/ From patchwork Sun Jan 7 12:14:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123651 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1547391qgn; Sun, 7 Jan 2018 04:16:51 -0800 (PST) X-Google-Smtp-Source: ACJfBosu9cjIKaJVStuBJZRiug5Dy6pH9UM4cIRMEfZ+vEahmitRuz813wBGHcb7vo8aMPNZqcwk X-Received: by 10.98.18.150 with SMTP id 22mr2875682pfs.180.1515327411048; Sun, 07 Jan 2018 04:16:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327411; cv=none; d=google.com; s=arc-20160816; b=JqQ/FzYd3k4vG4o/5lo+yVsXHOynXfil48xu9N0eFhpKr7r2MZLMebBTroNafpd19j +RKNOoqNiGb4/ew/tYlOjzSFK0dEBsi8f8vMVzWs+g7eO2Iq2yk7McL1bPZdTK34fyFL aWDvXcaF536fiAtE+OhZ1msvI0H3f4MJxDQu+eiyNNjCu1gvqNbrUO1OezF+wFey+0H8 QFFHSNd7ntP4wlKBZrj8ZUIlpv1REWDZtiKXPdE3Diof/XLf+Tq1qzU04BhVsF96VSQH wXKh2RsBDhgqYw0cTx1AAIDS1kVDdjDUBoKvv4OyaCafuuSWPXPZgjmvPrW7wsFwFgwy y5jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=q/lfB2mMhgKszafvN5WXxXTqMGiMQZIGLTFRSgRBU4Q=; b=UAEeyQ3CoEjqGErWeKvCYdrZEyxDY3GZ7uCzm/3wPKciNHssO7T56UlY///JVR8iMm P1Kq2PyfPcu00tqd38bFhAEVuHl3Y05xjck8ZGtHARMWET+DjcAvgThbkXDRgK26xTjX 8Gz48tRYzFnC7bVnHGZa5JIZu1b6lLJOZhVkPX99XizBGEkfgm41BABk5p1pvDJSmqBP /ZGHopd932SKE/MNGh4C8kM8KGZ9MMCTCr61QfkIhCfR6DfNbEYcI8RHbQ5CtaXO2Oo4 p1t8tYUEktHWvuRSLUBLuhTYadQLlvz0d8uuQ309tF7DG56VvBDjZ44n02TZXUg98yCN RvlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si796760pgv.684.2018.01.07.04.16.50; Sun, 07 Jan 2018 04:16:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753950AbeAGMQt (ORCPT + 28 others); Sun, 7 Jan 2018 07:16:49 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57452 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753836AbeAGMQr (ORCPT ); Sun, 7 Jan 2018 07:16:47 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A6FE61435; Sun, 7 Jan 2018 04:16:47 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 108423F581; Sun, 7 Jan 2018 04:16:45 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 07/27] staging: ccree: tag debugfs init/exit func properly Date: Sun, 7 Jan 2018 12:14:18 +0000 Message-Id: <1515327285-8948-8-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The debugfs global init and exit functions were missing __init and __exit tags, potentially wasting memory. Fix it by properly tagging them. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/cc_debugfs.c b/drivers/staging/ccree/cc_debugfs.c index ab2c986..72eb2b3 100644 --- a/drivers/staging/ccree/cc_debugfs.c +++ b/drivers/staging/ccree/cc_debugfs.c @@ -38,14 +38,14 @@ static struct debugfs_reg32 debug_regs[] = { CC_DEBUG_REG(AXIM_MON_COMP), }; -int cc_debugfs_global_init(void) +int __init cc_debugfs_global_init(void) { cc_debugfs_dir = debugfs_create_dir("ccree", NULL); return !cc_debugfs_dir; } -void cc_debugfs_global_fini(void) +void __exit cc_debugfs_global_fini(void) { debugfs_remove(cc_debugfs_dir); } From patchwork Sun Jan 7 12:14:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123652 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1547505qgn; Sun, 7 Jan 2018 04:17:01 -0800 (PST) X-Google-Smtp-Source: ACJfBovyJhhf9FYz/TxxSKeVJ82hZF0AIQS2vS5ZqxO0n8mY0DZnCtW6zs1KM1yZgxmwWfadGqmC X-Received: by 10.101.82.201 with SMTP id z9mr7061055pgp.283.1515327421790; Sun, 07 Jan 2018 04:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327421; cv=none; d=google.com; s=arc-20160816; b=CZRw4PaEJlEuw96EaegevV96AB8JUi2owkIyxL/1TNmqKtWtkosbL996qMhxfX1QMK e9hC3uRQzrLzAIQ5w+WepvIxeR+dEab0mSgKVKfI7duUSoC3S8bWUDU+6tqFwEVUT1Lx Z931mVqbXtmERrHVRSZccVZXezk7Hm5xt7SZ2svhE9FwRtbOyBL5RYgN74cd0yJTZPGv ybCbXoH9c87GMR0ZrYRSmsYbMU0uukYMLbnr6t+idtxdGBx+7pxI2g7oyIBedDzCGa6Y c/2hXAGlCn+1xomeqPC+nJ+T4ztlCWHI3rmaSB4g7Aakqp1Qzxr9hXDvxmdYPVYqvIpK z/lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=uZ3VLG4nA/5QVr7bVRJOlcYhoHH5265Mu9lBmqvjNuE=; b=vXzo86tNoV1o2XMMPpvVTHV7P4IkWyctJtuqH4lXKoRZJL2vm+tVNUY+vwAoY21cvG sXvJflX0iWB0HGJfgvulS0Y92cl5+R6S5tJsxFdEZD963uRsZoSz+AyQfEymSE63e6R9 qxOaSsqzoBuh/4850EVHrtqQn3Fs+p3DCijqTnprUVkFJIV+KHiPEjDym/uSXyhV8rWo 5tZgtRPAYx5oZbwUXo/CXPnZk/aDqgUGt8R8tFJgXE2hEC7sAmssExjiiQKv8MSQsCgh YSwLnROO77WN1jA/jgRji49kX5SLXbgqWmJyGS8Q1wVn67eOkl3bO+7aifD2U+foJapT Li7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a65si6916947pfg.271.2018.01.07.04.17.01; Sun, 07 Jan 2018 04:17:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753963AbeAGMQ7 (ORCPT + 28 others); Sun, 7 Jan 2018 07:16:59 -0500 Received: from foss.arm.com ([217.140.101.70]:57464 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752986AbeAGMQ6 (ORCPT ); Sun, 7 Jan 2018 07:16:58 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA0E71435; Sun, 7 Jan 2018 04:16:57 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F02733F581; Sun, 7 Jan 2018 04:16:55 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 08/27] staging: ccree: remove unused leftover field Date: Sun, 7 Jan 2018 12:14:19 +0000 Message-Id: <1515327285-8948-9-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the unused monitor_desc field. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 1 - 1 file changed, 1 deletion(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 7686e14..e1c01da 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -32,7 +32,6 @@ struct cc_req_mgr_handle { struct cc_hw_desc compl_desc; u8 *dummy_comp_buff; dma_addr_t dummy_comp_buff_dma; - struct cc_hw_desc monitor_desc; #ifdef COMP_IN_WQ struct workqueue_struct *workq; From patchwork Sun Jan 7 12:14:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123653 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1547693qgn; Sun, 7 Jan 2018 04:17:12 -0800 (PST) X-Google-Smtp-Source: ACJfBosKDcLfNYU1AfilPFn35BiGgqcs4jRPLDz6eM6XIIlNHmTnTtxHtxEL867RjxX9DN3P7Gys X-Received: by 10.98.157.196 with SMTP id a65mr8158524pfk.138.1515327432025; Sun, 07 Jan 2018 04:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327432; cv=none; d=google.com; s=arc-20160816; b=NG6/gIydmOi5OHuuWSBQPxsTNOUtBDjR+EBCiTh8KCLDGGd+ZMgs6hrdRXNICC1wXv Q948dX9bd4xOyhvujkGeC0cZuuZs5Ra9q7QBOEuq+vSdUw9o2FR09n+rjyw/eFkunVH4 cLSVz2Pposiq0iqhTA/z8oJKjpWDnun1ZlTAuTV3WNJftprs6XvVBN8AkEFhTsFXPefZ tUm8YKUyUY3csRYE3INr05jdnxMHOhNJkdS/itXDhgkl88iXxAIbpWg/MDQI2U0bW3VD 3zlLe41se2qi+zLcqG4lXjlJmiX3LY2hmHGBVJVUPtfjRW243W9Zm3273ou0YnXG7s/b qABQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ZGMrLnu4MjYN3D3ld0CitHuJHw6e2gW0a5Vg30Sok20=; b=FGEQ2rjt1LA4VCPcZpdIgLnTvXlriV4YSaoJSfGdGrYYnBU3+r39crvhVwV0AhrNIO hQfMpq+IEvRSSVmOx6FZT002loKoZ1I5ricZQgGscKvZWuILgnA9kHi4AT7aq/elCxaG Qg3BPVgG0BXO+c2zEJvjD/dPW8k4iCkayT3vYhWBPUv4VHAYthFbVhtE4HCFsc+vYaZo hadWyQ04caP7RgKBvf4yBlNEOsGE2XoBz4ZFO1+1E5hxJCgIp2XodoUS5GN6lILLXkqI sSPNV+YHwj2/WDF+x7W1Mzbu33hpX1J6WjQIxFs2HU5ynHKjIOOGbxDItnc9jdlD2afm VAEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3si6964818plb.87.2018.01.07.04.17.11; Sun, 07 Jan 2018 04:17:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753970AbeAGMRK (ORCPT + 28 others); Sun, 7 Jan 2018 07:17:10 -0500 Received: from foss.arm.com ([217.140.101.70]:57474 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752986AbeAGMRI (ORCPT ); Sun, 7 Jan 2018 07:17:08 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 085BE1435; Sun, 7 Jan 2018 04:17:08 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2F3573F581; Sun, 7 Jan 2018 04:17:05 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 09/27] staging: ccree: break send_request and fix ret val Date: Sun, 7 Jan 2018 12:14:20 +0000 Message-Id: <1515327285-8948-10-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The send_request() function was handling both synchronous and asynchronous invocations, but were not handling the asynchronous case, which may be called in an atomic context, properly as it was sleeping. Start to fix the problem by breaking up the two use cases to separate functions calling a common internal service function and return error instead of sleeping for the asynchronous case. The next patch will complete the fix by implementing proper backlog handling. Fixes: abefd6741d ("staging: ccree: introduce CryptoCell HW driver"). Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_aead.c | 6 +- drivers/staging/ccree/ssi_cipher.c | 3 +- drivers/staging/ccree/ssi_hash.c | 22 ++-- drivers/staging/ccree/ssi_request_mgr.c | 180 ++++++++++++++++++-------------- drivers/staging/ccree/ssi_request_mgr.h | 11 +- 5 files changed, 128 insertions(+), 94 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 414098a..c2ae6f3 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -531,7 +531,7 @@ cc_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, idx++; } - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 0); + rc = cc_send_sync_request(ctx->drvdata, &cc_req, desc, idx); if (rc) dev_err(dev, "send_request() failed (rc=%d)\n", rc); @@ -630,7 +630,7 @@ cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) /* STAT_PHASE_3: Submit sequence to HW */ if (seq_len > 0) { /* For CCM there is no sequence to setup the key */ - rc = send_request(ctx->drvdata, &cc_req, desc, seq_len, 0); + rc = cc_send_sync_request(ctx->drvdata, &cc_req, desc, seq_len); if (rc) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); goto setkey_error; @@ -2039,7 +2039,7 @@ static int cc_proc_aead(struct aead_request *req, /* STAT_PHASE_3: Lock HW and push sequence */ - rc = send_request(ctx->drvdata, &cc_req, desc, seq_len, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, seq_len, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 933a452..beeed9c 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -717,7 +717,8 @@ static int cc_cipher_process(struct ablkcipher_request *req, /* STAT_PHASE_3: Lock HW and push sequence */ - rc = send_request(ctx_p->drvdata, &cc_req, desc, seq_len, 1); + rc = cc_send_request(ctx_p->drvdata, &cc_req, desc, seq_len, + &req->base); if (rc != -EINPROGRESS) { /* Failed to send the request or request completed * synchronously diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index b51a1d4..b05fd40 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -532,7 +532,7 @@ static int cc_hash_digest(struct ahash_request *req) cc_set_endianity(ctx->hash_mode, &desc[idx]); idx++; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); @@ -620,7 +620,7 @@ static int cc_hash_update(struct ahash_request *req) set_setup_mode(&desc[idx], SETUP_WRITE_STATE1); idx++; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); @@ -741,7 +741,7 @@ static int cc_hash_finup(struct ahash_request *req) set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); @@ -873,7 +873,7 @@ static int cc_hash_final(struct ahash_request *req) set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); @@ -1014,7 +1014,7 @@ static int cc_hash_setkey(struct crypto_ahash *ahash, const u8 *key, idx++; } - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 0); + rc = cc_send_sync_request(ctx->drvdata, &cc_req, desc, idx); if (rc) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); goto out; @@ -1071,7 +1071,7 @@ static int cc_hash_setkey(struct crypto_ahash *ahash, const u8 *key, idx++; } - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 0); + rc = cc_send_sync_request(ctx->drvdata, &cc_req, desc, idx); out: if (rc) @@ -1154,7 +1154,7 @@ static int cc_xcbc_setkey(struct crypto_ahash *ahash, CC_AES_128_BIT_KEY_SIZE, NS_BIT, 0); idx++; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 0); + rc = cc_send_sync_request(ctx->drvdata, &cc_req, desc, idx); if (rc) crypto_ahash_set_flags(ahash, CRYPTO_TFM_RES_BAD_KEY_LEN); @@ -1355,7 +1355,7 @@ static int cc_mac_update(struct ahash_request *req) cc_req.user_cb = (void *)cc_update_complete; cc_req.user_arg = (void *)req; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); @@ -1468,7 +1468,7 @@ static int cc_mac_final(struct ahash_request *req) set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); @@ -1541,7 +1541,7 @@ static int cc_mac_finup(struct ahash_request *req) set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); @@ -1615,7 +1615,7 @@ static int cc_mac_digest(struct ahash_request *req) set_cipher_mode(&desc[idx], ctx->hw_mode); idx++; - rc = send_request(ctx->drvdata, &cc_req, desc, idx, 1); + rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index e1c01da..f82eda1 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -172,7 +172,7 @@ static void enqueue_seq(struct cc_drvdata *drvdata, struct cc_hw_desc seq[], /*! * Completion will take place if and only if user requested completion - * by setting "is_dout = 0" in send_request(). + * by cc_send_sync_request(). * * \param dev * \param dx_compl_h The completion event to signal @@ -199,7 +199,7 @@ static int cc_queues_status(struct cc_drvdata *drvdata, req_mgr_h->req_queue_tail) { dev_err(dev, "SW FIFO is full. req_queue_head=%d sw_fifo_len=%d\n", req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE); - return -EBUSY; + return -ENOSPC; } if (req_mgr_h->q_free_slots >= total_seq_len) @@ -224,24 +224,25 @@ static int cc_queues_status(struct cc_drvdata *drvdata, dev_dbg(dev, "HW FIFO full, timeout. req_queue_head=%d sw_fifo_len=%d q_free_slots=%d total_seq_len=%d\n", req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE, req_mgr_h->q_free_slots, total_seq_len); - return -EAGAIN; + return -ENOSPC; } /*! * Enqueue caller request to crypto hardware. + * Need to be called with HW lock held and PM running * * \param drvdata * \param cc_req The request to enqueue * \param desc The crypto sequence * \param len The crypto sequence length - * \param is_dout If "true": completion is handled by the caller - * If "false": this function adds a dummy descriptor completion - * and waits upon completion signal. + * \param add_comp If "true": add an artificial dout DMA to mark completion * - * \return int Returns -EINPROGRESS if "is_dout=true"; "0" if "is_dout=false" + * \return int Returns -EINPROGRESS or error code */ -int send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, - struct cc_hw_desc *desc, unsigned int len, bool is_dout) +static int cc_do_send_request(struct cc_drvdata *drvdata, + struct cc_crypto_req *cc_req, + struct cc_hw_desc *desc, unsigned int len, + bool add_comp, bool ivgen) { struct cc_req_mgr_handle *req_mgr_h = drvdata->request_mgr_handle; unsigned int used_sw_slots; @@ -250,59 +251,8 @@ int send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, struct cc_hw_desc iv_seq[CC_IVPOOL_SEQ_LEN]; struct device *dev = drvdata_to_dev(drvdata); int rc; - unsigned int max_required_seq_len = - (total_seq_len + - ((cc_req->ivgen_dma_addr_len == 0) ? 0 : - CC_IVPOOL_SEQ_LEN) + (!is_dout ? 1 : 0)); - -#if defined(CONFIG_PM) - rc = cc_pm_get(dev); - if (rc) { - dev_err(dev, "ssi_power_mgr_runtime_get returned %x\n", rc); - return rc; - } -#endif - - do { - spin_lock_bh(&req_mgr_h->hw_lock); - - /* Check if there is enough place in the SW/HW queues - * in case iv gen add the max size and in case of no dout add 1 - * for the internal completion descriptor - */ - rc = cc_queues_status(drvdata, req_mgr_h, max_required_seq_len); - if (rc == 0) - /* There is enough place in the queue */ - break; - /* something wrong release the spinlock*/ - spin_unlock_bh(&req_mgr_h->hw_lock); - - if (rc != -EAGAIN) { - /* Any error other than HW queue full - * (SW queue is full) - */ -#if defined(CONFIG_PM) - cc_pm_put_suspend(dev); -#endif - return rc; - } - - /* HW queue is full - wait for it to clear up */ - wait_for_completion_interruptible(&drvdata->hw_queue_avail); - reinit_completion(&drvdata->hw_queue_avail); - } while (1); - /* Additional completion descriptor is needed incase caller did not - * enabled any DLLI/MLLI DOUT bit in the given sequence - */ - if (!is_dout) { - init_completion(&cc_req->seq_compl); - cc_req->user_cb = request_mgr_complete; - cc_req->user_arg = &cc_req->seq_compl; - total_seq_len++; - } - - if (cc_req->ivgen_dma_addr_len > 0) { + if (ivgen) { dev_dbg(dev, "Acquire IV from pool into %d DMA addresses %pad, %pad, %pad, IV-size=%u\n", cc_req->ivgen_dma_addr_len, &cc_req->ivgen_dma_addr[0], @@ -318,10 +268,6 @@ int send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, if (rc) { dev_err(dev, "Failed to generate IV (rc=%d)\n", rc); - spin_unlock_bh(&req_mgr_h->hw_lock); -#if defined(CONFIG_PM) - cc_pm_put_suspend(dev); -#endif return rc; } @@ -350,9 +296,15 @@ int send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, wmb(); /* STAT_PHASE_4: Push sequence */ - enqueue_seq(drvdata, iv_seq, iv_seq_len); + if (ivgen) + enqueue_seq(drvdata, iv_seq, iv_seq_len); + enqueue_seq(drvdata, desc, len); - enqueue_seq(drvdata, &req_mgr_h->compl_desc, (is_dout ? 0 : 1)); + + if (add_comp) { + enqueue_seq(drvdata, &req_mgr_h->compl_desc, 1); + total_seq_len++; + } if (req_mgr_h->q_free_slots < total_seq_len) { /* This situation should never occur. Maybe indicating problem @@ -366,19 +318,95 @@ int send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, req_mgr_h->q_free_slots -= total_seq_len; } - spin_unlock_bh(&req_mgr_h->hw_lock); - - if (!is_dout) { - /* Wait upon sequence completion. - * Return "0" -Operation done successfully. - */ - wait_for_completion(&cc_req->seq_compl); - return 0; - } /* Operation still in process */ return -EINPROGRESS; } +int cc_send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, + struct cc_hw_desc *desc, unsigned int len, + struct crypto_async_request *req) +{ + int rc; + struct cc_req_mgr_handle *mgr = drvdata->request_mgr_handle; + bool ivgen = !!cc_req->ivgen_dma_addr_len; + unsigned int total_len = len + (ivgen ? CC_IVPOOL_SEQ_LEN : 0); + struct device *dev = drvdata_to_dev(drvdata); + +#if defined(CONFIG_PM) + rc = cc_pm_get(dev); + if (rc) { + dev_err(dev, "ssi_power_mgr_runtime_get returned %x\n", rc); + return rc; + } +#endif + spin_lock_bh(&mgr->hw_lock); + rc = cc_queues_status(drvdata, mgr, total_len); + + if (!rc) + rc = cc_do_send_request(drvdata, cc_req, desc, len, false, + ivgen); + + spin_unlock_bh(&mgr->hw_lock); + +#if defined(CONFIG_PM) + if (rc != -EINPROGRESS) + cc_pm_put_suspend(dev); +#endif + + return rc; +} + +int cc_send_sync_request(struct cc_drvdata *drvdata, + struct cc_crypto_req *cc_req, struct cc_hw_desc *desc, + unsigned int len) +{ + int rc; + struct device *dev = drvdata_to_dev(drvdata); + struct cc_req_mgr_handle *mgr = drvdata->request_mgr_handle; + + init_completion(&cc_req->seq_compl); + cc_req->user_cb = request_mgr_complete; + cc_req->user_arg = &cc_req->seq_compl; + +#if defined(CONFIG_PM) + rc = cc_pm_get(dev); + if (rc) { + dev_err(dev, "ssi_power_mgr_runtime_get returned %x\n", rc); + return rc; + } +#endif + while (true) { + spin_lock_bh(&mgr->hw_lock); + rc = cc_queues_status(drvdata, mgr, len + 1); + + if (!rc) + break; + + spin_unlock_bh(&mgr->hw_lock); + if (rc != -EAGAIN) { +#if defined(CONFIG_PM) + cc_pm_put_suspend(dev); +#endif + return rc; + } + wait_for_completion_interruptible(&drvdata->hw_queue_avail); + reinit_completion(&drvdata->hw_queue_avail); + } + + rc = cc_do_send_request(drvdata, cc_req, desc, len, true, false); + spin_unlock_bh(&mgr->hw_lock); + + if (rc != -EINPROGRESS) { +#if defined(CONFIG_PM) + cc_pm_put_suspend(dev); +#endif + return rc; + } + + wait_for_completion(&cc_req->seq_compl); + return 0; +} + /*! * Enqueue caller request to crypto hardware during init process. * assume this function is not called in middle of a flow, diff --git a/drivers/staging/ccree/ssi_request_mgr.h b/drivers/staging/ccree/ssi_request_mgr.h index 8f9a9d3..f11a26a 100644 --- a/drivers/staging/ccree/ssi_request_mgr.h +++ b/drivers/staging/ccree/ssi_request_mgr.h @@ -23,10 +23,15 @@ int cc_req_mgr_init(struct cc_drvdata *drvdata); * If "false": this function adds a dummy descriptor completion * and waits upon completion signal. * - * \return int Returns -EINPROGRESS if "is_dout=true"; "0" if "is_dout=false" + * \return int Returns -EINPROGRESS or error */ -int send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, - struct cc_hw_desc *desc, unsigned int len, bool is_dout); +int cc_send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, + struct cc_hw_desc *desc, unsigned int len, + struct crypto_async_request *req); + +int cc_send_sync_request(struct cc_drvdata *drvdata, + struct cc_crypto_req *cc_req, struct cc_hw_desc *desc, + unsigned int len); int send_request_init(struct cc_drvdata *drvdata, struct cc_hw_desc *desc, unsigned int len); From patchwork Sun Jan 7 12:14:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123654 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1547844qgn; Sun, 7 Jan 2018 04:17:22 -0800 (PST) X-Google-Smtp-Source: ACJfBoubbJ0DpDKnebwRfUhyxw9gY9CWhifdEXThqngIN1DBujN3lSyBTJ86URL4c+Ja0nbniyLn X-Received: by 10.99.95.193 with SMTP id t184mr2587237pgb.189.1515327442379; Sun, 07 Jan 2018 04:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327442; cv=none; d=google.com; s=arc-20160816; b=NEF66Vu7msogcvCMt+gv5KN1b74kCyVmTFHopmysfRamTRbAUm4w3iGwrdN5MVn3Q9 HRK/LnPAFjgOtiAMgs8ttqyal5K4Y3i4Z4iW+Mjgbylxd9ca0cl8KNEZTUyK84+dFuDS h/eY+CcAUm8CgfTh9n7vDBAT7FHOP3YT09vZeD19gpQ6t2FCdkiuLSdjDOX2tYM2BtDN KNwULAIJeG0Fz2+13aDA4h6ZUliMqVew7vAzoUnmMh6YsRVRTCu8m4gu2B02FB64mC+B mtWBUeLrGBkksa4LwQIh7pPH4NfLCsUCpAJl3LAdgmWJf2NcWPYjGSFoKcOKtK7MXZ3k XPlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=TBZV289GiIUYykGfGCjdwoltv81MSJvjrbHFcw5khcU=; b=HACvJU0sa+I18u/+vUh2sgRfk7LhWAQVOHTBF4ak0UUNAcpYix7GJKwS9NcFUWgZOu OkSIvnot62tCGIU10TpCnarnpkUkRyvA5ptf4Jhri1DHwAMHUjcwKdLzKivaBiFLiEGA PSI+m7+CBhmz7HnC9MH/PkIrAH0M5yPvPdMFDC0yVGQlguB5dAYJXDC1PRWbjflS44pB RuYtqzn1Gq1zSp/ic0K3VQkP18kiVGJRt/R41IN4kO4CZXO3xLzUiZgaeaMszVoyXmKy lmO4nspXyWuODXwMuLAsvdpeST+mQNIVEtJj/dBX92hG/yGif3G0lF/wTShKnhOU16j4 EvLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10si6104435pgv.773.2018.01.07.04.17.22; Sun, 07 Jan 2018 04:17:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753983AbeAGMRU (ORCPT + 28 others); Sun, 7 Jan 2018 07:17:20 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57484 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752986AbeAGMRT (ORCPT ); Sun, 7 Jan 2018 07:17:19 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C2DCD1435; Sun, 7 Jan 2018 04:17:18 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EF5ED3F581; Sun, 7 Jan 2018 04:17:15 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 10/27] staging: ccree: add backlog processing Date: Sun, 7 Jan 2018 12:14:21 +0000 Message-Id: <1515327285-8948-11-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Crypto API tfm providers are required to provide a backlog service, if so indicated, that queues up requests in the case of the provider being busy and processing them later. The ccree driver did not provide this facility. Add it now. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_aead.c | 26 +++--- drivers/staging/ccree/ssi_cipher.c | 13 ++- drivers/staging/ccree/ssi_driver.h | 2 +- drivers/staging/ccree/ssi_hash.c | 28 +++---- drivers/staging/ccree/ssi_request_mgr.c | 136 ++++++++++++++++++++++++++++++-- 5 files changed, 163 insertions(+), 42 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index c2ae6f3..6f41a00 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -211,19 +211,21 @@ static int cc_aead_init(struct crypto_aead *tfm) return -ENOMEM; } -static void cc_aead_complete(struct device *dev, void *cc_req) +static void cc_aead_complete(struct device *dev, void *cc_req, int err) { struct aead_request *areq = (struct aead_request *)cc_req; struct aead_req_ctx *areq_ctx = aead_request_ctx(areq); struct crypto_aead *tfm = crypto_aead_reqtfm(cc_req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); - int err = 0; cc_unmap_aead_request(dev, areq); /* Restore ordinary iv pointer */ areq->iv = areq_ctx->backup_iv; + if (err) + goto done; + if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) { if (memcmp(areq_ctx->mac_buf, areq_ctx->icv_virt_addr, ctx->authsize) != 0) { @@ -258,7 +260,7 @@ static void cc_aead_complete(struct device *dev, void *cc_req) CCM_BLOCK_IV_OFFSET, CCM_BLOCK_IV_SIZE); } } - +done: aead_request_complete(areq, err); } @@ -2041,7 +2043,7 @@ static int cc_proc_aead(struct aead_request *req, rc = cc_send_request(ctx->drvdata, &cc_req, desc, seq_len, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_aead_request(dev, req); } @@ -2063,7 +2065,7 @@ static int cc_aead_encrypt(struct aead_request *req) areq_ctx->plaintext_authenticate_only = false; rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_ENCRYPT); - if (rc != -EINPROGRESS) + if (rc != -EINPROGRESS && rc != -EBUSY) req->iv = areq_ctx->backup_iv; return rc; @@ -2092,7 +2094,7 @@ static int cc_rfc4309_ccm_encrypt(struct aead_request *req) cc_proc_rfc4309_ccm(req); rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_ENCRYPT); - if (rc != -EINPROGRESS) + if (rc != -EINPROGRESS && rc != -EBUSY) req->iv = areq_ctx->backup_iv; out: return rc; @@ -2111,7 +2113,7 @@ static int cc_aead_decrypt(struct aead_request *req) areq_ctx->plaintext_authenticate_only = false; rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_DECRYPT); - if (rc != -EINPROGRESS) + if (rc != -EINPROGRESS && rc != -EBUSY) req->iv = areq_ctx->backup_iv; return rc; @@ -2138,7 +2140,7 @@ static int cc_rfc4309_ccm_decrypt(struct aead_request *req) cc_proc_rfc4309_ccm(req); rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_DECRYPT); - if (rc != -EINPROGRESS) + if (rc != -EINPROGRESS && rc != -EBUSY) req->iv = areq_ctx->backup_iv; out: @@ -2257,7 +2259,7 @@ static int cc_rfc4106_gcm_encrypt(struct aead_request *req) areq_ctx->is_gcm4543 = true; rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_ENCRYPT); - if (rc != -EINPROGRESS) + if (rc != -EINPROGRESS && rc != -EBUSY) req->iv = areq_ctx->backup_iv; out: return rc; @@ -2281,7 +2283,7 @@ static int cc_rfc4543_gcm_encrypt(struct aead_request *req) areq_ctx->is_gcm4543 = true; rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_ENCRYPT); - if (rc != -EINPROGRESS) + if (rc != -EINPROGRESS && rc != -EBUSY) req->iv = areq_ctx->backup_iv; return rc; @@ -2312,7 +2314,7 @@ static int cc_rfc4106_gcm_decrypt(struct aead_request *req) areq_ctx->is_gcm4543 = true; rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_DECRYPT); - if (rc != -EINPROGRESS) + if (rc != -EINPROGRESS && rc != -EBUSY) req->iv = areq_ctx->backup_iv; out: return rc; @@ -2336,7 +2338,7 @@ static int cc_rfc4543_gcm_decrypt(struct aead_request *req) areq_ctx->is_gcm4543 = true; rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_DECRYPT); - if (rc != -EINPROGRESS) + if (rc != -EINPROGRESS && rc != -EBUSY) req->iv = areq_ctx->backup_iv; return rc; diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index beeed9c..a0e7d00 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -52,7 +52,7 @@ struct cc_cipher_ctx { struct crypto_shash *shash_tfm; }; -static void cc_cipher_complete(struct device *dev, void *cc_req); +static void cc_cipher_complete(struct device *dev, void *cc_req, int err); static int validate_keys_sizes(struct cc_cipher_ctx *ctx_p, u32 size) { @@ -590,7 +590,7 @@ static void cc_setup_cipher_data(struct crypto_tfm *tfm, } } -static void cc_cipher_complete(struct device *dev, void *cc_req) +static void cc_cipher_complete(struct device *dev, void *cc_req, int err) { struct ablkcipher_request *areq = (struct ablkcipher_request *)cc_req; struct scatterlist *dst = areq->dst; @@ -598,7 +598,6 @@ static void cc_cipher_complete(struct device *dev, void *cc_req) struct blkcipher_req_ctx *req_ctx = ablkcipher_request_ctx(areq); struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); unsigned int ivsize = crypto_ablkcipher_ivsize(tfm); - int completion_error = 0; struct ablkcipher_request *req = (struct ablkcipher_request *)areq; cc_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); @@ -614,13 +613,13 @@ static void cc_cipher_complete(struct device *dev, void *cc_req) if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) { memcpy(req->info, req_ctx->backup_info, ivsize); kfree(req_ctx->backup_info); - } else { + } else if (!err) { scatterwalk_map_and_copy(req->info, req->dst, (req->nbytes - ivsize), ivsize, 0); } - ablkcipher_request_complete(areq, completion_error); + ablkcipher_request_complete(areq, err); } static int cc_cipher_process(struct ablkcipher_request *req, @@ -719,7 +718,7 @@ static int cc_cipher_process(struct ablkcipher_request *req, rc = cc_send_request(ctx_p->drvdata, &cc_req, desc, seq_len, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { /* Failed to send the request or request completed * synchronously */ @@ -730,7 +729,7 @@ static int cc_cipher_process(struct ablkcipher_request *req, if (cts_restore_flag) ctx_p->cipher_mode = DRV_CIPHER_CBC_CTS; - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { kfree(req_ctx->backup_info); kfree(req_ctx->iv); } diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index f71c602..c2b978b 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -81,7 +81,7 @@ extern bool cc_dump_bytes; #define CC_MAX_IVGEN_DMA_ADDRESSES 3 struct cc_crypto_req { - void (*user_cb)(struct device *dev, void *req); + void (*user_cb)(struct device *dev, void *req, int err); void *user_arg; dma_addr_t ivgen_dma_addr[CC_MAX_IVGEN_DMA_ADDRESSES]; /* For the first 'ivgen_dma_addr_len' addresses of this array, diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index b05fd40..ff05ac8 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -342,7 +342,7 @@ static void cc_unmap_result(struct device *dev, struct ahash_req_ctx *state, state->digest_result_dma_addr = 0; } -static void cc_update_complete(struct device *dev, void *cc_req) +static void cc_update_complete(struct device *dev, void *cc_req, int err) { struct ahash_request *req = (struct ahash_request *)cc_req; struct ahash_req_ctx *state = ahash_request_ctx(req); @@ -350,10 +350,10 @@ static void cc_update_complete(struct device *dev, void *cc_req) dev_dbg(dev, "req=%pK\n", req); cc_unmap_hash_request(dev, state, req->src, false); - req->base.complete(&req->base, 0); + req->base.complete(&req->base, err); } -static void cc_digest_complete(struct device *dev, void *cc_req) +static void cc_digest_complete(struct device *dev, void *cc_req, int err) { struct ahash_request *req = (struct ahash_request *)cc_req; struct ahash_req_ctx *state = ahash_request_ctx(req); @@ -366,10 +366,10 @@ static void cc_digest_complete(struct device *dev, void *cc_req) cc_unmap_hash_request(dev, state, req->src, false); cc_unmap_result(dev, state, digestsize, req->result); cc_unmap_req(dev, state, ctx); - req->base.complete(&req->base, 0); + req->base.complete(&req->base, err); } -static void cc_hash_complete(struct device *dev, void *cc_req) +static void cc_hash_complete(struct device *dev, void *cc_req, int err) { struct ahash_request *req = (struct ahash_request *)cc_req; struct ahash_req_ctx *state = ahash_request_ctx(req); @@ -382,7 +382,7 @@ static void cc_hash_complete(struct device *dev, void *cc_req) cc_unmap_hash_request(dev, state, req->src, false); cc_unmap_result(dev, state, digestsize, req->result); cc_unmap_req(dev, state, ctx); - req->base.complete(&req->base, 0); + req->base.complete(&req->base, err); } static int cc_hash_digest(struct ahash_request *req) @@ -533,7 +533,7 @@ static int cc_hash_digest(struct ahash_request *req) idx++; rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); cc_unmap_result(dev, state, digestsize, result); @@ -621,7 +621,7 @@ static int cc_hash_update(struct ahash_request *req) idx++; rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); } @@ -742,7 +742,7 @@ static int cc_hash_finup(struct ahash_request *req) idx++; rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); cc_unmap_result(dev, state, digestsize, result); @@ -874,7 +874,7 @@ static int cc_hash_final(struct ahash_request *req) idx++; rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); cc_unmap_result(dev, state, digestsize, result); @@ -1356,7 +1356,7 @@ static int cc_mac_update(struct ahash_request *req) cc_req.user_arg = (void *)req; rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); } @@ -1469,7 +1469,7 @@ static int cc_mac_final(struct ahash_request *req) idx++; rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); cc_unmap_result(dev, state, digestsize, req->result); @@ -1542,7 +1542,7 @@ static int cc_mac_finup(struct ahash_request *req) idx++; rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); cc_unmap_result(dev, state, digestsize, req->result); @@ -1616,7 +1616,7 @@ static int cc_mac_digest(struct ahash_request *req) idx++; rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS) { + if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); cc_unmap_result(dev, state, digestsize, req->result); diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index f82eda1..1d13756 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -14,6 +14,8 @@ #include "ssi_pm.h" #define CC_MAX_POLL_ITER 10 +/* The highest descriptor count in used */ +#define CC_MAX_DESC_SEQ_LEN 23 struct cc_req_mgr_handle { /* Request manager resources */ @@ -33,6 +35,11 @@ struct cc_req_mgr_handle { u8 *dummy_comp_buff; dma_addr_t dummy_comp_buff_dma; + /* backlog queue */ + struct list_head backlog; + unsigned int bl_len; + spinlock_t bl_lock; /* protect backlog queue */ + #ifdef COMP_IN_WQ struct workqueue_struct *workq; struct delayed_work compwork; @@ -44,6 +51,14 @@ struct cc_req_mgr_handle { #endif }; +struct cc_bl_item { + struct cc_crypto_req creq; + struct cc_hw_desc desc[CC_MAX_DESC_SEQ_LEN]; + unsigned int len; + struct list_head list; + bool notif; +}; + static void comp_handler(unsigned long devarg); #ifdef COMP_IN_WQ static void comp_work_handler(struct work_struct *work); @@ -93,6 +108,9 @@ int cc_req_mgr_init(struct cc_drvdata *drvdata) drvdata->request_mgr_handle = req_mgr_h; spin_lock_init(&req_mgr_h->hw_lock); + spin_lock_init(&req_mgr_h->bl_lock); + INIT_LIST_HEAD(&req_mgr_h->backlog); + #ifdef COMP_IN_WQ dev_dbg(dev, "Initializing completion workqueue\n"); req_mgr_h->workq = create_singlethread_workqueue("arm_cc7x_wq"); @@ -177,7 +195,8 @@ static void enqueue_seq(struct cc_drvdata *drvdata, struct cc_hw_desc seq[], * \param dev * \param dx_compl_h The completion event to signal */ -static void request_mgr_complete(struct device *dev, void *dx_compl_h) +static void request_mgr_complete(struct device *dev, void *dx_compl_h, + int dummy) { struct completion *this_compl = dx_compl_h; @@ -322,6 +341,84 @@ static int cc_do_send_request(struct cc_drvdata *drvdata, return -EINPROGRESS; } +static void cc_enqueue_backlog(struct cc_drvdata *drvdata, + struct cc_bl_item *bli) +{ + struct cc_req_mgr_handle *mgr = drvdata->request_mgr_handle; + + spin_lock_bh(&mgr->bl_lock); + list_add_tail(&bli->list, &mgr->backlog); + ++mgr->bl_len; + spin_unlock_bh(&mgr->bl_lock); + tasklet_schedule(&mgr->comptask); +} + +static void cc_proc_backlog(struct cc_drvdata *drvdata) +{ + struct cc_req_mgr_handle *mgr = drvdata->request_mgr_handle; + struct cc_bl_item *bli; + struct cc_crypto_req *creq; + struct crypto_async_request *req; + bool ivgen; + unsigned int total_len; + struct device *dev = drvdata_to_dev(drvdata); + int rc; + + spin_lock(&mgr->bl_lock); + + while (mgr->bl_len) { + bli = list_first_entry(&mgr->backlog, struct cc_bl_item, list); + spin_unlock(&mgr->bl_lock); + + creq = &bli->creq; + req = (struct crypto_async_request *)creq->user_arg; + + /* + * Notify the request we're moving out of the backlog + * but only if we haven't done so already. + */ + if (!bli->notif) { + req->complete(req, -EINPROGRESS); + bli->notif = true; + } + + ivgen = !!creq->ivgen_dma_addr_len; + total_len = bli->len + (ivgen ? CC_IVPOOL_SEQ_LEN : 0); + + spin_lock(&mgr->hw_lock); + + rc = cc_queues_status(drvdata, mgr, total_len); + if (rc) { + /* + * There is still not room in the FIFO for + * this request. Bail out. We'll return here + * on the next completion irq. + */ + spin_unlock(&mgr->hw_lock); + return; + } + + rc = cc_do_send_request(drvdata, &bli->creq, bli->desc, + bli->len, false, ivgen); + + spin_unlock(&mgr->hw_lock); + + if (rc != -EINPROGRESS) { +#if defined(CONFIG_PM) + cc_pm_put_suspend(dev); +#endif + creq->user_cb(dev, req, rc); + } + + /* Remove ourselves from the backlog list */ + spin_lock(&mgr->bl_lock); + list_del(&bli->list); + --mgr->bl_len; + } + + spin_unlock(&mgr->bl_lock); +} + int cc_send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, struct cc_hw_desc *desc, unsigned int len, struct crypto_async_request *req) @@ -331,6 +428,9 @@ int cc_send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, bool ivgen = !!cc_req->ivgen_dma_addr_len; unsigned int total_len = len + (ivgen ? CC_IVPOOL_SEQ_LEN : 0); struct device *dev = drvdata_to_dev(drvdata); + bool backlog_ok = req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG; + gfp_t flags = cc_gfp_flags(req); + struct cc_bl_item *bli; #if defined(CONFIG_PM) rc = cc_pm_get(dev); @@ -342,17 +442,35 @@ int cc_send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, spin_lock_bh(&mgr->hw_lock); rc = cc_queues_status(drvdata, mgr, total_len); - if (!rc) - rc = cc_do_send_request(drvdata, cc_req, desc, len, false, - ivgen); +#ifdef CC_DEBUG_FORCE_BACKLOG + if (backlog_ok) + rc = -ENOSPC; +#endif /* CC_DEBUG_FORCE_BACKLOG */ - spin_unlock_bh(&mgr->hw_lock); + if (rc == -ENOSPC && backlog_ok) { + spin_unlock_bh(&mgr->hw_lock); + bli = kmalloc(sizeof(*bli), flags); + if (!bli) { #if defined(CONFIG_PM) - if (rc != -EINPROGRESS) - cc_pm_put_suspend(dev); + cc_pm_put_suspend(dev); #endif + return -ENOMEM; + } + + memcpy(&bli->creq, cc_req, sizeof(*cc_req)); + memcpy(&bli->desc, desc, len * sizeof(*desc)); + bli->len = len; + bli->notif = false; + cc_enqueue_backlog(drvdata, bli); + return -EBUSY; + } + if (!rc) + rc = cc_do_send_request(drvdata, cc_req, desc, len, false, + ivgen); + + spin_unlock_bh(&mgr->hw_lock); return rc; } @@ -501,7 +619,7 @@ static void proc_completions(struct cc_drvdata *drvdata) cc_req = &request_mgr_handle->req_queue[*tail]; if (cc_req->user_cb) - cc_req->user_cb(dev, cc_req->user_arg); + cc_req->user_cb(dev, cc_req->user_arg, 0); *tail = (*tail + 1) & (MAX_REQUEST_QUEUE_SIZE - 1); dev_dbg(dev, "Dequeue request tail=%u\n", *tail); dev_dbg(dev, "Request completed. axi_completed=%d\n", @@ -566,6 +684,8 @@ static void comp_handler(unsigned long devarg) */ cc_iowrite(drvdata, CC_REG(HOST_IMR), cc_ioread(drvdata, CC_REG(HOST_IMR)) & ~irq); + + cc_proc_backlog(drvdata); } /* From patchwork Sun Jan 7 12:14:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123655 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1548021qgn; Sun, 7 Jan 2018 04:17:32 -0800 (PST) X-Google-Smtp-Source: ACJfBosSvche7AEOLXaB0TBik7u8gaIdhOwacBVF0yRir+/f8uiTD4yhKTiqjovF1fKXachI8jNF X-Received: by 10.98.190.19 with SMTP id l19mr7967399pff.72.1515327452263; Sun, 07 Jan 2018 04:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327452; cv=none; d=google.com; s=arc-20160816; b=CYvBtkdrqjRxle1mWQps5FaAULhXtJyGFZtmzDJ5XD8tCN6HmPzQBiCDyZhtY4XiEC kcAi6VrACg4kEeKdEvDM9RLBS9CYH2tppujXsFBzdaSOTziISSU3R3FWOQ9aEs2TnogY 9zaHABs06vOpT+rYzHBzojO9f91cF2RGiZKsuUvFZAAhgkuHzUQuL5R1EGXyawLtKXym /tT0Jm8uXBT7wV6mnSg2wu94VYbju48H+r4aLBbl2T4fRuCR8BMosbA8V87+lNtQyy2W JpLjC9jllAPw04qKiG5wPCgyKWYIBEu3wNju1TTjjqrSxnBiDbplCG0Lg47SftDXZ8m3 v2jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=w7hgApJ5P3JZl7xGNazquDcxynAqXmz85Iq5v49MP4U=; b=zLPl04TkLbrXFnBOEGlfCAowrTsyUhXeAiyqH4FszMx45/DniXkUbt2j7jIo8JFZUN a7W+bPz0GIos8fU31Twnkv/zDwVWuz66sVfEUZDjQHsQMyIf1m1K1m/FGfStB5gaQNIJ 2qYLTmFF5JZ+qXlgVqTWzDKpQVb+IHmUbpPAuJ7KneqSDTj6fLkFaP/itzO4L8Rt62f0 podoAlAqnLGIuxnn3U6zH3QE5/XXP/YsD5+f8Jb4T5IgCaBiyYpjEcb4EY28wAeeN/Xx 1OT9O7/L7d8keekv9wByReqb/lNkmow+6UTHb1LaQL3dUrx2FTfnJDi1ij5nE535/G0n TKbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h70si6944949pfc.186.2018.01.07.04.17.32; Sun, 07 Jan 2018 04:17:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753997AbeAGMRa (ORCPT + 28 others); Sun, 7 Jan 2018 07:17:30 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57494 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753826AbeAGMR3 (ORCPT ); Sun, 7 Jan 2018 07:17:29 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B89A81435; Sun, 7 Jan 2018 04:17:28 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A84FF3F581; Sun, 7 Jan 2018 04:17:26 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 11/27] stating: ccree: revert "staging: ccree: fix leak of import() after init()" Date: Sun, 7 Jan 2018 12:14:22 +0000 Message-Id: <1515327285-8948-12-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit c5f39d07860c ("staging: ccree: fix leak of import() after init()") and commit aece09024414 ("staging: ccree: Uninitialized return in ssi_ahash_import()"). This is the wrong solution and ends up relying on uninitialized memory, although it was not obvious to me at the time. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index ff05ac8..ee7370c 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1673,7 +1673,7 @@ static int cc_hash_import(struct ahash_request *req, const void *in) struct device *dev = drvdata_to_dev(ctx->drvdata); struct ahash_req_ctx *state = ahash_request_ctx(req); u32 tmp; - int rc = 0; + int rc; memcpy(&tmp, in, sizeof(u32)); if (tmp != CC_EXPORT_MAGIC) { @@ -1682,12 +1682,9 @@ static int cc_hash_import(struct ahash_request *req, const void *in) } in += sizeof(u32); - /* call init() to allocate bufs if the user hasn't */ - if (!state->digest_buff) { - rc = cc_hash_init(req); - if (rc) - goto out; - } + rc = cc_hash_init(req); + if (rc) + goto out; dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); From patchwork Sun Jan 7 12:14:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123656 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1548175qgn; Sun, 7 Jan 2018 04:17:41 -0800 (PST) X-Google-Smtp-Source: ACJfBosx454cPTr78TeLIvwmO87UVjmQR0Npc5/ak5cqiWLouaJ0Shta5BxPZVm0J9OGHLpK5oBa X-Received: by 10.84.210.102 with SMTP id z93mr9050257plh.313.1515327461840; Sun, 07 Jan 2018 04:17:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327461; cv=none; d=google.com; s=arc-20160816; b=ak4aM49Grq3cHSen+EHq6yKMnLKiHr1I9aly7mCRmR2Fh9H9UcwA/b3sQ/97M5TEiv 50s1AmJ4k4l01sCB/5kuGLTIKGhK1/1ldDl9ZZJUrkjHjD4TF1F14d0fKe/xBD1htldf z4ak97KXkULr3HcavDg3vfKBssZf55KC7DGZ8TbMUtIEe3Kp+Aqu0vacr2ir0NTMCm0h lWZW5Gbz/kbf2PSgecHHDHfC56CNrog0mNxi4fSZgq7z6arFOduSJ7HEGeJUi/1Wk1LY k2OA885sFFbrG/JoTMJfu7WEafpq9Xt7erp0GH7GBIx7s09ixXJv3q4Gyksv1pPebbNs uZOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=qZ30rwiaScrvfUq11zpI0YStoi2meWLva582zxs3Ak0=; b=h63sKvIm92MSDZ4lKweegHS1pw/mTMqR2/gSE55IQq42jn2OWcRCz7FGePzRi01+UA hXEW6fVNvQOk29+lF1uHmuLdzhs8/4z3xFARn85WvR8WgjKZtjRM5T/o0kj8Iy0i1HW/ wIyc1JBrRq/WtloYg9V63C8i2M362i+U96H5P8a6cDjbC95qIbJzNleg1xxH7SNkTn7b 4IckxNKVCCdw1X9Iq2fq69y6Atwi2CAlHmlxiosnJ2g4zAHSev7DbQbA5exQWMSYw3AD 8SNWuTaVQwzYSyHEqkmZfKtpXDUiUGxZsDf48pVgyoaUHaGPXR5i/khnAuPb8llMMa5k CKyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si2014836pln.776.2018.01.07.04.17.41; Sun, 07 Jan 2018 04:17:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754011AbeAGMRk (ORCPT + 28 others); Sun, 7 Jan 2018 07:17:40 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57508 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753826AbeAGMRi (ORCPT ); Sun, 7 Jan 2018 07:17:38 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D71A1435; Sun, 7 Jan 2018 04:17:38 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C42EF3F581; Sun, 7 Jan 2018 04:17:36 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 12/27] staging: ccree: failing the suspend is not an error Date: Sun, 7 Jan 2018 12:14:23 +0000 Message-Id: <1515327285-8948-13-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PM suspend returning a none zero value is not an error. It simply indicates a suspend is not advised right now so don't treat it as an error. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 1d13756..ff751d3 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -598,9 +598,6 @@ static void proc_completions(struct cc_drvdata *drvdata) drvdata->request_mgr_handle; unsigned int *tail = &request_mgr_handle->req_queue_tail; unsigned int *head = &request_mgr_handle->req_queue_head; -#if defined(CONFIG_PM) - int rc = 0; -#endif while (request_mgr_handle->axi_completed) { request_mgr_handle->axi_completed--; @@ -625,10 +622,7 @@ static void proc_completions(struct cc_drvdata *drvdata) dev_dbg(dev, "Request completed. axi_completed=%d\n", request_mgr_handle->axi_completed); #if defined(CONFIG_PM) - rc = cc_pm_put_suspend(dev); - if (rc) - dev_err(dev, "Failed to set runtime suspension %d\n", - rc); + cc_pm_put_suspend(dev); #endif } } From patchwork Sun Jan 7 12:14:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123657 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1548328qgn; Sun, 7 Jan 2018 04:17:53 -0800 (PST) X-Google-Smtp-Source: ACJfBotx7INQdqqRg3Bg3oYHuoOQ4nyyTinmM5p8PnH/VwhhFJzQtEdhFhct7hEn7RKvXCCihgUE X-Received: by 10.101.71.205 with SMTP id f13mr7169764pgs.411.1515327473167; Sun, 07 Jan 2018 04:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327473; cv=none; d=google.com; s=arc-20160816; b=tytsOzb9zzWz6bOCz5/tZvi6eY2RVZm/XjGKriGQkglvkmtwJ7wjAYITPHhzuGs/te F7zJ6WMSYBrkcBlL16XiAPbxIdMVLN8mhpNrfQAA8qrr28psCxJ+Nx7P2Y6jn0H0dbKQ bDfyHET1RAPPQVX+fqrM3nwMZe+jfNc0W2xWltC2CBoIoofq7XVgDGFAcIhBbCRMZAjq /MW1pJkKMJYGeERQNEIbNXVxAicAZh7sjhiHm7glS4w7U/PM8TNvzPlkDg67y/vAoeIh ew4n1rEQh0cYE+J9O9EuKOPoRTX2aX663Dp1QmjFVlKiCvtMCX/iP9fT/BhIXE3DiMpa C/BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=TA0VYmepL2AjhZ24BnOEerRWAyGxxfoATYElf6fI6S0=; b=i6duoVLoADVStEoe7m0Tof2DwPeJMNZZaCj1IixhNo/BMy+4H88676ikmCYJqoLmEc Drmy+qpWMNn8LbRdaGKKbzHUPi9hpPUwzd0Coglf5ZElBzXu5fUAW0zSFnAWu/JY934z OGyPF/hdwpsYPQ9zm/Z9RyOuqpagwX/rffLrlVw+NddiysbEp9nLjrpOmrDWXTcldF12 QA6pRghaLtuDrJQZxKyjPYtdom//bh+tMJ2PY0yivHTZJQFXTZ/7o82fpb+rKA96QehV lnATWZxEQFZWOfPM8tT2NVq3ELWDLbcUsPMrjlXzUeoRu/pKfBQd4crDGcZPRc5AKQWm d+Zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si2127365pfh.17.2018.01.07.04.17.52; Sun, 07 Jan 2018 04:17:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754026AbeAGMRv (ORCPT + 28 others); Sun, 7 Jan 2018 07:17:51 -0500 Received: from foss.arm.com ([217.140.101.70]:57518 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753826AbeAGMRs (ORCPT ); Sun, 7 Jan 2018 07:17:48 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 985711435; Sun, 7 Jan 2018 04:17:48 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 88A543F581; Sun, 7 Jan 2018 04:17:46 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 13/27] staging: ccree: check DMA pool buf !NULL before free Date: Sun, 7 Jan 2018 12:14:24 +0000 Message-Id: <1515327285-8948-14-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we ran out of DMA pool buffers, we get into the unmap code path with a NULL before. Deal with this by checking the virtual mapping is not NULL. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index e85bb53..78288ed 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -465,7 +465,8 @@ void cc_unmap_blkcipher_request(struct device *dev, void *ctx, DMA_TO_DEVICE); } /* Release pool */ - if (req_ctx->dma_buf_type == CC_DMA_BUF_MLLI) { + if (req_ctx->dma_buf_type == CC_DMA_BUF_MLLI && + req_ctx->mlli_params.mlli_virt_addr) { dma_pool_free(req_ctx->mlli_params.curr_pool, req_ctx->mlli_params.mlli_virt_addr, req_ctx->mlli_params.mlli_dma_addr); From patchwork Sun Jan 7 12:14:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123659 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1548641qgn; Sun, 7 Jan 2018 04:18:15 -0800 (PST) X-Google-Smtp-Source: ACJfBotr7ags6LelDObdZ7faX1WODBP/QjTULCQiRlI2TnknU5g6J0I1x5bI+63zkmpI0Uqtd22J X-Received: by 10.84.251.134 with SMTP id w6mr8785310pll.230.1515327495320; Sun, 07 Jan 2018 04:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327495; cv=none; d=google.com; s=arc-20160816; b=V8iO3PcyCTuouiz6lxQbPPvfFISSKajZUZDk2kmfmRPl13HeRuJ76ikskBrbjQ62QQ VBI/sbMu5dVQXkQBB6jsCfSNR3kiAYDxmUl9DS9XOZA63BIdTYvYaJHO3U+yKsjaahod sNeumPD8RfxsPpKpeBXx9esAdmbBTvegKAmWGdlOVBqiFtt4mMsdA8nvI/jJJdmRwCrO 51Lh3mztjsgtw0EFhtvtLmU3XuRkiTXoLLZkZWRQzPdfnCVyUIjtDvA9mP2kpG71gOx3 xY/uXChe6Brv8g0kvah2Pgq9KS8QAaXKAKLX1uY1JkTwn7BSp2pVz6q812xiaGn6/NyG DAYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=sK0sMAKZfMGGAa3ydy8gFlNFYvkGTcNtrMFscD2EzCQ=; b=mhVkQm4PDS18B2Zeb0mFNHIq70CHzEmvS/kZZtGGuPCthGu2KK9fe/J74hDMZoHXPB dEjbEMg9Fpwd7Ozo/uVEMcJlzTNtJHc85CeEVpmqo5GAZ6Rb4uNALhIGyPZZpXr7vzOD LaSEX4EuN9szCIAbUM+8KRxmhJ/vWjMKFikNS7sg0nEFnNov+smBUgZQRa37N50aD4Ti 8ctIV1R61NkmbDe0vHCEIOWSzmmcJVXMMf1Xb9RQce2m+oArhrKUSM7mECUsKnkQCOTC q+RAjm0ACu7u4HWP5B6MKAmnQmSnvj8lFtpcVeN5wL497iAikvFgF1+WLkZib+kIbjEp Q0ZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si6936693pfx.81.2018.01.07.04.18.15; Sun, 07 Jan 2018 04:18:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754051AbeAGMSM (ORCPT + 28 others); Sun, 7 Jan 2018 07:18:12 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57540 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870AbeAGMSK (ORCPT ); Sun, 7 Jan 2018 07:18:10 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 51B451435; Sun, 7 Jan 2018 04:18:10 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 79ACC3F581; Sun, 7 Jan 2018 04:18:08 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 15/27] staging: ccree: use Makefile to include PM code Date: Sun, 7 Jan 2018 12:14:26 +0000 Message-Id: <1515327285-8948-16-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace ugly ifdefs with some inline macros and Makefile magic for optionally including power management related code for better readability. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/Makefile | 3 ++- drivers/staging/ccree/ssi_pm.c | 9 +------- drivers/staging/ccree/ssi_pm.h | 39 +++++++++++++++++++++++++++------ drivers/staging/ccree/ssi_request_mgr.c | 18 ++------------- 4 files changed, 37 insertions(+), 32 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/Makefile b/drivers/staging/ccree/Makefile index bb47144..c107e25 100644 --- a/drivers/staging/ccree/Makefile +++ b/drivers/staging/ccree/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o -ccree-y := ssi_driver.o ssi_buffer_mgr.o ssi_request_mgr.o ssi_cipher.o ssi_hash.o ssi_aead.o ssi_ivgen.o ssi_sram_mgr.o ssi_pm.o +ccree-y := ssi_driver.o ssi_buffer_mgr.o ssi_request_mgr.o ssi_cipher.o ssi_hash.o ssi_aead.o ssi_ivgen.o ssi_sram_mgr.o ccree-$(CONFIG_CRYPTO_FIPS) += ssi_fips.o ccree-$(CONFIG_DEBUG_FS) += cc_debugfs.o +ccree-$(CONFIG_PM) += ssi_pm.o diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c index 3d9d00b..3a8d91c 100644 --- a/drivers/staging/ccree/ssi_pm.c +++ b/drivers/staging/ccree/ssi_pm.c @@ -14,8 +14,6 @@ #include "ssi_hash.h" #include "ssi_pm.h" -#if defined(CONFIG_PM) - #define POWER_DOWN_ENABLE 0x01 #define POWER_DOWN_DISABLE 0x00 @@ -103,12 +101,9 @@ int cc_pm_put_suspend(struct device *dev) return rc; } -#endif - int cc_pm_init(struct cc_drvdata *drvdata) { int rc = 0; -#if defined(CONFIG_PM) struct device *dev = drvdata_to_dev(drvdata); /* must be before the enabling to avoid resdundent suspending */ @@ -120,13 +115,11 @@ int cc_pm_init(struct cc_drvdata *drvdata) return rc; /* enable the PM module*/ pm_runtime_enable(dev); -#endif + return rc; } void cc_pm_fini(struct cc_drvdata *drvdata) { -#if defined(CONFIG_PM) pm_runtime_disable(drvdata_to_dev(drvdata)); -#endif } diff --git a/drivers/staging/ccree/ssi_pm.h b/drivers/staging/ccree/ssi_pm.h index 87bc389..f603255 100644 --- a/drivers/staging/ccree/ssi_pm.h +++ b/drivers/staging/ccree/ssi_pm.h @@ -11,21 +11,46 @@ #define CC_SUSPEND_TIMEOUT 3000 -int cc_pm_init(struct cc_drvdata *drvdata); - -void cc_pm_fini(struct cc_drvdata *drvdata); - #if defined(CONFIG_PM) extern const struct dev_pm_ops ccree_pm; +int cc_pm_init(struct cc_drvdata *drvdata); +void cc_pm_fini(struct cc_drvdata *drvdata); int cc_pm_suspend(struct device *dev); - int cc_pm_resume(struct device *dev); - int cc_pm_get(struct device *dev); - int cc_pm_put_suspend(struct device *dev); + +#else + +static inline int cc_pm_init(struct cc_drvdata *drvdata) +{ + return 0; +} + +static inline void cc_pm_fini(struct cc_drvdata *drvdata) {} + +static inline int cc_pm_suspend(struct device *dev) +{ + return 0; +} + +static inline int cc_pm_resume(struct device *dev) +{ + return 0; +} + +static inline int cc_pm_get(struct device *dev) +{ + return 0; +} + +static inline int cc_pm_put_suspend(struct device *dev) +{ + return 0; +} + #endif #endif /*__POWER_MGR_H__*/ diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index ff751d3..78f25e5 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -46,9 +46,7 @@ struct cc_req_mgr_handle { #else struct tasklet_struct comptask; #endif -#if defined(CONFIG_PM) bool is_runtime_suspended; -#endif }; struct cc_bl_item { @@ -404,9 +402,7 @@ static void cc_proc_backlog(struct cc_drvdata *drvdata) spin_unlock(&mgr->hw_lock); if (rc != -EINPROGRESS) { -#if defined(CONFIG_PM) cc_pm_put_suspend(dev); -#endif creq->user_cb(dev, req, rc); } @@ -432,13 +428,12 @@ int cc_send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, gfp_t flags = cc_gfp_flags(req); struct cc_bl_item *bli; -#if defined(CONFIG_PM) rc = cc_pm_get(dev); if (rc) { dev_err(dev, "ssi_power_mgr_runtime_get returned %x\n", rc); return rc; } -#endif + spin_lock_bh(&mgr->hw_lock); rc = cc_queues_status(drvdata, mgr, total_len); @@ -452,9 +447,7 @@ int cc_send_request(struct cc_drvdata *drvdata, struct cc_crypto_req *cc_req, bli = kmalloc(sizeof(*bli), flags); if (!bli) { -#if defined(CONFIG_PM) cc_pm_put_suspend(dev); -#endif return -ENOMEM; } @@ -486,13 +479,12 @@ int cc_send_sync_request(struct cc_drvdata *drvdata, cc_req->user_cb = request_mgr_complete; cc_req->user_arg = &cc_req->seq_compl; -#if defined(CONFIG_PM) rc = cc_pm_get(dev); if (rc) { dev_err(dev, "ssi_power_mgr_runtime_get returned %x\n", rc); return rc; } -#endif + while (true) { spin_lock_bh(&mgr->hw_lock); rc = cc_queues_status(drvdata, mgr, len + 1); @@ -502,9 +494,7 @@ int cc_send_sync_request(struct cc_drvdata *drvdata, spin_unlock_bh(&mgr->hw_lock); if (rc != -EAGAIN) { -#if defined(CONFIG_PM) cc_pm_put_suspend(dev); -#endif return rc; } wait_for_completion_interruptible(&drvdata->hw_queue_avail); @@ -515,9 +505,7 @@ int cc_send_sync_request(struct cc_drvdata *drvdata, spin_unlock_bh(&mgr->hw_lock); if (rc != -EINPROGRESS) { -#if defined(CONFIG_PM) cc_pm_put_suspend(dev); -#endif return rc; } @@ -621,9 +609,7 @@ static void proc_completions(struct cc_drvdata *drvdata) dev_dbg(dev, "Dequeue request tail=%u\n", *tail); dev_dbg(dev, "Request completed. axi_completed=%d\n", request_mgr_handle->axi_completed); -#if defined(CONFIG_PM) cc_pm_put_suspend(dev); -#endif } } From patchwork Sun Jan 7 12:14:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123660 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1548748qgn; Sun, 7 Jan 2018 04:18:24 -0800 (PST) X-Google-Smtp-Source: ACJfBovu/+l5nC+JaLZgeUnbwCryvwx7VexVQMh5wd6Jvxs7yCXQY8mP+OHzR5aR1hx90oNzwLgg X-Received: by 10.101.66.198 with SMTP id l6mr7084450pgp.148.1515327504651; Sun, 07 Jan 2018 04:18:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327504; cv=none; d=google.com; s=arc-20160816; b=hJE81kJYJ5zK1CMFiqKgmLNcHGlOD9nqS+sywqLK0oqnvRDYspiUCJ5krVff7fTvss hSQ566Ojz564Ld8X8C8YxCiRJ1XCs9OWD7AEisdxn01zLenMpN655+wKwTY3MUZt3T4V fcLxVBQ9uZ5j/x5gzhemUUJrhBZ+qK8T8w/GtX1/Agtr2LT22ZmxDO15n+21BH5LhiZS XnxdmadTPcHUobslgvjacEEZKNedTnTctYXOiRKoVr6vItKKnMM+j1Tu25EJz1Crg0o5 bzIJzeRCGJuUJOULTMqPExkmHxgIUF7bbZKYnTi1CZgGuxCh/nYXGvplQGBQtOUYKOoc aT5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=4IF5Zb4mQZJymn/guETYR1hsaTcQsGUwD4x6guP1RpE=; b=F0Ax1lCXL4MgDf2lsEd+yZFflZLTKssIkPM02UCQDt0DSmACdZCs/qVgx2T38tFQvP 5um/tuVq9Yh0EPV66l8lEx915nWkp9hEtGiD6q5nrrud64+t5oxuaJsBfOf+5Fi9dg8H zPj3xkSljgc0WSlYrYV5RF1arzBwXg74YHQLTuiVqMM2hdhONCj9X9G+776YYY/TM3V8 78dB/TKuUDpJs0nCQhMKfYq4sQRzxI1AbJEi9C5s68RZsCCGG+az5/O/pWZj+FgHt/cH lOsll0sEIubf3AI0HQwDNJiAEQZxA5MPe93oLM9+OvFYvbeo3NtH64IIU2aFZxh/MJ0o iVKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si6131666pgc.644.2018.01.07.04.18.24; Sun, 07 Jan 2018 04:18:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754066AbeAGMSW (ORCPT + 28 others); Sun, 7 Jan 2018 07:18:22 -0500 Received: from foss.arm.com ([217.140.101.70]:57552 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753791AbeAGMSU (ORCPT ); Sun, 7 Jan 2018 07:18:20 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F31181435; Sun, 7 Jan 2018 04:18:19 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2565E3F581; Sun, 7 Jan 2018 04:18:17 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 16/27] staging: ccree: remove unused field Date: Sun, 7 Jan 2018 12:14:27 +0000 Message-Id: <1515327285-8948-17-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove unused struct field. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 1 - 1 file changed, 1 deletion(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index ee7370c..efea792 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -23,7 +23,6 @@ struct cc_hash_handle { cc_sram_addr_t digest_len_sram_addr; /* const value in SRAM*/ cc_sram_addr_t larval_digest_sram_addr; /* const value in SRAM */ struct list_head hash_list; - struct completion init_comp; }; static const u32 digest_len_init[] = { From patchwork Sun Jan 7 12:14:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123661 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1548878qgn; Sun, 7 Jan 2018 04:18:33 -0800 (PST) X-Google-Smtp-Source: ACJfBotn50B2myvxav0KW9holcWPXcJVoGIdBRYSMA1+P7UXHsl95G60fHUme6Nb7kaqrEMYZZD+ X-Received: by 10.124.25.5 with SMTP id c5mr3764429plz.225.1515327513308; Sun, 07 Jan 2018 04:18:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327513; cv=none; d=google.com; s=arc-20160816; b=kAfi+KPm9lCVtxX62EdEuU7Z+HvqUm/LgxdJLC9xrYBu8hBGzCuDBqISW3cctx/lJK gqRQIItG9WAgJKLRHxBuYTrUnuPCxIPUsHxZoQV9yzE+kL1tkR3PTAsvf/haaY6Xv1w/ /bNI5q5cNcs5A9IJJvo9+57sXov6F0mqCnOTGjDybNnBhoThZAmxz8N3qjRqqQXVkLZ8 jXPMFZgxulxRF6dnRx+gb3nXrrdyPcvdoPVIkXdRinDyfsaR5/pOTgsPIBdANPCzL0Na WTI6MlcUxT1bpRe1hsuBzz91jVo9aM6L2ZNEXuR/1LWAZ/G3FqYb6y9x0QxFEIxNt0qb RNdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=M/5kQD/b51f9jVbxdvwJ2CPkhSBZiOehVJtzT5O4YGA=; b=jtNTRGdTTolnfmLENM+IqAyfM97sPbkuGDvZHhutRcrukZeVBUZR1lGD4SJcCfgpMJ EKqPRtFXLew8Ipr1Krt4aqPJGZU6zFaCQHUHDcB2n8LS7e3zCTx6Zo976mlac2Jm/+fx I9OJgYvYqr4U3NzHzGZNMw8f9gDBXDMsF0ZZTuU6ZRfxaicC7OWt7DfBfPE0qMrg0uYn EFPAM52SU1bvSgp/CY0vqwkt8sOmN/d6JBzRU5iVDTKBrPp/+MUrsx4dtAbUMC2lkdsw XRgjvWmOIdW2lPHWYDKjuZblPblM/UPz666AnI5xb8/wV53TpwXrKYMpD3EzJMcDlO/4 bDZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18si6911578pll.75.2018.01.07.04.18.33; Sun, 07 Jan 2018 04:18:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754077AbeAGMSb (ORCPT + 28 others); Sun, 7 Jan 2018 07:18:31 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57566 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753824AbeAGMSa (ORCPT ); Sun, 7 Jan 2018 07:18:30 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C5F091435; Sun, 7 Jan 2018 04:18:29 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ED9433F581; Sun, 7 Jan 2018 04:18:27 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 17/27] staging: ccree: use array for double buffer Date: Sun, 7 Jan 2018 12:14:28 +0000 Message-Id: <1515327285-8948-18-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ccree hash code is using a double buffer to hold data for processing but manages the buffers and their associated data count in two separate fields and uses a predicate to chose which to use. Move to using a proper 2 members array for a much cleaner code. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 21 +++++++------------- drivers/staging/ccree/ssi_hash.c | 36 ++++++++++++++++------------------ drivers/staging/ccree/ssi_hash.h | 26 ++++++++++++++++++++---- 3 files changed, 46 insertions(+), 37 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 0f71264..684070d 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -1391,10 +1391,8 @@ int cc_map_hash_request_final(struct cc_drvdata *drvdata, void *ctx, { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; struct device *dev = drvdata_to_dev(drvdata); - u8 *curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : - areq_ctx->buff0; - u32 *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : - &areq_ctx->buff0_cnt; + u8 *curr_buff = cc_hash_buf(areq_ctx); + u32 *curr_buff_cnt = cc_hash_buf_cnt(areq_ctx); struct mlli_params *mlli_params = &areq_ctx->mlli_params; struct buffer_array sg_data; struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle; @@ -1472,14 +1470,10 @@ int cc_map_hash_request_update(struct cc_drvdata *drvdata, void *ctx, { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; struct device *dev = drvdata_to_dev(drvdata); - u8 *curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 : - areq_ctx->buff0; - u32 *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt : - &areq_ctx->buff0_cnt; - u8 *next_buff = areq_ctx->buff_index ? areq_ctx->buff0 : - areq_ctx->buff1; - u32 *next_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : - &areq_ctx->buff1_cnt; + u8 *curr_buff = cc_hash_buf(areq_ctx); + u32 *curr_buff_cnt = cc_hash_buf_cnt(areq_ctx); + u8 *next_buff = cc_next_buf(areq_ctx); + u32 *next_buff_cnt = cc_next_buf_cnt(areq_ctx); struct mlli_params *mlli_params = &areq_ctx->mlli_params; unsigned int update_data_len; u32 total_in_len = nbytes + *curr_buff_cnt; @@ -1585,8 +1579,7 @@ void cc_unmap_hash_request(struct device *dev, void *ctx, struct scatterlist *src, bool do_revert) { struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx; - u32 *prev_len = areq_ctx->buff_index ? &areq_ctx->buff0_cnt : - &areq_ctx->buff1_cnt; + u32 *prev_len = cc_next_buf_cnt(areq_ctx); /*In case a pool was set, a table was *allocated and should be released diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index efea792..5ea095a 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -129,12 +129,12 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, bool is_hmac = ctx->is_hmac; int rc = -ENOMEM; - state->buff0 = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); - if (!state->buff0) + state->buffers[0] = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); + if (!state->buffers[0]) goto fail0; - state->buff1 = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); - if (!state->buff1) + state->buffers[1] = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); + if (!state->buffers[1]) goto fail_buff0; state->digest_result_buff = kzalloc(CC_MAX_HASH_DIGEST_SIZE, flags); @@ -252,8 +252,8 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, } else { state->opad_digest_dma_addr = 0; } - state->buff0_cnt = 0; - state->buff1_cnt = 0; + state->buf_cnt[0] = 0; + state->buf_cnt[1] = 0; state->buff_index = 0; state->mlli_params.curr_pool = NULL; @@ -281,11 +281,11 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, kfree(state->digest_result_buff); state->digest_result_buff = NULL; fail_buff1: - kfree(state->buff1); - state->buff1 = NULL; + kfree(state->buffers[1]); + state->buffers[1] = NULL; fail_buff0: - kfree(state->buff0); - state->buff0 = NULL; + kfree(state->buffers[0]); + state->buffers[0] = NULL; fail0: return rc; } @@ -319,8 +319,8 @@ static void cc_unmap_req(struct device *dev, struct ahash_req_ctx *state, kfree(state->digest_bytes_len); kfree(state->digest_buff); kfree(state->digest_result_buff); - kfree(state->buff1); - kfree(state->buff0); + kfree(state->buffers[1]); + kfree(state->buffers[0]); } static void cc_unmap_result(struct device *dev, struct ahash_req_ctx *state, @@ -1375,8 +1375,7 @@ static int cc_mac_final(struct ahash_request *req) u32 key_size, key_len; u32 digestsize = crypto_ahash_digestsize(tfm); gfp_t flags = cc_gfp_flags(&req->base); - u32 rem_cnt = state->buff_index ? state->buff1_cnt : - state->buff0_cnt; + u32 rem_cnt = *cc_hash_buf_cnt(state); if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) { key_size = CC_AES_128_BIT_KEY_SIZE; @@ -1630,9 +1629,8 @@ static int cc_hash_export(struct ahash_request *req, void *out) struct cc_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct device *dev = drvdata_to_dev(ctx->drvdata); struct ahash_req_ctx *state = ahash_request_ctx(req); - u8 *curr_buff = state->buff_index ? state->buff1 : state->buff0; - u32 curr_buff_cnt = state->buff_index ? state->buff1_cnt : - state->buff0_cnt; + u8 *curr_buff = cc_hash_buf(state); + u32 curr_buff_cnt = *cc_hash_buf_cnt(state); const u32 tmp = CC_EXPORT_MAGIC; memcpy(out, &tmp, sizeof(u32)); @@ -1715,8 +1713,8 @@ static int cc_hash_import(struct ahash_request *req, const void *in) } in += sizeof(u32); - state->buff0_cnt = tmp; - memcpy(state->buff0, in, state->buff0_cnt); + state->buf_cnt[0] = tmp; + memcpy(state->buffers[0], in, tmp); out: return rc; diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index f78faae..ca84428 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -39,8 +39,7 @@ struct aeshash_state { /* ahash state */ struct ahash_req_ctx { - u8 *buff0; - u8 *buff1; + u8 *buffers[2]; u8 *digest_result_buff; struct async_gen_req_ctx gen_ctx; enum cc_req_dma_buf_type data_dma_buf_type; @@ -51,8 +50,7 @@ struct ahash_req_ctx { dma_addr_t digest_buff_dma_addr; dma_addr_t digest_bytes_len_dma_addr; dma_addr_t digest_result_dma_addr; - u32 buff0_cnt; - u32 buff1_cnt; + u32 buf_cnt[2]; u32 buff_index; u32 xcbc_count; /* count xcbc update operatations */ struct scatterlist buff_sg[2]; @@ -62,6 +60,26 @@ struct ahash_req_ctx { struct mlli_params mlli_params; }; +static inline u32 *cc_hash_buf_cnt(struct ahash_req_ctx *state) +{ + return &state->buf_cnt[state->buff_index]; +} + +static inline u8 *cc_hash_buf(struct ahash_req_ctx *state) +{ + return state->buffers[state->buff_index]; +} + +static inline u32 *cc_next_buf_cnt(struct ahash_req_ctx *state) +{ + return &state->buf_cnt[state->buff_index ^ 1]; +} + +static inline u8 *cc_next_buf(struct ahash_req_ctx *state) +{ + return state->buffers[state->buff_index ^ 1]; +} + int cc_hash_alloc(struct cc_drvdata *drvdata); int cc_init_hash_sram(struct cc_drvdata *drvdata); int cc_hash_free(struct cc_drvdata *drvdata); From patchwork Sun Jan 7 12:14:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123662 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1549036qgn; Sun, 7 Jan 2018 04:18:44 -0800 (PST) X-Google-Smtp-Source: ACJfBouE1yAGfNXEwjcVON9wnONRgyh9Aryz+0g5cwU2oOOfTUfPqb3gqW7Rr87Xg8WmORQA1Gse X-Received: by 10.84.128.78 with SMTP id 72mr8893579pla.423.1515327524692; Sun, 07 Jan 2018 04:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327524; cv=none; d=google.com; s=arc-20160816; b=oG/RJfItSmIfNaiW2ym5/juL85ZgZMP/Sfo6Bibh8g4jiybLAigOVoBQRZTovjfXS+ +1NA+GG0rQbZdcYWl5LOLJl5OxTK31Byo7rss22cgzh5lLatnLjkcUORyRsdOEmeKAnP /eGLskRJQ76djNiKc3EKHINNnmiNDvIZ4/XHVbbh6CghXVgJsxqqbH8tDUwzD8fPNGeC qGNRcHIvReNGaSzCE2LuopPV5FFgI7dbJv3yfVAJYr03Yq9sKNW44YknK80w5nepdaK7 pHSgaQBRVMBo1eBGxuGlfIC8vFz921gsboFcMPve7MVvK73o7CwdBGEd7zM3Z+QAKPKw h9FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=gKbIkPFjbaAdMcfZOT/3RIzjT+WdB9h9ZB2uCNsYjWI=; b=bIhJX7zzK+RCg3sGFdjw+we2NBvmuxbF27ZUR2R8fn8Iq7EXLvrhEu+QhNy9gF8yaD i4iug8t4r5Trzji9sata0x6tj/GD/Vb9zKoWIySZpYGQTzfdjtZJujFGWkGKmR8BnUrj i0V25CB8k8xWMARsmAoSJ1Xe3uXmk/AR+pCMOy1zUuSxkNyoMnxcPwi2FtpgR7UIdhRF Sb4NrE0U7Ffb0AhztA8xykflSqFmWuhoU6WDpWXqANu66kh/stnGGaIQCIFtGdNKDvHc loDB1kSEGXWmujS0sX9iIxDa+WzuMAWwUvHTMz0RQ+qMkXx7wjg+1mAPM2K6+wZbeYOP GYkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s22si7049649plk.361.2018.01.07.04.18.44; Sun, 07 Jan 2018 04:18:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754083AbeAGMSm (ORCPT + 28 others); Sun, 7 Jan 2018 07:18:42 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57576 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753849AbeAGMSk (ORCPT ); Sun, 7 Jan 2018 07:18:40 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42D5C1435; Sun, 7 Jan 2018 04:18:40 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 681FE3F581; Sun, 7 Jan 2018 04:18:38 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 18/27] staging: ccree: allocate hash bufs inside req ctx Date: Sun, 7 Jan 2018 12:14:29 +0000 Message-Id: <1515327285-8948-19-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move to allocating the buffers needed for requests as part of the request structure instead of malloc'ing each one on it's own, making for simpler (and more efficient) code. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 68 ++++------------------------------------ drivers/staging/ccree/ssi_hash.h | 12 +++---- 2 files changed, 12 insertions(+), 68 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 5ea095a..b557db2 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -108,7 +108,7 @@ static int cc_map_result(struct device *dev, struct ahash_req_ctx *state, unsigned int digestsize) { state->digest_result_dma_addr = - dma_map_single(dev, (void *)state->digest_result_buff, + dma_map_single(dev, state->digest_result_buff, digestsize, DMA_BIDIRECTIONAL); if (dma_mapping_error(dev, state->digest_result_dma_addr)) { @@ -129,49 +129,15 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, bool is_hmac = ctx->is_hmac; int rc = -ENOMEM; - state->buffers[0] = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); - if (!state->buffers[0]) - goto fail0; - - state->buffers[1] = kzalloc(CC_MAX_HASH_BLCK_SIZE, flags); - if (!state->buffers[1]) - goto fail_buff0; - - state->digest_result_buff = kzalloc(CC_MAX_HASH_DIGEST_SIZE, flags); - if (!state->digest_result_buff) - goto fail_buff1; - - state->digest_buff = kzalloc(ctx->inter_digestsize, flags); - if (!state->digest_buff) - goto fail_digest_result_buff; - - dev_dbg(dev, "Allocated digest-buffer in context ctx->digest_buff=@%p\n", - state->digest_buff); - if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) { - state->digest_bytes_len = kzalloc(HASH_LEN_SIZE, flags); - if (!state->digest_bytes_len) - goto fail1; - - dev_dbg(dev, "Allocated digest-bytes-len in context state->>digest_bytes_len=@%p\n", - state->digest_bytes_len); - } else { - state->digest_bytes_len = NULL; - } - - state->opad_digest_buff = kzalloc(ctx->inter_digestsize, flags); - if (!state->opad_digest_buff) - goto fail2; - - dev_dbg(dev, "Allocated opad-digest-buffer in context state->digest_bytes_len=@%p\n", - state->opad_digest_buff); + memset(state, 0, sizeof(*state)); state->digest_buff_dma_addr = - dma_map_single(dev, (void *)state->digest_buff, + dma_map_single(dev, state->digest_buff, ctx->inter_digestsize, DMA_BIDIRECTIONAL); if (dma_mapping_error(dev, state->digest_buff_dma_addr)) { dev_err(dev, "Mapping digest len %d B at va=%pK for DMA failed\n", ctx->inter_digestsize, state->digest_buff); - goto fail3; + goto fail0; } dev_dbg(dev, "Mapped digest %d B at va=%pK to dma=%pad\n", ctx->inter_digestsize, state->digest_buff, @@ -221,7 +187,7 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) { state->digest_bytes_len_dma_addr = - dma_map_single(dev, (void *)state->digest_bytes_len, + dma_map_single(dev, state->digest_bytes_len, HASH_LEN_SIZE, DMA_BIDIRECTIONAL); if (dma_mapping_error(dev, state->digest_bytes_len_dma_addr)) { dev_err(dev, "Mapping digest len %u B at va=%pK for DMA failed\n", @@ -237,7 +203,7 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, if (is_hmac && ctx->hash_mode != DRV_HASH_NULL) { state->opad_digest_dma_addr = - dma_map_single(dev, (void *)state->opad_digest_buff, + dma_map_single(dev, state->opad_digest_buff, ctx->inter_digestsize, DMA_BIDIRECTIONAL); if (dma_mapping_error(dev, state->opad_digest_dma_addr)) { @@ -271,21 +237,6 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, ctx->inter_digestsize, DMA_BIDIRECTIONAL); state->digest_buff_dma_addr = 0; } -fail3: - kfree(state->opad_digest_buff); -fail2: - kfree(state->digest_bytes_len); -fail1: - kfree(state->digest_buff); -fail_digest_result_buff: - kfree(state->digest_result_buff); - state->digest_result_buff = NULL; -fail_buff1: - kfree(state->buffers[1]); - state->buffers[1] = NULL; -fail_buff0: - kfree(state->buffers[0]); - state->buffers[0] = NULL; fail0: return rc; } @@ -314,13 +265,6 @@ static void cc_unmap_req(struct device *dev, struct ahash_req_ctx *state, &state->opad_digest_dma_addr); state->opad_digest_dma_addr = 0; } - - kfree(state->opad_digest_buff); - kfree(state->digest_bytes_len); - kfree(state->digest_buff); - kfree(state->digest_result_buff); - kfree(state->buffers[1]); - kfree(state->buffers[0]); } static void cc_unmap_result(struct device *dev, struct ahash_req_ctx *state, diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h index ca84428..e45bb69 100644 --- a/drivers/staging/ccree/ssi_hash.h +++ b/drivers/staging/ccree/ssi_hash.h @@ -39,13 +39,13 @@ struct aeshash_state { /* ahash state */ struct ahash_req_ctx { - u8 *buffers[2]; - u8 *digest_result_buff; - struct async_gen_req_ctx gen_ctx; + u8 buffers[2][CC_MAX_HASH_BLCK_SIZE] ____cacheline_aligned; + u8 digest_result_buff[CC_MAX_HASH_DIGEST_SIZE] ____cacheline_aligned; + u8 digest_buff[CC_MAX_HASH_DIGEST_SIZE] ____cacheline_aligned; + u8 opad_digest_buff[CC_MAX_HASH_DIGEST_SIZE] ____cacheline_aligned; + u8 digest_bytes_len[HASH_LEN_SIZE] ____cacheline_aligned; + struct async_gen_req_ctx gen_ctx ____cacheline_aligned; enum cc_req_dma_buf_type data_dma_buf_type; - u8 *digest_buff; - u8 *opad_digest_buff; - u8 *digest_bytes_len; dma_addr_t opad_digest_dma_addr; dma_addr_t digest_buff_dma_addr; dma_addr_t digest_bytes_len_dma_addr; From patchwork Sun Jan 7 12:14:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123663 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1549146qgn; Sun, 7 Jan 2018 04:18:54 -0800 (PST) X-Google-Smtp-Source: ACJfBotDXQtmYfLSDpR8rb63ISg504aNpDypXPEne2nOdrTnzSRLUAuw6TfkSew7ZRUqkxkfIElu X-Received: by 10.98.202.150 with SMTP id y22mr8054030pfk.174.1515327534591; Sun, 07 Jan 2018 04:18:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327534; cv=none; d=google.com; s=arc-20160816; b=0TaoyO4LYDLjv9C46E2E1LY+jMAkmjgJ3iPNLjL40NDtT8irXtdwg2wOTXRr2vqhJf RhlVb0eZNPM7XKh998FkvcuBXA1wyDkKOcyk6yBAasMsPBiVjcZ9g/3qxW5EQ/N+6vI1 i7dTbQMxFyL8THbrel2pvxAmxLjl5uBlbwtHKT9LqetiYZzq17kk3F88QyCusg9lsIf8 tUoNIWEGxPnnOm/4xoMvulG3SFHwLV0BucChOb9m6DnAC1lBIzWEQRAAORbypd/PZL+E /+uHFlR9aA2Z4Wc832gqmr8glnwpsgLX1nRAHgbPSvGIu0j+HmZaw6HiiUwFhfLtj6Uw DpRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JYnetYTC4h85KFV+jZ/PGZqPabQVdkyyOwuRaHWYsVg=; b=xYAhHT2RUt+c1VUi/97IbupNFC+XU5JAKLBMZouii5FptgKzPM/YaussJI9SR68hrV ZbSogPw+NlCO3PpFa8BWqj75HmYfAJtEmTCyruK3tR3G5LzobjTpwPhTRTrBVl7WKRbx HJCS5m2zgkZ/JaSKu/JPG3b8trb/FnXK9estODJ9wkFvMYAPY2yd7Zke3b2mmQappb3d N9FpEyHCwjAjFgl0OKLOAzP4cc78vk62yYHfeDJg402gyWxWQ8qKigwBgpeWFQvjLyda HA+3y+7H5VbmsAMWM79tbU0PJagXyKDDSc8Nncsr+p/OMZIF7dBRwQg8+B7eGyd1Q6Xy lzJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t191si3176505pgd.227.2018.01.07.04.18.54; Sun, 07 Jan 2018 04:18:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754093AbeAGMSw (ORCPT + 28 others); Sun, 7 Jan 2018 07:18:52 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57586 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753912AbeAGMSu (ORCPT ); Sun, 7 Jan 2018 07:18:50 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E510D1435; Sun, 7 Jan 2018 04:18:49 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 170CD3F581; Sun, 7 Jan 2018 04:18:47 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 19/27] staging: ccree: do not map bufs in ahash_init Date: Sun, 7 Jan 2018 12:14:30 +0000 Message-Id: <1515327285-8948-20-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hash_init was mapping DMA memory that were then being unmap in hash_digest/final/finup callbacks, which is against the Crypto API usage rules (see discussion at https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg30077.html) Fix it by moving all buffer mapping/unmapping or each Crypto API op. This also properly deals with hash_import() not knowing if hash_init was called or not as it now no longer matters. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 192 +++++++++++++++++++++------------------ 1 file changed, 103 insertions(+), 89 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index b557db2..1cc3fae 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -123,34 +123,20 @@ static int cc_map_result(struct device *dev, struct ahash_req_ctx *state, return 0; } -static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, - struct cc_hash_ctx *ctx, gfp_t flags) +static void cc_init_req(struct device *dev, struct ahash_req_ctx *state, + struct cc_hash_ctx *ctx) { bool is_hmac = ctx->is_hmac; - int rc = -ENOMEM; memset(state, 0, sizeof(*state)); - state->digest_buff_dma_addr = - dma_map_single(dev, state->digest_buff, - ctx->inter_digestsize, DMA_BIDIRECTIONAL); - if (dma_mapping_error(dev, state->digest_buff_dma_addr)) { - dev_err(dev, "Mapping digest len %d B at va=%pK for DMA failed\n", - ctx->inter_digestsize, state->digest_buff); - goto fail0; - } - dev_dbg(dev, "Mapped digest %d B at va=%pK to dma=%pad\n", - ctx->inter_digestsize, state->digest_buff, - &state->digest_buff_dma_addr); - if (is_hmac) { - dma_sync_single_for_cpu(dev, ctx->digest_buff_dma_addr, - ctx->inter_digestsize, - DMA_BIDIRECTIONAL); - if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC || - ctx->hw_mode == DRV_CIPHER_CMAC) { - memset(state->digest_buff, 0, ctx->inter_digestsize); - } else { /*sha*/ + if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC && + ctx->hw_mode != DRV_CIPHER_CMAC) { + dma_sync_single_for_cpu(dev, ctx->digest_buff_dma_addr, + ctx->inter_digestsize, + DMA_BIDIRECTIONAL); + memcpy(state->digest_buff, ctx->digest_buff, ctx->inter_digestsize); #if (CC_DEV_SHA_MAX > 256) @@ -181,9 +167,24 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, memcpy(state->digest_buff, larval, ctx->inter_digestsize); } +} - dma_sync_single_for_device(dev, state->digest_buff_dma_addr, - ctx->inter_digestsize, DMA_BIDIRECTIONAL); +static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, + struct cc_hash_ctx *ctx) +{ + bool is_hmac = ctx->is_hmac; + + state->digest_buff_dma_addr = + dma_map_single(dev, state->digest_buff, + ctx->inter_digestsize, DMA_BIDIRECTIONAL); + if (dma_mapping_error(dev, state->digest_buff_dma_addr)) { + dev_err(dev, "Mapping digest len %d B at va=%pK for DMA failed\n", + ctx->inter_digestsize, state->digest_buff); + return -EINVAL; + } + dev_dbg(dev, "Mapped digest %d B at va=%pK to dma=%pad\n", + ctx->inter_digestsize, state->digest_buff, + &state->digest_buff_dma_addr); if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) { state->digest_bytes_len_dma_addr = @@ -192,13 +193,11 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, if (dma_mapping_error(dev, state->digest_bytes_len_dma_addr)) { dev_err(dev, "Mapping digest len %u B at va=%pK for DMA failed\n", HASH_LEN_SIZE, state->digest_bytes_len); - goto fail4; + goto unmap_digest_buf; } dev_dbg(dev, "Mapped digest len %u B at va=%pK to dma=%pad\n", HASH_LEN_SIZE, state->digest_bytes_len, &state->digest_bytes_len_dma_addr); - } else { - state->digest_bytes_len_dma_addr = 0; } if (is_hmac && ctx->hash_mode != DRV_HASH_NULL) { @@ -210,35 +209,29 @@ static int cc_map_req(struct device *dev, struct ahash_req_ctx *state, dev_err(dev, "Mapping opad digest %d B at va=%pK for DMA failed\n", ctx->inter_digestsize, state->opad_digest_buff); - goto fail5; + goto unmap_digest_len; } dev_dbg(dev, "Mapped opad digest %d B at va=%pK to dma=%pad\n", ctx->inter_digestsize, state->opad_digest_buff, &state->opad_digest_dma_addr); - } else { - state->opad_digest_dma_addr = 0; } - state->buf_cnt[0] = 0; - state->buf_cnt[1] = 0; - state->buff_index = 0; - state->mlli_params.curr_pool = NULL; return 0; -fail5: +unmap_digest_len: if (state->digest_bytes_len_dma_addr) { dma_unmap_single(dev, state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, DMA_BIDIRECTIONAL); state->digest_bytes_len_dma_addr = 0; } -fail4: +unmap_digest_buf: if (state->digest_buff_dma_addr) { dma_unmap_single(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); state->digest_buff_dma_addr = 0; } -fail0: - return rc; + + return -EINVAL; } static void cc_unmap_req(struct device *dev, struct ahash_req_ctx *state, @@ -289,10 +282,13 @@ static void cc_update_complete(struct device *dev, void *cc_req, int err) { struct ahash_request *req = (struct ahash_request *)cc_req; struct ahash_req_ctx *state = ahash_request_ctx(req); + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); + struct cc_hash_ctx *ctx = crypto_ahash_ctx(tfm); dev_dbg(dev, "req=%pK\n", req); cc_unmap_hash_request(dev, state, req->src, false); + cc_unmap_req(dev, state, ctx); req->base.complete(&req->base, err); } @@ -350,19 +346,24 @@ static int cc_hash_digest(struct ahash_request *req) dev_dbg(dev, "===== %s-digest (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); - if (cc_map_req(dev, state, ctx, flags)) { + cc_init_req(dev, state, ctx); + + if (cc_map_req(dev, state, ctx)) { dev_err(dev, "map_ahash_source() failed\n"); return -ENOMEM; } if (cc_map_result(dev, state, digestsize)) { dev_err(dev, "map_ahash_digest() failed\n"); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); + cc_unmap_result(dev, state, digestsize, result); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } @@ -521,6 +522,12 @@ static int cc_hash_update(struct ahash_request *req) return -ENOMEM; } + if (cc_map_req(dev, state, ctx)) { + dev_err(dev, "map_ahash_source() failed\n"); + cc_unmap_hash_request(dev, state, src, true); + return -EINVAL; + } + /* Setup DX request structure */ cc_req.user_cb = cc_update_complete; cc_req.user_arg = req; @@ -567,6 +574,7 @@ static int cc_hash_update(struct ahash_request *req) if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); + cc_unmap_req(dev, state, ctx); } return rc; } @@ -591,13 +599,21 @@ static int cc_hash_finup(struct ahash_request *req) dev_dbg(dev, "===== %s-finup (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); + if (cc_map_req(dev, state, ctx)) { + dev_err(dev, "map_ahash_source() failed\n"); + return -EINVAL; + } + if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } if (cc_map_result(dev, state, digestsize)) { dev_err(dev, "map_ahash_digest() failed\n"); + cc_unmap_hash_request(dev, state, src, true); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } @@ -689,6 +705,7 @@ static int cc_hash_finup(struct ahash_request *req) dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); cc_unmap_result(dev, state, digestsize, result); + cc_unmap_req(dev, state, ctx); } return rc; } @@ -713,14 +730,22 @@ static int cc_hash_final(struct ahash_request *req) dev_dbg(dev, "===== %s-final (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes); + if (cc_map_req(dev, state, ctx)) { + dev_err(dev, "map_ahash_source() failed\n"); + return -EINVAL; + } + if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 0, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } if (cc_map_result(dev, state, digestsize)) { dev_err(dev, "map_ahash_digest() failed\n"); + cc_unmap_hash_request(dev, state, src, true); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } @@ -821,6 +846,7 @@ static int cc_hash_final(struct ahash_request *req) dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, src, true); cc_unmap_result(dev, state, digestsize, result); + cc_unmap_req(dev, state, ctx); } return rc; } @@ -831,12 +857,10 @@ static int cc_hash_init(struct ahash_request *req) struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct cc_hash_ctx *ctx = crypto_ahash_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); - gfp_t flags = cc_gfp_flags(&req->base); dev_dbg(dev, "===== init (%d) ====\n", req->nbytes); - state->xcbc_count = 0; - cc_map_req(dev, state, ctx, flags); + cc_init_req(dev, state, ctx); return 0; } @@ -1277,6 +1301,11 @@ static int cc_mac_update(struct ahash_request *req) return -ENOMEM; } + if (cc_map_req(dev, state, ctx)) { + dev_err(dev, "map_ahash_source() failed\n"); + return -EINVAL; + } + if (ctx->hw_mode == DRV_CIPHER_XCBC_MAC) cc_setup_xcbc(req, desc, &idx); else @@ -1302,6 +1331,7 @@ static int cc_mac_update(struct ahash_request *req) if (rc != -EINPROGRESS && rc != -EBUSY) { dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); + cc_unmap_req(dev, state, ctx); } return rc; } @@ -1332,14 +1362,22 @@ static int cc_mac_final(struct ahash_request *req) dev_dbg(dev, "===== final xcbc reminder (%d) ====\n", rem_cnt); + if (cc_map_req(dev, state, ctx)) { + dev_err(dev, "map_ahash_source() failed\n"); + return -EINVAL; + } + if (cc_map_hash_request_final(ctx->drvdata, state, req->src, req->nbytes, 0, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } if (cc_map_result(dev, state, digestsize)) { dev_err(dev, "map_ahash_digest() failed\n"); + cc_unmap_hash_request(dev, state, req->src, true); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } @@ -1415,6 +1453,7 @@ static int cc_mac_final(struct ahash_request *req) dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); cc_unmap_result(dev, state, digestsize, req->result); + cc_unmap_req(dev, state, ctx); } return rc; } @@ -1439,13 +1478,21 @@ static int cc_mac_finup(struct ahash_request *req) return cc_mac_final(req); } + if (cc_map_req(dev, state, ctx)) { + dev_err(dev, "map_ahash_source() failed\n"); + return -EINVAL; + } + if (cc_map_hash_request_final(ctx->drvdata, state, req->src, req->nbytes, 1, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } if (cc_map_result(dev, state, digestsize)) { dev_err(dev, "map_ahash_digest() failed\n"); + cc_unmap_hash_request(dev, state, req->src, true); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } @@ -1488,6 +1535,7 @@ static int cc_mac_finup(struct ahash_request *req) dev_err(dev, "send_request() failed (rc=%d)\n", rc); cc_unmap_hash_request(dev, state, req->src, true); cc_unmap_result(dev, state, digestsize, req->result); + cc_unmap_req(dev, state, ctx); } return rc; } @@ -1508,18 +1556,22 @@ static int cc_mac_digest(struct ahash_request *req) dev_dbg(dev, "===== -digest mac (%d) ====\n", req->nbytes); - if (cc_map_req(dev, state, ctx, flags)) { + cc_init_req(dev, state, ctx); + + if (cc_map_req(dev, state, ctx)) { dev_err(dev, "map_ahash_source() failed\n"); return -ENOMEM; } if (cc_map_result(dev, state, digestsize)) { dev_err(dev, "map_ahash_digest() failed\n"); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } if (cc_map_hash_request_final(ctx->drvdata, state, req->src, req->nbytes, 1, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); + cc_unmap_req(dev, state, ctx); return -ENOMEM; } @@ -1571,7 +1623,6 @@ static int cc_hash_export(struct ahash_request *req, void *out) { struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); struct cc_hash_ctx *ctx = crypto_ahash_ctx(ahash); - struct device *dev = drvdata_to_dev(ctx->drvdata); struct ahash_req_ctx *state = ahash_request_ctx(req); u8 *curr_buff = cc_hash_buf(state); u32 curr_buff_cnt = *cc_hash_buf_cnt(state); @@ -1580,19 +1631,10 @@ static int cc_hash_export(struct ahash_request *req, void *out) memcpy(out, &tmp, sizeof(u32)); out += sizeof(u32); - dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr, - ctx->inter_digestsize, DMA_BIDIRECTIONAL); memcpy(out, state->digest_buff, ctx->inter_digestsize); out += ctx->inter_digestsize; - if (state->digest_bytes_len_dma_addr) { - dma_sync_single_for_cpu(dev, state->digest_bytes_len_dma_addr, - HASH_LEN_SIZE, DMA_BIDIRECTIONAL); - memcpy(out, state->digest_bytes_len, HASH_LEN_SIZE); - } else { - /* Poison the unused exported digest len field. */ - memset(out, 0x5F, HASH_LEN_SIZE); - } + memcpy(out, state->digest_bytes_len, HASH_LEN_SIZE); out += HASH_LEN_SIZE; memcpy(out, &curr_buff_cnt, sizeof(u32)); @@ -1600,10 +1642,6 @@ static int cc_hash_export(struct ahash_request *req, void *out) memcpy(out, curr_buff, curr_buff_cnt); - /* No sync for device ineeded since we did not change the data, - * we only copy it - */ - return 0; } @@ -1614,54 +1652,30 @@ static int cc_hash_import(struct ahash_request *req, const void *in) struct device *dev = drvdata_to_dev(ctx->drvdata); struct ahash_req_ctx *state = ahash_request_ctx(req); u32 tmp; - int rc; memcpy(&tmp, in, sizeof(u32)); - if (tmp != CC_EXPORT_MAGIC) { - rc = -EINVAL; - goto out; - } + if (tmp != CC_EXPORT_MAGIC) + return -EINVAL; in += sizeof(u32); - rc = cc_hash_init(req); - if (rc) - goto out; + cc_init_req(dev, state, ctx); - dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr, - ctx->inter_digestsize, DMA_BIDIRECTIONAL); memcpy(state->digest_buff, in, ctx->inter_digestsize); in += ctx->inter_digestsize; - if (state->digest_bytes_len_dma_addr) { - dma_sync_single_for_cpu(dev, state->digest_bytes_len_dma_addr, - HASH_LEN_SIZE, DMA_BIDIRECTIONAL); - memcpy(state->digest_bytes_len, in, HASH_LEN_SIZE); - } + memcpy(state->digest_bytes_len, in, HASH_LEN_SIZE); in += HASH_LEN_SIZE; - dma_sync_single_for_device(dev, state->digest_buff_dma_addr, - ctx->inter_digestsize, DMA_BIDIRECTIONAL); - - if (state->digest_bytes_len_dma_addr) - dma_sync_single_for_device(dev, - state->digest_bytes_len_dma_addr, - HASH_LEN_SIZE, DMA_BIDIRECTIONAL); - - state->buff_index = 0; - /* Sanity check the data as much as possible */ memcpy(&tmp, in, sizeof(u32)); - if (tmp > CC_MAX_HASH_BLCK_SIZE) { - rc = -EINVAL; - goto out; - } + if (tmp > CC_MAX_HASH_BLCK_SIZE) + return -EINVAL; in += sizeof(u32); state->buf_cnt[0] = tmp; memcpy(state->buffers[0], in, tmp); -out: - return rc; + return 0; } struct cc_hash_template { From patchwork Sun Jan 7 12:14:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123665 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1549410qgn; Sun, 7 Jan 2018 04:19:14 -0800 (PST) X-Google-Smtp-Source: ACJfBou7iJC9ThPRu93qvqSoWnWn3gqMTL6O5Mo3y1WLK0gW6qxo7Uxbing6QADy4wFedbiIn17D X-Received: by 10.99.175.76 with SMTP id s12mr7096821pgo.328.1515327554071; Sun, 07 Jan 2018 04:19:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327554; cv=none; d=google.com; s=arc-20160816; b=Ik+YBGbqRnWm2AJ9yxMimX/GXmIhXAiqFPrA7jIRFa0Hz1LIs6DAMVPP4S6WP5cvcU tumv9h4GykW157UdIIhZE6u/FzwuxGP+erehk2+7X5EAoCf1DFgXgDUAb50hykiYLRvz ueUGgzw0jri34E+CeToidx7qn3KZMTmhpcKMJdJsSbqMKk33FJVjFw101GzilYeSYY1/ 6wnsrbIuBk2fQ4zQiBfoWkIvPRYX87JyRBEZRAS3IwZhYlaP6w1ooWwknFhsrW4uWVaN l5QYARuAf8p0tEU2xlKwldEiwivvgbL19om/ek0kxK+ZiUvHWqUg4oszpCzcDtoXH1uw v/qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=yS2v+mI1EwOfCcU4JOZfXDKOI2rT2y0xC9wSupJegk8=; b=mbBFtl2zOcfVcXBNvE8+goBnG55oM27OkZPuwtFU8mPA8w7YVyCSTd4KD7LSVsZQxH up1qh7z6nYl2vl6kNScx57rs8fE779K7RlSbT//jR9ewF4bOXC6nKVdHpKwt+xiH5Hae J1aZB8TYUO7Aklds0is9q51hqNgAWkQfNcLtUPReFDjs7f+cEMXzUCbFCOkr+Tpy+/+d UHSiCBT7pjzLHzB8mjU4qUt7F/6/fAfrsR+1+aoWfeEoU18HRpgKMVxVQBV88MR9UIko yQ9rYPwi5obTlYkrxBmmoDM4uLlQi4jYhpn88No29jsl3X+P08MK4W/MJfBlZCGqlTNs gwfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si6139336pgr.226.2018.01.07.04.19.13; Sun, 07 Jan 2018 04:19:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754111AbeAGMTM (ORCPT + 28 others); Sun, 7 Jan 2018 07:19:12 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57606 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753806AbeAGMTK (ORCPT ); Sun, 7 Jan 2018 07:19:10 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0831A1435; Sun, 7 Jan 2018 04:19:10 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2F28C3F581; Sun, 7 Jan 2018 04:19:07 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 21/27] staging: ccree: fold common code into service func Date: Sun, 7 Jan 2018 12:14:32 +0000 Message-Id: <1515327285-8948-22-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fold common code in hash call into service functions. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 339 ++++++++++++++------------------------- 1 file changed, 116 insertions(+), 223 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index c04b335..57031c7 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -319,6 +319,84 @@ static void cc_hash_complete(struct device *dev, void *cc_req, int err) req->base.complete(&req->base, err); } +static int cc_fin_result(struct cc_hw_desc *desc, struct ahash_request *req, + int idx) +{ + struct ahash_req_ctx *state = ahash_request_ctx(req); + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); + struct cc_hash_ctx *ctx = crypto_ahash_ctx(tfm); + u32 digestsize = crypto_ahash_digestsize(tfm); + + /* Get final MAC result */ + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + /* TODO */ + set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, + NS_BIT, 1); + set_queue_last_ind(&desc[idx]); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); + cc_set_endianity(ctx->hash_mode, &desc[idx]); + idx++; + + return idx; +} + +static int cc_fin_hmac(struct cc_hw_desc *desc, struct ahash_request *req, + int idx) +{ + struct ahash_req_ctx *state = ahash_request_ctx(req); + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); + struct cc_hash_ctx *ctx = crypto_ahash_ctx(tfm); + u32 digestsize = crypto_ahash_digestsize(tfm); + + /* store the hash digest result in the context */ + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, digestsize, + NS_BIT, 0); + set_flow_mode(&desc[idx], S_HASH_to_DOUT); + cc_set_endianity(ctx->hash_mode, &desc[idx]); + set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); + idx++; + + /* Loading hash opad xor key state */ + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, + ctx->inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); + idx++; + + /* Load the hash current length */ + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_sram(&desc[idx], + cc_digest_len_addr(ctx->drvdata, ctx->hash_mode), + HASH_LEN_SIZE); + set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + idx++; + + /* Memory Barrier: wait for IPAD/OPAD axi write to complete */ + hw_desc_init(&desc[idx]); + set_din_no_dma(&desc[idx], 0, 0xfffff0); + set_dout_no_dma(&desc[idx], 0, 0, 1); + idx++; + + /* Perform HASH update */ + hw_desc_init(&desc[idx]); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + digestsize, NS_BIT); + set_flow_mode(&desc[idx], DIN_HASH); + idx++; + + return idx; +} + static int cc_hash_digest(struct ahash_request *req) { struct ahash_req_ctx *state = ahash_request_ctx(req); @@ -414,62 +492,10 @@ static int cc_hash_digest(struct ahash_request *req) set_cipher_do(&desc[idx], DO_PAD); idx++; - /* store the hash digest result in the context */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, - digestsize, NS_BIT, 0); - set_flow_mode(&desc[idx], S_HASH_to_DOUT); - cc_set_endianity(ctx->hash_mode, &desc[idx]); - set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); - idx++; - - /* Loading hash opad xor key state */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_type(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, - ctx->inter_digestsize, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); - idx++; - - /* Load the hash current length */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_sram(&desc[idx], - cc_digest_len_addr(ctx->drvdata, ctx->hash_mode), - HASH_LEN_SIZE); - set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); - idx++; - - /* Memory Barrier: wait for IPAD/OPAD axi write to complete */ - hw_desc_init(&desc[idx]); - set_din_no_dma(&desc[idx], 0, 0xfffff0); - set_dout_no_dma(&desc[idx], 0, 0, 1); - idx++; - - /* Perform HASH update */ - hw_desc_init(&desc[idx]); - set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, - digestsize, NS_BIT); - set_flow_mode(&desc[idx], DIN_HASH); - idx++; + idx = cc_fin_hmac(desc, req, idx); } - /* Get final MAC result */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - /* TODO */ - set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, - NS_BIT, 1); - set_queue_last_ind(&desc[idx]); - set_flow_mode(&desc[idx], S_HASH_to_DOUT); - set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); - set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); - cc_set_endianity(ctx->hash_mode, &desc[idx]); - idx++; + idx = cc_fin_result(desc, req, idx); rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS && rc != -EBUSY) { @@ -481,6 +507,33 @@ static int cc_hash_digest(struct ahash_request *req) return rc; } +static int cc_restore_hash(struct cc_hw_desc *desc, struct cc_hash_ctx *ctx, + struct ahash_req_ctx *state, int idx) +{ + /* Restore hash digest */ + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, + ctx->inter_digestsize, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); + idx++; + + /* Restore hash current length */ + hw_desc_init(&desc[idx]); + set_cipher_mode(&desc[idx], ctx->hw_mode); + set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); + set_din_type(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, + HASH_LEN_SIZE, NS_BIT); + set_flow_mode(&desc[idx], S_DIN_to_HASH); + set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); + idx++; + + cc_set_desc(state, ctx, DIN_HASH, desc, false, &idx); + + return idx; +} + static int cc_hash_update(struct ahash_request *req) { struct ahash_req_ctx *state = ahash_request_ctx(req); @@ -527,24 +580,7 @@ static int cc_hash_update(struct ahash_request *req) cc_req.user_cb = cc_update_complete; cc_req.user_arg = req; - /* Restore hash digest */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, - ctx->inter_digestsize, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); - idx++; - /* Restore hash current length */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_type(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, - HASH_LEN_SIZE, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); - idx++; - - cc_set_desc(state, ctx, DIN_HASH, desc, false, &idx); + idx = cc_restore_hash(desc, ctx, state, idx); /* store the hash digest result in context */ hw_desc_init(&desc[idx]); @@ -616,84 +652,12 @@ static int cc_hash_finup(struct ahash_request *req) cc_req.user_cb = cc_hash_complete; cc_req.user_arg = req; - /* Restore hash digest */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, - ctx->inter_digestsize, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); - idx++; - - /* Restore hash current length */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); - set_din_type(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, - HASH_LEN_SIZE, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); - idx++; + idx = cc_restore_hash(desc, ctx, state, idx); - cc_set_desc(state, ctx, DIN_HASH, desc, false, &idx); + if (is_hmac) + idx = cc_fin_hmac(desc, req, idx); - if (is_hmac) { - /* Store the hash digest result in the context */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, - digestsize, NS_BIT, 0); - cc_set_endianity(ctx->hash_mode, &desc[idx]); - set_flow_mode(&desc[idx], S_HASH_to_DOUT); - set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); - idx++; - - /* Loading hash OPAD xor key state */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_type(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, - ctx->inter_digestsize, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); - idx++; - - /* Load the hash current length */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_sram(&desc[idx], - cc_digest_len_addr(ctx->drvdata, ctx->hash_mode), - HASH_LEN_SIZE); - set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); - idx++; - - /* Memory Barrier: wait for IPAD/OPAD axi write to complete */ - hw_desc_init(&desc[idx]); - set_din_no_dma(&desc[idx], 0, 0xfffff0); - set_dout_no_dma(&desc[idx], 0, 0, 1); - idx++; - - /* Perform HASH update on last digest */ - hw_desc_init(&desc[idx]); - set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, - digestsize, NS_BIT); - set_flow_mode(&desc[idx], DIN_HASH); - idx++; - } - - /* Get final MAC result */ - hw_desc_init(&desc[idx]); - /* TODO */ - set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, - NS_BIT, 1); - set_queue_last_ind(&desc[idx]); - set_flow_mode(&desc[idx], S_HASH_to_DOUT); - set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); - set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); - cc_set_endianity(ctx->hash_mode, &desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - idx++; + idx = cc_fin_result(desc, req, idx); rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS && rc != -EBUSY) { @@ -748,26 +712,7 @@ static int cc_hash_final(struct ahash_request *req) cc_req.user_cb = cc_hash_complete; cc_req.user_arg = req; - /* Restore hash digest */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, - ctx->inter_digestsize, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); - idx++; - - /* Restore hash current length */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); - set_din_type(&desc[idx], DMA_DLLI, state->digest_bytes_len_dma_addr, - HASH_LEN_SIZE, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); - idx++; - - cc_set_desc(state, ctx, DIN_HASH, desc, false, &idx); + idx = cc_restore_hash(desc, ctx, state, idx); /* "DO-PAD" must be enabled only when writing current length to HW */ hw_desc_init(&desc[idx]); @@ -779,62 +724,10 @@ static int cc_hash_final(struct ahash_request *req) set_flow_mode(&desc[idx], S_HASH_to_DOUT); idx++; - if (is_hmac) { - /* Store the hash digest result in the context */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_dout_dlli(&desc[idx], state->digest_buff_dma_addr, - digestsize, NS_BIT, 0); - cc_set_endianity(ctx->hash_mode, &desc[idx]); - set_flow_mode(&desc[idx], S_HASH_to_DOUT); - set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); - idx++; - - /* Loading hash OPAD xor key state */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_type(&desc[idx], DMA_DLLI, state->opad_digest_dma_addr, - ctx->inter_digestsize, NS_BIT); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); - idx++; - - /* Load the hash current length */ - hw_desc_init(&desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - set_din_sram(&desc[idx], - cc_digest_len_addr(ctx->drvdata, ctx->hash_mode), - HASH_LEN_SIZE); - set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); - set_flow_mode(&desc[idx], S_DIN_to_HASH); - set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); - idx++; - - /* Memory Barrier: wait for IPAD/OPAD axi write to complete */ - hw_desc_init(&desc[idx]); - set_din_no_dma(&desc[idx], 0, 0xfffff0); - set_dout_no_dma(&desc[idx], 0, 0, 1); - idx++; + if (is_hmac) + idx = cc_fin_hmac(desc, req, idx); - /* Perform HASH update on last digest */ - hw_desc_init(&desc[idx]); - set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr, - digestsize, NS_BIT); - set_flow_mode(&desc[idx], DIN_HASH); - idx++; - } - - /* Get final MAC result */ - hw_desc_init(&desc[idx]); - set_dout_dlli(&desc[idx], state->digest_result_dma_addr, digestsize, - NS_BIT, 1); - set_queue_last_ind(&desc[idx]); - set_flow_mode(&desc[idx], S_HASH_to_DOUT); - set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); - set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); - cc_set_endianity(ctx->hash_mode, &desc[idx]); - set_cipher_mode(&desc[idx], ctx->hw_mode); - idx++; + idx = cc_fin_result(desc, req, idx); rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); if (rc != -EINPROGRESS && rc != -EBUSY) { From patchwork Sun Jan 7 12:14:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123666 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1549561qgn; Sun, 7 Jan 2018 04:19:24 -0800 (PST) X-Google-Smtp-Source: ACJfBos7UJM6fZvWGiFOezzF/PESwzfxMjbc81osdHrclK6m5ZHc0P2c+HmERrO9jChYm1FhbTFi X-Received: by 10.101.100.202 with SMTP id t10mr7082623pgv.21.1515327563999; Sun, 07 Jan 2018 04:19:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327563; cv=none; d=google.com; s=arc-20160816; b=DRDOC+iGSzYxgnum8zol7ruadaa7cmpMrYGFgRiKyUJase2aXYA4N8XKX+bk4XX5vG lFQ44yX415vQfzwDITrFLPVOGUHa9EJDcmz1U5RH8TnRzAMj7saU8h1Go2WLHgcTth4N GTeEfDjMOeN3Nvw9wxBJG+woWTV8B3bGZrfmaicjTXZrPq+xGncrrgZHk7u0QmqlaEep 1smXD1dCcf0ApfFbAGuizGwwxC04Kpm1cT7eGrwdqy0HpvFl7F39AHkY3PFrbcq+nmxI uRjHkWTxkFKxZdQrLO/+dO4/s5mGAOwiO7MWm2DiTNBetcaQVt/rpRxF+3siH/qAWj39 Sxjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=TI0G4L1afqKxWs+/QIE0NHlG64rxjMO36ctzSWCacXQ=; b=CfzlscIi16fez6BaXy09J82AWykAkKRvkTHx9L/D2+48RnsyOnpZ0Mi0fVC7wxRj6t gOAPGTs8UDxai3JYGRTU2cNP6mM4TzUxv7AJPRUlYQwIm9SeLbAYQAwCf2RAH3Y6xCtS Tqse3b/hWjSZu+sH8XBZ3K5qWXutTwoRKVGbJxp4r7FfstvJOhfplhcVMUTz+ZMmUS7D r4PHL/JgCDpUc1zwvTA9JDWJKjYGh2+xZEBZp90f7R9ErtRF7zqeZ4DwOtiO9yZdwPho VNBdWT+BT05UglOVvj6ra9AHtC/TzK/GUZrGV9yKbRbidUyCpoQsM40DZIlWG6XFrETG TTGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v15si401490plk.832.2018.01.07.04.19.23; Sun, 07 Jan 2018 04:19:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754124AbeAGMTV (ORCPT + 28 others); Sun, 7 Jan 2018 07:19:21 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57616 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753738AbeAGMTU (ORCPT ); Sun, 7 Jan 2018 07:19:20 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B523A1435; Sun, 7 Jan 2018 04:19:19 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DC1AC3F581; Sun, 7 Jan 2018 04:19:17 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 22/27] staging: ccree: put pointer next to var name Date: Sun, 7 Jan 2018 12:14:33 +0000 Message-Id: <1515327285-8948-23-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Put pointer next to var name as per coding style. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 78f25e5..dc3be29 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -166,7 +166,7 @@ static void enqueue_seq(struct cc_drvdata *drvdata, struct cc_hw_desc seq[], unsigned int seq_len) { int i, w; - void * __iomem reg = drvdata->cc_base + CC_REG(DSCRPTR_QUEUE_WORD0); + void __iomem *reg = drvdata->cc_base + CC_REG(DSCRPTR_QUEUE_WORD0); struct device *dev = drvdata_to_dev(drvdata); /* From patchwork Sun Jan 7 12:14:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123667 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1549737qgn; Sun, 7 Jan 2018 04:19:35 -0800 (PST) X-Google-Smtp-Source: ACJfBot1lcfl7I15dweYTRAbZEbKMMonRwwSf3rbukDrWsUALz0XiR/RcD3ToSuxWOp5dePVhhtb X-Received: by 10.159.211.8 with SMTP id bc8mr9162597plb.142.1515327575882; Sun, 07 Jan 2018 04:19:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327575; cv=none; d=google.com; s=arc-20160816; b=AA2DUfi1Nxjy0FPf/WB8hxAhy691q51rjcTZOWoGHWJ2Qe+wBjPqc0UkWuR+xD29pM IXRhZIdlo5nvjPb+N1W6sa/BoaqWgWUiM2qGOLXPLP+GgAjJpcfJuqezjwQHJq4LytXR 2rQe58WO0spoCKXybqlujaj+SnJ+y8qGUbreADVDg5Q5cXn0jcZRCNwbUU642FOo2Moj qwANMxfE6OU4fAtlX5NvBnGkSXAxlZgs7oik0F6E+rY1FjU48q/NILhASZ/Ff+/BrrdX i2ptZCaj/7i51p7G9RRxwlXjE+yMpQdyQnT4RLhCj9EBXxAnY6a2j0GXba+eUj6ujJCV RmbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=lB3FpQPkaGDl+fyzImlTAhjZY9kNIiVn+XYVHHCShGg=; b=VlTQKOjlG/xsevyYameTpjwnI30iPGnntKxksrSxkZ0GDa61ViPqmoHlDJoXymH9r0 SzeeX6WdRhxoH6EhXsZE4sd/zAykAKeFgqJXLQpA0Xv6TZjOXEJ4JXpsAN0J1z4ijrsM qgZyGNFYqzcHDc11o3a+nNsUGdEUgRjfS+4QeEm6N2UcFFkvSc5pyoCnBMtVbDpdfrH/ 7uZuLJnx/suvBnrPCudLs77oQaCoqZCkOJdIY4fcece1hbNQ1xtmjcO6JsDGbfYPYnlz rkSxh3D0TR8mrcwhv5cb3VTv3FM/qlqmzD29KKezea8ebInJH9BdVKW/++49bE3jylG0 diHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si6133141pgv.49.2018.01.07.04.19.35; Sun, 07 Jan 2018 04:19:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754132AbeAGMTc (ORCPT + 28 others); Sun, 7 Jan 2018 07:19:32 -0500 Received: from foss.arm.com ([217.140.101.70]:57626 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753738AbeAGMTa (ORCPT ); Sun, 7 Jan 2018 07:19:30 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0E7591435; Sun, 7 Jan 2018 04:19:30 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EAE313F581; Sun, 7 Jan 2018 04:19:27 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 23/27] stating: ccree: fix allocation of void sized buf Date: Sun, 7 Jan 2018 12:14:34 +0000 Message-Id: <1515327285-8948-24-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We were allocating buffers using sizeof(*struct->field) where field was type void. Fix it by having a local variable with the real type. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_ivgen.c | 9 ++++----- drivers/staging/ccree/ssi_sram_mgr.c | 9 ++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_ivgen.c b/drivers/staging/ccree/ssi_ivgen.c index 6b92649..2ba15a5 100644 --- a/drivers/staging/ccree/ssi_ivgen.c +++ b/drivers/staging/ccree/ssi_ivgen.c @@ -175,13 +175,10 @@ int cc_ivgen_init(struct cc_drvdata *drvdata) int rc; /* Allocate "this" context */ - drvdata->ivgen_handle = kzalloc(sizeof(*drvdata->ivgen_handle), - GFP_KERNEL); - if (!drvdata->ivgen_handle) + ivgen_ctx = kzalloc(sizeof(*ivgen_ctx), GFP_KERNEL); + if (!ivgen_ctx) return -ENOMEM; - ivgen_ctx = drvdata->ivgen_handle; - /* Allocate pool's header for initial enc. key/IV */ ivgen_ctx->pool_meta = dma_alloc_coherent(device, CC_IVPOOL_META_SIZE, &ivgen_ctx->pool_meta_dma, @@ -200,6 +197,8 @@ int cc_ivgen_init(struct cc_drvdata *drvdata) goto out; } + drvdata->ivgen_handle = ivgen_ctx; + return cc_init_iv_sram(drvdata); out: diff --git a/drivers/staging/ccree/ssi_sram_mgr.c b/drivers/staging/ccree/ssi_sram_mgr.c index 1a2a7f4d..c5497aa 100644 --- a/drivers/staging/ccree/ssi_sram_mgr.c +++ b/drivers/staging/ccree/ssi_sram_mgr.c @@ -32,13 +32,16 @@ void cc_sram_mgr_fini(struct cc_drvdata *drvdata) */ int cc_sram_mgr_init(struct cc_drvdata *drvdata) { + struct cc_sram_ctx *ctx; + /* Allocate "this" context */ - drvdata->sram_mgr_handle = kzalloc(sizeof(*drvdata->sram_mgr_handle), - GFP_KERNEL); + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); - if (!drvdata->sram_mgr_handle) + if (!ctx) return -ENOMEM; + drvdata->sram_mgr_handle = ctx; + return 0; } From patchwork Sun Jan 7 12:14:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123668 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1550108qgn; Sun, 7 Jan 2018 04:19:59 -0800 (PST) X-Google-Smtp-Source: ACJfBouIgscZXpvVLm10RimK4thrrFVRaYFuxOAWTakpGdAs+IhgcSyK4E8gVeRQanABlx5VqJKC X-Received: by 10.98.75.91 with SMTP id y88mr3190964pfa.178.1515327599791; Sun, 07 Jan 2018 04:19:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327599; cv=none; d=google.com; s=arc-20160816; b=vRCKcLO6GoLHjdf05OvukqWSB3xDrkeJdtL68uE13QYWYOYAKm/ViH/YcBXy3YZ1ey k6ZK8lneBiM11dDWsk5qS0i0K+UuB4RcZ0XhUzAvsYO0eQ49g3O1+jXGE2HSYD4jAv13 rOq0se0dBYnUc4QVguIEZZhp5U0Si2WTEw554dJK9yWBY3V8nXY5Ux4B75L59FG0QPCE /mqJ2Gfz8QYK7afVN8BG5PWZnlM9mKsiFc7RpiA9hZWXKThXSpCckHpjsg0d/LFA30nO Yhb4orNEgas45LCfc59/KMBAtG5NzVnZzBH4zxY3IkSvjFOhcgwpFxR7Dy+IUFqZtI0i SwdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=FhFIJVvIfvfUQMSHMYmBRJVZEHLCgB4W1NukUVrkbTA=; b=BQTtT/WDWr7szaIBi0UfXMpwvVH/YqPsYnGx7IFjEsfD4g+VlLz6vWabgN7Neetbd8 00fP6sI39ezhLW6EB45Kd8jCEEE4HYSYUpD3OcGFGK8EZit200ZaeS8DGKbKt2RcsQVP aJoVSY7tqEEMzAioZqmM+aSvXLj46SsslWvu3fREngcn72UOaiJAjM0NlNy1yA79Z6We UGTXCvP/Uhg8JcfPkZwWa7nbOW0t9ZslYH29mF7BHaxZEkHZHSaOONfjJLaT2NVFoHeN nMISht1BeQjxmBHGqJi+X/itiaCKumVEymW9jCx1M+18GsJHcQaDEzqGGBFjGN8/Fb2+ frUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si6133141pgv.49.2018.01.07.04.19.59; Sun, 07 Jan 2018 04:19:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754020AbeAGMT5 (ORCPT + 28 others); Sun, 7 Jan 2018 07:19:57 -0500 Received: from foss.arm.com ([217.140.101.70]:57650 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753738AbeAGMTz (ORCPT ); Sun, 7 Jan 2018 07:19:55 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9DC5A1435; Sun, 7 Jan 2018 04:19:55 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5BBB3F581; Sun, 7 Jan 2018 04:19:53 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 25/27] staging: ccree: remove unneeded includes Date: Sun, 7 Jan 2018 12:14:36 +0000 Message-Id: <1515327285-8948-26-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove include files not needed for compilation. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_aead.c | 7 ------- drivers/staging/ccree/cc_buffer_mgr.c | 6 ------ drivers/staging/ccree/cc_cipher.c | 4 ---- drivers/staging/ccree/cc_driver.c | 31 ------------------------------- drivers/staging/ccree/cc_hash.c | 2 -- drivers/staging/ccree/cc_ivgen.c | 1 - drivers/staging/ccree/cc_pm.c | 2 -- drivers/staging/ccree/cc_request_mgr.c | 5 ----- 8 files changed, 58 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/cc_aead.c b/drivers/staging/ccree/cc_aead.c index da74423..265adff 100644 --- a/drivers/staging/ccree/cc_aead.c +++ b/drivers/staging/ccree/cc_aead.c @@ -3,18 +3,11 @@ #include #include -#include #include -#include -#include #include -#include -#include #include -#include #include #include -#include #include "cc_driver.h" #include "cc_buffer_mgr.h" #include "cc_aead.h" diff --git a/drivers/staging/ccree/cc_buffer_mgr.c b/drivers/staging/ccree/cc_buffer_mgr.c index 01c786c..14b2eab 100644 --- a/drivers/staging/ccree/cc_buffer_mgr.c +++ b/drivers/staging/ccree/cc_buffer_mgr.c @@ -1,17 +1,11 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ -#include -#include -#include #include -#include #include #include #include #include -#include -#include #include "cc_buffer_mgr.h" #include "cc_lli_defs.h" diff --git a/drivers/staging/ccree/cc_cipher.c b/drivers/staging/ccree/cc_cipher.c index eca0578..8afdbc1 100644 --- a/drivers/staging/ccree/cc_cipher.c +++ b/drivers/staging/ccree/cc_cipher.c @@ -3,12 +3,8 @@ #include #include -#include -#include #include #include -#include -#include #include #include #include diff --git a/drivers/staging/ccree/cc_driver.c b/drivers/staging/ccree/cc_driver.c index 98d491e..b49bc25 100644 --- a/drivers/staging/ccree/cc_driver.c +++ b/drivers/staging/ccree/cc_driver.c @@ -5,43 +5,12 @@ #include #include -#include -#include -#include -#include -#include -#include -#include - -#include #include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include #include -#include - -/* cache.h required for L1_CACHE_ALIGN() and cache_line_size() */ -#include -#include -#include -#include -#include #include #include #include diff --git a/drivers/staging/ccree/cc_hash.c b/drivers/staging/ccree/cc_hash.c index 7c1645d..86f9ec7 100644 --- a/drivers/staging/ccree/cc_hash.c +++ b/drivers/staging/ccree/cc_hash.c @@ -3,10 +3,8 @@ #include #include -#include #include #include -#include #include #include diff --git a/drivers/staging/ccree/cc_ivgen.c b/drivers/staging/ccree/cc_ivgen.c index 43f70d4..25a3131 100644 --- a/drivers/staging/ccree/cc_ivgen.c +++ b/drivers/staging/ccree/cc_ivgen.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ -#include #include #include "cc_driver.h" #include "cc_ivgen.h" diff --git a/drivers/staging/ccree/cc_pm.c b/drivers/staging/ccree/cc_pm.c index 1f5da86..c7d6b86 100644 --- a/drivers/staging/ccree/cc_pm.c +++ b/drivers/staging/ccree/cc_pm.c @@ -2,9 +2,7 @@ /* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include -#include #include -#include #include #include "cc_driver.h" #include "cc_buffer_mgr.h" diff --git a/drivers/staging/ccree/cc_request_mgr.c b/drivers/staging/ccree/cc_request_mgr.c index cbcfcc3..8372410 100644 --- a/drivers/staging/ccree/cc_request_mgr.c +++ b/drivers/staging/ccree/cc_request_mgr.c @@ -2,11 +2,6 @@ /* Copyright (C) 2012-2018 ARM Limited or its affiliates. */ #include -#include -#include -#include -#include -#include #include "cc_driver.h" #include "cc_buffer_mgr.h" #include "cc_request_mgr.h" From patchwork Sun Jan 7 12:14:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123671 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1550310qgn; Sun, 7 Jan 2018 04:20:14 -0800 (PST) X-Google-Smtp-Source: ACJfBovE8pHbXJ0mivUBQzosA89a0eZ/vqFeN/j2EbBjo4Oueu+YSYWLNP51fD/DqWrtTlcCM+q7 X-Received: by 10.98.137.86 with SMTP id v83mr8129912pfd.4.1515327614883; Sun, 07 Jan 2018 04:20:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327614; cv=none; d=google.com; s=arc-20160816; b=Tt0lF7BJTvUef8PMA3QmWN2qm0QHWLgMJ7AwKeB9scPpSgydvg0nNU1MrqtM/mstax MrPwK/0J//0vojN7SLSx+cKXyDGB7gItTQBmkViR227VpcnyGOdZggN1VbYQlwNmFfKu OQH8jDxppSlr6uyynT1whjA71io5mUqOWYO/r7C0Ta5lKhntEbPYQoEx+QqfrCXfROuN vlFBvYD0AUkU6kH7ResfYpQ7aY92FHo0xNfWgU7tjZ6BN0OSQbbZNGITtuZ/5bGHZrzZ oc7EHh2GlaEv1sfok6xHTSYc/hcH2PqBUEExMZ9JMwVIMVxSbDK9/cUwifLj8ZS9cs93 Kp2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=8KjXcQpQWs+6NYFXjRUE3T48ZJq0X3WWqzAkI3mHJgk=; b=GlC7RSEqOFMnWGigQ1HVFuo89JKNOSLox6dSncC2g5gzwkhqutgIjHB4stCHMDG6fb rFtetsGyEjACsldQkA1To+ZiSvnvegj28ZG4K0W9+sCacIM6dEh8egdLn9rsmmpGuonr uGdnK3dhpV6TB9MheLqBEqqkPjb1vPImzpz/Yfgxlsdi3WN2/JN7aw3PhwSWidEx+jas ffvAHeqKb60RRqVcm3JEm9FXWpbW/r/N4eMywAXvEPFlGsCJMY+U0zPIj8cPMQ9HP9Q+ 8v4NjDU5rmkocfqeB/JHggwf4UH8Yq5qqDr3nJ5luHr6p09R4d8xD3NMMrbXQ/xdcjW4 SL2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18si6976520pls.615.2018.01.07.04.20.14; Sun, 07 Jan 2018 04:20:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754073AbeAGMUN (ORCPT + 28 others); Sun, 7 Jan 2018 07:20:13 -0500 Received: from foss.arm.com ([217.140.101.70]:57662 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753776AbeAGMUG (ORCPT ); Sun, 7 Jan 2018 07:20:06 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 088B21435; Sun, 7 Jan 2018 04:20:06 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 306B03F581; Sun, 7 Jan 2018 04:20:03 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 26/27] staging: ccree: update TODO Date: Sun, 7 Jan 2018 12:14:37 +0000 Message-Id: <1515327285-8948-27-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update TODO to reflect work done Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/staging/ccree/TODO b/drivers/staging/ccree/TODO index 6d8702b..b8e163d 100644 --- a/drivers/staging/ccree/TODO +++ b/drivers/staging/ccree/TODO @@ -6,5 +6,5 @@ * * ************************************************************************* -1. Handle HW FIFO fullness more cleanly. +1. ??? From patchwork Sun Jan 7 12:14:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123672 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1550391qgn; Sun, 7 Jan 2018 04:20:20 -0800 (PST) X-Google-Smtp-Source: ACJfBoupjcTUHmuGybO4iILM5NKvlNxyp76OXzAaIkqJzstF4eT4erndt2KW4RhaJnTH7qWege8d X-Received: by 10.99.124.85 with SMTP id l21mr3688535pgn.401.1515327620397; Sun, 07 Jan 2018 04:20:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327620; cv=none; d=google.com; s=arc-20160816; b=ELmiA0VEturXcjPI3luDJpj2GkVun9QBxBsQJMBDKifoZfbfmOpu1nrKjX/HfBzss2 lxr5BZHBg2WpSf5YN2lKeJmC85y/AvsRLydB9c7YTYn2HbCqrYOyqDnhCc8yRu1i21Vv iTtyfeeLmjTTwRyVpgoGRms/tChkx90/6v2Q6QUJmz+BGH5WDjEy0Qo6H957wqCue/FP ILbeQHAwTe+QD5802MVrgBthj4P8eeO0lfGT/T2WUjdAEw0uPZ3KGe1X0/KeHGDivB6x ZfsoPeMhU+/csl6TnF0ZD7NlVlnJrzqUIm6TFqdL2C264BwBBdPQMSGT3pMIBz/m3eSB XDEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=4AOU7XeXkc1KHVVCNgG8VQovc2CPY5CH3lyWdyeTGSk=; b=V3unlfOpwFuMSeEkIe68ICck84RU+PJSnHy3i/xgFePQ36Eg4/dJxE6DsuEXICE9Ig Pv9w9AK8DiJ106I2V0rLzORyhEDpLBZao2pRVzUbAThA3+wNHQe/MQo0QLnf7WGjdPLx JLXQDeOmpUui7ifaDR/GaeWpJc1SbPxKwtj8+YFHEIS5F1gY0KKN7l2Bw3OpT2NNMqzT 1lB5z+iP68zGBBJOJgECqPSBzIveIla5fvTlXHRQSncSfco0/taGXu0NkXH7b6IkR8g6 awhGghsBdw/8mpiw0zeA7eKoT4dJ3Ls/nKJqUtZVZjPtgwAn+Kgc+7aFSh3Hw1G8uGcP ZmuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b187si6121844pgc.815.2018.01.07.04.20.20; Sun, 07 Jan 2018 04:20:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754143AbeAGMUS (ORCPT + 28 others); Sun, 7 Jan 2018 07:20:18 -0500 Received: from foss.arm.com ([217.140.101.70]:57672 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753808AbeAGMUQ (ORCPT ); Sun, 7 Jan 2018 07:20:16 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0BFF61435; Sun, 7 Jan 2018 04:20:16 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 342C33F581; Sun, 7 Jan 2018 04:20:13 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH v3 27/27] staging: ccree: add missing include Date: Sun, 7 Jan 2018 12:14:38 +0000 Message-Id: <1515327285-8948-28-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the missing include of include file with function declarations. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_debugfs.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 diff --git a/drivers/staging/ccree/cc_debugfs.c b/drivers/staging/ccree/cc_debugfs.c index f927a73..08f8db4 100644 --- a/drivers/staging/ccree/cc_debugfs.c +++ b/drivers/staging/ccree/cc_debugfs.c @@ -6,6 +6,7 @@ #include #include "cc_driver.h" #include "cc_crypto_ctx.h" +#include "cc_debugfs.h" struct cc_debugfs_ctx { struct dentry *dir;