LKML Archive on lore.kernel.org help / color / mirror / Atom feed
* [PATCH 0/3] enable ccree on Renesas R-Car platform @ 2018-05-15 12:29 Gilad Ben-Yossef 2018-05-15 12:29 ` [PATCH 1/3] crypto: ccree: drop signature register check Gilad Ben-Yossef ` (2 more replies) 0 siblings, 3 replies; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-15 12:29 UTC (permalink / raw) To: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller Cc: Ofir Drang, linux-renesas-soc, devicetree, linux-arm-kernel, linux-kernel, linux-clk, linux-crypto The following patch set enables CryptoCell present in the Renesas R-Car SoC. Gilad Ben-Yossef (3): crypto: ccree: drop signature register check clk: renesas: r8a7795: Add ccree clock arm64: dts: renesas: r8a7795: add ccree binding arch/arm64/boot/dts/renesas/r8a7795.dtsi | 8 ++++++++ drivers/clk/renesas/r8a7795-cpg-mssr.c | 1 + drivers/crypto/ccree/cc_driver.c | 18 +++--------------- 3 files changed, 12 insertions(+), 15 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 1/3] crypto: ccree: drop signature register check 2018-05-15 12:29 [PATCH 0/3] enable ccree on Renesas R-Car platform Gilad Ben-Yossef @ 2018-05-15 12:29 ` Gilad Ben-Yossef 2018-05-17 12:54 ` Gilad Ben-Yossef 2018-05-15 12:29 ` [PATCH 2/3] clk: renesas: r8a7795: Add ccree clock Gilad Ben-Yossef 2018-05-15 12:29 ` [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding Gilad Ben-Yossef 2 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-15 12:29 UTC (permalink / raw) To: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller Cc: Ofir Drang, linux-renesas-soc, devicetree, linux-arm-kernel, linux-kernel, linux-clk, linux-crypto We were using the content of the signature register as a sanity check for the hardware functioning but it turns out not all implementers use the same values so the check is giving false negative on certain SoCs and so we drop it. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> --- drivers/crypto/ccree/cc_driver.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c index 89ce013..f8ff358 100644 --- a/drivers/crypto/ccree/cc_driver.c +++ b/drivers/crypto/ccree/cc_driver.c @@ -38,21 +38,20 @@ MODULE_PARM_DESC(cc_dump_bytes, "Dump buffers to kernel log as debugging aid"); struct cc_hw_data { char *name; enum cc_hw_rev rev; - u32 sig; }; /* Hardware revisions defs. */ static const struct cc_hw_data cc712_hw = { - .name = "712", .rev = CC_HW_REV_712, .sig = 0xDCC71200U + .name = "712", .rev = CC_HW_REV_712 }; static const struct cc_hw_data cc710_hw = { - .name = "710", .rev = CC_HW_REV_710, .sig = 0xDCC63200U + .name = "710", .rev = CC_HW_REV_710 }; static const struct cc_hw_data cc630p_hw = { - .name = "630P", .rev = CC_HW_REV_630, .sig = 0xDCC63000U + .name = "630P", .rev = CC_HW_REV_630 }; static const struct of_device_id arm_ccree_dev_of_match[] = { @@ -186,7 +185,6 @@ static int init_cc_resources(struct platform_device *plat_dev) struct cc_drvdata *new_drvdata; struct device *dev = &plat_dev->dev; struct device_node *np = dev->of_node; - u32 signature_val; u64 dma_mask; const struct cc_hw_data *hw_rev; const struct of_device_id *dev_id; @@ -275,16 +273,6 @@ static int init_cc_resources(struct platform_device *plat_dev) return rc; } - /* Verify correct mapping */ - signature_val = cc_ioread(new_drvdata, CC_REG(HOST_SIGNATURE)); - if (signature_val != hw_rev->sig) { - dev_err(dev, "Invalid CC signature: SIGNATURE=0x%08X != expected=0x%08X\n", - signature_val, hw_rev->sig); - rc = -EINVAL; - goto post_clk_err; - } - dev_dbg(dev, "CC SIGNATURE=0x%08X\n", signature_val); - /* Display HW versions */ dev_info(dev, "ARM CryptoCell %s Driver: HW version 0x%08X, Driver version %s\n", hw_rev->name, cc_ioread(new_drvdata, CC_REG(HOST_VERSION)), -- 2.7.4 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 1/3] crypto: ccree: drop signature register check 2018-05-15 12:29 ` [PATCH 1/3] crypto: ccree: drop signature register check Gilad Ben-Yossef @ 2018-05-17 12:54 ` Gilad Ben-Yossef 0 siblings, 0 replies; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-17 12:54 UTC (permalink / raw) To: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller Cc: Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux kernel mailing list, linux-clk, Linux Crypto Mailing List Herbert, On Tue, May 15, 2018 at 3:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > We were using the content of the signature register as a sanity > check for the hardware functioning but it turns out not all > implementers use the same values so the check is giving false > negative on certain SoCs and so we drop it. > Please drop this patch. I have found a better fix and will send a v2 soon. Thanks, Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 2/3] clk: renesas: r8a7795: Add ccree clock 2018-05-15 12:29 [PATCH 0/3] enable ccree on Renesas R-Car platform Gilad Ben-Yossef 2018-05-15 12:29 ` [PATCH 1/3] crypto: ccree: drop signature register check Gilad Ben-Yossef @ 2018-05-15 12:29 ` Gilad Ben-Yossef 2018-05-15 14:47 ` Geert Uytterhoeven 2018-05-15 12:29 ` [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding Gilad Ben-Yossef 2 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-15 12:29 UTC (permalink / raw) To: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller Cc: Ofir Drang, linux-renesas-soc, devicetree, linux-arm-kernel, linux-kernel, linux-clk, linux-crypto This patch adds the clock used by the CryptoCell 630p instance in the SoC. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> --- drivers/clk/renesas/r8a7795-cpg-mssr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c index 775b0ce..642706a 100644 --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c @@ -132,6 +132,7 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { DEF_MOD("sys-dmac2", 217, R8A7795_CLK_S0D3), DEF_MOD("sys-dmac1", 218, R8A7795_CLK_S0D3), DEF_MOD("sys-dmac0", 219, R8A7795_CLK_S0D3), + DEF_MOD("ccree", 229, R8A7795_CLK_S3D2), DEF_MOD("cmt3", 300, R8A7795_CLK_R), DEF_MOD("cmt2", 301, R8A7795_CLK_R), DEF_MOD("cmt1", 302, R8A7795_CLK_R), -- 2.7.4 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] clk: renesas: r8a7795: Add ccree clock 2018-05-15 12:29 ` [PATCH 2/3] clk: renesas: r8a7795: Add ccree clock Gilad Ben-Yossef @ 2018-05-15 14:47 ` Geert Uytterhoeven 2018-05-17 8:00 ` Gilad Ben-Yossef 0 siblings, 1 reply; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-15 14:47 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List Hi Gilad, On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > This patch adds the clock used by the CryptoCell 630p instance in the SoC. > > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Thanks for your patch! > --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c > +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c > @@ -132,6 +132,7 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { > DEF_MOD("sys-dmac2", 217, R8A7795_CLK_S0D3), > DEF_MOD("sys-dmac1", 218, R8A7795_CLK_S0D3), > DEF_MOD("sys-dmac0", 219, R8A7795_CLK_S0D3), > + DEF_MOD("ccree", 229, R8A7795_CLK_S3D2), I don't know if "ccree" is the proper name for this clock, as there may be multiple instances. I also can't verify the parent clock. > DEF_MOD("cmt3", 300, R8A7795_CLK_R), > DEF_MOD("cmt2", 301, R8A7795_CLK_R), > DEF_MOD("cmt1", 302, R8A7795_CLK_R), Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] clk: renesas: r8a7795: Add ccree clock 2018-05-15 14:47 ` Geert Uytterhoeven @ 2018-05-17 8:00 ` Gilad Ben-Yossef 2018-05-17 8:41 ` Geert Uytterhoeven 0 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-17 8:00 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Tue, May 15, 2018 at 5:47 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > Hi Gilad, > > On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >> This patch adds the clock used by the CryptoCell 630p instance in the SoC. >> >> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> > > Thanks for your patch! > >> --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c >> +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c >> @@ -132,6 +132,7 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { >> DEF_MOD("sys-dmac2", 217, R8A7795_CLK_S0D3), >> DEF_MOD("sys-dmac1", 218, R8A7795_CLK_S0D3), >> DEF_MOD("sys-dmac0", 219, R8A7795_CLK_S0D3), >> + DEF_MOD("ccree", 229, R8A7795_CLK_S3D2), > > I don't know if "ccree" is the proper name for this clock, as there > may be multiple > instances. I'd be happy to rename it to anything else. Suggestions? > I also can't verify the parent clock. I'm afraid I can't really help. This is based on code snippet from Renesas. I verified it works but I am not an expert on the clock settings :-( > >> DEF_MOD("cmt3", 300, R8A7795_CLK_R), >> DEF_MOD("cmt2", 301, R8A7795_CLK_R), >> DEF_MOD("cmt1", 302, R8A7795_CLK_R), > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] clk: renesas: r8a7795: Add ccree clock 2018-05-17 8:00 ` Gilad Ben-Yossef @ 2018-05-17 8:41 ` Geert Uytterhoeven 0 siblings, 0 replies; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-17 8:41 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List Hi Gilad, On Thu, May 17, 2018 at 10:00 AM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > On Tue, May 15, 2018 at 5:47 PM, Geert Uytterhoeven > <geert@linux-m68k.org> wrote: >> On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >>> This patch adds the clock used by the CryptoCell 630p instance in the SoC. >>> >>> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> >> >> Thanks for your patch! >> >>> --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c >>> +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c >>> @@ -132,6 +132,7 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { >>> DEF_MOD("sys-dmac2", 217, R8A7795_CLK_S0D3), >>> DEF_MOD("sys-dmac1", 218, R8A7795_CLK_S0D3), >>> DEF_MOD("sys-dmac0", 219, R8A7795_CLK_S0D3), >>> + DEF_MOD("ccree", 229, R8A7795_CLK_S3D2), >> >> I don't know if "ccree" is the proper name for this clock, as there >> may be multiple >> instances. > > I'd be happy to rename it to anything else. Suggestions? I believe it should be called "sceg-pub". >> I also can't verify the parent clock. > > I'm afraid I can't really help. This is based on code snippet from > Renesas. I verified it works but > I am not an expert on the clock settings :-( As your driver doesn't care about the clock rate, only about enabling/disabling the clock, the actual parent doesn't matter much. After some deeper diving into the datasheet, I believe the correct parent is the CR clock, which is unfortunately not yet supported by the R-Car H3 clock driver. I'll send a patch... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-15 12:29 [PATCH 0/3] enable ccree on Renesas R-Car platform Gilad Ben-Yossef 2018-05-15 12:29 ` [PATCH 1/3] crypto: ccree: drop signature register check Gilad Ben-Yossef 2018-05-15 12:29 ` [PATCH 2/3] clk: renesas: r8a7795: Add ccree clock Gilad Ben-Yossef @ 2018-05-15 12:29 ` Gilad Ben-Yossef 2018-05-15 14:50 ` Geert Uytterhoeven 2 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-15 12:29 UTC (permalink / raw) To: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller Cc: Ofir Drang, linux-renesas-soc, devicetree, linux-arm-kernel, linux-kernel, linux-clk, linux-crypto Add bindings for CryptoCell instance in the SoC. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> --- arch/arm64/boot/dts/renesas/r8a7795.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi index 91486b4..6c76841 100644 --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi @@ -528,6 +528,14 @@ status = "disabled"; }; + arm_cc630p: crypto@e6601000 { + compatible = "arm,cryptocell-630p-ree"; + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; + #interrupt-cells = <2>; + reg = <0x0 0xe6601000 0 0x1000>; + clocks = <&cpg CPG_MOD 229>; + }; + i2c3: i2c@e66d0000 { #address-cells = <1>; #size-cells = <0>; -- 2.7.4 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-15 12:29 ` [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding Gilad Ben-Yossef @ 2018-05-15 14:50 ` Geert Uytterhoeven 2018-05-16 7:43 ` Simon Horman 0 siblings, 1 reply; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-15 14:50 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List Hi Gilad, On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > Add bindings for CryptoCell instance in the SoC. > > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Thanks for your patch! > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi > @@ -528,6 +528,14 @@ > status = "disabled"; > }; > > + arm_cc630p: crypto@e6601000 { > + compatible = "arm,cryptocell-630p-ree"; > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; > + #interrupt-cells = <2>; I believe the #interrupt-cells property is not needed. > + reg = <0x0 0xe6601000 0 0x1000>; > + clocks = <&cpg CPG_MOD 229>; > + }; The rest looks good, but I cannot verify the register block. > + > i2c3: i2c@e66d0000 { > #address-cells = <1>; > #size-cells = <0>; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-15 14:50 ` Geert Uytterhoeven @ 2018-05-16 7:43 ` Simon Horman 2018-05-17 8:01 ` Gilad Ben-Yossef 0 siblings, 1 reply; 24+ messages in thread From: Simon Horman @ 2018-05-16 7:43 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Gilad Ben-Yossef, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Tue, May 15, 2018 at 04:50:44PM +0200, Geert Uytterhoeven wrote: > Hi Gilad, > > On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > > Add bindings for CryptoCell instance in the SoC. > > > > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> > > Thanks for your patch! > > > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi > > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi > > @@ -528,6 +528,14 @@ > > status = "disabled"; > > }; > > > > + arm_cc630p: crypto@e6601000 { > > + compatible = "arm,cryptocell-630p-ree"; > > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; > > + #interrupt-cells = <2>; > > I believe the #interrupt-cells property is not needed. > > > + reg = <0x0 0xe6601000 0 0x1000>; > > + clocks = <&cpg CPG_MOD 229>; > > + }; > > The rest looks good, but I cannot verify the register block. > > > + > > i2c3: i2c@e66d0000 { > > #address-cells = <1>; > > #size-cells = <0>; Thanks, I have applied this after dropping the #interrupt-cells property. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-16 7:43 ` Simon Horman @ 2018-05-17 8:01 ` Gilad Ben-Yossef 2018-05-17 9:04 ` Simon Horman 2018-05-17 10:16 ` Geert Uytterhoeven 0 siblings, 2 replies; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-17 8:01 UTC (permalink / raw) To: Simon Horman Cc: Geert Uytterhoeven, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Wed, May 16, 2018 at 10:43 AM, Simon Horman <horms@verge.net.au> wrote: > On Tue, May 15, 2018 at 04:50:44PM +0200, Geert Uytterhoeven wrote: >> Hi Gilad, >> >> On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >> > Add bindings for CryptoCell instance in the SoC. >> > >> > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> >> >> Thanks for your patch! >> >> > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi >> > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi >> > @@ -528,6 +528,14 @@ >> > status = "disabled"; >> > }; >> > >> > + arm_cc630p: crypto@e6601000 { >> > + compatible = "arm,cryptocell-630p-ree"; >> > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; >> > + #interrupt-cells = <2>; >> >> I believe the #interrupt-cells property is not needed. >> >> > + reg = <0x0 0xe6601000 0 0x1000>; >> > + clocks = <&cpg CPG_MOD 229>; >> > + }; >> >> The rest looks good, but I cannot verify the register block. >> >> > + >> > i2c3: i2c@e66d0000 { >> > #address-cells = <1>; >> > #size-cells = <0>; > > Thanks, I have applied this after dropping the #interrupt-cells property. Thanks you! Alas, it will not work without the clk patch (the previous one in the series) so they need to be taken or dropped together. Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 8:01 ` Gilad Ben-Yossef @ 2018-05-17 9:04 ` Simon Horman 2018-05-17 13:12 ` Gilad Ben-Yossef 2018-05-17 10:16 ` Geert Uytterhoeven 1 sibling, 1 reply; 24+ messages in thread From: Simon Horman @ 2018-05-17 9:04 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Geert Uytterhoeven, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Thu, May 17, 2018 at 11:01:57AM +0300, Gilad Ben-Yossef wrote: > On Wed, May 16, 2018 at 10:43 AM, Simon Horman <horms@verge.net.au> wrote: > > On Tue, May 15, 2018 at 04:50:44PM +0200, Geert Uytterhoeven wrote: > >> Hi Gilad, > >> > >> On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > >> > Add bindings for CryptoCell instance in the SoC. > >> > > >> > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> > >> > >> Thanks for your patch! > >> > >> > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi > >> > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi > >> > @@ -528,6 +528,14 @@ > >> > status = "disabled"; > >> > }; > >> > > >> > + arm_cc630p: crypto@e6601000 { > >> > + compatible = "arm,cryptocell-630p-ree"; > >> > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; > >> > + #interrupt-cells = <2>; > >> > >> I believe the #interrupt-cells property is not needed. > >> > >> > + reg = <0x0 0xe6601000 0 0x1000>; > >> > + clocks = <&cpg CPG_MOD 229>; > >> > + }; > >> > >> The rest looks good, but I cannot verify the register block. > >> > >> > + > >> > i2c3: i2c@e66d0000 { > >> > #address-cells = <1>; > >> > #size-cells = <0>; > > > > Thanks, I have applied this after dropping the #interrupt-cells property. > > Thanks you! > > Alas, it will not work without the clk patch (the previous one in the > series) so they need to be > taken or dropped together. I think its fine if it does not yet work. But not if its causes things that previously worked to stop working. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 9:04 ` Simon Horman @ 2018-05-17 13:12 ` Gilad Ben-Yossef 2018-05-18 9:50 ` Simon Horman 0 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-17 13:12 UTC (permalink / raw) To: Simon Horman Cc: Geert Uytterhoeven, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Thu, May 17, 2018 at 12:04 PM, Simon Horman <horms@verge.net.au> wrote: > On Thu, May 17, 2018 at 11:01:57AM +0300, Gilad Ben-Yossef wrote: >> On Wed, May 16, 2018 at 10:43 AM, Simon Horman <horms@verge.net.au> wrote: >> > On Tue, May 15, 2018 at 04:50:44PM +0200, Geert Uytterhoeven wrote: >> >> Hi Gilad, >> >> >> >> On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >> >> > Add bindings for CryptoCell instance in the SoC. >> >> > >> >> > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> >> >> >> >> Thanks for your patch! >> >> >> >> > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi >> >> > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi >> >> > @@ -528,6 +528,14 @@ >> >> > status = "disabled"; >> >> > }; >> >> > >> >> > + arm_cc630p: crypto@e6601000 { >> >> > + compatible = "arm,cryptocell-630p-ree"; >> >> > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; >> >> > + #interrupt-cells = <2>; >> >> >> >> I believe the #interrupt-cells property is not needed. >> >> >> >> > + reg = <0x0 0xe6601000 0 0x1000>; >> >> > + clocks = <&cpg CPG_MOD 229>; >> >> > + }; >> >> >> >> The rest looks good, but I cannot verify the register block. >> >> >> >> > + >> >> > i2c3: i2c@e66d0000 { >> >> > #address-cells = <1>; >> >> > #size-cells = <0>; >> > >> > Thanks, I have applied this after dropping the #interrupt-cells property. >> >> Thanks you! >> >> Alas, it will not work without the clk patch (the previous one in the >> series) so they need to be >> taken or dropped together. > > I think its fine if it does not yet work. > But not if its causes things that previously worked to stop working. Based on the further discussion with Geert my recommendation is to drop my patch for now, take Geert CR clock patch and I will follow up next week with a v2 that fixes the clock handing as discussed with Geert. Many thanks, Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 13:12 ` Gilad Ben-Yossef @ 2018-05-18 9:50 ` Simon Horman 0 siblings, 0 replies; 24+ messages in thread From: Simon Horman @ 2018-05-18 9:50 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Geert Uytterhoeven, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Thu, May 17, 2018 at 04:12:23PM +0300, Gilad Ben-Yossef wrote: > On Thu, May 17, 2018 at 12:04 PM, Simon Horman <horms@verge.net.au> wrote: > > On Thu, May 17, 2018 at 11:01:57AM +0300, Gilad Ben-Yossef wrote: > >> On Wed, May 16, 2018 at 10:43 AM, Simon Horman <horms@verge.net.au> wrote: > >> > On Tue, May 15, 2018 at 04:50:44PM +0200, Geert Uytterhoeven wrote: > >> >> Hi Gilad, > >> >> > >> >> On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > >> >> > Add bindings for CryptoCell instance in the SoC. > >> >> > > >> >> > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> > >> >> > >> >> Thanks for your patch! > >> >> > >> >> > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi > >> >> > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi > >> >> > @@ -528,6 +528,14 @@ > >> >> > status = "disabled"; > >> >> > }; > >> >> > > >> >> > + arm_cc630p: crypto@e6601000 { > >> >> > + compatible = "arm,cryptocell-630p-ree"; > >> >> > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; > >> >> > + #interrupt-cells = <2>; > >> >> > >> >> I believe the #interrupt-cells property is not needed. > >> >> > >> >> > + reg = <0x0 0xe6601000 0 0x1000>; > >> >> > + clocks = <&cpg CPG_MOD 229>; > >> >> > + }; > >> >> > >> >> The rest looks good, but I cannot verify the register block. > >> >> > >> >> > + > >> >> > i2c3: i2c@e66d0000 { > >> >> > #address-cells = <1>; > >> >> > #size-cells = <0>; > >> > > >> > Thanks, I have applied this after dropping the #interrupt-cells property. > >> > >> Thanks you! > >> > >> Alas, it will not work without the clk patch (the previous one in the > >> series) so they need to be > >> taken or dropped together. > > > > I think its fine if it does not yet work. > > But not if its causes things that previously worked to stop working. > > Based on the further discussion with Geert my recommendation is to > drop my patch for now, > take Geert CR clock patch and I will follow up next week with a v2 > that fixes the clock > handing as discussed with Geert. Thanks, I will drop the patch. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 8:01 ` Gilad Ben-Yossef 2018-05-17 9:04 ` Simon Horman @ 2018-05-17 10:16 ` Geert Uytterhoeven 2018-05-17 13:09 ` Gilad Ben-Yossef ` (2 more replies) 1 sibling, 3 replies; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-17 10:16 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List Hi Gilad, On Thu, May 17, 2018 at 10:01 AM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > On Wed, May 16, 2018 at 10:43 AM, Simon Horman <horms@verge.net.au> wrote: >> On Tue, May 15, 2018 at 04:50:44PM +0200, Geert Uytterhoeven wrote: >>> On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >>> > Add bindings for CryptoCell instance in the SoC. >>> > >>> > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> >>> >>> Thanks for your patch! >>> >>> > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi >>> > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi >>> > @@ -528,6 +528,14 @@ >>> > status = "disabled"; >>> > }; >>> > >>> > + arm_cc630p: crypto@e6601000 { >>> > + compatible = "arm,cryptocell-630p-ree"; >>> > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; >>> > + #interrupt-cells = <2>; >>> >>> I believe the #interrupt-cells property is not needed. >>> >>> > + reg = <0x0 0xe6601000 0 0x1000>; >>> > + clocks = <&cpg CPG_MOD 229>; Missing "power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;", as the Secure Engine is part of the CPG/MSSR clock domain (see below [*]). >>> > + }; >>> >>> The rest looks good, but I cannot verify the register block. >>> >>> > + >>> > i2c3: i2c@e66d0000 { >>> > #address-cells = <1>; >>> > #size-cells = <0>; >> >> Thanks, I have applied this after dropping the #interrupt-cells property. > > Thanks you! > > Alas, it will not work without the clk patch (the previous one in the > series) so they need to be > taken or dropped together. Indeed. From a quick glance, it looks like drivers/crypto/ccree/cc_driver.c does not distinguish between the absence of the clock property, and an actual error in getting the clock, and never considers any error a failure (incl. -PROBE_DEFER). As of_clk_get() returns -ENOENT for both a missing clock property and a missing clock, you should use (devm_)clk_get() instead, and distinguish between NULL (no clock property) and IS_ERR() (actual failure -> abort). Hence in the absence of the clock patch, the driver accesses the crypto engine while its module clock is turned off, leading to: ccree e6601000.crypto: Invalid CC signature: SIGNATURE=0x00000000 != expected=0xDCC63000 You must be lucky, though, usually you get an imprecise external abort later, crashing the whole system ;-) So I think this patch should be dropped for now. However, even with your clock patch, the signature checking fails for me, on both R-Car H3 ES1.0 and ES2.0. Does this need changes to the ARM Trusted Firmware, to allow Linux to access the public SCEG module? [*] More on the subject of clock control: At least for Renesas SoCs, where the module is part of a clock domain, and can be controlled automatically by Runtime PM, you could drop the explicit clock control, and use Runtime PM instead (pm_runtime_{enable,get_sync,put,disable}()). That would allow the driver to work on systems with any kind of PM Domains, too. Depending on the other platforms that include a CryptoCell and their (non)reliance on PM Domains, you may have to keep the explicit clock handling, in addition to Runtime PM. To decrease power consumption, I suggest to move the clock and/or Runtime PM handling to the routines that actually use the hardware, instead of powering the module in the probe routine. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 10:16 ` Geert Uytterhoeven @ 2018-05-17 13:09 ` Gilad Ben-Yossef 2018-05-17 13:35 ` Geert Uytterhoeven 2018-05-17 13:17 ` Geert Uytterhoeven 2018-05-21 13:43 ` Gilad Ben-Yossef 2 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-17 13:09 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Thu, May 17, 2018 at 1:16 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > Hi Gilad, > > On Thu, May 17, 2018 at 10:01 AM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >> On Wed, May 16, 2018 at 10:43 AM, Simon Horman <horms@verge.net.au> wrote: >>> On Tue, May 15, 2018 at 04:50:44PM +0200, Geert Uytterhoeven wrote: >>>> On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >>>> > Add bindings for CryptoCell instance in the SoC. >>>> > >>>> > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> >>>> >>>> Thanks for your patch! >>>> >>>> > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi >>>> > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi >>>> > @@ -528,6 +528,14 @@ >>>> > status = "disabled"; >>>> > }; >>>> > >>>> > + arm_cc630p: crypto@e6601000 { >>>> > + compatible = "arm,cryptocell-630p-ree"; >>>> > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; >>>> > + #interrupt-cells = <2>; >>>> >>>> I believe the #interrupt-cells property is not needed. >>>> >>>> > + reg = <0x0 0xe6601000 0 0x1000>; >>>> > + clocks = <&cpg CPG_MOD 229>; > > Missing "power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;", as > the Secure Engine is part of the CPG/MSSR clock domain (see below [*]). Thank you. I didn't get this information from Renesas :-) > >>>> > + }; >>>> >>>> The rest looks good, but I cannot verify the register block. >>>> >>>> > + >>>> > i2c3: i2c@e66d0000 { >>>> > #address-cells = <1>; >>>> > #size-cells = <0>; >>> >>> Thanks, I have applied this after dropping the #interrupt-cells property. >> >> Thanks you! >> >> Alas, it will not work without the clk patch (the previous one in the >> series) so they need to be >> taken or dropped together. > > Indeed. From a quick glance, it looks like drivers/crypto/ccree/cc_driver.c > does not distinguish between the absence of the clock property, and an > actual error in getting the clock, and never considers any error a failure > (incl. -PROBE_DEFER). > > As of_clk_get() returns -ENOENT for both a missing clock property and a > missing clock, you should use (devm_)clk_get() instead, and distinguish > between NULL (no clock property) and IS_ERR() (actual failure -> abort). > Thank you, this is very valuable. I will do as you suggested. > Hence in the absence of the clock patch, the driver accesses the crypto > engine while its module clock is turned off, leading to: > > ccree e6601000.crypto: Invalid CC signature: SIGNATURE=0x00000000 > != expected=0xDCC63000 > > You must be lucky, though, usually you get an imprecise external abort > later, crashing the whole system ;-) > > So I think this patch should be dropped for now. > > However, even with your clock patch, the signature checking fails for me, > on both R-Car H3 ES1.0 and ES2.0. > Does this need changes to the ARM Trusted Firmware, to allow Linux to > access the public SCEG module? Well, this is actually something different. If you look you will notice that my patch was part of a 3 part patch series, the first of which disabled this test. If you take all the 3 patches, it will work. To make things more interesting, I have since sending the patch learned WHY the test does not work, so disabling it is not needed - to make a long story short, I was reading the wrong register that just happens to have the right value in our FPGA based tests systems but does not in the real silicon implementations. But you are right - if the clock is not enabled and you are try to read from the register the system does freeze. I will send a fixed v2. based on your patch enabling the CR clock. > > [*] More on the subject of clock control: > At least for Renesas SoCs, where the module is part of a clock domain, and > can be controlled automatically by Runtime PM, you could drop the explicit > clock control, and use Runtime PM instead > (pm_runtime_{enable,get_sync,put,disable}()). That would allow the driver > to work on systems with any kind of PM Domains, too. > Depending on the other platforms that include a CryptoCell and their > (non)reliance on PM Domains, you may have to keep the explicit clock > handling, in addition to Runtime PM. > > To decrease power consumption, I suggest to move the clock and/or Runtime > PM handling to the routines that actually use the hardware, instead of > powering the module in the probe routine. > This is very interesting and I will give it a try. Thanks again! Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 13:09 ` Gilad Ben-Yossef @ 2018-05-17 13:35 ` Geert Uytterhoeven 2018-05-17 13:41 ` Gilad Ben-Yossef 0 siblings, 1 reply; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-17 13:35 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List Hi Gilad, On Thu, May 17, 2018 at 3:09 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > On Thu, May 17, 2018 at 1:16 PM, Geert Uytterhoeven > <geert@linux-m68k.org> wrote: >> However, even with your clock patch, the signature checking fails for me, >> on both R-Car H3 ES1.0 and ES2.0. >> Does this need changes to the ARM Trusted Firmware, to allow Linux to >> access the public SCEG module? > > Well, this is actually something different. If you look you will > notice that my patch was part of a 3 part patch series, > the first of which disabled this test. Sorry, I had completely forgotten about the first patch from the series. With that applied, it continues: ccree e6601000.crypto: ARM CryptoCell 630P Driver: HW version 0x00000000, Driver version 4.0 ccree e6601000.crypto: Cache params previous: 0x00000777 ccree e6601000.crypto: Cache params current: 0x00000000 (expect: 0x00000000) alg: No test for cts1(cbc(aes)) (cts1-cbc-aes-ccree) alg: No test for authenc(xcbc(aes),cbc(aes)) (authenc-xcbc-aes-cbc-aes-ccree) alg: No test for authenc(xcbc(aes),rfc3686(ctr(aes))) (authenc-xcbc-aes-rfc3686-ctr-aes-ccree) ccree e6601000.crypto: ARM ccree device initialized Is HW version 0x00000000 expected? > If you take all the 3 patches, it will work. is there an easy way to test proper operation? I enabled CONFIG_CRYPT_TEST, and did insmod tcrypt.ko, but I mostly see "Failed to load transform" messages. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 13:35 ` Geert Uytterhoeven @ 2018-05-17 13:41 ` Gilad Ben-Yossef 2018-05-17 13:49 ` Geert Uytterhoeven 0 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-17 13:41 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Thu, May 17, 2018 at 4:35 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > Hi Gilad, > > On Thu, May 17, 2018 at 3:09 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >> On Thu, May 17, 2018 at 1:16 PM, Geert Uytterhoeven >> <geert@linux-m68k.org> wrote: >>> However, even with your clock patch, the signature checking fails for me, >>> on both R-Car H3 ES1.0 and ES2.0. >>> Does this need changes to the ARM Trusted Firmware, to allow Linux to >>> access the public SCEG module? >> >> Well, this is actually something different. If you look you will >> notice that my patch was part of a 3 part patch series, >> the first of which disabled this test. > > Sorry, I had completely forgotten about the first patch from the series. > With that applied, it continues: > > ccree e6601000.crypto: ARM CryptoCell 630P Driver: HW version > 0x00000000, Driver version 4.0 > ccree e6601000.crypto: Cache params previous: 0x00000777 > ccree e6601000.crypto: Cache params current: 0x00000000 > (expect: 0x00000000) > alg: No test for cts1(cbc(aes)) (cts1-cbc-aes-ccree) > alg: No test for authenc(xcbc(aes),cbc(aes)) > (authenc-xcbc-aes-cbc-aes-ccree) > alg: No test for authenc(xcbc(aes),rfc3686(ctr(aes))) > (authenc-xcbc-aes-rfc3686-ctr-aes-ccree) > ccree e6601000.crypto: ARM ccree device initialized > > Is HW version 0x00000000 expected? It's related to the problem with reading the wrong register I've mentioned before. > >> If you take all the 3 patches, it will work. > > is there an easy way to test proper operation? The lines of the form " alg: No test for cts1(cbc(aes)) (cts1-cbc-aes-ccree)" indicates you have the Crypto API testmgr enable (or rather not disabled would be more accurate) so every cryptographic algorithm except those specified in these messages was tested with test vectors from crypto/testmgr.c upon registration. If you don't seen failure warnings, it works. You can also check /proc/crypto for all the algorithm with ccree listed as their driver and check that their test passed. > I enabled CONFIG_CRYPT_TEST, and did insmod tcrypt.ko, but I mostly see > "Failed to load transform" messages. > tcrypt.ko is a rather crude developer tool. It has hard coded lists of test for different algorithms that does not take into account if some crypto algs are enagled in the build or not. It's more of a stress test. Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 13:41 ` Gilad Ben-Yossef @ 2018-05-17 13:49 ` Geert Uytterhoeven 0 siblings, 0 replies; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-17 13:49 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List Hi Gilad, On Thu, May 17, 2018 at 3:41 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > On Thu, May 17, 2018 at 4:35 PM, Geert Uytterhoeven > <geert@linux-m68k.org> wrote: >> On Thu, May 17, 2018 at 3:09 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >>> On Thu, May 17, 2018 at 1:16 PM, Geert Uytterhoeven >>> <geert@linux-m68k.org> wrote: >>>> However, even with your clock patch, the signature checking fails for me, >>>> on both R-Car H3 ES1.0 and ES2.0. >>>> Does this need changes to the ARM Trusted Firmware, to allow Linux to >>>> access the public SCEG module? >>> >>> Well, this is actually something different. If you look you will >>> notice that my patch was part of a 3 part patch series, >>> the first of which disabled this test. >> >> Sorry, I had completely forgotten about the first patch from the series. >> With that applied, it continues: >> >> ccree e6601000.crypto: ARM CryptoCell 630P Driver: HW version >> 0x00000000, Driver version 4.0 >> ccree e6601000.crypto: Cache params previous: 0x00000777 >> ccree e6601000.crypto: Cache params current: 0x00000000 >> (expect: 0x00000000) >> alg: No test for cts1(cbc(aes)) (cts1-cbc-aes-ccree) >> alg: No test for authenc(xcbc(aes),cbc(aes)) >> (authenc-xcbc-aes-cbc-aes-ccree) >> alg: No test for authenc(xcbc(aes),rfc3686(ctr(aes))) >> (authenc-xcbc-aes-rfc3686-ctr-aes-ccree) >> ccree e6601000.crypto: ARM ccree device initialized >> >> Is HW version 0x00000000 expected? > > It's related to the problem with reading the wrong register I've > mentioned before. OK. >>> If you take all the 3 patches, it will work. >> >> is there an easy way to test proper operation? > > The lines of the form " alg: No test for cts1(cbc(aes)) > (cts1-cbc-aes-ccree)" indicates > you have the Crypto API testmgr enable (or rather not disabled would > be more accurate) so every > cryptographic algorithm except those specified in these messages was > tested with test > vectors from crypto/testmgr.c upon registration. If you don't seen > failure warnings, it works. OK. > You can also check /proc/crypto for all the algorithm with ccree > listed as their driver and check > that their test passed. OK, in that case everything works as expected, on both R-Car H3 ES1.0 and ES2.0. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 10:16 ` Geert Uytterhoeven 2018-05-17 13:09 ` Gilad Ben-Yossef @ 2018-05-17 13:17 ` Geert Uytterhoeven 2018-05-21 13:43 ` Gilad Ben-Yossef 2 siblings, 0 replies; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-17 13:17 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Thu, May 17, 2018 at 12:16 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Thu, May 17, 2018 at 10:01 AM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >> On Wed, May 16, 2018 at 10:43 AM, Simon Horman <horms@verge.net.au> wrote: >>> On Tue, May 15, 2018 at 04:50:44PM +0200, Geert Uytterhoeven wrote: >>>> On Tue, May 15, 2018 at 2:29 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >>>> > Add bindings for CryptoCell instance in the SoC. >>>> > >>>> > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> >>>> >>>> Thanks for your patch! >>>> >>>> > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi >>>> > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi >>>> > @@ -528,6 +528,14 @@ >>>> > status = "disabled"; >>>> > }; >>>> > >>>> > + arm_cc630p: crypto@e6601000 { >>>> > + compatible = "arm,cryptocell-630p-ree"; >>>> > + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; >>>> > + #interrupt-cells = <2>; >>>> >>>> I believe the #interrupt-cells property is not needed. >>>> >>>> > + reg = <0x0 0xe6601000 0 0x1000>; >>>> > + clocks = <&cpg CPG_MOD 229>; > > Missing "power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;", as > the Secure Engine is part of the CPG/MSSR clock domain (see below [*]). And missing "resets = <&cpg 229>;", as the module is tied to the CPG/MSSR reset controller. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-17 10:16 ` Geert Uytterhoeven 2018-05-17 13:09 ` Gilad Ben-Yossef 2018-05-17 13:17 ` Geert Uytterhoeven @ 2018-05-21 13:43 ` Gilad Ben-Yossef 2018-05-22 7:48 ` Geert Uytterhoeven 2 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-21 13:43 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Thu, May 17, 2018 at 1:16 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > Indeed. From a quick glance, it looks like drivers/crypto/ccree/cc_driver.c > does not distinguish between the absence of the clock property, and an > actual error in getting the clock, and never considers any error a failure > (incl. -PROBE_DEFER). > > As of_clk_get() returns -ENOENT for both a missing clock property and a > missing clock, you should use (devm_)clk_get() instead, and distinguish > between NULL (no clock property) and IS_ERR() (actual failure -> abort). > I was trying to do as you suggested but I didn't quite get what is the dev_id (2nd) parameter to devm_clk_get parameter is supposed to be. I see what of_clk_get() is doing, so can replicate that but it seems an over kill. Any ideas? Thanks, Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-21 13:43 ` Gilad Ben-Yossef @ 2018-05-22 7:48 ` Geert Uytterhoeven 2018-05-24 13:20 ` Gilad Ben-Yossef 0 siblings, 1 reply; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-22 7:48 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List Hi Gilad, On Mon, May 21, 2018 at 3:43 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > On Thu, May 17, 2018 at 1:16 PM, Geert Uytterhoeven > <geert@linux-m68k.org> wrote: >> Indeed. From a quick glance, it looks like drivers/crypto/ccree/cc_driver.c >> does not distinguish between the absence of the clock property, and an >> actual error in getting the clock, and never considers any error a failure >> (incl. -PROBE_DEFER). >> >> As of_clk_get() returns -ENOENT for both a missing clock property and a >> missing clock, you should use (devm_)clk_get() instead, and distinguish >> between NULL (no clock property) and IS_ERR() (actual failure -> abort). > > I was trying to do as you suggested but I didn't quite get what is the > dev_id (2nd) parameter to devm_clk_get parameter is supposed to be. It's the (optional) name of the clock, helpful in case there is more than one. In your case, NULL is fine. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-22 7:48 ` Geert Uytterhoeven @ 2018-05-24 13:20 ` Gilad Ben-Yossef 2018-05-24 13:44 ` Geert Uytterhoeven 0 siblings, 1 reply; 24+ messages in thread From: Gilad Ben-Yossef @ 2018-05-24 13:20 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List On Tue, May 22, 2018 at 10:48 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > Hi Gilad, > > On Mon, May 21, 2018 at 3:43 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >> On Thu, May 17, 2018 at 1:16 PM, Geert Uytterhoeven >> <geert@linux-m68k.org> wrote: >>> Indeed. From a quick glance, it looks like drivers/crypto/ccree/cc_driver.c >>> does not distinguish between the absence of the clock property, and an >>> actual error in getting the clock, and never considers any error a failure >>> (incl. -PROBE_DEFER). >>> >>> As of_clk_get() returns -ENOENT for both a missing clock property and a >>> missing clock, you should use (devm_)clk_get() instead, and distinguish >>> between NULL (no clock property) and IS_ERR() (actual failure -> abort). >> >> I was trying to do as you suggested but I didn't quite get what is the >> dev_id (2nd) parameter to devm_clk_get parameter is supposed to be. > > It's the (optional) name of the clock, helpful in case there is more than one. > In your case, NULL is fine. > I have assumed as much and tried it, it did not work and so I assumed I am missing something and asked you. It turns out I was missing the fact I was using the wrong device tree file... :-( So thanks, it works now :-) Having said that, while using devm)clk_get() is a better approach, it does not seems to distinguish between no "clocks" and a failure to clock information - it returns ENOENT in both cases as well. Thanks, Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding 2018-05-24 13:20 ` Gilad Ben-Yossef @ 2018-05-24 13:44 ` Geert Uytterhoeven 0 siblings, 0 replies; 24+ messages in thread From: Geert Uytterhoeven @ 2018-05-24 13:44 UTC (permalink / raw) To: Gilad Ben-Yossef Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Herbert Xu, David S. Miller, Ofir Drang, Linux-Renesas, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux ARM, Linux Kernel Mailing List, linux-clk, Linux Crypto Mailing List Hi Gilad, On Thu, May 24, 2018 at 3:20 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: > On Tue, May 22, 2018 at 10:48 AM, Geert Uytterhoeven > <geert@linux-m68k.org> wrote: >> On Mon, May 21, 2018 at 3:43 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote: >>> On Thu, May 17, 2018 at 1:16 PM, Geert Uytterhoeven >>> <geert@linux-m68k.org> wrote: >>>> Indeed. From a quick glance, it looks like drivers/crypto/ccree/cc_driver.c >>>> does not distinguish between the absence of the clock property, and an >>>> actual error in getting the clock, and never considers any error a failure >>>> (incl. -PROBE_DEFER). >>>> >>>> As of_clk_get() returns -ENOENT for both a missing clock property and a >>>> missing clock, you should use (devm_)clk_get() instead, and distinguish >>>> between NULL (no clock property) and IS_ERR() (actual failure -> abort). >>> >>> I was trying to do as you suggested but I didn't quite get what is the >>> dev_id (2nd) parameter to devm_clk_get parameter is supposed to be. >> >> It's the (optional) name of the clock, helpful in case there is more than one. >> In your case, NULL is fine. > > I have assumed as much and tried it, it did not work and so I assumed > I am missing something and asked you. > It turns out I was missing the fact I was using the wrong device tree > file... :-( > > So thanks, it works now :-) Glad to hear that! > Having said that, while using devm)clk_get() is a better approach, it > does not seems to distinguish > between no "clocks" and a failure to clock information - it returns > ENOENT in both cases as well. Oh right, I guess I'm too used to not even getting that far due to the PM Domain code failing to obtain the clock... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2018-05-24 13:44 UTC | newest] Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-05-15 12:29 [PATCH 0/3] enable ccree on Renesas R-Car platform Gilad Ben-Yossef 2018-05-15 12:29 ` [PATCH 1/3] crypto: ccree: drop signature register check Gilad Ben-Yossef 2018-05-17 12:54 ` Gilad Ben-Yossef 2018-05-15 12:29 ` [PATCH 2/3] clk: renesas: r8a7795: Add ccree clock Gilad Ben-Yossef 2018-05-15 14:47 ` Geert Uytterhoeven 2018-05-17 8:00 ` Gilad Ben-Yossef 2018-05-17 8:41 ` Geert Uytterhoeven 2018-05-15 12:29 ` [PATCH 3/3] arm64: dts: renesas: r8a7795: add ccree binding Gilad Ben-Yossef 2018-05-15 14:50 ` Geert Uytterhoeven 2018-05-16 7:43 ` Simon Horman 2018-05-17 8:01 ` Gilad Ben-Yossef 2018-05-17 9:04 ` Simon Horman 2018-05-17 13:12 ` Gilad Ben-Yossef 2018-05-18 9:50 ` Simon Horman 2018-05-17 10:16 ` Geert Uytterhoeven 2018-05-17 13:09 ` Gilad Ben-Yossef 2018-05-17 13:35 ` Geert Uytterhoeven 2018-05-17 13:41 ` Gilad Ben-Yossef 2018-05-17 13:49 ` Geert Uytterhoeven 2018-05-17 13:17 ` Geert Uytterhoeven 2018-05-21 13:43 ` Gilad Ben-Yossef 2018-05-22 7:48 ` Geert Uytterhoeven 2018-05-24 13:20 ` Gilad Ben-Yossef 2018-05-24 13:44 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).