diff mbox

KVM: PPC: bookehv64: Add support for std/ld emulation.

Message ID 1340052146-1172-1-git-send-email-Varun.Sethi@freescale.com
State New, archived
Headers show

Commit Message

Varun Sethi June 18, 2012, 8:42 p.m. UTC
Add support for std/ld emulation.

Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com>
---
 arch/powerpc/kvm/emulate.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

Comments

Scott Wood June 18, 2012, 8:48 p.m. UTC | #1
On 06/18/2012 03:42 PM, Varun Sethi wrote:
> Add support for std/ld emulation.
> 
> Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com>
> ---
>  arch/powerpc/kvm/emulate.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
> index f90e86d..a04543a 100644
> --- a/arch/powerpc/kvm/emulate.c
> +++ b/arch/powerpc/kvm/emulate.c
> @@ -59,11 +59,13 @@
>  #define OP_31_XOP_STHBRX    918
>  
>  #define OP_LWZ  32
> +#define OP_LD   58
>  #define OP_LWZU 33
>  #define OP_LBZ  34
>  #define OP_LBZU 35
>  #define OP_STW  36
>  #define OP_STWU 37
> +#define OP_STD  62
>  #define OP_STB  38
>  #define OP_STBU 39
>  #define OP_LHZ  40

What about STDU, STDX, LWA, etc?  If you're going to add some 64-bit
load/store instructions, but not others of the same classes as are
implemented for 32-bit, at least leave a comment pointing out what's
missing.

-Scott

--
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
Sethi Varun-B16395 June 18, 2012, 8:58 p.m. UTC | #2
> -----Original Message-----

> From: Wood Scott-B07421

> Sent: Tuesday, June 19, 2012 2:19 AM

> To: Sethi Varun-B16395

> Cc: kvm-ppc@vger.kernel.org

> Subject: Re: [PATCH] KVM: PPC: bookehv64: Add support for std/ld

> emulation.

> 

> On 06/18/2012 03:42 PM, Varun Sethi wrote:

> > Add support for std/ld emulation.

> >

> > Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com>

> > ---

> >  arch/powerpc/kvm/emulate.c |   14 ++++++++++++++

> >  1 files changed, 14 insertions(+), 0 deletions(-)

> >

> > diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c

> > index f90e86d..a04543a 100644

> > --- a/arch/powerpc/kvm/emulate.c

> > +++ b/arch/powerpc/kvm/emulate.c

> > @@ -59,11 +59,13 @@

> >  #define OP_31_XOP_STHBRX    918

> >

> >  #define OP_LWZ  32

> > +#define OP_LD   58

> >  #define OP_LWZU 33

> >  #define OP_LBZ  34

> >  #define OP_LBZU 35

> >  #define OP_STW  36

> >  #define OP_STWU 37

> > +#define OP_STD  62

> >  #define OP_STB  38

> >  #define OP_STBU 39

> >  #define OP_LHZ  40

> 

> What about STDU, STDX, LWA, etc?  If you're going to add some 64-bit

> load/store instructions, but not others of the same classes as are

> implemented for 32-bit, at least leave a comment pointing out what's

> missing.

There would be a separate patch for supporting those instructions. I will a "TBD" comment 
in the code.

-Varun
diff mbox

Patch

diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index f90e86d..a04543a 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -59,11 +59,13 @@ 
 #define OP_31_XOP_STHBRX    918
 
 #define OP_LWZ  32
+#define OP_LD   58
 #define OP_LWZU 33
 #define OP_LBZ  34
 #define OP_LBZU 35
 #define OP_STW  36
 #define OP_STWU 37
+#define OP_STD  62
 #define OP_STB  38
 #define OP_STBU 39
 #define OP_LHZ  40
@@ -392,6 +394,11 @@  int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
 		emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
 		break;
 
+	case OP_LD:
+		rt = get_rt(inst);
+		emulated = kvmppc_handle_load(run, vcpu, rt, 8, 1);
+		break;
+
 	case OP_LWZU:
 		emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
 		kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
@@ -412,6 +419,13 @@  int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
 		                               4, 1);
 		break;
 
+	case OP_STD:
+		rs = get_rs(inst);
+		emulated = kvmppc_handle_store(run, vcpu,
+					       kvmppc_get_gpr(vcpu, rs),
+		                               8, 1);
+		break;
+
 	case OP_STWU:
 		emulated = kvmppc_handle_store(run, vcpu,
 					       kvmppc_get_gpr(vcpu, rs),