aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoffer Dall <christoffer.dall@linaro.org>2016-04-24 15:41:36 -0400
committerChristoffer Dall <christoffer.dall@linaro.org>2016-05-20 09:39:42 -0400
commitd5a5a0eff368f039ed2222b47c15f09cb60e1245 (patch)
tree3f6fe7e2b16518ecaab92ff8098553c0828cff9b
parent83091db981e105d97562d3ed3ffe676e21927e3a (diff)
KVM: arm/arm64: Export mmio_read/write_bus
Rename mmio_{read,write}_bus to kvm_mmio_{read,write}_bus and export them out of mmio.c. This will be needed later for the new VGIC implementation. Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
-rw-r--r--arch/arm/include/asm/kvm_mmio.h3
-rw-r--r--arch/arm/kvm/mmio.c10
-rw-r--r--arch/arm64/include/asm/kvm_mmio.h3
3 files changed, 11 insertions, 5 deletions
diff --git a/arch/arm/include/asm/kvm_mmio.h b/arch/arm/include/asm/kvm_mmio.h
index d8e90c8cb5fa..f3a7de71f515 100644
--- a/arch/arm/include/asm/kvm_mmio.h
+++ b/arch/arm/include/asm/kvm_mmio.h
@@ -28,6 +28,9 @@ struct kvm_decode {
28 bool sign_extend; 28 bool sign_extend;
29}; 29};
30 30
31void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data);
32unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len);
33
31int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run); 34int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run);
32int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, 35int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
33 phys_addr_t fault_ipa); 36 phys_addr_t fault_ipa);
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
index 0158e9e3276d..10f80a6c797a 100644
--- a/arch/arm/kvm/mmio.c
+++ b/arch/arm/kvm/mmio.c
@@ -23,7 +23,7 @@
23 23
24#include "trace.h" 24#include "trace.h"
25 25
26static void mmio_write_buf(char *buf, unsigned int len, unsigned long data) 26void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data)
27{ 27{
28 void *datap = NULL; 28 void *datap = NULL;
29 union { 29 union {
@@ -55,7 +55,7 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
55 memcpy(buf, datap, len); 55 memcpy(buf, datap, len);
56} 56}
57 57
58static unsigned long mmio_read_buf(char *buf, unsigned int len) 58unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len)
59{ 59{
60 unsigned long data = 0; 60 unsigned long data = 0;
61 union { 61 union {
@@ -66,7 +66,7 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
66 66
67 switch (len) { 67 switch (len) {
68 case 1: 68 case 1:
69 data = buf[0]; 69 data = *(u8 *)buf;
70 break; 70 break;
71 case 2: 71 case 2:
72 memcpy(&tmp.hword, buf, len); 72 memcpy(&tmp.hword, buf, len);
@@ -103,7 +103,7 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
103 if (len > sizeof(unsigned long)) 103 if (len > sizeof(unsigned long))
104 return -EINVAL; 104 return -EINVAL;
105 105
106 data = mmio_read_buf(run->mmio.data, len); 106 data = kvm_mmio_read_buf(run->mmio.data, len);
107 107
108 if (vcpu->arch.mmio_decode.sign_extend && 108 if (vcpu->arch.mmio_decode.sign_extend &&
109 len < sizeof(unsigned long)) { 109 len < sizeof(unsigned long)) {
@@ -189,7 +189,7 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
189 len); 189 len);
190 190
191 trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, data); 191 trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, data);
192 mmio_write_buf(data_buf, len, data); 192 kvm_mmio_write_buf(data_buf, len, data);
193 193
194 ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, fault_ipa, len, 194 ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, fault_ipa, len,
195 data_buf); 195 data_buf);
diff --git a/arch/arm64/include/asm/kvm_mmio.h b/arch/arm64/include/asm/kvm_mmio.h
index fe612a962576..75ea42079757 100644
--- a/arch/arm64/include/asm/kvm_mmio.h
+++ b/arch/arm64/include/asm/kvm_mmio.h
@@ -30,6 +30,9 @@ struct kvm_decode {
30 bool sign_extend; 30 bool sign_extend;
31}; 31};
32 32
33void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data);
34unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len);
35
33int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run); 36int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run);
34int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, 37int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
35 phys_addr_t fault_ipa); 38 phys_addr_t fault_ipa);