Skip to contentSkip to conversation

ARC: mm: Update ARC_REG_*C_PTAG on each cacheline operation

PATCH Superseded Barbaros Tokaoglu 2 participants 3 messages Dec 14, 2021 – Dec 15, 2021 Synopsys ARC architecture

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARC: mm: Update ARC_REG_*C_PTAG on each cacheline operation

For 16 kB data cache with 4 ways and 32 byte cache lines we have tag LSB [(128 locations for each way: 7 bits) + byte offset (32 bytes: 5 bits)] lower than page offset (13 bits for 8 kB pages).
So it is possible for PTAG to change even for single page loop. Hence update ARC_REG_*C_PTAG register on each cacheline iteration.

---
  arch/arc/mm/cache.c | 13 ++-----------
  1 file changed, 2 insertions(+), 11 deletions(-)
arch/arc/mm/cache.c +0 -0
index 8aa1231..d0875a8 100644
@@ -251,13 +251,6 @@ void __cache_line_loop_v3(phys_addr_t paddr, 

unsigned long vaddr,
num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES);

/*
- * MMUv3, cache ops require paddr in PTAG reg
- * if V-P const for loop, PTAG can be written once outside loop
- */
- if (full_page)
- write_aux_reg(aux_tag, paddr);
-
- /*
* This is technically for MMU v4, using the MMU v3 programming model
* Special work for HS38 aliasing I-cache configuration with PAE40
* - upper 8 bits of paddr need to be written into PTAG_HI
@@ -268,10 +261,8 @@ void __cache_line_loop_v3(phys_addr_t paddr, unsigned long vaddr,
write_aux_reg(ARC_REG_IC_PTAG_HI, (u64)paddr >> 32);

while (num_lines-- > 0) {
- if (!full_page) {
- write_aux_reg(aux_tag, paddr);
- paddr += L1_CACHE_BYTES;
- }
+ write_aux_reg(aux_tag, paddr);
+ paddr += L1_CACHE_BYTES;

write_aux_reg(aux_cmd, vaddr);
vaddr += L1_CACHE_BYTES;

Signature · 5 lines
2.7.4
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Acked-by on v2 1/1
#1 lore raw
Quoted 44 lines · Barbaros Tokaoglu

For 16 kB data cache with 4 ways and 32 byte cache lines we have tag LSB [(128 locations for each way: 7 bits) + byte offset (32 bytes: 5 bits)] lower than page offset (13 bits for 8 kB pages).
So it is possible for PTAG to change even for single page loop. Hence update ARC_REG_*C_PTAG register on each cacheline iteration.

---
  arch/arc/mm/cache.c | 13 ++-----------
  1 file changed, 2 insertions(+), 11 deletions(-)
arch/arc/mm/cache.c +0 -7
index 8aa1231..d0875a8 100644
@@ -251,13 +251,6 @@ void __cache_line_loop_v3(phys_addr_t paddr,
 unsigned long vaddr,
  	num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES);
 
  	/*
-	 * MMUv3, cache ops require paddr in PTAG reg
-	 * if V-P const for loop, PTAG can be written once outside loop
-	 */
-	if (full_page)
-		write_aux_reg(aux_tag, paddr);
-
-	/*
  	 * This is technically for MMU v4, using the MMU v3 programming

model
* Special work for HS38 aliasing I-cache configuration with PAE40
* - upper 8 bits of paddr need to be written into PTAG_HI

arch/arc/mm/cache.c +2 -4
@@ -268,10 +261,8 @@ void __cache_line_loop_v3(phys_addr_t paddr,
 unsigned long vaddr,
  		write_aux_reg(ARC_REG_IC_PTAG_HI, (u64)paddr >> 32);
 
  	while (num_lines-- > 0) {
-		if (!full_page) {
-			write_aux_reg(aux_tag, paddr);
-			paddr += L1_CACHE_BYTES;
-		}
+		write_aux_reg(aux_tag, paddr);
+		paddr += L1_CACHE_BYTES;
 
  		write_aux_reg(aux_cmd, vaddr);
Quoted 3 lines

vaddr += L1_CACHE_BYTES;
--
2.7.4

Thank you,
Vladimir Isaev
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#2 lore raw
Quoted 51 lines · Vladimir Isaev
Quoted 45 lines · Barbaros Tokaoglu

For 16 kB data cache with 4 ways and 32 byte cache lines we have tag LSB [(128 locations for each way: 7 bits) + byte offset (32 bytes: 5 bits)] lower than page offset (13 bits for 8 kB pages).
So it is possible for PTAG to change even for single page loop. Hence update ARC_REG_*C_PTAG register on each cacheline iteration.

---
   arch/arc/mm/cache.c | 13 ++-----------
   1 file changed, 2 insertions(+), 11 deletions(-)
arch/arc/mm/cache.c +0 -7
index 8aa1231..d0875a8 100644
@@ -251,13 +251,6 @@ void __cache_line_loop_v3(phys_addr_t paddr,
 unsigned long vaddr,
   	num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES);
 
   	/*
-	 * MMUv3, cache ops require paddr in PTAG reg
-	 * if V-P const for loop, PTAG can be written once outside loop
-	 */
-	if (full_page)
-		write_aux_reg(aux_tag, paddr);
-
-	/*
   	 * This is technically for MMU v4, using the MMU v3 programming

model
* Special work for HS38 aliasing I-cache configuration with PAE40
* - upper 8 bits of paddr need to be written into PTAG_HI

arch/arc/mm/cache.c +2 -4
@@ -268,10 +261,8 @@ void __cache_line_loop_v3(phys_addr_t paddr,
 unsigned long vaddr,
   		write_aux_reg(ARC_REG_IC_PTAG_HI, (u64)paddr >> 32);
 
   	while (num_lines-- > 0) {
-		if (!full_page) {
-			write_aux_reg(aux_tag, paddr);
-			paddr += L1_CACHE_BYTES;
-		}
+		write_aux_reg(aux_tag, paddr);
+		paddr += L1_CACHE_BYTES;
 
   		write_aux_reg(aux_cmd, vaddr);
   		vaddr += L1_CACHE_BYTES;
Quoted 2 lines

--
2.7.4

Quoted 3 lines

Thank you,
Vladimir Isaev

Please consider v3, there was an issue with patch of v2. Sorry for this.

Best Regards,
Barbaros
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc