* [PATCH 02/11] kvm, x86: introduce kvm_do_set_mce
@ 2010-10-14 8:42 ` Jin Dongming
0 siblings, 0 replies; 2+ messages in thread
From: Jin Dongming @ 2010-10-14 8:42 UTC (permalink / raw)
To: KVM list
Cc: Dean Nelson, Marcelo Tosatti, Avi Kivity, Huang Ying,
Hidetoshi Seto, qemu-devel@nongnu.org
Share the same error handling.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Tested-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
qemu-kvm.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 6f62973..1338e99 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1130,6 +1130,22 @@ static void sigbus_reraise(void)
abort();
}
+#if defined(KVM_CAP_MCE) && defined(TARGET_I386)
+static void kvm_do_set_mce(CPUState *env, struct kvm_x86_mce *mce,
+ int abort_on_error)
+{
+ int r;
+
+ r = kvm_set_mce(env, mce);
+ if (r < 0) {
+ perror("kvm_set_mce FAILED");
+ if (abort_on_error) {
+ abort();
+ }
+ }
+}
+#endif
+
static void sigbus_handler(int n, struct qemu_signalfd_siginfo *siginfo,
void *ctx)
{
@@ -1365,11 +1381,7 @@ static void kvm_on_sigbus(CPUState *env, siginfo_t *siginfo)
}
}
mce.addr = paddr;
- r = kvm_set_mce(env, &mce);
- if (r < 0) {
- fprintf(stderr, "kvm_set_mce: %s\n", strerror(errno));
- abort();
- }
+ kvm_do_set_mce(env, &mce, 1);
} else
#endif
{
@@ -1913,13 +1925,8 @@ static void kvm_do_inject_x86_mce(void *_data)
return;
}
}
- r = kvm_set_mce(data->env, data->mce);
- if (r < 0) {
- perror("kvm_set_mce FAILED");
- if (data->abort_on_error) {
- abort();
- }
- }
+
+ kvm_do_set_mce(data->env, data->mce, data->abort_on_error);
}
#endif
--
1.7.1.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] [PATCH 02/11] kvm, x86: introduce kvm_do_set_mce
@ 2010-10-14 8:42 ` Jin Dongming
0 siblings, 0 replies; 2+ messages in thread
From: Jin Dongming @ 2010-10-14 8:42 UTC (permalink / raw)
To: KVM list
Cc: Hidetoshi Seto, Dean Nelson, Marcelo Tosatti,
qemu-devel@nongnu.org, Avi Kivity, Huang Ying
Share the same error handling.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Tested-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
qemu-kvm.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 6f62973..1338e99 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1130,6 +1130,22 @@ static void sigbus_reraise(void)
abort();
}
+#if defined(KVM_CAP_MCE) && defined(TARGET_I386)
+static void kvm_do_set_mce(CPUState *env, struct kvm_x86_mce *mce,
+ int abort_on_error)
+{
+ int r;
+
+ r = kvm_set_mce(env, mce);
+ if (r < 0) {
+ perror("kvm_set_mce FAILED");
+ if (abort_on_error) {
+ abort();
+ }
+ }
+}
+#endif
+
static void sigbus_handler(int n, struct qemu_signalfd_siginfo *siginfo,
void *ctx)
{
@@ -1365,11 +1381,7 @@ static void kvm_on_sigbus(CPUState *env, siginfo_t *siginfo)
}
}
mce.addr = paddr;
- r = kvm_set_mce(env, &mce);
- if (r < 0) {
- fprintf(stderr, "kvm_set_mce: %s\n", strerror(errno));
- abort();
- }
+ kvm_do_set_mce(env, &mce, 1);
} else
#endif
{
@@ -1913,13 +1925,8 @@ static void kvm_do_inject_x86_mce(void *_data)
return;
}
}
- r = kvm_set_mce(data->env, data->mce);
- if (r < 0) {
- perror("kvm_set_mce FAILED");
- if (data->abort_on_error) {
- abort();
- }
- }
+
+ kvm_do_set_mce(data->env, data->mce, data->abort_on_error);
}
#endif
--
1.7.1.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-14 8:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-14 8:42 [PATCH 02/11] kvm, x86: introduce kvm_do_set_mce Jin Dongming
2010-10-14 8:42 ` [Qemu-devel] " Jin Dongming
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.