From patchwork Fri Dec 16 21:42:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 634441 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1071657pvb; Fri, 16 Dec 2022 13:51:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4bR2+yOt1gojxP/kHQ0O3lWSCYa6QTlBx/qDkF2MyPObAOPI4TyGE/hCVjdGS900JQLC8I X-Received: by 2002:ac8:7949:0:b0:3a8:991:bfa5 with SMTP id r9-20020ac87949000000b003a80991bfa5mr38147604qtt.44.1671227513637; Fri, 16 Dec 2022 13:51:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671227513; cv=none; d=google.com; s=arc-20160816; b=Q4tk+u1S2tNF/lphWyNniG4tgU3AjdWIzN0/pIm+yT8ZhY6vRK8VGyVAIFVAuybWCP 8Zm+5PvEHGKNSU0cd9r9aaVNfPCh6ZugC0hB5aTvJHYwvhI3kYcNcFfbqgI6JZyOcOpn lmyXoDubV8FLXj3BZ/81ECRrSXQUBT+nQX1aBNSoLqXl/wtchde/SZwT9T75fGcZVD4U FKvfckolkVYFdLgUnez8zmTmAW+z9beND1jjYar2TAglOtT4yHxBv7XsArFgPmPlVIp6 FJyo1sfWDWU0L0MfWdrcvAbllW+By5YSO2aEYrAvDNVNF27dCx1FZDYtJaGQro1AnLvo Qa9g== 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=NlLR2z3qolE9UkVci7mw2GXgMx349fCTP5JUzSE62RQ=; b=ERIs+Tc3hO0gegV9PURRkZHZXXaeUsesfJm/GWSZTAFt7dmdVeSdlbWOk3HstX3YlH lBdrLXSJN9sey0q07bPcqrcwY+plb9zg3pYWZ6kM5ydwG4l1KdCUa4OY6mZPE/sRH/CF bsqMx/O1YM2T+PIux2EjzhQlwS8U1gdrAEzL/p3QXWsxFQDGhZYSYaSfw2aMNCnF81E+ 2+GejvtQu9wD+dH0xTj5uaVJgV8UDx1Az07CGFWqagEsaGu1ykD8O078sYi1dOOCi9Fy d1t5GlP5etX48QesJkY59Sey7x/fIKUhvp8dGx3eZeq0MqKGtj5OuWlyYPM08LSUrb4Z MiBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bScts5i5; 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 r13-20020ac867cd000000b0039a1d73d2dcsi1509587qtp.226.2022.12.16.13.51.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Dec 2022 13:51:53 -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=bScts5i5; 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 1p6IU4-00061Z-EU; Fri, 16 Dec 2022 16:43:12 -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 1p6ITu-0005wt-M5 for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:06 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6ITs-0000ag-QB for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:02 -0500 Received: by mail-wm1-x330.google.com with SMTP id ay14-20020a05600c1e0e00b003cf6ab34b61so5001336wmb.2 for ; Fri, 16 Dec 2022 13:43:00 -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=NlLR2z3qolE9UkVci7mw2GXgMx349fCTP5JUzSE62RQ=; b=bScts5i56vU/uLIcXiRNf5AUdcGkeLW/PbIaYPQDLAKftZ0zUFClUy1QiLY5G/mFv8 cjiMAZLn/f9h54F0QUyPR6Q/IQqPpzwBsCHOpFhCFvL8QNDyBT5ZCnVy8cPBLp0hy566 s0OVA6AsXFBl8IMs5VSdI3GPrZ9egUxh5eWAeoJQM8CQxCm7EKGU7SHhF/B6FZur5ELF 0nP9JAMSmW9jNUBwDfsj4gBE4cnP71dylBMOBvUNxo9tQ6obw+bnfVqGE+4As4b8xm0h G0Hjj4HCmdm8+JV73KL5ckyQ4oFYaWW7WhCSmtxKdQC/TBopys5bHMVFq8MHRA3Rdv9J 9hQQ== 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=NlLR2z3qolE9UkVci7mw2GXgMx349fCTP5JUzSE62RQ=; b=K/W2zd4B7z3G/7qCgKKiO7smGVzBp/QVRjiQaMo/Tk2J0SAWponU46ljaAtitWWZwu rP87/wnRR8mJSF7tkVJWCBITvPXDNSMHzymHOfzRBIfOknIC9VOhMBwGi9VCit+vDElB aoPUYBvBmODXkDf6CYSCbP3VrjTgvoETEVqLIhtlQelHVn0cPgF7UjkKc2etwltpjl+b ELmkojwLkgPu9pQ+fmu3MKPX5u2uDry3Ko/5nSNQhTb62t0Def5C/NSbRuLbRtFriuQ+ lWqGVQQLZ5B025DxjPam8o9HGrSCVy4Vn4us1A9HC4GGp/rriU5Lfw0oB2T+d7ogf1kT 4oYg== X-Gm-Message-State: AFqh2koxjrSiFoP7zcS6nhmk70GQR0FnQWzDqnIj448xHnH1pq9ZrvFv Es37d0BnJCji8ZEsKWmYeCDJPSvN3LyWwoU4 X-Received: by 2002:a05:600c:1e29:b0:3d3:404a:8a1b with SMTP id ay41-20020a05600c1e2900b003d3404a8a1bmr3957083wmb.8.1671226980085; Fri, 16 Dec 2022 13:43:00 -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.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 13:42:59 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/36] target/hexagon: Convert to 3-phase reset Date: Fri, 16 Dec 2022 21:42:23 +0000 Message-Id: <20221216214244.1391647-16-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::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 hexagon 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-6-peter.maydell@linaro.org --- target/hexagon/cpu.h | 2 +- target/hexagon/cpu.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 2a65a57bab3..794a0453fd4 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -137,7 +137,7 @@ typedef struct HexagonCPUClass { CPUClass parent_class; /*< public >*/ DeviceRealize parent_realize; - DeviceReset parent_reset; + ResettablePhases parent_phases; } HexagonCPUClass; struct ArchCPU { diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 03221fbdc28..658ca4ff783 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -281,14 +281,16 @@ static void hexagon_restore_state_to_opc(CPUState *cs, env->gpr[HEX_REG_PC] = data[0]; } -static void hexagon_cpu_reset(DeviceState *dev) +static void hexagon_cpu_reset_hold(Object *obj) { - CPUState *cs = CPU(dev); + CPUState *cs = CPU(obj); HexagonCPU *cpu = HEXAGON_CPU(cs); HexagonCPUClass *mcc = HEXAGON_CPU_GET_CLASS(cpu); CPUHexagonState *env = &cpu->env; - mcc->parent_reset(dev); + if (mcc->parent_phases.hold) { + mcc->parent_phases.hold(obj); + } set_default_nan_mode(1, &env->fp_status); set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status); @@ -339,11 +341,13 @@ static void hexagon_cpu_class_init(ObjectClass *c, void *data) HexagonCPUClass *mcc = HEXAGON_CPU_CLASS(c); CPUClass *cc = CPU_CLASS(c); DeviceClass *dc = DEVICE_CLASS(c); + ResettableClass *rc = RESETTABLE_CLASS(c); device_class_set_parent_realize(dc, hexagon_cpu_realize, &mcc->parent_realize); - device_class_set_parent_reset(dc, hexagon_cpu_reset, &mcc->parent_reset); + resettable_class_set_parent_phases(rc, NULL, hexagon_cpu_reset_hold, NULL, + &mcc->parent_phases); cc->class_by_name = hexagon_cpu_class_by_name; cc->has_work = hexagon_cpu_has_work;