Commit cf50a1eb authored by Andre Przywara's avatar Andre Przywara Committed by Marc Zyngier

KVM: arm/arm64: rename struct kvm_mmio_range to vgic_io_range

The name "kvm_mmio_range" is a bit bold, given that it only covers
the VGIC's MMIO ranges. To avoid confusion with kvm_io_range, rename
it to vgic_io_range.
Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
Acked-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent f0e4b277
...@@ -319,7 +319,7 @@ static bool handle_mmio_sgi_clear(struct kvm_vcpu *vcpu, ...@@ -319,7 +319,7 @@ static bool handle_mmio_sgi_clear(struct kvm_vcpu *vcpu,
return write_set_clear_sgi_pend_reg(vcpu, mmio, offset, false); return write_set_clear_sgi_pend_reg(vcpu, mmio, offset, false);
} }
static const struct kvm_mmio_range vgic_dist_ranges[] = { static const struct vgic_io_range vgic_dist_ranges[] = {
{ {
.base = GIC_DIST_CTRL, .base = GIC_DIST_CTRL,
.len = 12, .len = 12,
...@@ -647,7 +647,7 @@ static bool handle_cpu_mmio_ident(struct kvm_vcpu *vcpu, ...@@ -647,7 +647,7 @@ static bool handle_cpu_mmio_ident(struct kvm_vcpu *vcpu,
* CPU Interface Register accesses - these are not accessed by the VM, but by * CPU Interface Register accesses - these are not accessed by the VM, but by
* user space for saving and restoring VGIC state. * user space for saving and restoring VGIC state.
*/ */
static const struct kvm_mmio_range vgic_cpu_ranges[] = { static const struct vgic_io_range vgic_cpu_ranges[] = {
{ {
.base = GIC_CPU_CTRL, .base = GIC_CPU_CTRL,
.len = 12, .len = 12,
...@@ -674,7 +674,7 @@ static int vgic_attr_regs_access(struct kvm_device *dev, ...@@ -674,7 +674,7 @@ static int vgic_attr_regs_access(struct kvm_device *dev,
struct kvm_device_attr *attr, struct kvm_device_attr *attr,
u32 *reg, bool is_write) u32 *reg, bool is_write)
{ {
const struct kvm_mmio_range *r = NULL, *ranges; const struct vgic_io_range *r = NULL, *ranges;
phys_addr_t offset; phys_addr_t offset;
int ret, cpuid, c; int ret, cpuid, c;
struct kvm_vcpu *vcpu, *tmp_vcpu; struct kvm_vcpu *vcpu, *tmp_vcpu;
......
...@@ -340,7 +340,7 @@ static bool handle_mmio_idregs(struct kvm_vcpu *vcpu, ...@@ -340,7 +340,7 @@ static bool handle_mmio_idregs(struct kvm_vcpu *vcpu,
return false; return false;
} }
static const struct kvm_mmio_range vgic_v3_dist_ranges[] = { static const struct vgic_io_range vgic_v3_dist_ranges[] = {
{ {
.base = GICD_CTLR, .base = GICD_CTLR,
.len = 0x04, .len = 0x04,
...@@ -570,7 +570,7 @@ static bool handle_mmio_cfg_reg_redist(struct kvm_vcpu *vcpu, ...@@ -570,7 +570,7 @@ static bool handle_mmio_cfg_reg_redist(struct kvm_vcpu *vcpu,
return vgic_handle_cfg_reg(reg, mmio, offset); return vgic_handle_cfg_reg(reg, mmio, offset);
} }
static const struct kvm_mmio_range vgic_redist_sgi_ranges[] = { static const struct vgic_io_range vgic_redist_sgi_ranges[] = {
{ {
.base = GICR_IGROUPR0, .base = GICR_IGROUPR0,
.len = 0x04, .len = 0x04,
...@@ -676,7 +676,7 @@ static bool handle_mmio_typer_redist(struct kvm_vcpu *vcpu, ...@@ -676,7 +676,7 @@ static bool handle_mmio_typer_redist(struct kvm_vcpu *vcpu,
return false; return false;
} }
static const struct kvm_mmio_range vgic_redist_ranges[] = { static const struct vgic_io_range vgic_redist_ranges[] = {
{ {
.base = GICR_CTLR, .base = GICR_CTLR,
.len = 0x04, .len = 0x04,
...@@ -726,7 +726,7 @@ static bool vgic_v3_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run, ...@@ -726,7 +726,7 @@ static bool vgic_v3_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
unsigned long rdbase = dist->vgic_redist_base; unsigned long rdbase = dist->vgic_redist_base;
int nrcpus = atomic_read(&vcpu->kvm->online_vcpus); int nrcpus = atomic_read(&vcpu->kvm->online_vcpus);
int vcpu_id; int vcpu_id;
const struct kvm_mmio_range *mmio_range; const struct vgic_io_range *mmio_range;
if (is_in_range(mmio->phys_addr, mmio->len, dbase, GIC_V3_DIST_SIZE)) { if (is_in_range(mmio->phys_addr, mmio->len, dbase, GIC_V3_DIST_SIZE)) {
return vgic_handle_mmio_range(vcpu, run, mmio, return vgic_handle_mmio_range(vcpu, run, mmio,
......
...@@ -712,11 +712,11 @@ void vgic_unqueue_irqs(struct kvm_vcpu *vcpu) ...@@ -712,11 +712,11 @@ void vgic_unqueue_irqs(struct kvm_vcpu *vcpu)
} }
const const
struct kvm_mmio_range *vgic_find_range(const struct kvm_mmio_range *ranges, struct vgic_io_range *vgic_find_range(const struct vgic_io_range *ranges,
struct kvm_exit_mmio *mmio, struct kvm_exit_mmio *mmio,
phys_addr_t offset) phys_addr_t offset)
{ {
const struct kvm_mmio_range *r = ranges; const struct vgic_io_range *r = ranges;
while (r->len) { while (r->len) {
if (offset >= r->base && if (offset >= r->base &&
...@@ -729,7 +729,7 @@ struct kvm_mmio_range *vgic_find_range(const struct kvm_mmio_range *ranges, ...@@ -729,7 +729,7 @@ struct kvm_mmio_range *vgic_find_range(const struct kvm_mmio_range *ranges,
} }
static bool vgic_validate_access(const struct vgic_dist *dist, static bool vgic_validate_access(const struct vgic_dist *dist,
const struct kvm_mmio_range *range, const struct vgic_io_range *range,
unsigned long offset) unsigned long offset)
{ {
int irq; int irq;
...@@ -757,7 +757,7 @@ static bool vgic_validate_access(const struct vgic_dist *dist, ...@@ -757,7 +757,7 @@ static bool vgic_validate_access(const struct vgic_dist *dist,
static bool call_range_handler(struct kvm_vcpu *vcpu, static bool call_range_handler(struct kvm_vcpu *vcpu,
struct kvm_exit_mmio *mmio, struct kvm_exit_mmio *mmio,
unsigned long offset, unsigned long offset,
const struct kvm_mmio_range *range) const struct vgic_io_range *range)
{ {
u32 *data32 = (void *)mmio->data; u32 *data32 = (void *)mmio->data;
struct kvm_exit_mmio mmio32; struct kvm_exit_mmio mmio32;
...@@ -804,10 +804,10 @@ static bool call_range_handler(struct kvm_vcpu *vcpu, ...@@ -804,10 +804,10 @@ static bool call_range_handler(struct kvm_vcpu *vcpu,
*/ */
bool vgic_handle_mmio_range(struct kvm_vcpu *vcpu, struct kvm_run *run, bool vgic_handle_mmio_range(struct kvm_vcpu *vcpu, struct kvm_run *run,
struct kvm_exit_mmio *mmio, struct kvm_exit_mmio *mmio,
const struct kvm_mmio_range *ranges, const struct vgic_io_range *ranges,
unsigned long mmio_base) unsigned long mmio_base)
{ {
const struct kvm_mmio_range *range; const struct vgic_io_range *range;
struct vgic_dist *dist = &vcpu->kvm->arch.vgic; struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
bool updated_state; bool updated_state;
unsigned long offset; unsigned long offset;
...@@ -1984,7 +1984,7 @@ int vgic_get_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr) ...@@ -1984,7 +1984,7 @@ int vgic_get_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
return r; return r;
} }
int vgic_has_attr_regs(const struct kvm_mmio_range *ranges, phys_addr_t offset) int vgic_has_attr_regs(const struct vgic_io_range *ranges, phys_addr_t offset)
{ {
struct kvm_exit_mmio dev_attr_mmio; struct kvm_exit_mmio dev_attr_mmio;
......
...@@ -74,7 +74,7 @@ void mmio_data_write(struct kvm_exit_mmio *mmio, u32 mask, u32 value) ...@@ -74,7 +74,7 @@ void mmio_data_write(struct kvm_exit_mmio *mmio, u32 mask, u32 value)
*((u32 *)mmio->data) = cpu_to_le32(value) & mask; *((u32 *)mmio->data) = cpu_to_le32(value) & mask;
} }
struct kvm_mmio_range { struct vgic_io_range {
phys_addr_t base; phys_addr_t base;
unsigned long len; unsigned long len;
int bits_per_irq; int bits_per_irq;
...@@ -89,13 +89,13 @@ static inline bool is_in_range(phys_addr_t addr, unsigned long len, ...@@ -89,13 +89,13 @@ static inline bool is_in_range(phys_addr_t addr, unsigned long len,
} }
const const
struct kvm_mmio_range *vgic_find_range(const struct kvm_mmio_range *ranges, struct vgic_io_range *vgic_find_range(const struct vgic_io_range *ranges,
struct kvm_exit_mmio *mmio, struct kvm_exit_mmio *mmio,
phys_addr_t offset); phys_addr_t offset);
bool vgic_handle_mmio_range(struct kvm_vcpu *vcpu, struct kvm_run *run, bool vgic_handle_mmio_range(struct kvm_vcpu *vcpu, struct kvm_run *run,
struct kvm_exit_mmio *mmio, struct kvm_exit_mmio *mmio,
const struct kvm_mmio_range *ranges, const struct vgic_io_range *ranges,
unsigned long mmio_base); unsigned long mmio_base);
bool vgic_handle_enable_reg(struct kvm *kvm, struct kvm_exit_mmio *mmio, bool vgic_handle_enable_reg(struct kvm *kvm, struct kvm_exit_mmio *mmio,
...@@ -120,7 +120,7 @@ bool vgic_handle_cfg_reg(u32 *reg, struct kvm_exit_mmio *mmio, ...@@ -120,7 +120,7 @@ bool vgic_handle_cfg_reg(u32 *reg, struct kvm_exit_mmio *mmio,
void vgic_kick_vcpus(struct kvm *kvm); void vgic_kick_vcpus(struct kvm *kvm);
int vgic_has_attr_regs(const struct kvm_mmio_range *ranges, phys_addr_t offset); int vgic_has_attr_regs(const struct vgic_io_range *ranges, phys_addr_t offset);
int vgic_set_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr); int vgic_set_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr);
int vgic_get_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr); int vgic_get_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment