diff mbox

[v1,1/3] target/s390x: Indicate and check for local tlb clearing

Message ID 20170620123553.16186-2-david@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Hildenbrand June 20, 2017, 12:35 p.m. UTC
Let's allow to enable it for the qemu cpu model and correctly emulate
it.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/cpu_models.c |  1 +
 target/s390x/mem_helper.c | 13 ++++---------
 2 files changed, 5 insertions(+), 9 deletions(-)

Comments

Richard Henderson June 20, 2017, 5:25 p.m. UTC | #1
On 06/20/2017 05:35 AM, David Hildenbrand wrote:
> +    if (s390_has_feat(S390_FEAT_LOCAL_TLB_CLEARING) && (m4 & 1)) {

Surely better to let m4 == 0 without local-tlb-clearing during translate.


r~
David Hildenbrand June 22, 2017, 7:51 a.m. UTC | #2
On 20.06.2017 19:25, Richard Henderson wrote:
> On 06/20/2017 05:35 AM, David Hildenbrand wrote:
>> +    if (s390_has_feat(S390_FEAT_LOCAL_TLB_CLEARING) && (m4 & 1)) {
> 
> Surely better to let m4 == 0 without local-tlb-clearing during translate.
> 

Yes, that makes sense!
diff mbox

Patch

diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 478bcc6..8fce957 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -685,6 +685,7 @@  static void add_qemu_cpu_model_features(S390FeatBitmap fbm)
         S390_FEAT_GENERAL_INSTRUCTIONS_EXT,
         S390_FEAT_EXECUTE_EXT,
         S390_FEAT_STFLE_45,
+        S390_FEAT_LOCAL_TLB_CLEARING,
     };
     int i;
 
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 80caab9..1de0494 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -1558,18 +1558,13 @@  void HELPER(ipte)(CPUS390XState *env, uint64_t pto, uint64_t vaddr,
 
     /* XXX we exploit the fact that Linux passes the exact virtual
        address here - it's not obliged to! */
-    /* XXX: the LC bit should be considered as 0 if the local-TLB-clearing
-       facility is not installed.  */
-    if (m4 & 1) {
+    if (s390_has_feat(S390_FEAT_LOCAL_TLB_CLEARING) && (m4 & 1)) {
         tlb_flush_page(cs, page);
-    } else {
-        tlb_flush_page_all_cpus_synced(cs, page);
-    }
-
-    /* XXX 31-bit hack */
-    if (m4 & 1) {
+        /* 31 bit hack */
         tlb_flush_page(cs, page ^ 0x80000000);
     } else {
+        tlb_flush_page_all_cpus_synced(cs, page);
+        /* 31 bit hack */
         tlb_flush_page_all_cpus_synced(cs, page ^ 0x80000000);
     }
 }