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>,
"Andreas Färber" <afaerber@suse.de>
Subject: [PATCH 02/11] s390: Add mapping helper functions.
Date: Thu, 24 Jan 2013 13:28:02 +0100 [thread overview]
Message-ID: <1359030491-46725-3-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1359030491-46725-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>
---
v5 -> v6:
- Make lowcore/0 page handling easier to read
- Make len a pointer
---
target-s390x/cpu.h | 4 ++++
target-s390x/helper.c | 25 +++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 1f2d942..7951aab 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -302,6 +302,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 023c074..3109c77 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -490,6 +490,31 @@ static void cpu_unmap_lowcore(LowCore *lowcore)
cpu_physical_memory_unmap(lowcore, sizeof(LowCore), 1, sizeof(LowCore));
}
+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) {
+ /* Map the lowcore. */
+ start += env->psa;
+ *len = MIN(*len, 8192 - addr);
+ } else if ((addr >= env->psa) && (addr < env->psa + 8192)) {
+ /* Map the 0 page. */
+ start -= env->psa;
+ *len = MIN(*len, 8192 - start);
+ }
+
+ return cpu_physical_memory_map(start, len, is_write);
+}
+
+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
next prev parent reply other threads:[~2013-01-24 12:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 12:28 [PATCH v6 00/11] s390: channel I/O support in qemu Cornelia Huck
2013-01-24 12:28 ` [PATCH 01/11] s390: Lowcore mapping helper Cornelia Huck
2013-01-24 12:28 ` Cornelia Huck [this message]
2013-01-24 12:28 ` [PATCH 03/11] s390: Channel I/O basic definitions Cornelia Huck
2013-01-24 12:28 ` [PATCH 04/11] s390: I/O interrupt and machine check injection Cornelia Huck
2013-01-24 12:28 ` [PATCH 05/11] s390: Add channel I/O instructions Cornelia Huck
2013-01-24 12:28 ` [PATCH 06/11] s390: Virtual channel subsystem support Cornelia Huck
2013-01-24 12:28 ` [PATCH 07/11] s390: Wire up channel I/O in kvm Cornelia Huck
2013-01-24 12:28 ` [PATCH 08/11] s390: Add new channel I/O based virtio transport Cornelia Huck
2013-01-24 13:18 ` [Qemu-devel] " Andreas Färber
2013-01-24 14:35 ` Cornelia Huck
2013-01-24 14:42 ` Cornelia Huck
2013-01-24 15:33 ` Andreas Färber
2013-01-24 12:28 ` [PATCH 09/11] s390-virtio: Factor out some initialization code Cornelia Huck
2013-01-24 12:28 ` [PATCH 10/11] s390: Add default support for SCLP console Cornelia Huck
2013-01-24 12:28 ` [PATCH 11/11] s390: Add s390-ccw-virtio machine Cornelia Huck
2013-01-24 14:08 ` [PATCH v6 00/11] s390: channel I/O support in qemu Alexander Graf
2013-01-25 14:15 ` Anthony Liguori
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=1359030491-46725-3-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=afaerber@suse.de \
--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