* [PATCH 0/3] Further integration with qemu.git
@ 2009-10-19 13:20 Glauber Costa
2009-10-19 13:20 ` [PATCH 1/3] use handle_io upstream version Glauber Costa
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Glauber Costa @ 2009-10-19 13:20 UTC (permalink / raw)
To: kvm; +Cc: avi
A couple of more functions are used from qemu.git.
Merging keeps going...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] use handle_io upstream version.
2009-10-19 13:20 [PATCH 0/3] Further integration with qemu.git Glauber Costa
@ 2009-10-19 13:20 ` Glauber Costa
2009-10-19 13:20 ` [PATCH 2/3] change pre and post kvm_run signatures Glauber Costa
2009-10-19 23:47 ` [PATCH 0/3] Further integration with qemu.git Avi Kivity
2009-10-20 15:01 ` Marcelo Tosatti
2 siblings, 1 reply; 6+ messages in thread
From: Glauber Costa @ 2009-10-19 13:20 UTC (permalink / raw)
To: kvm; +Cc: avi
We can use upstream version of handle_io, there called kvm_handle_io()
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
kvm-all.c | 2 ++
qemu-kvm.c | 58 +++++-----------------------------------------------------
2 files changed, 7 insertions(+), 53 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 5ea999e..5a7be5b 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -520,6 +520,7 @@ err:
return ret;
}
+#endif
static int kvm_handle_io(uint16_t port, void *data, int direction, int size,
uint32_t count)
@@ -560,6 +561,7 @@ static int kvm_handle_io(uint16_t port, void *data, int direction, int size,
return 1;
}
+#ifdef KVM_UPSTREAM
static void kvm_run_coalesced_mmio(CPUState *env, struct kvm_run *run)
{
#ifdef KVM_CAP_COALESCED_MMIO
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 91cfc32..ad00560 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -751,58 +751,6 @@ int kvm_set_irqchip(kvm_context_t kvm, struct kvm_irqchip *chip)
#endif
-static int handle_io(CPUState *env)
-{
- struct kvm_run *run = env->kvm_run;
- uint16_t addr = run->io.port;
- int i;
- void *p = (void *) run + run->io.data_offset;
-
- for (i = 0; i < run->io.count; ++i) {
- switch (run->io.direction) {
- case KVM_EXIT_IO_IN:
- switch (run->io.size) {
- case 1:
- *(uint8_t *) p = cpu_inb(addr);
- break;
- case 2:
- *(uint16_t *) p = cpu_inw(addr);
- break;
- case 4:
- *(uint32_t *) p = cpu_inl(addr);
- break;
- default:
- fprintf(stderr, "bad I/O size %d\n", run->io.size);
- return -EMSGSIZE;
- }
- break;
- case KVM_EXIT_IO_OUT:
- switch (run->io.size) {
- case 1:
- cpu_outb(addr, *(uint8_t *) p);
- break;
- case 2:
- cpu_outw(addr, *(uint16_t *) p);
- break;
- case 4:
- cpu_outl(addr, *(uint32_t *) p);
- break;
- default:
- fprintf(stderr, "bad I/O size %d\n", run->io.size);
- return -EMSGSIZE;
- }
- break;
- default:
- fprintf(stderr, "bad I/O direction %d\n", run->io.direction);
- return -EPROTO;
- }
-
- p += run->io.size;
- }
-
- return 0;
-}
-
static int handle_debug(CPUState *env)
{
#ifdef KVM_CAP_SET_GUEST_DEBUG
@@ -994,7 +942,11 @@ int kvm_run(CPUState *env)
abort();
break;
case KVM_EXIT_IO:
- r = handle_io(env);
+ r = kvm_handle_io(run->io.port,
+ (uint8_t *)run + run->io.data_offset,
+ run->io.direction,
+ run->io.size,
+ run->io.count);
break;
case KVM_EXIT_DEBUG:
r = handle_debug(env);
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] change pre and post kvm_run signatures.
2009-10-19 13:20 ` [PATCH 1/3] use handle_io upstream version Glauber Costa
@ 2009-10-19 13:20 ` Glauber Costa
2009-10-19 13:20 ` [PATCH 3/3] use upstream version of kvm_arch_post_run Glauber Costa
0 siblings, 1 reply; 6+ messages in thread
From: Glauber Costa @ 2009-10-19 13:20 UTC (permalink / raw)
To: kvm; +Cc: avi
Intention is to merge with upstream version in the following patch.
Doing as a separate step to help identify any further issues.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
qemu-kvm-x86.c | 6 ++++--
qemu-kvm.c | 4 ++--
qemu-kvm.h | 4 ++--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 350e5fd..b9ffabb 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1329,13 +1329,14 @@ int kvm_arch_halt(CPUState *env)
return 1;
}
-void kvm_arch_pre_kvm_run(void *opaque, CPUState *env)
+int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
{
if (!kvm_irqchip_in_kernel())
kvm_set_cr8(env, cpu_get_apic_tpr(env));
+ return 0;
}
-void kvm_arch_post_kvm_run(void *opaque, CPUState *env)
+int kvm_arch_post_run(CPUState *env, struct kvm_run *run)
{
cpu_single_env = env;
@@ -1344,6 +1345,7 @@ void kvm_arch_post_kvm_run(void *opaque, CPUState *env)
cpu_set_apic_tpr(env, kvm_get_cr8(env));
cpu_set_apic_base(env, kvm_get_apic_base(env));
+ return 0;
}
int kvm_arch_has_work(CPUState *env)
diff --git a/qemu-kvm.c b/qemu-kvm.c
index ad00560..a883a48 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -852,12 +852,12 @@ static inline void push_nmi(kvm_context_t kvm)
void post_kvm_run(kvm_context_t kvm, CPUState *env)
{
pthread_mutex_lock(&qemu_mutex);
- kvm_arch_post_kvm_run(kvm->opaque, env);
+ kvm_arch_post_run(env, env->kvm_run);
}
int pre_kvm_run(kvm_context_t kvm, CPUState *env)
{
- kvm_arch_pre_kvm_run(kvm->opaque, env);
+ kvm_arch_pre_run(env, env->kvm_run);
pthread_mutex_unlock(&qemu_mutex);
return 0;
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 06507a6..b84fed1 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -965,8 +965,8 @@ void kvm_arch_load_regs(CPUState *env);
void kvm_arch_load_mpstate(CPUState *env);
void kvm_arch_save_mpstate(CPUState *env);
int kvm_arch_init_vcpu(CPUState *cenv);
-void kvm_arch_pre_kvm_run(void *opaque, CPUState *env);
-void kvm_arch_post_kvm_run(void *opaque, CPUState *env);
+int kvm_arch_pre_run(CPUState *env, struct kvm_run *run);
+int kvm_arch_post_run(CPUState *env, struct kvm_run *run);
int kvm_arch_has_work(CPUState *env);
void kvm_arch_process_irqchip_events(CPUState *env);
int kvm_arch_try_push_interrupts(void *opaque);
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] use upstream version of kvm_arch_post_run
2009-10-19 13:20 ` [PATCH 2/3] change pre and post kvm_run signatures Glauber Costa
@ 2009-10-19 13:20 ` Glauber Costa
0 siblings, 0 replies; 6+ messages in thread
From: Glauber Costa @ 2009-10-19 13:20 UTC (permalink / raw)
To: kvm; +Cc: avi
Replace ours with qemu.git version. A couple of functions go
unused, and are deleted.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
qemu-kvm-x86.c | 22 ----------------------
qemu-kvm.c | 5 -----
qemu-kvm.h | 11 -----------
target-i386/kvm.c | 2 ++
4 files changed, 2 insertions(+), 38 deletions(-)
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index b9ffabb..db0b351 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -515,21 +515,11 @@ void kvm_show_regs(CPUState *env)
sregs.efer);
}
-static uint64_t kvm_get_apic_base(CPUState *env)
-{
- return env->kvm_run->apic_base;
-}
-
static void kvm_set_cr8(CPUState *env, uint64_t cr8)
{
env->kvm_run->cr8 = cr8;
}
-static __u64 kvm_get_cr8(CPUState *env)
-{
- return env->kvm_run->cr8;
-}
-
int kvm_setup_cpuid(CPUState *env, int nent,
struct kvm_cpuid_entry *entries)
{
@@ -1336,18 +1326,6 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
return 0;
}
-int kvm_arch_post_run(CPUState *env, struct kvm_run *run)
-{
- cpu_single_env = env;
-
- env->eflags = kvm_get_interrupt_flag(env)
- ? env->eflags | IF_MASK : env->eflags & ~IF_MASK;
-
- cpu_set_apic_tpr(env, kvm_get_cr8(env));
- cpu_set_apic_base(env, kvm_get_apic_base(env));
- return 0;
-}
-
int kvm_arch_has_work(CPUState *env)
{
if (((env->interrupt_request & CPU_INTERRUPT_HARD) &&
diff --git a/qemu-kvm.c b/qemu-kvm.c
index a883a48..57d8b1a 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -863,11 +863,6 @@ int pre_kvm_run(kvm_context_t kvm, CPUState *env)
return 0;
}
-int kvm_get_interrupt_flag(CPUState *env)
-{
- return env->kvm_run->if_flag;
-}
-
int kvm_is_ready_for_interrupt_injection(CPUState *env)
{
return env->kvm_run->ready_for_interrupt_injection;
diff --git a/qemu-kvm.h b/qemu-kvm.h
index b84fed1..57c8c86 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -190,17 +190,6 @@ void kvm_create_irqchip(kvm_context_t kvm);
int kvm_run(CPUState *env);
/*!
- * \brief Get interrupt flag from on last exit to userspace
- *
- * This gets the CPU interrupt flag as it was on the last exit to userspace.
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- * \return interrupt flag value (0 or 1)
- */
-int kvm_get_interrupt_flag(CPUState *env);
-
-/*!
* \brief Check if a vcpu is ready for interrupt injection
*
* This checks if vcpu interrupts are not masked by mov ss or sti.
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 1cf0dc3..24c9903 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -748,6 +748,7 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
return 0;
}
+#endif
int kvm_arch_post_run(CPUState *env, struct kvm_run *run)
{
@@ -762,6 +763,7 @@ int kvm_arch_post_run(CPUState *env, struct kvm_run *run)
return 0;
}
+#ifdef KVM_UPSTREAM
static int kvm_handle_halt(CPUState *env)
{
if (!((env->interrupt_request & CPU_INTERRUPT_HARD) &&
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Further integration with qemu.git
2009-10-19 13:20 [PATCH 0/3] Further integration with qemu.git Glauber Costa
2009-10-19 13:20 ` [PATCH 1/3] use handle_io upstream version Glauber Costa
@ 2009-10-19 23:47 ` Avi Kivity
2009-10-20 15:01 ` Marcelo Tosatti
2 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2009-10-19 23:47 UTC (permalink / raw)
To: Glauber Costa; +Cc: kvm
On 10/19/2009 10:20 PM, Glauber Costa wrote:
> A couple of more functions are used from qemu.git.
> Merging keeps going...
>
Looks good.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Further integration with qemu.git
2009-10-19 13:20 [PATCH 0/3] Further integration with qemu.git Glauber Costa
2009-10-19 13:20 ` [PATCH 1/3] use handle_io upstream version Glauber Costa
2009-10-19 23:47 ` [PATCH 0/3] Further integration with qemu.git Avi Kivity
@ 2009-10-20 15:01 ` Marcelo Tosatti
2 siblings, 0 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2009-10-20 15:01 UTC (permalink / raw)
To: Glauber Costa; +Cc: kvm, avi
On Mon, Oct 19, 2009 at 11:20:41AM -0200, Glauber Costa wrote:
> A couple of more functions are used from qemu.git.
> Merging keeps going...
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-10-20 17:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-19 13:20 [PATCH 0/3] Further integration with qemu.git Glauber Costa
2009-10-19 13:20 ` [PATCH 1/3] use handle_io upstream version Glauber Costa
2009-10-19 13:20 ` [PATCH 2/3] change pre and post kvm_run signatures Glauber Costa
2009-10-19 13:20 ` [PATCH 3/3] use upstream version of kvm_arch_post_run Glauber Costa
2009-10-19 23:47 ` [PATCH 0/3] Further integration with qemu.git Avi Kivity
2009-10-20 15:01 ` Marcelo Tosatti
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).