2022-09-20 11:42:58

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 0/9] crypto: qcom-qce: Add YAML bindings & support for newer SoCs

Changes since v6:
=================
- v6 can be seen here: https://lore.kernel.org/linux-arm-msm/[email protected]/
- As per Krzysztof's suggestion on v6, clubbed the crypto driver and
dt-bindings changes together. Now the overall v5 patchset into 3
separate patchsets, one each for the following areas to allow easier
review and handling from the maintainer:
arm-msm, crypto and dma

Changes since v5:
=================
- v5 can be seen here: https://lore.kernel.org/lkml/[email protected]/
- As per Bjorn's suggestion on irc, broke down the patchset into 4
separate patchsets, one each for the following areas to allow easier
review and handling from the maintainer:
arm-msm, crypto, dma and devicetree
- Addressed Rob's, Vladimir's and Bjorn's review comments received on
v5.
- Added Tested-by from Jordan received on the v5.

Changes since v4:
=================
- v4 for sm8250 can be seen here: https://lore.kernel.org/linux-arm-msm/[email protected]/
- v1 for sm8150 qce enablement can be seen here: https://lore.kernel.org/linux-arm-msm/[email protected]/
- Merged the sm8150 and sm8250 enablement patches in the same patchset,
as per suggestions from Bjorn.
- Dropped a couple of patches from v4, as these have been picked by
Bjorn already via his tree.
- Addressed review comments from Vladimir, Thara and Rob.
- Collect Reviewed-by from Rob and Thara on some of the patches from the
v4 patchset.

Changes since v3:
=================
- v3 can be seen here: https://lore.kernel.org/linux-arm-msm/[email protected]/
- Dropped a couple of patches from v3, on basis of the review comments:
~ [PATCH 13/17] crypto: qce: core: Make clocks optional
~ [PATCH 15/17] crypto: qce: Convert the device found dev_dbg() to dev_info()
- Addressed review comments from Thara, Rob and Stephan Gerhold.
- Collect Reviewed-by from Rob and Thara on some of the patches from the
v3 patchset.

Changes since v2:
=================
- v2 can be seen here: https://lore.kernel.org/dmaengine/[email protected]/
- Drop a couple of patches from v1, which tried to address the defered
probing of qce driver in case bam dma driver is not yet probed.
Replace it instead with a single (simpler) patch [PATCH 16/17].
- Convert bam dma and qce crypto dt-bindings to YAML.
- Addressed review comments from Thara, Bjorn, Vinod and Rob.

Changes since v1:
=================
- v1 can be seen here: https://lore.kernel.org/linux-arm-msm/[email protected]/
- v1 did not work well as reported earlier by Dmitry, so v2 contains the following
changes/fixes:
~ Enable the interconnect path b/w BAM DMA and main memory first
before trying to access the BAM DMA registers.
~ Enable the interconnect path b/w qce crytpo and main memory first
before trying to access the qce crypto registers.
~ Make sure to document the required and optional properties for both
BAM DMA and qce crypto drivers.
~ Add a few debug related print messages in case the qce crypto driver
passes or fails to probe.
~ Convert the qce crypto driver probe to a defered one in case the BAM DMA
or the interconnect driver(s) (needed on specific Qualcomm parts) are not
yet probed.

Qualcomm crypto engine (qce) is available on several Snapdragon SoCs.
The qce block supports hardware accelerated algorithms for encryption
and authentication. It also provides support for aes, des, 3des
encryption algorithms and sha1, sha256, hmac(sha1), hmac(sha256)
authentication algorithms.

Tested the enabled crypto algorithms with cryptsetup test utilities
on sm8150-mtp, sa8155p-adp, sm8250-mtp and RB5 boards (see [1]) and
also with crypto self-tests, including the fuzz tests
(CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y).

[1]. https://linux.die.net/man/8/cryptsetup

Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Tested-by: Jordan Crouse <[email protected]>

Bhupesh Sharma (7):
dt-bindings: qcom-qce: Convert bindings to yaml
dt-bindings: qcom-qce: Add 'interconnects' and 'interconnect-names'
dt-bindings: qcom-qce: Add 'iommus' to optional properties
dt-bindings: qcom-qce: Add new SoC compatible strings for qcom-qce
crypto: qce: core: Add new compatibles for qce crypto driver
MAINTAINERS: Add qcom-qce dt-binding file to QUALCOMM CRYPTO DRIVERS
section
MAINTAINERS: Add myself as a co-maintainer for Qualcomm Crypto Drivers

Thara Gopinath (2):
crypto: qce: core: Add support to initialize interconnect path
crypto: qce: core: Make clocks optional

