qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, rth@twiddle.net,
	david@redhat.com, cohuck@redhat.com
Cc: borntraeger@de.ibm.com, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [Qemu-devel] [PATCH] s390: support EDAT-2 in mmu_translate_region
Date: Tue, 16 Jul 2019 14:34:46 +0200	[thread overview]
Message-ID: <20190716123446.24039-1-iii@linux.ibm.com> (raw)

When debugging s390 linux kernel with qemu kvm gdbstub, dumping memory
contents at addresses in range 0x80000000-0x100000000 results in an
error or all zeroes being returned.

The problem appears to be that linux puts 2G page at that location,
which qemu currently does not know about.

Check FC bit of Region-Third-Table Entry in mmu_translate_region, just
like it's already done for FC bit of Segment-Table Entry in
mmu_translate_segment.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 target/s390x/cpu.h        | 1 +
 target/s390x/mmu_helper.c | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index a606547b4d..947553386f 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -548,6 +548,7 @@ QEMU_BUILD_BUG_ON(sizeof(SysIB) != 4096);
 #define ASCE_TABLE_LENGTH     0x03        /* region table length              */
 
 #define REGION_ENTRY_ORIGIN   (~0xfffULL) /* region/segment table origin    */
+#define REGION_ENTRY_FC       0x400       /* region format control          */
 #define REGION_ENTRY_RO       0x200       /* region/segment protection bit  */
 #define REGION_ENTRY_TF       0xc0        /* region/segment table offset    */
 #define REGION_ENTRY_INV      0x20        /* invalid region table entry     */
diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
index 6e9c4d6151..76cf920cd2 100644
--- a/target/s390x/mmu_helper.c
+++ b/target/s390x/mmu_helper.c
@@ -242,6 +242,14 @@ static int mmu_translate_region(CPUS390XState *env, target_ulong vaddr,
         return -1;
     }
 
+    if (level == ASCE_TYPE_REGION3
+        && (new_entry & REGION_ENTRY_FC) && (env->cregs[0] & CR0_EDAT)) {
+        /* Decode EDAT-2 region frame absolute address (2GB page) */
+        *raddr = (new_entry & 0xffffffff80000000ULL) | (vaddr & 0x7fffffff);
+        PTE_DPRINTF("%s: REG=0x%" PRIx64 "\n", __func__, new_entry);
+        return 0;
+    }
+
     if (level == ASCE_TYPE_SEGMENT) {
         return mmu_translate_segment(env, vaddr, asc, new_entry, raddr, flags,
                                      rw, exc);
-- 
2.21.0



             reply	other threads:[~2019-07-16 13:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 12:34 Ilya Leoshkevich [this message]
2019-07-16 12:41 ` [Qemu-devel] [PATCH] s390: support EDAT-2 in mmu_translate_region David Hildenbrand
2019-07-16 12:52   ` Ilya Leoshkevich
2019-07-16 13:04     ` Cornelia Huck
2019-07-16 13:07       ` Ilya Leoshkevich
2019-07-16 13:11       ` Christian Borntraeger
2019-07-16 13:12         ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190716123446.24039-1-iii@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).