diff mbox series

[1/2] ARM: cache: Allow SPL to build cache-pl310.c

Message ID 20220804081533.2228257-1-pro@denx.de
State Superseded
Delegated to: Tom Rini
Headers show
Series [1/2] ARM: cache: Allow SPL to build cache-pl310.c | expand

Commit Message

Philip Oberfichtner Aug. 4, 2022, 8:15 a.m. UTC
Before this commit, the SPL could enable the PL310 L2 cache [1], but the
cache maintenance functions from cache-pl310.c were only useable for
non-SPL builds.

After enabling the cache one must be able to flush it, too. Thus this
commit allows cache-pl310.c to be included in the SPL build.

[1] See for example arch/arm/mach-imx/cache.c: v7_outer_cache_enable()

Signed-off-by: Philip Oberfichtner <pro@denx.de>
---

 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marek Vasut Aug. 4, 2022, 9:02 a.m. UTC | #1
On 8/4/22 10:15, Philip Oberfichtner wrote:
> Before this commit, the SPL could enable the PL310 L2 cache [1], but the
> cache maintenance functions from cache-pl310.c were only useable for
> non-SPL builds.
> 
> After enabling the cache one must be able to flush it, too. Thus this
> commit allows cache-pl310.c to be included in the SPL build.
> 
> [1] See for example arch/arm/mach-imx/cache.c: v7_outer_cache_enable()
> 
> Signed-off-by: Philip Oberfichtner <pro@denx.de>
> ---
> 
>   arch/arm/lib/Makefile | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
> index c603fe61bc..ac1d4245bb 100644
> --- a/arch/arm/lib/Makefile
> +++ b/arch/arm/lib/Makefile
> @@ -33,7 +33,6 @@ obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
>   obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
>   obj-$(CONFIG_CMD_BOOTM) += bootm.o
>   obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
> -obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
>   else
>   obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o
>   obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
> @@ -46,6 +45,7 @@ else
>   obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
>   obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
>   endif
> +obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o

Doesn't this need SPL/TPL Kconfig symbols and

obj-$(CONFIG_$(SPL_TPL_)SYS_L2_PL310) += cache-pl310.o

?
Philip Oberfichtner Aug. 4, 2022, 9:19 a.m. UTC | #2
On Thu, 2022-08-04 at 11:02 +0200, Marek Vasut wrote:
> On 8/4/22 10:15, Philip Oberfichtner wrote:
> > Before this commit, the SPL could enable the PL310 L2 cache [1],
> > but the
> > cache maintenance functions from cache-pl310.c were only useable
> > for
> > non-SPL builds.
> > 
> > After enabling the cache one must be able to flush it, too. Thus
> > this
> > commit allows cache-pl310.c to be included in the SPL build.
> > 
> > [1] See for example arch/arm/mach-imx/cache.c:
> > v7_outer_cache_enable()
> > 
> > Signed-off-by: Philip Oberfichtner <pro@denx.de>
> > ---
> > 
> >   arch/arm/lib/Makefile | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
> > index c603fe61bc..ac1d4245bb 100644
> > --- a/arch/arm/lib/Makefile
> > +++ b/arch/arm/lib/Makefile
> > @@ -33,7 +33,6 @@ obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
> >   obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
> >   obj-$(CONFIG_CMD_BOOTM) += bootm.o
> >   obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
> > -obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
> >   else
> >   obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o
> >   obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
> > @@ -46,6 +45,7 @@ else
> >   obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
> >   obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
> >   endif
> > +obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
> 
> Doesn't this need SPL/TPL Kconfig symbols and
> 
> obj-$(CONFIG_$(SPL_TPL_)SYS_L2_PL310) += cache-pl310.o
> 
> ?

CONFIG_SYS_L2_PL310 is not converted to Kconfig yet. And there is no
CONFIG_SPL_ usage for it so far. So I'd say no. Please correct me if
I'm wrong.
Marek Vasut Aug. 4, 2022, 11:33 a.m. UTC | #3
On 8/4/22 11:19, Philip Oberfichtner wrote:

[...]

>>> @@ -46,6 +45,7 @@ else
>>>    obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
>>>    obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
>>>    endif
>>> +obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
>>
>> Doesn't this need SPL/TPL Kconfig symbols and
>>
>> obj-$(CONFIG_$(SPL_TPL_)SYS_L2_PL310) += cache-pl310.o
>>
>> ?
> 
> CONFIG_SYS_L2_PL310 is not converted to Kconfig yet. And there is no
> CONFIG_SPL_ usage for it so far. So I'd say no. Please correct me if
> I'm wrong.

I'm concerned whether applying this patch won't enable L2CC in SPL for 
boards where this could break things.

There is a script to do the conversion to Kconfig easily, see 
doc/develop/moveconfig.rst . It might make sense to run it first, 
convert this symbol to Kconfig, and then add this patch second, and then 
enable SPL_...PL310 for this board only.
diff mbox series

Patch

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index c603fe61bc..ac1d4245bb 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -33,7 +33,6 @@  obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
-obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
 else
 obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o
 obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
@@ -46,6 +45,7 @@  else
 obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
 obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
 endif
+obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
 obj-$(CONFIG_$(SPL_TPL_)SEMIHOSTING) += semihosting.o
 
 ifneq ($(filter y,$(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR) $(CONFIG_SAVE_PREV_BL_FDT_ADDR)),)