.../devicetree/bindings/crypto/qcom-qce.txt | 25 -----
.../devicetree/bindings/crypto/qcom-qce.yaml | 93 +++++++++++++++++++
MAINTAINERS | 2 +
drivers/crypto/qce/core.c | 31 ++++++-
drivers/crypto/qce/core.h | 1 +
5 files changed, 123 insertions(+), 29 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/crypto/qcom-qce.txt
create mode 100644 Documentation/devicetree/bindings/crypto/qcom-qce.yaml

--
2.37.1


2022-09-20 11:42:59

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 2/9] dt-bindings: qcom-qce: Add 'interconnects' and 'interconnect-names'

Add 'interconnects' and 'interconnect-names' as optional properties
to the device-tree binding documentation for Qualcomm crypto IP.

These properties describe the interconnect path between crypto and main
memory and the interconnect type respectively.

Cc: Bjorn Andersson <[email protected]>
Acked-by: Rob Herring <[email protected]>
Tested-by: Jordan Crouse <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
---
Documentation/devicetree/bindings/crypto/qcom-qce.yaml | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
index 8df47e8513b8..94f96ebc5dac 100644
--- a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
+++ b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
@@ -32,6 +32,14 @@ properties:
- const: bus
- const: core

+ interconnects:
+ maxItems: 1
+ description:
+ Interconnect path between qce crypto and main memory.
+
+ interconnect-names:
+ const: memory
+
dmas:
items:
- description: DMA specifiers for rx dma channel.
--
2.37.1

2022-09-20 11:43:10

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 3/9] dt-bindings: qcom-qce: Add 'iommus' to optional properties

Add the missing optional property - 'iommus' to the
device-tree binding documentation for qcom-qce crypto IP.

This property describes the phandle(s) to apps_smmu node with sid mask.

Cc: Bjorn Andersson <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Tested-by: Jordan Crouse <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
---
Documentation/devicetree/bindings/crypto/qcom-qce.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
index 94f96ebc5dac..4e00e7925fed 100644
--- a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
+++ b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
@@ -32,6 +32,12 @@ properties:
- const: bus
- const: core

+ iommus:
+ minItems: 1
+ maxItems: 8
+ description:
+ phandle to apps_smmu node with sid mask.
+
interconnects:
maxItems: 1
description:
@@ -72,4 +78,8 @@ examples:
clock-names = "iface", "bus", "core";
dmas = <&cryptobam 2>, <&cryptobam 3>;
dma-names = "rx", "tx";
+ iommus = <&apps_smmu 0x584 0x0011>,
+ <&apps_smmu 0x586 0x0011>,
+ <&apps_smmu 0x594 0x0011>,
+ <&apps_smmu 0x596 0x0011>;
};
--
2.37.1

2022-09-20 11:43:18

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 4/9] dt-bindings: qcom-qce: Add new SoC compatible strings for qcom-qce

Newer Qualcomm chips support newer versions of the qce crypto IP, so add
soc specific compatible strings for qcom-qce instead of using crypto
IP version specific ones.

Keep the old strings for backward-compatibility, but mark them as
deprecated.

Cc: Bjorn Andersson <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Tested-by: Jordan Crouse <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
---
.../devicetree/bindings/crypto/qcom-qce.yaml | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
index 4e00e7925fed..aa2f676f5382 100644
--- a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
+++ b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
@@ -15,7 +15,15 @@ description:

properties:
compatible:
- const: qcom,crypto-v5.1
+ enum:
+ - qcom,crypto-v5.1 # Deprecated. Kept only for backward compatibility
+ - qcom,ipq6018-qce
+ - qcom,ipq8074-qce
+ - qcom,msm8996-qce
+ - qcom,sdm845-qce
+ - qcom,sm8150-qce
+ - qcom,sm8250-qce
+ - qcom,sm8350-qce

reg:
maxItems: 1
@@ -70,7 +78,7 @@ examples:
- |
#include <dt-bindings/clock/qcom,gcc-apq8084.h>
[email protected] {
- compatible = "qcom,crypto-v5.1";
+ compatible = "qcom,ipq6018-qce";
reg = <0xfd45a000 0x6000>;
clocks = <&gcc GCC_CE2_AHB_CLK>,
<&gcc GCC_CE2_AXI_CLK>,
--
2.37.1

2022-09-20 11:43:31

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 6/9] crypto: qce: core: Add new compatibles for qce crypto driver

Since we decided to use soc specific compatibles for describing
the qce crypto IP nodes in the device-trees, adapt the driver
now to handle the same.

Keep the old deprecated compatible strings still in the driver,
to ensure backward compatibility.

Cc: Bjorn Andersson <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Tested-by: Jordan Crouse <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
---
drivers/crypto/qce/core.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index 63be06df5519..99ed540611ab 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -291,8 +291,17 @@ static int qce_crypto_remove(struct platform_device *pdev)
}

