mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mips: kvm: simplify kvm_mips_deliver_interrupts()
@ 2025-07-16 17:29 Yury Norov
  2025-12-01  9:43 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Yury Norov @ 2025-07-16 17:29 UTC (permalink / raw)
  To: Huacai Chen, Thomas Bogendoerfer, linux-mips, kvm, linux-kernel
  Cc: Yury Norov

The function opencodes for_each_set_bit() macro, which makes it bulky.
Using the proper API makes all the housekeeping code go away.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 arch/mips/kvm/interrupt.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/mips/kvm/interrupt.c b/arch/mips/kvm/interrupt.c
index 0277942279ea..895a6f1781fd 100644
--- a/arch/mips/kvm/interrupt.c
+++ b/arch/mips/kvm/interrupt.c
@@ -27,27 +27,11 @@ void kvm_mips_deliver_interrupts(struct kvm_vcpu *vcpu, u32 cause)
 	unsigned long *pending_clr = &vcpu->arch.pending_exceptions_clr;
 	unsigned int priority;
 
-	if (!(*pending) && !(*pending_clr))
-		return;
-
-	priority = __ffs(*pending_clr);
-	while (priority <= MIPS_EXC_MAX) {
+	for_each_set_bit(priority, pending_clr, MIPS_EXC_MAX + 1)
 		kvm_mips_callbacks->irq_clear(vcpu, priority, cause);
 
-		priority = find_next_bit(pending_clr,
-					 BITS_PER_BYTE * sizeof(*pending_clr),
-					 priority + 1);
-	}
-
-	priority = __ffs(*pending);
-	while (priority <= MIPS_EXC_MAX) {
+	for_each_set_bit(priority, pending, MIPS_EXC_MAX + 1)
 		kvm_mips_callbacks->irq_deliver(vcpu, priority, cause);
-
-		priority = find_next_bit(pending,
-					 BITS_PER_BYTE * sizeof(*pending),
-					 priority + 1);
-	}
-
 }
 
 int kvm_mips_pending_timer(struct kvm_vcpu *vcpu)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mips: kvm: simplify kvm_mips_deliver_interrupts()
  2025-07-16 17:29 [PATCH] mips: kvm: simplify kvm_mips_deliver_interrupts() Yury Norov
@ 2025-12-01  9:43 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2025-12-01  9:43 UTC (permalink / raw)
  To: Yury Norov; +Cc: Huacai Chen, linux-mips, kvm, linux-kernel

On Wed, Jul 16, 2025 at 01:29:17PM -0400, Yury Norov wrote:
> The function opencodes for_each_set_bit() macro, which makes it bulky.
> Using the proper API makes all the housekeeping code go away.
> 
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
>  arch/mips/kvm/interrupt.c | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-01  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-16 17:29 [PATCH] mips: kvm: simplify kvm_mips_deliver_interrupts() Yury Norov
2025-12-01  9:43 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®