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