hw/intc/loongarch_pch: Change default irq number of pch irq controller
authorTianrui Zhao <zhaotianrui@loongson.cn>
Tue, 27 Dec 2022 03:19:57 +0000 (11:19 +0800)
committerSong Gao <gaosong@loongson.cn>
Fri, 6 Jan 2023 06:12:43 +0000 (14:12 +0800)
Change the default irq number of pch pic to 32, so that the irq
number of pch msi is 224(256 - 32), and move the 'PCH_PIC_IRQ_NUM'
macro to pci-host/ls7a.h and add prefix 'VIRT' on it to keep standard
format.

Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230104020518.2564263-4-zhaotianrui@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
hw/intc/loongarch_pch_pic.c
hw/loongarch/virt.c
include/hw/intc/loongarch_pch_msi.h
include/hw/intc/loongarch_pch_pic.h
include/hw/pci-host/ls7a.h

index 33966e7bac6f796e9c7fd7ae6a084eea527bd5e6..9208fc4460e7b3e63d4f9a67e1284e21961c76f3 100644 (file)
@@ -9,6 +9,7 @@
 #include "qemu/bitops.h"
 #include "hw/sysbus.h"
 #include "hw/loongarch/virt.h"
+#include "hw/pci-host/ls7a.h"
 #include "hw/irq.h"
 #include "hw/intc/loongarch_pch_pic.h"
 #include "hw/qdev-properties.h"
@@ -377,7 +378,7 @@ static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp)
 {
     LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(dev);
 
-    if (!s->irq_num || s->irq_num  > PCH_PIC_IRQ_NUM) {
+    if (!s->irq_num || s->irq_num  > VIRT_PCH_PIC_IRQ_NUM) {
         error_setg(errp, "Invalid 'pic_irq_num'");
         return;
     }
index 35d4bce3b3ac834133bdb687320793e5c254815e..66be9250684e14d2a8a40740f10eb2bb35becbfc 100644 (file)
@@ -616,7 +616,7 @@ static void loongarch_irq_init(LoongArchMachineState *lams)
     }
 
     pch_pic = qdev_new(TYPE_LOONGARCH_PCH_PIC);
-    num = PCH_PIC_IRQ_NUM;
+    num = VIRT_PCH_PIC_IRQ_NUM;
     qdev_prop_set_uint32(pch_pic, "pch_pic_irq_num", num);
     d = SYS_BUS_DEVICE(pch_pic);
     sysbus_realize_and_unref(d, &error_fatal);
index c5a52bc3271c49c9846e7d6b0204c3eb62c08370..832e69fa32c38e7a918323f1478fda05d00647af 100644 (file)
@@ -8,10 +8,10 @@
 #define TYPE_LOONGARCH_PCH_MSI "loongarch_pch_msi"
 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHMSI, LOONGARCH_PCH_MSI)
 
-/* Msi irq start start from 64 to 255 */
-#define PCH_MSI_IRQ_START   64
+/* MSI irq start from 32 to 255 */
+#define PCH_MSI_IRQ_START   32
 #define PCH_MSI_IRQ_END     255
-#define PCH_MSI_IRQ_NUM     192
+#define PCH_MSI_IRQ_NUM     224
 
 struct LoongArchPCHMSI {
     SysBusDevice parent_obj;
index efae5fa8e998b24e509bf63d1b107fe27d3fd9b1..258e3b3294dc758ba7beca9b1d0b0afc8ec507f9 100644 (file)
@@ -9,7 +9,6 @@
 #define PCH_PIC_NAME(name) TYPE_LOONGARCH_PCH_PIC#name
 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHPIC, LOONGARCH_PCH_PIC)
 
-#define PCH_PIC_IRQ_NUM                 64
 #define PCH_PIC_INT_ID_VAL              0x7000000UL
 #define PCH_PIC_INT_ID_VER              0x1UL
 
index 6443327bd7735906f17c3a29d2184560d97b7a45..8061c4bbbf84e8911cf8927e18fcfbd24b76e554 100644 (file)
@@ -32,6 +32,7 @@
  * 0 ~ 16 irqs used for non-pci device while 16 ~ 64 irqs
  * used for pci device.
  */
+#define VIRT_PCH_PIC_IRQ_NUM     32
 #define PCH_PIC_IRQ_OFFSET       64
 #define VIRT_DEVICE_IRQS         16
 #define VIRT_UART_IRQ            (PCH_PIC_IRQ_OFFSET + 2)