]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
x86/irq: fix calculation of max PV dom0 pIRQs
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 27 Nov 2024 11:42:02 +0000 (12:42 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 27 Nov 2024 11:42:02 +0000 (12:42 +0100)
The current calculation of PV dom0 pIRQs uses:

n = min(fls(num_present_cpus()), dom0_max_vcpus());

The usage of fls() is wrong, as num_present_cpus() already returns the number
of present CPUs, not the bitmap mask of CPUs.

Fix by removing the usage of fls().

Fixes: 7e73a6e7f12a ('have architectures specify the number of PIRQs a hardware domain gets')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 5c56361c618e5d05855fc73118c4655f998b8272
master date: 2024-11-25 11:33:06 +0100

xen/arch/x86/io_apic.c

index 836af62061c62f80dc476f9e3c7645787774ad3b..0450b5f7845a56f598121d5e7fc6f4b2b7de014e 100644 (file)
@@ -2731,7 +2731,7 @@ void __init ioapic_init(void)
 
 unsigned int __hwdom_init arch_hwdom_irqs(const struct domain *d)
 {
-    unsigned int n = fls(num_present_cpus());
+    unsigned int n = num_present_cpus();
     /* Bounding by the domain pirq EOI bitmap capacity. */
     const unsigned int max_irqs = min_t(unsigned int, nr_irqs,
                                         PAGE_SIZE * BITS_PER_BYTE);