From patchwork Tue Jul 2 18:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13720154 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE0121CE084; Tue, 2 Jul 2024 18:56:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719946615; cv=none; b=MNrQXa9ZLQTEP05eIt5cZsxVt1nogF/FEW5pBbTzmafXxL2pPFxJG89ktHmHxyz37F6pX4EqSrnFEI45YS+OcgxmoaxgjYRRKGey9oNrh8x0kdZdWzC7dibVPIzvVefvXIHF+6ryLiWhxUtcT9b6IyGYrYN395Gq+YSaAQTbTIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719946615; c=relaxed/simple; bh=Tq6BeA1w1NTkooeocTh0TfPApScW5WuthP1LYm80wmY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bTA0+xRq3Ju6f3hquJWB0f0fgjLtGHWEz7enJO3NtVGEnaKFYmVN5eglO+Dtyovkd9hBtitRydM8fyYW54E6BsBFGV2rJwS/q7lz6BjatiHAvJV/tnDy4LzvMTZWGXwi8xSH95J9r0y8KDXuF9hGTcZHTht/wvAWsyNYEhP2N3Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-57cb9a370ddso2610050a12.1; Tue, 02 Jul 2024 11:56:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719946612; x=1720551412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ip/QRkyatcVO8eC7phQqenDI9TdZRtsHzlRKFfbcrzA=; b=VCc3e12YJ2ecE6N+f6bbsltlMLHshtocB7lD/rf7Ms5H9NFBfYwKOK8UVKIxj9ib2a V4uklJPmqaadzMdtbbj+yneyovZoCj4z9HQ7IUZOfWLhRwiPZobzXHZ+H1yGawPdLfCi 9Or5mSKct4EhjTlf2NOo7W7jPQdkKJHkcbbiABN9BPeuXTAF0db0tA7pxfd5uypG0mEE VJTSfdNNOmHn/AAuSYqS4fcIWLGrfhHHd+JwLwhq+jQyNpz3KAhcbkn2TqZyWrHGxzZ9 N3m+A5Ipszy5ycN8uiYemgb54/gk51t/vgjA75MnfWEJb+1LryrNGH+i3dDMcVJKM5XW YyTw== X-Forwarded-Encrypted: i=1; AJvYcCWZZlTpcDGCBivAwwoN07LPRZ2l5rIr9Gy2TFg9Y8uX2MfBSftG5502y03W2ZWF9GRdvE22GHQVZ4Jv2y9vWQHmrbI8a8kT3Ne2Mqe9+1Hcn0kZ4gwSy39r9eg3cSVisJZuGVw6GJB4cj9lwTLYTPIJCSM5BBSoY8+VGvZ/3BCHJG9H X-Gm-Message-State: AOJu0Yx1d3wWLt1CBrxmgp4hLdDepEW/ih8yc/77B0A3xiJiHUji84GR bSXZmoc42og9dS4D43RJ+k3RO41j1pPa8YZQb02htTBvXNmU7rLc X-Google-Smtp-Source: AGHT+IFVGEuTqBHQWwZ3xfvjSxpJO86F1S10Bdm6VwIjobxlgC6PqqFmKGSZQEEo+L2eUFVJp179mA== X-Received: by 2002:a17:907:60d0:b0:a77:9bf3:f2f0 with SMTP id a640c23a62f3a-a779bf3f42cmr56778766b.65.1719946612128; Tue, 02 Jul 2024 11:56:52 -0700 (PDT) Received: from localhost (fwdproxy-lla-112.fbsv.net. [2a03:2880:30ff:70::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab08cfc1sm442036166b.163.2024.07.02.11.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 11:56:51 -0700 (PDT) From: Breno Leitao To: kuba@kernel.org, horia.geanta@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com, linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" Cc: horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH net-next v3 1/4] crypto: caam: Avoid unused imx8m_machine_match variable Date: Tue, 2 Jul 2024 11:55:51 -0700 Message-ID: <20240702185557.3699991-2-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240702185557.3699991-1-leitao@debian.org> References: <20240702185557.3699991-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If caam module is built without OF support, the compiler returns the following warning: drivers/crypto/caam/ctrl.c:83:34: warning: 'imx8m_machine_match' defined but not used [-Wunused-const-variable=] imx8m_machine_match is only referenced by of_match_node(), which is set to NULL if CONFIG_OF is not set, as of commit 5762c20593b6b ("dt: Add empty of_match_node() macro"): #define of_match_node(_matches, _node) NULL Do not create imx8m_machine_match if CONFIG_OF is not set. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202407011309.cpTuOGdg-lkp@intel.com/ Suggested-by: Jakub Kicinski Signed-off-by: Breno Leitao --- drivers/crypto/caam/ctrl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index bd418dea586d..d4b39184dbdb 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -80,6 +80,7 @@ static void build_deinstantiation_desc(u32 *desc, int handle) append_jump(desc, JUMP_CLASS_CLASS1 | JUMP_TYPE_HALT); } +#ifdef CONFIG_OF static const struct of_device_id imx8m_machine_match[] = { { .compatible = "fsl,imx8mm", }, { .compatible = "fsl,imx8mn", }, @@ -88,6 +89,7 @@ static const struct of_device_id imx8m_machine_match[] = { { .compatible = "fsl,imx8ulp", }, { } }; +#endif /* * run_descriptor_deco0 - runs a descriptor on DECO0, under direct control of From patchwork Tue Jul 2 18:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13720155 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A05951CE098; Tue, 2 Jul 2024 18:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719946617; cv=none; b=riYUy7S2RU2u7kJsI5JUwL7+bqFxQNqJkKwW8MVY5ULiZy6IcuACjLwa86YCBQTjXiF/U2xa89CM+uWd+3yea4l+tcRKpXoe0Rz96vqsWw8szIayWubbMdyyn7xkl65ZK9BrMkU7Me7Zw7pkI174q0zXF4HwvqZ06kX5YaHpCd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719946617; c=relaxed/simple; bh=tUK00xKqvOijEUvn4/25P+icPcM73AmxS1/boRQuHwc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZW2OPoin/rPqwJK1HjEoyc+mL6UOS2fW9fjCO46vtxIpqUgxp75Vn3/AHzXalgXnJ2BB8qxgsnWR8ahuKey5Xck8gzh8DimHd6EqxAMxBixHDC1tX+6LoVi1hUCgKEJiBrDlzsaN6POYyqbl6jTW5rIWMQdEFqCroWLHLvcZ140= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a72459d8d6aso464763566b.0; Tue, 02 Jul 2024 11:56:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719946614; x=1720551414; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ShLo8usNRCEFu5wG7vvAmQF6Nr70DMxisgaHAPu+cb8=; b=neYyWR8k+capayAPsrWL1TeAujC2Eq5V7Mgyz95mjioLur3i9vErR9Co/gK9fz+iAO yb1qYkZmYAdptH6QFQJv/Oi5ptxr0pxttqaQ9OD8KvKwJVpga6a+jPJUmtk4NQNe623C RfUzqx7riZAC46MXqHjmoTuWq52Wl101tOFgTSNOPhFawf4x8JsQThXVI3rHFXZ+QBgU SgM7yRSjAJP8P32DQAeqoloo1/94IaWth50cXwcZUwxIkxbqqWrf35PQTvnQDP3K6fgc HrWYzkV+AZmAe/hKIjuqgcJNpLKSy9fPOLGvs39oAmLUPbXddyGc5Ra2T7jBlmqG2fF4 Xh2Q== X-Forwarded-Encrypted: i=1; AJvYcCWevRKMCmF/LngZ7UKidQE8XbrdsTDfeFAap3CpPORtzTa0s289VcEdbQ3zyvikoL9T/mjhxfpiFTfInJP25krwcLLdH5i5mSulN7KJKlsCW0EjMy4A1FTbGrrdmxYwSrMTDChL+IvkjXXDUk6CGn1UlcqXBtb+Y4IqcuSwHP/O0emy X-Gm-Message-State: AOJu0YyC8ISEsFFCpsa7AZhplkpFmtL8VFGFfExmnoqDxJXPUvB6pRnG j3Ptbv4zKJv4jKmN2s7cI/nDT6ijSmhMsFZr5a2s3nkuY/hqlLHP X-Google-Smtp-Source: AGHT+IFijCxDVh8MOClU9v30A+rRP4QeKP6ELLHnbBxcyBbAktP/k9hezkG+J7/Leq5NDhzL6eU9Gg== X-Received: by 2002:a17:906:a0c2:b0:a72:6f10:52da with SMTP id a640c23a62f3a-a75144a28bemr666287966b.59.1719946613978; Tue, 02 Jul 2024 11:56:53 -0700 (PDT) Received: from localhost (fwdproxy-lla-001.fbsv.net. [2a03:2880:30ff:1::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0656a0sm444457066b.113.2024.07.02.11.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 11:56:53 -0700 (PDT) From: Breno Leitao To: kuba@kernel.org, horia.geanta@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com, linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" Cc: horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v3 2/4] crypto: caam: Make CRYPTO_DEV_FSL_CAAM dependent of COMPILE_TEST Date: Tue, 2 Jul 2024 11:55:52 -0700 Message-ID: <20240702185557.3699991-3-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240702185557.3699991-1-leitao@debian.org> References: <20240702185557.3699991-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As most of the drivers that depend on ARCH_LAYERSCAPE, make CRYPTO_DEV_FSL_CAAM depend on COMPILE_TEST for compilation and testing. # grep -r depends.\*ARCH_LAYERSCAPE.\*COMPILE_TEST | wc -l 29 Signed-off-by: Breno Leitao --- drivers/crypto/caam/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/caam/Kconfig b/drivers/crypto/caam/Kconfig index c631f99e415f..05210a0edb8a 100644 --- a/drivers/crypto/caam/Kconfig +++ b/drivers/crypto/caam/Kconfig @@ -10,7 +10,7 @@ config CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC config CRYPTO_DEV_FSL_CAAM tristate "Freescale CAAM-Multicore platform driver backend" - depends on FSL_SOC || ARCH_MXC || ARCH_LAYERSCAPE + depends on FSL_SOC || ARCH_MXC || ARCH_LAYERSCAPE || COMPILE_TEST select SOC_BUS select CRYPTO_DEV_FSL_CAAM_COMMON imply FSL_MC_BUS From patchwork Tue Jul 2 18:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13720156 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64EF81CF3CB; Tue, 2 Jul 2024 18:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719946619; cv=none; b=FGoRJ38nliNrZSe89vEb4IWnCmTyWUdCpN1GAuQuToXkCb2XDucOGve9tde7yNxX/uTnsgEBdz9XCbKN8e5BrQva9w2Sz9bA2281R6uOCbS5H4sdYS93kWrbXH/8Rm6YkgAGLYaGnEm3ujfSZoorWyEBih2fGZyn7vQR23lvWXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719946619; c=relaxed/simple; bh=LewReLZ488nceXVfROCKjjRqr6mgLCSW0OHeBB/hHSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ak7VBnMX5UjX6Y4mBVuJu4IBuOvVV9FGgHB/CXHsTWMqIwuhqBjNHlCA1Sm5d/aDipo+G33bUqcbtcbhEkbHJnBz7/m3tOZK06juxbQv+rH9fztsan17n2co/KdnupTlDittqzfAx/JMGDXI7NSs/ucmVIymlDR+SLZBqFaBnsc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a72b3e1c14cso535885766b.1; Tue, 02 Jul 2024 11:56:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719946616; x=1720551416; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SKoF4CiVeQZjUAsog/IhvfGsb/vWl4mbiyS3/rCHROE=; b=pNzq6ZiTucQdv6VeIN1q//xxZ6EgnrcyB4ndMerzAVAyKwFFOrKmm1L4CGSKczO4it zQFozwqHJ+P3xGYpW91DP7jYXFIbaHrpP+PSgy7pbr+QzPC8pUrHanzhUmoT3bfk0QrJ Cw3m6iXNrYmtQapyNTdibAxvyGoz5syN5P0UJ1YuS7KfBpkD7Ksjj/9urRYHq2bG3z2A BiL3FHQPpCluYjDxO6Dtiyz4MTRDIKkM24uSPzo9F42k8ONHAmkVqL4bKe/pMXDOjeTY TzpxsV83IZQNBo/0r7kJU31GBbETsBGXuDgIQ32p9mIhukD0d+RuIfcQ3/+9WoUkXsom 1UPg== X-Forwarded-Encrypted: i=1; AJvYcCVsrjDN2f3kaR4TjdLC+ORj7DNFXdSiy9epl8yxv/HSSnPDlXVcuKWq5hqB4ixPQ0A2/KEJSYhhJxua8vDxHQPIa+CGzLxrxc0dwdaFMugPzHfPosaHXrgn7agzMD40bxrnjf7iwXUo7fST1ZQarlxuZCVfTxgCPo27wSdVbTUB8aEy X-Gm-Message-State: AOJu0YwnWAxpd7bC/shvTgnJA9H69bIJ9Eefp/YhVXN7VpPhzrIoNefx Z2ChKRRElOHkRARgCSQ9OK/UT8hPgPHlndjgOQaZLbqIhd/qJcS/WE6U1w== X-Google-Smtp-Source: AGHT+IEze65jQf7HnZOgqdtG7PyeTgOhJEZRPpZUDwi9ebQf0brT8FCeqOlR9bZHX0qzLiTYp3P1Yw== X-Received: by 2002:a17:907:9488:b0:a6f:7c8:4fd6 with SMTP id a640c23a62f3a-a75141fb4f8mr873741166b.0.1719946615676; Tue, 02 Jul 2024 11:56:55 -0700 (PDT) Received: from localhost (fwdproxy-lla-001.fbsv.net. [2a03:2880:30ff:1::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf6336csm443042166b.70.2024.07.02.11.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 11:56:55 -0700 (PDT) From: Breno Leitao To: kuba@kernel.org, horia.geanta@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com, linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" Cc: horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v3 3/4] crypto: caam: Unembed net_dev structure from qi Date: Tue, 2 Jul 2024 11:55:53 -0700 Message-ID: <20240702185557.3699991-4-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240702185557.3699991-1-leitao@debian.org> References: <20240702185557.3699991-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Embedding net_device into structures prohibits the usage of flexible arrays in the net_device structure. For more details, see the discussion at [1]. Un-embed the net_devices from struct caam_qi_pcpu_priv by converting them into pointers, and allocating them dynamically. Use the leverage alloc_netdev_dummy() to allocate the net_device object at caam_qi_init(). The free of the device occurs at caam_qi_shutdown(). Link: https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/ [1] Signed-off-by: Breno Leitao --- drivers/crypto/caam/qi.c | 43 ++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c index 46a083849a8e..ba8fb5d8a7b2 100644 --- a/drivers/crypto/caam/qi.c +++ b/drivers/crypto/caam/qi.c @@ -57,7 +57,7 @@ struct caam_napi { */ struct caam_qi_pcpu_priv { struct caam_napi caam_napi; - struct net_device net_dev; + struct net_device *net_dev; struct qman_fq *rsp_fq; } ____cacheline_aligned; @@ -144,7 +144,7 @@ static void caam_fq_ern_cb(struct qman_portal *qm, struct qman_fq *fq, { const struct qm_fd *fd; struct caam_drv_req *drv_req; - struct device *qidev = &(raw_cpu_ptr(&pcpu_qipriv)->net_dev.dev); + struct device *qidev = &(raw_cpu_ptr(&pcpu_qipriv)->net_dev->dev); struct caam_drv_private *priv = dev_get_drvdata(qidev); fd = &msg->ern.fd; @@ -530,6 +530,7 @@ static void caam_qi_shutdown(void *data) if (kill_fq(qidev, per_cpu(pcpu_qipriv.rsp_fq, i))) dev_err(qidev, "Rsp FQ kill failed, cpu: %d\n", i); + free_netdev(per_cpu(pcpu_qipriv.net_dev, i)); } qman_delete_cgr_safe(&priv->cgr); @@ -573,7 +574,7 @@ static enum qman_cb_dqrr_result caam_rsp_fq_dqrr_cb(struct qman_portal *p, struct caam_napi *caam_napi = raw_cpu_ptr(&pcpu_qipriv.caam_napi); struct caam_drv_req *drv_req; const struct qm_fd *fd; - struct device *qidev = &(raw_cpu_ptr(&pcpu_qipriv)->net_dev.dev); + struct device *qidev = &(raw_cpu_ptr(&pcpu_qipriv)->net_dev->dev); struct caam_drv_private *priv = dev_get_drvdata(qidev); u32 status; @@ -718,12 +719,24 @@ static void free_rsp_fqs(void) kfree(per_cpu(pcpu_qipriv.rsp_fq, i)); } +static void free_caam_qi_pcpu_netdev(const cpumask_t *cpus) +{ + struct caam_qi_pcpu_priv *priv; + int i; + + for_each_cpu(i, cpus) { + priv = per_cpu_ptr(&pcpu_qipriv, i); + free_netdev(priv->net_dev); + } +} + int caam_qi_init(struct platform_device *caam_pdev) { int err, i; struct device *ctrldev = &caam_pdev->dev, *qidev; struct caam_drv_private *ctrlpriv; const cpumask_t *cpus = qman_affine_cpus(); + cpumask_t clean_mask; ctrlpriv = dev_get_drvdata(ctrldev); qidev = ctrldev; @@ -743,6 +756,8 @@ int caam_qi_init(struct platform_device *caam_pdev) return err; } + cpumask_clear(&clean_mask); + /* * Enable the NAPI contexts on each of the core which has an affine * portal. @@ -751,10 +766,16 @@ int caam_qi_init(struct platform_device *caam_pdev) struct caam_qi_pcpu_priv *priv = per_cpu_ptr(&pcpu_qipriv, i); struct caam_napi *caam_napi = &priv->caam_napi; struct napi_struct *irqtask = &caam_napi->irqtask; - struct net_device *net_dev = &priv->net_dev; + struct net_device *net_dev; + net_dev = alloc_netdev_dummy(0); + if (!net_dev) { + err = -ENOMEM; + goto fail; + } + cpumask_set_cpu(i, &clean_mask); + priv->net_dev = net_dev; net_dev->dev = *qidev; - INIT_LIST_HEAD(&net_dev->napi_list); netif_napi_add_tx_weight(net_dev, irqtask, caam_qi_poll, CAAM_NAPI_WEIGHT); @@ -766,16 +787,22 @@ int caam_qi_init(struct platform_device *caam_pdev) dma_get_cache_alignment(), 0, NULL); if (!qi_cache) { dev_err(qidev, "Can't allocate CAAM cache\n"); - free_rsp_fqs(); - return -ENOMEM; + err = -ENOMEM; + goto fail2; } caam_debugfs_qi_init(ctrlpriv); err = devm_add_action_or_reset(qidev, caam_qi_shutdown, ctrlpriv); if (err) - return err; + goto fail2; dev_info(qidev, "Linux CAAM Queue I/F driver initialised\n"); return 0; + +fail2: + free_rsp_fqs(); +fail: + free_caam_qi_pcpu_netdev(&clean_mask); + return err; } From patchwork Tue Jul 2 18:55:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13720157 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 256901CF3F9; Tue, 2 Jul 2024 18:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719946620; cv=none; b=NsrztHudx780pSlFlKpqcGKEb7vX7OquenxjkbQURUWZUkGeeN/iVByi8yVkg3ixmbkT9V8jrEor56nWifsEQu1eRUz+nFYTCUSnst/u6WzBFR0ayHLJ/US4kqxo/SeJ/VmkkjAKFIdsujD2FsLTE6QazDZs38JAl0fUtF1I3PA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719946620; c=relaxed/simple; bh=JNl2l3vdXcnwyiGAaHW2mChV80yaVjG0lqiKdNOQ6eM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GQmwP+NLMgi1hYcYt3PNQDcB/gG6kcOSVZh6wW+07xdTRtG96JjJ8z9oCZX9CNveCgTY1MawfVp6K1+0mwBmiIpA71VWC99BRpZgxRg3WE2cbUh0f72yMc2KlOdGjkAzdOuaX06NAI/+8hAzed0TtxSSxM6UHNqamfwRrlGslbg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a75131ce948so418996066b.2; Tue, 02 Jul 2024 11:56:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719946617; x=1720551417; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oSy9xn6zf0uOofSAGvu9prtSY8Ipz+Uu9GyDLC9cna0=; b=tR+4OdhakwwDdUHxw8/qXVuyjzP84H6JIIJS550oHF5c4O8sWAgGW1iGZLDN5/6TcN LsRQoj7e5Iu1aU0DiEKdulmTbhMyFmxDx7EvXOfc1cV6D/UVq/qfsKEX46EO2cUO1Opm E9FkonQcZ8IGRMO7i4Bv4WGYG+4aDSaFFVY8j8eAIo9FtsDqISYuPF1dFhXHf5jbZJJX RQP+L7u63XMcnYW4lq4N9vA8HZKBjPMV42LbaWDLZZ5xtI/Nw1b/bDTKIGcZhXAoUnxE yNZ8gz9DrQNzak70fLVC7xfRtNbSkzz2IK1BJBAWb9Y4RPDUrMmIA9Fdav3waAkYwbyB 2b7A== X-Forwarded-Encrypted: i=1; AJvYcCVuLTs1tjXmdGqojknwpfpUWSpgx6Hvoj78A7Yf9DOWWad2ZueOQ9td7WK/YkEMedf5NRPjTry+0IPjkza64/154e3uYsa/SFjs+09JDD+b1iTa1dOT87ImRfESRJeiPXlLMwBQMIcmSCyFTSYP6H5Omu6IAGPLlfNEa93MNrIOvrJo X-Gm-Message-State: AOJu0YyOU8NUlKwWoanYnCvxvQPWz/3hcylhwjRfV6oF/E3k/QY2/RVG y6w13nfpIVQso+pWV3Ba720e0jS0JSz0oosKUUV8M4tZlI+4o09N X-Google-Smtp-Source: AGHT+IEXvPn8naD3LbFJ25auYC36fl2hcqanVnNALKBRNbctpka4Tp29E80aHtwxaClGB+NJLiSMzQ== X-Received: by 2002:a17:906:3450:b0:a72:8100:c3e with SMTP id a640c23a62f3a-a75144a2848mr512170666b.48.1719946617501; Tue, 02 Jul 2024 11:56:57 -0700 (PDT) Received: from localhost (fwdproxy-lla-116.fbsv.net. [2a03:2880:30ff:74::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf63360sm444217666b.64.2024.07.02.11.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 11:56:57 -0700 (PDT) From: Breno Leitao To: kuba@kernel.org, horia.geanta@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com, linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" Cc: horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v3 4/4] crypto: caam: Unembed net_dev structure in dpaa2 Date: Tue, 2 Jul 2024 11:55:54 -0700 Message-ID: <20240702185557.3699991-5-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240702185557.3699991-1-leitao@debian.org> References: <20240702185557.3699991-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Embedding net_device into structures prohibits the usage of flexible arrays in the net_device structure. For more details, see the discussion at [1]. Un-embed the net_devices from struct dpaa2_caam_priv_per_cpu by converting them into pointers, and allocating them dynamically. Use the leverage alloc_netdev_dummy() to allocate the net_device object at dpaa2_dpseci_setup(). The free of the device occurs at dpaa2_dpseci_disable(). Link: https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/ [1] Signed-off-by: Breno Leitao --- drivers/crypto/caam/caamalg_qi2.c | 28 +++++++++++++++++++++++++--- drivers/crypto/caam/caamalg_qi2.h | 2 +- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c index a4f6884416a0..207dc422785a 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -4990,11 +4990,23 @@ static int dpaa2_dpseci_congestion_setup(struct dpaa2_caam_priv *priv, return err; } +static void free_dpaa2_pcpu_netdev(struct dpaa2_caam_priv *priv, const cpumask_t *cpus) +{ + struct dpaa2_caam_priv_per_cpu *ppriv; + int i; + + for_each_cpu(i, cpus) { + ppriv = per_cpu_ptr(priv->ppriv, i); + free_netdev(ppriv->net_dev); + } +} + static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev) { struct device *dev = &ls_dev->dev; struct dpaa2_caam_priv *priv; struct dpaa2_caam_priv_per_cpu *ppriv; + cpumask_t clean_mask; int err, cpu; u8 i; @@ -5073,6 +5085,7 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev) } } + cpumask_clear(&clean_mask); i = 0; for_each_online_cpu(cpu) { u8 j; @@ -5096,15 +5109,23 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev) priv->rx_queue_attr[j].fqid, priv->tx_queue_attr[j].fqid); - ppriv->net_dev.dev = *dev; - INIT_LIST_HEAD(&ppriv->net_dev.napi_list); - netif_napi_add_tx_weight(&ppriv->net_dev, &ppriv->napi, + ppriv->net_dev = alloc_netdev_dummy(0); + if (!ppriv->net_dev) { + err = -ENOMEM; + goto err_alloc_netdev; + } + cpumask_set_cpu(cpu, &clean_mask); + ppriv->net_dev->dev = *dev; + + netif_napi_add_tx_weight(ppriv->net_dev, &ppriv->napi, dpaa2_dpseci_poll, DPAA2_CAAM_NAPI_WEIGHT); } return 0; +err_alloc_netdev: + free_dpaa2_pcpu_netdev(priv, &clean_mask); err_get_rx_queue: dpaa2_dpseci_congestion_free(priv); err_get_vers: @@ -5153,6 +5174,7 @@ static int __cold dpaa2_dpseci_disable(struct dpaa2_caam_priv *priv) ppriv = per_cpu_ptr(priv->ppriv, i); napi_disable(&ppriv->napi); netif_napi_del(&ppriv->napi); + free_netdev(ppriv->net_dev); } return 0; diff --git a/drivers/crypto/caam/caamalg_qi2.h b/drivers/crypto/caam/caamalg_qi2.h index abb502bb675c..61d1219a202f 100644 --- a/drivers/crypto/caam/caamalg_qi2.h +++ b/drivers/crypto/caam/caamalg_qi2.h @@ -81,7 +81,7 @@ struct dpaa2_caam_priv { */ struct dpaa2_caam_priv_per_cpu { struct napi_struct napi; - struct net_device net_dev; + struct net_device *net_dev; int req_fqid; int rsp_fqid; int prio;