2018-12-09 22:45:56 +03:00
|
|
|
/*
|
|
|
|
* QEMU PowerPC sPAPR XIVE interrupt controller model
|
|
|
|
*
|
|
|
|
* Copyright (c) 2017-2018, IBM Corporation.
|
|
|
|
*
|
|
|
|
* This code is licensed under the GPL version 2 or later. See the
|
|
|
|
* COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PPC_SPAPR_XIVE_H
|
|
|
|
#define PPC_SPAPR_XIVE_H
|
|
|
|
|
2019-08-12 08:23:31 +03:00
|
|
|
#include "hw/ppc/spapr_irq.h"
|
2018-12-09 22:45:56 +03:00
|
|
|
#include "hw/ppc/xive.h"
|
|
|
|
|
|
|
|
#define TYPE_SPAPR_XIVE "spapr-xive"
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 07:35:37 +03:00
|
|
|
#define SPAPR_XIVE(obj) OBJECT_CHECK(SpaprXive, (obj), TYPE_SPAPR_XIVE)
|
2019-12-19 21:11:47 +03:00
|
|
|
#define SPAPR_XIVE_CLASS(klass) \
|
|
|
|
OBJECT_CLASS_CHECK(SpaprXiveClass, (klass), TYPE_SPAPR_XIVE)
|
|
|
|
#define SPAPR_XIVE_GET_CLASS(obj) \
|
|
|
|
OBJECT_GET_CLASS(SpaprXiveClass, (obj), TYPE_SPAPR_XIVE)
|
2018-12-09 22:45:56 +03:00
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 07:35:37 +03:00
|
|
|
typedef struct SpaprXive {
|
2018-12-09 22:45:56 +03:00
|
|
|
XiveRouter parent;
|
|
|
|
|
|
|
|
/* Internal interrupt source for IPIs and virtual devices */
|
|
|
|
XiveSource source;
|
|
|
|
hwaddr vc_base;
|
|
|
|
|
|
|
|
/* END ESB MMIOs */
|
|
|
|
XiveENDSource end_source;
|
|
|
|
hwaddr end_base;
|
|
|
|
|
2019-02-19 20:18:08 +03:00
|
|
|
/* DT */
|
|
|
|
gchar *nodename;
|
|
|
|
|
2018-12-09 22:45:56 +03:00
|
|
|
/* Routing table */
|
|
|
|
XiveEAS *eat;
|
|
|
|
uint32_t nr_irqs;
|
|
|
|
XiveEND *endt;
|
|
|
|
uint32_t nr_ends;
|
|
|
|
|
|
|
|
/* TIMA mapping address */
|
|
|
|
hwaddr tm_base;
|
|
|
|
MemoryRegion tm_mmio;
|
2019-05-13 11:42:33 +03:00
|
|
|
|
|
|
|
/* KVM support */
|
|
|
|
int fd;
|
|
|
|
void *tm_mmap;
|
2019-06-14 19:59:19 +03:00
|
|
|
MemoryRegion tm_mmio_kvm;
|
2019-05-13 11:42:36 +03:00
|
|
|
VMChangeStateEntry *change;
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 07:35:37 +03:00
|
|
|
} SpaprXive;
|
2018-12-09 22:45:56 +03:00
|
|
|
|
2019-12-19 21:11:47 +03:00
|
|
|
typedef struct SpaprXiveClass {
|
|
|
|
XiveRouterClass parent;
|
|
|
|
|
|
|
|
DeviceRealize parent_realize;
|
|
|
|
} SpaprXiveClass;
|
|
|
|
|
2019-05-13 11:42:35 +03:00
|
|
|
/*
|
|
|
|
* The sPAPR machine has a unique XIVE IC device. Assign a fixed value
|
|
|
|
* to the controller block id value. It can nevertheless be changed
|
|
|
|
* for testing purpose.
|
|
|
|
*/
|
|
|
|
#define SPAPR_XIVE_BLOCK_ID 0x0
|
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 07:35:37 +03:00
|
|
|
void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon);
|
2018-12-09 22:45:56 +03:00
|
|
|
|
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-06 07:35:37 +03:00
|
|
|
void spapr_xive_hcall_init(SpaprMachineState *spapr);
|
|
|
|
void spapr_xive_mmio_set_enabled(SpaprXive *xive, bool enable);
|
2019-05-13 11:42:33 +03:00
|
|
|
void spapr_xive_map_mmio(SpaprXive *xive);
|
|
|
|
|
2019-05-13 11:42:34 +03:00
|
|
|
int spapr_xive_end_to_target(uint8_t end_blk, uint32_t end_idx,
|
|
|
|
uint32_t *out_server, uint8_t *out_prio);
|
|
|
|
|
2019-05-13 11:42:33 +03:00
|
|
|
/*
|
|
|
|
* KVM XIVE device helpers
|
|
|
|
*/
|
2019-11-26 19:46:23 +03:00
|
|
|
int kvmppc_xive_connect(SpaprInterruptController *intc, uint32_t nr_servers,
|
|
|
|
Error **errp);
|
2019-09-26 16:23:51 +03:00
|
|
|
void kvmppc_xive_disconnect(SpaprInterruptController *intc);
|
2019-05-13 11:42:34 +03:00
|
|
|
void kvmppc_xive_reset(SpaprXive *xive, Error **errp);
|
|
|
|
void kvmppc_xive_set_source_config(SpaprXive *xive, uint32_t lisn, XiveEAS *eas,
|
|
|
|
Error **errp);
|
|
|
|
void kvmppc_xive_sync_source(SpaprXive *xive, uint32_t lisn, Error **errp);
|
|
|
|
uint64_t kvmppc_xive_esb_rw(XiveSource *xsrc, int srcno, uint32_t offset,
|
|
|
|
uint64_t data, bool write);
|
|
|
|
void kvmppc_xive_set_queue_config(SpaprXive *xive, uint8_t end_blk,
|
|
|
|
uint32_t end_idx, XiveEND *end,
|
|
|
|
Error **errp);
|
|
|
|
void kvmppc_xive_get_queue_config(SpaprXive *xive, uint8_t end_blk,
|
|
|
|
uint32_t end_idx, XiveEND *end,
|
|
|
|
Error **errp);
|
2019-05-13 11:42:35 +03:00
|
|
|
void kvmppc_xive_synchronize_state(SpaprXive *xive, Error **errp);
|
2019-05-13 11:42:37 +03:00
|
|
|
int kvmppc_xive_pre_save(SpaprXive *xive);
|
|
|
|
int kvmppc_xive_post_load(SpaprXive *xive, int version_id);
|
2018-12-12 01:38:13 +03:00
|
|
|
|
2018-12-09 22:45:56 +03:00
|
|
|
#endif /* PPC_SPAPR_XIVE_H */
|