[PATCH 4 of 7] Add vcpu to arguments of powerpc libkvm callbacks

Jerone Young
2008-01-28T03:16:27Z

# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1201488336 21600
# Node ID 3aa131f9bc863af5d029740b1579e747d3703c7e
# Parent 7c535acfd618f41aa6f49efa25e3fd6e1f75b633
Add vcpu to arguments of powerpc libkvm callbacks

This patch adds vcpu as an argmunent for powerpc specific callbacks:
powerpc_dcr_read
powerpc_dcr_write

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-powerpc.c b/libkvm/libkvm-powerpc.c
--- a/libkvm/libkvm-powerpc.c
+++ b/libkvm/libkvm-powerpc.c
@@ -26,15 +26,17 @@
#include <errno.h>
#include <stdio.h>

-int handle_dcr(struct kvm_run *run, kvm_context_t kvm)
+int handle_dcr(struct kvm_run *run, kvm_context_t kvm, int vcpu)
{
int ret = 0;

if (run->dcr.is_write)
- ret = kvm->callbacks->powerpc_dcr_write(run->dcr.dcrn,
+ ret = kvm->callbacks->powerpc_dcr_write(vcpu,
+ run->dcr.dcrn,
run->dcr.data);
else
- ret = kvm->callbacks->powerpc_dcr_read(run->dcr.dcrn,
+ ret = kvm->callbacks->powerpc_dcr_read(vcpu,
+ run->dcr.dcrn,
&(run->dcr.data));

return ret;
@@ -102,7 +104,7 @@ int kvm_arch_run(struct kvm_run *run, kv

switch (run->exit_reason){
case KVM_EXIT_DCR:
- ret = handle_dcr(run, kvm);
+ ret = handle_dcr(run, kvm, vcpu);
break;
default:
ret = 1;
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -66,8 +66,8 @@ struct kvm_callbacks {
int (*pre_kvm_run)(void *opaque, int vcpu);
int (*tpr_access)(void *opaque, int vcpu, uint64_t rip, int is_write);
#if defined(__powerpc__)
- int (*powerpc_dcr_read)(uint32_t dcrn, uint32_t *data);
- int (*powerpc_dcr_write)(uint32_t dcrn, uint32_t data);
+ int (*powerpc_dcr_read)(int vcpu, uint32_t dcrn, uint32_t *data);
+ int (*powerpc_dcr_write)(int vcpu, uint32_t dcrn, uint32_t data);
#endif
};