#define DST_BIT_POS    9U
 #define SRC_BITMASK    GENMASK(11, 8)
 
-#define MAX_SGI 16
+/* Macro to represent SGI type for IPI IRQs */
+#define IPI_IRQ_TYPE_SGI       2
 
 /*
  * Module parameters
  * @dev:                  device pointer corresponding to the Xilinx ZynqMP
  *                        IPI agent
  * @irq:                  IPI agent interrupt ID
+ * @irq_type:             IPI SGI or SPI IRQ type
  * @method:               IPI SMC or HVC is going to be used
  * @local_id:             local IPI agent ID
  * @virq_sgi:             IRQ number mapped to SGI
 struct zynqmp_ipi_pdata {
        struct device *dev;
        int irq;
+       unsigned int irq_type;
        unsigned int method;
        u32 local_id;
        int virq_sgi;
        struct zynqmp_ipi_mbox *ipi_mbox;
        int i;
 
-       if (pdata->irq < MAX_SGI)
+       if (pdata->irq_type == IPI_IRQ_TYPE_SGI)
                xlnx_mbox_cleanup_sgi(pdata);
 
        i = pdata->num_mboxes - 1;
                dev_err(dev, "failed to parse interrupts\n");
                goto free_mbox_dev;
        }
-       ret = out_irq.args[1];
+
+       /* Use interrupt type to distinguish SGI and SPI interrupts */
+       pdata->irq_type = out_irq.args[0];
 
        /*
         * If Interrupt number is in SGI range, then request SGI else request
         * IPI system IRQ.
         */
-       if (ret < MAX_SGI) {
-               pdata->irq = ret;
+       if (pdata->irq_type == IPI_IRQ_TYPE_SGI) {
+               pdata->irq = out_irq.args[1];
                ret = xlnx_mbox_init_sgi(pdev, pdata->irq, pdata);
                if (ret)
                        goto free_mbox_dev;