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
Unified · Split
| @@ -206,7 +206,8 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, · 205 unmodified lines | |||
| 206 | run->mmio.is_write = is_write; | 206 | run->mmio.is_write = is_write; |
| 207 | run->mmio.phys_addr = fault_ipa; | 207 | run->mmio.phys_addr = fault_ipa; |
| 208 | run->mmio.len = len; | 208 | run->mmio.len = len; |
| 209 | memcpy(run->mmio.data, data_buf, len); | 209 | if (is_write) |
| 210 | memcpy(run->mmio.data, data_buf, len); | ||
| 210 | 211 | ||
| 211 | if (!ret) { | 212 | if (!ret) { |
| 212 | /* We handled the access successfully in the kernel. */ | 213 | /* We handled the access successfully in the kernel. */ |
| @@ -147,16 +147,6 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu) · 146 unmodified lines | |||
| 147 | max_lr_idx = vtr_to_max_lr_idx(val); | 147 | max_lr_idx = vtr_to_max_lr_idx(val); |
| 148 | nr_pri_bits = vtr_to_nr_pri_bits(val); | 148 | nr_pri_bits = vtr_to_nr_pri_bits(val); |
| 149 | 149 | ||
| 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 | |||
| 160 | switch (nr_pri_bits) { | 150 | switch (nr_pri_bits) { |
| 161 | case 7: | 151 | case 7: |
| 162 | write_gicreg(cpu_if->vgic_ap0r[3], ICH_AP0R3_EL2); | 152 | 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) · 4 unmodified lines | |||
| 167 | write_gicreg(cpu_if->vgic_ap0r[0], ICH_AP0R0_EL2); | 157 | write_gicreg(cpu_if->vgic_ap0r[0], ICH_AP0R0_EL2); |
| 168 | } | 158 | } |
| 169 | 159 | ||
| 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 | |||
| 170 | switch (max_lr_idx) { | 170 | switch (max_lr_idx) { |
| 171 | case 15: | 171 | case 15: |
| 172 | write_gicreg(cpu_if->vgic_lr[VGIC_V3_LR_INDEX(15)], ICH_LR15_EL2); | 172 | write_gicreg(cpu_if->vgic_lr[VGIC_V3_LR_INDEX(15)], ICH_LR15_EL2); |
| @@ -1875,8 +1875,8 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu) · 1874 unmodified lines | |||
| 1875 | static int vgic_vcpu_init_maps(struct kvm_vcpu *vcpu, int nr_irqs) | 1875 | static int vgic_vcpu_init_maps(struct kvm_vcpu *vcpu, int nr_irqs) |
| 1876 | { | 1876 | { |
| 1877 | struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; | 1877 | struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; |
| 1878 | 1878 | int nr_longs = BITS_TO_LONGS(nr_irqs - VGIC_NR_PRIVATE_IRQS); | |
| 1879 | int sz = (nr_irqs - VGIC_NR_PRIVATE_IRQS) / 8; | 1879 | int sz = nr_longs * sizeof(unsigned long); |
| 1880 | vgic_cpu->pending_shared = kzalloc(sz, GFP_KERNEL); | 1880 | vgic_cpu->pending_shared = kzalloc(sz, GFP_KERNEL); |
| 1881 | vgic_cpu->active_shared = kzalloc(sz, GFP_KERNEL); | 1881 | vgic_cpu->active_shared = kzalloc(sz, GFP_KERNEL); |
| 1882 | vgic_cpu->pend_act_shared = kzalloc(sz, GFP_KERNEL); | 1882 | vgic_cpu->pend_act_shared = kzalloc(sz, GFP_KERNEL); |