xref: /openbmc/qemu/include/hw/ppc/pnv_xive.h (revision 80748eb4fbc70f0a3ae423f2c01cb5a4584d803f)
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 
13b6c80037SMarkus Armbruster #include "hw/ppc/pnv.h"
142dfa91a2SCédric Le Goater #include "hw/ppc/xive.h"
15db1015e9SEduardo Habkost #include "qom/object.h"
16da71b7e3SCédric Le Goater #include "hw/ppc/xive2.h"
172dfa91a2SCédric Le Goater 
182dfa91a2SCédric Le Goater #define TYPE_PNV_XIVE "pnv-xive"
19c821774aSEduardo Habkost OBJECT_DECLARE_TYPE(PnvXive, PnvXiveClass,
2030b5707cSEduardo Habkost                     PNV_XIVE)
212dfa91a2SCédric Le Goater 
222dfa91a2SCédric Le Goater #define XIVE_BLOCK_MAX      16
232dfa91a2SCédric Le Goater 
242dfa91a2SCédric Le Goater #define XIVE_TABLE_BLK_MAX  16  /* Block Scope Table (0-15) */
252dfa91a2SCédric Le Goater #define XIVE_TABLE_MIG_MAX  16  /* Migration Register Table (1-15) */
262dfa91a2SCédric Le Goater #define XIVE_TABLE_VDT_MAX  16  /* VDT Domain Table (0-15) */
272dfa91a2SCédric Le Goater #define XIVE_TABLE_EDT_MAX  64  /* EDT Domain Table (0-63) */
282dfa91a2SCédric Le Goater 
29db1015e9SEduardo Habkost struct PnvXive {
302dfa91a2SCédric Le Goater     XiveRouter    parent_obj;
312dfa91a2SCédric Le Goater 
322dfa91a2SCédric Le Goater     /* Owning chip */
33b6c80037SMarkus Armbruster     PnvChip *chip;
342dfa91a2SCédric Le Goater 
352dfa91a2SCédric Le Goater     /* XSCOM addresses giving access to the controller registers */
362dfa91a2SCédric Le Goater     MemoryRegion  xscom_regs;
372dfa91a2SCédric Le Goater 
382dfa91a2SCédric Le Goater     /* Main MMIO regions that can be configured by FW */
392dfa91a2SCédric Le Goater     MemoryRegion  ic_mmio;
402dfa91a2SCédric Le Goater     MemoryRegion    ic_reg_mmio;
412dfa91a2SCédric Le Goater     MemoryRegion    ic_notify_mmio;
422dfa91a2SCédric Le Goater     MemoryRegion    ic_lsi_mmio;
432dfa91a2SCédric Le Goater     MemoryRegion    tm_indirect_mmio;
442dfa91a2SCédric Le Goater     MemoryRegion  vc_mmio;
452dfa91a2SCédric Le Goater     MemoryRegion  pc_mmio;
462dfa91a2SCédric Le Goater     MemoryRegion  tm_mmio;
472dfa91a2SCédric Le Goater 
482dfa91a2SCédric Le Goater     /*
492dfa91a2SCédric Le Goater      * IPI and END address spaces modeling the EDT segmentation in the
502dfa91a2SCédric Le Goater      * VC region
512dfa91a2SCédric Le Goater      */
522dfa91a2SCédric Le Goater     AddressSpace  ipi_as;
532dfa91a2SCédric Le Goater     MemoryRegion  ipi_mmio;
542dfa91a2SCédric Le Goater     MemoryRegion    ipi_edt_mmio;
552dfa91a2SCédric Le Goater 
562dfa91a2SCédric Le Goater     AddressSpace  end_as;
572dfa91a2SCédric Le Goater     MemoryRegion  end_mmio;
582dfa91a2SCédric Le Goater     MemoryRegion    end_edt_mmio;
592dfa91a2SCédric Le Goater 
602dfa91a2SCédric Le Goater     /* Shortcut values for the Main MMIO regions */
612dfa91a2SCédric Le Goater     hwaddr        ic_base;
622dfa91a2SCédric Le Goater     uint32_t      ic_shift;
632dfa91a2SCédric Le Goater     hwaddr        vc_base;
642dfa91a2SCédric Le Goater     uint32_t      vc_shift;
652dfa91a2SCédric Le Goater     hwaddr        pc_base;
662dfa91a2SCédric Le Goater     uint32_t      pc_shift;
672dfa91a2SCédric Le Goater     hwaddr        tm_base;
682dfa91a2SCédric Le Goater     uint32_t      tm_shift;
692dfa91a2SCédric Le Goater 
702dfa91a2SCédric Le Goater     /* Our XIVE source objects for IPIs and ENDs */
712dfa91a2SCédric Le Goater     XiveSource    ipi_source;
722dfa91a2SCédric Le Goater     XiveENDSource end_source;
732dfa91a2SCédric Le Goater 
742dfa91a2SCédric Le Goater     /* Interrupt controller registers */
752dfa91a2SCédric Le Goater     uint64_t      regs[0x300];
762dfa91a2SCédric Le Goater 
772dfa91a2SCédric Le Goater     /*
782dfa91a2SCédric Le Goater      * Virtual Structure Descriptor tables : EAT, SBE, ENDT, NVTT, IRQ
792dfa91a2SCédric Le Goater      * These are in a SRAM protected by ECC.
802dfa91a2SCédric Le Goater      */
812dfa91a2SCédric Le Goater     uint64_t      vsds[5][XIVE_BLOCK_MAX];
822dfa91a2SCédric Le Goater 
832dfa91a2SCédric Le Goater     /* Translation tables */
842dfa91a2SCédric Le Goater     uint64_t      blk[XIVE_TABLE_BLK_MAX];
852dfa91a2SCédric Le Goater     uint64_t      mig[XIVE_TABLE_MIG_MAX];
862dfa91a2SCédric Le Goater     uint64_t      vdt[XIVE_TABLE_VDT_MAX];
872dfa91a2SCédric Le Goater     uint64_t      edt[XIVE_TABLE_EDT_MAX];
88db1015e9SEduardo Habkost };
892dfa91a2SCédric Le Goater 
90db1015e9SEduardo Habkost struct PnvXiveClass {
910da41d3cSGreg Kurz     XiveRouterClass parent_class;
920da41d3cSGreg Kurz 
930da41d3cSGreg Kurz     DeviceRealize parent_realize;
94db1015e9SEduardo Habkost };
950da41d3cSGreg Kurz 
960527563aSPhilippe Mathieu-Daudé void pnv_xive_pic_print_info(PnvXive *xive, GString *buf);
972dfa91a2SCédric Le Goater 
98da71b7e3SCédric Le Goater /*
99da71b7e3SCédric Le Goater  * XIVE2 interrupt controller (POWER10)
100da71b7e3SCédric Le Goater  */
101da71b7e3SCédric Le Goater #define TYPE_PNV_XIVE2 "pnv-xive2"
102da71b7e3SCédric Le Goater OBJECT_DECLARE_TYPE(PnvXive2, PnvXive2Class, PNV_XIVE2);
103da71b7e3SCédric Le Goater 
104da71b7e3SCédric Le Goater typedef struct PnvXive2 {
105da71b7e3SCédric Le Goater     Xive2Router   parent_obj;
106da71b7e3SCédric Le Goater 
107da71b7e3SCédric Le Goater     /* Owning chip */
108b6c80037SMarkus Armbruster     PnvChip *chip;
109da71b7e3SCédric Le Goater 
110da71b7e3SCédric Le Goater     /* XSCOM addresses giving access to the controller registers */
111da71b7e3SCédric Le Goater     MemoryRegion  xscom_regs;
112da71b7e3SCédric Le Goater 
113da71b7e3SCédric Le Goater     MemoryRegion  ic_mmio;
114da71b7e3SCédric Le Goater     MemoryRegion  ic_mmios[8];
115da71b7e3SCédric Le Goater     MemoryRegion  esb_mmio;
116da71b7e3SCédric Le Goater     MemoryRegion  end_mmio;
117da71b7e3SCédric Le Goater     MemoryRegion  nvc_mmio;
118da71b7e3SCédric Le Goater     MemoryRegion  nvpg_mmio;
119da71b7e3SCédric Le Goater     MemoryRegion  tm_mmio;
120da71b7e3SCédric Le Goater 
121da71b7e3SCédric Le Goater     /* Shortcut values for the Main MMIO regions */
122da71b7e3SCédric Le Goater     hwaddr        ic_base;
123da71b7e3SCédric Le Goater     uint32_t      ic_shift;
124da71b7e3SCédric Le Goater     hwaddr        esb_base;
125da71b7e3SCédric Le Goater     uint32_t      esb_shift;
126da71b7e3SCédric Le Goater     hwaddr        end_base;
127da71b7e3SCédric Le Goater     uint32_t      end_shift;
128da71b7e3SCédric Le Goater     hwaddr        nvc_base;
129da71b7e3SCédric Le Goater     uint32_t      nvc_shift;
130da71b7e3SCédric Le Goater     hwaddr        nvpg_base;
131da71b7e3SCédric Le Goater     uint32_t      nvpg_shift;
132da71b7e3SCédric Le Goater     hwaddr        tm_base;
133da71b7e3SCédric Le Goater     uint32_t      tm_shift;
134da71b7e3SCédric Le Goater 
135da71b7e3SCédric Le Goater     /* Interrupt controller registers */
136da71b7e3SCédric Le Goater     uint64_t      cq_regs[0x40];
137da71b7e3SCédric Le Goater     uint64_t      vc_regs[0x100];
138da71b7e3SCédric Le Goater     uint64_t      pc_regs[0x100];
139da71b7e3SCédric Le Goater     uint64_t      tctxt_regs[0x30];
140da71b7e3SCédric Le Goater 
141da71b7e3SCédric Le Goater     /* To change default behavior */
142da71b7e3SCédric Le Goater     uint64_t      capabilities;
143da71b7e3SCédric Le Goater     uint64_t      config;
144da71b7e3SCédric Le Goater 
145da71b7e3SCédric Le Goater     /* Our XIVE source objects for IPIs and ENDs */
146da71b7e3SCédric Le Goater     XiveSource    ipi_source;
147da71b7e3SCédric Le Goater     Xive2EndSource end_source;
148da71b7e3SCédric Le Goater 
149da71b7e3SCédric Le Goater     /*
150da71b7e3SCédric Le Goater      * Virtual Structure Descriptor tables
151da71b7e3SCédric Le Goater      * These are in a SRAM protected by ECC.
152da71b7e3SCédric Le Goater      */
153da71b7e3SCédric Le Goater     uint64_t      vsds[9][XIVE_BLOCK_MAX];
154da71b7e3SCédric Le Goater 
155da71b7e3SCédric Le Goater     /* Translation tables */
156da71b7e3SCédric Le Goater     uint64_t      tables[8][XIVE_BLOCK_MAX];
157da71b7e3SCédric Le Goater 
158da71b7e3SCédric Le Goater } PnvXive2;
159da71b7e3SCédric Le Goater 
160da71b7e3SCédric Le Goater typedef struct PnvXive2Class {
161da71b7e3SCédric Le Goater     Xive2RouterClass parent_class;
162da71b7e3SCédric Le Goater 
163da71b7e3SCédric Le Goater     DeviceRealize parent_realize;
164da71b7e3SCédric Le Goater } PnvXive2Class;
165da71b7e3SCédric Le Goater 
166*70fb275dSPhilippe Mathieu-Daudé void pnv_xive2_pic_print_info(PnvXive2 *xive, GString *buf);
167da71b7e3SCédric Le Goater 
1682dfa91a2SCédric Le Goater #endif /* PPC_PNV_XIVE_H */
169