From patchwork Fri Dec 16 21:42:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 634501 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1088710pvb; Fri, 16 Dec 2022 14:33:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PjgS/cj/GzVA1aJBqF+5ANvZVNFmy7cXHe5ujtvvdKU2IvOzg2ndBt0MER/Gb8P3GHiZe X-Received: by 2002:a0c:ed46:0:b0:4dd:6e9f:697d with SMTP id v6-20020a0ced46000000b004dd6e9f697dmr31665261qvq.25.1671230013160; Fri, 16 Dec 2022 14:33:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671230013; cv=none; d=google.com; s=arc-20160816; b=tWX9xuLL1hxjP2vmh1noaLcruIE1evPXMqPuWzyyiqw+wXUQ17as/+FhNUkJd9dWzj Fod9e6RBoPjFo7JhTPWxecYSl1nFa1ejulPbhIKTRZleFvrqAD2s+KRLUWJtt44NoQe3 kSfnSdVJpVut+jwX/nUSPMbO9NSA5JjJQeIJ7qSE0nul9/NlpjXy9bSmFLM2zPdlYB6V 3Zrje8FdxvYClo68XhR39H84YHquTXcA1uSafZ+MXoCdEqNxP4oTzgSNJey6gMeBsRr6 EDVHOX8XG8RoFs75Lr8EWukFZjcgVpWa8BiZiEZmuSe7z8qQROlBtLCeW9y1ORUVShS7 m7yA== 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:to:from :dkim-signature; bh=dunqq5wh2SHxaxGYJwoMKd8AXFWzRcMTlvb9MMShOc4=; b=0jkLCIjEkZXzNkP66UBwoHJ1VmWkXPj15HrHrHcGlV/XvmQY6UklU08yAFvxQq9C+h imPh3VUbEJtGZDrFBfpLNO8u6iNfvGa9+nkez05PokMcYpI5WQSeQtsFY+G0/OoxJmFV KJKP4cVOFPd+s1H8/LAGTzB8HCvMQKRxbn3wG4eyiivvKJzmb/5ChUU3p18COqtfItrb y6SQLk8H8owh5iIC4J+BDd81wpLE8OrXa+SZkouPuCBVXUalKxG0HvDhyX9ASd39MXmS o6kZL+L++UsW7pop3ldNP6PweE8EIg04KTBTgzCC8/7bL4lR3EVukEKIZLaEI+iptyQf clkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TLP1xrFh; 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 t19-20020a05620a451300b006f95e20a78dsi1691669qkp.556.2022.12.16.14.33.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Dec 2022 14:33:33 -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=TLP1xrFh; 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 1p6IU7-00063k-QC; Fri, 16 Dec 2022 16:43:16 -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 1p6ITt-0005wk-VA for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:05 -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 1p6ITr-0000bF-7y for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:01 -0500 Received: by mail-wm1-x333.google.com with SMTP id bi26-20020a05600c3d9a00b003d3404a89faso1997490wmb.1 for ; Fri, 16 Dec 2022 13:42:57 -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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=dunqq5wh2SHxaxGYJwoMKd8AXFWzRcMTlvb9MMShOc4=; b=TLP1xrFhSRfMUMqkyT+dTh13tj/ELikcOblvMo5R4hWvlrtYhcjuUN6HLzod2ptn1w Oqoq1DPOcKAHWBfL+Aj3n/yRsgVN+OapNb/SvOCE9SObATp7P+J2RV1OM5TB0vWJl9th bm4g6Ubj8U6N6u740R2JhQh60fjcbi2+LEZF4qpT2WC2TO7mdZ4EITBWVztM+op1CuiF LL/1Aw8uPsUC/WXlhu3tKUlwoAM9dTzKQdFShaUjG/zEAG0l8mEGTOwn70Jcg0epu6iP TnYsEj8P1lhhy7BbRzF3/AYQsGqzdrxwBz3v2hLGdJzy2Boz16fNT+5GPgboR4nlAEAg OotQ== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dunqq5wh2SHxaxGYJwoMKd8AXFWzRcMTlvb9MMShOc4=; b=41PqaYvSLc2yzR9BiOhFSMkjFrlJwc5NUKStJbZ1YXbHioMzPO23oHVvjF/XIEnN97 Egua7iPWLRHNGnZ785yk3fNfMxRFbX7kbah/muXRv2z4OQX7xKL+YYFAtcGnPgXEnWVN UNSzVDD+JWr8aYMe0jfCthILUJn4+3kVKumqn55KAENQ+tSzXhZnq7jzxOVpvbBjS5yZ hrSuv+0qvFGNYWnNfY/oTR3x4rdT7lHBkWKUOr5Iafbb7iXdpHJDQyar9v1QjP77pdWK QwQqgU5kWbyDb7FO6TVjPc2z9Rq/yZAII3QMDsR8ULP7AiEtTFmO/FVUZ3vOCNhJAe9J 5WiA== X-Gm-Message-State: ANoB5pnRM/ShBShCqJ98M4CIfRPO1H6GeER7guH9GuJZPDTEb6qaABcy Y6FV9M70f3FkjpEtFZ3XPSl7unCVzOKB8BVF X-Received: by 2002:a05:600c:3d06:b0:3c6:e60f:3f55 with SMTP id bh6-20020a05600c3d0600b003c6e60f3f55mr26989589wmb.12.1671226977379; Fri, 16 Dec 2022 13:42:57 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id y7-20020a05600c364700b003d33ab317dasm4135263wmq.14.2022.12.16.13.42.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 13:42:56 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/36] target/arm: Convert to 3-phase reset Date: Fri, 16 Dec 2022 21:42:20 +0000 Message-Id: <20221216214244.1391647-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221216214244.1391647-1-peter.maydell@linaro.org> References: <20221216214244.1391647-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: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Reviewed-by: Cédric Le Goater Message-id: 20221124115023.2437291-3-peter.maydell@linaro.org --- 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 0f55004d7e7..2fa022f62ba 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)); @@ -2211,12 +2213,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;