static const struct of_device_id qce_crypto_of_match[] = {
+ /* Following two entries are deprecated (kept only for backward compatibility) */
{ .compatible = "qcom,crypto-v5.1", },
{ .compatible = "qcom,crypto-v5.4", },
+ /* Add compatible strings as per updated dt-bindings, here: */
+ { .compatible = "qcom,ipq4019-qce", },
+ { .compatible = "qcom,ipq6018-qce", },
+ { .compatible = "qcom,ipq8074-qce", },
+ { .compatible = "qcom,msm8996-qce", },
+ { .compatible = "qcom,sdm845-qce", },
+ { .compatible = "qcom,sm8150-qce", },
+ { .compatible = "qcom,sm8250-qce", },
{}
};
MODULE_DEVICE_TABLE(of, qce_crypto_of_match);
--
2.37.1

2022-09-20 11:43:36

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 1/9] dt-bindings: qcom-qce: Convert bindings to yaml

Convert Qualcomm QCE crypto devicetree binding to YAML.

Reviewed-by: Rob Herring <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Tested-by: Jordan Crouse <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
---
.../devicetree/bindings/crypto/qcom-qce.txt | 25 -------
.../devicetree/bindings/crypto/qcom-qce.yaml | 67 +++++++++++++++++++
2 files changed, 67 insertions(+), 25 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/crypto/qcom-qce.txt
create mode 100644 Documentation/devicetree/bindings/crypto/qcom-qce.yaml

diff --git a/Documentation/devicetree/bindings/crypto/qcom-qce.txt b/Documentation/devicetree/bindings/crypto/qcom-qce.txt
deleted file mode 100644
index fdd53b184ba8..000000000000
--- a/Documentation/devicetree/bindings/crypto/qcom-qce.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Qualcomm crypto engine driver
-
-Required properties:
-
-- compatible : should be "qcom,crypto-v5.1"
-- reg : specifies base physical address and size of the registers map
-- clocks : phandle to clock-controller plus clock-specifier pair
-- clock-names : "iface" clocks register interface
- "bus" clocks data transfer interface
- "core" clocks rest of the crypto block
-- dmas : DMA specifiers for tx and rx dma channels. For more see
- Documentation/devicetree/bindings/dma/dma.txt
-- dma-names : DMA request names should be "rx" and "tx"
-
-Example:
- [email protected] {
- compatible = "qcom,crypto-v5.1";
- reg = <0xfd45a000 0x6000>;
- clocks = <&gcc GCC_CE2_AHB_CLK>,
- <&gcc GCC_CE2_AXI_CLK>,
- <&gcc GCC_CE2_CLK>;
- clock-names = "iface", "bus", "core";
- dmas = <&cryptobam 2>, <&cryptobam 3>;
- dma-names = "rx", "tx";
- };
diff --git a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
new file mode 100644
index 000000000000..8df47e8513b8
--- /dev/null
+++ b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/crypto/qcom-qce.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm crypto engine driver
+
+maintainers:
+ - Bhupesh Sharma <[email protected]>
+
+description:
+ This document defines the binding for the QCE crypto
+ controller found on Qualcomm parts.
+
+properties:
+ compatible:
+ const: qcom,crypto-v5.1
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ items:
+ - description: iface clocks register interface.
+ - description: bus clocks data transfer interface.
+ - description: core clocks rest of the crypto block.
+
+ clock-names:
+ items:
+ - const: iface
+ - const: bus
+ - const: core
+
+ dmas:
+ items:
+ - description: DMA specifiers for rx dma channel.
+ - description: DMA specifiers for tx dma channel.
+
+ dma-names:
+ items:
+ - const: rx
+ - const: tx
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - dmas
+ - dma-names
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/qcom,gcc-apq8084.h>
+ [email protected] {
+ compatible = "qcom,crypto-v5.1";
+ reg = <0xfd45a000 0x6000>;
+ clocks = <&gcc GCC_CE2_AHB_CLK>,
+ <&gcc GCC_CE2_AXI_CLK>,
+ <&gcc GCC_CE2_CLK>;
+ clock-names = "iface", "bus", "core";
+ dmas = <&cryptobam 2>, <&cryptobam 3>;
+ dma-names = "rx", "tx";
+ };
--
2.37.1

2022-09-20 11:44:14

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 7/9] crypto: qce: core: Make clocks optional

From: Thara Gopinath <[email protected]>

On certain Snapdragon processors, the crypto engine clocks are enabled by
default by security firmware and the driver need not/ should not handle the
clocks. Make acquiring of all the clocks optional in crypto engine driver
so that the driver initializes properly even if no clocks are specified in
the dt.

Cc: Bjorn Andersson <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Tested-by: Jordan Crouse <[email protected]>
Signed-off-by: Thara Gopinath <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
[Bhupesh: Massage the commit log]
---
drivers/crypto/qce/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index 99ed540611ab..ef774f6edb5a 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -213,15 +213,15 @@ static int qce_crypto_probe(struct platform_device *pdev)
if (IS_ERR(qce->mem_path))
return PTR_ERR(qce->mem_path);

