Skip to content

Commit 1e93925

Browse files
YuryNorovKexyBiscuit
authored andcommitted
FROMGIT: LoongArch: KVM: Simplify kvm_deliver_intr()
The function opencodes for_each_set_bit() macro, which makes it bulky. Using the proper API makes all the housekeeping code going away. Reviewed-by: Bibo Mao <[email protected]> Signed-off-by: Yury Norov (NVIDIA) <[email protected]> Signed-off-by: Huacai Chen <[email protected]> (cherry picked from commit ca2e92d https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git loongarch-next) Signed-off-by: Kexy Biscuit <[email protected]>
1 parent a728b39 commit 1e93925

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

arch/loongarch/kvm/interrupt.c

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,11 @@ void kvm_deliver_intr(struct kvm_vcpu *vcpu)
8383
unsigned long *pending = &vcpu->arch.irq_pending;
8484
unsigned long *pending_clr = &vcpu->arch.irq_clear;
8585

86-
if (!(*pending) && !(*pending_clr))
87-
return;
88-
89-
if (*pending_clr) {
90-
priority = __ffs(*pending_clr);
91-
while (priority <= INT_IPI) {
92-
kvm_irq_clear(vcpu, priority);
93-
priority = find_next_bit(pending_clr,
94-
BITS_PER_BYTE * sizeof(*pending_clr),
95-
priority + 1);
96-
}
97-
}
86+
for_each_set_bit(priority, pending_clr, INT_IPI + 1)
87+
kvm_irq_clear(vcpu, priority);
9888

99-
if (*pending) {
100-
priority = __ffs(*pending);
101-
while (priority <= INT_IPI) {
102-
kvm_irq_deliver(vcpu, priority);
103-
priority = find_next_bit(pending,
104-
BITS_PER_BYTE * sizeof(*pending),
105-
priority + 1);
106-
}
107-
}
89+
for_each_set_bit(priority, pending, INT_IPI + 1)
90+
kvm_irq_deliver(vcpu, priority);
10891
}
10992

11093
int kvm_pending_timer(struct kvm_vcpu *vcpu)

0 commit comments

Comments
 (0)