Patchwork [1/2] KVM: PPC: 440: Implement mtdcrx

login
register
mail settings
Submitter Alexander Graf
Date Aug. 15, 2012, 10:42 p.m.
Message ID <1345070546-27513-1-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/177869/
State New
Headers show

Comments

Alexander Graf - Aug. 15, 2012, 10:42 p.m.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/44x_emulate.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Avi Kivity - Aug. 16, 2012, 9:11 a.m.
On 08/16/2012 01:42 AM, Alexander Graf wrote:
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/powerpc/kvm/44x_emulate.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c
> index c8c6157..ea57631 100644
> --- a/arch/powerpc/kvm/44x_emulate.c
> +++ b/arch/powerpc/kvm/44x_emulate.c
> @@ -28,6 +28,7 @@
>  #include "44x_tlb.h"
>  
>  #define XOP_MFDCR   323
> +#define XOP_MTDCRX  387
>  #define XOP_MTDCR   451
>  #define XOP_TLBSX   914
>  #define XOP_ICCCI   966
> @@ -84,6 +85,8 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  
>  			break;
>  
> +		case XOP_MTDCRX:
> +			dcrn = kvmppc_get_gpr(vcpu, ra);
>  		case XOP_MTDCR:

It's customary to put a /* fallthrough */ comment to shut down any
alarms that may be firing off in readers' minds.
Alexander Graf - Aug. 16, 2012, 10:50 a.m.
On 16.08.2012, at 11:11, Avi Kivity wrote:

> On 08/16/2012 01:42 AM, Alexander Graf wrote:
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> arch/powerpc/kvm/44x_emulate.c |    3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>> 
>> diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c
>> index c8c6157..ea57631 100644
>> --- a/arch/powerpc/kvm/44x_emulate.c
>> +++ b/arch/powerpc/kvm/44x_emulate.c
>> @@ -28,6 +28,7 @@
>> #include "44x_tlb.h"
>> 
>> #define XOP_MFDCR   323
>> +#define XOP_MTDCRX  387
>> #define XOP_MTDCR   451
>> #define XOP_TLBSX   914
>> #define XOP_ICCCI   966
>> @@ -84,6 +85,8 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
>> 
>> 			break;
>> 
>> +		case XOP_MTDCRX:
>> +			dcrn = kvmppc_get_gpr(vcpu, ra);
>> 		case XOP_MTDCR:
> 
> It's customary to put a /* fallthrough */ comment to shut down any
> alarms that may be firing off in readers' minds.

Yeah, I moved this over into function calls now. Makes the code easier to read :). And hopefully the compiler is smart enough to optimize it the same way.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c
index c8c6157..ea57631 100644
--- a/arch/powerpc/kvm/44x_emulate.c
+++ b/arch/powerpc/kvm/44x_emulate.c
@@ -28,6 +28,7 @@ 
 #include "44x_tlb.h"
 
 #define XOP_MFDCR   323
+#define XOP_MTDCRX  387
 #define XOP_MTDCR   451
 #define XOP_TLBSX   914
 #define XOP_ICCCI   966
@@ -84,6 +85,8 @@  int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
 
 			break;
 
+		case XOP_MTDCRX:
+			dcrn = kvmppc_get_gpr(vcpu, ra);
 		case XOP_MTDCR:
 			/* emulate some access in kernel */
 			switch (dcrn) {