- qce->core = devm_clk_get(qce->dev, "core");
+ qce->core = devm_clk_get_optional(qce->dev, "core");
if (IS_ERR(qce->core))
return PTR_ERR(qce->core);

- qce->iface = devm_clk_get(qce->dev, "iface");
+ qce->iface = devm_clk_get_optional(qce->dev, "iface");
if (IS_ERR(qce->iface))
return PTR_ERR(qce->iface);

- qce->bus = devm_clk_get(qce->dev, "bus");
+ qce->bus = devm_clk_get_optional(qce->dev, "bus");
if (IS_ERR(qce->bus))
return PTR_ERR(qce->bus);

--
2.37.1

2022-09-20 11:44:34

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 8/9] MAINTAINERS: Add qcom-qce dt-binding file to QUALCOMM CRYPTO DRIVERS section

Add the entry for 'Documentation/devicetree/bindings/crypto/qcom-qce.yaml'
to the appropriate section for 'QUALCOMM CRYPTO DRIVERS' in
MAINTAINERS file.

Cc: Bjorn Andersson <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 94e40d05cc83..b0556cd21f86 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16948,6 +16948,7 @@ M: Thara Gopinath <[email protected]>
L: [email protected]
L: [email protected]
S: Maintained
+F: Documentation/devicetree/bindings/crypto/qcom-qce.yaml
F: drivers/crypto/qce/

QUALCOMM EMAC GIGABIT ETHERNET DRIVER
--
2.37.1

2022-09-20 11:44:45

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 9/9] MAINTAINERS: Add myself as a co-maintainer for Qualcomm Crypto Drivers

Add myself as a co-maintainer of Qualcomm Crypto drivers.
As I will be working on enabling crypto block on newer
Qualcomm SoCs, I will also help review and co-maintain
the same.

Cc: Bjorn Andersson <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b0556cd21f86..df5724cf608c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16945,6 +16945,7 @@ F: drivers/cpufreq/qcom-cpufreq-nvmem.c

QUALCOMM CRYPTO DRIVERS
M: Thara Gopinath <[email protected]>
+M: Bhupesh Sharma <[email protected]>
L: [email protected]
L: [email protected]
S: Maintained
--
2.37.1

2022-09-20 11:46:09

by Bhupesh Sharma

[permalink] [raw]
Subject: [PATCH v7 5/9] crypto: qce: core: Add support to initialize interconnect path

From: Thara Gopinath <[email protected]>

Crypto engine on certain Snapdragon processors like sm8150, sm8250, sm8350
etc. requires interconnect path between the engine and memory to be
explicitly enabled and bandwidth set prior to any operations. Add support
in the qce core to enable the interconnect path appropriately.

Cc: Bjorn Andersson <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Tested-by: Jordan Crouse <[email protected]>
Signed-off-by: Thara Gopinath <[email protected]>
Signed-off-by: Bhupesh Sharma <[email protected]>
[Bhupesh: Make header file inclusion alphabetical and use devm_of_icc_get()]
---
drivers/crypto/qce/core.c | 16 +++++++++++++++-
drivers/crypto/qce/core.h | 1 +
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index d3780be44a76..63be06df5519 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -5,6 +5,7 @@

#include <linux/clk.h>
#include <linux/dma-mapping.h>
+#include <linux/interconnect.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
@@ -22,6 +23,8 @@
#define QCE_MAJOR_VERSION5 0x05
#define QCE_QUEUE_LENGTH 1

+#define QCE_DEFAULT_MEM_BANDWIDTH 393600
+
static const struct qce_algo_ops *qce_ops[] = {
#ifdef CONFIG_CRYPTO_DEV_QCE_SKCIPHER
&skcipher_ops,
@@ -206,6 +209,10 @@ static int qce_crypto_probe(struct platform_device *pdev)
if (ret < 0)
return ret;

+ qce->mem_path = devm_of_icc_get(qce->dev, "memory");
+ if (IS_ERR(qce->mem_path))
+ return PTR_ERR(qce->mem_path);
+
qce->core = devm_clk_get(qce->dev, "core");
if (IS_ERR(qce->core))
return PTR_ERR(qce->core);
@@ -218,10 +225,14 @@ static int qce_crypto_probe(struct platform_device *pdev)
if (IS_ERR(qce->bus))
return PTR_ERR(qce->bus);

- ret = clk_prepare_enable(qce->core);
+ ret = icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH, QCE_DEFAULT_MEM_BANDWIDTH);
if (ret)
return ret;

