render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame c4f91d7b7be76c47015521ab0109c6e998a369b0.patch

1bd1d0
From c4f91d7b7be76c47015521ab0109c6e998a369b0 Mon Sep 17 00:00:00 2001
1bd1d0
From: Harsh Prateek Bora <harshpb@linux.ibm.com>
1bd1d0
Date: Wed, 24 Jan 2024 10:30:55 +1000
1bd1d0
Subject: [PATCH] ppc/spapr: Initialize max_cpus limit to SPAPR_IRQ_NR_IPIS.
1bd1d0
MIME-Version: 1.0
1bd1d0
Content-Type: text/plain; charset=UTF-8
1bd1d0
Content-Transfer-Encoding: 8bit
1bd1d0
1bd1d0
Initialize the machine specific max_cpus limit as per the maximum range
1bd1d0
of CPU IPIs available. Keeping between 4096 to 8192 will throw IRQ not
1bd1d0
free error due to XIVE/XICS limitation and keeping beyond 8192 will hit
1bd1d0
assert in tcg_region_init or spapr_xive_claim_irq.
1bd1d0
1bd1d0
Logs:
1bd1d0
1bd1d0
Without patch fix:
1bd1d0
1bd1d0
[root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=4097
1bd1d0
qemu-system-ppc64: IRQ 4096 is not free
1bd1d0
[root@host build]#
1bd1d0
1bd1d0
On LPAR:
1bd1d0
[root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=8193
1bd1d0
**
1bd1d0
ERROR:../tcg/region.c:774:tcg_region_init: assertion failed:
1bd1d0
(region_size >= 2 * page_size)
1bd1d0
Bail out! ERROR:../tcg/region.c:774:tcg_region_init: assertion failed:
1bd1d0
(region_size >= 2 * page_size)
1bd1d0
Aborted (core dumped)
1bd1d0
[root@host build]#
1bd1d0
1bd1d0
On x86:
1bd1d0
[root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=8193
1bd1d0
qemu-system-ppc64: ../hw/intc/spapr_xive.c:596: spapr_xive_claim_irq:
1bd1d0
Assertion `lisn < xive->nr_irqs' failed.
1bd1d0
Aborted (core dumped)
1bd1d0
[root@host build]#
1bd1d0
1bd1d0
With patch fix:
1bd1d0
[root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=4097
1bd1d0
qemu-system-ppc64: Invalid SMP CPUs 4097. The max CPUs supported by
1bd1d0
machine 'pseries-8.2' is 4096
1bd1d0
[root@host build]#
1bd1d0
1bd1d0
1bd1d0
Reported-by: Kowshik Jois <kowsjois@linux.ibm.com>
1bd1d0
Tested-by: Kowshik Jois <kowsjois@linux.ibm.com>
1bd1d0
Reviewed-by: Cédric Le Goater <clg@kaod.org>
1bd1d0
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
1bd1d0
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
1bd1d0
---
1bd1d0
 hw/ppc/spapr.c | 9 +++------
1bd1d0
 1 file changed, 3 insertions(+), 6 deletions(-)
1bd1d0
1bd1d0
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
1bd1d0
index 0d72d286d80f..0028ce0b673b 100644
1bd1d0
--- a/hw/ppc/spapr.c
1bd1d0
+++ b/hw/ppc/spapr.c
1bd1d0
@@ -4639,13 +4639,10 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
1bd1d0
     mc->block_default_type = IF_SCSI;
1bd1d0
 
1bd1d0
     /*
1bd1d0
-     * Setting max_cpus to INT32_MAX. Both KVM and TCG max_cpus values
1bd1d0
-     * should be limited by the host capability instead of hardcoded.
1bd1d0
-     * max_cpus for KVM guests will be checked in kvm_init(), and TCG
1bd1d0
-     * guests are welcome to have as many CPUs as the host are capable
1bd1d0
-     * of emulate.
1bd1d0
+     * While KVM determines max cpus in kvm_init() using kvm_max_vcpus(),
1bd1d0
+     * In TCG the limit is restricted by the range of CPU IPIs available.
1bd1d0
      */
1bd1d0
-    mc->max_cpus = INT32_MAX;
1bd1d0
+    mc->max_cpus = SPAPR_IRQ_NR_IPIS;
1bd1d0
 
1bd1d0
     mc->no_parallel = 1;
1bd1d0
     mc->default_boot_order = "";