aboutsummaryrefslogtreecommitdiff
path: root/include/hw/ppc/pnv_xive.h
blob: 9c48430ee4181f2b9bbbfbb4c18946e030f34b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
 * QEMU PowerPC XIVE interrupt controller model
 *
 * Copyright (c) 2017-2019, IBM Corporation.
 *
 * This code is licensed under the GPL version 2 or later. See the
 * COPYING file in the top-level directory.
 */

#ifndef PPC_PNV_XIVE_H
#define PPC_PNV_XIVE_H

#include "hw/ppc/pnv.h"
#include "hw/ppc/xive.h"
#include "qom/object.h"
#include "hw/ppc/xive2.h"

#define TYPE_PNV_XIVE "pnv-xive"
OBJECT_DECLARE_TYPE(PnvXive, PnvXiveClass,
                    PNV_XIVE)

#define XIVE_BLOCK_MAX      16

#define XIVE_TABLE_BLK_MAX  16  /* Block Scope Table (0-15) */
#define XIVE_TABLE_MIG_MAX  16  /* Migration Register Table (1-15) */
#define XIVE_TABLE_VDT_MAX  16  /* VDT Domain Table (0-15) */
#define XIVE_TABLE_EDT_MAX  64  /* EDT Domain Table (0-63) */

struct PnvXive {
    XiveRouter    parent_obj;

    /* Owning chip */
    PnvChip *chip;

    /* XSCOM addresses giving access to the controller registers */
    MemoryRegion  xscom_regs;

    /* Main MMIO regions that can be configured by FW */
    MemoryRegion  ic_mmio;
    MemoryRegion    ic_reg_mmio;
    MemoryRegion    ic_notify_mmio;
    MemoryRegion    ic_lsi_mmio;
    MemoryRegion    tm_indirect_mmio;
    MemoryRegion  vc_mmio;
    MemoryRegion  pc_mmio;
    MemoryRegion  tm_mmio;

    /*
     * IPI and END address spaces modeling the EDT segmentation in the
     * VC region
     */
    AddressSpace  ipi_as;
    MemoryRegion  ipi_mmio;
    MemoryRegion    ipi_edt_mmio;

    AddressSpace  end_as;
    MemoryRegion  end_mmio;
    MemoryRegion    end_edt_mmio;

    /* Shortcut values for the Main MMIO regions */
    hwaddr        ic_base;
    uint32_t      ic_shift;
    hwaddr        vc_base;
    uint32_t      vc_shift;
    hwaddr        pc_base;
    uint32_t      pc_shift;
    hwaddr        tm_base;
    uint32_t      tm_shift;

    /* Our XIVE source objects for IPIs and ENDs */
    XiveSource    ipi_source;
    XiveENDSource end_source;

    /* Interrupt controller registers */
    uint64_t      regs[0x300];

    /*
     * Virtual Structure Descriptor tables : EAT, SBE, ENDT, NVTT, IRQ
     * These are in a SRAM protected by ECC.
     */
    uint64_t      vsds[5][XIVE_BLOCK_MAX];

    /* Translation tables */
    uint64_t      blk[XIVE_TABLE_BLK_MAX];
    uint64_t      mig[XIVE_TABLE_MIG_MAX];
    uint64_t      vdt[XIVE_TABLE_VDT_MAX];
    uint64_t      edt[XIVE_TABLE_EDT_MAX];
};

struct PnvXiveClass {
    XiveRouterClass parent_class;

    DeviceRealize parent_realize;
};

void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon);

/*
 * XIVE2 interrupt controller (POWER10)
 */
#define TYPE_PNV_XIVE2 "pnv-xive2"
OBJECT_DECLARE_TYPE(PnvXive2, PnvXive2Class, PNV_XIVE2);

typedef struct PnvXive2 {
    Xive2Router   parent_obj;

    /* Owning chip */
    PnvChip *chip;

    /* XSCOM addresses giving access to the controller registers */
    MemoryRegion  xscom_regs;

    MemoryRegion  ic_mmio;
    MemoryRegion  ic_mmios[8];
    MemoryRegion  esb_mmio;
    MemoryRegion  end_mmio;
    MemoryRegion  nvc_mmio;
    MemoryRegion  nvpg_mmio;
    MemoryRegion  tm_mmio;

    /* Shortcut values for the Main MMIO regions */
    hwaddr        ic_base;
    uint32_t      ic_shift;
    hwaddr        esb_base;
    uint32_t      esb_shift;
    hwaddr        end_base;
    uint32_t      end_shift;
    hwaddr        nvc_base;
    uint32_t      nvc_shift;
    hwaddr        nvpg_base;
    uint32_t      nvpg_shift;
    hwaddr        tm_base;
    uint32_t      tm_shift;

    /* Interrupt controller registers */
    uint64_t      cq_regs[0x40];
    uint64_t      vc_regs[0x100];
    uint64_t      pc_regs[0x100];
    uint64_t      tctxt_regs[0x30];

    /* To change default behavior */
    uint64_t      capabilities;
    uint64_t      config;

    /* Our XIVE source objects for IPIs and ENDs */
    XiveSource    ipi_source;
    Xive2EndSource end_source;

    /*
     * Virtual Structure Descriptor tables
     * These are in a SRAM protected by ECC.
     */
    uint64_t      vsds[9][XIVE_BLOCK_MAX];

    /* Translation tables */
    uint64_t      tables[8][XIVE_BLOCK_MAX];

} PnvXive2;

typedef struct PnvXive2Class {
    Xive2RouterClass parent_class;

    DeviceRealize parent_realize;
} PnvXive2Class;

void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon);

#endif /* PPC_PNV_XIVE_H */