Received: by 2002:ac2:4841:0:0:0:0:0 with SMTP id 1csp606132lfy; Wed, 19 Aug 2020 09:44:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoJwTRwe0n5IBreRGA8TVPADt2E+iNBglm7n/pJ/ESer+qHB9RQEwJLvw7NXjY9ex07MBq X-Received: by 2002:a63:7f50:: with SMTP id p16mr16809990pgn.451.1597855442456; Wed, 19 Aug 2020 09:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597855442; cv=none; d=google.com; s=arc-20160816; b=Wq+nL+hWtXXxtL5mJXV1kwtOVNXgAissbe6fpkhkN328PGOF0QYUNWw3FPbrkvR4ML gpjRr/v+OzzIWc1n6D0ruJlaRdNtZcAwRjQyRJTNI2mEbmv7OBhNXVutBgtB05ZZBWMO mBfbot6XPTQPpD3IM4L83LK0LML8OXX703ltpVq7fv8GWGjYZZRWvBbL5LvqGDW2Q1rr e8//+z7R/FpcvhClK+kELVb7RdPu3mgeoCBocB8bzAkYaBb5oz8wQnwexYiUctUeErmb /YtPBHORJ3D8PVYyvV/NLSYEYqlcJIjwZ1fehS3300sZn38NqN7rfrVG2bVFKnDPvOzi THQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=MvO/3TaXIaWi0NFqkMYr5QRYsMxBjotQRfyRCmT/j60=; b=zZxoSSetk1K6QQadrF2LCyFOAcTn/eloQEbLkDzS0t87zbEExxdek/LN3zHJqoN99H CK46fb6pYFaTbdPpv+QUH3Ex6tVhtQAX2967o/au2b0lT/8HEuSbSBaIIYXDpX30BULI bCBfArxeqjJTk3pswkSJCbkWj2p8dKZ6ih3TcqB9oePtoAJ5N7bbiTY7TYSUYZIpZ28v mbHJF7hh305NcEzCdlgyLPXhhD4nPD/IC/4IiQur0k4DK0Q6oLKeB+meBwXTHFtnRU6R W/6tCkWinSWlZuHlPgnjgym50oeghLVwh0j6KD1HaezEVSmxerJJ4b/2TUbr8bJ9IYBV 2/rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DV4pvNWM; spf=pass (google.com: domain of bauerman@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=bauerman@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id j2si18266425plj.392.2020.08.19.09.44.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Aug 2020 09:44:02 -0700 (PDT) Received-SPF: pass (google.com: domain of bauerman@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DV4pvNWM; spf=pass (google.com: domain of bauerman@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=bauerman@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07JGWqkA074405; Wed, 19 Aug 2020 12:43:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=MvO/3TaXIaWi0NFqkMYr5QRYsMxBjotQRfyRCmT/j60=; b=DV4pvNWMsC4aiZatIg0jzKKD0yFu0A2alFf+SX4brGfNkyaJMyC42hyD/mKhDSWCRSY1 s4yomegLgWLIfv4wHR0Lcjlt5kO3bCBh6RD1u4HyPIgC6hAaNDaDsR1yCFdW0VEE5shQ W3yN8gRBXsaffnp7V1EepCdVAhYQEKEWPOiWjHwGQkyxuWLmqovcp8Fyy749nGL07Fka 2CmtmegIogOLal4aCEu6OeegBeepMxNXSOuHzkWlfGcjJsYhcGXtHEbP3Q9FZTCiRaKo 7+V9PLTdnWcTdh8NqJjcFFRqwfUcwh6b3zronoIsL1wI6LrLwpyV3Nko7rNNYz7fnZpT xA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 330ccb8e4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 12:43:36 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07JGhajA118098; Wed, 19 Aug 2020 12:43:36 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 330ccb8e3y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 12:43:36 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07JGPQOn020389; Wed, 19 Aug 2020 16:43:35 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma03dal.us.ibm.com with ESMTP id 3304ccruk7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 16:43:35 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07JGhVJS65536436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Aug 2020 16:43:31 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE2A1C6057; Wed, 19 Aug 2020 16:43:33 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72951C6055; Wed, 19 Aug 2020 16:43:28 +0000 (GMT) Received: from morokweng.localdomain.com (unknown [9.211.41.171]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 19 Aug 2020 16:43:28 +0000 (GMT) From: Thiago Jung Bauermann To: qemu-ppc@nongnu.org Cc: qemu-arm@nongnu.org, qemu-s390x@nongnu.org, qemu-devel@nongnu.org, David Gibson , Paolo Bonzini , Marcel Apfelbaum , Eduardo Habkost , Richard Henderson , Peter Maydell , Aleksandar Markovic , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Mark Cave-Ayland , Artyom Tarasenko , Cornelia Huck , Thomas Huth , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Greg Kurz , Igor Mammedov , Thiago Jung Bauermann Subject: [PATCH v6 1/8] target/arm: Move start-powered-off property to generic CPUState Date: Wed, 19 Aug 2020 13:42:59 -0300 Message-Id: <20200819164306.625357-2-bauerman@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200819164306.625357-1-bauerman@linux.ibm.com> References: <20200819164306.625357-1-bauerman@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-19_09:2020-08-19,2020-08-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 suspectscore=1 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 clxscore=1015 phishscore=0 priorityscore=1501 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008190138 X-TUID: eycTVTRaWo20 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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: David Gibson Reviewed-by: Greg Kurz Signed-off-by: Thiago Jung Bauermann --- 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 6f381f98e2..82e82fab09 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 111579554f..ec65c7653f 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'; @@ -2182,7 +2182,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 9e8ed423ea..a925d26996 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -810,9 +810,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 1169237905..f8a6d905fb 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -775,7 +775,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)) {