+ ret = clk_prepare_enable(qce->core);
+ if (ret)
+ goto err_mem_path_disable;
+
ret = clk_prepare_enable(qce->iface);
if (ret)
goto err_clks_core;
@@ -260,6 +271,9 @@ static int qce_crypto_probe(struct platform_device *pdev)
clk_disable_unprepare(qce->iface);
err_clks_core:
clk_disable_unprepare(qce->core);
+err_mem_path_disable:
+ icc_set_bw(qce->mem_path, 0, 0);
+
return ret;
}

diff --git a/drivers/crypto/qce/core.h b/drivers/crypto/qce/core.h
index 085774cdf641..228fcd69ec51 100644
--- a/drivers/crypto/qce/core.h
+++ b/drivers/crypto/qce/core.h
@@ -35,6 +35,7 @@ struct qce_device {
void __iomem *base;
struct device *dev;
struct clk *core, *iface, *bus;
+ struct icc_path *mem_path;
struct qce_dma_data dma;
int burst_size;
unsigned int pipe_pair_id;
--
2.37.1

2022-09-20 15:14:18

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v7 4/9] dt-bindings: qcom-qce: Add new SoC compatible strings for qcom-qce

On 20/09/2022 13:40, Bhupesh Sharma wrote:
> Newer Qualcomm chips support newer versions of the qce crypto IP, so add
> soc specific compatible strings for qcom-qce instead of using crypto
> IP version specific ones.
>
> Keep the old strings for backward-compatibility, but mark them as
> deprecated.
>
> Cc: Bjorn Andersson <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>
> Tested-by: Jordan Crouse <[email protected]>
> Signed-off-by: Bhupesh Sharma <[email protected]>
> ---
> .../devicetree/bindings/crypto/qcom-qce.yaml | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
> index 4e00e7925fed..aa2f676f5382 100644
> --- a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
> +++ b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
> @@ -15,7 +15,15 @@ description:
>
> properties:
> compatible:
> - const: qcom,crypto-v5.1
> + enum:
> + - qcom,crypto-v5.1 # Deprecated. Kept only for backward compatibility

No changes since v6.


Best regards,
Krzysztof

2022-09-20 15:15:03

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v7 6/9] crypto: qce: core: Add new compatibles for qce crypto driver

