From patchwork Thu Nov 24 11:50:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 628316 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp298614pvb; Thu, 24 Nov 2022 03:53:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf6uS/aIk1KYfAlerGA3Gvm146LteldLmzkdzTVfGsSX6eQH16FsTkwZFDkTx9eg96rQs0uB X-Received: by 2002:a05:620a:10a9:b0:6fa:156e:4525 with SMTP id h9-20020a05620a10a900b006fa156e4525mr14716772qkk.76.1669290793317; Thu, 24 Nov 2022 03:53:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669290793; cv=none; d=google.com; s=arc-20160816; b=C9g+FPr5iSCXjhqVupawiNzvBed80qiWuP14sO92XCWIwKoS3Orc9cHdxcdmoBOwjR OC2riMm0rWXLDAKwphBBonz0eaGe8H3wz6Yu3v+rJXl6ysFZP1mlsnF8ktnCsZovmQEx gVcMuJ4C9tS+y4q16xmkB81YSb8Po9YKx/aYd4dzs0PtO/WzDiRozUusEAb6kb2pM8GC je937bN+iCsFRLfLmPDNEhL4ywV7O3WJiaK58nTxIfvx4jqPamvtMpXlbP4H+S9KNBdp +QvW1sO8ddPSwRtHKxNlH00vbe23w+zFUSla2CmhUHLzH+7tCSj+MuxcleDxLhHdb93B ZLwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gIYjvXcQb6sHTWomcsrQkP1J8MqtcGNuimz+TJGwZxU=; b=sfaJZmtVA51vw+q5IaZCEsWzetk5dsq3oo7Wi39DHAG5GubGxP+TdHNigxfW44B7ZT YqB/spBKR4e3o/fHe2zn6XTA6nk/qc0elvO2YifNLxnV3P4uwQqAda1psu3SkTJFJaTk B41qWSg4gjwujaSBkKW0JbG2RuAix8STlgdPU3h4zgMvKKUNoC74Xi+0KMNvAqLenPbZ HWxcFzaMZEZ1bQKYg2OcVHxlVl00bDII2ut+stsC9p64IRwsLKRGLedj3WWFsSVgghjY tvaSnFQ+lMwsFgLY5SL5HVrNxs0Pxu6JevJBVL+K6wxCOwoI+IRx1j4agOm9ZM+fZRoy spGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mHXx6uT6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q23-20020a05620a2a5700b006fbeca19758si610092qkp.712.2022.11.24.03.53.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Nov 2022 03:53:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mHXx6uT6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyAkp-0003kj-UE; Thu, 24 Nov 2022 06:50:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oyAkV-0003TN-At for qemu-devel@nongnu.org; Thu, 24 Nov 2022 06:50:37 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oyAkR-0004q9-Ls for qemu-devel@nongnu.org; Thu, 24 Nov 2022 06:50:34 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5so1131247wmo.1 for ; Thu, 24 Nov 2022 03:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gIYjvXcQb6sHTWomcsrQkP1J8MqtcGNuimz+TJGwZxU=; b=mHXx6uT6wKM9UVPy7jNKt76M4YZ6wLyLVEqZgE3UyC/+O1vl/mMDsB3PnLF7vqkvZJ 0d5ea0xA4g9tVJLanjDhDCKpcxkdaXzzvkQw85yITbZZqYe3ai8B5Hb+LtQxtK9h4327 ASEAmpLkHWLAkKz3hq37WNJ9T8XH4eNe27cli0m4YvEuAUjALlzY4wbctsKrZwxv1rIx RUsoyQEppixkzpRP5oN+PHGIOVlRo7/l4dmfTfk1BQWjxFbybC3AOrMOqLulCI10/DBT jkZHN76Ka6VSwAX1wvwyRXE02KdVqYn5bRMwW4Jr8WiF38INeypFal9aJJlm6kkAAkdK zE0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gIYjvXcQb6sHTWomcsrQkP1J8MqtcGNuimz+TJGwZxU=; b=YE6p7lMjUq/BV1ClKm//mWEaH3LWgjch/o1LheAi3CobwpMBB78B2NS+/VXtzAi+q0 V0RiG9Xvi+buru9l6h0i31vVHhmlA7GOnq7Qrz6De97IfVYxxbD5FRgH71cppB3utMh8 mkgSP03IDeagyWnVvLHDfgAKDD8citcC+SiUGTLVwLNGakxMB7+HXdjxfFoQKomXvFqQ LkmThXGgXeKUOofy9zhJP+XcTPkW1hh+jFRkLR5clCmAWExOnaLpPNJBTL4JQ3j1sIcl 2nE5Ciovsgu28ZuZNh0Vxj4A+wVbcocR/8nlXb8S1N6/puvrbnBs2RjbvXEGlYF0I6id uVLg== X-Gm-Message-State: ANoB5pltgKtAkKGx359XMtTcBQSMO+/ZmYoYJ0P7pdorjSI6brnfll14 HG/zQhNXp3bsbcTbhhN3Ifck7KeQ4Lsiqw== X-Received: by 2002:a1c:7214:0:b0:3cf:7b65:76c5 with SMTP id n20-20020a1c7214000000b003cf7b6576c5mr23334105wmc.166.1669290629391; Thu, 24 Nov 2022 03:50:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f14-20020a05600c154e00b003c6f3e5ba42sm6212559wmg.46.2022.11.24.03.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 03:50:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Peter Maydell , Michael Rolnik , "Edgar E. Iglesias" , Taylor Simpson , Song Gao , Xiaojuan Yang , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Stafford Horne , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Palmer Dabbelt , Alistair Francis , Bin Meng , Yoshinori Sato , Mark Cave-Ayland , Artyom Tarasenko , Bastian Koppelmann , Max Filippov , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH for-8.0 02/19] target/arm: Convert to 3-phase reset Date: Thu, 24 Nov 2022 11:50:05 +0000 Message-Id: <20221124115023.2437291-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221124115023.2437291-1-peter.maydell@linaro.org> References: <20221124115023.2437291-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert the Arm CPU class to use 3-phase reset, so it doesn't need to use device_class_set_parent_reset() any more. Signed-off-by: Peter Maydell Reviewed-by: Cédric Le Goater Reviewed-by: Alistair Francis --- target/arm/cpu-qom.h | 4 ++-- target/arm/cpu.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h index 64c44cef2dd..514c22ced9b 100644 --- a/target/arm/cpu-qom.h +++ b/target/arm/cpu-qom.h @@ -43,7 +43,7 @@ void aarch64_cpu_register(const ARMCPUInfo *info); /** * ARMCPUClass: * @parent_realize: The parent class' realize handler. - * @parent_reset: The parent class' reset handler. + * @parent_phases: The parent class' reset phase handlers. * * An ARM CPU model. */ @@ -54,7 +54,7 @@ struct ARMCPUClass { const ARMCPUInfo *info; DeviceRealize parent_realize; - DeviceReset parent_reset; + ResettablePhases parent_phases; }; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index a021df9e9e8..5bad065579f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -202,14 +202,16 @@ static void cp_reg_check_reset(gpointer key, gpointer value, gpointer opaque) assert(oldvalue == newvalue); } -static void arm_cpu_reset(DeviceState *dev) +static void arm_cpu_reset_hold(Object *obj) { - CPUState *s = CPU(dev); + CPUState *s = CPU(obj); ARMCPU *cpu = ARM_CPU(s); ARMCPUClass *acc = ARM_CPU_GET_CLASS(cpu); CPUARMState *env = &cpu->env; - acc->parent_reset(dev); + if (acc->parent_phases.hold) { + acc->parent_phases.hold(obj); + } memset(env, 0, offsetof(CPUARMState, end_reset_fields)); @@ -2210,12 +2212,15 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) ARMCPUClass *acc = ARM_CPU_CLASS(oc); CPUClass *cc = CPU_CLASS(acc); DeviceClass *dc = DEVICE_CLASS(oc); + ResettableClass *rc = RESETTABLE_CLASS(oc); device_class_set_parent_realize(dc, arm_cpu_realizefn, &acc->parent_realize); device_class_set_props(dc, arm_cpu_properties); - device_class_set_parent_reset(dc, arm_cpu_reset, &acc->parent_reset); + + resettable_class_set_parent_phases(rc, NULL, arm_cpu_reset_hold, NULL, + &acc->parent_phases); cc->class_by_name = arm_cpu_class_by_name; cc->has_work = arm_cpu_has_work;