2019-03-06 09:50:11 +01:00
|
|
|
/*
|
|
|
|
* 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/xive.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
ppc/pnv: Add a XIVE2 controller to the POWER10 chip
The XIVE2 interrupt controller of the POWER10 processor follows the
same logic than on POWER9 but the HW interface has been largely
reviewed. It has a new register interface, different BARs, extra
VSDs, new layout for the XIVE2 structures, and a set of new features
which are described below.
This is a model of the POWER10 XIVE2 interrupt controller for the
PowerNV machine. It focuses primarily on the needs of the skiboot
firmware but some initial hypervisor support is implemented for KVM
use (escalation).
Support for new features will be implemented in time and will require
new support from the OS.
* XIVE2 BARS
The interrupt controller BARs have a different layout outlined below.
Each sub-engine has now own its range and the indirect TIMA access was
replaced with a set of pages, one per CPU, under the IC BAR:
- IC BAR (Interrupt Controller)
. 4 pages, one per sub-engine
. 128 indirect TIMA pages
- TM BAR (Thread Interrupt Management Area)
. 4 pages
- ESB BAR (ESB pages for IPIs)
. up to 1TB
- END BAR (ESB pages for ENDs)
. up to 2TB
- NVC BAR (Notification Virtual Crowd)
. up to 128
- NVPG BAR (Notification Virtual Process and Group)
. up to 1TB
- Direct mapped Thread Context Area (reads & writes)
OPAL does not use the grouping and crowd capability.
* Virtual Structure Tables
XIVE2 adds new tables types and also changes the field layout of the END
and NVP Virtualization Structure Descriptors.
- EAS
- END new layout
- NVT was splitted in :
. NVP (Processor), 32B
. NVG (Group), 32B
. NVC (Crowd == P9 block group) 32B
- IC for remote configuration
- SYNC for cache injection
- ERQ for event input queue
The setup is slighly different on XIVE2 because the indexing has changed
for some of the tables, block ID or the chip topology ID can be used.
* XIVE2 features
SCOM and MMIO registers have a new layout and XIVE2 adds a new global
capability and configuration registers.
The lowlevel hardware offers a set of new features among which :
- a configurable number of priorities : 1 - 8
- StoreEOI with load-after-store ordering is activated by default
- Gen2 TIMA layout
- A P9-compat mode, or Gen1, TIMA toggle bit for SW compatibility
- increase to 24bit for VP number
Other features will have some impact on the Hypervisor and guest OS
when activated, but this is not required for initial support of the
controller.
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2022-03-02 06:51:38 +01:00
|
|
|
#include "hw/ppc/xive2.h"
|
2019-03-06 09:50:11 +01:00
|
|
|
|
|
|
|
struct PnvChip;
|
|
|
|
|
|
|
|
#define TYPE_PNV_XIVE "pnv-xive"
|
2020-08-31 23:07:37 +02:00
|
|
|
OBJECT_DECLARE_TYPE(PnvXive, PnvXiveClass,
|
qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros
One of the goals of having less boilerplate on QOM declarations
is to avoid human error. Requiring an extra argument that is
never used is an opportunity for mistakes.
Remove the unused argument from OBJECT_DECLARE_TYPE and
OBJECT_DECLARE_SIMPLE_TYPE.
Coccinelle patch used to convert all users of the macros:
@@
declarer name OBJECT_DECLARE_TYPE;
identifier InstanceType, ClassType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_TYPE(InstanceType, ClassType,
- lowercase,
UPPERCASE);
@@
declarer name OBJECT_DECLARE_SIMPLE_TYPE;
identifier InstanceType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_SIMPLE_TYPE(InstanceType,
- lowercase,
UPPERCASE);
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Paul Durrant <paul@xen.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200916182519.415636-4-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-16 20:25:17 +02:00
|
|
|
PNV_XIVE)
|
2019-03-06 09:50:11 +01:00
|
|
|
|
|
|
|
#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) */
|
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct PnvXive {
|
2019-03-06 09:50:11 +01:00
|
|
|
XiveRouter parent_obj;
|
|
|
|
|
|
|
|
/* Owning chip */
|
|
|
|
struct 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];
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2019-03-06 09:50:11 +01:00
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct PnvXiveClass {
|
2020-01-06 15:56:36 +01:00
|
|
|
XiveRouterClass parent_class;
|
|
|
|
|
|
|
|
DeviceRealize parent_realize;
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2020-01-06 15:56:36 +01:00
|
|
|
|
2019-03-06 09:50:11 +01:00
|
|
|
void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon);
|
|
|
|
|
ppc/pnv: Add a XIVE2 controller to the POWER10 chip
The XIVE2 interrupt controller of the POWER10 processor follows the
same logic than on POWER9 but the HW interface has been largely
reviewed. It has a new register interface, different BARs, extra
VSDs, new layout for the XIVE2 structures, and a set of new features
which are described below.
This is a model of the POWER10 XIVE2 interrupt controller for the
PowerNV machine. It focuses primarily on the needs of the skiboot
firmware but some initial hypervisor support is implemented for KVM
use (escalation).
Support for new features will be implemented in time and will require
new support from the OS.
* XIVE2 BARS
The interrupt controller BARs have a different layout outlined below.
Each sub-engine has now own its range and the indirect TIMA access was
replaced with a set of pages, one per CPU, under the IC BAR:
- IC BAR (Interrupt Controller)
. 4 pages, one per sub-engine
. 128 indirect TIMA pages
- TM BAR (Thread Interrupt Management Area)
. 4 pages
- ESB BAR (ESB pages for IPIs)
. up to 1TB
- END BAR (ESB pages for ENDs)
. up to 2TB
- NVC BAR (Notification Virtual Crowd)
. up to 128
- NVPG BAR (Notification Virtual Process and Group)
. up to 1TB
- Direct mapped Thread Context Area (reads & writes)
OPAL does not use the grouping and crowd capability.
* Virtual Structure Tables
XIVE2 adds new tables types and also changes the field layout of the END
and NVP Virtualization Structure Descriptors.
- EAS
- END new layout
- NVT was splitted in :
. NVP (Processor), 32B
. NVG (Group), 32B
. NVC (Crowd == P9 block group) 32B
- IC for remote configuration
- SYNC for cache injection
- ERQ for event input queue
The setup is slighly different on XIVE2 because the indexing has changed
for some of the tables, block ID or the chip topology ID can be used.
* XIVE2 features
SCOM and MMIO registers have a new layout and XIVE2 adds a new global
capability and configuration registers.
The lowlevel hardware offers a set of new features among which :
- a configurable number of priorities : 1 - 8
- StoreEOI with load-after-store ordering is activated by default
- Gen2 TIMA layout
- A P9-compat mode, or Gen1, TIMA toggle bit for SW compatibility
- increase to 24bit for VP number
Other features will have some impact on the Hypervisor and guest OS
when activated, but this is not required for initial support of the
controller.
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2022-03-02 06:51:38 +01:00
|
|
|
/*
|
|
|
|
* 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 */
|
|
|
|
struct 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);
|
|
|
|
|
2019-03-06 09:50:11 +01:00
|
|
|
#endif /* PPC_PNV_XIVE_H */
|