Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'kvm-riscv-fixes-6.9-1' of https://github.com/kvm-riscv/linux into HEAD

KVM/riscv fixes for 6.9, take #1

- Fix spelling mistake in arch_timer selftest
- Remove redundant semicolon in num_isa_ext_regs()
- Fix APLIC setipnum_le/be write emulation
- Fix APLIC in_clrip[x] read emulation

+34 -9
+31 -6
arch/riscv/kvm/aia_aplic.c
··· 137 137 raw_spin_lock_irqsave(&irqd->lock, flags); 138 138 139 139 sm = irqd->sourcecfg & APLIC_SOURCECFG_SM_MASK; 140 - if (!pending && 141 - ((sm == APLIC_SOURCECFG_SM_LEVEL_HIGH) || 142 - (sm == APLIC_SOURCECFG_SM_LEVEL_LOW))) 140 + if (sm == APLIC_SOURCECFG_SM_INACTIVE) 143 141 goto skip_write_pending; 142 + 143 + if (sm == APLIC_SOURCECFG_SM_LEVEL_HIGH || 144 + sm == APLIC_SOURCECFG_SM_LEVEL_LOW) { 145 + if (!pending) 146 + goto skip_write_pending; 147 + if ((irqd->state & APLIC_IRQ_STATE_INPUT) && 148 + sm == APLIC_SOURCECFG_SM_LEVEL_LOW) 149 + goto skip_write_pending; 150 + if (!(irqd->state & APLIC_IRQ_STATE_INPUT) && 151 + sm == APLIC_SOURCECFG_SM_LEVEL_HIGH) 152 + goto skip_write_pending; 153 + } 144 154 145 155 if (pending) 146 156 irqd->state |= APLIC_IRQ_STATE_PENDING; ··· 197 187 198 188 static bool aplic_read_input(struct aplic *aplic, u32 irq) 199 189 { 200 - bool ret; 201 - unsigned long flags; 190 + u32 sourcecfg, sm, raw_input, irq_inverted; 202 191 struct aplic_irq *irqd; 192 + unsigned long flags; 193 + bool ret = false; 203 194 204 195 if (!irq || aplic->nr_irqs <= irq) 205 196 return false; 206 197 irqd = &aplic->irqs[irq]; 207 198 208 199 raw_spin_lock_irqsave(&irqd->lock, flags); 209 - ret = (irqd->state & APLIC_IRQ_STATE_INPUT) ? true : false; 200 + 201 + sourcecfg = irqd->sourcecfg; 202 + if (sourcecfg & APLIC_SOURCECFG_D) 203 + goto skip; 204 + 205 + sm = sourcecfg & APLIC_SOURCECFG_SM_MASK; 206 + if (sm == APLIC_SOURCECFG_SM_INACTIVE) 207 + goto skip; 208 + 209 + raw_input = (irqd->state & APLIC_IRQ_STATE_INPUT) ? 1 : 0; 210 + irq_inverted = (sm == APLIC_SOURCECFG_SM_LEVEL_LOW || 211 + sm == APLIC_SOURCECFG_SM_EDGE_FALL) ? 1 : 0; 212 + ret = !!(raw_input ^ irq_inverted); 213 + 214 + skip: 210 215 raw_spin_unlock_irqrestore(&irqd->lock, flags); 211 216 212 217 return ret;
+1 -1
arch/riscv/kvm/vcpu_onereg.c
··· 986 986 987 987 static inline unsigned long num_isa_ext_regs(const struct kvm_vcpu *vcpu) 988 988 { 989 - return copy_isa_ext_reg_indices(vcpu, NULL);; 989 + return copy_isa_ext_reg_indices(vcpu, NULL); 990 990 } 991 991 992 992 static int copy_sbi_ext_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
+1 -1
tools/testing/selftests/kvm/aarch64/arch_timer.c
··· 136 136 irq_iter = READ_ONCE(shared_data->nr_iter); 137 137 __GUEST_ASSERT(config_iter + 1 == irq_iter, 138 138 "config_iter + 1 = 0x%x, irq_iter = 0x%x.\n" 139 - " Guest timer interrupt was not trigged within the specified\n" 139 + " Guest timer interrupt was not triggered within the specified\n" 140 140 " interval, try to increase the error margin by [-e] option.\n", 141 141 config_iter + 1, irq_iter); 142 142 }
+1 -1
tools/testing/selftests/kvm/riscv/arch_timer.c
··· 60 60 irq_iter = READ_ONCE(shared_data->nr_iter); 61 61 __GUEST_ASSERT(config_iter + 1 == irq_iter, 62 62 "config_iter + 1 = 0x%x, irq_iter = 0x%x.\n" 63 - " Guest timer interrupt was not trigged within the specified\n" 63 + " Guest timer interrupt was not triggered within the specified\n" 64 64 " interval, try to increase the error margin by [-e] option.\n", 65 65 config_iter + 1, irq_iter); 66 66 }