On 20/09/2022 13:40, Bhupesh Sharma wrote:
> Since we decided to use soc specific compatibles for describing
> the qce crypto IP nodes in the device-trees, adapt the driver
> now to handle the same.
>
> Keep the old deprecated compatible strings still in the driver,
> to ensure backward compatibility.
>
> Cc: Bjorn Andersson <[email protected]>
> Cc: Rob Herring <[email protected]>
> Cc: [email protected]
> Tested-by: Jordan Crouse <[email protected]>
> Signed-off-by: Bhupesh Sharma <[email protected]>
> ---
> drivers/crypto/qce/core.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index 63be06df5519..99ed540611ab 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
> @@ -291,8 +291,17 @@ static int qce_crypto_remove(struct platform_device *pdev)
> }
>
> static const struct of_device_id qce_crypto_of_match[] = {
> + /* Following two entries are deprecated (kept only for backward compatibility) */
> { .compatible = "qcom,crypto-v5.1", },
> { .compatible = "qcom,crypto-v5.4", },

This is okay, so there is no ABI break.

> + /* Add compatible strings as per updated dt-bindings, here: */
> + { .compatible = "qcom,ipq4019-qce", },
> + { .compatible = "qcom,ipq6018-qce", },
> + { .compatible = "qcom,ipq8074-qce", },
> + { .compatible = "qcom,msm8996-qce", },
> + { .compatible = "qcom,sdm845-qce", },
> + { .compatible = "qcom,sm8150-qce", },
> + { .compatible = "qcom,sm8250-qce", },

This is a bit odd... you have 7 devices which are simply compatible or
even the same. This should be instead one compatible.

I don't really get why do you want to deprecate "qcom,crypto-v5.1".
Commit msg only says "we decided" but I do not know who is "we" and "why
we decided like this". If you want to deprecate it, perfectly fine by
me, but please say in commit msg why you are doing it.

Best regards,
Krzysztof

2022-09-21 06:08:13

by Bhupesh Sharma

[permalink] [raw]
Subject: Re: [PATCH v7 4/9] dt-bindings: qcom-qce: Add new SoC compatible strings for qcom-qce


On 9/20/22 8:40 PM, Krzysztof Kozlowski wrote:
> On 20/09/2022 13:40, Bhupesh Sharma wrote:
>> Newer Qualcomm chips support newer versions of the qce crypto IP, so add
>> soc specific compatible strings for qcom-qce instead of using crypto
>> IP version specific ones.
>>
>> Keep the old strings for backward-compatibility, but mark them as
>> deprecated.
>>
>> Cc: Bjorn Andersson <[email protected]>
>> Reviewed-by: Rob Herring <[email protected]>
>> Tested-by: Jordan Crouse <[email protected]>
>> Signed-off-by: Bhupesh Sharma <[email protected]>
>> ---
>> .../devicetree/bindings/crypto/qcom-qce.yaml | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
>> index 4e00e7925fed..aa2f676f5382 100644
>> --- a/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
>> +++ b/Documentation/devicetree/bindings/crypto/qcom-qce.yaml
>> @@ -15,7 +15,15 @@ description:
>>
>> properties:
>> compatible:
>> - const: qcom,crypto-v5.1
>> + enum:
>> + - qcom,crypto-v5.1 # Deprecated. Kept only for backward compatibility
>
> No changes since v6.

Right. v7 is just to propose the new subset of patchsets and ordering
(since we changed it from v5 - which was a single patchset) and get some
early feedback and comments and get to know if the respective
maintainers are fine with the patch ordering, cc-list etc.

I will surely include your comments in v8.

Thanks,
Bhupesh

2022-09-21 06:31:41

by Bhupesh Sharma

[permalink] [raw]
Subject: Re: [PATCH v7 6/9] crypto: qce: core: Add new compatibles for qce crypto driver



On 9/20/22 8:42 PM, Krzysztof Kozlowski wrote:
> On 20/09/2022 13:40, Bhupesh Sharma wrote:
>> Since we decided to use soc specific compatibles for describing
>> the qce crypto IP nodes in the device-trees, adapt the driver
>> now to handle the same.
>>
>> Keep the old deprecated compatible strings still in the driver,
>> to ensure backward compatibility.
>>
>> Cc: Bjorn Andersson <[email protected]>
>> Cc: Rob Herring <[email protected]>
>> Cc: [email protected]
>> Tested-by: Jordan Crouse <[email protected]>
>> Signed-off-by: Bhupesh Sharma <[email protected]>
>> ---
>> drivers/crypto/qce/core.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
>> index 63be06df5519..99ed540611ab 100644
>> --- a/drivers/crypto/qce/core.c
>> +++ b/drivers/crypto/qce/core.c
>> @@ -291,8 +291,17 @@ static int qce_crypto_remove(struct platform_device *pdev)
>> }
>>
>> static const struct of_device_id qce_crypto_of_match[] = {
>> + /* Following two entries are deprecated (kept only for backward compatibility) */
>> { .compatible = "qcom,crypto-v5.1", },
>> { .compatible = "qcom,crypto-v5.4", },
>
> This is okay, so there is no ABI break.

Great. Thanks for the confirmation.

>> + /* Add compatible strings as per updated dt-bindings, here: */
>> + { .compatible = "qcom,ipq4019-qce", },
>> + { .compatible = "qcom,ipq6018-qce", },
>> + { .compatible = "qcom,ipq8074-qce", },
>> + { .compatible = "qcom,msm8996-qce", },
>> + { .compatible = "qcom,sdm845-qce", },
>> + { .compatible = "qcom,sm8150-qce", },
>> + { .compatible = "qcom,sm8250-qce", },
>
> This is a bit odd... you have 7 devices which are simply compatible or
> even the same. This should be instead one compatible.
>
> I don't really get why do you want to deprecate "qcom,crypto-v5.1".
> Commit msg only says "we decided" but I do not know who is "we" and "why
> we decided like this". If you want to deprecate it, perfectly fine by
> me, but please say in commit msg why you are doing it.

I understand. This patchset has been in flight for some time and hence I
might have missed sharing some detailed information about the review
comments and rework done along the way (in the cover letter for this
series).

Coming back to your concern, here is the relevant background:
- Please see:
https://lore.kernel.org/linux-arm-msm/[email protected]/

- Rob shared some comments on the v1 series regarding the soc-specific
compatibles. He mentioned in the above thread that 'you should stick
with SoC specific compatibles as *everyone* else does (including most
QCom bindings).'

- So, while I had proposed "qcom,crypto-v5.1" (for ipq6018) and
"qcom,crypto-v5.4" (for sdm845, sm8150) etc. as the compatible(s) in the
v1 series, I shifted to using the soc-specific compatibles from the v2
series, onwards.

- Basically, since we are going to have newer qce IP versions available
in near future, e.g. "qcom,crypto-v5.5" etc, and we will have 2 or more
SoCs also sharing 1 version, these compatibles would grow and become
more confusing. IMO, having a soc-specific compatible in such cases is
probably a much cleaner approach.

Hope this helps answer some of your concerns and provides some relevant
background information.

Thanks,
Bhupesh

2022-09-21 06:31:42

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v7 6/9] crypto: qce: core: Add new compatibles for qce crypto driver

