All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glauber Costa <gcosta@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm-devel@lists.sourceforge.net, avi@qumranet.com
Subject: [PATCH 11/13] [PATCH] wrap modify_page through accel calls
Date: Thu, 15 May 2008 11:09:31 -0300	[thread overview]
Message-ID: <12108606151640-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <12108606121918-git-send-email-gcosta@redhat.com>

---
 exec-all.h |    8 +++++++-
 exec.c     |   24 +++++++++---------------
 kqemu.c    |   26 +++++++++++++++-----------
 3 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/exec-all.h b/exec-all.h
index ed96a22..04112e0 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -586,6 +586,7 @@ typedef struct QEMUAccel {
     int (*info)(CPUState *env, char *buf);
     int (*profile)(CPUState *env, char *buf);
     void (*set_notdirty)(ram_addr_t addr);
+    void (*modify_page)(ram_addr_t addr, int dirty_flags);
 } QEMUAccel;
 
 extern QEMUAccel *current_accel;
@@ -639,11 +640,16 @@ static inline void accel_set_notdirty(target_ulong addr)
         current_accel->set_notdirty(addr);
 }
 
+static inline void accel_modify_page(target_ulong addr, int dirty_flags)
+{
+    if (current_accel && current_accel->modify_page)
+        current_accel->modify_page(addr, dirty_flags);
+}
+
 #ifdef USE_KQEMU
 #define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))
 
 int kqemu_cpu_exec(CPUState *env);
-void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr);
 void kqemu_record_dump(void);
 
 static inline int kqemu_is_ok(CPUState *env)
diff --git a/exec.c b/exec.c
index 6d05f75..92f1552 100644
--- a/exec.c
+++ b/exec.c
@@ -2185,11 +2185,9 @@ static void notdirty_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t
 #endif
     }
     stb_p((uint8_t *)(long)addr, val);
-#ifdef USE_KQEMU
-    if (cpu_single_env->kqemu_enabled &&
-        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
-        kqemu_modify_page(cpu_single_env, ram_addr);
-#endif
+
+    accel_modify_page(ram_addr, dirty_flags);
+
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been
@@ -2211,11 +2209,9 @@ static void notdirty_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t
 #endif
     }
     stw_p((uint8_t *)(long)addr, val);
-#ifdef USE_KQEMU
-    if (cpu_single_env->kqemu_enabled &&
-        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
-        kqemu_modify_page(cpu_single_env, ram_addr);
-#endif
+
+    accel_modify_page(ram_addr, dirty_flags);
+
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been
@@ -2237,11 +2233,9 @@ static void notdirty_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t
 #endif
     }
     stl_p((uint8_t *)(long)addr, val);
-#ifdef USE_KQEMU
-    if (cpu_single_env->kqemu_enabled &&
-        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
-        kqemu_modify_page(cpu_single_env, ram_addr);
-#endif
+
+    accel_modify_page(ram_addr, dirty_flags);
+
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been
diff --git a/kqemu.c b/kqemu.c
index 44c1a55..7e24bb7 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -358,16 +358,6 @@ void kqemu_set_notdirty(ram_addr_t ram_addr)
         ram_pages_to_update[nb_ram_pages_to_update++] = ram_addr;
 }
 
-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,
-    .profile = kqemu_profile,
-    .set_notdirty = kqemu_set_notdirty,
-};
-
 static void kqemu_reset_modified_ram_pages(void)
 {
     int i;
@@ -380,7 +370,7 @@ static void kqemu_reset_modified_ram_pages(void)
     nb_modified_ram_pages = 0;
 }
 
-void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr)
+void kqemu_modify_page(ram_addr_t ram_addr, int dirty_flags)
 {
     unsigned long page_index;
     int ret;
@@ -388,6 +378,8 @@ void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr)
     DWORD temp;
 #endif
 
+    if ((dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
+        return;
     page_index = ram_addr >> TARGET_PAGE_BITS;
     if (!modified_ram_pages_table[page_index]) {
 #if 0
@@ -411,6 +403,18 @@ void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr)
     }
 }
 
+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,
+    .profile = kqemu_profile,
+    .set_notdirty = kqemu_set_notdirty,
+    .modify_page = kqemu_modify_page,
+};
+
+
 struct fpstate {
     uint16_t fpuc;
     uint16_t dummy1;
-- 
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 11/13] [PATCH] wrap modify_page through accel calls
Date: Thu, 15 May 2008 11:09:31 -0300	[thread overview]
Message-ID: <12108606151640-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <12108606121918-git-send-email-gcosta@redhat.com>

