Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1749484iof; Tue, 7 Jun 2022 10:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMVhadFwgnn3E/wp7hjX7g1haVBImYg+T8fjqFh2yP9637CHRmA4Z5lnLkVe6YMj3hzd9T X-Received: by 2002:a17:907:d0d:b0:711:d554:1c8f with SMTP id gn13-20020a1709070d0d00b00711d5541c8fmr9263841ejc.223.1654623893365; Tue, 07 Jun 2022 10:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654623893; cv=none; d=google.com; s=arc-20160816; b=zcqsp0HZZgCiArOqMDyKEaF8HBP/GJ8f6PYn0hj0vEoNLEs7ka6S3oENW/CltaPWon nQfvRDgY87CjRYrDZp2OkAWkOc/ybG2cI6Ac0yAjYbYvKV+jaZIdwnLCBXzifVVkUjFZ 9Nn/kMJc24ChI7Few8nIZRsuCF7ZCKhs3mHuny9UwdYHOIe0UsoSyr0hy7CXCCc1tP4b 0DRiVxf38LlvV0ChfPkRJABUTYaSxkV/nuHlnLSJ9ek7s3J0dbB7V6ywJwQL7PG9LuIG rTHdr+rWlotY/oh8pqOYrB8Mem4dVqFCYaCVxSqLr3ygZ31iZB3T1UP7Avn8E1vjzovM F50w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=JrFUIV706M1nQGPnTgf23GOQUReTTr0m/i52CqY/X98=; b=uBdJ58NVbs/WhP8TQ0WCSVBVxCyVNbY88ar6G3/aKawM1WN/Xsx680mQGP0fMAY4Yj robRIj5gDjGOWxtm/fzZxaccxaBE1r+3JTQ4TRApc2J69Pc19iNtEMs4lkwK4I/nFcdf y+feRcGEpAjX0T5Aa9HIE0SbVlHBCiXJ0kd/B8gWI4PYNixRbk8DtHbMi7CTp+Qhyp9F bwZI8fgT3Wi5PQlojuHRQUlrTrcqbGz62U9OB8/w4996dEXwmtAjEhn2XxTUKjU7SxJK dC/3DKUZBSMNsgmns6jUvEEWyyAoRiUzuf7Mka72VjWfe4FXlvhS50T9BEFD6+VhDDES hs3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z70-20020a509e4c000000b0042dd79e606fsi13899291ede.478.2022.06.07.10.44.18; Tue, 07 Jun 2022 10:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345294AbiFGQ64 (ORCPT + 99 others); Tue, 7 Jun 2022 12:58:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345285AbiFGQ6z (ORCPT ); Tue, 7 Jun 2022 12:58:55 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E6EA7F338C; Tue, 7 Jun 2022 09:58:53 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B0C851480; Tue, 7 Jun 2022 09:58:53 -0700 (PDT) Received: from ampere-altra-2-1.usa.Arm.com (ampere-altra-2-1.usa.arm.com [10.118.91.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 731EB3F66F; Tue, 7 Jun 2022 09:58:53 -0700 (PDT) From: Yoan Picchi To: Giovanni Cabiddu , Herbert Xu , "David S . Miller" , qat-linux@intel.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andre Przywara , Ard Biesheuvel Subject: [PATCH 1/2] crypto: qat: replace get_current_node() with numa_node_id() Date: Tue, 7 Jun 2022 16:58:39 +0000 Message-Id: <20220607165840.66931-2-yoan.picchi@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220607165840.66931-1-yoan.picchi@arm.com> References: <20220607165840.66931-1-yoan.picchi@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Andre Przywara Currently the QAT driver code uses a self-defined wrapper function called get_current_node() when it wants to learn the current NUMA node. This implementation references the topology_physical_package_id[] array, which more or less coincidentally contains the NUMA node id, at least on x86. Because this is not universal, and Linux offers a direct function to learn the NUMA node ID, replace that function with a call to numa_node_id(), which would work everywhere. This fixes the QAT driver operation on arm64 machines. Reported-by: Yoan Picchi Signed-off-by: Andre Przywara Signed-off-by: Yoan Picchi --- drivers/crypto/qat/qat_common/adf_common_drv.h | 5 ----- drivers/crypto/qat/qat_common/qat_algs.c | 4 ++-- drivers/crypto/qat/qat_common/qat_asym_algs.c | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h index e8c9b77c0d66..b582107db67b 100644 --- a/drivers/crypto/qat/qat_common/adf_common_drv.h +++ b/drivers/crypto/qat/qat_common/adf_common_drv.h @@ -49,11 +49,6 @@ struct service_hndl { struct list_head list; }; -static inline int get_current_node(void) -{ - return topology_physical_package_id(raw_smp_processor_id()); -} - int adf_service_register(struct service_hndl *service); int adf_service_unregister(struct service_hndl *service); diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index f998ed58457c..c0ffaebcc8b8 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -618,7 +618,7 @@ static int qat_alg_aead_newkey(struct crypto_aead *tfm, const u8 *key, { struct qat_alg_aead_ctx *ctx = crypto_aead_ctx(tfm); struct qat_crypto_instance *inst = NULL; - int node = get_current_node(); + int node = numa_node_id(); struct device *dev; int ret; @@ -1042,7 +1042,7 @@ static int qat_alg_skcipher_newkey(struct qat_alg_skcipher_ctx *ctx, { struct qat_crypto_instance *inst = NULL; struct device *dev; - int node = get_current_node(); + int node = numa_node_id(); int ret; inst = qat_crypto_get_instance_node(node); diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c index b0b78445418b..3701eac10bce 100644 --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c @@ -480,7 +480,7 @@ static int qat_dh_init_tfm(struct crypto_kpp *tfm) { struct qat_dh_ctx *ctx = kpp_tfm_ctx(tfm); struct qat_crypto_instance *inst = - qat_crypto_get_instance_node(get_current_node()); + qat_crypto_get_instance_node(numa_node_id()); if (!inst) return -EINVAL; @@ -1218,7 +1218,7 @@ static int qat_rsa_init_tfm(struct crypto_akcipher *tfm) { struct qat_rsa_ctx *ctx = akcipher_tfm_ctx(tfm); struct qat_crypto_instance *inst = - qat_crypto_get_instance_node(get_current_node()); + qat_crypto_get_instance_node(numa_node_id()); if (!inst) return -EINVAL; -- 2.25.1