On 21/09/2022 08:16, Bhupesh Sharma wrote:
>
>
> On 9/20/22 8:42 PM, Krzysztof Kozlowski wrote:
>> On 20/09/2022 13:40, Bhupesh Sharma wrote:
>>> Since we decided to use soc specific compatibles for describing
>>> the qce crypto IP nodes in the device-trees, adapt the driver
>>> now to handle the same.
>>>
>>> Keep the old deprecated compatible strings still in the driver,
>>> to ensure backward compatibility.
>>>
>>> Cc: Bjorn Andersson <[email protected]>
>>> Cc: Rob Herring <[email protected]>
>>> Cc: [email protected]
>>> Tested-by: Jordan Crouse <[email protected]>
>>> Signed-off-by: Bhupesh Sharma <[email protected]>
>>> ---
>>> drivers/crypto/qce/core.c | 9 +++++++++
>>> 1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
>>> index 63be06df5519..99ed540611ab 100644
>>> --- a/drivers/crypto/qce/core.c
>>> +++ b/drivers/crypto/qce/core.c
>>> @@ -291,8 +291,17 @@ static int qce_crypto_remove(struct platform_device *pdev)
>>> }
>>>
>>> static const struct of_device_id qce_crypto_of_match[] = {
>>> + /* Following two entries are deprecated (kept only for backward compatibility) */
>>> { .compatible = "qcom,crypto-v5.1", },
>>> { .compatible = "qcom,crypto-v5.4", },
>>
>> This is okay, so there is no ABI break.
>
> Great. Thanks for the confirmation.
>
>>> + /* Add compatible strings as per updated dt-bindings, here: */
>>> + { .compatible = "qcom,ipq4019-qce", },
>>> + { .compatible = "qcom,ipq6018-qce", },
>>> + { .compatible = "qcom,ipq8074-qce", },
>>> + { .compatible = "qcom,msm8996-qce", },
>>> + { .compatible = "qcom,sdm845-qce", },
>>> + { .compatible = "qcom,sm8150-qce", },
>>> + { .compatible = "qcom,sm8250-qce", },
>>
>> This is a bit odd... you have 7 devices which are simply compatible or
>> even the same. This should be instead one compatible.
>>
>> I don't really get why do you want to deprecate "qcom,crypto-v5.1".
>> Commit msg only says "we decided" but I do not know who is "we" and "why
>> we decided like this". If you want to deprecate it, perfectly fine by
>> me, but please say in commit msg why you are doing it.
>
> I understand. This patchset has been in flight for some time and hence I
> might have missed sharing some detailed information about the review
> comments and rework done along the way (in the cover letter for this
> series).
>
> Coming back to your concern, here is the relevant background:
> - Please see:
> https://lore.kernel.org/linux-arm-msm/[email protected]/
>
> - Rob shared some comments on the v1 series regarding the soc-specific
> compatibles. He mentioned in the above thread that 'you should stick
> with SoC specific compatibles as *everyone* else does (including most
> QCom bindings).'
>
> - So, while I had proposed "qcom,crypto-v5.1" (for ipq6018) and
> "qcom,crypto-v5.4" (for sdm845, sm8150) etc. as the compatible(s) in the
> v1 series, I shifted to using the soc-specific compatibles from the v2
> series, onwards.

Then the reason could be - Reviewers preferred SoC-based compatible
instead of IP-block-version-based.

What is confusing is the difference between that link and here. That
link wanted to introduce 4 different compatibles... and here you have
even 7 compatibles being the same.

>
> - Basically, since we are going to have newer qce IP versions available
> in near future, e.g. "qcom,crypto-v5.5" etc, and we will have 2 or more
> SoCs also sharing 1 version, these compatibles would grow and become
> more confusing. IMO, having a soc-specific compatible in such cases is
> probably a much cleaner approach.
>
> Hope this helps answer some of your concerns and provides some relevant
> background information.

Sure, but I still think you should have only one compatible in the
driver in such case. You don't have differences between them from the
driver point of view, so the devices seem to be compatible.

If not, what are the differences?

Best regards,
Krzysztof

2022-09-21 06:56:53

by Bhupesh Sharma

[permalink] [raw]
Subject: Re: [PATCH v7 6/9] crypto: qce: core: Add new compatibles for qce crypto driver

On 9/21/22 11:57 AM, Krzysztof Kozlowski wrote:
> On 21/09/2022 08:16, Bhupesh Sharma wrote:
>>
>>
>> On 9/20/22 8:42 PM, Krzysztof Kozlowski wrote:
>>> On 20/09/2022 13:40, Bhupesh Sharma wrote:
>>>> Since we decided to use soc specific compatibles for describing
>>>> the qce crypto IP nodes in the device-trees, adapt the driver
>>>> now to handle the same.
>>>>
>>>> Keep the old deprecated compatible strings still in the driver,
>>>> to ensure backward compatibility.
>>>>
>>>> Cc: Bjorn Andersson <[email protected]>
>>>> Cc: Rob Herring <[email protected]>
>>>> Cc: [email protected]
>>>> Tested-by: Jordan Crouse <[email protected]>
>>>> Signed-off-by: Bhupesh Sharma <[email protected]>
>>>> ---
>>>> drivers/crypto/qce/core.c | 9 +++++++++
>>>> 1 file changed, 9 insertions(+)
>>>>
>>>> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
>>>> index 63be06df5519..99ed540611ab 100644
>>>> --- a/drivers/crypto/qce/core.c
>>>> +++ b/drivers/crypto/qce/core.c
>>>> @@ -291,8 +291,17 @@ static int qce_crypto_remove(struct platform_device *pdev)
>>>> }
>>>>
>>>> static const struct of_device_id qce_crypto_of_match[] = {
>>>> + /* Following two entries are deprecated (kept only for backward compatibility) */
>>>> { .compatible = "qcom,crypto-v5.1", },
>>>> { .compatible = "qcom,crypto-v5.4", },
>>>
>>> This is okay, so there is no ABI break.
>>
>> Great. Thanks for the confirmation.
>>
>>>> + /* Add compatible strings as per updated dt-bindings, here: */
>>>> + { .compatible = "qcom,ipq4019-qce", },
>>>> + { .compatible = "qcom,ipq6018-qce", },
>>>> + { .compatible = "qcom,ipq8074-qce", },
>>>> + { .compatible = "qcom,msm8996-qce", },
>>>> + { .compatible = "qcom,sdm845-qce", },
>>>> + { .compatible = "qcom,sm8150-qce", },
>>>> + { .compatible = "qcom,sm8250-qce", },
>>>
>>> This is a bit odd... you have 7 devices which are simply compatible or
>>> even the same. This should be instead one compatible.
>>>
>>> I don't really get why do you want to deprecate "qcom,crypto-v5.1".
>>> Commit msg only says "we decided" but I do not know who is "we" and "why
>>> we decided like this". If you want to deprecate it, perfectly fine by
>>> me, but please say in commit msg why you are doing it.
>>
>> I understand. This patchset has been in flight for some time and hence I
>> might have missed sharing some detailed information about the review
>> comments and rework done along the way (in the cover letter for this
>> series).
>>
>> Coming back to your concern, here is the relevant background:
>> - Please see:
>> https://lore.kernel.org/linux-arm-msm/[email protected]/
>>
>> - Rob shared some comments on the v1 series regarding the soc-specific
>> compatibles. He mentioned in the above thread that 'you should stick
>> with SoC specific compatibles as *everyone* else does (including most
>> QCom bindings).'
>>
>> - So, while I had proposed "qcom,crypto-v5.1" (for ipq6018) and
>> "qcom,crypto-v5.4" (for sdm845, sm8150) etc. as the compatible(s) in the
>> v1 series, I shifted to using the soc-specific compatibles from the v2
>> series, onwards.
>
> Then the reason could be - Reviewers preferred SoC-based compatible
> instead of IP-block-version-based.
>
> What is confusing is the difference between that link and here. That
> link wanted to introduce 4 different compatibles... and here you have
> even 7 compatibles being the same.

The link points to v1 version and we are on v7 currently. So there have
been other comments and reworks along the way :)

