diff options
author | Christoffer Dall <christoffer.dall@linaro.org> | 2016-04-24 15:41:36 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2016-05-20 09:39:42 -0400 |
commit | d5a5a0eff368f039ed2222b47c15f09cb60e1245 (patch) | |
tree | 3f6fe7e2b16518ecaab92ff8098553c0828cff9b | |
parent | 83091db981e105d97562d3ed3ffe676e21927e3a (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.h | 3 | ||||
-rw-r--r-- | arch/arm/kvm/mmio.c | 10 | ||||
-rw-r--r-- | arch/arm64/include/asm/kvm_mmio.h | 3 |
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 | ||
31 | void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data); | ||
32 | unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len); | ||
33 | |||
31 | int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run); | 34 | int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run); |
32 | int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, | 35 | int 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 | ||
26 | static void mmio_write_buf(char *buf, unsigned int len, unsigned long data) | 26 | void 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 | ||
58 | static unsigned long mmio_read_buf(char *buf, unsigned int len) | 58 | unsigned 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 | ||
33 | void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data); | ||
34 | unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len); | ||
35 | |||
33 | int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run); | 36 | int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run); |
34 | int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, | 37 | int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, |
35 | phys_addr_t fault_ipa); | 38 | phys_addr_t fault_ipa); |