1*2dfa91a2SCédric Le Goater /* 2*2dfa91a2SCédric Le Goater * QEMU PowerPC XIVE interrupt controller model 3*2dfa91a2SCédric Le Goater * 4*2dfa91a2SCédric Le Goater * Copyright (c) 2017-2019, IBM Corporation. 5*2dfa91a2SCédric Le Goater * 6*2dfa91a2SCédric Le Goater * This code is licensed under the GPL version 2 or later. See the 7*2dfa91a2SCédric Le Goater * COPYING file in the top-level directory. 8*2dfa91a2SCédric Le Goater */ 9*2dfa91a2SCédric Le Goater 10*2dfa91a2SCédric Le Goater #ifndef PPC_PNV_XIVE_H 11*2dfa91a2SCédric Le Goater #define PPC_PNV_XIVE_H 12*2dfa91a2SCédric Le Goater 13*2dfa91a2SCédric Le Goater #include "hw/ppc/xive.h" 14*2dfa91a2SCédric Le Goater 15*2dfa91a2SCédric Le Goater struct PnvChip; 16*2dfa91a2SCédric Le Goater 17*2dfa91a2SCédric Le Goater #define TYPE_PNV_XIVE "pnv-xive" 18*2dfa91a2SCédric Le Goater #define PNV_XIVE(obj) OBJECT_CHECK(PnvXive, (obj), TYPE_PNV_XIVE) 19*2dfa91a2SCédric Le Goater 20*2dfa91a2SCédric Le Goater #define XIVE_BLOCK_MAX 16 21*2dfa91a2SCédric Le Goater 22*2dfa91a2SCédric Le Goater #define XIVE_TABLE_BLK_MAX 16 /* Block Scope Table (0-15) */ 23*2dfa91a2SCédric Le Goater #define XIVE_TABLE_MIG_MAX 16 /* Migration Register Table (1-15) */ 24*2dfa91a2SCédric Le Goater #define XIVE_TABLE_VDT_MAX 16 /* VDT Domain Table (0-15) */ 25*2dfa91a2SCédric Le Goater #define XIVE_TABLE_EDT_MAX 64 /* EDT Domain Table (0-63) */ 26*2dfa91a2SCédric Le Goater 27*2dfa91a2SCédric Le Goater typedef struct PnvXive { 28*2dfa91a2SCédric Le Goater XiveRouter parent_obj; 29*2dfa91a2SCédric Le Goater 30*2dfa91a2SCédric Le Goater /* Owning chip */ 31*2dfa91a2SCédric Le Goater struct PnvChip *chip; 32*2dfa91a2SCédric Le Goater 33*2dfa91a2SCédric Le Goater /* XSCOM addresses giving access to the controller registers */ 34*2dfa91a2SCédric Le Goater MemoryRegion xscom_regs; 35*2dfa91a2SCédric Le Goater 36*2dfa91a2SCédric Le Goater /* Main MMIO regions that can be configured by FW */ 37*2dfa91a2SCédric Le Goater MemoryRegion ic_mmio; 38*2dfa91a2SCédric Le Goater MemoryRegion ic_reg_mmio; 39*2dfa91a2SCédric Le Goater MemoryRegion ic_notify_mmio; 40*2dfa91a2SCédric Le Goater MemoryRegion ic_lsi_mmio; 41*2dfa91a2SCédric Le Goater MemoryRegion tm_indirect_mmio; 42*2dfa91a2SCédric Le Goater MemoryRegion vc_mmio; 43*2dfa91a2SCédric Le Goater MemoryRegion pc_mmio; 44*2dfa91a2SCédric Le Goater MemoryRegion tm_mmio; 45*2dfa91a2SCédric Le Goater 46*2dfa91a2SCédric Le Goater /* 47*2dfa91a2SCédric Le Goater * IPI and END address spaces modeling the EDT segmentation in the 48*2dfa91a2SCédric Le Goater * VC region 49*2dfa91a2SCédric Le Goater */ 50*2dfa91a2SCédric Le Goater AddressSpace ipi_as; 51*2dfa91a2SCédric Le Goater MemoryRegion ipi_mmio; 52*2dfa91a2SCédric Le Goater MemoryRegion ipi_edt_mmio; 53*2dfa91a2SCédric Le Goater 54*2dfa91a2SCédric Le Goater AddressSpace end_as; 55*2dfa91a2SCédric Le Goater MemoryRegion end_mmio; 56*2dfa91a2SCédric Le Goater MemoryRegion end_edt_mmio; 57*2dfa91a2SCédric Le Goater 58*2dfa91a2SCédric Le Goater /* Shortcut values for the Main MMIO regions */ 59*2dfa91a2SCédric Le Goater hwaddr ic_base; 60*2dfa91a2SCédric Le Goater uint32_t ic_shift; 61*2dfa91a2SCédric Le Goater hwaddr vc_base; 62*2dfa91a2SCédric Le Goater uint32_t vc_shift; 63*2dfa91a2SCédric Le Goater hwaddr pc_base; 64*2dfa91a2SCédric Le Goater uint32_t pc_shift; 65*2dfa91a2SCédric Le Goater hwaddr tm_base; 66*2dfa91a2SCédric Le Goater uint32_t tm_shift; 67*2dfa91a2SCédric Le Goater 68*2dfa91a2SCédric Le Goater /* Our XIVE source objects for IPIs and ENDs */ 69*2dfa91a2SCédric Le Goater XiveSource ipi_source; 70*2dfa91a2SCédric Le Goater XiveENDSource end_source; 71*2dfa91a2SCédric Le Goater 72*2dfa91a2SCédric Le Goater /* Interrupt controller registers */ 73*2dfa91a2SCédric Le Goater uint64_t regs[0x300]; 74*2dfa91a2SCédric Le Goater 75*2dfa91a2SCédric Le Goater /* Can be configured by FW */ 76*2dfa91a2SCédric Le Goater uint32_t tctx_chipid; 77*2dfa91a2SCédric Le Goater 78*2dfa91a2SCédric Le Goater /* 79*2dfa91a2SCédric Le Goater * Virtual Structure Descriptor tables : EAT, SBE, ENDT, NVTT, IRQ 80*2dfa91a2SCédric Le Goater * These are in a SRAM protected by ECC. 81*2dfa91a2SCédric Le Goater */ 82*2dfa91a2SCédric Le Goater uint64_t vsds[5][XIVE_BLOCK_MAX]; 83*2dfa91a2SCédric Le Goater 84*2dfa91a2SCédric Le Goater /* Translation tables */ 85*2dfa91a2SCédric Le Goater uint64_t blk[XIVE_TABLE_BLK_MAX]; 86*2dfa91a2SCédric Le Goater uint64_t mig[XIVE_TABLE_MIG_MAX]; 87*2dfa91a2SCédric Le Goater uint64_t vdt[XIVE_TABLE_VDT_MAX]; 88*2dfa91a2SCédric Le Goater uint64_t edt[XIVE_TABLE_EDT_MAX]; 89*2dfa91a2SCédric Le Goater } PnvXive; 90*2dfa91a2SCédric Le Goater 91*2dfa91a2SCédric Le Goater void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon); 92*2dfa91a2SCédric Le Goater 93*2dfa91a2SCédric Le Goater #endif /* PPC_PNV_XIVE_H */ 94