[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/33] target/arm: Move start-powered-off property to generic CPUS
From: |
David Gibson |
Subject: |
[PULL 15/33] target/arm: Move start-powered-off property to generic CPUState |
Date: |
Tue, 8 Sep 2020 15:19:35 +1000 |
From: Thiago Jung Bauermann <bauerman@linux.ibm.com>
There are other platforms which also have CPUs that start powered off, so
generalize the start-powered-off property so that it can be used by them.
Note that ARMv7MState also has a property of the same name but this patch
doesn't change it because that class isn't a subclass of CPUState so it
wouldn't be a trivial change.
This change should not cause any change in behavior.
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Message-Id: <20200826055535.951207-2-bauerman@linux.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
exec.c | 1 +
include/hw/core/cpu.h | 4 ++++
target/arm/cpu.c | 5 ++---
target/arm/cpu.h | 3 ---
target/arm/kvm32.c | 2 +-
target/arm/kvm64.c | 2 +-
6 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/exec.c b/exec.c
index 7683afb6a8..e34b602bdf 100644
--- a/exec.c
+++ b/exec.c
@@ -899,6 +899,7 @@ Property cpu_common_props[] = {
DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
MemoryRegion *),
#endif
+ DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, false),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 8f145733ce..9fc2696db5 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -374,6 +374,10 @@ struct CPUState {
bool created;
bool stop;
bool stopped;
+
+ /* Should CPU start in powered-off state? */
+ bool start_powered_off;
+
bool unplug;
bool crash_occurred;
bool exit_request;
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index c179e0752d..9f814194fb 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -174,8 +174,8 @@ static void arm_cpu_reset(DeviceState *dev)
env->vfp.xregs[ARM_VFP_MVFR1] = cpu->isar.mvfr1;
env->vfp.xregs[ARM_VFP_MVFR2] = cpu->isar.mvfr2;
- cpu->power_state = cpu->start_powered_off ? PSCI_OFF : PSCI_ON;
- s->halted = cpu->start_powered_off;
+ cpu->power_state = s->start_powered_off ? PSCI_OFF : PSCI_ON;
+ s->halted = s->start_powered_off;
if (arm_feature(env, ARM_FEATURE_IWMMXT)) {
env->iwmmxt.cregs[ARM_IWMMXT_wCID] = 0x69051000 | 'Q';
@@ -2186,7 +2186,6 @@ static const ARMCPUInfo arm_cpus[] = {
};
static Property arm_cpu_properties[] = {
- DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false),
DEFINE_PROP_UINT32("psci-conduit", ARMCPU, psci_conduit, 0),
DEFINE_PROP_UINT64("midr", ARMCPU, midr, 0),
DEFINE_PROP_UINT64("mp-affinity", ARMCPU,
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index a1c7d8ebae..6036f61d60 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -817,9 +817,6 @@ struct ARMCPU {
*/
uint32_t psci_version;
- /* Should CPU start in PSCI powered-off state? */
- bool start_powered_off;
-
/* Current power state, access guarded by BQL */
ARMPSCIState power_state;
diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c
index 0af46b41c8..1f2b8f8b7a 100644
--- a/target/arm/kvm32.c
+++ b/target/arm/kvm32.c
@@ -218,7 +218,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
/* Determine init features for this CPU */
memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features));
- if (cpu->start_powered_off) {
+ if (cs->start_powered_off) {
cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF;
}
if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index ef1e960285..987b35e33f 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -774,7 +774,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
/* Determine init features for this CPU */
memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features));
- if (cpu->start_powered_off) {
+ if (cs->start_powered_off) {
cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF;
}
if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
--
2.26.2
- [PULL 07/33] spapr/xive: Use the xics flag to check for XIVE-only IRQ backends, (continued)
- [PULL 07/33] spapr/xive: Use the xics flag to check for XIVE-only IRQ backends, David Gibson, 2020/09/08
- [PULL 05/33] ppc/pnv: Add a HIOMAP erase command, David Gibson, 2020/09/08
- [PULL 08/33] spapr/xive: Modify kvm_cpu_is_enabled() interface, David Gibson, 2020/09/08
- [PULL 06/33] spapr_vscsi: do not allow device hotplug, David Gibson, 2020/09/08
- [PULL 09/33] spapr/xive: Use kvmppc_xive_source_reset() in post_load, David Gibson, 2020/09/08
- [PULL 10/33] spapr/xive: Allocate IPIs independently from the other sources, David Gibson, 2020/09/08
- [PULL 11/33] spapr/xive: Allocate vCPU IPIs from the vCPU contexts, David Gibson, 2020/09/08
- [PULL 12/33] ppc/spapr_nvdimm: use g_autofree in spapr_nvdimm_validate_opts(), David Gibson, 2020/09/08
- [PULL 13/33] spapr, spapr_nvdimm: fold NVDIMM validation in the same place, David Gibson, 2020/09/08
- [PULL 14/33] ppc/spapr_nvdimm: do not enable support with 'nvdimm=off', David Gibson, 2020/09/08
- [PULL 15/33] target/arm: Move start-powered-off property to generic CPUState,
David Gibson <=
- [PULL 18/33] ppc/e500: Use start-powered-off CPUState property, David Gibson, 2020/09/08
- [PULL 17/33] ppc/spapr: Use start-powered-off CPUState property, David Gibson, 2020/09/08
- [PULL 20/33] sparc/sun4m: Don't set cs->halted = 0 in main_cpu_reset(), David Gibson, 2020/09/08
- [PULL 24/33] hw/ppc/ppc4xx_pci: Replace pointless warning by assert(), David Gibson, 2020/09/08
- [PULL 19/33] mips/cps: Use start-powered-off CPUState property, David Gibson, 2020/09/08
- [PULL 22/33] target/s390x: Use start-powered-off CPUState property, David Gibson, 2020/09/08
- [PULL 21/33] sparc/sun4m: Use start-powered-off CPUState property, David Gibson, 2020/09/08
- [PULL 16/33] target/arm: Move setting of CPU halted state to generic code, David Gibson, 2020/09/08
- [PULL 23/33] hw/ppc/ppc4xx_pci: Use ARRAY_SIZE() instead of magic value, David Gibson, 2020/09/08
- [PULL 26/33] ppc/spapr_nvdimm: turn spapr_dt_nvdimm() static, David Gibson, 2020/09/08