From patchwork Fri Dec 16 21:42:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 634468 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1082514pvb; Fri, 16 Dec 2022 14:16:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf6vRWYQrUn2u82eAE+72WKYmJUPSdCyYawwloTC2+3iy2it6ZCfCkoGC/UktGD+DnhYsf05 X-Received: by 2002:a0c:c58e:0:b0:4c6:5682:887c with SMTP id a14-20020a0cc58e000000b004c65682887cmr43330260qvj.17.1671229019389; Fri, 16 Dec 2022 14:16:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671229019; cv=none; d=google.com; s=arc-20160816; b=T0JQHSCGUMFeotYpAkeKB4lHWEfKNgJbpPIsiqIzKvBbMIvd/oS52r7xhinwZAPWNq WDE+BW4qcFvO91pnVJdeTgTisaIXDc+we/CSIehvVVI34J7OkVnehKo2br9zcJon+g7/ uoQ30B100z8sgznEZdh8UbOIq2v8GOfRvi2kM3mV2B80y3+3W9eoUTtdYsQgncSC8UiO TYYp2G6h7eJrgPDKUedVXGmCWgU2kTirc4VbSyPe/K/CAh6n9XLRQ6ehozZ/sk2KsR9Y YlU/iYPMGHD44i/b7nuJhVHM7yKvIIjRe2hKXMt1KVaWl5FALbjQ4B8edZhMsCQyIXav okGg== 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=B378x5OhsXxdbYk6KqXx4tmBaBnAJUAFvnfZ7I26cuw=; b=W6TY5EJgHLreLM+SUFJGQVqKavTkBU/ygPhmHkx0g6PGtesGxCbriRwiVUZQRAQAwy eW2fdSg7cAP7rG0ZLPR5newx7W7Z4zXV62GNbRwS/LcpSmhSkJKtVlnQ/3tQfabfIWbN 0Viz8IuLTgjuZQ6bxSovvFL/pjvTpFMNhMVHnfyCMtfhTMWvvwr61RPaG2ZCGDzgOEnr bP27yGolcb2nwcp/K87kEgX6KO6kptTVu2ISUwVD9bDplJ+WgamO+M+M0Fts8meSfAQg JKrHN5v5DAgqm4l+GfLd7hb2l/ycDvmHxT7dyyg3QEBvJxTLUzyGSoicXUSadY7B0MXB i+yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="kAPsUCy/"; 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 hu15-20020a056214234f00b004ba170c195esi1687919qvb.48.2022.12.16.14.16.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Dec 2022 14:16:59 -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="kAPsUCy/"; 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 1p6IUe-0006Mu-Pc; Fri, 16 Dec 2022 16:43:48 -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 1p6IU1-00060G-5o for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:09 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6ITx-0000fr-FI for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:07 -0500 Received: by mail-wm1-x331.google.com with SMTP id p13-20020a05600c468d00b003cf8859ed1bso2706736wmo.1 for ; Fri, 16 Dec 2022 13:43:05 -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=B378x5OhsXxdbYk6KqXx4tmBaBnAJUAFvnfZ7I26cuw=; b=kAPsUCy/qj/ZQYxNQkc7OPBW5+fyTP1cmBmMZQXw22aa7Pz+1wFbiV4XI1YrQrcT/1 H1QPpVtB+90vqgRtgRF4E3KR+14nmo4XED2osQOQJOJ07wMSPUgZPaoadqWQaW1aGQsa pANCkpXvUdSwk6vkyMnGCZIQTcpz7n41wwI6dbbGj8xX1R4xvMuYl7Xmjnoxlf+qdT7A qlUvX9HHYqvpqWnSZEvJf+0rGA12LAk72Yn0ZAr2S+n3a1y9F7SRjqrcQpShUx8VpX4W 6GOBzLKcMRu08tU4fNIlurydA/j/SJ8Bwos+5ig/jhm+V134Rj+QkfzyYuYbyt1IiE6j c8hA== 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=B378x5OhsXxdbYk6KqXx4tmBaBnAJUAFvnfZ7I26cuw=; b=BpMjpDr2rlzCDIjqX4krJrfLAl3Mnv4VOyI6U2xXegcBR+EQuhpjr1XqXHeOUTLW/h 0hMjk7brETLUIinQ2aV1f8agKSJvqGoNgM4oAbhdlV/mRyIUJM+SCty0KJ9k6jrVbZ2j 2I/Q11+dWPBB9kcIMPo8sIFPGNiMZVWQ8m7nittWFFGgKRzMGyY8TXSe761C3+7DPNDi PjItK+wDML+Gm0rkclhnXdCtqRiykpkYoVgpbyNRiOU/RY2zVN4U0huI4w1DzFK62+ov vy2QA872vuunkKfoun5vCb31uPi0m5nmyyigs1bVNf+HLEJHxp/rJCpO7JN6BcKXg0r4 6Mmw== X-Gm-Message-State: AFqh2kqlDaMxdpEnLvl4AOAWRAyk/3eeJzqMgmfbbZjazHUVqCUazFXA EEU1aepWIQ5WYvmvxnLVHABqijH8qc2dcCdb X-Received: by 2002:a7b:cc85:0:b0:3d3:3c93:af5e with SMTP id p5-20020a7bcc85000000b003d33c93af5emr5337292wma.35.1671226984176; Fri, 16 Dec 2022 13:43:04 -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.43.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 13:43:03 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/36] target/microblaze: Convert to 3-phase reset Date: Fri, 16 Dec 2022 21:42:27 +0000 Message-Id: <20221216214244.1391647-20-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::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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 microblaze 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 Reviewed-by: Edgar E. Iglesias Reviewed-by: Taylor Simpson Message-id: 20221124115023.2437291-10-peter.maydell@linaro.org --- target/microblaze/cpu-qom.h | 4 ++-- target/microblaze/cpu.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/target/microblaze/cpu-qom.h b/target/microblaze/cpu-qom.h index 255b39a45df..cda9220fa99 100644 --- a/target/microblaze/cpu-qom.h +++ b/target/microblaze/cpu-qom.h @@ -30,7 +30,7 @@ OBJECT_DECLARE_CPU_TYPE(MicroBlazeCPU, MicroBlazeCPUClass, MICROBLAZE_CPU) /** * MicroBlazeCPUClass: * @parent_realize: The parent class' realize handler. - * @parent_reset: The parent class' reset handler. + * @parent_phases: The parent class' reset phase handlers. * * A MicroBlaze CPU model. */ @@ -40,7 +40,7 @@ struct MicroBlazeCPUClass { /*< public >*/ DeviceRealize parent_realize; - DeviceReset parent_reset; + ResettablePhases parent_phases; }; diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 89e493f3ff7..817681f9b21 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -162,14 +162,16 @@ static void microblaze_cpu_set_irq(void *opaque, int irq, int level) } #endif -static void mb_cpu_reset(DeviceState *dev) +static void mb_cpu_reset_hold(Object *obj) { - CPUState *s = CPU(dev); + CPUState *s = CPU(obj); MicroBlazeCPU *cpu = MICROBLAZE_CPU(s); MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_GET_CLASS(cpu); CPUMBState *env = &cpu->env; - mcc->parent_reset(dev); + if (mcc->parent_phases.hold) { + mcc->parent_phases.hold(obj); + } memset(env, 0, offsetof(CPUMBState, end_reset_fields)); env->res_addr = RES_ADDR_NONE; @@ -399,10 +401,12 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) DeviceClass *dc = DEVICE_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_CLASS(oc); + ResettableClass *rc = RESETTABLE_CLASS(oc); device_class_set_parent_realize(dc, mb_cpu_realizefn, &mcc->parent_realize); - device_class_set_parent_reset(dc, mb_cpu_reset, &mcc->parent_reset); + resettable_class_set_parent_phases(rc, NULL, mb_cpu_reset_hold, NULL, + &mcc->parent_phases); cc->class_by_name = mb_cpu_class_by_name; cc->has_work = mb_cpu_has_work;