Skip to contentSkip to conversation

Unlike real hardware, vmport needs access to the CPU registers to handle iomem read and writes. So add an explicit cpu_synchronize_state call, otherwise vmmouse can not work with KVM.

PATCH In review =?UTF-8?q?Reimar=20D=C3=B6ffinger?= 2 participants 4 messages Sep 12, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Unlike real hardware, vmport needs access to the CPU registers to handle iomem read and writes. So add an explicit cpu_synchronize_state call, otherwise vmmouse can not work with KVM.

---
 hw/vmport.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/vmport.c +2 -0
index 884af3f..9a942ee 100644
@@ -25,6 +25,7 @@
 #include "isa.h"
 #include "pc.h"
 #include "sysemu.h"
+#include "kvm.h"
 
 //#define VMPORT_DEBUG
 
@@ -58,6 +59,7 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
     unsigned char command;
     uint32_t eax;
 
+    cpu_synchronize_state(env);
     eax = env->regs[R_EAX];
     if (eax != VMPORT_MAGIC)
         return eax;
Signature · 1 line
1.6.4.2
#1 lore raw

[Qemu-devel] Re: [PATCH] Unlike real hardware, vmport needs access to the CPU [...]

Quoted 18 lines · =?UTF-8?q?Reimar=20D=C3=B6ffinger?= wrote:
---
 hw/vmport.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/vmport.c +1 -0
index 884af3f..9a942ee 100644
@@ -25,6 +25,7 @@
 #include "isa.h"
 #include "pc.h"
 #include "sysemu.h"
+#include "kvm.h"
 
 //#define VMPORT_DEBUG
 

hw/vmport.c static uint32_t vmport_ioport_read(void *opaque, uint32_t addr) · line 65

Quoted 7 lines
hw/vmport.c +1 -0
@@ -58,6 +59,7 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
     unsigned char command;
     uint32_t eax;
 
+    cpu_synchronize_state(env);
     eax = env->regs[R_EAX];
     if (eax != VMPORT_MAGIC)
         return eax;

Ack (qemu-kvm carries a similar patch).

But please grant your patches some proper titles.

Jan

#2 lore raw

Re: [Qemu-devel] Re: [PATCH] Unlike real hardware, vmport needs access to the CPU [...]

Quoted 22 lines · Jan Kiszka
Quoted 21 lines · =?UTF-8?q?Reimar=20D=C3=B6ffinger?= wrote:
---
 hw/vmport.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/vmport.c +1 -0
index 884af3f..9a942ee 100644
@@ -25,6 +25,7 @@
 #include "isa.h"
 #include "pc.h"
 #include "sysemu.h"
+#include "kvm.h"
 
 //#define VMPORT_DEBUG
 
@@ -58,6 +59,7 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
     unsigned char command;
     uint32_t eax;
 
Quoted 6 lines

hw/vmport.c static uint32_t vmport_ioport_read(void *opaque, uint32_t addr) · line 65

Quoted 4 lines
hw/vmport.c +1 -0
+    cpu_synchronize_state(env);
     eax = env->regs[R_EAX];
     if (eax != VMPORT_MAGIC)
         return eax;

Ack (qemu-kvm carries a similar patch).

Now that I look at it... yes.
Except that it does not yet have cpu_synchronize_state and thus is broken for vmport_ioport_write, the return value written to EAX is lost.

Quoted 1 line

But please grant your patches some proper titles.

Sorry, I am still figuring out how to write commit messages that git format-patch handles in a good way (as well as the most sane way to use it in general).

#3 lore raw

Re: [Qemu-devel] Re: [PATCH] Unlike real hardware, vmport needs access to the CPU [...]

Quoted 29 lines · Reimar Döffinger
Quoted 22 lines · Jan Kiszka
Quoted 21 lines · =?UTF-8?q?Reimar=20D=C3=B6ffinger?= wrote:
---
 hw/vmport.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/vmport.c +1 -0
index 884af3f..9a942ee 100644
@@ -25,6 +25,7 @@
 #include "isa.h"
 #include "pc.h"
 #include "sysemu.h"
+#include "kvm.h"
 
 //#define VMPORT_DEBUG
 
@@ -58,6 +59,7 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
     unsigned char command;
     uint32_t eax;
 
Quoted 5 lines

hw/vmport.c static uint32_t vmport_ioport_read(void *opaque, uint32_t addr) · line 65

Quoted 4 lines
hw/vmport.c +1 -0
+    cpu_synchronize_state(env);
     eax = env->regs[R_EAX];
     if (eax != VMPORT_MAGIC)
         return eax;

Ack (qemu-kvm carries a similar patch).

Quoted 3 lines

Now that I look at it... yes.
Except that it does not yet have cpu_synchronize_state and thus is broken for vmport_ioport_write, the return value written to EAX is lost.

Normally qemu-kvm catches such things when merging from upstream.

Quoted 6 lines
Quoted 2 lines

But please grant your patches some proper titles.

Sorry, I am still figuring out how to write commit messages that git format-patch handles in a good way (as well as the most sane way to use it in general).

This rule is simple, just write your commit messages in the form

Title
<blank line>
Description...

Moreover, your mail client is configured to inject "Mail-Followup-To" into your postings. This quickly causes troubles. E.g., it suggested my client to send myself a mail when replying to yours.

Jan