---
 exec-all.h |    8 +++++++-
 exec.c     |   24 +++++++++---------------
 kqemu.c    |   26 +++++++++++++++-----------
 3 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/exec-all.h b/exec-all.h
index ed96a22..04112e0 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -586,6 +586,7 @@ typedef struct QEMUAccel {
     int (*info)(CPUState *env, char *buf);
     int (*profile)(CPUState *env, char *buf);
     void (*set_notdirty)(ram_addr_t addr);
+    void (*modify_page)(ram_addr_t addr, int dirty_flags);
 } QEMUAccel;
 
 extern QEMUAccel *current_accel;
@@ -639,11 +640,16 @@ static inline void accel_set_notdirty(target_ulong addr)
         current_accel->set_notdirty(addr);
 }
 
+static inline void accel_modify_page(target_ulong addr, int dirty_flags)
+{
+    if (current_accel && current_accel->modify_page)
+        current_accel->modify_page(addr, dirty_flags);
+}
+
 #ifdef USE_KQEMU
 #define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))
 
 int kqemu_cpu_exec(CPUState *env);
-void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr);
 void kqemu_record_dump(void);
 
 static inline int kqemu_is_ok(CPUState *env)
diff --git a/exec.c b/exec.c
index 6d05f75..92f1552 100644
--- a/exec.c
+++ b/exec.c
@@ -2185,11 +2185,9 @@ static void notdirty_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t
 #endif
     }
     stb_p((uint8_t *)(long)addr, val);
-#ifdef USE_KQEMU
-    if (cpu_single_env->kqemu_enabled &&
-        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
-        kqemu_modify_page(cpu_single_env, ram_addr);
-#endif
+
+    accel_modify_page(ram_addr, dirty_flags);
+
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been
@@ -2211,11 +2209,9 @@ static void notdirty_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t
 #endif
     }
     stw_p((uint8_t *)(long)addr, val);
-#ifdef USE_KQEMU
-    if (cpu_single_env->kqemu_enabled &&
-        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
-        kqemu_modify_page(cpu_single_env, ram_addr);
-#endif
+
+    accel_modify_page(ram_addr, dirty_flags);
+
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been
@@ -2237,11 +2233,9 @@ static void notdirty_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t
 #endif
     }
     stl_p((uint8_t *)(long)addr, val);
-#ifdef USE_KQEMU
-    if (cpu_single_env->kqemu_enabled &&
-        (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
-        kqemu_modify_page(cpu_single_env, ram_addr);
-#endif
+
+    accel_modify_page(ram_addr, dirty_flags);
+
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been
diff --git a/kqemu.c b/kqemu.c
index 44c1a55..7e24bb7 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -358,16 +358,6 @@ void kqemu_set_notdirty(ram_addr_t ram_addr)
         ram_pages_to_update[nb_ram_pages_to_update++] = ram_addr;
 }
 
-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,
-    .profile = kqemu_profile,
-    .set_notdirty = kqemu_set_notdirty,
-};
-
 static void kqemu_reset_modified_ram_pages(void)
 {
     int i;
@@ -380,7 +370,7 @@ static void kqemu_reset_modified_ram_pages(void)
     nb_modified_ram_pages = 0;
 }
 
-void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr)
+void kqemu_modify_page(ram_addr_t ram_addr, int dirty_flags)
 {
     unsigned long page_index;
     int ret;
@@ -388,6 +378,8 @@ void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr)
     DWORD temp;
 #endif
 
+    if ((dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)
+        return;
     page_index = ram_addr >> TARGET_PAGE_BITS;
     if (!modified_ram_pages_table[page_index]) {
 #if 0
@@ -411,6 +403,18 @@ void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr)
     }
 }
 
+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,
+    .profile = kqemu_profile,
+    .set_notdirty = kqemu_set_notdirty,
+    .modify_page = kqemu_modify_page,
+};
+
+
 struct fpstate {
     uint16_t fpuc;
     uint16_t dummy1;
-- 
1.5.5

  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           ` [PATCH 06/13] [PATCH] turn info kqemu into generic info accelerator Glauber Costa
2008-05-15 14:09             ` [Qemu-devel] " 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                     ` Glauber Costa [this message]
2008-05-15 14:09                       ` [Qemu-devel] [PATCH 11/13] [PATCH] wrap modify_page through accel calls 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=12108606151640-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.