Skip to contentSkip to conversation

armv8: cache_v8: fix mmu_set_region_dcache_behaviour

PATCH New Peng Fan 2 participants 5 messages May 11, 2020 – May 26, 2020 Arm (32-bit)

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 armv8: cache_v8: fix mmu_set_region_dcache_behaviour

enum dcache_option already shift left 2 bits, PMD_ATTRINDX(option), will wrongly shift left the attr 4bits, which is wrong. And make the region user set not has expected attribute and might affect the splitted block region.

---
 arch/arm/cpu/armv8/cache_v8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/cache_v8.c +1 -1
index 6a5518f9de..35ee5572e9 100644
@@ -555,7 +555,7 @@ static u64 set_one_region(u64 start, u64 size, u64 attrs, bool flag, int level)
 void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
 				     enum dcache_option option)
 {
-	u64 attrs = PMD_ATTRINDX(option);
+	u64 attrs = PMD_ATTRINDX(option >> 2);
 	u64 real_start = start;
 	u64 real_size = size;
 
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH 1/1 armv8: cache_v8: fix mmu_set_region_dcache_behaviour

Quoted 1 line

Subject: [PATCH] armv8: cache_v8: fix mmu_set_region_dcache_behaviour

Any comments?

Thanks,
Peng.

Quoted 27 lines

enum dcache_option already shift left 2 bits, PMD_ATTRINDX(option), will wrongly shift left the attr 4bits, which is wrong. And make the region user set not has expected attribute and might affect the splitted block region.

---
 arch/arm/cpu/armv8/cache_v8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/cache_v8.c index 6a5518f9de..35ee5572e9 100644

arch/arm/cpu/armv8/cache_v8.c +0 -0
@@ -555,7 +555,7 @@ static u64 set_one_region(u64 start, u64 size, u64

attrs, bool flag, int level) void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,

arch/arm/cpu/armv8/cache_v8.c +1 -2
 				     enum dcache_option option)
 {
-	u64 attrs = PMD_ATTRINDX(option);
+	u64 attrs = PMD_ATTRINDX(option >> 2);
 	u64 real_start = start;
 	u64 real_size = size;
 
--

2.16.4

#2 lore raw

PATCH 1/1 armv8: cache_v8: fix mmu_set_region_dcache_behaviour

Quoted 3 lines · Peng Fan
Quoted 1 line

Subject: [PATCH] armv8: cache_v8: fix mmu_set_region_dcache_behaviour

Any comments?

I'll put it on my list, thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200520/f0969c74/attachment.sig>
#3 lore raw

PATCH 1/1 armv8: cache_v8: fix mmu_set_region_dcache_behaviour

In reply to Peng Fan
Quoted 7 lines · Peng Fan

enum dcache_option already shift left 2 bits, PMD_ATTRINDX(option), will wrongly shift left the attr 4bits, which is wrong. And make the region user set not has expected attribute and might affect the splitted block region.

Please note that I reworded the commit message a bit. In the interest of fixing the bug now:

Applied to u-boot/master.

But on reading the code and macros to understand things better for the commit message, I wonder why we don't just use options directly now in the code? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200525/00be01cb/attachment.sig>
author
#4 lore raw

PATCH 1/1 armv8: cache_v8: fix mmu_set_region_dcache_behaviour

Quoted 13 lines

Subject: Re: [PATCH] armv8: cache_v8: fix
mmu_set_region_dcache_behaviour

Quoted 7 lines · Peng Fan

enum dcache_option already shift left 2 bits, PMD_ATTRINDX(option), will wrongly shift left the attr 4bits, which is wrong. And make the region user set not has expected attribute and might affect the splitted block region.

Quoted 8 lines

Please note that I reworded the commit message a bit. In the interest of fixing the bug now:

Applied to u-boot/master.

But on reading the code and macros to understand things better for the commit message, I wonder why we don't just use options directly now in the code?

Seems directly using options would make it a bit simplier! I agree.

Thanks,
Peng.

Thanks!

Quoted 3 lines

--
Tom