Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel <qemu-devel@nongnu.org>, KVM <kvm@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>
Cc: Carsten Otte <cotte@de.ibm.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Gleb Natapov <gleb@redhat.com>,
	Sebastian Ott <sebott@linux.vnet.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [PATCH 03/12] s390: Add mapping helper functions.
Date: Thu, 17 Jan 2013 15:23:48 +0100	[thread overview]
Message-ID: <1358432637-42512-4-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1358432637-42512-1-git-send-email-cornelia.huck@de.ibm.com>

Add s390_cpu_physical_memory_{map,unmap} with special handling
for the lowcore.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 target-s390x/cpu.h    |  4 ++++
 target-s390x/helper.c | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 6700fe9..cd729d3 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -299,6 +299,10 @@ int cpu_s390x_handle_mmu_fault (CPUS390XState *env, target_ulong address, int rw
 
 
 #ifndef CONFIG_USER_ONLY
+void *s390_cpu_physical_memory_map(CPUS390XState *env, hwaddr addr, hwaddr len,
+                                   int is_write);
+void s390_cpu_physical_memory_unmap(CPUS390XState *env, void *addr, hwaddr len,
+                                    int is_write);
 void s390x_tod_timer(void *opaque);
 void s390x_cpu_timer(void *opaque);
 
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index bf2b4d3..d350f28 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -490,6 +490,32 @@ static void cpu_unmap_lowcore(LowCore *lowcore, hwaddr len)
     cpu_physical_memory_unmap(lowcore, len, 1, len);
 }
 
+void *s390_cpu_physical_memory_map(CPUS390XState *env, hwaddr addr, hwaddr len,
+                                   int is_write)
+{
+    hwaddr start = addr;
+
+    /* Mind the prefix area. */
+    if (addr < 8192) {
+        start += env->psa;
+    } else if ((env->psa <= addr) && (addr < env->psa + 8192)) {
+        start -= env->psa;
+    }
+
+    if ((addr + len <= env->psa) || (addr >= env->psa + 8192)) {
+        return cpu_physical_memory_map(start, &len, is_write);
+    }
+
+    DPRINTF("mapping across lowcore boundaries not yet supported\n");
+    return NULL;
+}
+
+void s390_cpu_physical_memory_unmap(CPUS390XState *env, void *addr, hwaddr len,
+                                    int is_write)
+{
+    cpu_physical_memory_unmap(addr, len, is_write, len);
+}
+
 static void do_svc_interrupt(CPUS390XState *env)
 {
     uint64_t mask, addr;
-- 
1.7.12.4

  parent reply	other threads:[~2013-01-17 14:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17 14:23 [PATCH v5 00/12] s390: channel I/O support in qemu Cornelia Huck
2013-01-17 14:23 ` [PATCH 01/12] s390: Add a hypercall registration interface Cornelia Huck
2013-01-18 16:51   ` Alexander Graf
2013-01-17 14:23 ` [PATCH 02/12] s390: Lowcore mapping helper Cornelia Huck
2013-01-18 16:54   ` Alexander Graf
2013-01-17 14:23 ` Cornelia Huck [this message]
2013-01-18 17:07   ` [PATCH 03/12] s390: Add mapping helper functions Alexander Graf
2013-01-17 14:23 ` [PATCH 04/12] Update linux headers Cornelia Huck
2013-01-17 15:05   ` [Qemu-devel] " Peter Maydell
2013-01-17 16:20     ` Cornelia Huck
2013-01-17 16:55       ` Alexander Graf
2013-01-17 14:23 ` [PATCH 05/12] s390: Channel I/O basic defintions Cornelia Huck
2013-01-17 14:23 ` [PATCH 06/12] s390: I/O interrupt and machine check injection Cornelia Huck
2013-01-17 14:23 ` [PATCH 07/12] s390: Add channel I/O instructions Cornelia Huck
2013-01-17 14:23 ` [PATCH 08/12] s390: Virtual channel subsystem support Cornelia Huck
2013-01-17 14:23 ` [PATCH 09/12] s390: Wire up channel I/O in kvm Cornelia Huck
2013-01-17 14:23 ` [PATCH 10/12] s390: Add new channel I/O based virtio transport Cornelia Huck
2013-01-17 14:23 ` [PATCH 11/12] s390-virtio: Factor out some initialization code Cornelia Huck
2013-01-17 14:23 ` [PATCH 12/12] s390: Add s390-ccw-virtio machine Cornelia Huck
2013-01-18 17:24   ` Alexander Graf
2013-01-18 16:49 ` [PATCH v5 00/12] s390: channel I/O support in qemu Alexander Graf

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=1358432637-42512-4-git-send-email-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=gleb@redhat.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sebott@linux.vnet.ibm.com \
    /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