mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
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>
This commit is contained in:
parent
83091db981
commit
d5a5a0eff3
@ -28,6 +28,9 @@ struct kvm_decode {
|
|||||||
bool sign_extend;
|
bool sign_extend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data);
|
||||||
|
unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len);
|
||||||
|
|
||||||
int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run);
|
int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run);
|
||||||
int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
|
int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
|
||||||
phys_addr_t fault_ipa);
|
phys_addr_t fault_ipa);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
|
void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data)
|
||||||
{
|
{
|
||||||
void *datap = NULL;
|
void *datap = NULL;
|
||||||
union {
|
union {
|
||||||
@ -55,7 +55,7 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
|
|||||||
memcpy(buf, datap, len);
|
memcpy(buf, datap, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long mmio_read_buf(char *buf, unsigned int len)
|
unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len)
|
||||||
{
|
{
|
||||||
unsigned long data = 0;
|
unsigned long data = 0;
|
||||||
union {
|
union {
|
||||||
@ -66,7 +66,7 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
|
|||||||
|
|
||||||
switch (len) {
|
switch (len) {
|
||||||
case 1:
|
case 1:
|
||||||
data = buf[0];
|
data = *(u8 *)buf;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
memcpy(&tmp.hword, buf, len);
|
memcpy(&tmp.hword, buf, len);
|
||||||
@ -103,7 +103,7 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
|
|||||||
if (len > sizeof(unsigned long))
|
if (len > sizeof(unsigned long))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
data = mmio_read_buf(run->mmio.data, len);
|
data = kvm_mmio_read_buf(run->mmio.data, len);
|
||||||
|
|
||||||
if (vcpu->arch.mmio_decode.sign_extend &&
|
if (vcpu->arch.mmio_decode.sign_extend &&
|
||||||
len < sizeof(unsigned long)) {
|
len < sizeof(unsigned long)) {
|
||||||
@ -189,7 +189,7 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
|
|||||||
len);
|
len);
|
||||||
|
|
||||||
trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, data);
|
trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, data);
|
||||||
mmio_write_buf(data_buf, len, data);
|
kvm_mmio_write_buf(data_buf, len, data);
|
||||||
|
|
||||||
ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, fault_ipa, len,
|
ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, fault_ipa, len,
|
||||||
data_buf);
|
data_buf);
|
||||||
|
@ -30,6 +30,9 @@ struct kvm_decode {
|
|||||||
bool sign_extend;
|
bool sign_extend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data);
|
||||||
|
unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len);
|
||||||
|
|
||||||
int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run);
|
int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run);
|
||||||
int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
|
int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
|
||||||
phys_addr_t fault_ipa);
|
phys_addr_t fault_ipa);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user