Message ID | 20190606132439.25182-1-krzysztof.michonski@digitalstrom.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip | expand |
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
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 >
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
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;