From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
James Hogan <james.hogan@imgtec.com>,
Christoffer Dall <christoffer.dall@linaro.org>,
Gleb Natapov <gleb@redhat.com>, Sanjay Lal <sanjayl@kymasys.com>
Subject: [Qemu-devel] [PULL 11/11] target-mips: Ignore unassigned accesses with KVM
Date: Wed, 6 Aug 2014 18:12:35 +0200 [thread overview]
Message-ID: <1407341555-13173-12-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1407341555-13173-1-git-send-email-pbonzini@redhat.com>
From: James Hogan <james.hogan@imgtec.com>
MIPS registers an unassigned access handler which raises a guest bus
error exception. However this causes QEMU to crash when KVM is enabled
as it isn't called from the main execution loop so longjmp() gets called
without a corresponding setjmp().
Until the KVM API can be updated to trigger a guest exception in
response to an MMIO exit, prevent the bus error exception being raised
from mips_cpu_unassigned_access() if KVM is enabled.
The check is at run time since the do_unassigned_access callback is
initialised before it is known whether KVM will be enabled.
The problem can be triggered with Malta emulation by making the guest
write to the reset region at physical address 0x1bf00000, since it is
marked read-only which is treated as unassigned for writes.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Sanjay Lal <sanjayl@kymasys.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target-mips/op_helper.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 27651a4..df97b35 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -21,6 +21,7 @@
#include "qemu/host-utils.h"
#include "exec/helper-proto.h"
#include "exec/cpu_ldst.h"
+#include "sysemu/kvm.h"
#ifndef CONFIG_USER_ONLY
static inline void cpu_mips_tlb_flush (CPUMIPSState *env, int flush_global);
@@ -2168,6 +2169,16 @@ void mips_cpu_unassigned_access(CPUState *cs, hwaddr addr,
MIPSCPU *cpu = MIPS_CPU(cs);
CPUMIPSState *env = &cpu->env;
+ /*
+ * Raising an exception with KVM enabled will crash because it won't be from
+ * the main execution loop so the longjmp won't have a matching setjmp.
+ * Until we can trigger a bus error exception through KVM lets just ignore
+ * the access.
+ */
+ if (kvm_enabled()) {
+ return;
+ }
+
if (is_exec) {
helper_raise_exception(env, EXCP_IBE);
} else {
--
1.9.3
next prev parent reply other threads:[~2014-08-06 16:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 16:12 [Qemu-devel] [PULL 00/11] KVM, icount changes for 2014-08-06 Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 01/11] backends: Introduce chr-testdev Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 02/11] icount: put icount variables into TimerState Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 03/11] migration: migrate icount fields Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 04/11] timer: add cpu_icount_to_ns function Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 05/11] icount: Fix virtual clock start value on ARM Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 06/11] icount: Add QemuOpts for icount Paolo Bonzini
2015-06-25 10:33 ` Peter Maydell
2014-08-06 16:12 ` [Qemu-devel] [PULL 07/11] icount: Add align option to icount Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 08/11] cpu-exec: Add sleeping algorithm Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 09/11] cpu-exec: Print to console if the guest is late Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 10/11] monitor: Add drift info to 'info jit' Paolo Bonzini
2014-08-06 16:12 ` Paolo Bonzini [this message]
2014-08-07 11:28 ` [Qemu-devel] [PULL 00/11] KVM, icount changes for 2014-08-06 Peter Maydell
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=1407341555-13173-12-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=christoffer.dall@linaro.org \
--cc=gleb@redhat.com \
--cc=james.hogan@imgtec.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sanjayl@kymasys.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;
as well as URLs for NNTP newsgroup(s).