[Qemu-devel] [PULL 18/30] target-sparc: replace the last tlb entry when no free entries left

2017-01-18 Thread Artyom Tarasenko
Implement the behavior described in the chapter 13.9.11 of
UltraSPARC T1™ Supplement to the UltraSPARC Architecture 2005:

"If a TLB Data-In replacement is attempted with all TLB
entries locked and valid, the last TLB entry (entry 63) is
replaced."

Signed-off-by: Artyom Tarasenko 
---
 target/sparc/ldst_helper.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index d3747cf..029120d 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -246,9 +246,11 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,
 }
 
 #ifdef DEBUG_MMU
-DPRINTF_MMU("%s lru replacement failed: no entries available\n", strmmu);
+DPRINTF_MMU("%s lru replacement: no free entries available, "
+"replacing the last one\n", strmmu);
 #endif
-/* error state? */
+/* corner case: the last entry is replaced anyway */
+replace_tlb_entry([63], tlb_tag, tlb_tte, env1);
 }
 
 #endif
-- 
2.7.2




[Qemu-devel] [PULL 18/30] target-sparc: replace the last tlb entry when no free entries left

2017-01-11 Thread Richard Henderson
From: Artyom Tarasenko 

Implement the behavior described in the chapter 13.9.11 of
UltraSPARC T1™ Supplement to the UltraSPARC Architecture 2005:

"If a TLB Data-In replacement is attempted with all TLB
entries locked and valid, the last TLB entry (entry 63) is
replaced."

Signed-off-by: Artyom Tarasenko 
Message-Id: 
<86cbe148bfaf96575128f3d8394a17c48ad92f28.1484165352.git.atar4q...@gmail.com>
Signed-off-by: Richard Henderson 
---
 target/sparc/ldst_helper.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index d524aaa..8cc8bb1 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -246,9 +246,11 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,
 }
 
 #ifdef DEBUG_MMU
-DPRINTF_MMU("%s lru replacement failed: no entries available\n", strmmu);
+DPRINTF_MMU("%s lru replacement: no free entries available, "
+"replacing the last one\n", strmmu);
 #endif
-/* error state? */
+/* corner case: the last entry is replaced anyway */
+replace_tlb_entry([63], tlb_tag, tlb_tte, env1);
 }
 
 #endif
-- 
2.9.3