diff options
| author | Rodrigo Vivi <[email protected]> | 2018-07-23 09:13:12 -0700 | 
|---|---|---|
| committer | Rodrigo Vivi <[email protected]> | 2018-07-23 09:13:12 -0700 | 
| commit | c74a7469f97c0f40b46e82ee979f9fb1bb6e847c (patch) | |
| tree | f2690a1a916b73ef94657fbf0e0141ae57701825 /arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | |
| parent | 6f15a7de86c8cf2dc09fc9e6d07047efa40ef809 (diff) | |
| parent | 500775074f88d9cf5416bed2ca19592812d62c41 (diff) | |
Merge drm/drm-next into drm-intel-next-queued
We need a backmerge to get DP_DPCD_REV_14 before we push other
i915 changes to dinq that could break compilation.
Signed-off-by: Rodrigo Vivi <[email protected]>
Diffstat (limited to 'arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c')
| -rw-r--r-- | arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | 24 | 
1 files changed, 19 insertions, 5 deletions
| diff --git a/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c b/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c index 86801b6055d6..39be799d0417 100644 --- a/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c +++ b/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c @@ -18,11 +18,20 @@  #include <linux/compiler.h>  #include <linux/irqchip/arm-gic.h>  #include <linux/kvm_host.h> +#include <linux/swab.h>  #include <asm/kvm_emulate.h>  #include <asm/kvm_hyp.h>  #include <asm/kvm_mmu.h> +static bool __hyp_text __is_be(struct kvm_vcpu *vcpu) +{ +	if (vcpu_mode_is_32bit(vcpu)) +		return !!(read_sysreg_el2(spsr) & COMPAT_PSR_E_BIT); + +	return !!(read_sysreg(SCTLR_EL1) & SCTLR_ELx_EE); +} +  /*   * __vgic_v2_perform_cpuif_access -- perform a GICV access on behalf of the   *				     guest. @@ -64,14 +73,19 @@ int __hyp_text __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu)  	addr += fault_ipa - vgic->vgic_cpu_base;  	if (kvm_vcpu_dabt_iswrite(vcpu)) { -		u32 data = vcpu_data_guest_to_host(vcpu, -						   vcpu_get_reg(vcpu, rd), -						   sizeof(u32)); +		u32 data = vcpu_get_reg(vcpu, rd); +		if (__is_be(vcpu)) { +			/* guest pre-swabbed data, undo this for writel() */ +			data = swab32(data); +		}  		writel_relaxed(data, addr);  	} else {  		u32 data = readl_relaxed(addr); -		vcpu_set_reg(vcpu, rd, vcpu_data_host_to_guest(vcpu, data, -							       sizeof(u32))); +		if (__is_be(vcpu)) { +			/* guest expects swabbed data */ +			data = swab32(data); +		} +		vcpu_set_reg(vcpu, rd, data);  	}  	return 1; |