On 24/3/25 10:37, Bibo Mao wrote:
Register PCH_PIC_INT_ID constains version and supported irq number
information, and it is read only register. The detailed value can
be set at initial stage, rather than read callback.

Signed-off-by: Bibo Mao <maob...@loongson.cn>
---
  hw/intc/loongarch_pch_pic.c            | 17 ++++++++++-------
  include/hw/intc/loongarch_pic_common.h | 17 +++++++++++++++--
  2 files changed, 25 insertions(+), 9 deletions(-)


diff --git a/include/hw/intc/loongarch_pic_common.h 
b/include/hw/intc/loongarch_pic_common.h
index ef6edc15bf..fb848da4b8 100644
--- a/include/hw/intc/loongarch_pic_common.h
+++ b/include/hw/intc/loongarch_pic_common.h
@@ -10,9 +10,9 @@
  #include "hw/pci-host/ls7a.h"
  #include "hw/sysbus.h"
-#define PCH_PIC_INT_ID_VAL 0x7000000UL
-#define PCH_PIC_INT_ID_VER              0x1UL
  #define PCH_PIC_INT_ID                  0x00
+#define  PCH_PIC_INT_ID_VAL             0x7
+#define  PCH_PIC_INT_ID_VER             0x1
  #define PCH_PIC_INT_MASK                0x20
  #define PCH_PIC_HTMSI_EN                0x40
  #define PCH_PIC_INT_EDGE                0x60
@@ -30,10 +30,23 @@
  OBJECT_DECLARE_TYPE(LoongArchPICCommonState,
                      LoongArchPICCommonClass, LOONGARCH_PIC_COMMON)
+union LoongArchPIC_ID {
+    struct {
+        uint64_t _reserved_0:24;
+        uint64_t id:8;

Why not use:

           uint8_t _reserved_0[3];
           uint8_t id;

Otherwise see commit ecbf3567e21 ("docs/devel/style: add a section about
bitfield, and disallow them for packed structures"), this might give
troubles on Windows or big-endian hosts such s390x.

+        uint64_t version:8;
+        uint64_t _reserved_1:8;
+        uint64_t irq_num:8;
+        uint64_t _reserved_2:8;
> +    } QEMU_PACKED desc;> +    uint64_t data;
+};


Reply via email to