From patchwork Fri Dec 16 21:42:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 634502 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1088731pvb; Fri, 16 Dec 2022 14:33:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf4WZ8uBoZ25nQftYOnkA6EVJh7nsG7IsPRIIkXdMgeYqTYywCfR6jaomdeVRYMR/ea9YPgH X-Received: by 2002:a05:6214:449c:b0:4da:ef71:14b0 with SMTP id on28-20020a056214449c00b004daef7114b0mr41915582qvb.50.1671230015869; Fri, 16 Dec 2022 14:33:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671230015; cv=none; d=google.com; s=arc-20160816; b=srP8IebV5c4p6/KnnZMoRRiZkpdcchDYQFSUoHVJW0qN8BxmWgSrBbdhijqduDK5gf 2Q8XleZ7ez8fqVybRUbwF8j1iMpExqAILZFWr9DfyyhCC2f9Yq+JNZt6uert5T110xsa 3nC9mbjFnHX4uZLDHKxfkbctO4Q8I6B4wRhcqBFR0d5mJSwm/vkhB17ZKao38ilsPx3w Ou7CDTIlvNCmjWSF64LqSwn2Uqwy137WeE7Fog4K7R66MkC4yyC4R6zHWwxdsGTTJ+Jg ZoXTipb1Nw2AN0ypJmhbSd1EGi7C3fALHRjqfELLbqGTzX+1PI8gYAJ/PcVdsxsysc5P AV6w== 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=NmHc1iW2xf801WdjGgkjhtPtQcaDJVi1vDsYl4gELPE=; b=k++yCqS7VCpmyLJt4BMPR1C5GhoXaDeQN/fuRchNLuERPmXFGETASl5+mq40p7goXV eOxLBYx9q+QAj6KaK0ZnGLLrsUsjeDcjXnXyJYdzB/Y/tH64gnaF0wC473NxN173WBGv c0XbFHW7Fjwq7sOSTKHtlu6Z2FuMtohquWdQv8SSc0FjAQJlLog0ebRtjfYafA85U4ZY yN0faxiEg8eOXrArbDBiGMLJKVmbQbIqguBssNL0YP57Ua86JohOopbT81CZLn4PPXzx F5wED920B6IAkboNuTliWcHWbhwq3deWyPJ3PF9XbkTQv5woTpsjzMu+Gyo1CNwvP7jD RodA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sJs61Y9r; 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 mr13-20020a056214348d00b004c684733a3bsi1423150qvb.514.2022.12.16.14.33.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Dec 2022 14:33:35 -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=sJs61Y9r; 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 1p6IV5-0006lp-Mq; Fri, 16 Dec 2022 16:44:15 -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 1p6IU7-00063T-8k for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:15 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6IU5-0000ck-Gg for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:14 -0500 Received: by mail-wm1-x32d.google.com with SMTP id f13-20020a1cc90d000000b003d08c4cf679so2678562wmb.5 for ; Fri, 16 Dec 2022 13:43:13 -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=NmHc1iW2xf801WdjGgkjhtPtQcaDJVi1vDsYl4gELPE=; b=sJs61Y9rk7oSJyORF5J4o54KW7CWbVbFYwkwP2Lm4ShEBQdC6ZIiHxUVFDw3pV6Zgu aAEXxF2yCCwEx2BCaSwrIwcIVqUD59tVYKpFp9koov0cuMMgP/nSI29dGeZ85It3vdaN 3cvHzuTKTua4kRSJfKLAxE/xLonAPOqFTtXXU/1y+Rk9ZufMF8Cz90gH2jaTTe9WDytv isdEd8OyBzo7dcBQvFGfCoGtacLi7YGnNtmEscwr7LbfivRIaL3AnFTnUmPh9BlZ1Sde QOkNW5460W2rL+7VHa9Hby1VGL4+/5xw1WpguifNiCmz2qgLVjmRQSibeRqbI3L8PIC4 Gkcg== 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=NmHc1iW2xf801WdjGgkjhtPtQcaDJVi1vDsYl4gELPE=; b=LOl/QhzYGt5DHlNaiQlhKDpUFbfqLIWmIMIcalk70Ek23ad5uODzyASUlo9KdpQGWP Lf8WYsYl8Z+q6/7Gg+tNmm3qY+KFtjmuRRSHmS9u0bJeoQYvxGPJ3jxIG//wYYDY4pvj dO0Zy0zMvGaOMCstzSqXU7y6gpn6t6eRQ0HPY0ShNe4vDGcWYJ1YEGu1wPdaOmLMGQR1 f7OTTqqStt+NeOBZoHbqNHLXX2AsnnbD5MNkGInmxsz+PMMQWOzN8Lru5bwpyRdHAVqn YsTR2BxsT4Qz0/hcTsZv+EaHyt/LhNqPcJF2P8PfxSCs9/WL+nlSWpgb/8MITLBDWNNY kLPQ== X-Gm-Message-State: ANoB5pk2+YYDbunkdkcsNo+mUHzGRusR6dbqCBXBFzvx+i69BSO3SJ8j d3SRvA/eL/mhYEo7aPbCx9xllhFm5yiGucGk X-Received: by 2002:a05:600c:3555:b0:3d0:8643:caf1 with SMTP id i21-20020a05600c355500b003d08643caf1mr18952734wmq.16.1671226992735; Fri, 16 Dec 2022 13:43:12 -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.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 13:43:12 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/36] target/tricore: Convert to 3-phase reset Date: Fri, 16 Dec 2022 21:42:36 +0000 Message-Id: <20221216214244.1391647-29-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::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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 tricore 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 Reviewed-by: Greg Kurz Reviewed-by: Mark Cave-Ayland Message-id: 20221124115023.2437291-19-peter.maydell@linaro.org --- target/tricore/cpu-qom.h | 2 +- target/tricore/cpu.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/target/tricore/cpu-qom.h b/target/tricore/cpu-qom.h index ee24e9fa76a..612731daa09 100644 --- a/target/tricore/cpu-qom.h +++ b/target/tricore/cpu-qom.h @@ -32,7 +32,7 @@ struct TriCoreCPUClass { /*< public >*/ DeviceRealize parent_realize; - DeviceReset parent_reset; + ResettablePhases parent_phases; }; diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 2c54a2825f8..594cd1efd5e 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -68,14 +68,16 @@ static void tricore_restore_state_to_opc(CPUState *cs, env->PC = data[0]; } -static void tricore_cpu_reset(DeviceState *dev) +static void tricore_cpu_reset_hold(Object *obj) { - CPUState *s = CPU(dev); + CPUState *s = CPU(obj); TriCoreCPU *cpu = TRICORE_CPU(s); TriCoreCPUClass *tcc = TRICORE_CPU_GET_CLASS(cpu); CPUTriCoreState *env = &cpu->env; - tcc->parent_reset(dev); + if (tcc->parent_phases.hold) { + tcc->parent_phases.hold(obj); + } cpu_state_reset(env); } @@ -180,11 +182,13 @@ static void tricore_cpu_class_init(ObjectClass *c, void *data) TriCoreCPUClass *mcc = TRICORE_CPU_CLASS(c); CPUClass *cc = CPU_CLASS(c); DeviceClass *dc = DEVICE_CLASS(c); + ResettableClass *rc = RESETTABLE_CLASS(c); device_class_set_parent_realize(dc, tricore_cpu_realizefn, &mcc->parent_realize); - device_class_set_parent_reset(dc, tricore_cpu_reset, &mcc->parent_reset); + resettable_class_set_parent_phases(rc, NULL, tricore_cpu_reset_hold, NULL, + &mcc->parent_phases); cc->class_by_name = tricore_cpu_class_by_name; cc->has_work = tricore_cpu_has_work;