diff --git a/c4f91d7b7be76c47015521ab0109c6e998a369b0.patch b/c4f91d7b7be76c47015521ab0109c6e998a369b0.patch
new file mode 100644
index 0000000..b37288b
--- /dev/null
+++ b/c4f91d7b7be76c47015521ab0109c6e998a369b0.patch
@@ -0,0 +1,75 @@
+From c4f91d7b7be76c47015521ab0109c6e998a369b0 Mon Sep 17 00:00:00 2001
+From: Harsh Prateek Bora <harshpb@linux.ibm.com>
+Date: Wed, 24 Jan 2024 10:30:55 +1000
+Subject: [PATCH] ppc/spapr: Initialize max_cpus limit to SPAPR_IRQ_NR_IPIS.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Initialize the machine specific max_cpus limit as per the maximum range
+of CPU IPIs available. Keeping between 4096 to 8192 will throw IRQ not
+free error due to XIVE/XICS limitation and keeping beyond 8192 will hit
+assert in tcg_region_init or spapr_xive_claim_irq.
+
+Logs:
+
+Without patch fix:
+
+[root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=4097
+qemu-system-ppc64: IRQ 4096 is not free
+[root@host build]#
+
+On LPAR:
+[root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=8193
+**
+ERROR:../tcg/region.c:774:tcg_region_init: assertion failed:
+(region_size >= 2 * page_size)
+Bail out! ERROR:../tcg/region.c:774:tcg_region_init: assertion failed:
+(region_size >= 2 * page_size)
+Aborted (core dumped)
+[root@host build]#
+
+On x86:
+[root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=8193
+qemu-system-ppc64: ../hw/intc/spapr_xive.c:596: spapr_xive_claim_irq:
+Assertion `lisn < xive->nr_irqs' failed.
+Aborted (core dumped)
+[root@host build]#
+
+With patch fix:
+[root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=4097
+qemu-system-ppc64: Invalid SMP CPUs 4097. The max CPUs supported by
+machine 'pseries-8.2' is 4096
+[root@host build]#
+
+
+Reported-by: Kowshik Jois <kowsjois@linux.ibm.com>
+Tested-by: Kowshik Jois <kowsjois@linux.ibm.com>
+Reviewed-by: Cédric Le Goater <clg@kaod.org>
+Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
+Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
+---
+ hw/ppc/spapr.c | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
+index 0d72d286d80f..0028ce0b673b 100644
+--- a/hw/ppc/spapr.c
++++ b/hw/ppc/spapr.c
+@@ -4639,13 +4639,10 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
+     mc->block_default_type = IF_SCSI;
+ 
+     /*
+-     * Setting max_cpus to INT32_MAX. Both KVM and TCG max_cpus values
+-     * should be limited by the host capability instead of hardcoded.
+-     * max_cpus for KVM guests will be checked in kvm_init(), and TCG
+-     * guests are welcome to have as many CPUs as the host are capable
+-     * of emulate.
++     * While KVM determines max cpus in kvm_init() using kvm_max_vcpus(),
++     * In TCG the limit is restricted by the range of CPU IPIs available.
+      */
+-    mc->max_cpus = INT32_MAX;
++    mc->max_cpus = SPAPR_IRQ_NR_IPIS;
+ 
+     mc->no_parallel = 1;
+     mc->default_boot_order = "";
diff --git a/qemu.spec b/qemu.spec
index 9f47a04..b3e83f5 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -361,7 +361,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38
 %endif
 
 # To prevent rpmdev-bumpspec breakage
-%global baserelease 8
+%global baserelease 9
 
 Summary: QEMU is a FAST! processor emulator
 Name: qemu
@@ -399,6 +399,10 @@ Patch: 0001-block-blkio-Make-s-mem_region_alignment-be-64-bits.patch
 # https://lists.nongnu.org/archive/html/qemu-devel/2024-02/msg03971.html
 Patch: qemu-fifreeze-fithaw.patch
 
+# ppc/spapr: Initialize max_cpus limit to SPAPR_IRQ_NR_IPIS
+# https://bugzilla.redhat.com/show_bug.cgi?id=2265982
+Patch: https://github.com/qemu/qemu/commit/c4f91d7b7be76c47015521ab0109c6e998a369b0.patch
+
 Source10: qemu-guest-agent.service
 Source11: 99-qemu-guest-agent.rules
 Source12: bridge.conf
@@ -3164,6 +3168,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
 
 
 %changelog
+* Mon Feb 26 2024 Richard W.M. Jones <rjones@redhat.com> - 2:8.2.0-9
+-  Backport ppc/spapr: Initialize max_cpus limit to SPAPR_IRQ_NR_IPIS
+
 * Wed Feb 21 2024 Richard W.M. Jones <rjones@redhat.com> - 2:8.2.0-8
 - Fix user-emulation of FIFREEZE and FITHAW ioctls