* [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip
@ 2019-06-06 13:24 Krzysztof Michonski
2019-06-06 13:24 ` [PATCH 2/2] Enable secure monitor on gxl Krzysztof Michonski
2019-06-07 20:27 ` [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip Martin Blumenstingl
0 siblings, 2 replies; 7+ messages in thread
From: Krzysztof Michonski @ 2019-06-06 13:24 UTC (permalink / raw)
To: khilman, linux-amlogic, devicetree; +Cc: Krzysztof Michonski, afenkart
From: Krzysztof Michonski <michonskikrzysztof@gmail.com>
Extend the meson_sm driver by adding gxl structure and SECURITY_KEY
commands.
Signed-off-by: Krzysztof Michonski <michonskikrzysztof@gmail.com>
---
drivers/firmware/meson/meson_sm.c | 14 ++++++++++++++
include/linux/firmware/meson/meson_sm.h | 3 +++
2 files changed, 17 insertions(+)
diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index 29fbc818a573..b19489f759fc 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -54,6 +54,19 @@ struct meson_sm_chip gxbb_chip = {
},
};
+struct meson_sm_chip gxl_chip = {
+ .shmem_size = SZ_4K,
+ .cmd_shmem_in_base = 0x82000023,
+ .cmd_shmem_out_base = 0x82000024,
+ .cmd = {
+ CMD(SM_SECURITY_KEY_READ, 0x82000061),
+ CMD(SM_SECURITY_KEY_WRITE, 0x82000062),
+ CMD(SM_SECURITY_KEY_TELL, 0x82000063),
+ CMD(SM_GET_CHIP_ID, 0x82000044),
+ { /* sentinel */ },
+ },
+};
+
struct meson_sm_firmware {
const struct meson_sm_chip *chip;
void __iomem *sm_shmem_in_base;
@@ -269,6 +282,7 @@ static const struct attribute_group meson_sm_sysfs_attr_group = {
static const struct of_device_id meson_sm_ids[] = {
{ .compatible = "amlogic,meson-gxbb-sm", .data = &gxbb_chip },
+ { .compatible = "amlogic,meson-gxl-sm", .data = &gxl_chip },
{ /* sentinel */ },
};
diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h
index f98c20dd266e..9352d35c6e96 100644
--- a/include/linux/firmware/meson/meson_sm.h
+++ b/include/linux/firmware/meson/meson_sm.h
@@ -18,6 +18,9 @@ enum {
SM_EFUSE_WRITE,
SM_EFUSE_USER_MAX,
SM_GET_CHIP_ID,
+ SM_SECURITY_KEY_READ,
+ SM_SECURITY_KEY_WRITE,
+ SM_SECURITY_KEY_TELL,
};
struct meson_sm_firmware;
--
2.21.0
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] Enable secure monitor on gxl
2019-06-06 13:24 [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip Krzysztof Michonski
@ 2019-06-06 13:24 ` Krzysztof Michonski
2019-06-06 20:02 ` Martin Blumenstingl
2019-06-07 20:27 ` [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip Martin Blumenstingl
1 sibling, 1 reply; 7+ messages in thread
From: Krzysztof Michonski @ 2019-06-06 13:24 UTC (permalink / raw)
To: khilman, linux-amlogic, devicetree; +Cc: Krzysztof Michonski, afenkart
From: Krzysztof Michonski <michonskikrzysztof@gmail.com>
Add secure monitor node in the gxl dtsi file.
Signed-off-by: Krzysztof Michonski <michonskikrzysztof@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index 3093ae421b17..fd75538ee9f9 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -37,6 +37,10 @@
};
};
};
+
+ sm: secure-monitor {
+ compatible = "amlogic,meson-gxl-sm";
+ };
};
&apb {
--
2.21.0
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] Enable secure monitor on gxl
2019-06-06 13:24 ` [PATCH 2/2] Enable secure monitor on gxl Krzysztof Michonski
@ 2019-06-06 20:02 ` Martin Blumenstingl
[not found] ` <CAOiNxGD2OLwbHhUWuvOV6H0woQEOuk10_t-PTfqvMKNu_tTn4Q@mail.gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Martin Blumenstingl @ 2019-06-06 20:02 UTC (permalink / raw)
To: Krzysztof Michonski; +Cc: khilman, devicetree, afenkart, linux-amlogic
Hi Krzysztof,
the subject should start with: "arm64: dts: meson-gxl:", see the git
history (note that there was a rule change to use "arm64" instead of
"ARM64")
On Thu, Jun 6, 2019 at 3:24 PM Krzysztof Michonski
<michonskikrzysztof@gmail.com> wrote:
>
> From: Krzysztof Michonski <michonskikrzysztof@gmail.com>
>
> Add secure monitor node in the gxl dtsi file.
I assume that this is to enable the GXL and GXM specific commands?
> Signed-off-by: Krzysztof Michonski <michonskikrzysztof@gmail.com>
> ---
> arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
> index 3093ae421b17..fd75538ee9f9 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
> @@ -37,6 +37,10 @@
> };
> };
> };
> +
> + sm: secure-monitor {
> + compatible = "amlogic,meson-gxl-sm";
> + };
> };
if you keep the secure-monitor node in meson-gx.dtsi then you can use
something like:
&sm {
compatible = "amlogic,meson-gxl-sm";
};
the compatible string has to be added to the documentation in
Documentation/devicetree/bindings/firmware/meson/meson_sm.txt with a
separate patch
devicetree bindings should be backwards compatible (at least that's
the rule of thumb)
you can use a fallback compatible string so this new .dts/.dtb also
works with old kernels (which don't support the new, GXL specific,
compatible string yet):
compatible = "amlogic,meson-gxl-sm", "amlogic,meson-gxbb-sm";
Martin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip
2019-06-06 13:24 [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip Krzysztof Michonski
2019-06-06 13:24 ` [PATCH 2/2] Enable secure monitor on gxl Krzysztof Michonski
@ 2019-06-07 20:27 ` Martin Blumenstingl
2019-06-14 9:23 ` Neil Armstrong
1 sibling, 1 reply; 7+ messages in thread
From: Martin Blumenstingl @ 2019-06-07 20:27 UTC (permalink / raw)
To: Krzysztof Michonski; +Cc: khilman, devicetree, afenkart, linux-amlogic
Hi Krzysztof,
On Thu, Jun 6, 2019 at 3:24 PM Krzysztof Michonski
<michonskikrzysztof@gmail.com> wrote:
[...]
> +struct meson_sm_chip gxl_chip = {
> + .shmem_size = SZ_4K,
> + .cmd_shmem_in_base = 0x82000023,
> + .cmd_shmem_out_base = 0x82000024,
where did you get these values from and/or what issues did you see
with the values from GXBB?
I checked Amlogic's buildroot kernel whether they are doing something similar:
$ grep in_base_func
buildroot-openlinux-A113-201901/kernel/aml-4.9/arch/arm64/boot/dts/amlogic/mesong*.dtsi
| cut -d':' -f2 | sort -u
in_base_func = <0x82000020>;
that includes GXL, GXM, G12A and G12B. however, I admit that I didn't
have time to test your patch yet (so it may be just fine and the
vendor kernel is buggy)
Martin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip
2019-06-07 20:27 ` [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip Martin Blumenstingl
@ 2019-06-14 9:23 ` Neil Armstrong
2019-06-17 8:28 ` Krzysztof Michoński
0 siblings, 1 reply; 7+ messages in thread
From: Neil Armstrong @ 2019-06-14 9:23 UTC (permalink / raw)
To: Martin Blumenstingl, Krzysztof Michonski
Cc: khilman, linux-amlogic, afenkart, devicetree
On 07/06/2019 22:27, Martin Blumenstingl wrote:
> Hi Krzysztof,
>
> On Thu, Jun 6, 2019 at 3:24 PM Krzysztof Michonski
> <michonskikrzysztof@gmail.com> wrote:
> [...]
>> +struct meson_sm_chip gxl_chip = {
>> + .shmem_size = SZ_4K,
>> + .cmd_shmem_in_base = 0x82000023,
>> + .cmd_shmem_out_base = 0x82000024,
> where did you get these values from and/or what issues did you see
> with the values from GXBB?
>
> I checked Amlogic's buildroot kernel whether they are doing something similar:
> $ grep in_base_func
> buildroot-openlinux-A113-201901/kernel/aml-4.9/arch/arm64/boot/dts/amlogic/mesong*.dtsi
> | cut -d':' -f2 | sort -u
> in_base_func = <0x82000020>;
> that includes GXL, GXM, G12A and G12B. however, I admit that I didn't
> have time to test your patch yet (so it may be just fine and the
> vendor kernel is buggy)
Same question from me, we've been using the same shmem address on GXL for years now
without any issues, can you elaborate ?
Neil
>
>
> Martin
>
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip
2019-06-14 9:23 ` Neil Armstrong
@ 2019-06-17 8:28 ` Krzysztof Michoński
0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Michoński @ 2019-06-17 8:28 UTC (permalink / raw)
To: Neil Armstrong
Cc: Martin Blumenstingl, khilman, linux-amlogic, afenkart, devicetree
Hi,
a word of explanation from me. The reason why I thought the addresses
differ is I've had wrong understanding of the shared storage and
shared memory. Due to a problem we've faced we were made to read from
the secure storage and as you can see the secure monitor driver after
altering the shmem_in/out addresses can be used map shared storage.
This patches then are incorrect.
Krzysztof Michoński
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-06-17 8:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06 13:24 [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip Krzysztof Michonski
2019-06-06 13:24 ` [PATCH 2/2] Enable secure monitor on gxl Krzysztof Michonski
2019-06-06 20:02 ` Martin Blumenstingl
[not found] ` <CAOiNxGD2OLwbHhUWuvOV6H0woQEOuk10_t-PTfqvMKNu_tTn4Q@mail.gmail.com>
2019-06-07 20:23 ` Martin Blumenstingl
2019-06-07 20:27 ` [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip Martin Blumenstingl
2019-06-14 9:23 ` Neil Armstrong
2019-06-17 8:28 ` Krzysztof Michoński
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).