xref: /qemu/include/hw/ppc/pnv_xive.h (revision 0da41d3c5af7897e742c2fa4f6a5c5609b86c493)
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"
142dfa91a2SCédric Le Goater 
152dfa91a2SCédric Le Goater struct PnvChip;
162dfa91a2SCédric Le Goater 
172dfa91a2SCédric Le Goater #define TYPE_PNV_XIVE "pnv-xive"
182dfa91a2SCédric Le Goater #define PNV_XIVE(obj) OBJECT_CHECK(PnvXive, (obj), TYPE_PNV_XIVE)
19*0da41d3cSGreg Kurz #define PNV_XIVE_CLASS(klass)                                   \
20*0da41d3cSGreg Kurz     OBJECT_CLASS_CHECK(PnvXiveClass, (klass), TYPE_PNV_XIVE)
21*0da41d3cSGreg Kurz #define PNV_XIVE_GET_CLASS(obj)                                 \
22*0da41d3cSGreg Kurz     OBJECT_GET_CLASS(PnvXiveClass, (obj), TYPE_PNV_XIVE)
232dfa91a2SCédric Le Goater 
242dfa91a2SCédric Le Goater #define XIVE_BLOCK_MAX      16
252dfa91a2SCédric Le Goater 
262dfa91a2SCédric Le Goater #define XIVE_TABLE_BLK_MAX  16  /* Block Scope Table (0-15) */
272dfa91a2SCédric Le Goater #define XIVE_TABLE_MIG_MAX  16  /* Migration Register Table (1-15) */
282dfa91a2SCédric Le Goater #define XIVE_TABLE_VDT_MAX  16  /* VDT Domain Table (0-15) */
292dfa91a2SCédric Le Goater #define XIVE_TABLE_EDT_MAX  64  /* EDT Domain Table (0-63) */
302dfa91a2SCédric Le Goater 
312dfa91a2SCédric Le Goater typedef struct PnvXive {
322dfa91a2SCédric Le Goater     XiveRouter    parent_obj;
332dfa91a2SCédric Le Goater 
342dfa91a2SCédric Le Goater     /* Owning chip */
352dfa91a2SCédric Le Goater     struct PnvChip *chip;
362dfa91a2SCédric Le Goater 
372dfa91a2SCédric Le Goater     /* XSCOM addresses giving access to the controller registers */
382dfa91a2SCédric Le Goater     MemoryRegion  xscom_regs;
392dfa91a2SCédric Le Goater 
402dfa91a2SCédric Le Goater     /* Main MMIO regions that can be configured by FW */
412dfa91a2SCédric Le Goater     MemoryRegion  ic_mmio;
422dfa91a2SCédric Le Goater     MemoryRegion    ic_reg_mmio;
432dfa91a2SCédric Le Goater     MemoryRegion    ic_notify_mmio;
442dfa91a2SCédric Le Goater     MemoryRegion    ic_lsi_mmio;
452dfa91a2SCédric Le Goater     MemoryRegion    tm_indirect_mmio;
462dfa91a2SCédric Le Goater     MemoryRegion  vc_mmio;
472dfa91a2SCédric Le Goater     MemoryRegion  pc_mmio;
482dfa91a2SCédric Le Goater     MemoryRegion  tm_mmio;
492dfa91a2SCédric Le Goater 
502dfa91a2SCédric Le Goater     /*
512dfa91a2SCédric Le Goater      * IPI and END address spaces modeling the EDT segmentation in the
522dfa91a2SCédric Le Goater      * VC region
532dfa91a2SCédric Le Goater      */
542dfa91a2SCédric Le Goater     AddressSpace  ipi_as;
552dfa91a2SCédric Le Goater     MemoryRegion  ipi_mmio;
562dfa91a2SCédric Le Goater     MemoryRegion    ipi_edt_mmio;
572dfa91a2SCédric Le Goater 
582dfa91a2SCédric Le Goater     AddressSpace  end_as;
592dfa91a2SCédric Le Goater     MemoryRegion  end_mmio;
602dfa91a2SCédric Le Goater     MemoryRegion    end_edt_mmio;
612dfa91a2SCédric Le Goater 
622dfa91a2SCédric Le Goater     /* Shortcut values for the Main MMIO regions */
632dfa91a2SCédric Le Goater     hwaddr        ic_base;
642dfa91a2SCédric Le Goater     uint32_t      ic_shift;
652dfa91a2SCédric Le Goater     hwaddr        vc_base;
662dfa91a2SCédric Le Goater     uint32_t      vc_shift;
672dfa91a2SCédric Le Goater     hwaddr        pc_base;
682dfa91a2SCédric Le Goater     uint32_t      pc_shift;
692dfa91a2SCédric Le Goater     hwaddr        tm_base;
702dfa91a2SCédric Le Goater     uint32_t      tm_shift;
712dfa91a2SCédric Le Goater 
722dfa91a2SCédric Le Goater     /* Our XIVE source objects for IPIs and ENDs */
732dfa91a2SCédric Le Goater     XiveSource    ipi_source;
742dfa91a2SCédric Le Goater     XiveENDSource end_source;
752dfa91a2SCédric Le Goater 
762dfa91a2SCédric Le Goater     /* Interrupt controller registers */
772dfa91a2SCédric Le Goater     uint64_t      regs[0x300];
782dfa91a2SCédric Le Goater 
792dfa91a2SCédric Le Goater     /*
802dfa91a2SCédric Le Goater      * Virtual Structure Descriptor tables : EAT, SBE, ENDT, NVTT, IRQ
812dfa91a2SCédric Le Goater      * These are in a SRAM protected by ECC.
822dfa91a2SCédric Le Goater      */
832dfa91a2SCédric Le Goater     uint64_t      vsds[5][XIVE_BLOCK_MAX];
842dfa91a2SCédric Le Goater 
852dfa91a2SCédric Le Goater     /* Translation tables */
862dfa91a2SCédric Le Goater     uint64_t      blk[XIVE_TABLE_BLK_MAX];
872dfa91a2SCédric Le Goater     uint64_t      mig[XIVE_TABLE_MIG_MAX];
882dfa91a2SCédric Le Goater     uint64_t      vdt[XIVE_TABLE_VDT_MAX];
892dfa91a2SCédric Le Goater     uint64_t      edt[XIVE_TABLE_EDT_MAX];
902dfa91a2SCédric Le Goater } PnvXive;
912dfa91a2SCédric Le Goater 
92*0da41d3cSGreg Kurz typedef struct PnvXiveClass {
93*0da41d3cSGreg Kurz     XiveRouterClass parent_class;
94*0da41d3cSGreg Kurz 
95*0da41d3cSGreg Kurz     DeviceRealize parent_realize;
96*0da41d3cSGreg Kurz } PnvXiveClass;
97*0da41d3cSGreg Kurz 
982dfa91a2SCédric Le Goater void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon);
992dfa91a2SCédric Le Goater 
1002dfa91a2SCédric Le Goater #endif /* PPC_PNV_XIVE_H */
101