Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp143255pxu; Wed, 2 Dec 2020 17:37:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbppftGCiaoOZFC/QPSiKtanFruWRFZag+1096uRSuynOLTmATCdq5gzkJubUZdWAkZDbX X-Received: by 2002:a17:906:1199:: with SMTP id n25mr511364eja.293.1606959443442; Wed, 02 Dec 2020 17:37:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1606959443; cv=pass; d=google.com; s=arc-20160816; b=DqacYu8H99Rso4/AC1PkXxYy1ALz9MaFYJixGXdsR9ITqcexDzfkL1XS5sEmt4vemQ XtZiSWRBdpih/u/wyHrIUKxKPUmB87iR2C0JvEJzlA9WwQTm5u9lnokP2fdeDusyQyGP kfUe18d6DBYfCebjk2N25Q8qxztKYIUnF6TbZQhC29UKRLxIv1HKNNbRfgpBcIH3ICZ2 M/rAz6RlkTFvBnC5LJ/2MaEkmePV0TZUL8o6ki2tub79WV6CWh1dqXvIT4s52j20Lj0h F2FQTGtXJh+WqZ7cXL/T3Tl3Awqi3U2kg1ilpEqw5APGEZYbJfGZO9A+VY/PhxhQ8BBG LZqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=Ua/gHjkPkxXoiHmpW4h7tUwffCzJ5L0REIL3iDJPibM=; b=S5+8wWMsjT9QYXIoqYLsBASFesY6okYzx/HzNRt1mVXAJ+Dr80Cn2fjJszacG9xZJE dwdvLKDe2hhSjUl4ywlfH7+lqyz/4bTOVO0uKDdr60LR4c0hcmLxVvI0HfDkoxHjv7Vl Nmv6Cu51sF++TQ7+qIOao2/tu4GAROkt8ARwr04WboZVHlpqcq0uSB1wYH16A9sxAQRP WlqslO3ZqoE0e21/WCKoB7G8/eu+ZaHyC4DaxILlDz/AhRoDtMfybEPiREloXVGpqPlx zmNm1Jlq7kiMaEiIqPSC2UUQKvvQx26vOQFigs5fLtNvq2WEoT0VLzLV7v64V89xv6az X46g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=SUgyfgVJ; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si236103ejh.137.2020.12.02.17.36.53; Wed, 02 Dec 2020 17:37:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=SUgyfgVJ; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727153AbgLCBgi (ORCPT + 99 others); Wed, 2 Dec 2020 20:36:38 -0500 Received: from mail-eopbgr40078.outbound.protection.outlook.com ([40.107.4.78]:53706 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727066AbgLCBgi (ORCPT ); Wed, 2 Dec 2020 20:36:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nIQTeL/OTc2rAxPLW+l3hLUIbFMQ+07qpgV5DN+h0wUqCibgmfyBmQdiaaSYB1tRFztbI5K65ez0l0TQsvTNneojSpQILjSb6JNbj0XPLYnhRcnAHlqk326whhYQnQ3VNBheHylrG5N62uvxTTxcHcjvBLUH5qB0bEuruKFAJL3sN0PsrPb43xqVQ6JG2+V2JjADZ5x75qVK32DNh0uqlNwx7c4TA5oYjvP5YNCPIz5RfMEtpxlkmzjcbJcbZDXeoFxI4bDEyQq6NTIzy2es2kyw+JddqRUTls0+s7ey9awpYwQ70Kiwz3Tx+UjBQiyjJdJTEQkezHeBV3JOCJcW1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ua/gHjkPkxXoiHmpW4h7tUwffCzJ5L0REIL3iDJPibM=; b=LXpCrllkb77YJj5tDuXQtdLpiydZ7UQHm6HXIgmZ7/tTLnEJzw4T+XJpQVebHD4is2fU0hBq7mVueNYriycoLJJDw52OwTD5uRoatWFXce46Q4Rc9wtrx80E+V0oK5qh8oIh4pzC6Vc61bMvOaxLuTiTymU9XLdPzCngQM2fWSwb5c7bMPIp5Mz+tzPpS7re0Lplr/VT3HbOJVfcLp2BLE7HkEIn/lGm7BkUHIy1SBQRjQ99+OShhMChZKzWeRvjEz+sE2+AusEQR7+iYoQmmjVrZBd9om06kMb/D92tPZBJg+bUgVnvBAHEx3rqd0p909yhkCyApw61n9DN4ne7AQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ua/gHjkPkxXoiHmpW4h7tUwffCzJ5L0REIL3iDJPibM=; b=SUgyfgVJZqYwMt6qA3383ZTzZi8losxM7pbCIL9qc2lQH6DqGMtSeETB1/MLmW3dT0VlzVL2vmC0dqsGxmbsSZ075d7sjB1Qu3uYVo9r7t2vOeVVYJYOUOOUweD4rNL95NVi464xsziL/PA0II1s8YewGspMC2dMLKSPth42Pks= Authentication-Results: gondor.apana.org.au; dkim=none (message not signed) header.d=none;gondor.apana.org.au; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR0402MB3712.eurprd04.prod.outlook.com (2603:10a6:803:1c::25) by VI1PR04MB4430.eurprd04.prod.outlook.com (2603:10a6:803:65::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Thu, 3 Dec 2020 01:35:47 +0000 Received: from VI1PR0402MB3712.eurprd04.prod.outlook.com ([fe80::ade4:e169:1f4a:28c]) by VI1PR0402MB3712.eurprd04.prod.outlook.com ([fe80::ade4:e169:1f4a:28c%4]) with mapi id 15.20.3632.018; Thu, 3 Dec 2020 01:35:47 +0000 From: "Iuliana Prodan (OSS)" To: Herbert Xu , Ard Biesheuvel , "David S. Miller" , Horia Geanta Cc: Aymen Sghaier , Silvano Di Ninno , Franck Lenormand , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx , Iuliana Prodan Subject: [PATCH 0/5] crypto: caam - avoid allocating memory at crypto request runtime Date: Thu, 3 Dec 2020 03:35:19 +0200 Message-Id: <20201203013524.30495-1-iuliana.prodan@oss.nxp.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-Originating-IP: [83.217.231.2] X-ClientProxiedBy: AM0PR03CA0059.eurprd03.prod.outlook.com (2603:10a6:208::36) To VI1PR0402MB3712.eurprd04.prod.outlook.com (2603:10a6:803:1c::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15040.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR03CA0059.eurprd03.prod.outlook.com (2603:10a6:208::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18 via Frontend Transport; Thu, 3 Dec 2020 01:35:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c09c5bbf-cc71-4e93-7e72-08d8972bc269 X-MS-TrafficTypeDiagnostic: VI1PR04MB4430: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mz71iZHqHXyNzaEhkFa8+CnMEXTZU8cNgRgpP/VZUfhGPQt9HQxqJQonP0baanzFa7FFImdYGkAjqDKX+TKTSTui1E9EMhZ5YF0cZpu+CpiWQOFgAANOpYbERoXNM8eAs/em8ylih1rzgDjUKWgw4HeOd7413TovKrkQ7AVxVoiTVnU4FwDkpw2UAS1xc/hdlTAUpj9oueIUjjnzRsLydIOnpLwhL/J3oYixKMbhFaAkv49cFGleI46+qUTI/xWIeljtqZxQJBEzAB/NDgEk8657NPSlSHMgtvrUa+WEGFbn/Y1rzqpcq1xJT88SMF5Q4tBDB0E77s5sWQRXVNAOzw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR0402MB3712.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(136003)(346002)(376002)(39860400002)(396003)(54906003)(1076003)(110136005)(2906002)(316002)(2616005)(83380400001)(8676002)(52116002)(6506007)(8936002)(5660300002)(66946007)(26005)(66476007)(956004)(16526019)(86362001)(186003)(6512007)(4326008)(478600001)(66556008)(6666004)(6486002);DIR:OUT;S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?Q?zSuobXaU06pC9eqQXvx7t/+mqZ1oO8kDs73Z+8WX8DagKTYMKEx/SWhulUld?= =?us-ascii?Q?5Aqwby7L0CBqOcEiw6CBhkOBWYbXqv07B9gHgKi2jxzocMwJh1KS0ETDevz0?= =?us-ascii?Q?AXSsiSoVXQRLGvGVmYDl04fzrGhkTkomHMEo7HLAQrlOMRZAunv0Y8g6PuKH?= =?us-ascii?Q?tdqs?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c09c5bbf-cc71-4e93-7e72-08d8972bc269 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0402MB3712.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2020 01:35:47.6715 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aQ7w0u2nGms2cibS72f0RxqdNWBM6OKE1ue9VfyptNES22tTWsUBGO6aCGYLt425pPQE4x7Cys4IEEsoydHDdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4430 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Iuliana Prodan This series removes CRYPTO_ALG_ALLOCATES_MEMORY flag and allocates the memory needed by the driver, to fulfil a request, within the crypto request object. The extra size needed for base extended descriptor, hw descriptor commands and link tables is added to the reqsize field that indicates how much memory could be needed per request. CRYPTO_ALG_ALLOCATES_MEMORY flag is limited only to dm-crypt use-cases, which seems to be 4 entries maximum. Therefore in reqsize we allocate memory for maximum 4 entries for src and 4 for dst, aligned. If the driver needs more than the 4 entries maximum, the memory is dynamically allocated, at runtime. Iuliana Prodan (5): crypto: caam/jr - avoid allocating memory at crypto request runtime for skcipher crypto: caam/jr - avoid allocating memory at crypto request runtime for aead crypto: caam/jr - avoid allocating memory at crypto request runtime fost hash crypto: caam/qi - avoid allocating memory at crypto request runtime crypto: caam/qi2 - avoid allocating memory at crypto request runtime drivers/crypto/caam/caamalg.c | 141 +++++++--- drivers/crypto/caam/caamalg_qi.c | 134 ++++++---- drivers/crypto/caam/caamalg_qi2.c | 415 ++++++++++++++++++++---------- drivers/crypto/caam/caamalg_qi2.h | 6 + drivers/crypto/caam/caamhash.c | 77 ++++-- 5 files changed, 538 insertions(+), 235 deletions(-) -- 2.17.1