xref: /qemu/include/hw/ppc/pnv_xive.h (revision db1015e92e04835c9eb50c29625fe566d1202dbd)
12dfa91a2SCédric Le Goater /*
22dfa91a2SCédric Le Goater  * QEMU PowerPC XIVE interrupt controller model
32dfa91a2SCédric Le Goater  *
42dfa91a2SCédric Le Goater  * Copyright (c) 2017-2019, IBM Corporation.
52dfa91a2SCédric Le Goater  *
62dfa91a2SCédric Le Goater  * This code is licensed under the GPL version 2 or later. See the
72dfa91a2SCédric Le Goater  * COPYING file in the top-level directory.
82dfa91a2SCédric Le Goater  */
92dfa91a2SCédric Le Goater 
102dfa91a2SCédric Le Goater #ifndef PPC_PNV_XIVE_H
112dfa91a2SCédric Le Goater #define PPC_PNV_XIVE_H
122dfa91a2SCédric Le Goater 
132dfa91a2SCédric Le Goater #include "hw/ppc/xive.h"
14*db1015e9SEduardo Habkost #include "qom/object.h"
152dfa91a2SCédric Le Goater 
162dfa91a2SCédric Le Goater struct PnvChip;
172dfa91a2SCédric Le Goater 
182dfa91a2SCédric Le Goater #define TYPE_PNV_XIVE "pnv-xive"
19*db1015e9SEduardo Habkost typedef struct PnvXive PnvXive;
20*db1015e9SEduardo Habkost typedef struct PnvXiveClass PnvXiveClass;
212dfa91a2SCédric Le Goater #define PNV_XIVE(obj) OBJECT_CHECK(PnvXive, (obj), TYPE_PNV_XIVE)
220da41d3cSGreg Kurz #define PNV_XIVE_CLASS(klass)                                   \
230da41d3cSGreg Kurz     OBJECT_CLASS_CHECK(PnvXiveClass, (klass), TYPE_PNV_XIVE)
240da41d3cSGreg Kurz #define PNV_XIVE_GET_CLASS(obj)                                 \
250da41d3cSGreg Kurz     OBJECT_GET_CLASS(PnvXiveClass, (obj), TYPE_PNV_XIVE)
262dfa91a2SCédric Le Goater 
272dfa91a2SCédric Le Goater #define XIVE_BLOCK_MAX      16
282dfa91a2SCédric Le Goater 
292dfa91a2SCédric Le Goater #define XIVE_TABLE_BLK_MAX  16  /* Block Scope Table (0-15) */
302dfa91a2SCédric Le Goater #define XIVE_TABLE_MIG_MAX  16  /* Migration Register Table (1-15) */
312dfa91a2SCédric Le Goater #define XIVE_TABLE_VDT_MAX  16  /* VDT Domain Table (0-15) */
322dfa91a2SCédric Le Goater #define XIVE_TABLE_EDT_MAX  64  /* EDT Domain Table (0-63) */
332dfa91a2SCédric Le Goater 
34*db1015e9SEduardo Habkost struct PnvXive {
352dfa91a2SCédric Le Goater     XiveRouter    parent_obj;
362dfa91a2SCédric Le Goater 
372dfa91a2SCédric Le Goater     /* Owning chip */
382dfa91a2SCédric Le Goater     struct PnvChip *chip;
392dfa91a2SCédric Le Goater 
402dfa91a2SCédric Le Goater     /* XSCOM addresses giving access to the controller registers */
412dfa91a2SCédric Le Goater     MemoryRegion  xscom_regs;
422dfa91a2SCédric Le Goater 
432dfa91a2SCédric Le Goater     /* Main MMIO regions that can be configured by FW */
442dfa91a2SCédric Le Goater     MemoryRegion  ic_mmio;
452dfa91a2SCédric Le Goater     MemoryRegion    ic_reg_mmio;
462dfa91a2SCédric Le Goater     MemoryRegion    ic_notify_mmio;
472dfa91a2SCédric Le Goater     MemoryRegion    ic_lsi_mmio;
482dfa91a2SCédric Le Goater     MemoryRegion    tm_indirect_mmio;
492dfa91a2SCédric Le Goater     MemoryRegion  vc_mmio;
502dfa91a2SCédric Le Goater     MemoryRegion  pc_mmio;
512dfa91a2SCédric Le Goater     MemoryRegion  tm_mmio;
522dfa91a2SCédric Le Goater 
532dfa91a2SCédric Le Goater     /*
542dfa91a2SCédric Le Goater      * IPI and END address spaces modeling the EDT segmentation in the
552dfa91a2SCédric Le Goater      * VC region
562dfa91a2SCédric Le Goater      */
572dfa91a2SCédric Le Goater     AddressSpace  ipi_as;
582dfa91a2SCédric Le Goater     MemoryRegion  ipi_mmio;
592dfa91a2SCédric Le Goater     MemoryRegion    ipi_edt_mmio;
602dfa91a2SCédric Le Goater 
612dfa91a2SCédric Le Goater     AddressSpace  end_as;
622dfa91a2SCédric Le Goater     MemoryRegion  end_mmio;
632dfa91a2SCédric Le Goater     MemoryRegion    end_edt_mmio;
642dfa91a2SCédric Le Goater 
652dfa91a2SCédric Le Goater     /* Shortcut values for the Main MMIO regions */
662dfa91a2SCédric Le Goater     hwaddr        ic_base;
672dfa91a2SCédric Le Goater     uint32_t      ic_shift;
682dfa91a2SCédric Le Goater     hwaddr        vc_base;
692dfa91a2SCédric Le Goater     uint32_t      vc_shift;
702dfa91a2SCédric Le Goater     hwaddr        pc_base;
712dfa91a2SCédric Le Goater     uint32_t      pc_shift;
722dfa91a2SCédric Le Goater     hwaddr        tm_base;
732dfa91a2SCédric Le Goater     uint32_t      tm_shift;
742dfa91a2SCédric Le Goater 
752dfa91a2SCédric Le Goater     /* Our XIVE source objects for IPIs and ENDs */
762dfa91a2SCédric Le Goater     XiveSource    ipi_source;
772dfa91a2SCédric Le Goater     XiveENDSource end_source;
782dfa91a2SCédric Le Goater 
792dfa91a2SCédric Le Goater     /* Interrupt controller registers */
802dfa91a2SCédric Le Goater     uint64_t      regs[0x300];
812dfa91a2SCédric Le Goater 
822dfa91a2SCédric Le Goater     /*
832dfa91a2SCédric Le Goater      * Virtual Structure Descriptor tables : EAT, SBE, ENDT, NVTT, IRQ
842dfa91a2SCédric Le Goater      * These are in a SRAM protected by ECC.
852dfa91a2SCédric Le Goater      */
862dfa91a2SCédric Le Goater     uint64_t      vsds[5][XIVE_BLOCK_MAX];
872dfa91a2SCédric Le Goater 
882dfa91a2SCédric Le Goater     /* Translation tables */
892dfa91a2SCédric Le Goater     uint64_t      blk[XIVE_TABLE_BLK_MAX];
902dfa91a2SCédric Le Goater     uint64_t      mig[XIVE_TABLE_MIG_MAX];
912dfa91a2SCédric Le Goater     uint64_t      vdt[XIVE_TABLE_VDT_MAX];
922dfa91a2SCédric Le Goater     uint64_t      edt[XIVE_TABLE_EDT_MAX];
93*db1015e9SEduardo Habkost };
942dfa91a2SCédric Le Goater 
95*db1015e9SEduardo Habkost struct PnvXiveClass {
960da41d3cSGreg Kurz     XiveRouterClass parent_class;
970da41d3cSGreg Kurz 
980da41d3cSGreg Kurz     DeviceRealize parent_realize;
99*db1015e9SEduardo Habkost };
1000da41d3cSGreg Kurz 
1012dfa91a2SCédric Le Goater void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon);
1022dfa91a2SCédric Le Goater 
1032dfa91a2SCédric Le Goater #endif /* PPC_PNV_XIVE_H */
104