2016-06-10 00:59:01 +00:00
|
|
|
/*
|
|
|
|
* sPAPR CPU core device.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 Bharata B Rao <bharata@linux.vnet.ibm.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
#ifndef HW_SPAPR_CPU_CORE_H
|
|
|
|
#define HW_SPAPR_CPU_CORE_H
|
|
|
|
|
|
|
|
#include "hw/cpu/core.h"
|
2019-08-12 05:23:51 +00:00
|
|
|
#include "hw/qdev-core.h"
|
2016-10-11 06:56:52 +00:00
|
|
|
#include "target/ppc/cpu-qom.h"
|
2018-05-01 06:22:49 +00:00
|
|
|
#include "target/ppc/cpu.h"
|
2020-09-03 20:43:22 +00:00
|
|
|
#include "qom/object.h"
|
2016-06-10 00:59:01 +00:00
|
|
|
|
|
|
|
#define TYPE_SPAPR_CPU_CORE "spapr-cpu-core"
|
2020-08-31 21:07:37 +00:00
|
|
|
OBJECT_DECLARE_TYPE(SpaprCpuCore, SpaprCpuCoreClass,
|
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 18:25:17 +00:00
|
|
|
SPAPR_CPU_CORE)
|
2016-06-10 00:59:01 +00:00
|
|
|
|
2017-10-09 19:51:00 +00:00
|
|
|
#define SPAPR_CPU_CORE_TYPE_NAME(model) model "-" TYPE_SPAPR_CPU_CORE
|
|
|
|
|
2020-09-03 20:43:22 +00:00
|
|
|
struct SpaprCpuCore {
|
2016-06-10 00:59:01 +00:00
|
|
|
/*< private >*/
|
|
|
|
CPUCore parent_obj;
|
|
|
|
|
|
|
|
/*< public >*/
|
2017-11-20 09:19:54 +00:00
|
|
|
PowerPCCPU **threads;
|
2017-05-10 11:29:46 +00:00
|
|
|
int node_id;
|
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 04:35:37 +00:00
|
|
|
bool pre_3_0_migration; /* older machine don't know about SpaprCpuState */
|
2020-09-03 20:43:22 +00:00
|
|
|
};
|
2016-06-10 00:59:01 +00:00
|
|
|
|
2020-09-03 20:43:22 +00:00
|
|
|
struct SpaprCpuCoreClass {
|
2016-09-12 07:57:20 +00:00
|
|
|
DeviceClass parent_class;
|
2017-10-09 19:51:01 +00:00
|
|
|
const char *cpu_type;
|
2020-09-03 20:43:22 +00:00
|
|
|
};
|
2016-09-12 07:57:20 +00:00
|
|
|
|
2017-10-09 19:51:05 +00:00
|
|
|
const char *spapr_get_cpu_core_type(const char *cpu_type);
|
2020-03-10 05:07:31 +00:00
|
|
|
void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_ulong nip,
|
|
|
|
target_ulong r1, target_ulong r3,
|
|
|
|
target_ulong r4);
|
2018-05-01 06:22:49 +00: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 04:35:37 +00:00
|
|
|
typedef struct SpaprCpuState {
|
2018-06-13 06:22:18 +00:00
|
|
|
uint64_t vpa_addr;
|
|
|
|
uint64_t slb_shadow_addr, slb_shadow_size;
|
|
|
|
uint64_t dtl_addr, dtl_size;
|
2019-07-18 03:42:12 +00:00
|
|
|
bool prod; /* not migrated, only used to improve dispatch latencies */
|
2019-01-17 07:53:26 +00:00
|
|
|
struct ICPState *icp;
|
|
|
|
struct XiveTCTX *tctx;
|
2022-02-18 07:34:14 +00:00
|
|
|
|
|
|
|
/* Fields for nested-HV support */
|
|
|
|
bool in_nested; /* true while the L2 is executing */
|
|
|
|
CPUPPCState *nested_host_state; /* holds the L1 state while L2 executes */
|
|
|
|
int64_t nested_tb_offset; /* L1->L2 TB offset */
|
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 04:35:37 +00:00
|
|
|
} SpaprCpuState;
|
2018-06-13 06:22:18 +00: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 04:35:37 +00:00
|
|
|
static inline SpaprCpuState *spapr_cpu_state(PowerPCCPU *cpu)
|
2018-06-13 06:22:18 +00: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 04:35:37 +00:00
|
|
|
return (SpaprCpuState *)cpu->machine_data;
|
2018-06-13 06:22:18 +00:00
|
|
|
}
|
|
|
|
|
2016-06-10 00:59:01 +00:00
|
|
|
#endif
|