Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2234927pxm; Fri, 4 Mar 2022 12:01:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0QOFEzl27xvCRPGuc9FhqycChyNs0tXXR+3CwWBqE/78KA2nJcVKifl3/ek7ytP3OcB55 X-Received: by 2002:a17:902:f70b:b0:14d:643d:9c99 with SMTP id h11-20020a170902f70b00b0014d643d9c99mr279673plo.18.1646424062568; Fri, 04 Mar 2022 12:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646424062; cv=none; d=google.com; s=arc-20160816; b=rZcRLq5OkFRnJ5TE8KrMctOvr2euVWfVvWgA6AHzeMbUQzD3r+yKJNP7/xRtrT6TDo U0Lx+g2Pp+bJ9+5zp6wnMnwIvRtVal+5k9tV+I/WuNQXz+azQmQCE6I59/S8od8Zz3Dv cK3dVL9iqwTxOPtNu+Fhg1GfeerprYpVpMPvCcCvGFU5kfXqVaQ6D9SsEvo+8zg+9vHT 8cZU3RGgxUVSx3mF38CuWnSXmzA2vwyVL0+sd33KhlC/ylGgu+0i8kB37tArf0IKJFgi WPWI8RNJ92gGwGTlUNZXqZmZgfKeNygbo1AL95/b9WKJYHc1pynjljngzFRjCrouI3SB ME6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=KSJwoYhw5xAz+jN2GGlynb/GVe1ZJOzlOqWRsfY5F5I=; b=THphWuRZUgyBzfHTQTKp/Gi990ng5w+wJzwoguGNJZCR6EQZ82fv9kficv5uMbZf0j QWsWeaMifaLlHgWvAK2ovvQfDj1Uk58D6GCGKCw98JJtyT1lSHYDpa+OH6UIObnElw1r 3dBey47trcic5duQieU/jaDJsatbolXlc5d39JBqoE8Cfmbz6/Wzmlh0Dg2TNCKTsDrL NKONb4Cj98BYGlBvCQoF/bflxtjCknKhJfUS+uDkpUK1Zqdx5IHhbx/eojdiNH/nrN0c YOmRLuXIJwfozObM2rKVBpgWO+IJq6hBFfU2dV+KduaWJYFB50lyMcNBd7rtQa0SZida v4/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kbEo3Wx0; spf=softfail (google.com: domain of transitioning linux-crypto-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p15-20020a170903248f00b001515fbb3ac9si5022735plw.135.2022.03.04.12.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:01:02 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-crypto-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kbEo3Wx0; spf=softfail (google.com: domain of transitioning linux-crypto-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 90DEC30CAA8; Fri, 4 Mar 2022 11:24:13 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233593AbiCDRzr (ORCPT + 99 others); Fri, 4 Mar 2022 12:55:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233602AbiCDRzk (ORCPT ); Fri, 4 Mar 2022 12:55:40 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76BD01C469B; Fri, 4 Mar 2022 09:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646416492; x=1677952492; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ky+EBYxMHIUccuiPHDGLq5tdedRm2jVnYsGhmdAbGUo=; b=kbEo3Wx0TLlI2KqZS1znYhCMCZm8o6lHLsUyuYGX4pRjuHtje1jsNF+6 T10dPa2zYJNDZ14XpnGVOVzzW2njEmOIc4Kip8qXuCr/ewKWv4KIRe24+ lzA8w+Wo03ewPUoyR2lYrzp8HrYhrMfYhmUb1b/++KYOzO90OGXgkoDgc dpF7xm0ou6sQ8c94Gztcd2AGyR7FIxu9yGRavVpoX2TJzWCtAxfYBzwvT F86VZsBbLr1WZrtIToYVvfuxj+GR6viQiGrYtg9XQbYTGN9zAdxYPhdL/ ticSK5F4ZVWx7EnmcqJvY7/xJJro4M92HeHZDHVzhNgVGlHCQ20dKTIKf g==; X-IronPort-AV: E=McAfee;i="6200,9189,10276"; a="233985878" X-IronPort-AV: E=Sophos;i="5.90,155,1643702400"; d="scan'208";a="233985878" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2022 09:54:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,155,1643702400"; d="scan'208";a="511927888" Received: from silpixa00400314.ir.intel.com (HELO silpixa00400314.ger.corp.intel.com) ([10.237.222.76]) by orsmga006.jf.intel.com with ESMTP; 04 Mar 2022 09:54:50 -0800 From: Giovanni Cabiddu To: herbert@gondor.apana.org.au Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com, Giovanni Cabiddu , stable@vger.kernel.org Subject: [PATCH] crypto: qat - disable registration of algorithms Date: Fri, 4 Mar 2022 17:54:47 +0000 Message-Id: <20220304175447.19601-1-giovanni.cabiddu@intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Organization: Intel Research and Development Ireland Ltd - Co. Reg. #308263 - Collinstown Industrial Park, Leixlip, County Kildare - Ireland Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The implementations of aead and skcipher in the QAT driver do not support properly requests with the CRYPTO_TFM_REQ_MAY_BACKLOG flag set. If the HW queue is full, the driver returns -EBUSY but does not enqueue the request. This can result in applications like dm-crypt waiting indefinitely for a completion of a request that was never submitted to the hardware. To avoid this problem, disable the registration of all crypto algorithms in the QAT driver by setting the number of crypto instances to 0 at configuration time. Cc: stable@vger.kernel.org Signed-off-by: Giovanni Cabiddu --- drivers/crypto/qat/qat_4xxx/adf_drv.c | 7 +++++++ drivers/crypto/qat/qat_common/qat_crypto.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/crypto/qat/qat_4xxx/adf_drv.c b/drivers/crypto/qat/qat_4xxx/adf_drv.c index a6c78b9c730b..fa4c350c1bf9 100644 --- a/drivers/crypto/qat/qat_4xxx/adf_drv.c +++ b/drivers/crypto/qat/qat_4xxx/adf_drv.c @@ -75,6 +75,13 @@ static int adf_crypto_dev_config(struct adf_accel_dev *accel_dev) if (ret) goto err; + /* Temporarily set the number of crypto instances to zero to avoid + * registering the crypto algorithms. + * This will be removed when the algorithms will support the + * CRYPTO_TFM_REQ_MAY_BACKLOG flag + */ + instances = 0; + for (i = 0; i < instances; i++) { val = i; bank = i * 2; diff --git a/drivers/crypto/qat/qat_common/qat_crypto.c b/drivers/crypto/qat/qat_common/qat_crypto.c index 7234c4940fae..67c9588e89df 100644 --- a/drivers/crypto/qat/qat_common/qat_crypto.c +++ b/drivers/crypto/qat/qat_common/qat_crypto.c @@ -161,6 +161,13 @@ int qat_crypto_dev_config(struct adf_accel_dev *accel_dev) if (ret) goto err; + /* Temporarily set the number of crypto instances to zero to avoid + * registering the crypto algorithms. + * This will be removed when the algorithms will support the + * CRYPTO_TFM_REQ_MAY_BACKLOG flag + */ + instances = 0; + for (i = 0; i < instances; i++) { val = i; snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_ASYM_BANK_NUM, i); -- 2.35.1