From patchwork Thu Nov 24 11:50:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 628319 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp298867pvb; Thu, 24 Nov 2022 03:53:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf6TF8OeM4WEJBmAlvDu5ruPBMget3bZEP23FoeMjTVOY+V1ETlHxoyqnYITmP+8YQrRcQaz X-Received: by 2002:ae9:f807:0:b0:6fa:330f:85c8 with SMTP id x7-20020ae9f807000000b006fa330f85c8mr11996155qkh.127.1669290828331; Thu, 24 Nov 2022 03:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669290828; cv=none; d=google.com; s=arc-20160816; b=Z2MGFXiMI6eDhMNlhtyz5rsVy4SKxkW91fqZZOGfSOm60oZqCt0gT2LS2knNASf791 8jIu9ZvlOc5FVfxA990+PEPi0wNtXVqsK73a3Z5c9uwiHpcBM8JjAQ7SZ7kC4j8ikq6x IyhLHeLSYJ5NIsG3H5I20MhBMB8yyEQw35dSWKu40VL/Kt+VRdXJQ8YahxuM0l7wGS8/ iN69t3aK6E2q0v9m0K1bNIj1s1ox6OPzh02q2nwLOTlezBl+eHtPykruDL0LQZ9n36Ea GdfnXsowNImVQiJmTJZaPNq4053pVSiXTwwEBCmmyj8XIHWpEBF/1P8OrLuA+Qvto0pr pI4Q== 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=YH5A0XgSQ+x7lqY+JmUugpzZ5SHd9m7aavem37GWINU=; b=zdwP9DB5lzkMjJypD8GanZtElDRm9AL6VJvw7YmMsPgcZtokKSXQReVhZJB/HtY2Xr DqaRiPMgNQbQ2R3tD3AXDKprkQwmgTdB1incAwOc3YYpbNxorYMGRqczmTR8dL02eBuF 6oBsnm2idyOX/QaMc1E93/gT9KS8DYVBkEY53mzJUlFMOGYJZ0kAEmgFzXSWOqqTNu8/ 986g1aN71/ZZEfa780Y7gdR5xP1E7flU8AU1PTQZPRLtwU8W4KNRhLEsFTkyqRgRVGzk 82C3zpwETvSaJDidhmaLCC0z+TWXPShKcOrqKyxFLIKDHOVzKTC9MHCgGvqV0MV4wuRn 5uCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uysoE+lj; 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 e1-20020ac84901000000b0039cb9395caasi455978qtq.200.2022.11.24.03.53.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Nov 2022 03:53:48 -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=uysoE+lj; 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-0003kV-IN; 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 1oyAkf-0003XL-SG for qemu-devel@nongnu.org; Thu, 24 Nov 2022 06:50:47 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oyAka-0004qF-RM for qemu-devel@nongnu.org; Thu, 24 Nov 2022 06:50:44 -0500 Received: by mail-wm1-x32b.google.com with SMTP id p16so1123715wmc.3 for ; Thu, 24 Nov 2022 03:50:40 -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=YH5A0XgSQ+x7lqY+JmUugpzZ5SHd9m7aavem37GWINU=; b=uysoE+ljouGnQ5ASsQhEK0UBx1Xru4DBOsbetk0ixTQF5fGYKtqYw7YO1upKLRGXfp 3lekh1OyKhtMXg4GmIrgJGWi3lbcqmW6oq6oc3N9rtrk1x5z3W3f+6obEnPC8i6SWxt6 YAcE+Q83VF+ks3p1FGqwr3aK2Dy7JssibAsN42gyI/rgyJHKyt/XgnRwcdwisY7Z4zEF lkJJf1aO8lWtHbf+izUuvlvv3uww/BXroyDyZnrdsKyJhPay70He3NlwGYSvXAtPqJtH 1wjebi9bqHMk8yDoKpZH5JUrbulkTWpz32Y1lLC3dxqFR1jBQkKx86lhu4fVnMB95wAF /WCA== 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=YH5A0XgSQ+x7lqY+JmUugpzZ5SHd9m7aavem37GWINU=; b=QLKW7CoAy+BFZox501pCFZhPSO1vNyAHZC1ysAnphec2j+vsnOhNO7G91YQyBND0Jh fyK6dqzQvbUu6hKOZSYkb5JnQtq03csL6SQK4YyAkkoAQsKCFYecZ6jIbqZVvcIBArUF 9ChGEAkJZxHL3QocbqdkY94Ie+EyzeYo0Ol3OoyWwt5jTmi5osz9U6D+vsD2m6HIAuBj DKBSFmo4k2TMp0EPy6VgCb+B0e/dIxbHfHAUF3K7YaHhmlsWvhhioZFs7ezkmlW1Evsp oYABmZ9c3hE2IdjEJTDPz0wKjJ/pH3b1PkEzz8vp2RVHwMJK7+0hTW+bhChDldxEeM+j JTkA== X-Gm-Message-State: ANoB5pkQux4ExILuEaa12msItwAsip5IaiUKy8MUFiUJvVDy5K/ra70v aJ4fWx6uOOjXoZB5qD74jGYkm5PpZyKstw== X-Received: by 2002:a05:600c:4e0b:b0:3cf:e850:4437 with SMTP id b11-20020a05600c4e0b00b003cfe8504437mr12993161wmq.51.1669290640170; Thu, 24 Nov 2022 03:50:40 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 03:50:39 -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 09/19] target/microblaze: Convert to 3-phase reset Date: Thu, 24 Nov 2022 11:50:12 +0000 Message-Id: <20221124115023.2437291-10-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::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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: Edgar E. Iglesias --- 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;