Patchwork [v5.1,4/6] KVM: PPC: Book3S: modify kvmppc_need_byteswap() for little endian host

login
register
mail settings
Submitter Cédric Le Goater
Date Nov. 8, 2013, 2:36 p.m.
Message ID <527CF6D9.3050300@fr.ibm.com>
Download mbox | patch
Permalink /patch/289852/
State New
Headers show

Comments

Cédric Le Goater - Nov. 8, 2013, 2:36 p.m.
If the host has the same endian order as the guest, there is no need 
to byte-swap.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
---
 arch/powerpc/include/asm/kvm_book3s.h |    4 ++++
 1 file changed, 4 insertions(+)
Alexander Graf - Jan. 2, 2014, 8:28 p.m.
On 08.11.2013, at 15:36, Cedric Le Goater <clg@fr.ibm.com> wrote:

> If the host has the same endian order as the guest, there is no need 
> to byte-swap.
> 
> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
> ---
> arch/powerpc/include/asm/kvm_book3s.h |    4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
> index ac06434..6974aa0 100644
> --- a/arch/powerpc/include/asm/kvm_book3s.h
> +++ b/arch/powerpc/include/asm/kvm_book3s.h
> @@ -272,7 +272,7 @@ static inline ulong kvmppc_get_pc(struct kvm_vcpu *vcpu)
> 
> static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu)
> {
> -	return vcpu->arch.shared->msr & MSR_LE;
> +	return ((vcpu->arch.shared->msr & MSR_LE) != (MSR_KERNEL & MSR_LE));

Ah, I like that one :). However kvmppc_is_bigendian() is still broken now, no?


Alex

> }
> 
> static inline bool kvmppc_is_bigendian(struct kvm_vcpu *vcpu)
> -- 
> 1.7.10.4
> 
> 

--
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/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index ac06434..6974aa0 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -272,7 +272,7 @@  static inline ulong kvmppc_get_pc(struct kvm_vcpu *vcpu)
 
 static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu)
 {
-	return vcpu->arch.shared->msr & MSR_LE;
+	return ((vcpu->arch.shared->msr & MSR_LE) != (MSR_KERNEL & MSR_LE));
 }
 
 static inline bool kvmppc_is_bigendian(struct kvm_vcpu *vcpu)