ARM: cache: add an empty stub function for invalidate/flush dcache
Subsystems (4)
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
---
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/lib/cache.c +9 -0
@@ -53,6 +53,15 @@ __weak void enable_caches(void)puts ("WARNING: Caches not enabled\n" ); } +__weak void invalidate_dcache_range (unsigned long start,unsigned long stop) +{ +/* An empty stub, real implementation should be in platform code */ +} +__weak void flush_dcache_range (unsigned long start,unsigned long stop) +{ +/* An empty stub, real implementation should be in platform code */ +} +#ifdef CONFIG_SYS_NONCACHED_MEMORY /* * Reserve one MMU section worth of address space below the malloc() area that
Signature · 1 line
1.9.1
PATCH v2 2/3 m68k: cache: add an empty stub functions for invalidate/flush dcache
Since some driver like ohci, lcd used dcache functions. But m68k don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all m68k cpu.
Also each cpu can implement its own implementation. If not implemented then by default is using an empty function.
---
Changes in v2: new added.
arch/m68k/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/m68k/lib/cache.c +9 -0
@@ -132,3 +132,12 @@ void dcache_invalid(void) __asm__ __volatile__("movec %0, %%cacr" ::"r" (temp));#endif } + +__weak void invalidate_dcache_range (unsigned long start,unsigned long stop) +{ +/* An empty stub, real implementation should be in platform code */ +} +__weak void flush_dcache_range (unsigned long start,unsigned long stop) +{ +/* An empty stub, real implementation should be in platform code */ +}
Signature · 1 line
1.9.1
PATCH v2 2/3 m68k: cache: add an empty stub functions for invalidate/flush dcache
Quoted 9 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But m68k don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all m68k cpu.
Also each cpu can implement its own implementation. If not implemented then by default is using an empty function.
Quoted 7 lines
Signed-off-by Josh Wu <[email protected]>---
Changes in v2: new added.
arch/m68k/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
PATCH v2 3/3 usb: ohci: enable cache support
In reply to Josh WuRemove the CONFIG_DM_USB limitation to enable cache support functions. Tested on SAMA5D3x-EK board.
---
Changes in v2:
- CONFIG_DM_USB in periodic_unlink() should be remove as well. This version remove it.
- Add Hans de Goede's acked-by.
drivers/usb/host/ohci-hcd.c | 12 +----------- drivers/usb/host/ohci.h | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-)
drivers/usb/host/ohci-hcd.c +1 -11
@@ -103,21 +103,13 @@ static struct pci_device_id ehci_pci_ids[] = {# define m32_swap (x) cpu_to_le32(x)#endif /* CONFIG_SYS_OHCI_BE_CONTROLLER */ -#ifdef CONFIG_DM_USB -/* -* We really should do proper cache flushing everywhere, but for now we only -* do it for new (driver-model) usb code to avoid regressions. -*/ +/* We really should do proper cache flushing everywhere */ #define flush_dcache_buffer (addr, size) \ flush_dcache_range((unsigned long)(addr), \ ALIGN((unsigned long)(addr) + size, ARCH_DMA_MINALIGN))#define invalidate_dcache_buffer (addr, size) \ invalidate_dcache_range((unsigned long)(addr), \ ALIGN((unsigned long)(addr) + size, ARCH_DMA_MINALIGN)) -#else -#define flush_dcache_buffer (addr, size) -#define invalidate_dcache_buffer (addr, size) -#endif /* Do not use sizeof(ed / td) as our ed / td structs contain extra members */ #define flush_dcache_ed (addr) flush_dcache_buffer(addr, 16)
@@ -782,12 +774,10 @@ static void periodic_unlink(struct ohci *ohci, volatile struct ed *ed,if (((struct ed *)m32_swap ((unsigned long )ed_p)) == ed) { *ed_p = ed->hwNextED; -#ifdef CONFIG_DM_USB aligned_ed_p = (unsigned long )ed_p; aligned_ed_p &= ~(ARCH_DMA_MINALIGN -1 );flush_dcache_range (aligned_ed_p, aligned_ed_p +ARCH_DMA_MINALIGN ); -#endif break ; } ed_p = &(((struct ed *)
drivers/usb/host/ohci.h +1 -1
@@ -18,7 +18,7 @@# define ohci_writel (a, b) (*((volatile u32 *)(b)) = ((volatile u32)a))#endif /* CONFIG_SYS_OHCI_SWAP_REG_ACCESS */ -#if definedCONFIG_DM_USB &&ARCH_DMA_MINALIGN >16 +#if ARCH_DMA_MINALIGN >16 #define ED_ALIGNMENT ARCH_DMA_MINALIGN#else #define ED_ALIGNMENT 16
Signature · 1 line
1.9.1
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
In reply to Josh WuQuoted 10 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Quoted 7 lines
Signed-off-by Josh Wu <[email protected]>---
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Best regards,
Marek Vasut
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Hi, Marek
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Quoted 6 lines
Quoted 4 lines
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use? It seems there is no place to put common code for all arch cpu.
Best Regards,
Josh Wu
Quoted 3 lines
Best regards,
Marek Vasut
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Quoted 19 lines · Josh Wu
Hi, Marek
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Changes in v2: new added
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use?
Yes.
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Isn't that what the common/ directory is for ? ;-)
Best regards,
Marek Vasut
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Hi, Marek
Quoted 22 lines · Marek Vasut
Quoted 21 lines · Josh Wu
Hi, Marek
Quoted 18 lines · Marek Vasut
Quoted 17 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use?
Yes.
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Isn't that what the common/ directory is for ? ;-)
Oh, yes ;-)
I just think maybe it's more logical to keep those to the <arch>/lib/cache.c as cache are <arch> dependent.
Another point is if we create a new cache.c in common/, then the cache implementation code are in three files:
<arch>/cpu/cache.c or cpu.c
<arch>/lib/cache.c
common/cache.c
It seems too fragmented. What do you think?
Best Regards,
Josh Wu
Quoted 3 lines
Best regards,
Marek Vasut
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
In reply to Marek VasutQuoted 26 lines · Marek Vasut
Quoted 25 lines · Josh Wu
Hi, Marek
Quoted 21 lines · Marek Vasut
Quoted 10 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Quoted 7 lines
Signed-off-by Josh Wu <[email protected]>---
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Quoted 8 lines
Quoted 2 lines
Do you mean to make those empty functions as common code for all arch cpu to use?
Yes.
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Isn't that what the common/ directory is for ? ;-)
No, this is making something common for the sake of making it common rather than good architecutre of the code I think. We aren't going to share real cache functions just these dummy ones. We may re-evaluate our dummy ones at some point in the future when people try and use some particular combination harder, see for example the PowerPC dummy cache functions we just recently dropped. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150608/f4179dbf/attachment.sig>
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Hi, Tom
Quoted 27 lines · Tom Rini
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Josh Wu
Hi, Marek
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Quoted 6 lines
Quoted 4 lines
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use?
Quoted 7 lines
Quoted 4 lines
Yes.
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Isn't that what the common/ directory is for ? ;-)
No, this is making something common for the sake of making it common rather than good architecutre of the code I think. We aren't going to share real cache functions just these dummy ones.
So it is the right place: arch/arm/lib/cache.c to put the dummy cache function.
Quoted 5 lines
We may re-evaluate
our dummy ones at some point in the future when people try and use some particular combination harder, see for example the PowerPC dummy cache functions we just recently dropped. Thanks!
If this patch set are ok for you. I will sent more patches to drop the dummy cache functions in <arch>/cpu/ folders.
Also the flush_cache() in arch/arm/lib/cache.c can be dropped and just call flush_dcache_range() as the ARM1136, ARM926ejs alreay implemented their own flush_cache().
Best Regards,
Josh Wu
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Quoted 32 lines · Josh Wu
Hi, Tom
Quoted 29 lines · Tom Rini
Quoted 28 lines · Marek Vasut
Quoted 17 lines · Josh Wu
Hi, Marek
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use?
Yes.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Isn't that what the common/ directory is for ? ;-)
No, this is making something common for the sake of making it common rather than good architecutre of the code I think. We aren't going to share real cache functions just these dummy ones.
So it is the right place:
arch/arm/lib/cache.cto put the dummy cache function.
Yes.
Quoted 7 lines
Quoted 4 lines
We may re-evaluate
our dummy ones at some point in the future when people try and use some particular combination harder, see for example the PowerPC dummy cache functions we just recently dropped. Thanks!If this patch set are ok for you. I will sent more patches to drop the dummy cache functions in <arch>/cpu/ folders.
Right, that's the best palce I think, baring an existing arch having a location for weak cache functions already (like arm does).
Quoted 3 lines
Also the
flush_cache()inarch/arm/lib/cache.ccan be dropped and just callflush_dcache_range()as the ARM1136, ARM926ejs alreay implemented their ownflush_cache().
Nope, other things fail if you do that (vpac270_nor_256 and 24 others at least so far in my test build).
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150609/8212e1fc/attachment.sig>
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Quoted 48 lines · Tom Rini
Quoted 32 lines · Josh Wu
Hi, Tom
Quoted 29 lines · Tom Rini
Quoted 28 lines · Marek Vasut
Quoted 17 lines · Josh Wu
Hi, Marek
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use?
Yes.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Isn't that what the common/ directory is for ? ;-)
No, this is making something common for the sake of making it common rather than good architecutre of the code I think. We aren't going to share real cache functions just these dummy ones.
So it is the right place:
arch/arm/lib/cache.cto put the dummy cache function.Yes.
Quoted 6 lines
Quoted 4 lines
We may re-evaluate
our dummy ones at some point in the future when people try and use some particular combination harder, see for example the PowerPC dummy cache functions we just recently dropped. Thanks!If this patch set are ok for you. I will sent more patches to drop the dummy cache functions in <arch>/cpu/ folders.
Quoted 8 lines
Right, that's the best palce I think, baring an existing arch having a location for weak cache functions already (like arm does).
Quoted 3 lines
Also the
flush_cache()inarch/arm/lib/cache.ccan be dropped and just callflush_dcache_range()as the ARM1136, ARM926ejs alreay implemented their ownflush_cache().Nope, other things fail if you do that (
vpac270_nor_256and 24 others at least so far in my test build).
Does it fail to compile or on running? As I don't have the board to test the binary, but I don't find any compile error when I apply such a patch. Maybe it is better to sent out my patch for you to check.
Best Regards,
Josh Wu
Quoted 1 line
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Quoted 65 lines · Josh Wu
Quoted 64 lines · Tom Rini
Quoted 37 lines · Josh Wu
Hi, Tom
Quoted 34 lines · Tom Rini
Quoted 33 lines · Marek Vasut
Quoted 19 lines · Josh Wu
Hi, Marek
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Changes in v2: new added
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use?
Yes.
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Isn't that what the common/ directory is for ? ;-)
No, this is making something common for the sake of making it common rather than good architecutre of the code I think. We aren't going to share real cache functions just these dummy ones.
So it is the right place:
arch/arm/lib/cache.cto put the dummy cache function.Yes.
Quoted 7 lines
Quoted 4 lines
We may re-evaluate
our dummy ones at some point in the future when people try and use some particular combination harder, see for example the PowerPC dummy cache functions we just recently dropped. Thanks!If this patch set are ok for you. I will sent more patches to drop the dummy cache functions in <arch>/cpu/ folders.
Right, that's the best palce I think, baring an existing arch having a location for weak cache functions already (like arm does).
Quoted 3 lines
Also the
flush_cache()inarch/arm/lib/cache.ccan be dropped and just callflush_dcache_range()as the ARM1136, ARM926ejs alreay implemented their ownflush_cache().
Quoted 6 lines
Quoted 2 lines
Nope, other things fail if you do that (
vpac270_nor_256and 24 others at least so far in my test build).Does it fail to compile or on running? As I don't have the board to test the binary, but I don't find any compile error when I apply such a patch. Maybe it is better to sent out my patch for you to check.
VPAC is PXA270 and to my knowledge, PXA has no cache support in place at all.
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
Quoted 56 lines · Marek Vasut
Quoted 55 lines · Josh Wu
Quoted 54 lines · Tom Rini
Quoted 32 lines · Josh Wu
Hi, Tom
Quoted 29 lines · Tom Rini
Quoted 28 lines · Marek Vasut
Quoted 17 lines · Josh Wu
Hi, Marek
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use?
Yes.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Isn't that what the common/ directory is for ? ;-)
No, this is making something common for the sake of making it common rather than good architecutre of the code I think. We aren't going to share real cache functions just these dummy ones.
So it is the right place:
arch/arm/lib/cache.cto put the dummy cache function.Yes.
Quoted 6 lines
Quoted 4 lines
We may re-evaluate
our dummy ones at some point in the future when people try and use some particular combination harder, see for example the PowerPC dummy cache functions we just recently dropped. Thanks!If this patch set are ok for you. I will sent more patches to drop the dummy cache functions in <arch>/cpu/ folders.
Right, that's the best palce I think, baring an existing arch having a location for weak cache functions already (like arm does).
Quoted 3 lines
Also the
flush_cache()inarch/arm/lib/cache.ccan be dropped and just callflush_dcache_range()as the ARM1136, ARM926ejs alreay implemented their ownflush_cache().
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Nope, other things fail if you do that (
vpac270_nor_256and 24 others at least so far in my test build).Does it fail to compile or on running? As I don't have the board to test the binary, but I don't find any compile error when I apply such a patch. Maybe it is better to sent out my patch for you to check.
VPAC is PXA270 and to my knowledge, PXA has no cache support in place at all.
ok, so use a empty function is reasonable for pxa.
Marek, Tom
I just sent out another two patches:
first one is drop the invalidate_dcache_range()/flush_dcache_range(). second one is drop the flush_cache() function.
Could you check those two patches? thank you.
Best Regards,
Josh Wu
PATCH v2 1/3 ARM: cache: add an empty stub function for invalidate/flush dcache
In reply to Josh WuQuoted 55 lines · Josh Wu
Quoted 54 lines · Tom Rini
Quoted 32 lines · Josh Wu
Hi, Tom
Quoted 29 lines · Tom Rini
Quoted 28 lines · Marek Vasut
Quoted 17 lines · Josh Wu
Hi, Marek
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Josh Wu
Since some driver like ohci, lcd used dcache functions. But some ARM cpu don't implement the invalidate_dcache_range()/flush_dcache_range() functions.
To avoid compiling errors this patch adds an weak empty stub function for all ARM cpu.
And each cpu can implement its own implementation. If not implemented by default it will use an empty function.
Signed-off-by Josh Wu <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)So, why exactly can't this be entirely common code , but a CPU-specific code ? :)
Do you mean to make those empty functions as common code for all arch cpu to use?
Yes.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
It seems there is no place to put common code for all arch cpu.
Isn't that what the common/ directory is for ? ;-)
No, this is making something common for the sake of making it common rather than good architecutre of the code I think. We aren't going to share real cache functions just these dummy ones.
So it is the right place:
arch/arm/lib/cache.cto put the dummy cache function.Yes.
Quoted 6 lines
Quoted 4 lines
We may re-evaluate
our dummy ones at some point in the future when people try and use some particular combination harder, see for example the PowerPC dummy cache functions we just recently dropped. Thanks!If this patch set are ok for you. I will sent more patches to drop the dummy cache functions in <arch>/cpu/ folders.
Right, that's the best palce I think, baring an existing arch having a location for weak cache functions already (like arm does).
Quoted 3 lines
Also the
flush_cache()inarch/arm/lib/cache.ccan be dropped and just callflush_dcache_range()as the ARM1136, ARM926ejs alreay implemented their ownflush_cache().
Quoted 6 lines
Quoted 2 lines
Nope, other things fail if you do that (
vpac270_nor_256and 24 others at least so far in my test build).Does it fail to compile or on running? As I don't have the board to test the binary, but I don't find any compile error when I apply such a patch.
It was a link failure for me when I just dropped flush_cache() from arch/arm/lib/cache.c
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150610/9bad2491/attachment.sig>
cover ARM: cache: clean up the code to drop the empty stub functions
In reply to Josh WuThis series is based on the patch I sent:
http://patchwork.ozlabs.org/patch/481095/
As above introduces the default empty function for invalidate_dcache_range() & flush_dcache_range() in arch/arm/lib/cache.c.
So in this series, we can drop the empty stubs in arch/arm/cpu/
Also this series introduces a default function for flush_cache().
Josh Wu (2):
ARM: cache: drop the empty dcache functions as we have it in
lib/cache.c
ARM: cache: implement a default flush_cache() function
arch/arm/cpu/arm1136/cpu.c | 17 ----------------- arch/arm/cpu/arm926ejs/cache.c | 17 ----------------- arch/arm/cpu/armv7/cache_v7.c | 21 --------------------- arch/arm/cpu/armv8/cache_v8.c | 16 ---------------- arch/arm/lib/cache.c | 26 +++++--------------------- 5 files changed, 5 insertions(+), 92 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 ARM: cache: drop the empty dcache functions as we have it in lib/cache.c
As there are empty function invalidate_dcache_range(), flush_dcache_range() in arch/arm/lib/cache.c. So we can reuse it by just drop them in arch/arm/cpu/.
---
arch/arm/cpu/arm1136/cpu.c | 8 -------- arch/arm/cpu/arm926ejs/cache.c | 8 -------- arch/arm/cpu/armv7/cache_v7.c | 8 -------- arch/arm/cpu/armv8/cache_v8.c | 8 -------- 4 files changed, 32 deletions(-)
arch/arm/cpu/arm1136/cpu.c +0 -8
@@ -134,14 +134,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range (unsigned long start,unsigned long stop) -{ -} - -void flush_dcache_range (unsigned long start,unsigned long stop) -{ -} -void flush_cache (unsigned long start,unsigned long size) { }
arch/arm/cpu/arm926ejs/cache.c +0 -8
@@ -83,14 +83,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range (unsigned long start,unsigned long stop) -{ -} - -void flush_dcache_range (unsigned long start,unsigned long stop) -{ -} -void flush_cache (unsigned long start,unsigned long size) { }
arch/arm/cpu/armv7/cache_v7.c +0 -8
@@ -304,14 +304,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range (unsigned long start,unsigned long stop) -{ -} - -void flush_dcache_range (unsigned long start,unsigned long stop) -{ -} -void arm_init_before_mmu (void ) { }
arch/arm/cpu/armv8/cache_v8.c +0 -8
@@ -149,14 +149,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range (unsigned long start,unsigned long stop) -{ -} - -void flush_dcache_range (unsigned long start,unsigned long stop) -{ -} -void dcache_enable (void ) { }
Signature · 1 line
1.9.1
PATCH 1/2 ARM: cache: drop the empty dcache functions as we have it in lib/cache.c
Hello Josh,
Sorry this series somehow dropped off my radar completely. Is it still needed now? If it does, then it would require rework as some of the functions removed are not empty anymore.
Quoted 91 lines · Josh Wu
As there are empty function
invalidate_dcache_range(),flush_dcache_range()inarch/arm/lib/cache.c. So we can reuse it by just drop them inarch/arm/cpu/.Signed-off-by Josh Wu <[email protected]>---
arch/arm/cpu/arm1136/cpu.c | 8 -------- arch/arm/cpu/arm926ejs/cache.c | 8 -------- arch/arm/cpu/armv7/cache_v7.c | 8 -------- arch/arm/cpu/armv8/cache_v8.c | 8 -------- 4 files changed, 32 deletions(-)arch/arm/cpu/arm1136/cpu.c +0
-8@@ -134,14 +134,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range (unsigned long start,unsigned long stop) -{ -} - -void flush_dcache_range (unsigned long start,unsigned long stop) -{ -} -void flush_cache (unsigned long start,unsigned long size) { }arch/arm/cpu/arm926ejs/cache.c +0
-8@@ -83,14 +83,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range (unsigned long start,unsigned long stop) -{ -} - -void flush_dcache_range (unsigned long start,unsigned long stop) -{ -} -void flush_cache (unsigned long start,unsigned long size) { }arch/arm/cpu/armv7/cache_v7.c +0
-8@@ -304,14 +304,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range (unsigned long start,unsigned long stop) -{ -} - -void flush_dcache_range (unsigned long start,unsigned long stop) -{ -} -void arm_init_before_mmu (void ) { }arch/arm/cpu/armv8/cache_v8.c +0
-8@@ -149,14 +149,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range (unsigned long start,unsigned long stop) -{ -} - -void flush_dcache_range (unsigned long start,unsigned long stop) -{ -} -void dcache_enable (void ) { }Signature · 1 line
1.9.1
Amicalement,
Signature · 1 line
Albert.
PATCH 1/2 ARM: cache: drop the empty dcache functions as we have it in lib/cache.c
Quoted 5 lines · Albert ARIBAUD
Hello Josh,
Sorry this series somehow dropped off my radar completely. Is it still needed now? If it does, then it would require rework as some of the functions removed are not empty anymore.
An updated version of this series which handled other arches has been applied now.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150912/307fae99/attachment.sig>
PATCH 2/2 ARM: cache: implement a default flush_cache() function
In reply to Josh WuIt will just call flush_dcache_range().
As ARM1136 & ARM926ejs already implemented their own flush_cache(), those code in weak function in arch/arm/lib/cache.c can be dropped.
---
arch/arm/cpu/arm1136/cpu.c | 9 --------- arch/arm/cpu/arm926ejs/cache.c | 9 --------- arch/arm/cpu/armv7/cache_v7.c | 13 ------------- arch/arm/cpu/armv8/cache_v8.c | 8 -------- arch/arm/lib/cache.c | 26 +++++--------------------- 5 files changed, 5 insertions(+), 60 deletions(-)
arch/arm/cpu/arm1136/cpu.c +0 -9
@@ -120,11 +120,6 @@ void flush_dcache_range(unsigned long start, unsigned long stop) asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)); } -void flush_cache (unsigned long start,unsigned long size) -{ -flush_dcache_range (start, start + size); -} -#else /* #ifndef CONFIG_SYS_DCACHE_OFF */ void invalidate_dcache_all (void ) {
@@ -133,10 +128,6 @@ void invalidate_dcache_all(void)void flush_dcache_all (void ) { } - -void flush_cache (unsigned long start,unsigned long size) -{ -}#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */ #if !defined(CONFIG_SYS_ICACHE_OFF ) || !defined(CONFIG_SYS_DCACHE_OFF )
arch/arm/cpu/arm926ejs/cache.c +0 -9
@@ -69,11 +69,6 @@ void flush_dcache_range(unsigned long start, unsigned long stop) asm volatile("mcr p15, 0, %0, c7, c10, 4\n" : : "r"(0)); } - -void flush_cache (unsigned long start,unsigned long size) -{ -flush_dcache_range (start, start + size); -}#else /* #ifndef CONFIG_SYS_DCACHE_OFF */ void invalidate_dcache_all (void ) {
@@ -82,10 +77,6 @@ void invalidate_dcache_all(void)void flush_dcache_all (void ) { } - -void flush_cache (unsigned long start,unsigned long size) -{ -}#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */ /*
arch/arm/cpu/armv7/cache_v7.c +0 -13
@@ -286,15 +286,6 @@ void mmu_page_table_flush(unsigned long start, unsigned long stop)flush_dcache_range (start, stop); v7_inval_tlb(); } - -/* -* Flush range from all levels of d-cache/unified-cache used: -* Affects the range [start, start + size - 1] -*/ -void flush_cache (unsigned long start,unsigned long size) -{ -flush_dcache_range (start, start + size); -}#else /* #ifndef CONFIG_SYS_DCACHE_OFF */ void invalidate_dcache_all (void ) {
@@ -308,10 +299,6 @@ void arm_init_before_mmu(void) { } -void flush_cache (unsigned long start,unsigned long size) -{ -} -void mmu_page_table_flush (unsigned long start,unsigned long stop) { }
arch/arm/cpu/armv8/cache_v8.c +0 -8
@@ -217,11 +217,3 @@ void __weak enable_caches(void)icache_enable ();dcache_enable (); } - -/* -* Flush range from all levels of d-cache/unified-cache -*/ -void flush_cache (unsigned long start,unsigned long size) -{ -flush_dcache_range (start, start + size); -}
arch/arm/lib/cache.c +5 -21
@@ -10,29 +10,13 @@#include <common.h> #include <malloc.h> +/* +* Flush range from all levels of d-cache/unified-cache. +* Affects the range [start, start + size - 1]. +*/ __weak void flush_cache (unsigned long start,unsigned long size) { -#if defined(CONFIG_CPU_ARM1136 ) - -#if !defined(CONFIG_SYS_ICACHE_OFF ) - asm("mcr p15, 0, r1, c7, c5, 0" );/* invalidate I cache */ -#endif - -#if !defined(CONFIG_SYS_DCACHE_OFF ) - asm("mcr p15, 0, r1, c7, c14, 0" );/* Clean+invalidate D cache */ -#endif - -#endif /* CONFIG_CPU_ARM1136 */ - -#ifdef CONFIG_CPU_ARM926EJS -#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF )) -/* test and clean, page 2-23 of arm926ejs manual */ - asm("0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n" : : :"memory" ); -/* disable write buffer as well (page 2-22) */ - asm("mcr p15, 0, %0, c7, c10, 4" : :"r" (0 )); -#endif -#endif /* CONFIG_CPU_ARM926EJS */ -return ; +flush_dcache_range (start, start + size); }/*
Signature · 1 line
1.9.1
cover ARM: cache: clean up the code to drop the empty stub functions
In reply to Josh WuHi,
Any feedback for this series patch?
Best Regards,
Josh Wu
Quoted 21 lines · Josh Wu
This series is based on the patch I sent:
http://patchwork.ozlabs.org/patch/481095/As above introduces the default empty function for
invalidate_dcache_range()&flush_dcache_range()inarch/arm/lib/cache.c.
So in this series, we can drop the empty stubs inarch/arm/cpu/Also this series introduces a default function for
flush_cache().Josh Wu (2):
ARM: cache: drop the empty dcache functions as we have it in
lib/cache.c
ARM: cache: implement a defaultflush_cache()functionarch/arm/cpu/arm1136/cpu.c | 17 ----------------- arch/arm/cpu/arm926ejs/cache.c | 17 ----------------- arch/arm/cpu/armv7/cache_v7.c | 21 --------------------- arch/arm/cpu/armv8/cache_v8.c | 16 ---------------- arch/arm/lib/cache.c | 26 +++++--------------------- 5 files changed, 5 insertions(+), 92 deletions(-)