From: Alexander Graf <agraf@suse.de>
To: QEMU-devel Developers <qemu-devel@nongnu.org>
Cc: peter.maydell@linaro.org, jan.kiszka@siemens.com,
Aurelien Jarno <aurelien@aurel32.net>,
Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH 08/13] s390x: Adjust internal kvm code
Date: Wed, 4 May 2011 14:09:37 +0200 [thread overview]
Message-ID: <1304510982-30810-9-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1304510982-30810-1-git-send-email-agraf@suse.de>
We're now finally emulating an s390x CPU, so we can move quite some logic
from the kvm code out into generic CPU code.
This patch does this and adjusts the interfaces according to what the code
around now expects to be able to call.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
target-s390x/kvm.c | 44 +++++++-------------------------------------
1 files changed, 7 insertions(+), 37 deletions(-)
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 2643460..b68749b 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -49,13 +49,6 @@
#define DIAG_KVM_HYPERCALL 0x500
#define DIAG_KVM_BREAKPOINT 0x501
-#define SCP_LENGTH 0x00
-#define SCP_FUNCTION_CODE 0x02
-#define SCP_CONTROL_MASK 0x03
-#define SCP_RESPONSE_CODE 0x06
-#define SCP_MEM_CODE 0x08
-#define SCP_INCREMENT 0x0a
-
#define ICPT_INSTRUCTION 0x04
#define ICPT_WAITPSW 0x1c
#define ICPT_SOFT_INTERCEPT 0x24
@@ -228,9 +221,9 @@ static void enter_pgmcheck(CPUState *env, uint16_t code)
kvm_s390_interrupt(env, KVM_S390_PROGRAM_INT, code);
}
-static void setcc(CPUState *env, uint64_t cc)
+static inline void setcc(CPUState *env, uint64_t cc)
{
- env->kvm_run->psw_mask &= ~(3ul << 44);
+ env->kvm_run->psw_mask &= ~(3ull << 44);
env->kvm_run->psw_mask |= (cc & 3) << 44;
env->psw.mask &= ~(3ul << 44);
@@ -248,35 +241,11 @@ static int kvm_sclp_service_call(CPUState *env, struct kvm_run *run,
sccb = env->regs[ipbh0 & 0xf];
code = env->regs[(ipbh0 & 0xf0) >> 4];
- dprintf("sclp(0x%x, 0x%lx)\n", sccb, code);
-
- if (sccb & ~0x7ffffff8ul) {
- fprintf(stderr, "KVM: invalid sccb address 0x%x\n", sccb);
- r = -1;
- goto out;
- }
-
- switch(code) {
- case SCLP_CMDW_READ_SCP_INFO:
- case SCLP_CMDW_READ_SCP_INFO_FORCED:
- stw_phys(sccb + SCP_MEM_CODE, ram_size >> 20);
- stb_phys(sccb + SCP_INCREMENT, 1);
- stw_phys(sccb + SCP_RESPONSE_CODE, 0x10);
- setcc(env, 0);
-
- kvm_s390_interrupt_internal(env, KVM_S390_INT_SERVICE,
- sccb & ~3, 0, 1);
- break;
- default:
- dprintf("KVM: invalid sclp call 0x%x / 0x%lx\n", sccb, code);
- r = -1;
- break;
- }
-
-out:
- if (r < 0) {
+ r = sclp_service_call(env, sccb, code);
+ if (r) {
setcc(env, 3);
}
+
return 0;
}
@@ -449,7 +418,8 @@ static int handle_intercept(CPUState *env)
int icpt_code = run->s390_sieic.icptcode;
int r = 0;
- dprintf("intercept: 0x%x (at 0x%lx)\n", icpt_code, env->kvm_run->psw_addr);
+ dprintf("intercept: 0x%x (at 0x%lx)\n", icpt_code,
+ (long)env->kvm_run->psw_addr);
switch (icpt_code) {
case ICPT_INSTRUCTION:
r = handle_instruction(env, run);
--
1.6.0.2
next prev parent reply other threads:[~2011-05-04 12:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 12:09 [Qemu-devel] [PATCH 00/13] s390x emulation support v5 Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 01/13] tcg: extend max tcg opcodes when using 64-on-32bit Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 02/13] s390x: s390x-linux-user support Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 03/13] s390x: make kvm exported functions conditional on kvm Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 04/13] s390x: keep hint on virtio managing size Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 05/13] s390x: Shift variables in CPUState for memset(0) Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 06/13] s390x: helper functions for system emulation Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 07/13] s390x: Implement opcode helpers Alexander Graf
2011-05-04 12:09 ` Alexander Graf [this message]
2011-05-04 12:09 ` [Qemu-devel] [PATCH 09/13] s390x: translate engine for s390x CPU Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 10/13] s390x: Adjust GDB stub Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 11/13] s390x: remove compatibility cc field Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 12/13] s390x: build s390x by default Alexander Graf
2011-05-04 12:09 ` [Qemu-devel] [PATCH 13/13] s390x: Fix debugging for unknown sigp order codes 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=1304510982-30810-9-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=aurelien@aurel32.net \
--cc=jan.kiszka@siemens.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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).