]> xenbits.xensource.com Git - xen.git/commitdiff
x86/irq: fix calculation of max PV dom0 pIRQs
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 25 Nov 2024 10:33:06 +0000 (11:33 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Nov 2024 10:33:06 +0000 (11:33 +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>
xen/arch/x86/io_apic.c

index d44d2c9a4173a653aef9c0392c1091f62b77eb39..bd5ad61c85e4325d48b200535fca5b7b11dce1c6 100644 (file)
@@ -2744,7 +2744,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);