Skip to content

Commit 0fb00d3

Browse files
committed
Merge tag 'kvm-arm-for-4.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master
KVM/ARM fixes for 4.5-rc6 - Fix per-vcpu vgic bitmap allocation - Do not give copy random memory on MMIO read - Fix GICv3 APR register restore order
2 parents 17e4bce + fd451b9 commit 0fb00d3

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

arch/arm/kvm/mmio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
206206
run->mmio.is_write = is_write;
207207
run->mmio.phys_addr = fault_ipa;
208208
run->mmio.len = len;
209-
memcpy(run->mmio.data, data_buf, len);
209+
if (is_write)
210+
memcpy(run->mmio.data, data_buf, len);
210211

211212
if (!ret) {
212213
/* We handled the access successfully in the kernel. */

arch/arm64/kvm/hyp/vgic-v3-sr.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,6 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu)
147147
max_lr_idx = vtr_to_max_lr_idx(val);
148148
nr_pri_bits = vtr_to_nr_pri_bits(val);
149149

150-
switch (nr_pri_bits) {
151-
case 7:
152-
write_gicreg(cpu_if->vgic_ap1r[3], ICH_AP1R3_EL2);
153-
write_gicreg(cpu_if->vgic_ap1r[2], ICH_AP1R2_EL2);
154-
case 6:
155-
write_gicreg(cpu_if->vgic_ap1r[1], ICH_AP1R1_EL2);
156-
default:
157-
write_gicreg(cpu_if->vgic_ap1r[0], ICH_AP1R0_EL2);
158-
}
159-
160150
switch (nr_pri_bits) {
161151
case 7:
162152
write_gicreg(cpu_if->vgic_ap0r[3], ICH_AP0R3_EL2);
@@ -167,6 +157,16 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu)
167157
write_gicreg(cpu_if->vgic_ap0r[0], ICH_AP0R0_EL2);
168158
}
169159

160+
switch (nr_pri_bits) {
161+
case 7:
162+
write_gicreg(cpu_if->vgic_ap1r[3], ICH_AP1R3_EL2);
163+
write_gicreg(cpu_if->vgic_ap1r[2], ICH_AP1R2_EL2);
164+
case 6:
165+
write_gicreg(cpu_if->vgic_ap1r[1], ICH_AP1R1_EL2);
166+
default:
167+
write_gicreg(cpu_if->vgic_ap1r[0], ICH_AP1R0_EL2);
168+
}
169+
170170
switch (max_lr_idx) {
171171
case 15:
172172
write_gicreg(cpu_if->vgic_lr[VGIC_V3_LR_INDEX(15)], ICH_LR15_EL2);

virt/kvm/arm/vgic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,8 +1875,8 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
18751875
static int vgic_vcpu_init_maps(struct kvm_vcpu *vcpu, int nr_irqs)
18761876
{
18771877
struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
1878-
1879-
int sz = (nr_irqs - VGIC_NR_PRIVATE_IRQS) / 8;
1878+
int nr_longs = BITS_TO_LONGS(nr_irqs - VGIC_NR_PRIVATE_IRQS);
1879+
int sz = nr_longs * sizeof(unsigned long);
18801880
vgic_cpu->pending_shared = kzalloc(sz, GFP_KERNEL);
18811881
vgic_cpu->active_shared = kzalloc(sz, GFP_KERNEL);
18821882
vgic_cpu->pend_act_shared = kzalloc(sz, GFP_KERNEL);

0 commit comments

Comments
 (0)