From: Glauber Costa <gcosta@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm-devel@lists.sourceforge.net, avi@qumranet.com
Subject: [PATCH 06/13] [PATCH] turn info kqemu into generic info accelerator
Date: Thu, 15 May 2008 11:09:26 -0300 [thread overview]
Message-ID: <12108605981240-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <121086059420-git-send-email-gcosta@redhat.com>
---
exec-all.h | 8 ++++++++
kqemu.c | 24 ++++++++++++++++++++++++
monitor.c | 36 +++++++++++++-----------------------
3 files changed, 45 insertions(+), 23 deletions(-)
diff --git a/exec-all.h b/exec-all.h
index bfc6576..f1bd7ae 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -583,6 +583,7 @@ typedef struct QEMUAccel {
void (*init_env)(CPUState *env);
void (*flush_cache)(CPUState *env, int global);
void (*flush_page)(CPUState *env, target_ulong addr);
+ int (*info)(CPUState *env, char *buf);
} QEMUAccel;
extern QEMUAccel *current_accel;
@@ -616,6 +617,13 @@ static inline void accel_flush_page(CPUState *env, target_ulong addr)
current_accel->flush_page(env, addr);
}
+static inline int accel_info(CPUState *env, char *buf)
+{
+ if (current_accel && current_accel->info)
+ return current_accel->info(env, buf);
+ return 0;
+}
+
#ifdef USE_KQEMU
#define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))
diff --git a/kqemu.c b/kqemu.c
index 524c74d..451d1d4 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -284,11 +284,35 @@ void kqemu_flush(CPUState *env, int global)
nb_pages_to_flush = KQEMU_FLUSH_ALL;
}
+int kqemu_info(CPUState *env, char *buf)
+{
+ int val, len;
+ val = 0;
+ val = env->kqemu_enabled;
+ len = sprintf(buf, "kqemu support: ");
+ buf += len;
+
+ switch(val) {
+ default:
+ len += sprintf(buf, "present, but bogus value\n");
+ break;
+ case 1:
+ len += sprintf(buf, "enabled for user code\n");
+ break;
+ case 2:
+ len += sprintf(buf, "enabled for user and kernel code\n");
+ break;
+ }
+
+ return len;
+}
+
QEMUAccel kqemu_accel = {
.cpu_interrupt = kqemu_cpu_interrupt,
.init_env = kqemu_init_env,
.flush_cache = kqemu_flush,
.flush_page = kqemu_flush_page,
+ .info = kqemu_info,
};
diff --git a/monitor.c b/monitor.c
index 236b827..cb9faef 100644
--- a/monitor.c
+++ b/monitor.c
@@ -34,6 +34,7 @@
#include "block.h"
#include "audio/audio.h"
#include "disas.h"
+#include "exec-all.h"
#include <dirent.h>
#ifdef CONFIG_PROFILER
@@ -1165,34 +1166,23 @@ static void mem_info(void)
}
#endif
-static void do_info_kqemu(void)
+#define MAX_BUF 1024
+static void do_info_accelerator(void)
{
-#ifdef USE_KQEMU
+ char buf[MAX_BUF];
CPUState *env;
- int val;
- val = 0;
+
env = mon_get_cpu();
+
if (!env) {
term_printf("No cpu initialized yet");
return;
}
- val = env->kqemu_enabled;
- term_printf("kqemu support: ");
- switch(val) {
- default:
- case 0:
- term_printf("disabled\n");
- break;
- case 1:
- term_printf("enabled for user code\n");
- break;
- case 2:
- term_printf("enabled for user and kernel code\n");
- break;
- }
-#else
- term_printf("kqemu support: not compiled\n");
-#endif
+
+ if (accel_info(env, buf))
+ term_printf(buf);
+ else
+ term_printf("No accelerator present\n");
}
#ifdef CONFIG_PROFILER
@@ -1422,8 +1412,8 @@ static term_cmd_t info_cmds[] = {
#endif
{ "jit", "", do_info_jit,
"", "show dynamic compiler info", },
- { "kqemu", "", do_info_kqemu,
- "", "show kqemu information", },
+ { "accelerator", "", do_info_accelerator,
+ "", "show accelerator information", },
{ "usb", "", usb_info,
"", "show guest USB devices", },
{ "usbhost", "", usb_host_info,
--
1.5.5
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
WARNING: multiple messages have this Message-ID (diff)
From: Glauber Costa <gcosta@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm-devel@lists.sourceforge.net
Subject: [Qemu-devel] [PATCH 06/13] [PATCH] turn info kqemu into generic info accelerator
Date: Thu, 15 May 2008 11:09:26 -0300 [thread overview]
Message-ID: <12108605981240-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <121086059420-git-send-email-gcosta@redhat.com>
---
exec-all.h | 8 ++++++++
kqemu.c | 24 ++++++++++++++++++++++++
monitor.c | 36 +++++++++++++-----------------------
3 files changed, 45 insertions(+), 23 deletions(-)
diff --git a/exec-all.h b/exec-all.h
index bfc6576..f1bd7ae 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -583,6 +583,7 @@ typedef struct QEMUAccel {
void (*init_env)(CPUState *env);
void (*flush_cache)(CPUState *env, int global);
void (*flush_page)(CPUState *env, target_ulong addr);
+ int (*info)(CPUState *env, char *buf);
} QEMUAccel;
extern QEMUAccel *current_accel;
@@ -616,6 +617,13 @@ static inline void accel_flush_page(CPUState *env, target_ulong addr)
current_accel->flush_page(env, addr);
}
+static inline int accel_info(CPUState *env, char *buf)
+{
+ if (current_accel && current_accel->info)
+ return current_accel->info(env, buf);
+ return 0;
+}
+
#ifdef USE_KQEMU
#define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))
diff --git a/kqemu.c b/kqemu.c
index 524c74d..451d1d4 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -284,11 +284,35 @@ void kqemu_flush(CPUState *env, int global)
nb_pages_to_flush = KQEMU_FLUSH_ALL;
}
+int kqemu_info(CPUState *env, char *buf)
+{
+ int val, len;
+ val = 0;
+ val = env->kqemu_enabled;
+ len = sprintf(buf, "kqemu support: ");
+ buf += len;
+
+ switch(val) {
+ default:
+ len += sprintf(buf, "present, but bogus value\n");
+ break;
+ case 1:
+ len += sprintf(buf, "enabled for user code\n");
+ break;
+ case 2:
+ len += sprintf(buf, "enabled for user and kernel code\n");
+ break;
+ }
+
+ return len;
+}
+
QEMUAccel kqemu_accel = {
.cpu_interrupt = kqemu_cpu_interrupt,
.init_env = kqemu_init_env,
.flush_cache = kqemu_flush,
.flush_page = kqemu_flush_page,
+ .info = kqemu_info,
};
diff --git a/monitor.c b/monitor.c
index 236b827..cb9faef 100644
--- a/monitor.c
+++ b/monitor.c
@@ -34,6 +34,7 @@
#include "block.h"
#include "audio/audio.h"
#include "disas.h"
+#include "exec-all.h"
#include <dirent.h>
#ifdef CONFIG_PROFILER
@@ -1165,34 +1166,23 @@ static void mem_info(void)
}
#endif
-static void do_info_kqemu(void)
+#define MAX_BUF 1024
+static void do_info_accelerator(void)
{
-#ifdef USE_KQEMU
+ char buf[MAX_BUF];
CPUState *env;
- int val;
- val = 0;
+
env = mon_get_cpu();
+
if (!env) {
term_printf("No cpu initialized yet");
return;
}
- val = env->kqemu_enabled;
- term_printf("kqemu support: ");
- switch(val) {
- default:
- case 0:
- term_printf("disabled\n");
- break;
- case 1:
- term_printf("enabled for user code\n");
- break;
- case 2:
- term_printf("enabled for user and kernel code\n");
- break;
- }
-#else
- term_printf("kqemu support: not compiled\n");
-#endif
+
+ if (accel_info(env, buf))
+ term_printf(buf);
+ else
+ term_printf("No accelerator present\n");
}
#ifdef CONFIG_PROFILER
@@ -1422,8 +1412,8 @@ static term_cmd_t info_cmds[] = {
#endif
{ "jit", "", do_info_jit,
"", "show dynamic compiler info", },
- { "kqemu", "", do_info_kqemu,
- "", "show kqemu information", },
+ { "accelerator", "", do_info_accelerator,
+ "", "show accelerator information", },
{ "usb", "", usb_info,
"", "show guest USB devices", },
{ "usbhost", "", usb_host_info,
--
1.5.5
next prev parent reply other threads:[~2008-05-15 14:09 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-15 14:09 [PATCH 0/13] New shot at QEMUAccel Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 01/13] [PATCH] make cpu_exec_init symmetric Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 02/13] [PATCH] split kqemu_init into two Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 03/13] [PATCH] introduce QEMUAccel and fill it with interrupt specific driver Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 04/13] [PATCH] init env made accel driver Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 05/13] [PATCH] wrap cache flushing functions into accel drivers Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` Glauber Costa [this message]
2008-05-15 14:09 ` [Qemu-devel] [PATCH 06/13] [PATCH] turn info kqemu into generic info accelerator Glauber Costa
2008-05-15 14:09 ` [PATCH 07/13] [PATCH] separate accelerator part of info profiler Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 08/13] [PATCH] move kqemu externs to kqemu.h Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 09/13] [PATCH] move disabling code to kqemu.c instead of vl.c Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 10/13] [PATCH] set_notdirty goes through accel wrapper Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 11/13] [PATCH] wrap modify_page through accel calls Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 12/13] [PATCH] remove kqemu reference from hw/pc.c Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
2008-05-15 14:09 ` [PATCH 13/13] [PATCH] build list of available accelerators Glauber Costa
2008-05-15 14:09 ` [Qemu-devel] " Glauber Costa
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=12108605981240-git-send-email-gcosta@redhat.com \
--to=gcosta@redhat.com \
--cc=avi@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=qemu-devel@nongnu.org \
/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 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.