diff options
author | Andre Przywara <andre.przywara@arm.com> | 2014-11-06 07:11:45 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2014-11-25 08:57:28 -0500 |
commit | 5100f9833e1881c800bc088e70afa4b9a1409f51 (patch) | |
tree | c4f34bbb05d281c623d7c0dbeba90ae4e8175ca3 | |
parent | 849260c72c6b8bd53850cb00b80027db3a273c2c (diff) |
arm/arm64: KVM: avoid unnecessary guest register mangling on MMIO read
Currently we mangle the endianness of the guest's register even on an
MMIO _read_, where it is completely useless, because we will not use
the value of that register.
Rework the io_mem_abort() function to clearly separate between reads
and writes and only do the endianness mangling on MMIO writes.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | arch/arm/kvm/mmio.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c index 4cb5a93182e9..5d3bfc0eb3f0 100644 --- a/arch/arm/kvm/mmio.c +++ b/arch/arm/kvm/mmio.c | |||
@@ -187,15 +187,18 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, | |||
187 | } | 187 | } |
188 | 188 | ||
189 | rt = vcpu->arch.mmio_decode.rt; | 189 | rt = vcpu->arch.mmio_decode.rt; |
190 | data = vcpu_data_guest_to_host(vcpu, *vcpu_reg(vcpu, rt), mmio.len); | ||
191 | 190 | ||
192 | trace_kvm_mmio((mmio.is_write) ? KVM_TRACE_MMIO_WRITE : | 191 | if (mmio.is_write) { |
193 | KVM_TRACE_MMIO_READ_UNSATISFIED, | 192 | data = vcpu_data_guest_to_host(vcpu, *vcpu_reg(vcpu, rt), |
194 | mmio.len, fault_ipa, | 193 | mmio.len); |
195 | (mmio.is_write) ? data : 0); | ||
196 | 194 | ||
197 | if (mmio.is_write) | 195 | trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, mmio.len, |
196 | fault_ipa, data); | ||
198 | mmio_write_buf(mmio.data, mmio.len, data); | 197 | mmio_write_buf(mmio.data, mmio.len, data); |
198 | } else { | ||
199 | trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, mmio.len, | ||
200 | fault_ipa, 0); | ||
201 | } | ||
199 | 202 | ||
200 | if (vgic_handle_mmio(vcpu, run, &mmio)) | 203 | if (vgic_handle_mmio(vcpu, run, &mmio)) |
201 | return 1; | 204 | return 1; |