All of these have been referred to in the cover letter logs.

Again please refer to Vladimir's comments on v5 version here, where he
suggested adding soc compatibles for 'ipq8074' and 'msm8996' as well.

-
https://lore.kernel.org/lkml/[email protected]/
-
https://lore.kernel.org/lkml/[email protected]/
-
https://lore.kernel.org/lkml/[email protected]/

Also the 7 SoC compatibles do not point to the same crypto IP version.
We have two IP versions currently supported upstream, "qcom,crypto-v5.1"
and "qcom,crypto-v5.4" (with patches for support for newer versions
under work and can be expected to land upstream in near future).

However, if you suggest, we can add some comments in the dt-binding doc
to reflect which SoC supports which version.

>> - Basically, since we are going to have newer qce IP versions available
>> in near future, e.g. "qcom,crypto-v5.5" etc, and we will have 2 or more
>> SoCs also sharing 1 version, these compatibles would grow and become
>> more confusing. IMO, having a soc-specific compatible in such cases is
>> probably a much cleaner approach.
>>
>> Hope this helps answer some of your concerns and provides some relevant
>> background information.
>
> Sure, but I still think you should have only one compatible in the
> driver in such case. You don't have differences between them from the
> driver point of view, so the devices seem to be compatible.
>
> If not, what are the differences?

There can always be requirements for compatible specific handling done
in the driver. See Bjorn's comment here for example:
https://lore.kernel.org/lkml/[email protected]/ , as an
example of 'clk_get' calls conditional based on the compatible instead.

This series is to get some early comments and might need some further
rework / rearrangement.

However, I would request Rob to share his views as well on the soc
specific compatibles, since it was originally his suggestion. I can
rework the patchset accordingly.

Thanks,
Bhupesh