Skip to content

Commit

Permalink
kvm/powerpc: move kvm_hypercall0() and friends to epapr_hypercall0()
Browse files Browse the repository at this point in the history
kvm_hypercall0() and friends have nothing KVM specific so moved to
epapr_hypercall0() and friends. Also they are moved from
arch/powerpc/include/asm/kvm_para.h to arch/powerpc/include/asm/epapr_hcalls.h

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
Bharat Bhushan authored and Alexander Graf committed Jan 9, 2014
1 parent 1820a8d commit b1f0d94
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 68 deletions.
65 changes: 65 additions & 0 deletions arch/powerpc/include/asm/epapr_hcalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,5 +506,70 @@ static unsigned long epapr_hypercall(unsigned long *in,
}
#endif

static inline long epapr_hypercall0_1(unsigned int nr, unsigned long *r2)
{
unsigned long in[8];
unsigned long out[8];
unsigned long r;

r = epapr_hypercall(in, out, nr);
*r2 = out[0];

return r;
}

static inline long epapr_hypercall0(unsigned int nr)
{
unsigned long in[8];
unsigned long out[8];

return epapr_hypercall(in, out, nr);
}

static inline long epapr_hypercall1(unsigned int nr, unsigned long p1)
{
unsigned long in[8];
unsigned long out[8];

in[0] = p1;
return epapr_hypercall(in, out, nr);
}

static inline long epapr_hypercall2(unsigned int nr, unsigned long p1,
unsigned long p2)
{
unsigned long in[8];
unsigned long out[8];

in[0] = p1;
in[1] = p2;
return epapr_hypercall(in, out, nr);
}

static inline long epapr_hypercall3(unsigned int nr, unsigned long p1,
unsigned long p2, unsigned long p3)
{
unsigned long in[8];
unsigned long out[8];

in[0] = p1;
in[1] = p2;
in[2] = p3;
return epapr_hypercall(in, out, nr);
}

static inline long epapr_hypercall4(unsigned int nr, unsigned long p1,
unsigned long p2, unsigned long p3,
unsigned long p4)
{
unsigned long in[8];
unsigned long out[8];

in[0] = p1;
in[1] = p2;
in[2] = p3;
in[3] = p4;
return epapr_hypercall(in, out, nr);
}
#endif /* !__ASSEMBLY__ */
#endif /* _EPAPR_HCALLS_H */
69 changes: 1 addition & 68 deletions arch/powerpc/include/asm/kvm_para.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,81 +48,14 @@ static inline int kvm_para_available(void)

#endif

static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2)
{
unsigned long in[8];
unsigned long out[8];
unsigned long r;

r = epapr_hypercall(in, out, KVM_HCALL_TOKEN(nr));
*r2 = out[0];

return r;
}

static inline long kvm_hypercall0(unsigned int nr)
{
unsigned long in[8];
unsigned long out[8];

return epapr_hypercall(in, out, KVM_HCALL_TOKEN(nr));
}

static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
{
unsigned long in[8];
unsigned long out[8];

in[0] = p1;
return epapr_hypercall(in, out, KVM_HCALL_TOKEN(nr));
}

static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
unsigned long p2)
{
unsigned long in[8];
unsigned long out[8];

in[0] = p1;
in[1] = p2;
return epapr_hypercall(in, out, KVM_HCALL_TOKEN(nr));
}

static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
unsigned long p2, unsigned long p3)
{
unsigned long in[8];
unsigned long out[8];

in[0] = p1;
in[1] = p2;
in[2] = p3;
return epapr_hypercall(in, out, KVM_HCALL_TOKEN(nr));
}

static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
unsigned long p2, unsigned long p3,
unsigned long p4)
{
unsigned long in[8];
unsigned long out[8];

in[0] = p1;
in[1] = p2;
in[2] = p3;
in[3] = p4;
return epapr_hypercall(in, out, KVM_HCALL_TOKEN(nr));
}


static inline unsigned int kvm_arch_para_features(void)
{
unsigned long r;

if (!kvm_para_available())
return 0;

if(kvm_hypercall0_1(KVM_HC_FEATURES, &r))
if(epapr_hypercall0_1(KVM_HCALL_TOKEN(KVM_HC_FEATURES), &r))
return 0;

return r;
Expand Down

0 comments on commit b1f0d94

Please sign in to comment.